(
scalar => [ qw(requirement_spec_item visible_item visible_section) ],
'scalar --get_set_init' => [ qw(requirement_spec customers types statuses complexities risks projects project_types project_statuses default_project_type default_project_status copy_source js
- current_text_block_output_position models time_based_units html_template) ],
+ current_text_block_output_position models time_based_units html_template cvar_configs) ],
);
__PACKAGE__->run_before('setup');
$::auth->assert('requirement_spec_edit');
$::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec);
- $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec ckeditor/ckeditor ckeditor/adapters/jquery autocomplete_part);
+ $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec ckeditor/ckeditor ckeditor/adapters/jquery autocomplete_part autocomplete_customer);
$self->init_visible_section;
return 1;
sub init_statuses { SL::DB::Manager::RequirementSpecStatus->get_all_sorted }
sub init_time_based_units { SL::DB::Manager::Unit->time_based_units }
sub init_types { SL::DB::Manager::RequirementSpecType->get_all_sorted }
+sub init_cvar_configs { SL::DB::Manager::CustomVariableConfig->get_all_sorted(where => [ module => 'RequirementSpecs' ]) }
sub init_customers {
my ($self) = @_;
use SL::DB::Helper::Manager;
use base qw(SL::DB::Helper::Manager);
+use SL::DB::Helper::Filtered;
use SL::DB::Helper::Paginated;
use SL::DB::Helper::Sorted;
--- /dev/null
+[%- USE HTML -%][%- USE L -%][%- USE LxERP -%][%- USE T8 -%]
+[%- SET id__ = cvar_cfg.id
+ name__ = 'filter.cvar.' _ id__
+ value__ = filter.cvar.$id__ %]
+[%- IF cvar_cfg.type == 'bool' %]
+ [%- L.select_tag(name__, [ '', [ 1, LxERP.t8('Yes') ], [ 0, LxERP.t8('No') ] ], default=value__, class=cvar_class) %]
+
+[%- ELSIF cvar_cfg.type == 'number' %]
+ [% L.select_tag(name__ _ '::', [ [ 'eq', '==' ], [ 'ne', '=/=' ], [ 'gt', '>' ], [ 'ge', '>=' ], [ 'lt', '<' ], [ 'le', '<=' ] ]) %]
+ [% L.input_tag(name__, value__, class=cvar_class) %]
+
+[%- ELSIF cvar_cfg.type == 'date' %]
+ [% L.select_tag(name__ _ '::', [ [ 'eq', '==' ], [ 'ne', '=/=' ], [ 'gt', '>' ], [ 'ge', '>=' ], [ 'lt', '<' ], [ 'le', '<=' ] ]) %]
+ [% L.date_tag(name__, value__, class=cvar_class) %]
+
+[% ELSIF cvar_cfg.type == 'select' %]
+ [% options__ = [ '' ];
+ options__ = options__.import(cvar_cfg.processed_options);
+ L.select_tag(name__, options__, default=value__, class=cvar_class) %]
+
+[% ELSIF cvar_cfg.type == 'customer' %]
+ [%- L.customer_vendor_picker(name__, value__, type='customer', class=cvar_class) %]
+
+[% ELSIF cvar_cfg.type == 'vendor' %]
+ [%- L.customer_vendor_picker(name__, value__, type='vendor', class=cvar_class) %]
+
+[% ELSIF cvar_cfg.type == 'part' %]
+ [%- L.part_picker(name__, value__, class=cvar_class) %]
+
+[%- ELSE %]
+ [% SET value_name__ = id__ _ '_substr__ilike'
+ value__ = filter.cvar.$value_name__ %]
+ [%- L.input_tag(name__ _ ':substr::ilike', value__, maxlength=cvar_cfg.maxlength, class=cvar_class) %]
+
+[%- END %]
[%- L.hidden_tag("is_template", is_template) %]
<p>
- <table class="rs_input_field">
+ <table>
<tr>
<th align="right">[% LxERP.t8("Title") %]</th>
- <td>[% L.input_tag('filter.title:substr::ilike', filter.title_substr__ilike) %]</td>
+ <td>[% L.input_tag('filter.title:substr::ilike', filter.title_substr__ilike, class="rs_input_field") %]</td>
</tr>
[%- UNLESS is_template %]
<tr>
<th align="right">[% LxERP.t8("Customer") %]</th>
- <td>[% L.input_tag('filter.customer.name:substr::ilike', filter.customer.name_substr__ilike) %]</td>
+ <td>[% L.input_tag('filter.customer.name:substr::ilike', filter.customer.name_substr__ilike, class="rs_input_field") %]</td>
</tr>
<tr>
<th align="right">[% LxERP.t8("Customer Number") %]</th>
- <td>[% L.input_tag('filter.customer.customernumber:substr::ilike', filter.customer.customernumber_substr__ilike) %]</td>
+ <td>[% L.input_tag('filter.customer.customernumber:substr::ilike', filter.customer.customernumber_substr__ilike, class="rs_input_field") %]</td>
</tr>
<tr>
<th align="right">[% LxERP.t8("Requirement Spec Type") %]</th>
- <td>[% L.select_tag('filter.type_id', SELF.types, default=filter.type_id, title_key="description", with_empty=1) %]</td>
+ <td>[% L.select_tag('filter.type_id', SELF.types, default=filter.type_id, title_key="description", with_empty=1, class="rs_input_field") %]</td>
</tr>
<tr>
<th align="right">[% LxERP.t8("Requirement Spec Status") %]</th>
- <td>[% L.select_tag('filter.status_id[]', SELF.statuses, default=filter.status_id_, title_key="description", multiple=1) %][%# NOTE: the trailing '_' is NOT a mistake -- look at SL::Controller::Helper::Filtered for the explanation! %]</td>
+ <td>[% L.select_tag('filter.status_id[]', SELF.statuses, default=filter.status_id_, title_key="description", multiple=1, class="rs_input_field") %][%# NOTE: the trailing '_' is NOT a mistake -- look at SL::Controller::Helper::Filtered for the explanation! %]</td>
</tr>
<tr>
<th align="right">[% LxERP.t8("Project Number") %]</th>
- <td>[% L.input_tag('filter.project.projectnumber:substr::ilike', filter.project.projectnumber_substr__ilike) %]</td>
+ <td>[% L.input_tag('filter.project.projectnumber:substr::ilike', filter.project.projectnumber_substr__ilike, class="rs_input_field") %]</td>
</tr>
<tr>
<th align="right">[% LxERP.t8("Project Description") %]</th>
- <td>[% L.input_tag('filter.project.description:substr::ilike', filter.project.description_substr__ilike) %]</td>
+ <td>[% L.input_tag('filter.project.description:substr::ilike', filter.project.description_substr__ilike, class="rs_input_field") %]</td>
</tr>
+
+ [% FOREACH cvar_cfg = SELF.cvar_configs %]
+ [%- IF cvar_cfg.searchable %]
+ <tr>
+ <th align="right">[% HTML.escape(cvar_cfg.description) %]</th>
+ <td>[% INCLUDE 'common/render_cvar_filter_input.html' cvar_cfg=cvar_cfg cvar_class="rs_input_field" %]</td>
+ </tr>
+ [% END %]
+ [% END %]
[%- END %]
</table>
</p>