Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bcb43619

Von Sven Schöling vor mehr als 10 Jahren hinzugefügt

  • ID bcb43619d8eb7088e0b6975d356c569d167f505c
  • Vorgänger 3a755957
  • Nachfolger cbd9fcfa

Projektsuche auf simpel+filter umgestellt

Unterschiede anzeigen:

SL/Controller/Project.pm
30 30

  
31 31
__PACKAGE__->run_before('check_auth');
32 32
__PACKAGE__->run_before('load_project',        only => [ qw(edit update destroy) ]);
33
__PACKAGE__->run_before('load_project_types',  only => [ qw(search edit new) ]);
34
__PACKAGE__->run_before('load_project_status', only => [ qw(search edit new) ]);
33
__PACKAGE__->run_before('load_project_types',  only => [ qw(search edit new list) ]);
34
__PACKAGE__->run_before('load_project_status', only => [ qw(search edit new list) ]);
35 35

  
36 36
#
37 37
# actions
......
54 54
sub action_list {
55 55
  my ($self) = @_;
56 56

  
57
  # $self->make_filter_summary;
57
  $self->make_filter_summary;
58 58

  
59 59
  my $projects = $self->models->get;
60 60

  
......
228 228
    std_column_visibility => 1,
229 229
    controller_class      => 'Project',
230 230
    output_format         => 'HTML',
231
    top_info_text         => $::locale->text('Projects'),
231
    raw_top_info_text     => $self->render('project/report_top', { output => 0 }),
232
    raw_bottom_info_text  => $self->render('project/report_bottom', { output => 0 }),
232 233
    title                 => $::locale->text('Projects'),
233 234
    allow_pdf_export      => 1,
234 235
    allow_csv_export      => 1,
......
262 263
  );
263 264
}
264 265

  
266
sub make_filter_summary {
267
  my ($self) = @_;
268

  
269
  my $filter = $::form->{filter} || {};
270
  my @filter_strings;
271

  
272
  my @filters = (
273
    [ $filter->{"projectnumber:substr::ilike"},  t8('Project Number') ],
274
    [ $filter->{"description:substr::ilike"},    t8('Description')    ],
275
    [ $filter->{customer}{"name:substr::ilike"}, t8('Customer')       ],
276
    [ $filter->{"project_type_id"},              t8('Project Type'),    sub { SL::DB::Manager::ProjectType->find_by(id => $filter->{"project_type_id"})->description }   ],
277
    [ $filter->{"project_status_id"},            t8('Project Status'),  sub { SL::DB::Manager::ProjectStatus->find_by(id => $filter->{"project_status_id"})->description } ],
278
  );
279

  
280
  my @flags = (
281
    [ $filter->{active} eq 'active',    $::locale->text('Active')      ],
282
    [ $filter->{active} eq 'inactive',  $::locale->text('Inactive')    ],
283
    [ $filter->{valid}  eq 'valid',     $::locale->text('Valid')       ],
284
    [ $filter->{valid}  eq 'invalid',   $::locale->text('Invalid')     ],
285
    [ $filter->{orphaned},              $::locale->text('Orphaned')    ],
286
  );
287

  
288
  for (@flags) {
289
    push @filter_strings, "$_->[1]" if $_->[0];
290
  }
291
  for (@filters) {
292
    push @filter_strings, "$_->[1]: " . ($_->[2] ? $_->[2]->() : $_->[0]) if $_->[0];
293
  }
294

  
295
  $self->{filter_summary} = join ', ', @filter_strings;
296
}
297

  
265 298
sub load_project_types {
266 299
  $_[0]{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted;
267 300
}
menus/erp.ini
85 85
[Master Data--Reports--Projects]
86 86
ACCESS=project_edit
87 87
module=controller.pl
88
action=Project/search
88
action=Project/list
89
filter.active=active
90
filter.valid=valid
89 91

  
90 92
[AR]
91 93

  
templates/webpages/project/_filter.html
1
[%- USE T8 %]
2
[%- USE HTML %]
3
[%- USE L %]
4
[%- USE LxERP %]
5

  
6
<table>
7
 <tr>
8
  <th align="right">[% 'Number' | $T8 %]</th>
9
  <td>[% L.input_tag('filter.projectnumber:substr::ilike', filter.projectnumber_substr__ilike, size=60) %]</td>
10
 </tr>
11

  
12
 <tr>
13
  <th align="right">[% 'Description' | $T8 %]</th>
14
  <td>[% L.input_tag('filter.description:substr::ilike', filter.description_substr__ilike, size=60) %]</td>
15
 </tr>
16

  
17
 <tr>
18
  <th align="right">[% 'Customer' | $T8 %]</th>
19
  <td>[% L.input_tag('filter.customer.name:substr::ilike', filter.customer.name_substr__ilike, size=60) %]</td>
20
 </tr>
21

  
22
 <tr>
23
  <th align="right">[% 'Project Type' | $T8 %]</th>
24
  <td>[% L.select_tag('filter.project_type_id', SELF.ALL_PROJECT_TYPES, default=filter.project_type_id, title_key='description', with_empty=1) %]</td>
25
 </tr>
26

  
27
 <tr>
28
  <th align="right">[% 'Project Status' | $T8 %]</th>
29
  <td>[% L.select_tag('filter.project_status_id', SELF.ALL_PROJECT_STATUS, default=filter.project_status_id, title_key='description', with_empty=1) %]</td>
30
 </tr>
31

  
32
 [% CUSTOM_VARIABLES_FILTER_CODE %]
33

  
34
 <tr>
35
  <th>[% 'Include in Report' | $T8 %]</th>
36
  <td>
37
   <table>
38
    <tr>
39
     <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>
40
    </tr>
41

  
42
    <tr>
43
     <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>
44
    </tr>
45

  
46
    <tr>
47
     <td>[% L.select_tag('filter.status', [ [ 'all', LxERP.t8('All') ], [ 'orphaned', LxERP.t8('Orphaned') ] ], default=filter.status, style="width: 200px") %]</td>
48
    </tr>
49

  
50
    [% CUSTOM_VARIABLES_INCLUSION_CODE %]
51

  
52
   </table>
53
  </td>
54
 </tr>
55
</table>
templates/webpages/project/report_top.html
1
[%- USE L %]
2
[%- USE T8 %]
3
[%- USE LxERP %]
4
[%- USE HTML %]
5
<form action='controller.pl' method='post'>
6
<div class='filter_toggle'>
7
<a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
8
  [% SELF.filter_summary | html %]
9
</div>
10
<div class='filter_toggle' style='display:none'>
11
<a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Hide Filter' | $T8 %]</a>
12
[%- PROCESS 'project/_filter.html' filter=SELF.filter %]
13

  
14
[% L.hidden_tag('action', 'Project/dispatch') %]
15
[% L.hidden_tag('sort_by', FORM.sort_by) %]
16
[% L.hidden_tag('sort_dir', FORM.sort_dir) %]
17
[% L.hidden_tag('page', FORM.page) %]
18
[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
19

  
20

  
21
<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);'>[% 'Reset' | $T8 %]</a>
22

  
23
</div>
24

  
25
</form>
26
 <hr>

Auch abrufbar als: Unified diff