merge with staging

This commit is contained in:
Yan
2017-07-31 19:37:51 +06:30
7 changed files with 38 additions and 26 deletions

View File

@@ -96,7 +96,8 @@ class Crm::CustomersController < BaseCrmController
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
if paypar_account_no != nil || paypar_account_no != ''
# if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
@@ -153,8 +154,8 @@ class Crm::CustomersController < BaseCrmController
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer cannot created.' + response["message"]}
else
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
end
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
end
end
if params[:sale_id]
@@ -243,13 +244,14 @@ end
response = { status: false}
end
customer = Customer.find(@crm_customer.customer_id)
if response["status"] == true
customer = Customer.find(@crm_customer.customer_id)
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)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
@@ -303,11 +305,12 @@ end
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer }
else
customer = Customer.find(@crm_customer.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
status = customer.update_attributes(membership_type:member_group_id )
end
format.html { redirect_to crm_customers_path, notice: response["message"] }
end

View File

@@ -28,11 +28,11 @@ class Settings::LookupsController < ApplicationController
respond_to do |format|
if @settings_lookup.save
format.html { redirect_to @settings_lookup, notice: 'Lookup was successfully created.' }
format.html { redirect_to settings_lookups_path, notice: 'Lookup was successfully created.' }
format.json { render :show, status: :created, location: @settings_lookup }
else
format.html { render :new }
format.json { render json: @settings_lookup.errors, status: :unprocessable_entity }
format.json { render json: settings_lookups_path.errors, status: :unprocessable_entity }
end
end
end
@@ -42,11 +42,11 @@ class Settings::LookupsController < ApplicationController
def update
respond_to do |format|
if @settings_lookup.update(settings_lookup_params)
format.html { redirect_to @settings_lookup, notice: 'Lookup was successfully updated.' }
format.html { redirect_to settings_lookups_path, notice: 'Lookup was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_lookup }
else
format.html { render :edit }
format.json { render json: @settings_lookup.errors, status: :unprocessable_entity }
format.json { render json: settings_lookups_path.errors, status: :unprocessable_entity }
end
end
end
@@ -56,7 +56,7 @@ class Settings::LookupsController < ApplicationController
def destroy
@settings_lookup.destroy
respond_to do |format|
format.html { redirect_to settings_lookups_url, notice: 'Lookup was successfully destroyed.' }
format.html { redirect_to settings_lookups_path, notice: 'Lookup was successfully destroyed.' }
format.json { head :no_content }
end
end