ca5560c1035e7fbb55daba87cb1f6e8b51cfbb6e
[kivitendo-erp.git] / templates / webpages / io / ship_to.html
1 [% USE HTML %][% USE L %][% USE LxERP %][%- USE JavaScript -%]
2
3 <script type="text/javascript">
4   var addresses = [
5     { shiptoname:         "[% JavaScript.escape(vc_obj.name) %]",
6       shiptodepartment_1: "[% JavaScript.escape(vc_obj.department_1) %]",
7       shiptodepartment_2: "[% JavaScript.escape(vc_obj.department_2) %]",
8       shiptostreet:       "[% JavaScript.escape(vc_obj.street) %]",
9       shiptozipcode:      "[% JavaScript.escape(vc_obj.zipcode) %]",
10       shiptocity:         "[% JavaScript.escape(vc_obj.city) %]",
11       shiptocountry:      "[% JavaScript.escape(vc_obj.country) %]",
12       shiptocontact:      "[% JavaScript.escape(vc_obj.contact) %]",
13       shiptocp_gender:    "[% JavaScript.escape(vc_obj.cp_gender) %]",
14       shiptophone:        "[% JavaScript.escape(vc_obj.phone) %]",
15       shiptofax:          "[% JavaScript.escape(vc_obj.fax) %]",
16       shiptoemail:        "[% JavaScript.escape(vc_obj.email) %]"
17     }
18
19   [% FOREACH shipto = vc_obj.shipto %]
20     ,
21     { shiptoname:         "[% JavaScript.escape(shipto.shiptoname) %]",
22       shiptodepartment_1: "[% JavaScript.escape(shipto.shiptodepartment_1) %]",
23       shiptodepartment_2: "[% JavaScript.escape(shipto.shiptodepartment_2) %]",
24       shiptostreet:       "[% JavaScript.escape(shipto.shiptostreet) %]",
25       shiptozipcode:      "[% JavaScript.escape(shipto.shiptozipcode) %]",
26       shiptocity:         "[% JavaScript.escape(shipto.shiptocity) %]",
27       shiptocountry:      "[% JavaScript.escape(shipto.shiptocountry) %]",
28       shiptocontact:      "[% JavaScript.escape(shipto.shiptocontact) %]",
29       shiptocp_gender:    "[% JavaScript.escape(shipto.shiptocp_gender) %]",
30       shiptophone:        "[% JavaScript.escape(shipto.shiptophone) %]",
31       shiptofax:          "[% JavaScript.escape(shipto.shiptofax) %]",
32       shiptoemail:        "[% JavaScript.escape(shipto.shiptoemail) %]"
33     }
34   [% END %]
35   ];
36
37   function copy_address() {
38     var shipto = addresses[ $('#shipto_to_copy').val() ];
39     for (key in shipto)
40       $('#' + key).val(shipto[key]);
41   }
42
43   function clear_fields() {
44     var shipto = addresses[0];
45     for (key in shipto)
46       $('#' + key).val('');
47     $('#shiptocp_gender').val('m');
48   }
49
50   function clear_shipto_id_before_submit() {
51     var shipto = addresses[0];
52     for (key in shipto)
53       if ((key != 'shiptocp_gender') && ($('#' + key).val() != '')) {
54         $('#shipto_id').val('');
55         break;
56       }
57
58     $('form').submit();
59   }
60 </script>
61
62 [% select_options = [ [ 0, LxERP.t8("Billing Address") ] ] ;
63    FOREACH shipto = vc_obj.shipto ;
64      city  = shipto.shiptozipcode _ ' ' _ shipto.shiptocity ;
65      title = [ shipto.shiptoname, shipto.shiptostreet, city ] ;
66      CALL select_options.import([ [ loop.count, title.grep('\S').join("; ") ] ]) ;
67    END ;
68    '' %]
69
70  <form method="post" action="[% HTML.escape(script) %]">
71   [% L.hidden_tag("shipto_id", shipto_id) %]
72
73   <p>
74    [% LxERP.t8("Copy address from master data") %]:
75    [% L.select_tag("", select_options, id="shipto_to_copy", style="width: 400px") %]
76    [% L.button_tag("copy_address()", LxERP.t8("Copy")) %]
77    [% L.button_tag("clear_fields()", LxERP.t8("Clear fields")) %]
78   </p>
79
80   <table>
81    <tr class="listheading">
82     <th colspan="2" width="50%">[% LxERP.t8('Billing Address') %]</th>
83     <th width="50%">[% LxERP.t8('Shipping Address') %]</th>
84    </tr>
85    <tr height="5"></tr>
86    <tr>
87     <th align="right" nowrap>[%- IF vc == "customer" %][%- LxERP.t8('Customer Number') %][%- ELSE %][%- LxERP.t8('Vendor Number') %][%- END %]</th>
88     <td>[%- IF vc == "customer" %][%- HTML.escape(customernumber) %][%- ELSE %][%- HTML.escape(vendornumber) %][%- END %]</td>
89    </tr>
90    <tr>
91     <th align="right" nowrap>[% LxERP.t8('Company Name') %]</th>
92     <td>[% HTML.escape(name) %]</td>
93     <td>[% L.input_tag("shiptoname", shiptoname, "size", "35") %]</td>
94    </tr>
95    <tr>
96     <th align="right" nowrap>[% LxERP.t8('Department') %]</th>
97     <td>[% HTML.escape(department_1) %]</td>
98     <td>[% L.input_tag("shiptodepartment_1", shiptodepartment_1, "size", "35") %]</td>
99    </tr>
100    <tr>
101     <th align="right" nowrap>&nbsp;</th>
102     <td>[% HTML.escape(department_2) %]</td>
103     <td>[% L.input_tag("shiptodepartment_2", shiptodepartment_2, "size", "35") %]</td>
104    </tr>
105    <tr>
106     <th align="right" nowrap>[% LxERP.t8('Street') %]</th>
107     <td>[% HTML.escape(street) %]</td>
108     <td>[% L.input_tag("shiptostreet", shiptostreet, "size", "35") %]</td>
109    </tr>
110    <tr>
111     <th align="right" nowrap>[% LxERP.t8('Zipcode') %]</th>
112     <td>[% HTML.escape(zipcode) %]</td>
113     <td>[% L.input_tag("shiptozipcode", shiptozipcode, "size", "35") %]</td>
114    </tr>
115    <tr>
116     <th align="right" nowrap>[% LxERP.t8('City') %]</th>
117     <td>[% HTML.escape(city) %]</td>
118     <td>[% L.input_tag("shiptocity", shiptocity, "size", "35") %]</td>
119    </tr>
120    <tr>
121     <th align="right" nowrap>[% LxERP.t8('Country') %]</th>
122     <td>[% HTML.escape(country) %]</td>
123     <td>[% L.input_tag("shiptocountry", shiptocountry, "size", "35") %]</td>
124    </tr>
125    <tr>
126     <th align="right" nowrap>[% LxERP.t8('Contact') %]</th>
127     <td>[% HTML.escape(contact) %]</td>
128     <td>[% L.input_tag("shiptocontact", shiptocontact, "size", "35") %]</td>
129    </tr>
130    <tr>
131     <th align="right" nowrap>[% LxERP.t8('Gender') %]</th>
132     <td></td>
133     <td>
134      [% L.select_tag('shiptocp_gender', [ [ 'm', LxERP.t8('male') ], [ 'f', LxERP.t8('female') ] ], 'default' = shiptocp_gender) %]
135     </td>
136    </tr>
137    <tr>
138     <th align="right" nowrap>[% LxERP.t8('Phone') %]</th>
139     <td>[% HTML.escape(phone) %]</td>
140     <td>[% L.input_tag("shiptophone", shiptophone, "size", "35") %]</td>
141    </tr>
142    <tr>
143     <th align="right" nowrap>[% LxERP.t8('Fax') %]</th>
144     <td>[% HTML.escape(fax) %]</td>
145     <td>[% L.input_tag("shiptofax", shiptofax, "size", "35") %]</td>
146    </tr>
147    <tr>
148     <th align="right" nowrap>[% LxERP.t8('E-mail') %]</th>
149     <td>[% HTML.escape(email) %]</td>
150     <td>[% L.input_tag("shiptoemail", shiptoemail, "size", "35") %]</td>
151    </tr>
152   </table>
153
154   <hr size="3" noshade>
155
156   [% L.hidden_tag("action", "ship_to_entered") %]
157   [% L.hidden_tag("nextsub", nextsub) %]
158   [% L.hidden_tag("previousform", previousform) %]
159
160   [% L.button_tag("clear_shipto_id_before_submit()", LxERP.t8("Continue")) %]
161  </form>