Part: multipicker verwenden
[kivitendo-erp.git] / templates / webpages / part / _assortment.html
1 [%- USE T8 %]
2 [%- USE HTML %]
3 [%- USE LxERP %]
4 [%- USE L %]
5
6 <div id="assortment" name="assortment">
7
8 <h2>[% 'Assortment items' | $T8 %]</h2>
9
10 [% L.hidden_tag('assortment_id', SELF.part.id) %]
11
12 <table id="assortment_items">
13  <thead>
14    <tr class="listheading">
15      <th class="listheading" style='display:none'></th>
16      [% IF SELF.orphaned %]
17      <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
18      [% END %]
19      <th class="listheading" nowrap width="3" >[%- 'position'     | $T8 %] </th>
20      [% IF SELF.orphaned %]
21      <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
22      [% END %]
23      <th id="partnumber_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Part.reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
24      <th id="partdescription_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Part.reorder_items("description")' >[%- 'Description' | $T8 %]</a></th>
25      <th id="qty_header_id"         class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Part.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
26      <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
27      <th class="listheading" nowrap width="5" >[%- 'Charge'       | $T8 %] </th>
28      <th class="listheading" nowrap width="5" >[%- 'Line Total'   | $T8 %] </th>
29      <th id="sellprice_header_id"   class="listheading" nowrap width="10" ><a href='#' onClick='javascript:kivi.Part.reorder_items("sellprice")'> [%- 'Sellprice'   | $T8 %]</a></th>
30      <th id="lastcost_header_id"   class="listheading" nowrap width="10" ><a href='#' onClick='javascript:kivi.Part.reorder_items("lastcost")'> [%- 'Lastcost'      | $T8 %]</a></th>
31      <th id="_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Part.reorder_items("partsgroup")'> [%- 'Partsgroup'       | $T8 %]</a></th>
32    </tr>
33  </thead>
34 <tbody id="assortment_rows">
35   [% assortment_html %]
36 </tbody>
37 <tbody id="assortment_input">
38 <tr>
39  [% IF SELF.orphaned %]
40  <td></td>
41  <td></td>
42  <td align="right">[% 'Part' | $T8 %]:</td>
43  <td>[% L.part_picker('add_items[+].parts_id', '', style='width: 300px', multiple=1, id='assortment_picker', action={set_multi_items='kivi.Part.set_multi_assortment_items'}) %]</td>
44  <td>[%- L.button_tag("kivi.Part.add_assortment_item()", LxERP.t8("Add")) %]</td>
45  <td>[% L.button_tag('$("#assortment_picker").data("part_picker").open_dialog()', LxERP.t8('Add multiple items')) %]</td>
46  <td>[% L.hidden_tag('add_items[].qty_as_number', 1) %]</td>
47  [% ELSE %]
48  <td></td>
49  <td></td>
50  <td></td>
51  <td></td>
52  <td></td>
53  <td></td>
54  [% END %]
55  <td></td>
56  <td align="right">[% 'Totals' | $T8 %]:</td>
57  <th id="items_sellprice_sum" class="numeric">[%- LxERP.format_amount(items_sellprice_sum, 2, 0) %]</td>
58  <th id="items_lastcost_sum"  class="numeric">[%- LxERP.format_amount(items_lastcost_sum,  2, 0) %]</td>
59  <th id="items_sum_diff"      class="numeric">[%- LxERP.format_amount(items_sum_diff,      2, 0) %]</td>
60 </tr>
61 <tr>
62  [% IF SELF.orphaned %]
63  <td></td>
64  <td></td>
65  [% END %]
66  <td></td>
67  <td></td>
68  <td></td>
69  <td></td>
70  <td></td>
71  <td></td>
72  <td></td>
73  <td align="right">[% L.button_tag("kivi.Part.set_assortment_sellprice()", LxERP.t8("Set sellprice")) %]</td>
74  <td align="right">[% L.button_tag("kivi.Part.set_assortment_lastcost()",  LxERP.t8("Set lastcost"))  %]</td>
75  <td></td>
76 </tr>
77 </tbody>
78 </table>
79
80 [% L.sortable_element('#assortment_rows') %]
81
82 </div>
83
84 <script type="text/javascript">
85   $(function() {
86     $("#assortment").on( "focusout", ".recalc", function( event )  {
87       kivi.Part.assortment_recalc();
88     });
89
90     $("#assortment").on( "change", ":checkbox", function( event )  {
91       kivi.Part.assortment_recalc();
92     });
93
94     $('#assortment_rows').on('sortstop', function(event, ui) {
95       $('#assortment thead a img').remove();
96       kivi.Part.renumber_positions();
97     });
98   })
99 </script>