update origami dashboard
This commit is contained in:
@@ -67,7 +67,7 @@ class HomeController < ApplicationController
|
|||||||
redirect_to origami_root_path
|
redirect_to origami_root_path
|
||||||
elsif @employee.role == "waiter"
|
elsif @employee.role == "waiter"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to origami_dashboard_path
|
route_by_role(@employee)
|
||||||
elsif @employee.role == "account"
|
elsif @employee.role == "account"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to reports_dailysale_index_path
|
redirect_to reports_dailysale_index_path
|
||||||
|
|||||||
@@ -25,15 +25,18 @@ class Origami::DashboardController < BaseOrigamiController
|
|||||||
|
|
||||||
@sale_data = Array.new
|
@sale_data = Array.new
|
||||||
@total_payment_methods = Sale.total_payment_methods(today,current_user)
|
@total_payment_methods = Sale.total_payment_methods(today,current_user)
|
||||||
|
if !@total_payment_methods.nil?
|
||||||
@total_payment_methods.each do |payment|
|
@total_payment_methods.each do |payment|
|
||||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
||||||
pay = Sale.payment_sale('card', today, current_user)
|
pay = Sale.payment_sale('card', today, current_user)
|
||||||
@sale_data.push({'card' => pay.payment_amount})
|
@sale_data.push({'card' => pay.payment_amount})
|
||||||
else
|
else
|
||||||
pay = Sale.payment_sale(payment.payment_method, today, current_user)
|
pay = Sale.payment_sale(payment.payment_method, today, current_user)
|
||||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@sale_data = nil
|
||||||
end
|
end
|
||||||
@summ_sale = Sale.summary_sale_receipt(today,current_user)
|
@summ_sale = Sale.summary_sale_receipt(today,current_user)
|
||||||
@total_customer = Sale.total_customer(today,current_user)
|
@total_customer = Sale.total_customer(today,current_user)
|
||||||
@@ -45,11 +48,15 @@ class Origami::DashboardController < BaseOrigamiController
|
|||||||
@total_order = Sale.total_order(today,current_user)
|
@total_order = Sale.total_order(today,current_user)
|
||||||
@total_accounts = Sale.total_account(today,current_user)
|
@total_accounts = Sale.total_account(today,current_user)
|
||||||
@account_data = Array.new
|
@account_data = Array.new
|
||||||
@total_accounts.each do |account|
|
if !@total_accounts.nil?
|
||||||
acc = Sale.account_data(account.account_id, today,current_user)
|
@total_accounts.each do |account|
|
||||||
if !acc.nil?
|
acc = Sale.account_data(account.account_id, today,current_user)
|
||||||
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
if !acc.nil?
|
||||||
end
|
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@account_data = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@top_items = Sale.top_items(today,current_user)
|
@top_items = Sale.top_items(today,current_user)
|
||||||
|
|||||||
Reference in New Issue
Block a user