Merge branch 'foodcourt' of https://gitlab.com/code2lab/SXRestaurant into foodcourt

This commit is contained in:
Nweni
2019-11-27 15:51:14 +06:30
14 changed files with 82 additions and 67 deletions

View File

@@ -9,7 +9,7 @@ class Api::Restaurant::MenuController < Api::ApiController
# checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
shop_code = params[:shop_code]
all_menu = Menu.where('shop_id=?',shop_code).active.all
all_menu = Menu.where('shop_code=?',shop_code).active.all
@request_url = ''
if ENV["SERVER_MODE"] == "cloud"
@request_url = request.base_url
@@ -17,20 +17,20 @@ class Api::Restaurant::MenuController < Api::ApiController
# to hash
menu_array = []
all_menu.each do |m|
menu_array.push(m.to_json(:include => {:menu_categories =>
{ :include => { :menu_items =>
{ :include => [:menu_item_sets, :menu_item_instances =>
menu_array.push(m.to_json(:include => {:menu_categories =>
{ :include => { :menu_items =>
{ :include => [:menu_item_sets, :menu_item_instances =>
{ :include => :menu_instance_item_sets}]} } }}))
end
end
#export Checksum file generate by md5
menu_checksum = Digest::MD5.hexdigest(menu_array.to_json)
if menu_checksum != param_checksum
response.headers['CHECKSUM'] = menu_checksum
@menus = all_menu
@menus = all_menu
end
# @current_menu = Menu.current_menu
# @current_menu = Menu.current_menu
end
#Description

View File

@@ -1,6 +1,6 @@
class Api::VerificationsController < ActionController::API
def new
def new
phone_number = params[:phone_number]
#TODO - user generate
@@ -10,9 +10,9 @@ class Api::VerificationsController < ActionController::API
VerifyNumber.send_message(phone_number, @cus.pin_code)
@result = true
end
end
end
def update
def update
phone_number = params[:phone_number]
pin_code = params[:pin_code]
@cus = Customer.find_by_contact_no(phone_number)
@@ -23,4 +23,4 @@ class Api::VerificationsController < ActionController::API
end
end
end
end

View File

@@ -18,7 +18,7 @@ module LoginVerification
def current_shop
begin
shop_code ='262'
shop_code ='263'
@shop =Shop.find_by_shop_code(shop_code)
return @shop
rescue
@@ -42,7 +42,7 @@ module LoginVerification
#Shop Name in Navbor
def shop_detail
shop_code ='262'
shop_code ='263'
@shop = Shop.find_by_shop_code(shop_code)
return @shop
end

View File

@@ -1,5 +1,5 @@
class Origami::BankIntegrationController < ApplicationController #BaseOrigamiController
def settle_trans
if(params[:type] == 'request')
card_settle_trans = CardSettleTran.new()
@@ -35,7 +35,7 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon
card_settle_trans.save()
response = {status: 'success'}
end
render json: response
render json: response
end
def sale_trans
@@ -93,7 +93,7 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon
response = {status: 'success'}
end
render json: response
render json: response
end
end

View File

@@ -17,14 +17,14 @@ class Origami::FoodCourtController < ApplicationController
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@zone = Zone.all
@zone = Zone.all.where("shop_code='#{@shop.shop_code}' and is_active= true")
@customer = Customer.all
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@tables = Table.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@rooms = Room.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@cashier_type = "food_court"
#checked quick_service only
@quick_service_only = true
lookup_dine_in = Lookup.collection_of('dinein_cashier')
lookup_dine_in = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('dinein_cashier')
if !lookup_dine_in.empty?
lookup_dine_in.each do |dine_in|
if dine_in[0].downcase == "dineincashier"
@@ -156,7 +156,7 @@ class Origami::FoodCourtController < ApplicationController
end
def get_all_product()
@product = Product.all
@product = Product..where("shop_code='#{@shop.shop_code}'")
end
# render json for http status code
@@ -186,12 +186,6 @@ class Origami::FoodCourtController < ApplicationController
end
end
end
def check_user
if current_user.nil?
redirect_to root_path
end
end
# this can always true
def check_order_with_booking(booking)
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"

View File

@@ -33,9 +33,9 @@ class Origami::PaymalController < BaseOrigamiController
if customer_data
@membership_id = customer_data.membership_id
if !@membership_id.nil?
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",@shop.shop_code)
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
member_actions =MembershipAction.find_by_membership_type_and_shop_code("get_account_balance",@shop.shop_code)
if member_actions.gateway_url
@campaign_type_id = nil
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
@@ -72,7 +72,6 @@ def create
sale_id = params[:sale_id]
transaction_ref = params[:transaction_ref]
account_no = params[:account_no]
puts params.to_json
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
# shop_details = Shop.first
@@ -87,6 +86,7 @@ def create
# saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
status, @sale,@membership_data = sale_payment.process_payment(saleObj, current_user, cash, "paymal",account_no)
if status == true && @membership_data["status"] == true
@out = true, "Success!"
else

View File

@@ -26,7 +26,7 @@ class Settings::PaymentMethodSettingsController < ApplicationController
# POST /settings/payment_method_settings.json
def create
@settings_payment_method_setting = PaymentMethodSetting.new(settings_payment_method_setting_params)
@settings_payment_method_settings.shop_code = @shop.shop_code
@settings_payment_method_setting.shop_code = @shop.shop_code
respond_to do |format|
if @settings_payment_method_setting.save
format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully created.' }