update jade integration card use for all shop
This commit is contained in:
@@ -33,8 +33,6 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
puts @crm_customers
|
|
||||||
#@crm_customers = Customer.all
|
|
||||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||||
@crm_customer = Customer.new
|
@crm_customer = Customer.new
|
||||||
@count_customer = Customer.count_customer
|
@count_customer = Customer.count_customer
|
||||||
|
|||||||
@@ -36,12 +36,13 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
@crm_customers.customer_type = "Dinein"
|
@crm_customers.customer_type = "Dinein"
|
||||||
@crm_customers.tax_profiles = ["1", "2"]
|
@crm_customers.tax_profiles = ["1", "2"]
|
||||||
@crm_customers.save
|
@crm_customers.save
|
||||||
|
@crm_customers = Customer.search(filter)
|
||||||
else
|
else
|
||||||
@crm_customers = {:status=> response["status"],:message=>response["message"] }
|
@crm_customers = [{"customer_id": response["status"],"message": response["message"] }]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
puts @crm_customers
|
|
||||||
render :json => @crm_customers.to_json
|
render :json => @crm_customers.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -129,8 +129,7 @@ class Customer < ApplicationRecord
|
|||||||
sales = Sale.where("rebate_status = 'false'")
|
sales = Sale.where("rebate_status = 'false'")
|
||||||
sales.each do |sale|
|
sales.each do |sale|
|
||||||
if sale.customer.membership_id
|
if sale.customer.membership_id
|
||||||
response = self.rebat(Sale.find(sale.sale_id))
|
response = self.rebat(Sale.find(sale.sale_id))
|
||||||
puts response.to_json
|
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
status = sale.update_attributes(rebate_status: "true")
|
status = sale.update_attributes(rebate_status: "true")
|
||||||
end
|
end
|
||||||
@@ -188,8 +187,7 @@ class Customer < ApplicationRecord
|
|||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
|
||||||
end
|
end
|
||||||
return response
|
return response
|
||||||
puts response.to_json
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -224,8 +222,6 @@ class Customer < ApplicationRecord
|
|||||||
rescue SocketError
|
rescue SocketError
|
||||||
response = { status: false, message: "Can't connect server"}
|
response = { status: false, message: "Can't connect server"}
|
||||||
end
|
end
|
||||||
puts "sssssssssssss"
|
|
||||||
puts response.to_json
|
|
||||||
return response
|
return response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -261,21 +261,21 @@
|
|||||||
url: "get_customer" ,
|
url: "get_customer" ,
|
||||||
data: { filter : customer_mamber_card_no ,type :"card"},
|
data: { filter : customer_mamber_card_no ,type :"card"},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data.status == false) {
|
if (data[0].customer_id == false) {
|
||||||
$.alert({
|
$.alert({
|
||||||
title: 'Alert!',
|
title: 'Alert!',
|
||||||
content: data.message,
|
content: data[0].message,
|
||||||
type: 'red',
|
type: 'red',
|
||||||
typeAnimated: true,
|
typeAnimated: true,
|
||||||
btnClass: 'btn-danger',
|
btnClass: 'btn-danger',
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
customer_id = data[0].customer_id;
|
||||||
|
customer_name = data[0].name;
|
||||||
|
update_sale(customer_id, customer_name,sale_id);
|
||||||
}
|
}
|
||||||
if (data.status == undefined) {
|
|
||||||
customer_id = data[0].customer_id;
|
|
||||||
customer_name = data[0].name;
|
|
||||||
update_sale(customer_id, customer_name,sale_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user