Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / amcvar / search_filter.html
1 [%- USE T8 %]
2 [%- USE L %]
3 [% USE HTML %]
4
5    [%- FOREACH var = variables %]
6    [%- IF var.searchable %]
7    <tr id='cvar_filter_[% var.name %]'>
8     <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
9     <td valign="top">
10
11      [%- IF var.type == 'bool' %]
12      <select name="[% filter_prefix %]cvar_[% HTML.escape(var.name) %]">
13       <option value="">---</option>
14       <option value="yes">[% 'Yes' | $T8 %]</option>
15       <option value="no">[% 'No' | $T8 %]</option>
16      </select>
17
18      [%- ELSIF var.type == 'date' %]
19      [% L.date_tag(filter_prefix _'cvar_'_ HTML.escape(var.name) _'_from') %]
20
21      [% 'to (time)' | $T8 %]
22      [% L.date_tag(filter_prefix _'cvar_'_ HTML.escape(var.name) _'_to') %]
23
24      [%- ELSIF var.type == 'number' %]
25      <select name="[% filter_prefix %]cvar_[% HTML.escape(var.name) %]_qtyop">
26       <option selected>==</option>
27       <option>=/=</option>
28       <option>&gt;</option>
29       <option>&gt;=</option>
30       <option>&lt;</option>
31       <option>&lt;=</option>
32      </select>
33      <input name="[% filter_prefix %]cvar_[% HTML.escape(var.name) %]"[% IF var.maxlength %]maxlength="[% HTML.escape(var.maxlength) %]"[% END %]>
34
35      [%- ELSIF var.type == 'customer' %]
36      <input name="[% filter_prefix %]cvar_[% var.name | html %]">
37
38      [% ELSIF var.type == 'select' %]
39      <select name="[% filter_prefix %]cvar_[% HTML.escape(var.name) %]">
40       <option value="" selected>---</option>
41       [%- FOREACH option = var.OPTIONS %]
42       <option>[% HTML.escape(option.value) %]</option>
43       [%- END %]
44      </select>
45
46      [%- ELSE %]
47      <input name="[% filter_prefix %]cvar_[% HTML.escape(var.name) %]"[% IF var.maxlength %]maxlength="[% HTML.escape(var.maxlength) %]"[% END %]>
48
49      [%- END %]
50     </td>
51    </tr>
52    [%- END %]
53    [%- END %]
54 [% IF hidden_cvar_filters %]
55   <tr class="cvar_filter-toggle-wrapper">
56     <td></td>
57     <td colspan="3">
58       <a href="javascript:void(0);" class="cvar_filter-toggle"><i>[% 'click here to edit cvars' | $T8 %]</i></a>
59     </td>
60   </tr>
61   <script type='text/javascript'>
62     $(function(){
63       $('[id^="cvar_filter_"]').hide();
64       $('[id^="l_cvartd_"]').hide();
65
66       $('a.cvar_filter-toggle').click(function(){
67         $(".cvar_filter-toggle-wrapper").hide();
68         $('[id^="cvar_filter"]').show();
69         $('[id^="l_cvartd_"]').show();
70       });
71     });
72   </script>
73 [% END %]