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
});
/* 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

@@ -579,4 +579,16 @@ function timeFormat(date){
(isPM ? ' PM' : ' AM');
return time;
}
/* 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/demo.js
//= require custom.js
//= require order_reservation.js
/* Constant Varaibles */
_CREDIT_PAYMENTS_ = "/   CREDIT PAYMENTS";

View File

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

View File

@@ -67,7 +67,7 @@ class HomeController < ApplicationController
redirect_to origami_root_path
elsif @employee.role == "waiter"
session[:session_token] = @employee.token_session
redirect_to origami_dashboard_path
route_by_role(@employee)
elsif @employee.role == "account"
session[:session_token] = @employee.token_session
redirect_to reports_dailysale_index_path

View File

@@ -25,15 +25,18 @@ class Origami::DashboardController < BaseOrigamiController
@sale_data = Array.new
@total_payment_methods = Sale.total_payment_methods(today,current_user)
@total_payment_methods.each do |payment|
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)
@sale_data.push({'card' => pay.payment_amount})
else
pay = Sale.payment_sale(payment.payment_method, today, current_user)
@sale_data.push({payment.payment_method => pay.payment_amount})
end
if !@total_payment_methods.nil?
@total_payment_methods.each do |payment|
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)
@sale_data.push({'card' => pay.payment_amount})
else
pay = Sale.payment_sale(payment.payment_method, today, current_user)
@sale_data.push({payment.payment_method => pay.payment_amount})
end
end
else
@sale_data = nil
end
@summ_sale = Sale.summary_sale_receipt(today,current_user)
@total_customer = Sale.total_customer(today,current_user)
@@ -45,12 +48,16 @@ class Origami::DashboardController < BaseOrigamiController
@total_order = Sale.total_order(today,current_user)
@total_accounts = Sale.total_account(today,current_user)
@account_data = Array.new
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, today,current_user)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
end
if !@total_accounts.nil?
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, today,current_user)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
end
else
@account_data = nil
end
@top_items = Sale.top_items(today,current_user)
@total_foc_items = Sale.total_foc_items(today,current_user)

View File

@@ -22,7 +22,11 @@ class OrderReservation < ApplicationRecord
else
gender = "Male"
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.email = params[:email]
customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
@@ -33,7 +37,6 @@ class OrderReservation < ApplicationRecord
customer.customer_type = "Doemal"
customer.tax_profiles = ["2"]
customer.save
# unless customer.valid?
# render json: {
# status: 422,

View File

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