From e2fdf994d79540b055bd4400b1de4eda8df63da8 Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 11 Jun 2018 17:20:47 +0630 Subject: [PATCH] check JunctionPay --- .../javascripts/channels/order_reservation.js | 13 +++- app/assets/javascripts/order_reservation.js | 7 +- app/views/origami/junction_pay/index.html.erb | 8 ++- .../origami/order_reservation/index.html.erb | 71 ++++++++++++++----- 4 files changed, 76 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/channels/order_reservation.js b/app/assets/javascripts/channels/order_reservation.js index 7a6bb594..fc8662b8 100644 --- a/app/assets/javascripts/channels/order_reservation.js +++ b/app/assets/javascripts/channels/order_reservation.js @@ -28,6 +28,13 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel' delivery_type = "DIRECT DELIVERY"; } + var payment_type = ""; + if(value.payment_type=="cash_on_delivery"){ + payment_type = "COD"; + }else if(value.payment_type =="dinga"){ + payment_type = "DINGA"; + } + if(key==0){ var order_id = value.order_reservation_id; var sr_no = rowCount; @@ -49,11 +56,13 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel' +'' +''+created_at +'' - +''+time + +''+time +'' +''+value.grand_total +'' - +'' + +''+payment_type + +'' + +'' +''+ delivery_type +'' +'' +' '; diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index 2513ab30..f0d4aa4d 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -359,7 +359,12 @@ function show_order_detail(url,sr_no){ $('#address').text(address); $(".order_payment_type").show(); - $("#payment_type").text(data.payment_type); + if(data.payment_type == "cash_on_delivery"){ + $("#payment_type").text("COD"); + }else if(data.payment_type == "dinga"){ + $("#payment_type").text("DINGA"); + } + $('#ref_no').text(data.transaction_ref); $('#callback_url').text(data.callback_url); $('#order_id').text(data.order_reservation_id); diff --git a/app/views/origami/junction_pay/index.html.erb b/app/views/origami/junction_pay/index.html.erb index 76be5380..aee32523 100755 --- a/app/views/origami/junction_pay/index.html.erb +++ b/app/views/origami/junction_pay/index.html.erb @@ -205,7 +205,8 @@ $('#junction_pay').on('click',function(){ var com_port = '/dev/' + $("#com_port_name").val(); var is_rebate=false; //alert(cashier_id + amount + com_port); - code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port); + code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port); + resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount, voucherAmount,voucherNumber,receiptNumber){ $("#loading_wrapper").hide(); @@ -244,7 +245,10 @@ $('#junction_pay').on('click',function(){ if(memberno != ''){ is_rebate = true; } }; - + resError = function(err_message){ + $("#loading_wrapper").hide(); + swal ( "Oops" , err_message , "error" ); + }; // $("#loading_wrapper").hide(); // $.ajax({type: "POST", // url: "/origami/payment/"+payment_type, diff --git a/app/views/origami/order_reservation/index.html.erb b/app/views/origami/order_reservation/index.html.erb index b0cd2e9e..7327eb01 100644 --- a/app/views/origami/order_reservation/index.html.erb +++ b/app/views/origami/order_reservation/index.html.erb @@ -79,13 +79,20 @@ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %> - - <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> + + <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> <%=order.grand_total%> - + + <% if order.payment_type == 'cash_on_delivery' %> + COD + <% elsif order.payment_type == 'dinga' %> + DINGA + <% end %> + + <% if order.delivery.delivery_type == 'service' %> DELIVERY @@ -122,13 +129,20 @@ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %> - - <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> + + <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> - <%=order.grand_total%> + <%=order.grand_total%> - + + <% if order.payment_type == 'cash_on_delivery' %> + COD + <% elsif order.payment_type == 'dinga' %> + DINGA + <% end %> + + <% if order.delivery.delivery_type == 'service' %> DELIVERY @@ -164,13 +178,20 @@ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %> - - <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> + + <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> <%=order.grand_total%> - + + <% if order.payment_type == 'cash_on_delivery' %> + COD + <% elsif order.payment_type == 'dinga' %> + DINGA + <% end %> + + <% if order.delivery.delivery_type == 'service' %> DELIVERY @@ -206,13 +227,20 @@ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %> - - <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> + + <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> <%=order.grand_total%> - + + <% if order.payment_type == 'cash_on_delivery' %> + COD + <% elsif order.payment_type == 'dinga' %> + DINGA + <% end %> + + <% if order.delivery.delivery_type == 'service' %> DELIVERY @@ -248,13 +276,20 @@ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %> - - <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> + + <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> <%=order.grand_total%> - + + <% if order.payment_type == 'cash_on_delivery' %> + COD + <% elsif order.payment_type == 'dinga' %> + DINGA + <% end %> + + <% if order.delivery.delivery_type == 'service' %> DELIVERY @@ -353,7 +388,7 @@ - GRAND TOTAL + GRAND TOTAL 0.00 @@ -402,7 +437,7 @@ REF.
- + PAYMENT