Neuer Part Controller
[kivitendo-erp.git] / templates / webpages / part / _assembly.html
diff --git a/templates/webpages/part/_assembly.html b/templates/webpages/part/_assembly.html
new file mode 100644 (file)
index 0000000..1e2bbd1
--- /dev/null
@@ -0,0 +1,99 @@
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE L %]
+
+<div id="assembly" name="assembly">
+
+<h2>[% 'Assembly items' | $T8 %]</h2>
+
+[% L.hidden_tag('assembly_id', SELF.part.id) %]
+
+<table id="assembly_items">
+ <thead>
+   <tr class="listheading">
+     <th class="listheading" style='display:none'></th>
+     [% IF SELF.orphaned %]
+     <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
+     [% END %]
+     <th class="listheading" nowrap width="3" >[%- 'position'     | $T8 %] </th>
+     [% IF SELF.orphaned %]
+     <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
+     [% END %]
+     <th id="partnumber_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Part.reorder_items("partnumber")' >[%- 'Partnumber'  | $T8 %]</a></th>
+     <th id="partdescription_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Part.reorder_items("description")' >[%- 'Description' | $T8 %]</a></th>
+     <th id="qty_header_id"         class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Part.reorder_items("qty")'        >[%- 'Qty'         | $T8 %]</a></th>
+     <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
+     <th class="listheading" nowrap width="5" >[%- 'BOM'          | $T8 %] </th>
+     <th class="listheading" nowrap width="5" >[%- 'Line Total'   | $T8 %] </th>
+     <th id="sellprice_header_id"   class="listheading" nowrap width="10" ><a href='#' onClick='javascript:kivi.Part.reorder_items("sellprice")' >[%- 'Sellprice'       | $T8 %]</a></th>
+     <th id="lastcost_header_id"   class="listheading" nowrap width="10" ><a href='#' onClick='javascript:kivi.Part.reorder_items("lastcost")'   >[%- 'Lastcost'       | $T8 %]</a></th>
+     <th id="_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Part.reorder_items("partsgroup")'         >[%- 'Group'       | $T8 %]</a></th>
+   </tr>
+ </thead>
+<tbody id="assembly_rows">
+  [% assembly_html %]
+</tbody>
+<tbody id="assembly_input">
+<tr>
+ [% IF SELF.orphaned %]
+ <td></td>
+ <td></td>
+ <td align="right">[% 'Part' | $T8 %]:</td>
+ <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>
+ <td>[%- L.button_tag("kivi.Part.add_assembly_item()", LxERP.t8("Add")) %]</td>
+ <td>[% L.button_tag('kivi.Part.show_multi_items_dialog("assembly")', LxERP.t8('Add multiple items')) %]</td>
+ [% ELSE %]
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ [% END %]
+ <td></td>
+ <td align="right">[% 'Totals' | $T8 %]:</td>
+ <td></td>
+ <td id="items_sellprice_sum" class="numeric">[%- LxERP.format_amount(items_sellprice_sum, 2, 0) %]</td>
+ <td id="items_lastcost_sum"  class="numeric">[%- LxERP.format_amount(items_lastcost_sum,  2, 0) %]</td>
+ <td id="items_sum_diff"      class="numeric">[%- LxERP.format_amount(items_sum_diff,      2, 0) %]</td>
+</tr>
+<tr>
+ [% IF SELF.orphaned %]
+ <td></td>
+ <td></td>
+ [% END %]
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td align="right">[% L.button_tag("kivi.Part.set_assembly_sellprice()", LxERP.t8("Set sellprice")) %]</td>
+ <td></td>
+</tr>
+</tbody>
+</table>
+
+[% L.sortable_element('#assembly_rows') %]
+
+<div>
+<p>
+</p>
+</div>
+
+
+</div>
+
+<script type="text/javascript">
+  $(function() {
+    $("#assembly").on( "focusout", ".recalc", function( event )  {
+      kivi.Part.assembly_recalc();
+    });
+
+    $('#assembly_rows').on('sortstop', function(event, ui) {
+      $('#assembly thead a img').remove();
+      kivi.Part.renumber_positions();
+    });
+  })
+</script>