Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / am / edit_units.html
index 6494470..00bea73 100644 (file)
@@ -1,96 +1,47 @@
-[%- USE T8 %]
-[% USE HTML %]<body>
+[%- USE T8 %][%- USE LxERP %][% USE L %]
+[% USE HTML %]
+<h1>[% title %]</h1>
 
- [% IF saved_message %]
-  <p>[% saved_message %]</p>
+[% INCLUDE "common/flash.html" %]
 
-  <hr>
- [% END %]
+[% PROCESS "am/_units_header_info.html" %]
 
- <form method="post" action="[% HTML.escape(script) %]">
+<hr>
 
- <input type="hidden" name="type" value="unit">
-
- <table width="100%">
-  <tr>
-   <th class="listtop" colspan="2">[% title %]</th>
-  </tr>
-  <tr height="5"></tr>
- </table>
-
- <p>
-  Einheiten haben entweder keine oder genau eine Basiseinheit, von der sie ein Vielfaches sind. Wenn Sie eine Basiseinheit ausw&auml;hlen, dann m&uuml;ssen Sie auch einen Faktor eingeben. Sie m&uuml;ssen Einheiten als ein Vielfaches einer kleineren Einheit eingeben. So ist die Definition von &quot;kg&quot; mit der Basiseinheit &quot;g&quot; und dem Faktor 1000 zul&auml;ssig, die Definition von &quot;g&quot; mit der Basiseinheit &quot;kg&quot; und dem Faktor &quot;0,001&quot; hingegen nicht.
- </p>
-
- <hr>
-
- <table width="100%">
-  <tr><th class="listtop">[% 'Add unit' | $T8 %]</th></tr>
- </table>
-
- <table>
-  <tr>
-   <th align="right">[% 'Unit' | $T8 %]</th>
-   <td><input name="new_name" size="20" maxlength="20"></td>
-  </tr>
-  <tr>
-   <th align="right">[% 'Base unit' | $T8 %]</th>
-   <td>
-    <select name="new_base_unit">
-     [% FOREACH row = NEW_BASE_UNIT_DDBOX %]<option [% row.selected %]>[% row.name %]</option>[% END %]
-    </select>
-   </td>
-  </tr>
-  <tr>
-   <th align="right">[% 'Factor' | $T8 %]</th>
-   <td><input name="new_factor"></td>
-  </tr>
+<p>
+ [% 'Units that have already been used (e.g. for parts and services or in invoices or warehouse transactions) cannot be changed.' | $T8 %]
+</p>
 
-  [% FOREACH language = LANGUAGES %]
-   <tr>
-    <th align="right">[% language.description %]</th>
-    <td><input name="new_localized_[% language.id %]" size="20" maxlength="20"></td>
-    <th align="right">[% 'Plural' | $T8 %]</th>
-    <td><input name="new_localized_plural_[% language.id %]" size="20" maxlength="20"></td>
-   </tr>
-  [% END %]
- </table>
+<p>
+ [% 'Units marked for deletion will be deleted upon saving.' | $T8 %]
+</p>
 
- <input type="submit" class="submit" name="action" value="[% 'Add' | $T8 %]">
+<p>
+ [% 'You can declare different translations for singular and plural for each unit (e.g. &quot;day&quot; and &quot;days).' | $T8 %]
+</p>
 
- <hr>
+<form method="post" action="[% HTML.escape(script) %]" id="form">
 
- <table width="100%">
-  <tr><th class="listtop">[% 'Edit units' | $T8 %]</th></tr>
- </table>
+ <input type="hidden" name="type" value="unit">
 
- <p>
-  [% 'Units that have already been used (e.g. for parts and services or in invoices or warehouse transactions) cannot be changed.' | $T8 %]
- </p>
-
- <p>
-  [% 'Units marked for deletion will be deleted upon saving.' | $T8 %]
- </p>
-
- <p>
-  [% 'You can declare different translations for singular and plural for each unit (e.g. &quot;day&quot; and &quot;days).' | $T8 %]
- </p>
-
- <table>
-  <tr>
-   <th class="listheading" width="32" align="center" valign="center"><img alt="[% 'up' | $T8 %]" src="image/up.png"><img alt="[% 'down' | $T8 %]" src="image/down.png"></th>
-   <th class="listheading">[% 'Delete' | $T8 %]</th>
-   <th class="listheading">[% 'Unit' | $T8 %]</th>
-   <th class="listheading">[% 'Base unit' | $T8 %]</th>
-   <th class="listheading">[% 'Factor' | $T8 %]</th>
+ <table id="unit_list">
+  <thead>
+  <tr class="listheading">
+   <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
+   <th>[% 'Delete' | $T8 %]</th>
+   <th>[% 'Unit' | $T8 %]</th>
+   <th>[% 'Base unit' | $T8 %]</th>
+   <th>[% 'Factor' | $T8 %]</th>
    [% FOREACH language = LANGUAGES %]
-    <th class="listheading">[% language.description %]</th>
+    <th>[% language.description %]</th>
    [% END %]
   </tr>
+  </thead>
 
+  <tbody>
   [% FOREACH row = UNITS %]
-   <tr>
-    <td width="32" align="center" valign="center">[% IF loop.first %]<img src="image/transparent16x16.gif">[% ELSE %]<a href="[% updownlink %]&dir=up&name=[% HTML.url(row.name) %]"><img alt="[% 'up' | $T8 %]" src="image/up.png" border="0"></a>[% END %][% IF loop.last %]<img src="image/transparent16x16.gif">[% ELSE %]<a href="[% updownlink %]&dir=down&name=[% HTML.url(row.name) %]"><img alt="[% 'down' | $T8 %]" src="image/down.png" border="0"></a>[% END %]</td>
+   <tr class="listrow[% loop.count % 2 %]" id="unit_id_[% row.id %]">
+    <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
     [% IF row.in_use %]
      <td>
       <input type="hidden" name="unchangeable_[% loop.count %]" value="1">
      </td>
     [% END %]
    </tr>
-
-   [% IF loop.last %]<input type="hidden" name="rowcount" value="[% loop.count %]">[% END %]
   [% END %]
+  </tbody>
  </table>
 
- <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
+ <input type="hidden" name="rowcount" value="[% UNITS.size %]">
 
  </form>
 
-</body>
-</html>
+ [% L.sortable_element('#unit_list tbody', url => 'controller.pl?action=Unit/reorder', with => 'unit_id') %]