update lookup
This commit is contained in:
@@ -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,
|
||||
@@ -150,7 +151,12 @@ class Crm::CustomersController < BaseCrmController
|
||||
# When paypar account no not exist in paypar
|
||||
if response["message"] == "Account has not exist."
|
||||
customer.destroy
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer cannot created.' + response["message"]}
|
||||
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
|
||||
|
||||
end
|
||||
|
||||
if params[:sale_id]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -400,10 +400,8 @@ class SalePayment < ApplicationRecord
|
||||
rebate_arr =[]
|
||||
campaign_method.each do |a|
|
||||
data = {:type => a[:type], :amount => a[:amount]}
|
||||
puts data
|
||||
type_arr.each do |si|
|
||||
if si[:type] == a[:type]
|
||||
puts "steeeeeeeeeeeee"
|
||||
amount = (redeem_amount / total_percentage)*si[:percentage]
|
||||
actual = a[:amount] - amount
|
||||
data[:amount] = actual
|
||||
@@ -413,7 +411,7 @@ class SalePayment < ApplicationRecord
|
||||
rebate_arr.push(data)
|
||||
|
||||
end
|
||||
|
||||
|
||||
total_amount = rebate_prices - payparcost - overall_dis
|
||||
|
||||
if credit == 1
|
||||
@@ -454,7 +452,6 @@ class SalePayment < ApplicationRecord
|
||||
response = { "status": false, "message": "Can't connect server"}
|
||||
end
|
||||
return response
|
||||
|
||||
end
|
||||
else
|
||||
response = { "status": "no_member", "message": "Not membership"}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= simple_form_for(@settings_lookup) do |f| %>
|
||||
<%= simple_form_for([:settings,@settings_lookup]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
<%= render 'form', settings_lookup: @settings_lookup %>
|
||||
|
||||
<%= link_to 'Show', @settings_lookup %> |
|
||||
<%= link_to 'Show', settings_lookup_path(@settings_lookup) %> |
|
||||
<%= link_to 'Back', settings_lookups_path %>
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<h1>Settings Lookups</h1>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Account</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_lookup_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Lookup type</th>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
<th colspan="3"></th>
|
||||
<th colspan="">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -24,8 +33,6 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Settings Lookup', new_settings_lookup_path %>
|
||||
|
||||
Reference in New Issue
Block a user