update crm
This commit is contained in:
@@ -68,7 +68,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
def create
|
||||
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customers.save
|
||||
name = customer_params[:name]
|
||||
@@ -77,6 +77,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
dob = customer_params[:date_of_birth]
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
if !member_group_id.nil?
|
||||
@@ -87,16 +88,17 @@ class Crm::CustomersController < BaseCrmController
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
@@ -149,10 +151,12 @@ end
|
||||
dob = customer_params[:date_of_birth]
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
id = @crm_customer.membership_id
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
if id.nil? && !member_group_id.nil?
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
@@ -160,16 +164,17 @@ end
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
response = HTTParty.post(url,
|
||||
:body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
card_no:card_no,member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
@@ -185,20 +190,22 @@ end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("update_membership_customer")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
@@ -130,8 +130,10 @@ $(document).on('click',".customer_tr",function(){
|
||||
$('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected');
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
$('.female').prop( "checked", false )
|
||||
}else{
|
||||
$('.female').prop( "checked", true )
|
||||
$('.male').prop( "checked", false )
|
||||
}
|
||||
|
||||
if(data.salutation == 'Mr') {
|
||||
@@ -152,7 +154,6 @@ $(document).on('click',".customer_tr",function(){
|
||||
|
||||
$("#new_customer").attr('class', 'simple_form edit_customer');
|
||||
var id = "edit_customer_"+customer_id;
|
||||
alert(id)
|
||||
$("#new_customer").attr('id', id);
|
||||
|
||||
$(".edit_customer").attr('id', id);
|
||||
|
||||
@@ -161,10 +161,10 @@
|
||||
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<!-- <div class="form-group">
|
||||
<label>Sr.No</label>
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
|
||||
@@ -129,8 +129,10 @@
|
||||
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p class="hidden customer-id"><%= @customer.customer_id %></p>
|
||||
<p>Customer : <%= @customer.name %></p>
|
||||
<%if @customer %>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id %></p>
|
||||
<p>Customer : <%= @customer.name %></p>
|
||||
<%end%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -129,8 +129,10 @@
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<%if @customer %>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id %></p>
|
||||
<p>Customer : <%= @customer.name %></p>
|
||||
<p>Customer : <%= @customer.name %></p>
|
||||
<%end%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user