travelynx/templates/_connections.html.ep
Birte Kristina Friesel 1ba41db376
frontend: add train timestamps to checkin action
(preparations for more flexible checkin time frames)
2023-10-20 18:04:32 +02:00

82 lines
2.8 KiB
Text

<div><table class="striped"><tbody>
% for my $res (@{$connections}) {
% my ($train, $via, $via_arr, $load) = @{$res};
% $via_arr = $via_arr ? $via_arr->strftime('%H:%M') : q{};
% my $td_class = '';
% my $link_class = 'action-checkin';
% if ($train->is_cancelled) {
% $td_class = 'cancelled';
% $link_class = 'action-cancelled-from';
% }
% if ($checkin_from) {
<tr class="<%= $link_class %>" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-ts="<%= ($train->sched_departure // $train->departure)->epoch %>" data-dest="<%= $via->{name} %>">
% }
% else {
<tr>
% }
<td class="<%= $td_class %>">
% if ($train->platform) {
% if ($checkin_from) {
<a>Gleis <%= $train->platform %></a>
% }
% else {
Gleis <%= $train->platform %>
% }
<br/>
% }
% if ($checkin_from) {
<a><%= $train->line %></a>
% }
% else {
%= $train->line
% }
</td>
<td class="<%= $td_class %>">
% if ($checkin_from) {
<a><%= $via->{name} %></a>
% }
% else {
%= $via->{name}
% }
<br/>
% if ($load) {
% my ($first, $second) = load_icon($load);
<i class="material-icons tiny" aria-hidden="true"><%= $first %></i> <i class="material-icons tiny" aria-hidden="true"><%= $second %></i>
% }
% if ($train->{interchange_icon}) {
<i class="material-icons tiny" aria-label="<%= $train->{interchange_text} %>"><%= $train->{interchange_icon} %></i>
% }
% if ($train->{message_id}{96} or $train->{message_id}{97}) {
<i class="material-icons tiny" aria-label="Zug ist überbesetzt">warning</i>
% }
% if ($train->{message_id}{82} or $train->{message_id}{85}) {
<i class="material-icons tiny" aria-label="Fehlende Wagen">remove</i>
% }
% if (($train->{message_id}{73} or $train->{message_id}{74} or $train->{message_id}{75} or $train->{message_id}{76} or $train->{message_id}{80}) and not $train->{message_id}{84}) {
<i class="material-icons tiny" aria-label="Abweichende Wagenreihung">compare_arrows</i>
% }
% if ($train->{message_id}{83} or $train->{message_id}{93} or $train->{message_id}{95}) {
<i class="material-icons tiny" aria-label="Eingeschränkte Barrierefreiheit">info_outline</i>
% }
% if ($train->{message_id}{70} or $train->{message_id}{71}) {
<i class="material-icons tiny" aria-label="Ohne WLAN">portable_wifi_off</i>
% }
</td>
<td>
% if ($train->departure_is_cancelled) {
%= $train->sched_departure->strftime('%H:%M')
% }
% else {
%= $train->departure->strftime('%H:%M')
% }
% if ($via_arr) {
→ <%= $via_arr %>
% }
% if ($train->departure_delay) {
%= sprintf('(%+d)', $train->departure_delay)
% }
</td>
</tr>
% }
</tbody></table></div>