Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / common / _ship_to_dialog.html
diff --git a/templates/webpages/common/_ship_to_dialog.html b/templates/webpages/common/_ship_to_dialog.html
new file mode 100644 (file)
index 0000000..cb21c4f
--- /dev/null
@@ -0,0 +1,164 @@
+[% USE HTML %][% USE L %][% USE LxERP %][%- USE JavaScript -%]
+
+<script type="text/javascript">
+  $(function() {
+    kivi.SalesPurchase.shipto_addresses = [
+      { shiptoname:         "[% JavaScript.escape(vc_obj.name) %]",
+        shiptodepartment_1: "[% JavaScript.escape(vc_obj.department_1) %]",
+        shiptodepartment_2: "[% JavaScript.escape(vc_obj.department_2) %]",
+        shiptostreet:       "[% JavaScript.escape(vc_obj.street) %]",
+        shiptozipcode:      "[% JavaScript.escape(vc_obj.zipcode) %]",
+        shiptocity:         "[% JavaScript.escape(vc_obj.city) %]",
+        shiptocountry:      "[% JavaScript.escape(vc_obj.country) %]",
+        shiptogln:          "[% JavaScript.escape(vc_obj.gln) %]",
+        shiptocontact:      "[% JavaScript.escape(vc_obj.contact) %]",
+        shiptophone:        "[% JavaScript.escape(vc_obj.phone) %]",
+        shiptofax:          "[% JavaScript.escape(vc_obj.fax) %]",
+        shiptoemail:        "[% JavaScript.escape(vc_obj.email) %]"
+      [% FOREACH var = cvars %]
+        , "shiptocvar_[% JavaScript.escape(var.config.name) %]": ""
+      [% END %]
+      }
+
+    [% FOREACH shipto = vc_obj.shipto %]
+      ,
+      { shiptoname:         "[% JavaScript.escape(shipto.shiptoname) %]",
+        shiptodepartment_1: "[% JavaScript.escape(shipto.shiptodepartment_1) %]",
+        shiptodepartment_2: "[% JavaScript.escape(shipto.shiptodepartment_2) %]",
+        shiptostreet:       "[% JavaScript.escape(shipto.shiptostreet) %]",
+        shiptozipcode:      "[% JavaScript.escape(shipto.shiptozipcode) %]",
+        shiptocity:         "[% JavaScript.escape(shipto.shiptocity) %]",
+        shiptocountry:      "[% JavaScript.escape(shipto.shiptocountry) %]",
+        shiptogln:          "[% JavaScript.escape(shipto.shiptogln) %]",
+        shiptocontact:      "[% JavaScript.escape(shipto.shiptocontact) %]",
+        shiptophone:        "[% JavaScript.escape(shipto.shiptophone) %]",
+        shiptofax:          "[% JavaScript.escape(shipto.shiptofax) %]",
+        shiptoemail:        "[% JavaScript.escape(shipto.shiptoemail) %]"
+      [% FOREACH var = shipto.cvars_by_config %]
+        , "shiptocvar_[% JavaScript.escape(var.config.name) %]": "[% JavaScript.escape(var.value_as_text) %]"
+      [% END %]
+      }
+    [% END %]
+    ];
+  });
+</script>
+
+[% select_options = [ [ 0, LxERP.t8("Billing Address") ] ] ;
+   FOREACH shipto = vc_obj.shipto ;
+     tmpcity  = shipto.shiptozipcode _ ' ' _ shipto.shiptocity ;
+     tmptitle = [ shipto.shiptoname, shipto.shiptostreet, tmpcity ] ;
+     CALL select_options.import([ [ loop.count, tmptitle.grep('\S').join("; ") ] ]) ;
+   END ;
+   '' %]
+
+<p>
+ [% LxERP.t8("Copy address from master data") %]:
+ [% L.select_tag("", select_options, id="shipto_to_copy", style="width: 300px") %]
+ [% L.button_tag("kivi.SalesPurchase.copy_shipto_address()", LxERP.t8("Copy")) %]
+</p>
+
+[% IF cs_obj ;
+  fields = ['shiptoname', 'shiptodepartment_1', 'shiptodepartment_2',
+            'shiptostreet', 'shiptozipcode', 'shiptocity', 'shiptocountry',
+            'shiptogln', 'shiptocontact', 'shiptocp_gender', 'shiptophone',
+            'shiptofax', 'shiptoemail'] ;
+  FOREACH field = fields ;
+      $field = cs_obj.$field ;
+  END ;
+END ;
+'' %]
+
+
+<table>
+ <tr class="listheading">
+  <th></th>
+  <th>[% LxERP.t8('Billing Address') %]</th>
+  <th>[% LxERP.t8('Shipping Address') %]</th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+  <th align="right" nowrap>[%- IF vc == "customer" %][%- LxERP.t8('Customer Number') %][%- ELSE %][%- LxERP.t8('Vendor Number') %][%- END %]</th>
+  <td>[%- IF vc == "customer" %][%- HTML.escape(vc_obj.customernumber) %][%- ELSE %][%- HTML.escape(vc_obj.vendornumber) %][%- END %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Company Name') %]</th>
+  <td>[% HTML.escape(vc_obj.name) %]</td>
+  <td>[% L.input_tag("shiptoname", shiptoname, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Department') %]</th>
+  <td>[% HTML.escape(vc_obj.department_1) %]</td>
+  <td>[% L.input_tag("shiptodepartment_1", shiptodepartment_1, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>&nbsp;</th>
+  <td>[% HTML.escape(vc_obj.department_2) %]</td>
+  <td>[% L.input_tag("shiptodepartment_2", shiptodepartment_2, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Street') %]</th>
+  <td>[% HTML.escape(vc_obj.street) %]</td>
+  <td>[% L.input_tag("shiptostreet", shiptostreet, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Zipcode') %]</th>
+  <td>[% HTML.escape(vc_obj.zipcode) %]</td>
+  <td>[% L.input_tag("shiptozipcode", shiptozipcode, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('City') %]</th>
+  <td>[% HTML.escape(vc_obj.city) %]</td>
+  <td>[% L.input_tag("shiptocity", shiptocity, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Country') %]</th>
+  <td>[% HTML.escape(vc_obj.country) %]</td>
+  <td>[% L.input_tag("shiptocountry", shiptocountry, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('GLN') %]</th>
+  <td>[% HTML.escape(vc_obj.gln) %]</td>
+  <td>[% L.input_tag("shiptogln", shiptogln, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Contact') %]</th>
+  <td>[% HTML.escape(vc_obj.contact) %]</td>
+  <td>[% L.input_tag("shiptocontact", shiptocontact, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Gender') %]</th>
+  <td></td>
+  <td>
+   [% L.select_tag('shiptocp_gender', [ [ 'm', LxERP.t8('male') ], [ 'f', LxERP.t8('female') ] ], 'default' = shiptocp_gender) %]
+  </td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Phone') %]</th>
+  <td>[% HTML.escape(vc_obj.phone) %]</td>
+  <td>[% L.input_tag("shiptophone", shiptophone, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('Fax') %]</th>
+  <td>[% HTML.escape(vc_obj.fax) %]</td>
+  <td>[% L.input_tag("shiptofax", shiptofax, "size", "35") %]</td>
+ </tr>
+ <tr>
+  <th align="right" nowrap>[% LxERP.t8('E-mail') %]</th>
+  <td>[% HTML.escape(vc_obj.email) %]</td>
+  <td>[% L.input_tag("shiptoemail", shiptoemail, "size", "35") %]</td>
+ </tr>
+[% FOREACH var = cvars %]
+ <tr valign="top">
+  <th align="right" nowrap>[% HTML.escape(var.config.description) %]</th>
+  <td></td>
+  <td>[% INCLUDE 'common/render_cvar_input.html' cvar_name_prefix='shiptocvar_' %]</td>
+ </tr>
+[% END %]
+</table>
+
+<p>
+ [% L.button_tag("kivi.SalesPurchase.submit_custom_shipto('" _ id_selector _ "')", LxERP.t8("Apply")) %]
+ [% L.button_tag("kivi.SalesPurchase.reset_shipto_fields()", LxERP.t8("Reset")) %]
+ [% L.button_tag("kivi.SalesPurchase.clear_shipto_fields()", LxERP.t8("Clear fields")) %]
+ [% L.button_tag("\$('#shipto_dialog').dialog('close');", LxERP.t8("Abort")) %]
+</p>