From daf35548260bda88c158b4d9b3217d33a0060d31 Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 7 Dec 2017 17:04:55 +0630 Subject: [PATCH] table status color --- app/models/dining_facility.rb | 4 ++++ app/views/origami/home/index.html.erb | 8 ++------ app/views/origami/home/show.html.erb | 14 +++----------- app/views/origami/rooms/show.html.erb | 16 ++++------------ 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 4159372a..3b8eb22e 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -88,7 +88,11 @@ class DiningFacility < ApplicationRecord checkout_at_min -= min if (checkout_at_hr <= hr) && (checkout_at_min <= 15) return booking + else + return nil end + else + return nil end end end diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 4e3d27c1..df7d3f5f 100755 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -47,12 +47,8 @@ Table <%= table.name %> ( <%= table.seater %> Seat ) - <% else %> - <% if table.get_checkout_booking.nil? %> -
- <% else %> -
- <% end %> + <% else %> +
Zone <%= table.zone_id %>
Table <%= table.name %> ( <%= table.seater %> Seat ) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 6368ede9..718eb73c 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -40,23 +40,15 @@ <% @tables.each do |table| %> <% if table.status == 'occupied' %> <% if table.get_booking.nil? %> - <% if table.get_checkout_booking.nil? %> -
- <% else %> -
- <% end %> +
<%= table.name %> billed
- <% else %> - <% if table.get_checkout_booking.nil? %> -
- <% else %> -
- <% end %> + <% else %> +
<%= table.name %> new diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index d8901f35..7b76ecd3 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -39,23 +39,15 @@
<% @tables.each do |table| %> <% if table.status == 'occupied' %> - <% if table.get_booking.nil? %> - <% if table.get_checkout_booking.nil? %> -
- <% else %> -
- <% end %> + <% if table.get_booking.nil? %> +
<%= table.name %> billed
- <% else %> - <% if table.get_checkout_booking.nil? %> -
- <% else %> -
- <% end %> + <% else %> +
<%= table.name %> new