]> wagnertech.de Git - mfinanz.git/blob - templates/design40_webpages/custom_variable_config/form.html
date error in mapping
[mfinanz.git] / templates / design40_webpages / custom_variable_config / form.html
1 [% USE HTML -%]
2 [% USE LxERP -%]
3 [% USE L -%]
4 [% USE T8 -%]
5
6 <h1>[% HTML.escape(title) %]</h1>
7
8 <div class="wrapper">
9 <form action="controller.pl" method="post" id="form">
10  [% L.hidden_tag("id", SELF.config.id) %]
11
12 <table class="tbl-horizontal">
13   <caption>[% 'Custom Variable' | $T8 %]</caption>
14   <colgroup><col class="wi-normal"><col class="wi-wide"></colgroup>
15   <tbody>
16     <tr>
17       <th>[% 'Module' | $T8 %]</th>
18       <td>[% L.select_tag('module', SELF.modules, value_key='module', title_key='description', default=SELF.module, onchange="update_ic_rows();", class="wi-wide") %]</td>
19     </tr>
20     <tr>
21       <th>[% 'Variable Name' | $T8 %]<sup>(1)</sup></th>
22       <td>[% L.input_tag("config.name", SELF.config.name, class='initial_focus wi-wide') %]</td>
23     </tr>
24     <tr>
25       <th>[% 'Variable Description' | $T8 %]<sup>(2)</sup></th>
26       <td>[% L.input_tag("config.description", SELF.config.description, class='wi-wide') %]</td>
27     </tr>
28     <tr>
29       <th>[% 'Type' | $T8 %]<sup>(3)</sup></th>
30       <td>[% L.select_tag("config.type", SELF.translated_types, value_key='type', title_key='translation', default=SELF.config.type, class='wi-normal') %]</td>
31     </tr>
32     <tr>
33       <th>[% 'Default value' | $T8 %]<sup>(4)</sup></th>
34       <td>[% L.input_tag("config.default_value", SELF.config.type == 'number' ? LxERP.format_amount(SELF.config.default_value, 2) : SELF.config.default_value, class='wi-wide') %]</td>
35     </tr>
36     <tr>
37       <th>[% 'Options' | $T8 %]<sup>(5)</sup></th>
38       <td>
39         [% L.textarea_tag("config.options", SELF.config.options, cols='5' rows='3' class='wi-wide') %]
40       </td>
41     </tr>
42     <tr>
43       <th>[% 'Is Searchable' | $T8 %]</th>
44       <td class="horizontal">
45         [% L.radio_button_tag('config.searchable', value='1', id='config_searchable_1', label=LxERP.t8('Yes'), checked=(SELF.config.searchable ?  1 : '')) %]
46         [% L.radio_button_tag('config.searchable', value='0', id='config_searchable_0', label=LxERP.t8('No'),  checked=(SELF.config.searchable ? '' :  1)) %]
47       </td>
48     </tr>
49     <tr>
50       <th>[% 'Includeable in reports' | $T8 %]</th>
51       <td class="horizontal">
52         [% L.radio_button_tag('config.includeable', value='1', id='config_includeable_1', label=LxERP.t8('Yes'), checked=(SELF.config.includeable ?  1 : ''), onclick='update_included_by_default()') %]
53         [% L.radio_button_tag('config.includeable', value='0', id='config_includeable_0', label=LxERP.t8('No'),  checked=(SELF.config.includeable ? '' :  1), onclick='update_included_by_default()') %]
54       </td>
55     </tr>
56     <tr>
57       <th>[% 'Included in reports by default' | $T8 %]</th>
58       <td class="horizontal">
59         [% SET disabled = SELF.config.includeable ? '' : 'disabled' %]
60         [% L.radio_button_tag('config.included_by_default', value='1', id='config_included_by_default_1', label=LxERP.t8('Yes'), checked=(SELF.config.included_by_default ?  1 : ''), disabled=disabled) %]
61         [% L.radio_button_tag('config.included_by_default', value='0', id='config_included_by_default_0', label=LxERP.t8('No'),  checked=(SELF.config.included_by_default ? '' :  1), disabled=disabled) %]
62       </td>
63     </tr>
64     <tr data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
65       <th>[% 'Editable' | $T8 %]<sup>(6)</sup></th>
66       <td class="horizontal">
67         [% L.radio_button_tag('config.flag_editable', value='1', id='config.flag_editable_1', label=LxERP.t8('Yes'), checked=(SELF.flags.editable ?  1 : '')) %]
68         [% L.radio_button_tag('config.flag_editable', value='0', id='config.flag_editable_0', label=LxERP.t8('No'),  checked=(SELF.flags.editable ? '' :  1)) %]
69       </td>
70     </tr>
71     <tr data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
72       <th>[% 'Deactivate by default' | $T8 %]<sup>(7)</sup></th>
73       <td class="horizontal">
74         [% L.radio_button_tag('config.flag_defaults_to_invalid', value='1', id='config.flag_defaults_to_invalid_1', label=LxERP.t8('Yes'), checked=(SELF.flags.defaults_to_invalid ?  1 : '')) %]
75         [% L.radio_button_tag('config.flag_defaults_to_invalid', value='0', id='config.flag_defaults_to_invalid_0', label=LxERP.t8('No'),  checked=(SELF.flags.defaults_to_invalid ? '' :  1)) %]
76       </td>
77     </tr>
78     <tr data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
79       <th>[% 'Filter by Partsgroups' | $T8 %]</th>
80       <td class="horizontal">
81         [% L.radio_button_tag('config.flag_partsgroup_filter', value='1', id='config_flag_partsgroup_filter_1', label=LxERP.t8('Yes'), checked=(SELF.flags.partsgroup_filter ?  1 : ''), onclick='update_pg_filter_row()') %]
82         [% L.radio_button_tag('config.flag_partsgroup_filter', value='0', id='config_flag_partsgroup_filter_0', label=LxERP.t8('No'),  checked=(SELF.flags.partsgroup_filter ? '' :  1), onclick='update_pg_filter_row()') %]
83       </td>
84     </tr>
85     <tr data-show-for="IC+PGFILTER"[% UNLESS (SELF.module == 'IC' && SELF.flags.partsgroup_filter) %] style="display: none;"[% END %]>
86       <th></th>
87       <td>[% L.select_tag(
88                 'config.partsgroups[]',
89                 all_partsgroups,
90                 id                => "partsgroups",
91                 value_key         => "id",
92                 title_key         => "partsgroup",
93                 default           => SELF.config.partsgroups,
94                 default_value_key => "id",
95                 multiple          => 1)
96           %]
97           [% L.multiselect2side(
98                 "partsgroups",
99                 labelsx => LxERP.t8("All partsgroups"),
100                 labeldx => LxERP.t8("Partsgroups where variables are shown"))
101           %]
102       </td>
103     </tr>
104     <tr data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
105       <td>[% 'Display in basic data tab' | $T8 %]</td>
106       <td class="horizontal">
107         [% L.radio_button_tag('config.first_tab', value='1', id='config.first_tab', label=LxERP.t8('Yes'), checked=(SELF.config.first_tab ?  1 : '')) %]
108         [% L.radio_button_tag('config.first_tab', value='0', id='config.first_tab', label=LxERP.t8('No'),  checked=(SELF.config.first_tab ? '' :  1)) %]
109       </td>
110     </tr>
111   </tbody>
112 </table>
113
114 <div class="col" style="width:51.0em;">
115    <!--<h3 class="caption">[% 'Annotations' | $T8 %]</h3>-->
116 <h3><caption>[% 'Annotations' | $T8 %]</caption></h3>
117 <div class="long-description">
118
119 <ul class="footnotes">
120   <li><sup>(1)</sup> [% 'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' | $T8 %]</li>
121   <li><sup>(2)</sup> [% 'The description is shown on the form. Chose something short and descriptive.' | $T8 %]</li>
122   <li><sup>(3)</sup> [% 'For type "customer" the perl module JSON is required. Please check this on system level: $ ./scripts/installation_check.pl' | $T8 %]</li>
123   <li><sup>(4)</sup> [% 'The default value depends on the variable type:' | $T8 %]
124     <ul>
125       <li>[% 'Text, text field, HTML field and number variables: The default value will be used as-is.' | $T8 %]</li>
126       <li>[% 'Boolean variables: If the default value is non-empty then the checkbox will be checked by default and unchecked otherwise.' | $T8 %]</li>
127       <li>[% 'Date and timestamp variables: If the default value equals \'NOW\' then the current date/current timestamp will be used. Otherwise the default value is copied as-is.' | $T8 %]</li>
128     </ul>
129   </li>
130   <li><sup>(5)</sup> [% 'The available options depend on the varibale type:' | $T8 %]
131     <ul>
132       <li>[% 'Text variables: \'MAXLENGTH=n\' sets the maximum entry length to \'n\'.' | $T8 %]</li>
133       <li>[% 'Text field and HTML field variables: \'WIDTH=w HEIGHT=h\' sets the width and height
134         of the text field. They default to 225 and 90 respectively.' | $T8 %]</li>
135       <li>[% 'Number variables: \'PRECISION=n\' forces numbers to be shown with exactly n decimal places.' | $T8 %]</li>
136       <li>[% 'Selection fields: The option field must contain the available options for the selection. Options are separated by \'##\', for example \'Early##Normal##Late\'.' | $T8 %]</li>
137     </ul>
138   [% 'Other values are ignored.' | $T8 %]</li>
139 <div data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
140   <li><sup>(6)</sup> [% 'A variable marked as \'editable\' can be changed in each quotation, order, invoice etc.' | $T8 %] [% 'Otherwise the variable is only available for printing.' | $T8 %]</li>
141 </div>
142 <div data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
143   <li><sup>(7)</sup> [% 'A variable marked as \'Deactivate by default\' isn\'t automatically added to all articles, and has to be explicitly added for each desired article in its master data tab. Only then can the variable be used for that article in the records.' | $T8 %]</li>
144 </div>
145 </ul>
146
147 </div><!-- /.long-description -->
148 </div><!-- /.col -->
149
150 </form>
151 </div><!-- /.wrapper -->
152
153
154
155 <script type="text/javascript">
156 <!--
157 function update_included_by_default() {
158   $('INPUT[name="config.included_by_default"]').prop('disabled', !$('#config_includeable_1').prop('checked'));
159 }
160
161 function update_ic_rows() {
162   $('[data-show-for="IC"]').toggle($('#module').val() === "IC");
163   $('[data-show-for="IC+PGFILTER"]').toggle($('#module').val() === "IC" && $('#config_flag_partsgroup_filter_1').prop('checked'));
164 }
165
166 function update_pg_filter_row() {
167   $('[data-show-for="IC+PGFILTER"]').toggle($('#module').val() === "IC" && $('#config_flag_partsgroup_filter_1').prop('checked'));
168 }
169
170 function check_prerequisites() {
171   if (($('#config_type').val() === "select") && ($('#config_options').val() === "")) {
172     alert(kivi.t8('The option field is empty.'));
173     return false;
174   }
175
176   if ($('#config_name').val() === "") {
177     alert(kivi.t8('The name is missing.'));
178     return false;
179   }
180
181   if (!$('#config_name').val().match(/^[a-z][a-z0-9_]*$/i)) {
182     alert(kivi.t8('The name must only consist of letters, numbers and underscores and start with a letter.'));
183     return false;
184   }
185
186   if ($('#config_description').val() === "") {
187     alert(kivi.t8('The description is missing.'));
188     return false;
189   }
190
191   return true;
192 }
193 -->
194 </script>