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

This commit is contained in:
NyanLinHtut
2019-12-18 14:19:06 +06:30
22 changed files with 179 additions and 171 deletions

View File

@@ -311,6 +311,9 @@ settings/lookups => {type:show_total_before_tax, name:Show Total Before Tax, val
For Using Staff Meal For Using Staff Meal
settings/lookups => { type:customer_type, name: Staff, value:Staff } settings/lookups => { type:customer_type, name: Staff, value:Staff }
For FoodCourt Cashier role
settings/lookups => { type:employee_roles, name: FoodCourt Cashier, value:foodcourt_cashier }
* ToDo list * ToDo list
1. Migration 1. Migration

View File

@@ -1655,4 +1655,32 @@ $(function() {
//end is_sub_item false //end is_sub_item false
} }
} }
$("#add_to_existing_order").on('click', function(e){
$(this).attr('disabled', 'disabled');
e.preventDefault();
type = $("#link_type").val();
$("#oqs_loading_wrapper").show();
var ajax_url = 'addorders/add_to_existing_order';
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
var customer_id = $('#customer_id').text();
var booking_id = $('#booking_id').text();
var sale_id = $('#sale_id').text();
var order_items = JSON.stringify(get_order_item_rows());
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
'table_id': table_id,
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
$.ajax({
type: "POST",
url: ajax_url,
data: params,
dataType: "json",
success:function(result){
if (result.status) {
window.location.href = "/foodcourt/table/sale/" + sale_id + "/food_court/edit";
}
}
});
});
}); });

View File

@@ -1,5 +1,5 @@
class Api::CustomersController < ActionController::API class Api::CustomersController < Api::ApiController
skip_before_action :authenticate
#List all active customers by name #List all active customers by name
def index def index
@customers = Customer.order("name asc") @customers = Customer.order("name asc")
@@ -17,6 +17,6 @@ class Api::CustomersController < ActionController::API
#Show customer last five order #Show customer last five order
def get_customer_last_orders def get_customer_last_orders
@customer = Customer.find(params[:customer_id]) @sales =Sale.where("sales.customer_id=? and sales.sale_status =?",params[:customer_id],'completed').order("created_at desc").limit(5)
end end
end end

View File

@@ -122,8 +122,8 @@ class Api::OrdersController < Api::ApiController
end end
@status, @booking = @order.generate @status, @booking = @order.generate
if @status && @booking if params[:order_source] != "app"
Order.process_order_queue(@order.order_id,@order.table_id,@order.source) @order.process_order_queue(@order.order_id,@order.table_id,@order.source)
end end
if @order.table_id.to_i > 0 if @order.table_id.to_i > 0
table = DiningFacility.find(@booking.dining_facility_id) table = DiningFacility.find(@booking.dining_facility_id)
@@ -131,12 +131,6 @@ class Api::OrdersController < Api::ApiController
from = getCloudDomain #get sub domain in cloud mode from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
end end
# # for parallel order
# remoteIP = ""
# begin
# @status, @booking = @order.generate
# remoteIP = request.remote_ip
# end while request.remote_ip != remoteIP
if current_user.role != "waiter" && params[:create_type] == "create_pay" if current_user.role != "waiter" && params[:create_type] == "create_pay"
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court') || (@order.source == 'app') if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court') || (@order.source == 'app')
@status, @sale = Sale.request_bill(@order,current_user,current_user) @status, @sale = Sale.request_bill(@order,current_user,current_user)

View File

@@ -5,7 +5,7 @@ class Api::VerificationsController < Api::ApiController
#TODO - user generate #TODO - user generate
cus = Customer.new cus = Customer.new
@cus = cus.draft_customer(phone_number, rand(1000..9999)) @cus = cus.draft_customer(params, rand(1000..9999))
if @cus.verify_status == false if @cus.verify_status == false
VerifyNumber.send_message(phone_number, @cus.pin_code) VerifyNumber.send_message(phone_number, @cus.pin_code)
@result = true @result = true

View File

