control for member create and member discount

This commit is contained in:
Yan
2017-07-27 18:53:41 +06:30
parent 0408c6d498
commit bf3e30c70f
7 changed files with 125 additions and 57 deletions

View File

@@ -8,6 +8,17 @@ class Origami::CustomersController < BaseOrigamiController
def show
end
def get_customer
filter = params[:filter]
if filter.nil?
@crm_customers = Customer.order("customer_id").page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5)
else
@crm_customers = Customer.search(filter)
end
render :json => @crm_customers.to_json
end
def add_customer
@sale_id = params[:sale_id]
@@ -18,9 +29,7 @@ class Origami::CustomersController < BaseOrigamiController
@booking_order = BookingOrder.find_by_order_id(@sale_id)
@booking = Booking.find(@booking_order.booking_id)
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
end
filter = params[:filter]
end
filter = params[:filter]
@@ -53,12 +62,12 @@ class Origami::CustomersController < BaseOrigamiController
customer_id = params[:customer_id]
# Check and find with card no
if(!customer_id.include? "CUS")
customer = Customer.find_by_paypar_account_no(customer_id)
if(customer != nil)
customer_id = customer.customer_id
end
end
# if(!customer_id.include? "CUS")
# customer = Customer.find_by_paypar_account_no(customer_id)
# if(customer != nil)
# customer_id = customer.customer_id
# end
# end
if(id == "SAL")
sale = Sale.find(params[:sale_id])