[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]<h1>[% HTML.escape(title) %]</h1>
-<form action="controller.pl" method="post">
+<form action="controller.pl" method="post" id="form">
[%- L.hidden_tag("id", SELF.config.id) %]
<p>
[% 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)) %]
</td>
</tr>
+ <tr data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
+ <td align="right">[% 'Filter by Partsgroups' | $T8 %]</td>
+ <td>
+ [% 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()') %]
+ </td>
+ </tr>
+ <tr data-show-for="IC+PGFILTER"[% UNLESS (SELF.module == 'IC' && SELF.flags.partsgroup_filter) %] style="display: none;"[% END %]>
+ <td></td>
+ <td>
+ [% 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")) %]
+ </td>
+ </tr>
</table>
</p>
- <p>
- [% 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 %]
- <a href="[% SELF.url_for(action='list', module=SELF.module) %]">[%- LxERP.t8("Cancel") %]</a>
- </p>
-
<hr>
<h3>[% 'Annotations' | $T8 %]</h3>
function update_ic_rows() {
$('[data-show-for="IC"]').toggle($('#module').val() === "IC");
+ $('[data-show-for="IC+PGFILTER"]').toggle($('#module').val() === "IC" && $('#config_flag_partsgroup_filter_1').prop('checked'));
+}
+
+function update_pg_filter_row() {
+ $('[data-show-for="IC+PGFILTER"]').toggle($('#module').val() === "IC" && $('#config_flag_partsgroup_filter_1').prop('checked'));
}
function check_prerequisites() {