@@ -305,5 +305,56 @@ class Foodcourt::AddordersController < BaseFoodcourtController
return from return from
end end
def add_to_existing_order
if params[:booking_id].present? && params[:sale_id].present?
booking = Booking.find(params[:booking_id])
saleobj =Sale.find(params[:sale_id])
order =saleobj.orders[0]
items_arr = []
JSON.parse(params[:order_items]).each { |i|
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
if i["item_instance_code"].include? "ext"
is_extra_time = true
arr_exts = i["item_instance_code"].split("_")
if arr_exts[1].match(/^(\d)+$/)
time = arr_exts[1].to_i*60*i["quantity"].to_i
extra_time = Time.at(time)
end
end
if i["parent_order_item_id"];
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])}
else
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])}
end
items_arr.push(items)
}
order.items = items_arr
order.new_booking = false
order.booking_id = booking.booking_id
@status, booking = order.generate
order_array = []
items_arr.each do |item|
order_item =order.order_items.where("item_instance_code=?",item[:item_instance_code]).last
saleobj.add_item (order_item)
if !order_item.set_menu_items.nil?
saleobj.add_sub_item(order_item.set_menu_items)
end
end
# Re-compute for add
saleobj.compute(order.source)
saleobj.save
order.save
booking.save
order_array.push(order.order_id)
receipt_no = saleobj.receipt_no
action_by = current_user.name
type = "ADD_TO_EXISTING"
remark = "#{action_by} add to existing order #{order_array} to Receipt No=>#{receipt_no}"
sale_audit = SaleAudit.record_audit_sale(saleobj.sale_id,remark,action_by,type )
end
result = {:status=> @status}
render :json => result.to_json
end
end end

View File

@@ -8,6 +8,15 @@ class Foodcourt::FoodCourtController < ApplicationController
end end
def index def index
if params[:sale_id].present?
sale =Sale.find(params[:sale_id])
if sale
@sale_id =sale.sale_id
@booking_id =sale.bookings[0].booking_id
end
end
today = DateTime.now today = DateTime.now
day = Date.today.wday day = Date.today.wday
@menus = [] @menus = []

View File

@@ -6,7 +6,7 @@ class Foodcourt::HomeController < BaseFoodcourtController
@webview = check_mobile @webview = check_mobile
@tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@complete = Sale.completed_sale("cashier",@shop.shop_code) @complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("shop_code='#{@shop.shop_code}' and DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc') @orders = Order.includes("sale_orders").where("shop_code='#{@shop.shop_code}' and DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name") @customers = Customer.pluck("customer_id, name")
@@ -21,7 +21,7 @@ class Foodcourt::HomeController < BaseFoodcourtController
@webview = check_mobile @webview = check_mobile
@tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@complete = Sale.completed_sale("cashier",@shop.shop_code) @complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("shop_code='#{@shop.shop_code}' and DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc') @orders = Order.includes("sale_orders").where("shop_code='#{@shop.shop_code}' and DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name") @customers = Customer.pluck("customer_id, name")
@shift = ShiftSale.current_open_shift(current_user) @shift = ShiftSale.current_open_shift(current_user)

View File

@@ -38,19 +38,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController
# re-calc tax # re-calc tax
saleObj = Sale.find(saleitemObj.sale_id) saleObj = Sale.find(saleitemObj.sale_id)
# booking = Booking.find_by_sale_id(saleitemObj.sale_id)
# booking.booking_orders.each do |bo|
# order = Order.find(bo.order_id)
# order.order_items.each do |o|
# if saleitemObj.product_code == o.item_code
# o.qty = saleitemObj.qty * -1
# o.price = saleitemObj.price * -1
# o.save
# end
# end
# end
# FOr Sale Audit # FOr Sale Audit
action_by = current_user.name action_by = current_user.name
if access_code != "null" && current_user.role == "cashier" if access_code != "null" && current_user.role == "cashier"
@@ -99,26 +86,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController
ProductCommission.create_product_commission(@newsaleitem, saleitemObj) ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
end end
# def item_edit
# saleitemId = params[:sale_item_id]
# update_qty = params[:update_qty]
# update_price = params[:update_price]
# saleitemObj = SaleItem.find(saleitemId)
# saleitemObj.status = 'void'
# saleitemObj.save
# @newsaleitem = SaleItem.new
# @newsaleitem = saleitemObj.dup
# @newsaleitem.save
# @newsaleitem.qty = update_qty
# @newsaleitem.price = update_price
# @newsaleitem.unit_price = update_price
# @newsaleitem.taxable_price = update_price
# @newsaleitem.is_taxable = 0
# @newsaleitem.remark = 'edit'
# @newsaleitem.product_name = saleitemObj.product_name + " - updated"
# @newsaleitem.save
# end
def item_edit def item_edit
saleitemId = params[:sale_item_id] saleitemId = params[:sale_item_id]
update_qty = params[:update_qty] update_qty = params[:update_qty]
@@ -149,20 +116,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController
saleitemObj.save saleitemObj.save
# re-calc tax
# saleObj = Sale.find(saleitemObj.sale_id)
# order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
# order = Order.find(order_id)
# order.order_items.each do |o|
# if saleitemObj.product_code == o.item_code
# o.qty = update_qty
# o.price = update_price
# o.save
# end
# end
sale.compute_by_sale_items(sale.total_discount, nil, order_source) sale.compute_by_sale_items(sale.total_discount, nil, order_source)
ProductCommission.edit_product_commission(saleitemObj,sale.shop_code) ProductCommission.edit_product_commission(saleitemObj,sale.shop_code)

View File

@@ -5,7 +5,7 @@ class Origami::PendingOrderController < BaseOrigamiController
@cashier_type = params[:type] @cashier_type = params[:type]
@sale = Sale.pending_sale(@cashier_type) @sale = Sale.pending_sale(@cashier_type)
@order = Sale.pending_order(@cashier_type) @order = Sale.pending_order(@cashier_type)
@completed = Sale.completed_sale(@cashier_type,@shop.shop_code) @completed = Sale.completed_sale(@cashier_type)
@customers = Customer.pluck("customer_id, name") @customers = Customer.pluck("customer_id, name")
@occupied_table = @sale.count.length + @order.count.length @occupied_table = @sale.count.length + @order.count.length
@@ -36,7 +36,7 @@ class Origami::PendingOrderController < BaseOrigamiController
@cashier_type = params[:type] @cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type) @sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type) @orders = Sale.pending_order(@cashier_type)
@completed = Sale.completed_sale(@cashier_type,@shop.shop_code) @completed = Sale.completed_sale(@cashier_type)
@customers = Customer.pluck("customer_id, name") @customers = Customer.pluck("customer_id, name")
@occupied_table = @sales.count.length + @orders.count.length @occupied_table = @sales.count.length + @orders.count.length
@@ -46,7 +46,7 @@ class Origami::PendingOrderController < BaseOrigamiController
@cashier_type = params[:type] @cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type) @sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type) @orders = Sale.pending_order(@cashier_type)
@completed = Sale.completed_sale(@cashier_type,@shop.shop_code) @completed = Sale.completed_sale(@cashier_type)
@customers = Customer.pluck("customer_id, name") @customers = Customer.pluck("customer_id, name")
@occupied_table = @sales.count.length + @orders.count.length @occupied_table = @sales.count.length + @orders.count.length
@@ -81,7 +81,7 @@ class Origami::PendingOrderController < BaseOrigamiController
@cashier_type = params[:type] @cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type) @sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type) @orders = Sale.pending_order(@cashier_type)
@completed = Sale.completed_sale(@cashier_type,@shop.shop_code) @completed = Sale.completed_sale(@cashier_type)
@occupied_table = @sales.count.length + @orders.count.length @occupied_table = @sales.count.length + @orders.count.length

