menu alt name

This commit is contained in:
Nweni
2017-07-02 14:38:18 +06:30
16 changed files with 205 additions and 63 deletions

View File

@@ -48,7 +48,22 @@ class Crm::CustomersController < BaseCrmController
#get customer amount
@customer = Customer.find(params[:id])
@response = Customer.get_membership_transactions(@customer)
@response = Customer.get_membership_transactions(@customer)
# get member information
total = Customer.get_member_account(@customer)
@balance = 0.00
@accountable_type = ''
if total["status"]==true
total["data"].each do |res|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
@balance += res["balance"]
# @accountable_type = res["accountable_type"]
@accountable_type = "Rebate Balance"
end
end
end
# @response = ""
#end customer amount
@@ -127,7 +142,8 @@ class Crm::CustomersController < BaseCrmController
end
# format.json { render :index, status: :created, location: @crm_customers }
else
# @crm_customers.destroy
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' + response[:message]}
else
@@ -211,7 +227,12 @@ end
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
else
customer = Customer.find(@crm_customer.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
format.html { redirect_to crm_customers_path, notice: response["error"] }
end