From 871403382e25e499a078a7cc9133f6cf0234fd3e Mon Sep 17 00:00:00 2001 From: NyanLinHtut Date: Mon, 18 May 2020 14:23:33 +0630 Subject: [PATCH] validate foodcourt origami cashier --- .../foodcourt/food_court_controller.rb | 10 +- app/views/origami/dashboard/index.html.erb | 495 +++++++++--------- 2 files changed, 270 insertions(+), 235 deletions(-) diff --git a/app/controllers/foodcourt/food_court_controller.rb b/app/controllers/foodcourt/food_court_controller.rb index f1a86c9d..10c4686f 100644 --- a/app/controllers/foodcourt/food_court_controller.rb +++ b/app/controllers/foodcourt/food_court_controller.rb @@ -7,7 +7,8 @@ class Foodcourt::FoodCourtController < ApplicationController end end - def index + def index + if !ShiftSale.current_shift.nil? if params[:sale_id].present? sale =Sale.find(params[:sale_id]) if sale @@ -50,6 +51,13 @@ class Foodcourt::FoodCourtController < ApplicationController .joins("JOIN customers ON orders.customer_id=customers.customer_id") .where("bookings.booking_status !=? and sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','completed','paid',Date.today).order("bookings.created_at desc").uniq.length render "foodcourt/addorders/detail" + else + if current_user.role == 'administrator' || current_user.role == 'manager' + redirect_to origami_dashboard_path + else + redirect_to new_foodcourt_shift_path + end + end end def get_menu_category () diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 93cd2cee..bb72b2ed 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -1,269 +1,296 @@ -
- -
- -

<%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %>

-
- - -
- <% if @quick_service == '1' %> -
-
-
- arrow_forward -
-
<%= t :quick_service %>
-
-
- <% end %> - <% if @food_court == '1' %> -
-
-
- arrow_forward -
-
<%= @food_court_name %>
-
-
- <% end %> - <% if @dinein_cashier == '1' %> -
-
-
- arrow_forward -
-
<%= t :dine_in_cashier %>
-
-
- <% end %> - <% if @reservation == '1' %> -
-
-
- arrow_forward -
-
<%= t :reservation %>
-
-
- <% end %> - <% if @order_reservation == '1' %> -
-
-
- arrow_forward -
-
<%= t :order_reservation %>
-
-
- <% end %> +
+ +
+ +

<%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %>

- - <% if !@current_user.nil? && @current_user.role != 'waiter' && @setting_flag %> - -
- <% if !@summ_sale.nil? %> + +
+ <% if @quick_service == '1' %> +
+
+
+ arrow_forward +
+
<%= t :quick_service %>
+
+
+ <% end %> + <% if @food_court == '1' %> +
+
+
+ arrow_forward +
+
<%= @food_court_name %>
+
+
+ <% end %> + <% if @dinein_cashier == '1' %> +
+
+
+ arrow_forward +
+
<%= t :dine_in_cashier %>
+
+
+ <% end %> + <% if @reservation == '1' %> +
+
+
+ arrow_forward +
+
<%= t :reservation %>
+
+
+ <% end %> + <% if @order_reservation == '1' %> +
+
+
+ arrow_forward +
+
<%= t :order_reservation %>
+
+
+ <% end %> +
+ + <% if !@current_user.nil? && @current_user.role != 'waiter' && @setting_flag %> + +
+ <% if !@summ_sale.nil? %> + +
+
+
+
<%= t :sale %>
+ + + + + + + <% revenue = @summ_sale.total_amount - @summ_sale.total_discount%> + + + + + + + + + + + + + + + +
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.receipt") %> : <%= @summ_sale.total_receipt %>
<%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : <%= number_format( revenue, precision: precision.to_i ,delimiter: delimiter) %>
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : <%= number_format( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %>
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : <%= number_format( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%>
<%= t("views.right_panel.detail.total") %> <%= t :sale %> : <%= number_format( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%>
+ + <% if !(@total_payment_methods.nil?) %> + <% @total_payment_methods.each do |payment| %> + <% if !@sale_data[0].empty? %> + <% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %> + + <% if payment.payment_method == 'paypar' %> + + <% else %> + + <% end %> + + + <% end %> + <% end %> + <% end %> + + <% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %> + <% if !total_card.nil? %> + + + + + <% end %> + + <% end %> +
Redeem Sale : <%= payment.payment_method.to_s.capitalize %> Sale : + <% @sale_data.each do |data| %> + <% pay_mth = payment.payment_method %> + <%= data[""+pay_mth+""] %> + <% end %> +
<%= t("views.right_panel.detail.other_payment") %> : + <%= total_card["card"].to_f %> +
+
+
+
+ <% end %>
-
<%= t :sale %>
+
<%= t :customer %>
+ <% if !@total_customer.nil? %> - - + + - - <% revenue = @summ_sale.total_amount - @summ_sale.total_discount%> - - - - - - - - - - - - - - - -
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.receipt") %> : <%= @summ_sale.total_receipt %><%= t("views.right_panel.detail.total") %> <%= t :customer %> : <%= @total_customer %>
<%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : <%= number_format( revenue, precision: precision.to_i ,delimiter: delimiter) %>
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : <%= number_format( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %>
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : <%= number_format( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%>
<%= t("views.right_panel.detail.total") %> <%= t :sale %> : <%= number_format( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%>
- - <% if !(@total_payment_methods.nil?) %> - <% @total_payment_methods.each do |payment| %> - <% if !@sale_data[0].empty? %> - <% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %> - - <% if payment.payment_method == 'paypar' %> - - <% else %> - <% end %> - + + + + <% end %> + <% if !@total_takeaway.nil? %> + + + + + <% end %> + + <% if !@total_membership.nil? %> + + + + + <% end %> +
Redeem Sale : <%= payment.payment_method.to_s.capitalize %> Sale : - <% @sale_data.each do |data| %> - <% pay_mth = payment.payment_method %> - <%= data[""+pay_mth+""] %> + <% if !@total_dinein.nil? %> +
<%= t("views.right_panel.detail.dine_in") %> : <%= @total_dinein %>
<%= t("views.right_panel.detail.takeaway") %> : <%= @total_takeaway %>
<%= t("views.right_panel.detail.membership") %> : <%= @total_membership %>
+
+
+
+
+
+
+
<%= t("views.right_panel.detail.order") %>
+ + <% if !@total_order.nil? %> + + + + + <% end %> + + <% if !@total_accounts.nil? %> + <% @total_accounts.each do |account| %> + + + <% end %> <% end %> - <% end %> - - <% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %> - <% if !total_card.nil? %> + <% if !@top_items.nil? %> - - - - <% end %> - - <% end %> -
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.order") %> : <%= @total_order.total_order %>
<%= account.title %> (Account) : + <% @account_data.each do |data| %> + <% acc = account.title %> + <%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %> <% end %>
<%= t("views.right_panel.detail.other_payment") %> : - <%= total_card["card"].to_f %> -
-
-
-
- <% end %> -
-
-
-
<%= t :customer %>
- - <% if !@total_customer.nil? %> - - - - - <% end %> - <% if !@total_dinein.nil? %> - - - - - <% end %> - <% if !@total_takeaway.nil? %> - - - - - <% end %> - - <% if !@total_membership.nil? %> - - - - - <% end %> -
<%= t("views.right_panel.detail.total") %> <%= t :customer %> : <%= @total_customer %>
<%= t("views.right_panel.detail.dine_in") %> : <%= @total_dinein %>
<%= t("views.right_panel.detail.takeaway") %> : <%= @total_takeaway %>
<%= t("views.right_panel.detail.membership") %> : <%= @total_membership %>
-
-
-
-
-
-
-
<%= t("views.right_panel.detail.order") %>
- - <% if !@total_order.nil? %> - - - - - <% end %> - - <% if !@total_accounts.nil? %> - <% @total_accounts.each do |account| %> - - - + + <% end %> - - - <% end %> - <% end %> - <% if !@top_items.nil? %> - - - - - <% end %> - <% if !@total_foc_items.nil? %> - - - - - <% end %> -
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.order") %> : <%= @total_order.total_order %>
<%= account.title %> (Account) : - <% @account_data.each do |data| %> - <% acc = account.title %> - <%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %> + <%= t :top %> <%= t("views.right_panel.detail.item") %> : <%= @top_items.item_name %> +
(<%= @top_items.item_total_price %>)
<%= t :top %> <%= t("views.right_panel.detail.item") %> : <%= @top_items.item_name %> -
(<%= @top_items.item_total_price %>)
<%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : <%= @total_foc_items.to_int %>
+ <% if !@total_foc_items.nil? %> + + <%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : + <%= @total_foc_items.to_int %> + + <% end %> + +
+ <% end %>
- <% end %> -
" id="server_mode"> +