[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]

[% HTML.escape(title) %]

[%- L.hidden_tag("id", SELF.config.id) %]

[% 'Module' | $T8 %] [%- L.select_tag('module', SELF.modules, value_key='module', title_key='description', default=SELF.module, onchange="update_ic_rows();") %]
[% 'Variable Name' | $T8 %](1) [%- L.input_tag("config.name", SELF.config.name, class='initial_focus') %]
[% 'Variable Description' | $T8 %](2) [%- L.input_tag("config.description", SELF.config.description) %]
[% 'Type' | $T8 %](3) [% L.select_tag("config.type", SELF.translated_types, value_key='type', title_key='translation', default=SELF.config.type) %]
[% 'Default value' | $T8 %](4) [%- L.input_tag("config.default_value", SELF.config.type == 'number' ? LxERP.format_amount(SELF.config.default_value, 2) : SELF.config.default_value) %]
[% 'Options' | $T8 %](5) [%- L.input_tag("config.options", SELF.config.options) %]
[% 'Is Searchable' | $T8 %] [% L.radio_button_tag('config.searchable', value='1', id='config_searchable_1', label=LxERP.t8('Yes'), checked=(SELF.config.searchable ? 1 : '')) %] [% L.radio_button_tag('config.searchable', value='0', id='config_searchable_0', label=LxERP.t8('No'), checked=(SELF.config.searchable ? '' : 1)) %]
[% 'Includeable in reports' | $T8 %] [% 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()') %] [% 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()') %]
[% 'Included in reports by default' | $T8 %] [% SET disabled = SELF.config.includeable ? '' : 'disabled' %] [% 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) %] [% 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) %]
[% 'Editable' | $T8 %](6) [% L.radio_button_tag('config.flag_editable', value='1', id='config.flag_editable_1', label=LxERP.t8('Yes'), checked=(SELF.flags.editable ? 1 : '')) %] [% L.radio_button_tag('config.flag_editable', value='0', id='config.flag_editable_0', label=LxERP.t8('No'), checked=(SELF.flags.editable ? '' : 1)) %]
[% 'Deactivate by default' | $T8 %](7) [% 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 : '')) %] [% 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)) %]
[% 'Filter by Partsgroups' | $T8 %] [% 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()') %] [% 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()') %]
[% L.select_tag('config.partsgroups[]', all_partsgroups, id => "partsgroups", value_key => "id", title_key => "partsgroup", default => SELF.config.partsgroups, default_value_key => "id", multiple => 1) %] [% L.multiselect2side("partsgroups", labelsx => LxERP.t8("All partsgroups"), labeldx => LxERP.t8("Partsgroups where variables are shown")) %]

[% L.hidden_tag("action", "CustomVariableConfig/dispatch") %] [% L.submit_tag("action_" _ (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %] [%- IF SELF.config.id %] [% L.submit_tag("action_create", LxERP.t8('Save as new'), onclick="return check_prerequisites();") %] [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure?')) %] [%- END %] [%- LxERP.t8("Cancel") %]


[% 'Annotations' | $T8 %]

(1) [% 'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' | $T8 %]

(2) [% 'The description is shown on the form. Chose something short and descriptive.' | $T8 %]

(3) [% 'For type "customer" the perl module JSON is required. Please check this on system level: $ ./scripts/installation_check.pl' | $T8 %]

(4) [% 'The default value depends on the variable type:' | $T8 %]

(5) [% 'The available options depend on the varibale type:' | $T8 %]


[% 'Other values are ignored.' | $T8 %]

(6) [%- 'A variable marked as \'editable\' can be changed in each quotation, order, invoice etc.' | $T8 %] [% 'Otherwise the variable is only available for printing.' | $T8 %]

(7) [%- '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 %]