__PACKAGE__->run_before('check_auth');
__PACKAGE__->run_before('load_project', only => [ qw(edit update destroy) ]);
-__PACKAGE__->run_before('load_project_types', only => [ qw(search edit new) ]);
-__PACKAGE__->run_before('load_project_status', only => [ qw(search edit new) ]);
+__PACKAGE__->run_before('load_project_types', only => [ qw(search edit new list) ]);
+__PACKAGE__->run_before('load_project_status', only => [ qw(search edit new list) ]);
#
# actions
sub action_list {
my ($self) = @_;
- # $self->make_filter_summary;
+ $self->make_filter_summary;
my $projects = $self->models->get;
std_column_visibility => 1,
controller_class => 'Project',
output_format => 'HTML',
- top_info_text => $::locale->text('Projects'),
+ raw_top_info_text => $self->render('project/report_top', { output => 0 }),
+ raw_bottom_info_text => $self->render('project/report_bottom', { output => 0 }),
title => $::locale->text('Projects'),
allow_pdf_export => 1,
allow_csv_export => 1,
);
}
+sub make_filter_summary {
+ my ($self) = @_;
+
+ my $filter = $::form->{filter} || {};
+ my @filter_strings;
+
+ my @filters = (
+ [ $filter->{"projectnumber:substr::ilike"}, t8('Project Number') ],
+ [ $filter->{"description:substr::ilike"}, t8('Description') ],
+ [ $filter->{customer}{"name:substr::ilike"}, t8('Customer') ],
+ [ $filter->{"project_type_id"}, t8('Project Type'), sub { SL::DB::Manager::ProjectType->find_by(id => $filter->{"project_type_id"})->description } ],
+ [ $filter->{"project_status_id"}, t8('Project Status'), sub { SL::DB::Manager::ProjectStatus->find_by(id => $filter->{"project_status_id"})->description } ],
+ );
+
+ my @flags = (
+ [ $filter->{active} eq 'active', $::locale->text('Active') ],
+ [ $filter->{active} eq 'inactive', $::locale->text('Inactive') ],
+ [ $filter->{valid} eq 'valid', $::locale->text('Valid') ],
+ [ $filter->{valid} eq 'invalid', $::locale->text('Invalid') ],
+ [ $filter->{orphaned}, $::locale->text('Orphaned') ],
+ );
+
+ for (@flags) {
+ push @filter_strings, "$_->[1]" if $_->[0];
+ }
+ for (@filters) {
+ push @filter_strings, "$_->[1]: " . ($_->[2] ? $_->[2]->() : $_->[0]) if $_->[0];
+ }
+
+ $self->{filter_summary} = join ', ', @filter_strings;
+}
+
sub load_project_types {
$_[0]{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted;
}
[Master Data--Reports--Projects]
ACCESS=project_edit
module=controller.pl
-action=Project/search
+action=Project/list
+filter.active=active
+filter.valid=valid
[AR]
--- /dev/null
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE L %]
+[%- USE LxERP %]
+
+<table>
+ <tr>
+ <th align="right">[% 'Number' | $T8 %]</th>
+ <td>[% L.input_tag('filter.projectnumber:substr::ilike', filter.projectnumber_substr__ilike, size=60) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Description' | $T8 %]</th>
+ <td>[% L.input_tag('filter.description:substr::ilike', filter.description_substr__ilike, size=60) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Customer' | $T8 %]</th>
+ <td>[% L.input_tag('filter.customer.name:substr::ilike', filter.customer.name_substr__ilike, size=60) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Project Type' | $T8 %]</th>
+ <td>[% L.select_tag('filter.project_type_id', SELF.ALL_PROJECT_TYPES, default=filter.project_type_id, title_key='description', with_empty=1) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Project Status' | $T8 %]</th>
+ <td>[% L.select_tag('filter.project_status_id', SELF.ALL_PROJECT_STATUS, default=filter.project_status_id, title_key='description', with_empty=1) %]</td>
+ </tr>
+
+ [% CUSTOM_VARIABLES_FILTER_CODE %]
+
+ <tr>
+ <th>[% 'Include in Report' | $T8 %]</th>
+ <td>
+ <table>
+ <tr>
+ <td>[% L.select_tag('filter.active', [ [ 'active', LxERP.t8('Active') ], [ 'inactive', LxERP.t8('Inactive') ], [ 'both', LxERP.t8('Both') ] ], default=filter.active, style="width: 200px") %]</td>
+ </tr>
+
+ <tr>
+ <td>[% L.select_tag('filter.valid', [ [ 'valid', LxERP.t8('Valid') ], [ 'invalid', LxERP.t8('Invalid') ], [ 'both', LxERP.t8('Both') ] ], default=filter.valid, style="width: 200px") %]</td>
+ </tr>
+
+ <tr>
+ <td>[% L.select_tag('filter.status', [ [ 'all', LxERP.t8('All') ], [ 'orphaned', LxERP.t8('Orphaned') ] ], default=filter.status, style="width: 200px") %]</td>
+ </tr>
+
+ [% CUSTOM_VARIABLES_INCLUSION_CODE %]
+
+ </table>
+ </td>
+ </tr>
+</table>
--- /dev/null
+[%- USE L %]
+[%- USE T8 %]
+[%- USE LxERP %]
+[%- USE HTML %]
+<form action='controller.pl' method='post'>
+<div class='filter_toggle'>
+<a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
+ [% SELF.filter_summary | html %]
+</div>
+<div class='filter_toggle' style='display:none'>
+<a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Hide Filter' | $T8 %]</a>
+[%- PROCESS 'project/_filter.html' filter=SELF.filter %]
+
+[% L.hidden_tag('action', 'Project/dispatch') %]
+[% L.hidden_tag('sort_by', FORM.sort_by) %]
+[% L.hidden_tag('sort_dir', FORM.sort_dir) %]
+[% L.hidden_tag('page', FORM.page) %]
+[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
+
+
+<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);'>[% 'Reset' | $T8 %]</a>
+
+</div>
+
+</form>
+ <hr>