cannot cancel ticket before one hour of departure

This commit is contained in:
Harry Bomrah 2016-06-29 01:01:37 +08:00
parent 19f8dac642
commit 95945ed3cb
1 changed files with 3 additions and 1 deletions

View File

@ -27,7 +27,9 @@
</tr>
</tbody>
</table>
<a href="<%= admin_bus_booking_cancel_path(booking) %>" class="btn btn-danger" data-method="delete" data-confirm="Are you sure?"><%= t("bus_booking.cancel_reservation") %></a>
<% if ((@bus.departure_time - 1.hour) > Time.now rescue true) %>
<a href="<%= admin_bus_booking_cancel_path(booking) %>" class="btn btn-danger" data-method="delete" data-confirm="Are you sure?"><%= t("bus_booking.cancel_reservation") %></a>
<% end %>
</div>
<% else %>
<%= form_for @bus_booking, url: "/admin/bus_bookings/bookbus", html: {class: "form-horizontal main-forms"} do |f|%>