1 |
<%args> |
<%args> |
2 |
$page => 1 |
$page => 1 |
3 |
|
$show_description => 0 |
4 |
|
$show_comment => 0 |
5 |
</%args> |
</%args> |
6 |
<%init> |
<%init> |
7 |
my $transports = Transports::Model::TransportCollection->new(); |
my $transports = Transports::Model::TransportCollection->new(); |
22 |
$transports->order_by({ column => 'date' }); |
$transports->order_by({ column => 'date' }); |
23 |
$transports->set_page_info( |
$transports->set_page_info( |
24 |
current_page => $page, |
current_page => $page, |
25 |
per_page => 5, |
per_page => 10, |
26 |
); |
); |
27 |
if (my $nr = $transports->pager->total_entries) { |
if (my $nr = $transports->pager->total_entries) { |
28 |
$m->out("Showing $nr transports.") |
$m->out("Showing $nr transports.") |
29 |
|
|
30 |
} elsif ( Jifty->web->current_user->can_import ) { |
} elsif ( Jifty->web->current_user->can_import ) { |
31 |
$m->out("No transports waiting for import."); |
$m->out("No transports waiting for import."); |
32 |
} else { |
} else { |
34 |
} |
} |
35 |
</%init> |
</%init> |
36 |
|
|
37 |
|
<% Jifty->web->link( |
38 |
|
label => ( $show_description ? 'no ' : '' ) . ' description', |
39 |
|
onclick => { |
40 |
|
replace_with => '/transports/table', |
41 |
|
args => { show_description => $show_description ? 0 : 1 }, |
42 |
|
} |
43 |
|
) %> |
44 |
|
|
45 |
|
<% Jifty->web->link( |
46 |
|
label => ( $show_comment ? 'no ' : '' ) . ' import comment', |
47 |
|
onclick => { |
48 |
|
replace_with => '/transports/table', |
49 |
|
args => { show_comment => $show_comment ? 0 : 1 }, |
50 |
|
} |
51 |
|
) %> |
52 |
|
|
53 |
<table> |
<table> |
54 |
<tr> |
<tr> |
55 |
<th>src</th> |
<th>src</th> |
58 |
<th>req.nr</th> |
<th>req.nr</th> |
59 |
<th>dep</th> |
<th>dep</th> |
60 |
<th>created by</th> |
<th>created by</th> |
61 |
|
% if ($show_description) { |
62 |
<th>description</th> |
<th>description</th> |
63 |
|
% } |
64 |
<th>import</th> |
<th>import</th> |
65 |
|
% if ($show_comment) { |
66 |
|
<th>comment</th> |
67 |
|
% } |
68 |
|
</th> |
69 |
% if (Jifty->web->current_user->admin) { |
% if (Jifty->web->current_user->admin) { |
70 |
<th> </th> |
<th> </th> |
71 |
% } |
% } |
|
</th> |
|
72 |
</tr> |
</tr> |
73 |
|
|
74 |
% my $i = 0; |
% my $i = 0; |
75 |
% while (my $t = $transports->next) { |
% while (my $t = $transports->next) { |
76 |
|
|
77 |
<tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>"> |
<tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>"> |
78 |
<td><% $t->source->name %></td> |
<td><% $t->source->name %></td> |
79 |
<td><% $t->destination->name %></td> |
<td><% $t->destination->name %></td> |
83 |
<% $t->client_dependent ? 'client' : 'none' %> |
<% $t->client_dependent ? 'client' : 'none' %> |
84 |
</td> |
</td> |
85 |
<td><em><% $t->created_by->name %></em></td> |
<td><em><% $t->created_by->name %></em></td> |
86 |
|
% if ($show_description) { |
87 |
<td><% $t->description %></td> |
<td><% $t->description %></td> |
88 |
|
% } |
89 |
<td> |
<td> |
90 |
% if ($t->return_code) { |
% if ($t->return_code && $t->return_code->name) { |
91 |
<% $t->return_code->name %> |
<% $t->return_code->name %> |
92 |
% } elsif (Jifty->web->current_user->can_import) { |
% } elsif (Jifty->web->current_user->can_import) { |
93 |
<% Jifty->web->link( label => 'import', url => '/import/' . $t->id ) %> |
<% Jifty->web->link( label => 'import', onclick => { |
94 |
|
replace_with => '/transports/import', |
95 |
|
args => { id => $t->id }, |
96 |
|
} ) %> |
97 |
% } else { |
% } else { |
98 |
pending |
pending |
99 |
% } |
% } |
100 |
</td> |
</td> |
101 |
|
% if ($show_comment) { |
102 |
|
<td><% $t->comment %></td> |
103 |
|
% } |
104 |
% if (Jifty->web->current_user->admin) { |
% if (Jifty->web->current_user->admin) { |
105 |
<td><% Jifty->web->link( label => 'edit', url => '/edit/' . $t->id ) %></td> |
<td><% Jifty->web->link( label => 'edit', onclick => { |
106 |
|
replace_with => '/transports/edit', |
107 |
|
args => { id => $t->id }, |
108 |
|
} ) %></td> |
109 |
% } |
% } |
110 |
</tr> |
</tr> |
111 |
% } |
% } |
113 |
|
|
114 |
% if ($transports->pager->previous_page) { |
% if ($transports->pager->previous_page) { |
115 |
<% Jifty->web->link( |
<% Jifty->web->link( |
116 |
label => "Previous page", |
label => "Previous", |
117 |
onclick => { args => { page => $transports->pager->previous_page } } |
onclick => { args => { page => $transports->pager->previous_page } } |
118 |
) %> |
) %> |
119 |
% } |
% } |
124 |
|
|
125 |
% if ($transports->pager->next_page) { |
% if ($transports->pager->next_page) { |
126 |
<% Jifty->web->link( |
<% Jifty->web->link( |
127 |
label => "Next page", |
label => "Next", |
128 |
onclick => { args => { page => $transports->pager->next_page } } |
onclick => { args => { page => $transports->pager->next_page } } |
129 |
) %> |
) %> |
130 |
% } |
% } |