View File

@@ -6,7 +6,7 @@ class Settings::OrderQueueStationsController < ApplicationController
# GET /settings/order_queue_stations # GET /settings/order_queue_stations
# GET /settings/order_queue_stations.json # GET /settings/order_queue_stations.json
def index def index
@settings_order_queue_stations = OrderQueueStation.all @settings_order_queue_stations = OrderQueueStation.where("shop_code=?",@shop.shop_code)
@settings_order_queue_stations = Kaminari.paginate_array(@settings_order_queue_stations).page(params[:page]).per(50) @settings_order_queue_stations = Kaminari.paginate_array(@settings_order_queue_stations).page(params[:page]).per(50)
end end

View File

@@ -17,11 +17,11 @@ class Customer < ApplicationRecord
paginates_per 50 paginates_per 50
def draft_customer(phone, pin) def draft_customer(params, pin)
cus = Customer.find_by_contact_no(phone) cus = Customer.find_by_contact_no(params[:phone_number])
if cus.nil? if cus.nil?
self.name = "User " + pin.to_s self.name = params[:name]
self.contact_no = phone self.contact_no = params[:phone_number]
self.email = pin.to_s + "@gmail.com" self.email = pin.to_s + "@gmail.com"
self.pin_code = pin.to_s self.pin_code = pin.to_s
self.pin_sent_at = Time.now self.pin_sent_at = Time.now

View File

@@ -37,11 +37,13 @@ class Order < ApplicationRecord
:checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i, :checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i,
:checkin_by => self.employee_name, :checkin_by => self.employee_name,
:booking_status => "assign", :booking_status => "assign",
:customer_id => self.customer_id,
:shop_code=>self.shop_code}) :shop_code=>self.shop_code})
else else
booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking", booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
:checkin_at => Time.now.utc, :checkin_by => self.employee_name, :checkin_at => Time.now.utc, :checkin_by => self.employee_name,
:booking_status => "assign", :booking_status => "assign",
:customer_id => self.customer_id,
:shop_code=>self.shop_code }) :shop_code=>self.shop_code })
end end
#end extra time #end extra time

