Sortieren von Einheiten auf Drag-n-Drop & AJAX mittels jQuery UI Sortable umgestellt
[kivitendo-erp.git] / templates / webpages / am / edit_units.html
1 [%- USE T8 %][%- USE LxERP %][% USE L %]
2 [% USE HTML %]
3
4 <script type="text/javascript" src="js/jquery-ui.js"></script>
5
6 <body>
7
8  [% IF saved_message %]
9   <p>[% saved_message %]</p>
10
11   <hr>
12  [% END %]
13
14  <form method="post" action="[% HTML.escape(script) %]">
15
16  <input type="hidden" name="type" value="unit">
17
18  <table width="100%">
19   <tr>
20    <th class="listtop" colspan="2">[% title %]</th>
21   </tr>
22   <tr height="5"></tr>
23  </table>
24
25  <p>
26   [% LxERP.t8('All units have either no or exactly one base unit of which they are multiples.') %]
27   [% LxERP.t8('If you select a base unit then you also have to enter a factor.') %]
28   [% LxERP.t8('You have to define a unit as a multiple of a smaller unit.') %]
29   [% LxERP.t8('Therefore the definition of "kg" with the base unit "g" and a factor of 1000 is valid while defining "g" with a base unit of "kg" and a factor of "0.001" is not.') %]
30  </p>
31
32  <hr>
33
34  <table width="100%">
35   <tr><th class="listtop">[% 'Add unit' | $T8 %]</th></tr>
36  </table>
37
38  <table>
39   <tr>
40    <th align="right">[% 'Unit' | $T8 %]</th>
41    <td><input name="new_name" size="20" maxlength="20"></td>
42   </tr>
43   <tr>
44    <th align="right">[% 'Base unit' | $T8 %]</th>
45    <td>
46     <select name="new_base_unit">
47      [% FOREACH row = NEW_BASE_UNIT_DDBOX %]<option [% row.selected %]>[% row.name %]</option>[% END %]
48     </select>
49    </td>
50   </tr>
51   <tr>
52    <th align="right">[% 'Factor' | $T8 %]</th>
53    <td><input name="new_factor"></td>
54   </tr>
55
56   [% FOREACH language = LANGUAGES %]
57    <tr>
58     <th align="right">[% language.description %]</th>
59     <td><input name="new_localized_[% language.id %]" size="20" maxlength="20"></td>
60     <th align="right">[% 'Plural' | $T8 %]</th>
61     <td><input name="new_localized_plural_[% language.id %]" size="20" maxlength="20"></td>
62    </tr>
63   [% END %]
64  </table>
65
66  <input type="submit" class="submit" name="action" value="[% 'Add' | $T8 %]">
67
68  <hr>
69
70  <table width="100%">
71   <tr><th class="listtop">[% 'Edit units' | $T8 %]</th></tr>
72  </table>
73
74  <p>
75   [% 'Units that have already been used (e.g. for parts and services or in invoices or warehouse transactions) cannot be changed.' | $T8 %]
76  </p>
77
78  <p>
79   [% 'Units marked for deletion will be deleted upon saving.' | $T8 %]
80  </p>
81
82  <p>
83   [% 'You can declare different translations for singular and plural for each unit (e.g. &quot;day&quot; and &quot;days).' | $T8 %]
84  </p>
85
86  <table id="unit_list">
87   <thead>
88   <tr class="listheading">
89    <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
90    <th>[% 'Delete' | $T8 %]</th>
91    <th>[% 'Unit' | $T8 %]</th>
92    <th>[% 'Base unit' | $T8 %]</th>
93    <th>[% 'Factor' | $T8 %]</th>
94    [% FOREACH language = LANGUAGES %]
95     <th>[% language.description %]</th>
96    [% END %]
97   </tr>
98   </thead>
99
100   <tbody>
101   [% FOREACH row = UNITS %]
102    <tr class="listrow[% loop.count % 2 %]" id="unit_id_[% row.id %]">
103     <td align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
104     [% IF row.in_use %]
105      <td>
106       <input type="hidden" name="unchangeable_[% loop.count %]" value="1">
107       <input type="hidden" name="old_name_[% loop.count %]" value="[% HTML.escape(row.name) %]">
108      </td>
109
110      <td>[% HTML.escape(row.name) %]</td>
111      <td>[% IF row.base_unit %][% HTML.escape(row.base_unit) %][% ELSE %]---[% END %]</td>
112      <td>[% IF row.base_unit %][% HTML.escape(row.factor) %][% ELSE %]---[% END %]</td>
113
114      [% ELSE %]
115
116      <td align="center"><input type="checkbox" name="delete_[% loop.count %]"></td>
117      <td>
118       <input type="hidden" name="old_name_[% loop.count %]" value="[% HTML.escape(row.name) %]">
119       <input name="name_[% loop.count %]" size="10" maxlength="20" value="[% HTML.escape(row.name) %]">
120      </td>
121      <td>
122       <select name="base_unit_[% loop.count %]">
123        [% FOREACH option = row.BASE_UNIT_DDBOX %]<option [% option.selected %]>[% HTML.escape(option.name) %]</option>[% END %]
124       </select>
125      </td>
126      <td><input name="factor_[% loop.count %]" size="8" value="[% row.factor %]"></td>
127     [% END %]
128
129     [% FOREACH language = row.UNITLANGUAGES %]
130      <td>
131       [% 'singular first char' | $T8 %]:
132       <input name="localized_[% language.idx %]_[% language.language_id %]" value="[% HTML.escape(language.localized) %]" size="6" maxlength="20">
133       [% 'plural first char' | $T8 %]:
134       <input name="localized_plural_[% language.idx %]_[% language.language_id %]" value="[% HTML.escape(language.localized_plural) %]" size="6" maxlength="20">
135      </td>
136     [% END %]
137    </tr>
138   [% END %]
139   </tbody>
140  </table>
141
142  <input type="hidden" name="rowcount" value="[% UNITS.size %]">
143
144  <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
145
146  </form>
147
148  [% L.sortable_element('#unit_list tbody', 'url' => 'controller.pl?action=Unit/reorder', 'with' => 'unit_id') %]
149
150 </body>
151 </html>