Lager: Umstellung auf Verwendung vom Part-Picker
[kivitendo-erp.git] / templates / webpages / wh / warehouse_selection.html
1 [%- USE T8 %]
2 [%- USE HTML %]
3 [%- USE L %]
4 [%- USE JavaScript %][%- USE P -%]
5 <h1>[% title %]</h1>
6
7  <script type="text/javascript">
8    <!--
9       warehouses = new Array();
10       [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH warehouse = WAREHOUSES_it %]
11       warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
12       warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
13       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
14       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][0] = new Array();
15       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][0]['description'] = "---";
16       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][0]['id'] = "";
17       [% USE BINS_it = Iterator(warehouse.BINS) %][% FOREACH bin = BINS_it %]
18       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count %]] = new Array();
19       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count %]]['description'] = "[% JavaScript.escape(bin.description) %]";
20       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count %]]['id'] = [% bin.id %];
21       [% END %]
22       [% END %]
23
24       function warehouse_selected(warehouse_id, bin_id) {
25         var control = document.getElementById("bin_id");
26
27         for (var i = control.options.length - 1; i >= 0; i--) {
28           control.options[i] = null;
29         }
30
31         var warehouse_index = 0;
32
33         for (i = 0; i < warehouses.length; i++)
34           if (warehouses[i]['id'] == warehouse_id) {
35             warehouse_index = i;
36             break;
37           }
38
39         var warehouse = warehouses[warehouse_index];
40         var bin_index = 0;
41
42         for (i = 0; i < warehouse['bins'].length; i++)
43           if (warehouse['bins'][i]['id'] == bin_id) {
44             bin_index = i;
45             break;
46           }
47
48         for (i = 0; i < warehouse['bins'].length; i++) {
49           control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
50         }
51
52
53         control.options[bin_index].selected = true;
54       }
55
56       $(function() {
57         warehouse_selected(0, 0);
58         document.Form.partnumber.focus();
59       });
60      -->
61  </script>
62
63  <form name="Form" method="post" action="wh.pl">
64
65   <input type="hidden" name="nextsub" value="[% HTML.escape(nextsub) %]">
66
67   [% IF saved_message %]
68   <p>[% saved_message %]</p>
69   [% END %]
70
71   <p>
72    [% 'If you enter values for the part number and / or part description then only those bins containing parts whose part number or part description match your input will be shown.' | $T8 %]
73   </p>
74
75   <p>
76    <table>
77     <tr>
78      <th align="right" nowrap>[% 'Transfer from warehouse' | $T8 %]:</th>
79      <td>
80       <select name="warehouse_id" id="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)">
81        [%- FOREACH warehouse = WAREHOUSES %]
82        <option value="[% HTML.escape(warehouse.id) %]">[% warehouse.description %]</option>
83        [%- END %]
84       </select>
85      </td>
86     </tr>
87
88     <tr>
89      <th align="right" nowrap>[% 'Bin' | $T8 %]:</th>
90      <td><select id="bin_id" name="bin_id"></select></td>
91     </tr>
92
93     <tr>
94      <th align="right" nowrap>[% 'Limit part selection' | $T8 %]:</th>
95      <td></td>
96     </tr>
97
98     <tr>
99      <th align="right" nowrap>[% 'Part' | $T8 %]</th>
100      <td>
101       [% P.part_picker("part_id", '', size="30", part_type="part,assembly") %]
102      </td>
103     </tr>
104
105     <tr>
106      <th align="right" nowrap>[% 'Charge number' | $T8 %]</th>
107      <td><input name="chargenumber" size="30"></td>
108     </tr>
109
110     [% IF INSTANCE_CONF.get_show_bestbefore %]
111     <tr>
112      <th align="right" nowrap>[% 'Best Before' | $T8 %]</th>
113      <td>
114        [% L.date_tag('bestbefore') %]
115      </td>
116     </tr>
117     [% END %]
118
119     <tr>
120      <th align="right" nowrap>[% 'EAN' | $T8 %]</th>
121      <td><input name="ean" size="30"></td>
122     </tr>
123    </table>
124   </p>
125
126   <p>
127    <input type="submit" class="submit" name="action" value="[% 'Continue' | $T8 %]">
128   </p>
129  </form>
130