View File

@@ -38,20 +38,20 @@ class Printer::PrinterWorker
end end
def print(file_path,printer_destination = nil ) def print(file_path,printer_destination = nil )
# if printer_destination.nil? if printer_destination.nil?
# printer_destination = self.printer_destination printer_destination = self.printer_destination
# end end
#
# puts printer_destination puts printer_destination
# puts '........Printer Destination..........' puts '........Printer Destination..........'
#
# copy = self.print_copies copy = self.print_copies
# #Print only when printer information is not null #Print only when printer information is not null
# if !self.printer_destination.nil? if !self.printer_destination.nil?
# (1..copy).each do (1..copy).each do
# page = Cups::PrintJob.new(file_path, printer_destination) page = Cups::PrintJob.new(file_path, printer_destination)
# page.print page.print
# end end
# end end
end end
end end

View File

@@ -527,6 +527,8 @@ class Sale < ApplicationRecord
if order_source.to_s == "emenu" if order_source.to_s == "emenu"
order_source = "cashier" order_source = "cashier"
elsif order_source.to_s == "app"
order_source = "food_court"
end end
tax_profiles = unique_tax_profiles(order_source, self.customer_id) tax_profiles = unique_tax_profiles(order_source, self.customer_id)

View File

@@ -0,0 +1,9 @@
if(@sales)
json.sales @sales do |sale|
json.sale_id sale.sale_id
json.customer_id sale.customer_id
json.receipt_no sale.receipt_no
json.grand_total sale.grand_total
json.sale_items sale.sale_items
end
end

View File

@@ -151,63 +151,17 @@
</button> </button>
<br> <br>
<div class="card-header" style="padding: 0.12rem 0.25rem"> <div class="card-header" style="padding: 0.12rem 0.25rem">
<% if type %>
<div class="row clearfix">
<div class="col-md-6 col-lg-6 col-sm-12">
<strong id="order-title" class="font-13">ORDER DETAILS </strong>
</div>
<% if modify_order %>
<% if @table.nil? %>
<div class="col-md-3 col-lg-3 col-sm-3">Table : </div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"></p>
<p class="hidden" id="table_get_current"></p>
<% else%>
<div class="col-md-3 col-lg-3 col-sm-3">Table : <%=@table.name%></div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
<% end%>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : '---'%></p>
<p class="hidden" id="sale_id"><%=@sale_id%></p>
<div class="col-md-1 col-lg-1 col-sm-1">
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
</button>
</div>
<% else%>
<p class="hidden" id="table_type"></p>
<div class="col-md-2 col-lg-2 col-sm-2">
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
</button>
</div>
<% end%>
</div>
<% else %>
<div class="row "> <div class="row ">
<div class="col-md-9 col-lg-9 col-sm-9 "> <div class="col-md-9 col-lg-9 col-sm-9 ">
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span> <strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p> <p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p> <p class="hidden" id="sale_id"><%=@sale_id%></p>
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
</div> </div>
<div class="col-md-3 col-lg-3 col-sm-3"> <div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-xs btn-danger waves-effect" id='clear_all'>Clear <button type="button" class="btn btn-xs btn-danger waves-effect" id='clear_all'>Clear
</button> </button>
</div> </div>
<% end%>
</div> </div>
<div class="card-block"> <div class="card-block">
@@ -237,7 +191,11 @@
</tr> </tr>
</table> </table>
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001"> <input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
<% if @sale_id.nil?%>
<button type="button" class="btn btn-primary action-btn create col-md-11" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button> <button type="button" class="btn btn-primary action-btn create col-md-11" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
<% else %>
<button type="button" class="btn btn-primary action-btn create col-md-11" id="add_to_existing_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
<% end %>
</div> </div>
</div> </div>
</div> </div>
@@ -727,4 +685,5 @@ var webview = <%= @webview %>;
showHideNavbar(webview); showHideNavbar(webview);
<% end %> <% end %>
}); });
</script> </script>

View File

