7d262f5f245781e88b35bff4099c2b880d5f97cb
[kivitendo-erp.git] / templates / webpages / part / _assembly.html
1 [%- USE T8 %]
2 [%- USE HTML %]
3 [%- USE LxERP %]
4 [%- USE L %]
5
6 <div id="assembly" name="assembly">
7
8 <h2>[% 'Assembly items' | $T8 %]</h2>
9
10 [% L.hidden_tag('assembly_id', SELF.part.id) %]
11
12 <table id="assembly_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="5"><a href='#' onClick='javascript:kivi.Part.reorder_items("partnumber")' >[%- 'Partnumber'  | $T8 %]</a></th>
24      <th class="listheading" nowrap width="5">[% 'Type' | $T8 %]</th>
25      <th id="partdescription_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Part.reorder_items("description")' >[%- 'Description' | $T8 %]</a></th>
26      <th id="qty_header_id"         class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Part.reorder_items("qty")'        >[%- 'Qty'         | $T8 %]</a></th>
27      <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
28      <th class="listheading" nowrap width="5" >[%- 'BOM'          | $T8 %] </th>
29      <th class="listheading" nowrap width="5" >[%- 'Line Total'   | $T8 %] </th>
30      <th id="sellprice_header_id"   class="listheading" nowrap width="10" ><a href='#' onClick='javascript:kivi.Part.reorder_items("sellprice")' >[%- 'Sellprice'       | $T8 %]</a></th>
31      <th id="lastcost_header_id"   class="listheading" nowrap width="10" ><a href='#' onClick='javascript:kivi.Part.reorder_items("lastcost")'   >[%- 'Lastcost'       | $T8 %]</a></th>
32      <th id="_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Part.reorder_items("partsgroup")'         >[%- 'Group'       | $T8 %]</a></th>
33    </tr>
34  </thead>
35 <tbody id="assembly_rows">
36   [% assembly_html %]
37 </tbody>
38 <tbody id="assembly_input">
39 <tr>
40  [% IF SELF.orphaned %]
41  <td></td>
42  <td></td>
43  <td align="right">[% 'Part' | $T8 %]:</td>
44  <td>[% L.part_picker('add_items[+].parts_id'   , ''  , style='width: 300px' , class="add_assembly_item_input") %][% L.hidden_tag('add_items[].qty_as_number', 1) %]</td>
45  <td>[%- L.button_tag("kivi.Part.add_assembly_item()", LxERP.t8("Add")) %]</td>
46  <td>[% L.button_tag('kivi.Part.show_multi_items_dialog("assembly")', LxERP.t8('Add multiple items')) %]</td>
47  [% ELSE %]
48  <td></td>
49  <td></td>
50  <td></td>
51  <td></td>
52  <td></td>
53  [% END %]
54  <td></td>
55  <td align="right">[% 'Totals' | $T8 %]:</td>
56  <td></td>
57  <td id="items_sellprice_sum" class="numeric">[%- LxERP.format_amount(items_sellprice_sum, 2, 0) %]</td>
58  <td id="items_lastcost_sum"  class="numeric">[%- LxERP.format_amount(items_lastcost_sum,  2, 0) %]</td>
59  <td 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_assembly_sellprice()", LxERP.t8("Set sellprice")) %]</td>
74  <td></td>
75 </tr>
76 </tbody>
77 </table>
78
79 [% L.sortable_element('#assembly_rows') %]
80
81 <div>
82 <p>
83 </p>
84 </div>
85
86
87 </div>
88
89 <script type="text/javascript">
90   $(function() {
91     $("#assembly").on( "focusout", ".recalc", function( event )  {
92       kivi.Part.assembly_recalc();
93     });
94
95     $('#assembly_rows').on('sortstop', function(event, ui) {
96       $('#assembly thead a img').remove();
97       kivi.Part.renumber_positions();
98     });
99   })
100 </script>