update customerbind in origami
This commit is contained in:
@@ -39,5 +39,24 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_sale_by_customer
|
||||||
|
|
||||||
|
id = params[:sale_id][0,3]
|
||||||
|
if(id == "SAL")
|
||||||
|
sale = Sale.find(params[:sale_id])
|
||||||
|
else
|
||||||
|
sale = Order.find(params[:sale_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||||
|
|
||||||
|
if status == true
|
||||||
|
render json: JSON.generate({:status => true})
|
||||||
|
else
|
||||||
|
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ Rails.application.routes.draw do
|
|||||||
#resources :customers
|
#resources :customers
|
||||||
get '/:sale_id/customers', to: "customers#add_customer"
|
get '/:sale_id/customers', to: "customers#add_customer"
|
||||||
get '/:customer_id/get_customer' => 'home#get_customer'
|
get '/:customer_id/get_customer' => 'home#get_customer'
|
||||||
post '/:sale_id/update_sale' , to: "home#update_sale_by_customer"#update customer id in sale table
|
post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer"#update customer id in sale table
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Waiter/Ordering Station ------------#
|
#--------- Waiter/Ordering Station ------------#
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ void_reason = Lookup.create([{lookup_type:'void_reason', name: 'Approve By Manag
|
|||||||
{lookup_type:'void_reason', name: 'Waiter Mistake', value: 'Waiter Mistake'}])
|
{lookup_type:'void_reason', name: 'Waiter Mistake', value: 'Waiter Mistake'}])
|
||||||
|
|
||||||
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
||||||
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000"})
|
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000"})
|
||||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111"})
|
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"000"})
|
||||||
|
|
||||||
#Default ZOne
|
#Default ZOne
|
||||||
# zone = Zone.create({id:1, name: "Normal Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
|
# zone = Zone.create({id:1, name: "Normal Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
|
||||||
|
|||||||
Reference in New Issue
Block a user