Payment Method

This commit is contained in:
yarzar_code
2019-12-18 15:05:28 +06:30
parent 358fbcd134
commit 41d9c1375c
3 changed files with 26 additions and 6 deletions

View File

@@ -170,6 +170,8 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
end end
def show def show
@cash_exist = PaymentMethodSetting.cash_exist
@credit_exist = PaymentMethodSetting.credit_exist
display_type = Lookup.find_by_lookup_type("display_type") display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2 if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value @display_type = display_type.value

View File

@@ -1,4 +1,23 @@
class PaymentMethodSetting < ApplicationRecord class PaymentMethodSetting < ApplicationRecord
# validations # validations
validates_presence_of :payment_method , :gateway_communication_type #, :gateway_url, :auth_token, :merchant_account_id validates_presence_of :payment_method , :gateway_communication_type #, :gateway_url, :auth_token, :merchant_account_id
def self.cash_exist
temp = PaymentMethodSetting.where(payment_method: "Cash", is_active: true)
if temp.present?
return true
else
return false
end
end
def self.credit_exist
temp = PaymentMethodSetting.where(payment_method: "Credit", is_active: true)
if temp.present?
return true
else
return false
end
end
end end

View File

@@ -186,21 +186,20 @@
</strong> </strong>
</div> </div>
</div> </div>
<% if @cash_exist %>
<div class="row payment cash-color p-l-5 p-r-5"> <div class="row payment cash-color p-l-5 p-r-5">
<div class="col-md-8">Cash</div> <div class="col-md-8">Cash</div>
<div class="col-md-4" id="cash" > <div class="col-md-4" id="cash" >
<%= number_with_precision(@cash, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %> <%= number_with_precision(@cash, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
</div> </div>
</div> </div>
<% if @sale_payment.nil? && @cashier_type != "food_court" %> <%end%>
<%if @credit_exist%>
<div class="row payment credit-color p-l-5 p-r-5" id="credit_payment" > <div class="row payment credit-color p-l-5 p-r-5" id="credit_payment" >
<div class="col-md-8">Credit</div> <div class="col-md-8">Credit</div>
<div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div> <div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div> </div>
<% else %> <%end%>
<div class="col-md-4 hidden" id="credit">0</div>
<% end %>
<div class="row payment other-payment-color btn_paymal_member"> <div class="row payment other-payment-color btn_paymal_member">
<div class="col-md-8">Other Payments</div> <div class="col-md-8">Other Payments</div>
<div class="col-md-4" id="other_payment_amount"> <div class="col-md-4" id="other_payment_amount">