Merge branch 'addorder' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-08-24 15:21:46 +06:30
4 changed files with 19 additions and 18 deletions

View File

@@ -33,8 +33,6 @@ class Crm::CustomersController < BaseCrmController
end
end
end
puts @crm_customers
#@crm_customers = Customer.all
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new
@count_customer = Customer.count_customer

View File

@@ -29,19 +29,20 @@ class Origami::CustomersController < BaseOrigamiController
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
@crm_customers.nrc_no = response["customer_data"]["NRC"]
@crm_customers.address = response["customer_data"]["address"]
@crm_customers.card_no = 121212
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
@crm_customers.paypar_account_no = filter
@crm_customers.membership_id = response["customer_data"]["id"]
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.save
@crm_customers = Customer.search(filter)
else
@crm_customers = {:status=> response["status"],:message=>response["message"] }
@crm_customers = [{"customer_id": response["status"],"message": response["message"] }]
end
end
end
puts @crm_customers
render :json => @crm_customers.to_json
end

View File

@@ -138,8 +138,7 @@ class Customer < ApplicationRecord
sales = Sale.where("rebate_status = 'false'")
sales.each do |sale|
if sale.customer.membership_id
response = self.rebat(Sale.find(sale.sale_id))
puts response.to_json
response = self.rebat(Sale.find(sale.sale_id))
if response["status"] == true
status = sale.update_attributes(rebate_status: "true")
end
@@ -197,8 +196,7 @@ class Customer < ApplicationRecord
response = { "status": false, "message": "Can't connect server"}
end
return response
puts response.to_json
return response
end
end
end
@@ -233,8 +231,6 @@ class Customer < ApplicationRecord
rescue SocketError
response = { status: false, message: "Can't connect server"}
end
puts "sssssssssssss"
puts response.to_json
return response
end

View File

@@ -261,15 +261,21 @@
url: "get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json",
success: function(data) {
if (data.status == false) {
alert(data.message)
success: function(data) {
if (data[0].customer_id == false) {
$.alert({
title: 'Alert!',
content: data[0].message,
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id);
}
customer_id = data[0].customer_id;
customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id);
}
});
}