foodcourt
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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 %>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user