From 95945ed3cb2a89bd816d8c43ae0563c57d1220df Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 29 Jun 2016 01:01:37 +0800 Subject: [PATCH] cannot cancel ticket before one hour of departure --- app/views/admin/bus_bookings/reserve.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/admin/bus_bookings/reserve.html.erb b/app/views/admin/bus_bookings/reserve.html.erb index c37cca1..30ae531 100644 --- a/app/views/admin/bus_bookings/reserve.html.erb +++ b/app/views/admin/bus_bookings/reserve.html.erb @@ -27,7 +27,9 @@ - <%= t("bus_booking.cancel_reservation") %> + <% if ((@bus.departure_time - 1.hour) > Time.now rescue true) %> + <%= t("bus_booking.cancel_reservation") %> + <% end %> <% else %> <%= form_for @bus_booking, url: "/admin/bus_bookings/bookbus", html: {class: "form-horizontal main-forms"} do |f|%>