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