customer update

This commit is contained in:
Myat Zin Wai Maw
2019-06-20 18:26:10 +06:30
parent 55c9e0c578
commit 3716cbdda7
4 changed files with 15 additions and 8 deletions

View File

@@ -158,6 +158,9 @@ class Api::Payment::MobilepaymentController < Api::ApiController
# #end
# end
else
@out =false,"Something wrong!"
end
end
end

View File

@@ -8,7 +8,7 @@ class Crm::CustomersController < BaseCrmController
filter = params[:filter]
filter_card_no = params[:filter_card_no]
type = params[:type]
@customer_update_phone_email =false
@customer_update_phone_email_membertype =false
if filter_card_no==""
@crm_customers = Customer.all
elsif !filter_card_no.nil?
@@ -46,13 +46,16 @@ class Crm::CustomersController < BaseCrmController
else
@crm_customers.each do |customer|
if customer.contact_no != response["customer_data"]["phone"]
@customer_update_phone_email =true
@customer_update_phone_email_membertype =true
end
if customer.email != response["customer_data"]["email"]
@customer_update_phone_email =true
@customer_update_phone_email_membertype =true
end
if customer.name != response["customer_data"]["name"]
@customer_update_phone_email =true
@customer_update_phone_email_membertype =true
end
if customer.membership_type.to_i != response["customer_data"]["member_group_id"]
@customer_update_phone_email_membertype =true
end
end
end
@@ -554,13 +557,14 @@ class Crm::CustomersController < BaseCrmController
end
end
def customer_update_phone_email
def customer_update_phone_email_member_type
@customer = Customer.find(params[:id])
response = Customer.search_paypar_account_no(@customer.paypar_account_no)
if response["status"] == true
@customer.name =response["customer_data"]["name"]
@customer.contact_no =response["customer_data"]["phone"]
@customer.email =response["customer_data"]["email"]
@customer.membership_type =response["customer_data"]["member_group_id"]
@customer.save
respond_to do |format|
format.html { redirect_to crm_customers_path }

View File

@@ -126,8 +126,8 @@
<% if crm_customer.membership_id.nil? && !crm_customer.membership_type.nil? && !crm_customer.membership_type =="" && !crm_customer.paypar_account_no =="" && !crm_customer.paypar_account_no.nil? %>
<%= link_to t("views.btn.sync"), crm_customer_sync_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %>
<% end %>
<% if @customer_update_phone_email %>
<%= link_to t("views.btn.update"), crm_customer_update_phone_email_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %>
<% if @customer_update_phone_email_membertype %>
<%= link_to t("views.btn.update"), crm_customer_update_phone_email_member_type_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %>
<% end %>
<%= link_to t("views.btn.show"), crm_customer_path(crm_customer), :class => "btn btn-md bg-blue waves-effect" %>
</td>

View File

@@ -374,7 +374,7 @@ scope "(:locale)", locale: /en|mm/ do
root "home#index"
resources :customers
get "/customers/:id/sync" => "customers#sync", as:"customer_sync"
get "/customers/:id/customer_update_phone_email" => "customers#customer_update_phone_email", as:"customer_update_phone_email"
get "/customers/:id/customer_update_phone_email_member_type" => "customers#customer_update_phone_email_member_type", as:"customer_update_phone_email_member_type"
resources :dining_queues
post "update_booking", to: "bookings#update_booking", as: "update_booking" #assign and cancel
get '/print/:id', to: "home#print_order" #print order for crm