5 |
my $transports = Transports::Model::TransportCollection->new(); |
my $transports = Transports::Model::TransportCollection->new(); |
6 |
if (Jifty->web->current_user->admin) { |
if (Jifty->web->current_user->admin) { |
7 |
$transports->unlimit(); |
$transports->unlimit(); |
8 |
|
} elsif (Jifty->web->current_user->can_import) { |
9 |
|
$transports->limit( |
10 |
|
column => 'return_code', |
11 |
|
value => 'null', |
12 |
|
operator => 'is', |
13 |
|
); |
14 |
} else { |
} else { |
15 |
$transports->limit( |
$transports->limit( |
16 |
column => 'created_by', |
column => 'created_by', |
17 |
value => Jifty->web->current_user->id, |
value => Jifty->web->current_user->id, |
18 |
) |
); |
19 |
} |
} |
20 |
$transports->order_by({ column => 'date' }); |
$transports->order_by({ column => 'date' }); |
21 |
$transports->set_page_info( |
$transports->set_page_info( |
22 |
current_page => $page, |
current_page => $page, |
23 |
per_page => 5, |
per_page => 5, |
24 |
); |
); |
25 |
$m->out("No transports found.") if ($transports->pager->total_entries == 0); |
if (my $nr = $transports->pager->total_entries) { |
26 |
|
$m->out("Showing $nr transports.") |
27 |
|
} else { |
28 |
|
$m->out("No transports found.") |
29 |
|
} |
30 |
</%init> |
</%init> |
31 |
|
|
32 |
<table> |
<table> |
38 |
<th>dep</th> |
<th>dep</th> |
39 |
<th>created by</th> |
<th>created by</th> |
40 |
<th>description</th> |
<th>description</th> |
41 |
|
<th>import</th> |
42 |
% if (Jifty->web->current_user->admin) { |
% if (Jifty->web->current_user->admin) { |
43 |
<th> </th> |
<th> </th> |
44 |
% } |
% } |
61 |
% } |
% } |
62 |
</td> |
</td> |
63 |
<td><% $t->description %></td> |
<td><% $t->description %></td> |
64 |
|
<td> |
65 |
|
% if ($t->return_code) { |
66 |
|
<% $t->return_code->name %> |
67 |
|
% } elsif (Jifty->web->current_user->can_import) { |
68 |
|
<% Jifty->web->link( label => 'import', url => '/import/' . $t->id ) %> |
69 |
|
% } else { |
70 |
|
pending |
71 |
|
% } |
72 |
|
</td> |
73 |
% if (Jifty->web->current_user->admin) { |
% if (Jifty->web->current_user->admin) { |
74 |
<td><% Jifty->web->link( label => 'edit', url => '/edit/' . $t->id ) %></td> |
<td><% Jifty->web->link( label => 'edit', url => '/edit/' . $t->id ) %></td> |
75 |
% } |
% } |