From 9095dd46d90792ce90f69abf7935a4d87ba4ce3a Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 15 Jan 2018 15:04:17 +0630 Subject: [PATCH] change move table UI --- .../origami/movetable_controller.rb | 16 + app/views/origami/home/show.html.erb | 4 +- .../origami/movetable/move_dining.html.erb | 375 ++++++++++-------- 3 files changed, 238 insertions(+), 157 deletions(-) diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index 4bec80a8..52780381 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -19,10 +19,18 @@ class Origami::MovetableController < BaseOrigamiController order = Order.find(booking_order.order_id) @obj_order = order + @customer = order.customer @date = order.created_at + @booking= booking order.order_items.each do |item| @order_items.push(item) end + accounts = @customer.tax_profiles + @account_arr =[] + accounts.each do |acc| + account = TaxProfile.find(acc) + @account_arr.push(account) + end end @status_order = 'order' else @@ -32,9 +40,17 @@ class Origami::MovetableController < BaseOrigamiController if @status_order == 'order' @status_order = 'sale' end + @booking= booking @date = sale.created_at @status_sale = 'sale' @obj_sale = sale + @customer = sale.customer + accounts = @customer.tax_profiles + @account_arr =[] + accounts.each do |acc| + account = TaxProfile.find(acc) + @account_arr.push(account) + end end end end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index f162be5d..96e883ab 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -135,7 +135,7 @@
<% end %> ORDER DETAILS | Table <%= @dining.name rescue "" %> - <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? && %> + <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> <% else %> Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> @@ -152,7 +152,7 @@ <% else %> ORDER DETAILS | Table <%= @dining.name rescue "" %> <% end %> -
+
diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb index 3df91e14..01be4bb3 100755 --- a/app/views/origami/movetable/move_dining.html.erb +++ b/app/views/origami/movetable/move_dining.html.erb @@ -15,84 +15,152 @@ -
-
- -
-
+
+
+ +
+
<% @tables.each do |table| %> <% if table.status == 'occupied' %> + <% if table.get_booking.nil? %> + <% if table.get_checkout_booking.nil? %>
-
- <%= table.name %> + <% else %> +
+ <% end %> +
+ <%= table.name %> +
+
+ <% else %> + <% if table.get_checkout_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= table.name %> +
+
+ <% end %> + <% else %> +
+
+ <%= table.name %> +
+
+ <% end %> + <% end %>
- <% else %> -
-
- <%= table.name %> + + +
+
+ <% @rooms.each do |room| %> + <% if room.status == 'occupied' %> +
+
+ <%= room.name %> +
+
+ <% else %> +
+
+ <%= room.name %> +
+ <% end %> + <% end %>
- <% end %> - <% end %> -
- -
-
- <% @rooms.each do |room| %> - <% if room.status == 'occupied' %> -
-
- <%= room.name %> -
-
- <% else %> -
-
- <%= room.name %> -
-
- <% end %> - <% end %> +
-
- - -
-
- +
+
-
-
MOVE --> ' <%= @dining.name %> ' to
+
+
MOVE --> ' <%= @dining.name %> ' to
+ <% if @status_order == 'order' && @status_sale != 'sale' %> + <% if !@obj_order.nil? %> +
+ <% else %> +
+ <% end %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> + <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> + <% else %> + Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> + <% end %> +
+ <% elsif @status_sale == 'sale' %> +
INVOICE DETAILS | Table <%= @dining.name rescue "" %> + <% if !@booking.reserved_by.nil? && %> + <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> + <% else %> + Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> + <% end %>
-
-
-
-

Receipt No: - <% if @status_sale == 'sale' %> - <%= @sale_array[0].receipt_no rescue '' %> - <% end %> -

-
-
-

Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

-
-
-
-
-

Customer :

-
+ <% else %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% end %> +
+
+
+
+ <% if (!@sale_array.empty?) && (!@date.nil?) %> +
+   Receipt No: + <% if @status_sale == 'sale' %> + <%= @sale_array[0].receipt_no rescue '' %> + <% end %> + +
+
+
+ Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %> +
+
+ <% elsif !@date.nil? %> +
+   Order No: + <% if @status_order == 'order' %> + <%= @obj_order.order_id rescue '' %> -
-
+ <% end %> + +
+
+
+ Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %> +
+
+ <% end %> +
+
+
+
+ + <% if @status_sale == 'sale' %> + +   Customer : <%= @sale_array[0].customer.name rescue '' %> + <% elsif @status_order == 'order' + %> + +   Customer : <%= @customer.name rescue "" %> + <% end %> + +
+
+
@@ -100,56 +168,53 @@ - - - - - <% - count = 0 - sub_total = 0 - if @status_sale == "sale" - puts @sale_array[0] - @sale_array[0].sale_items.each do |sale_item| - count += 1 - sub_total = sub_total + sale_item.price - %> - - <% unless sale_item.price <= 0 %> - - - - - - - <% - end - end - end - - if @status_order == 'order' && @status_sale != 'sale' - unless @order_items.nil? - count = 0 - @order_items.each do |order_item | - puts @order_items.size - puts "view" + + + + + <% + count = 0 + sub_total = 0 + if @status_sale == "sale" + @sale_array[0].sale_items.each do |sale_item| count += 1 - sub_total = sub_total + order_item.price - - unless order_item.price <= 0 %> + sub_total = sub_total + sale_item.price + %> + + <% unless sale_item.price <= 0 %> - - - + + + <% end end end + + if @status_order == 'order' && @status_sale != 'sale' + unless @order_items.nil? || @order_items.empty? + count = 0 + @order_items.each do |order_item | + count += 1 + sub_total = sub_total + (order_item.price * order_item.qty) + + #unless order_item.price <= 0 %> + + + + + + + <% + #end + end end - %> - -
# Items QTYPrice
<%= count %><%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
Price
<%= count %><%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %><%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
<%= count %><%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
+ end + %> + +
<% @@ -212,10 +277,10 @@ end