@@ -8,22 +8,17 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (menu.menu_categories) if (menu.menu_categories)
order_by = Lookup.find_by_lookup_type("order_by") order_by = Lookup.find_by_lookup_type("order_by")
# if !order_by.nil? && order_by.value == "name" # if !order_by.nil? && order_by.value == "name"
# categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc") # categories = MenuCategory.unscope(:order).where("menu_id ='#{menu.id}'").order("name asc")
# else # else
# categories = menu.menu_categories # categories = menu.menu_categories
# end # end
categories = menu.menu_categories categories = menu.menu_categories
json.categories categories do |category| json.categories categories do |category|
if category.is_available if category.is_available
parent_category = category.parent json.sub_category category.children.present?
if !parent_category.nil?
json.sub_category "true"
else
json.sub_category "false"
end
valid_time = category.valid_time valid_time = category.valid_time
json.valid_time valid_time json.valid_time valid_time
json.id category.id json.id category.id
json.code category.code json.code category.code
json.order_by category.order_by json.order_by category.order_by
@@ -80,7 +75,7 @@ if (menu.menu_categories)
alt_name: its.alt_name, alt_name: its.alt_name,
min_selectable_qty: its.min_selectable_qty, min_selectable_qty: its.min_selectable_qty,
max_selectable_qty: its.max_selectable_qty, max_selectable_qty: its.max_selectable_qty,
instances: its.menu_item_instances.pluck(:id).map { |id| {id: id}} instances: its.menu_item_instances.map { |i| {id: i.id} }
} }
} }
@@ -100,6 +95,7 @@ if (menu.menu_categories)
json.is_default is.is_default json.is_default is.is_default
json.is_on_promotion is.is_on_promotion json.is_on_promotion is.is_on_promotion
json.promotion_price is.promotion_price json.promotion_price is.promotion_price
json.out_of_stock is.is_out_of_stock
json.values instance_attr json.values instance_attr
end end
end end

View File

@@ -155,6 +155,7 @@
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons --> <!-- Waiter Buttons -->
<button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button> <button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
<button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button> <button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button>
<button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button> <button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button>
</div> </div>
@@ -421,7 +422,7 @@ var access_code = localStorage.getItem("access_code");
} }
} }
function checkPrice(obj_value,sale_item_id) { $('#add_order').on('click', function () {
window.location.href = '/foodcourt/food_court?sale_id=<%=@saleobj.sale_id %>';
} });
</script> </script>

View File

@@ -31,7 +31,7 @@ div.form-inputs span{
<%= f.input :print_copy %> <%= f.input :print_copy %>
<%= f.hidden_field :processing_items %> <%= f.hidden_field :processing_items %>
<%= f.label "Select Zones", :class => 'control-label' %> <%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox'%> <%= f.collection_check_boxes :zone_ids , Zone.shop, :id, :name , :class => 'checkbox'%>
<%= f.input :cut_per_item %> <%= f.input :cut_per_item %>
<%= f.input :use_alternate_name %> <%= f.input :use_alternate_name %>
<%= f.input :processing_items, as: :hidden %> <%= f.input :processing_items, as: :hidden %>

View File

@@ -1,11 +1,11 @@
# application_path="#{File.expand_path("../..", __FILE__)}" application_path="#{File.expand_path("../..", __FILE__)}"
# directory application_path directory application_path
# #environment ENV.fetch("RAILS_ENV") { "production" } #environment ENV.fetch("RAILS_ENV") { "production" }
# environment "production" environment "production"
# pidfile "#{application_path}/tmp/puma/pid" pidfile "#{application_path}/tmp/puma/pid"
# state_path "#{application_path}/tmp/puma/state" state_path "#{application_path}/tmp/puma/state"
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
# port ENV.fetch("PORT") { 62158 } port ENV.fetch("PORT") { 62158 }
# workers 2 workers 2
# preload_app! preload_app!
# threads 1,1 threads 1,1

View File

@@ -83,7 +83,7 @@ scope "(:locale)", locale: /en|mm/ do
get "customers/get_order/:id" => "customers#get_customer_order" get "customers/get_order/:id" => "customers#get_customer_order"
#get customer last five orders #get customer last five orders
get "customers/get_orders/:customer_id" => "customers#get_customer_last_orders" get "get_customer_last_orders" => "customers#get_customer_last_orders"
#Generating Invoice and making payments - output render @sale #Generating Invoice and making payments - output render @sale
resources :invoices, only: [:index, :show, :create, :update, :destroy] do resources :invoices, only: [:index, :show, :create, :update, :destroy] do
@@ -677,6 +677,7 @@ scope "(:locale)", locale: /en|mm/ do
get '/:addorders/:id' => "addorders#detail" get '/:addorders/:id' => "addorders#detail"
post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' } post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' }
post '/:addorders/add_to_existing_order' => "addorders#add_to_existing_order",:as => "add_to_existing_order", :defaults => { :format => 'json' }
get '/addorders/get_item_instance/:id' => "addorders#get_item_instance",:as => "get_item_instance", :defaults => { :format => 'json' } get '/addorders/get_item_instance/:id' => "addorders#get_item_instance",:as => "get_item_instance", :defaults => { :format => 'json' }