c6330d218d5881f885dc2da846b98eef73fc3729
[kivitendo-erp.git] / templates / webpages / io / select_item.html
1 [% USE LxERP %][% USE HTML %][% USE L %][% USE P %]
2 [% SET COLS = 8 %]
3 <h1>[% title %]</h1>
4
5  <form method="post" action="[% HTML.escape(script) %]" id="form">
6
7   <table width="100%">
8    <tr class="listheading">
9     [%- IF MYCONFIG.item_multiselect %]
10       <th>[% LxERP.t8('Qty') %]</th>
11     [%- ELSE %]
12       <th>&nbsp;</th>
13     [%- END %]
14     <th>[% LxERP.t8('Number') %]</th>
15     <th>[% LxERP.t8('Part Classification') %]</th>
16     <th>[% LxERP.t8('Part Description') %]</th>
17     [%- IF INSTANCE_CONF.get_show_longdescription_select_item %]
18       [% SET COLS = COLS + 1 %]
19       <th>[% LxERP.t8('Long Description') %]</th>
20     [%- END %]
21     <th>[% LxERP.t8('Other Matches') %]</th>
22     <th>[% LxERP.t8('Price') %]</th>
23     [%- IF IS_PURCHASE %]
24       [% SET COLS = COLS + 1 %]
25      <th>[% LxERP.t8('ROP') %]</th>
26     [%- END %]
27     <th>[% LxERP.t8('Qty') %]</th>
28     <th>[% LxERP.t8('Unit') %]</th>
29    </tr>
30
31    [%- FOREACH item = ITEM_LIST %]
32    <tr class="listrow[% loop.count % 2 %]">
33     [%- IF MYCONFIG.item_multiselect %]
34       <td>[% L.input_tag('select_qty_' _ HTML.escape(item.id), '', size => 5) %]</td>
35     [%- ELSE %]
36       <td><input name="select_item_id" class="radio" type="radio" value="[% HTML.escape(item.id) %]"[% IF loop.first %] checked[% END %]></td>
37     [%- END %]
38     <td>[% HTML.escape(item.partnumber) %]</td>
39     <td>[% HTML.escape(item.type_and_classific) %]</td>
40     <td>[% HTML.escape(item.description) %]</td>
41     [%- IF INSTANCE_CONF.get_show_longdescription_select_item %]
42       <td>[% P.restricted_html(item.longdescription) %]</td>
43     [%- END %]
44     <td>[% HTML.escape(item.matches).join('<br>') %]</td>
45     <td align="right">[% LxERP.format_amount(item.display_sellprice, 2) %]</td>
46     [%- IF IS_PURCHASE %]
47      <td align="right">[% LxERP.format_amount(item.rop, '') %]</td>
48     [%- END %]
49     <td align="right">[% LxERP.format_amount(item.onhand, '') %]</td>
50     <td>[% HTML.escape(item.unit) %]</td>
51    </tr>
52    [%- END %]
53
54    <tr><td colspan="[% COLS %]"><hr size="3" noshade></td></tr>
55   </table>
56
57   [% L.hidden_tag('select_item_mode', MODE) %]
58   [% L.hidden_tag('select_item_previous_form', PREVIOUS_FORM) %]
59   [% L.hidden_tag('action', 'item_selected') %]
60  </form>
61
62 [%- IF MYCONFIG.item_multiselect %]
63  <script type='text/javascript'>
64    var first_click = 1;;
65    [%- FOREACH item = ITEM_LIST %]
66      [% SET THIS_ID = 'select_qty_' _ HTML.escape(item.id) %]
67      $('#[% THIS_ID %]').click(function(){
68        var qty = '1';
69        if (first_click) {
70          qty = '[% LxERP.format_amount(PRE_ENTERED_QTY, 5) %]';
71        }
72        first_click = 0;
73        if ($('#[% THIS_ID %]').attr('value') == '') {
74          $('#[% THIS_ID %]').attr('value', qty); $('#[% THIS_ID %]').select();
75        }
76      });
77    [%- END %]
78  </script>
79 [%- END %]