Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui

This commit is contained in:
Aung Myo
2018-06-06 11:35:34 +06:30
8 changed files with 53 additions and 38 deletions

View File

@@ -157,15 +157,3 @@ $(document).ready(function() {
} }
//end Notificaiotn message //end Notificaiotn message
}); });
/* start order reservation function */
function audioPlayBackground(shop_code,audio){
// console.log(shop_code);
//audio play
var audio = new Audio('/'+audio); // define your audio
// setTimeout(function(){
// audio.loop = true;
audio.play();
// },10000);
}
/* end order reservation function */

View File

@@ -580,3 +580,15 @@ function timeFormat(date){
return time; return time;
} }
/* end order reservation function */ /* end order reservation function */
/* start order reservation function */
function audioPlayBackground(shop_code,audio){
// console.log(shop_code);
//audio play
var audio = new Audio('/'+audio); // define your audio
// setTimeout(function(){
// audio.loop = true;
audio.play();
// },10000);
}
/* end order reservation function */

View File

@@ -15,7 +15,6 @@
//= require BSBMaterial/turbolink_admin.js //= require BSBMaterial/turbolink_admin.js
//= require BSBMaterial/demo.js //= require BSBMaterial/demo.js
//= require custom.js //= require custom.js
//= require order_reservation.js
/* Constant Varaibles */ /* Constant Varaibles */
_CREDIT_PAYMENTS_ = "/   CREDIT PAYMENTS"; _CREDIT_PAYMENTS_ = "/   CREDIT PAYMENTS";

View File

@@ -14,14 +14,20 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
end end
if status if status
check_customer = Customer.find_by_email_and_membership_id_and_customer_type(params[:email],params[:membership_id],'Doemal') if params[:customer_id] && !params[:customer_id].nil?
if !check_customer.nil? customer = OrderReservation.addCustomer(params)
customer_id = check_customer.customer_id customer_id = customer.customer_id
else else
customer = OrderReservation.addCustomer(params) check_customer = Customer.find_by_email_and_membership_id_and_customer_type(params[:email],params[:membership_id],'Doemal')
customer_id = customer.id if !check_customer.nil?
customer_id = check_customer.customer_id
else
customer = OrderReservation.addCustomer(params)
customer_id = customer.customer_id
end
end end
if !customer_id.nil?
if customer_id.nil?
render :json => { :status => false, :message => "email and customer are already existed!" } render :json => { :status => false, :message => "email and customer are already existed!" }
else else
render :json => { :status => true, :data => { :customer_id => customer_id} } render :json => { :status => true, :data => { :customer_id => customer_id} }

View File

@@ -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

View File

@@ -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)

View File

@@ -22,7 +22,11 @@ class OrderReservation < ApplicationRecord
else else
gender = "Male" gender = "Male"
end end
customer = Customer.new if params[:customer_id] && !params[:customer_id].nil?
customer = Customer.find(params[:customer_id])
else
customer = Customer.new
end
customer.name = params[:name] customer.name = params[:name]
customer.email = params[:email] customer.email = params[:email]
customer.contact_no = params[:contact_no] ? params[:contact_no] : '' customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
@@ -33,7 +37,6 @@ class OrderReservation < ApplicationRecord
customer.customer_type = "Doemal" customer.customer_type = "Doemal"
customer.tax_profiles = ["2"] customer.tax_profiles = ["2"]
customer.save customer.save
# unless customer.valid? # unless customer.valid?
# render json: { # render json: {
# status: 422, # status: 422,

View File

@@ -197,7 +197,7 @@ scope "(:locale)", locale: /en|mm/ do
post 'payment/voucher' => 'voucher_payments#create' post 'payment/voucher' => 'voucher_payments#create'
post 'payment/paymal' => 'paymal#create' post 'payment/paymal' => 'paymal#create'
post 'payment/alipay' => 'alipay#create' post 'payment/alipay' => 'alipay#create'
post 'payment/junctionpay' => 'junctionpay#create' post 'payment/junctionpay' => 'junction_pay#create'
post 'payment/dinga' => 'dinga#create' post 'payment/dinga' => 'dinga#create'
post 'payment/gift_voucher' => 'gift_voucher#create' post 'payment/gift_voucher' => 'gift_voucher#create'