bus_booking/app/views/admin/bus_bookings/index.html.erb

43 lines
1.6 KiB
Plaintext

<div class="content-holder">
<h2><%= t("bus_booking.bus_schedule") %></h2>
<table class="table table-striped table-bordered">
<thead>
<th><%= t("bus_booking.bus_route") %></th>
<th><%= t("bus_booking.capacity") + "/" + t("bus_booking.reserved") %></th>
<th><%= t("bus_booking.actions") %></th>
<th><%= t("bus_booking.posted_by") %></th>
</thead>
<tbody>
<% @buses.each do |bus| %>
<tr>
<td>
<div class="bus-route"><%= bus.departure_time.strftime("%Y/%m/%d (%H:%M)") %> - <%= bus.bus_route %></div>
<%= bus.remark.html_safe %>
</td>
<td><%= bus.capacity %> / <%= bus.bookings.count %></td>
<td class="actions">
<% if current_user.is_admin? %>
<a href="<%= admin_bus_booking_path(bus) %>"><%= t("bus_booking.details") %></a>
<a href="<%= edit_admin_bus_booking_path(bus) %>"><%= t(:edit) %></a>
<a href="<%= admin_bus_booking_duplicate_path(bus) %>"><%= t("bus_booking.duplicate") %></a>
<a class="error" href="<%= admin_bus_booking_path(bus) %>" data-method="delete" data-confirm="Are you sure?"><%= t("bus_booking.delete_route") %></a>
<% end %>
<% if bus.already_reserved?(current_user) %>
<a href="<%= admin_bus_booking_reserve_path(bus) %>"><%= t("bus_booking.manage") %></a>
<% else %>
<% if bus.can_reserve? %>
<a href="<%= admin_bus_booking_reserve_path(bus) %>"><%= t("bus_booking.reserve") %></a>
<% end %>
<% end %>
</td>
<td><%= bus.posted_by %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="bottomnav clearfix">
<%= content_tag :div, paginate(@buses), class: "pagination pagination-centered" %>
</div>