Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / wh / warehouse_selection_assembly.html
index 74da21a..fba6b71 100644 (file)
@@ -1,8 +1,8 @@
 [%- USE T8 %]
-[% USE HTML %][% USE JavaScript %][% USE LxERP %]<body onload="on_load(); [% onload %]">
+[%- USE L %]
+[%- USE HTML %][%- USE JavaScript %][%- USE LxERP %][%- USE P -%]
+<h1>[% title %]</h1>
 
- <script type="text/javascript" src="js/common.js"></script>
- <script type="text/javascript" src="js/part_selection.js"></script>
  <script type="text/javascript">
   <!--
       warehouses = new Array();
         control.options[bin_index].selected = true;
       }
 
-      function on_load() {
+      $(function() {
         warehouse_selected([% warehouse_id %], [% bin_id %]);
-      }
+      })
     -->
  </script>
 
- <form name="Form" method="post" action="wh.pl">
-
-  <input type="hidden" name="nextsub" value="transfer_assembly">
-  <input type="hidden" name="update_nextsub" value="transfer_assembly_update_part">
+ <form name="Form" method="post" action="wh.pl" id="form">
 
   [% IF saved_message %]
   <p>[% saved_message %]</p>
   [% END %]
 
-  <div class="listtop">[% title %]</div>
-
   <p>
    <table>
+    <tr>
+     <th align="right" nowrap>[% 'Assembly' | $T8 %]</th>
+     <td>
+      [% P.part.picker("parts_id", parts_id, part_type="assembly", class="initial_focus", fat_set_item="1") %]
+     </td>
+    </tr>
+
     <tr>
      <th align="right" nowrap>[% 'Destination warehouse' | $T8 %]</th>
      <td>
-      <select name="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)">
+      <select name="warehouse_id" id="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)">
        [%- FOREACH warehouse = WAREHOUSES %]
        <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
        [%- END %]
      <td><select id="bin_id" name="bin_id"></select></td>
     </tr>
 
-    <tr>
-     <th align="right" nowrap>[% 'Assembly Number' | $T8 %]</th>
-     <td>
-      <input type="hidden" name="parts_id" id="parts_id" value="[% HTML.escape(parts_id) %]">
-      <input type="hidden" name="old_partnumber" id="old_partnumber" value="[% HTML.escape(partnumber) %]">
-      <input name="partnumber" size="30" value="[% HTML.escape(partnumber) %]">
-     </td>
-    </tr>
-
-    <tr>
-     <th align="right" nowrap>[% 'Assembly Description' | $T8 %]</th>
-     <td>
-      <input name="description" size="30" value="[% HTML.escape(description) %]">
-      <input type="button" onclick="part_selection_window('partnumber', 'description', 'parts_id', 0, 'Form', 'assemblies:click_button=update_button')" value="?">
-     </td>
-    </tr>
-
     <tr>
      <th align="right" nowrap>[% 'Charge number' | $T8 %]</th>
      <td><input name="chargenumber" size="30" value="[% HTML.escape(chargenumber) %]"></td>
     </tr>
 
-    [% IF conf_show_best_before %]
+    [% IF INSTANCE_CONF.get_show_bestbefore %]
     <tr>
      <th align="right" nowrap>[% 'Best Before' | $T8 %]</th>
      <td>
-       <input name="bestbefore" id="bestbefore" size="11" value="[% HTML.escape(bestbefore) %]" title="[% myconfig_dateformat %]">
-       <input type="button" name="b_bestbefore" id="bestbefore_trigger" value="?">
+      [% L.date_tag('bestbefore', bestbefore) %]
      </td>
     </tr>
     [% END %]
 
    </table>
   </p>
-
-  <p>
-   <input type="submit" class="submit" name="action" id="update_button" value="[% 'Update' | $T8 %]">
-   [%- IF parts_id %]
-   <input type="submit" class="submit" name="action" value="[% 'Create Assembly' | $T8 %]">
-   [%- END %]
-  </p>
  </form>
 
- [% IF conf_show_best_before %]
- <script type="text/javascript">
-   <!--
-     Calendar.setup( {
-     inputField : "bestbefore",
-     ifFormat :"[% myconfig_jsc_dateformat %]",
-     align : "BR",
-     button : "bestbefore_trigger"
-     });
-   //-->
- </script>
- [% END %]
-
-</body>
-</html>
+<script type='text/javascript'>
+$(function(){
+  $('#parts_id').on('set_item:PartPicker', function(event, item) {
+    if (!item.warehouse_id)
+      return;
+
+    $('#warehouse_id').val(item.warehouse_id);
+    warehouse_selected(item.warehouse_id, item.bin_id);
+  });
+})
+</script>