menu item by id
This commit is contained in:
@@ -155,7 +155,7 @@ class Api::PaymentsController < Api::ApiController
|
|||||||
other_amount = SaleItem.calculate_other_charges(sale_items)
|
other_amount = SaleItem.calculate_other_charges(sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,params[:card_no], item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
|
||||||
|
|
||||||
render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no,:order_no => latest_order_no, :message => "Payment successful."})
|
render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no,:order_no => latest_order_no, :message => "Payment successful."})
|
||||||
else
|
else
|
||||||
|
|||||||
16
app/controllers/api/restaurant/menu_items_controller.rb
Normal file
16
app/controllers/api/restaurant/menu_items_controller.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class Api::Restaurant::MenuItemsController < Api::ApiController
|
||||||
|
|
||||||
|
skip_before_action :authenticate
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
# Input Params - id
|
||||||
|
def show
|
||||||
|
@request_url = ''
|
||||||
|
if ENV["SERVER_MODE"] == "cloud"
|
||||||
|
@request_url = request.base_url
|
||||||
|
end
|
||||||
|
@menu_item = MenuItem.find_by_id(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,73 +1,5 @@
|
|||||||
class Foodcourt::PaymalController < BaseFoodcourtController
|
class Foodcourt::PaymalController < BaseFoodcourtController
|
||||||
|
|
||||||
def index
|
|
||||||
@sale_id = params[:sale_id]
|
|
||||||
payment_method = params[:payment_method]
|
|
||||||
@cashier_type = params[:type]
|
|
||||||
@membership_rebate_balance=0
|
|
||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
|
||||||
@receipt_no = sale_data.receipt_no
|
|
||||||
|
|
||||||
if @shop.is_rounding_adj
|
|
||||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
|
||||||
else
|
|
||||||
new_total = sale_data.grand_total
|
|
||||||
end
|
|
||||||
@rounding_adj = new_total-sale_data.grand_total
|
|
||||||
# @rounding_adj = sale_data.rounding_adjustment
|
|
||||||
|
|
||||||
@payparcount = 0
|
|
||||||
others = 0
|
|
||||||
sale_data.sale_payments.each do |sale_payment|
|
|
||||||
if sale_payment.payment_method == "paypar"
|
|
||||||
@payparcount = @payparcount + sale_payment.payment_amount
|
|
||||||
else
|
|
||||||
others = others + sale_payment.payment_amount
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@payment_prices = sale_data.grand_total - @payparcount -others
|
|
||||||
|
|
||||||
|
|
||||||
if sale_data
|
|
||||||
if sale_data.customer_id
|
|
||||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
|
||||||
if customer_data
|
|
||||||
@membership_id = customer_data.membership_id
|
|
||||||
if !@membership_id.nil?
|
|
||||||
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_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
|
|
||||||
merchant_uid= member_actions.merchant_account_id
|
|
||||||
auth_token = member_actions.auth_token.to_s
|
|
||||||
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
|
||||||
if membership_data["status"]==true
|
|
||||||
@membership_rebate_balance=membership_data["balance"]
|
|
||||||
@out = true, @membership_rebate_balance,@membership_id
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@out =false,0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@out = false,0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@out = false, 0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@out = false, 0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@out = false, 0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@out = false, 0
|
|
||||||
end
|
|
||||||
@out = false, 0
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
cash = params[:payment_amount]
|
cash = params[:payment_amount]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
|
|||||||
path = request.fullpath
|
path = request.fullpath
|
||||||
latest_order_no = nil
|
latest_order_no = nil
|
||||||
is_kbz = params[:is_kbz]
|
is_kbz = params[:is_kbz]
|
||||||
|
account_no =params[:account_no]
|
||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
@@ -131,16 +132,16 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
|
|||||||
|
|
||||||
#for card sale data
|
#for card sale data
|
||||||
card_data = Array.new
|
card_data = Array.new
|
||||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
# card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||||
if !card_sale_trans_ref_no.nil?
|
# if !card_sale_trans_ref_no.nil?
|
||||||
card_sale_trans_ref_no.each do |cash_sale_trans|
|
# card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||||
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
# card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||||
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
# card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||||
card_no = cash_sale_trans.pan.last(4)
|
# card_no = cash_sale_trans.pan.last(4)
|
||||||
card_no = card_no.rjust(19,"**** **** **** ")
|
# card_no = card_no.rjust(19,"**** **** **** ")
|
||||||
card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
|
# card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
#card_balance amount for Paymal payment
|
#card_balance amount for Paymal payment
|
||||||
card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
|
card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
|
||||||
@@ -153,7 +154,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
|
|||||||
other_amount = SaleItem.calculate_other_charges(sale_items)
|
other_amount = SaleItem.calculate_other_charges(sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,account_no, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
|
||||||
|
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,113 +0,0 @@
|
|||||||
class Foodcourt::RequestBillsController < ApplicationController
|
|
||||||
before_action :check_user
|
|
||||||
|
|
||||||
def check_user
|
|
||||||
if current_user.nil?
|
|
||||||
redirect_to root_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# Print Request Bill and add to sale tables
|
|
||||||
def print
|
|
||||||
if !ShiftSale.current_shift.nil?
|
|
||||||
order_id = params[:id] # order_id
|
|
||||||
order = Order.find(order_id)
|
|
||||||
booking = order.booking
|
|
||||||
if booking.checkin_at.utc > Time.now.utc && booking.checkout_at.nil?
|
|
||||||
@status = false
|
|
||||||
@error_message = "Operation failed, Could not request bill!"
|
|
||||||
else
|
|
||||||
table = DiningFacility.find_by(id: booking.dining_facility_id)
|
|
||||||
|
|
||||||
if sale_data = booking.sale
|
|
||||||
@status = true
|
|
||||||
elsif sale_data = Sale.generate_invoice_from_booking(booking, current_login_employee, current_user, order.source, params[:current_checkin_induties_count])
|
|
||||||
@status = true
|
|
||||||
# in-duty update
|
|
||||||
in_duties = InDuty.where("booking_id=?", booking.id)
|
|
||||||
if !in_duties.empty?
|
|
||||||
in_duties.each do |in_duty|
|
|
||||||
induty = InDuty.find(in_duty.id)
|
|
||||||
induty.sale_id = sale_data.sale_id
|
|
||||||
induty.out_time = Time.now.utc
|
|
||||||
induty.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Bind shift sale id to sale
|
|
||||||
# @sale_data.shift_sale_id = shift.id
|
|
||||||
# @sale_data.save
|
|
||||||
|
|
||||||
action_by = current_user.name
|
|
||||||
type = "REQUEST_BILL"
|
|
||||||
|
|
||||||
remark = "Request bill Receipt No #{sale_data.receipt_no}"
|
|
||||||
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
|
|
||||||
|
|
||||||
# Promotion Activation
|
|
||||||
Promotion.promo_activate(sale_data)
|
|
||||||
|
|
||||||
#bill channel
|
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
|
||||||
from = request.subdomain + "." + request.domain
|
|
||||||
else
|
|
||||||
from = ""
|
|
||||||
end
|
|
||||||
|
|
||||||
if order.source == "cashier" || order.source == "quick_service"
|
|
||||||
ActionCable.server.broadcast "bill_channel",table: table, from: from
|
|
||||||
end
|
|
||||||
if order.source == "quick_service" || order.source == "food_court"
|
|
||||||
result = {:status=> @status, :data => sale_data.sale_id }
|
|
||||||
render :json => result.to_json
|
|
||||||
else
|
|
||||||
#check checkInOut pdf print
|
|
||||||
checkout_time = Lookup.collection_of('checkout_time')
|
|
||||||
if !booking.dining_facility_id.nil?
|
|
||||||
terminal = DiningFacility.find_by_id(booking.dining_facility_id)
|
|
||||||
cashier_terminal = CashierTerminal.find_by_id(terminal.zone_id)
|
|
||||||
|
|
||||||
if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server
|
|
||||||
unique_code = "CheckInOutPdf"
|
|
||||||
printer = PrintSetting.find_by_unique_code(unique_code)
|
|
||||||
|
|
||||||
# print when complete click
|
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(printer)
|
|
||||||
|
|
||||||
if !printer.nil?
|
|
||||||
order_queue_printer.print_check_in_out(printer, cashier_terminal, booking, table)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@status = true
|
|
||||||
else
|
|
||||||
@status = false
|
|
||||||
@error_message = "No Current Open Shift for This Employee"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Not Use for these printed bill cannot give customer
|
|
||||||
# unique_code = "ReceiptBillPdf"
|
|
||||||
# #shop detail
|
|
||||||
# shop_details = Shop.find(1)
|
|
||||||
# # customer= Customer.where('customer_id=' +.customer_id)
|
|
||||||
# customer= Customer.find(@sale_data.customer_id)
|
|
||||||
# # get member information
|
|
||||||
# member_info = Customer.get_member_account(customer)
|
|
||||||
# # get printer info
|
|
||||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
|
||||||
|
|
||||||
# # find order id by sale id
|
|
||||||
# # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
|
||||||
|
|
||||||
# # Calculate price_by_accounts
|
|
||||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
|
||||||
|
|
||||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
|
||||||
|
|
||||||
|
|
||||||
# printer.print_receipt_bill(print_settings, false, nil,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -5,7 +5,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
||||||
|
|
||||||
def initialize(printer_settings, kbz_pay_status, qr_code, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no,card_balance_amount,transaction_ref)
|
def initialize(printer_settings, kbz_pay_status, qr_code, sale_items, sale_data, customer_account, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no,card_balance_amount,transaction_ref)
|
||||||
self.page_width = printer_settings.page_width
|
self.page_width = printer_settings.page_width
|
||||||
self.page_height = printer_settings.page_height
|
self.page_height = printer_settings.page_height
|
||||||
self.header_font_size = printer_settings.header_font_size.to_i
|
self.header_font_size = printer_settings.header_font_size.to_i
|
||||||
@@ -59,17 +59,19 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
cashier_info(sale_data, customer_name, latest_order_no)
|
cashier_info(sale_data, customer_account, latest_order_no)
|
||||||
line_items(sale_items,precision,delimiter)
|
line_items(sale_items,precision,delimiter)
|
||||||
all_total(sale_data,precision,delimiter)
|
all_total(sale_data,precision,delimiter)
|
||||||
|
|
||||||
|
|
||||||
if member_info != nil
|
if member_info != nil
|
||||||
member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
member_info(member_info,customer_account,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||||
|
end
|
||||||
|
if sale_data.orders[0].source =='app' || sale_data.orders[0].source =='food_court'
|
||||||
|
customer(customer_account,'card')
|
||||||
|
else
|
||||||
|
customer(customer_account,nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
customer(customer_name)
|
|
||||||
|
|
||||||
#start card sale trans data
|
#start card sale trans data
|
||||||
if card_data != nil
|
if card_data != nil
|
||||||
card_sale_data(card_data)
|
card_sale_data(card_data)
|
||||||
@@ -124,7 +126,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def cashier_info(sale_data, customer_name, latest_order_no)
|
def cashier_info(sale_data, customer_account, latest_order_no)
|
||||||
if latest_order_no.nil?
|
if latest_order_no.nil?
|
||||||
move_down line_move
|
move_down line_move
|
||||||
text "Booking : #{ sale_data.bookings[0].booking_id }", :size => self.header_font_size+2,:align => :left
|
text "Booking : #{ sale_data.bookings[0].booking_id }", :size => self.header_font_size+2,:align => :left
|
||||||
@@ -504,7 +506,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# show member information
|
# show member information
|
||||||
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
def member_info(member_info,customer_account,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||||
if rebate_amount != nil
|
if rebate_amount != nil
|
||||||
if rebate_amount["status"] == true
|
if rebate_amount["status"] == true
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
@@ -595,15 +597,21 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def customer(customer_name)
|
def customer(customer_account,type)
|
||||||
# move_down line_move
|
# move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
#move_down line_move
|
#move_down line_move
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
if type=='card'
|
||||||
text "Customer Name", :size => self.item_font_size,:align => :left
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "Customer Acc", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
else
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "Customer Name", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
text "#{ customer_account }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down line_move
|
move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|||||||
129
app/views/api/restaurant/menu_items/_menu_item.json.jbuilder
Normal file
129
app/views/api/restaurant/menu_items/_menu_item.json.jbuilder
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
# Format for attributes json
|
||||||
|
attr_format = []
|
||||||
|
# Format for attributes json
|
||||||
|
if item.is_available
|
||||||
|
if item.item_attributes.count > 0
|
||||||
|
item.item_attributes.each do|attr_id|
|
||||||
|
menu_attr = MenuItemAttribute.find(attr_id)
|
||||||
|
if attr_format.count == 0
|
||||||
|
attr_format.push({ type: menu_attr.attribute_type, values: [menu_attr.name] })
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
attr_format.each do |af|
|
||||||
|
if menu_attr.attribute_type.in? attr_format.map {|k| k[:type]}
|
||||||
|
if menu_attr.attribute_type == af[:type]
|
||||||
|
af[:values].push(menu_attr.name)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
new_attr = {type: menu_attr.attribute_type, values: [ menu_attr.name ] }
|
||||||
|
attr_format.push(new_attr)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Format for option json
|
||||||
|
opt_format = []
|
||||||
|
# Format for attributes json
|
||||||
|
if item.item_options.count > 0
|
||||||
|
item.item_options.each do|opt|
|
||||||
|
menu_opt = MenuItemOption.find(opt)
|
||||||
|
if opt_format.count == 0
|
||||||
|
opt_format.push({ type: menu_opt.option_type, values: [menu_opt.name] })
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
opt_format.each do |of|
|
||||||
|
if menu_opt.option_type.in? opt_format.map {|k| k[:type]}
|
||||||
|
if menu_opt.option_type == of[:type]
|
||||||
|
of[:values].push(menu_opt.name)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
new_opt = {type: menu_opt.option_type, values: [ menu_opt.name ] }
|
||||||
|
opt_format.push(new_opt)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#Menu Item Information
|
||||||
|
json.id item.id
|
||||||
|
json.code item.item_code
|
||||||
|
json.name item.name
|
||||||
|
json.alt_name item.alt_name
|
||||||
|
if !request_url.nil? && request_url != '' && !item.image_path.nil?
|
||||||
|
json.image request_url + item.image_path.to_s
|
||||||
|
else
|
||||||
|
json.image item.image_path.url
|
||||||
|
end
|
||||||
|
json.description item.description
|
||||||
|
json.information item.information
|
||||||
|
json.type item.type
|
||||||
|
json.account_id item.account_id
|
||||||
|
json.min_qty item.min_qty
|
||||||
|
json.is_available item.is_available
|
||||||
|
json.is_sub_item item.is_sub_item
|
||||||
|
json.unit item.unit
|
||||||
|
|
||||||
|
# Item Sets of Menu Item
|
||||||
|
json.item_sets item.item_sets do |its|
|
||||||
|
json.id its.id
|
||||||
|
json.name its.name
|
||||||
|
json.alt_name its.alt_name
|
||||||
|
json.min_selectable_qty its.min_selectable_qty
|
||||||
|
json.max_selectable_qty its.max_selectable_qty
|
||||||
|
json.instances its.menu_item_instances do |i|
|
||||||
|
json.id i.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
json.attributes attr_format
|
||||||
|
json.options opt_format
|
||||||
|
# json.min_selectable_item item.min_selectable_item
|
||||||
|
# json.max_selectable_item item.max_selectable_item
|
||||||
|
|
||||||
|
#Item instance
|
||||||
|
# if item.menu_item_instances.count == 1 then
|
||||||
|
# item_instance = item.menu_item_instances[0]
|
||||||
|
# json.price = item_instance.price
|
||||||
|
# json.is_available = item_instance.is_available
|
||||||
|
# json.is_on_promotion = item_instance.is_on_promotion
|
||||||
|
# json.promotion_price = item_instance.promotion_price
|
||||||
|
# json.item_attributes = item_instance.item_attributes
|
||||||
|
|
||||||
|
json.instances item.menu_item_instances do |is|
|
||||||
|
if is.is_available
|
||||||
|
# Convert id to name for attributes
|
||||||
|
instance_attr = []
|
||||||
|
|
||||||
|
is.item_attributes.each do |ia|
|
||||||
|
# mItemAttr = MenuItemAttribute.find(is)
|
||||||
|
# instance_attr.push(ia)
|
||||||
|
mItemAttr = MenuItemAttribute.find(ia).name
|
||||||
|
instance_attr.push(mItemAttr)
|
||||||
|
end
|
||||||
|
|
||||||
|
json.id is.id
|
||||||
|
json.code is.item_instance_code
|
||||||
|
json.name is.item_instance_name
|
||||||
|
json.price is.price
|
||||||
|
json.is_available is.is_available
|
||||||
|
json.is_default is.is_default
|
||||||
|
json.is_on_promotion is.is_on_promotion
|
||||||
|
json.promotion_price is.promotion_price
|
||||||
|
json.values instance_attr
|
||||||
|
json.out_of_stock is.is_out_of_stock
|
||||||
|
# json.item_sets is.item_sets
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#Child Menu items
|
||||||
|
# if (item.children) then
|
||||||
|
# json.set_items item.children.each do |item|
|
||||||
|
# json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
end
|
||||||
3
app/views/api/restaurant/menu_items/show.json.jbuilder
Normal file
3
app/views/api/restaurant/menu_items/show.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
if (@menu_item)
|
||||||
|
json.partial! 'api/restaurant/menu/menu_item', item: @menu_item, request_url: @request_url
|
||||||
|
end
|
||||||
@@ -1530,7 +1530,7 @@ $(document).ready(function(){
|
|||||||
var url = "<%= foodcourt_payment_cash_path %>";
|
var url = "<%= foodcourt_payment_cash_path %>";
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz,
|
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz+"&account_no="+customer_mamber_card_no,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
/* start delete receipt no in first bill*/
|
/* start delete receipt no in first bill*/
|
||||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
|
|||||||
Reference in New Issue
Block a user