epic-ts
[kivitendo-erp.git] / templates / webpages / inventory / warehouse_selection_stock.html
1 [%- USE T8 %]
2 [%- USE L %]
3 [%- USE HTML %]
4 [%- USE LxERP %]
5
6 <h1>[% title | html %]</h1>
7
8 [%- PROCESS 'common/flash.html' %]
9
10 <form name="Form" method="post" action="controller.pl">
11
12  <table>
13   <tr>
14    <th align="right" nowrap>[% 'Part' | $T8 %]</th>
15    <td>[% L.part_picker('part_id', SELF.part) %]</td>
16   </tr>
17
18   <tr>
19    <th align="right" nowrap>[% 'Destination warehouse' | $T8 %]</th>
20    <td>[% L.select_tag('warehouse_id', SELF.warehouses, default=SELF.warehouse.id, title_key='description') %]
21      [% IF SELF.warehouse.id %]
22        [% L.select_tag('bin_id', SELF.warehouse.bins, default=SELF.bin.id, title_key='description') %]
23       [%- ELSE %]
24        <span id='bin_id'></span>
25       [% END %]
26        <span id='write_default_bin_span' style='display:none'><br>[% L.checkbox_tag('write_default_bin', label=LxERP.t8('Write bin to default bin in part?')) %]</span>
27     </td>
28   </tr>
29
30   <tr>
31    <th align="right" nowrap>[% 'Charge number' | $T8 %]</th>
32    <td>[% L.input_tag('chargenumber', SELF.chargenumber, size=30) %]</td>
33   </tr>
34
35 [% IF INSTANCE_CONF.get_show_bestbefore %]
36   <tr>
37    <th align="right" nowrap>[% 'Best Before' | $T8 %]</th>
38    <td>[% L.date_tag('bestbefore', SELF.bestbefore) %]</td>
39   </tr>
40 [%- END %]
41
42   <tr>
43    <th align="right" nowrap>[% 'EAN' | $T8 %]</th>
44    <td><input name="ean" size="30" value="[% HTML.escape(ean) %]"></td>
45   </tr>
46
47   <tr>
48    <th align="right" nowrap>[% 'Quantity' | $T8 %]</th>
49    <td>
50     <input name="qty" size="10" value="[% HTML.escape(LxERP.format_amount(qty)) %]">
51 [%- IF SELF.part.unit %]
52     [% L.select_tag('unit_id', SELF.part.available_units, title_key='name', default=SELF.unit.id) %]
53 [%- ELSE %]
54     [% L.select_tag('unit_id', SELF.units, title_key='name') %]
55 [%- END %]
56    </td>
57   </tr>
58
59   <tr>
60    <th align="right" nowrap>[% 'Optional comment' | $T8 %]</th>
61    <td><input name="comment" size="60" value="[% HTML.escape(comment) %]"></td>
62   </tr>
63  </table>
64
65  <input type="hidden" name="action" value="Inventory/dispatch">
66  <input type="submit" id='action_stock' class="submit" name="action_stock" value="[% 'Stock' | $T8 %]" [% IF !SELF.part.id %]disabled[% END %]>
67 </form>
68
69 <div id='stock'>
70   [%- PROCESS 'inventory/_stock.html' %]
71 </div>
72 <div id='journal'>
73  [%- PROCESS 'inventory/_journal.html' journal=SELF.mini_journal %]
74 </div>
75
76 <script type='text/javascript'>
77 function reload_warehouse_selection () {
78   $.post("controller.pl", { action: 'Inventory/part_changed', part_id: function(){ return $('#part_id').val() } }, kivi.eval_json_result);
79   $.post("controller.pl", { action: 'Inventory/mini_stock', part_id: function(){ return $('#part_id').val() } }, kivi.eval_json_result);
80 }
81 function reload_bin_selection () {
82   $.post("controller.pl", { action: 'Inventory/warehouse_changed', warehouse_id: function(){ return $('#warehouse_id').val() } }, kivi.eval_json_result);
83 }
84 $(function(){
85   $('#part_id').change(reload_warehouse_selection);
86   $('#part_id').change(function(){
87     if ($('#part_id').val() > 0)
88       $('#action_stock').removeAttr('disabled');
89     else
90       $('#action_stock').attr('disabled', 'disabled');
91   });
92   $('#warehouse_id').change(reload_bin_selection);
93 })
94 </script>