fix for customer tax
This commit is contained in:
@@ -65,6 +65,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
|
|
||||||
# GET /crm/customers/1/edit
|
# GET /crm/customers/1/edit
|
||||||
def edit
|
def edit
|
||||||
|
@customer = Customer.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /crm/customers
|
# POST /crm/customers
|
||||||
@@ -78,7 +79,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
if @crm_customers.save
|
if @crm_customers.save
|
||||||
# update tax profile
|
# update tax profile
|
||||||
customer = Customer.find(@crm_customers.customer_id)
|
customer = Customer.find(@crm_customers.customer_id)
|
||||||
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles].to_json)
|
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
|
||||||
name = customer_params[:name]
|
name = customer_params[:name]
|
||||||
phone = customer_params[:contact_no]
|
phone = customer_params[:contact_no]
|
||||||
email = customer_params[:email]
|
email = customer_params[:email]
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ $(document).on('click',".customer_tr",function(){
|
|||||||
update_sale(customer_id,sale_id);
|
update_sale(customer_id,sale_id);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
var url = "customers/"+customer_id;
|
var url = "customers/" + customer_id + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -131,8 +131,9 @@ $(document).on('click',".customer_tr",function(){
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
// Selected for Taxes
|
// Selected for Taxes
|
||||||
//var taxes = JSON.stringify(data.tax_profiles);
|
var taxes = JSON.stringify(data.tax_profiles);
|
||||||
var parse_taxes = JSON.parse(data.tax_profiles);
|
var parse_taxes = JSON.parse(taxes);
|
||||||
|
console.log(parse_taxes);
|
||||||
$.each(parse_taxes, function(i, value){
|
$.each(parse_taxes, function(i, value){
|
||||||
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
|
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -307,7 +307,8 @@
|
|||||||
data: {},
|
data: {},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var parse_taxes = JSON.parse(data.tax_profiles);
|
var taxes = JSON.stringify(data.tax_profiles);
|
||||||
|
var parse_taxes = JSON.parse(taxes);
|
||||||
$.each(parse_taxes, function(i, value){
|
$.each(parse_taxes, function(i, value){
|
||||||
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
|
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ customer_type = Lookup.create([{lookup_type:'customer_type', name: 'Dinein', val
|
|||||||
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])
|
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])
|
||||||
|
|
||||||
#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",card_no:"000", customer_type:"Dinein", tax_profiles:"[2,1]"})
|
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000", customer_type:"Dinein", tax_profiles:"[\"2\", \"1\"]"})
|
||||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111", customer_type:"Takeaway", tax_profiles:"[1]"})
|
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111", customer_type:"Takeaway", tax_profiles:"[\"1\"]"})
|
||||||
|
|
||||||
#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