update dinga and paymal

This commit is contained in:
Aung Myo
2018-04-26 13:07:31 +06:30
parent 9b0a564b9a
commit 3a85481dcd
9 changed files with 42 additions and 30 deletions

View File

@@ -457,9 +457,10 @@ $(function() {
var items = $('.selected-set'); var items = $('.selected-set');
if (items.length >= min_qty) { if (items.length >= min_qty) {
if ($('#server_mode').val() != "cloud") {
item = get_set_item(items); item = get_set_item(items);
customer_display_view(item,"set_add"); customer_display_view(item,"set_add");
}
var option = [] var option = []
attribute_arr = [] attribute_arr = []
@@ -786,8 +787,10 @@ $(function() {
$('.add_to_order').attr('data-options',JSON.stringify(option_arr)); $('.add_to_order').attr('data-options',JSON.stringify(option_arr));
$('.add_to_order').attr('data-opt',JSON.stringify(option_arr)); $('.add_to_order').attr('data-opt',JSON.stringify(option_arr));
var item_data = $(this); var item_data = $(this);
item = get_item(item_data,"add_to_order"); if ($('#server_mode').val() != "cloud") {
customer_display_view(item,"add"); item = get_item(item_data,"add_to_order");
customer_display_view(item,"add");
}
show_item_detail(item_data,"add_to_order"); show_item_detail(item_data,"add_to_order");
calculate_sub_total(); calculate_sub_total();
@@ -796,8 +799,10 @@ $(function() {
// click plus icon for add // click plus icon for add
$(document).on('click', '.add_icon', function(event){ $(document).on('click', '.add_icon', function(event){
var item_data = $(this); var item_data = $(this);
item = get_item(item_data,"add_icon"); if ($('#server_mode').val() != "cloud") {
customer_display_view(item,"add"); item = get_item(item_data,"add_icon");
customer_display_view(item,"add");
}
show_item_detail(item_data,"add_icon"); show_item_detail(item_data,"add_icon");
calculate_sub_total(); calculate_sub_total();
}); //End Add Icon Click }); //End Add Icon Click
@@ -922,7 +927,9 @@ console.log(d_option)
window.location.href = "/origami/room/" + table_id window.location.href = "/origami/room/" + table_id
} }
} }
customer_display_view(null,"reload"); if ($('#server_mode').val() != "cloud") {
customer_display_view(null,"reload");
}
} }
}); });
// }else{ // }else{

View File

@@ -86,11 +86,12 @@ def create
# saleObj = Sale.find(sale_id) # saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no) status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
if status == true
if status == true && @membership_data["status"] == true
@out = true, "Success!" @out = true, "Success!"
else else
@out =false, "Please try again payment!" @out =false, @membership_data["message"]
end end
end end
end end

View File

@@ -88,11 +88,11 @@ def create
# saleObj = Sale.find(sale_id) # saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no) status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
if status == true if status == true && @membership_data["status"] == true
@out = true, "Success!" @out = true, "Success!"
else else
@out =false, "Please try again payment!" @out =false, @membership_data["message"]
end end
end end
end end

View File

@@ -20,7 +20,7 @@ authorize_resource :class => false
payment_type = params[:payment_type] payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type) @sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type) @sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
@tax_profiles = TaxProfile.order('order_by asc') @tax_profiles = TaxProfile.order('order_by asc').limit(2)
@from = from @from = from
@to = to @to = to
# get printer info # get printer info

View File

@@ -23,6 +23,7 @@ class SalePayment < ApplicationRecord
if (amount_due >= 0) if (amount_due >= 0)
payment_status = false payment_status = false
membership_data = nil
#route to payment type #route to payment type
case payment_method case payment_method
when "cash" when "cash"
@@ -52,11 +53,11 @@ class SalePayment < ApplicationRecord
when "foc" when "foc"
payment_status = foc_payment payment_status = foc_payment
when "paymal" when "paymal"
payment_status = paymal_payment payment_status,membership_data = paymal_payment
when "JunctionPay" when "JunctionPay"
payment_status = junction_pay_payment payment_status = junction_pay_payment
when "dinga" when "dinga"
payment_status = dinga_payment payment_status,membership_data = dinga_payment
else else
puts "it was something else" puts "it was something else"
end end
@@ -73,7 +74,7 @@ class SalePayment < ApplicationRecord
end end
end end
return true, self.save return true, self.save,membership_data
else else
#record an payment in sale-audit #record an payment in sale-audit
# remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]" # remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
@@ -430,7 +431,7 @@ class SalePayment < ApplicationRecord
sale_update_payment_status(0) sale_update_payment_status(0)
end end
return payment_status return payment_status,membership_data
end end
def junction_pay_payment def junction_pay_payment
@@ -480,7 +481,7 @@ class SalePayment < ApplicationRecord
sale_update_payment_status(0) sale_update_payment_status(0)
end end
return payment_status return payment_status,membership_data
end end

View File

@@ -490,11 +490,13 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<style type="text/css"> <input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
.fadeInRight{
-webkit-animation-duration: 350ms !important; <style type="text/css">
} .fadeInRight{
</style> -webkit-animation-duration: 350ms !important;
}
</style>
<script> <script>
jQuery(function(){ jQuery(function(){
id = "<%=@menu[0].id%>"; id = "<%=@menu[0].id%>";

View File

@@ -199,6 +199,7 @@
<% end %> <% end %>
</div> </div>
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button> <button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
<script> <script>
$(".cashier_view").on('click', function() { $(".cashier_view").on('click', function() {
@@ -206,7 +207,9 @@
}); });
$(".qs_view").on('click', function() { $(".qs_view").on('click', function() {
document.getElementById('second_view').click(); if ($('#server_mode').val() != "cloud") {
document.getElementById('second_view').click();
}
window.location.href = '/origami/quick_service'; window.location.href = '/origami/quick_service';
}); });

View File

@@ -287,7 +287,7 @@
}); });
}else{ }else{
swal ( "Information" , result.message); swal ( "Opps",result.message ,"warning" );
} }
} }
}); });
@@ -364,7 +364,7 @@
}); });
}else{ }else{
swal ( "Information" , result.message); swal ( "Opps",result.message ,"warning" );
} }
} }
}); });

View File

@@ -281,7 +281,7 @@
}); });
}else{ }else{
swal ( "Information" , result.message); swal ( "Opps",result.message ,"warning" );
} }
} }
}); });
@@ -328,7 +328,6 @@
var payment_amount = parseFloat($("#used_amount").text()); var payment_amount = parseFloat($("#used_amount").text());
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
alert(code)
if(sale_id != 0 && code != ""){ if(sale_id != 0 && code != ""){
$.ajax({ $.ajax({
type: "POST", type: "POST",
@@ -345,7 +344,6 @@
url: "<%=origami_payment_paymal_path%>", url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code}, data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
success: function(result){ success: function(result){
alert(result)
if(result.status == true){ if(result.status == true){
swal({ swal({
title: "Information!", title: "Information!",
@@ -359,7 +357,7 @@
}); });
}else{ }else{
swal ( "Information" , result.message); swal ( "Opps",result.message ,"warning" );
} }
} }
}); });