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