From 223404a3b0be0c795daeaf36273a2e2d0ea0df21 Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 20 Apr 2018 11:51:33 +0630 Subject: [PATCH] fix childplay code and qr code --- app/views/crm/customers/index.html.erb | 2 +- app/views/origami/customers/index.html.erb | 55 +++++++++++----------- app/views/origami/payments/show.html.erb | 43 ++++++++--------- config/initializers/action_controller.rb | 10 ++-- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 70523063..87f3cabd 100755 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -142,7 +142,7 @@ $(function() { }); // QR Code Reader - $("#qr_code").on('sclick', function(e){ + $("#qr_code").on('click', function(e){ var code = ""; setTimeout(function(){ code=getQRCode(); diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index e5de4885..afe36d39 100755 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -358,7 +358,7 @@ } // QR Code Reader - $("#qr_code").on('click', function(e){ + $("#qr_code").on('click', function(e){ var code = ""; var customer_id = ''; var customer_name = ''; @@ -368,35 +368,34 @@ setTimeout(function(){ code=getQRCode(); setQRCode(code); + }, 100); - customer_mamber_card_no = $("#search").val(); - - if(sale_id != 0 && customer_mamber_card_no != 0){ - $.ajax({ - type: "POST", - url: "/origami/"+sale_id+"/get_customer" , - data: { filter : customer_mamber_card_no ,type :"card"}, - dataType: "json", - success: function(data) { - if (data[0].customer_id == false) { - swal("Alert!", data[0].message, "error"); - // $.alert({ - // title: 'Alert!', - // content: data[0].message, - // type: 'red', - // typeAnimated: true, - // btnClass: 'btn-danger', - // }); - }else{ - customer_id = data[0].customer_id; - customer_name = data[0].name; - update_sale(customer_id, customer_name,sale_id); - } - + customer_mamber_card_no = $("#search").val(); + + if(sale_id != 0 && customer_mamber_card_no != 0){ + $.ajax({ + type: "POST", + url: "/origami/"+sale_id+"/get_customer" , + data: { filter : customer_mamber_card_no ,type :"card"}, + dataType: "json", + success: function(data) { + if (data[0].customer_id == false) { + swal("Alert!", data[0].message, "error"); + // $.alert({ + // title: 'Alert!', + // content: data[0].message, + // type: 'red', + // typeAnimated: true, + // btnClass: 'btn-danger', + // }); + }else{ + customer_id = data[0].customer_id; + customer_name = data[0].name; + update_sale(customer_id, customer_name,sale_id); } - }); - } - },100); + } + }); + } }); // Read qrcode from java diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 334beea9..28b3f2ea 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -1134,33 +1134,34 @@ var customer_name = "<%= @customer.name %>"; var membership_type = ''; setTimeout(function(){ code=getQRCode(); - if(sale_id != 0 && code != ""){ - $.ajax({ - type: "POST", - url: "/origami/"+sale_id+"/get_customer" , - data: { filter : code ,type :"card"}, - dataType: "json", - success: function(data) { - if (data[0].customer_id == false) { - swal("Alert!", data[0].message, "error"); - }else{ - customer_id = data[0].customer_id; - customer_name = data[0].name; - membership_id = data[0].membership_id; - membership_type = data[0].membership_type; - update_sale(membership_id, customer_id, customer_name,sale_id); - } + $("#qr_code").val(code); + }); + if(sale_id != 0 && code != ""){ + $.ajax({ + type: "POST", + url: "/origami/"+sale_id+"/get_customer" , + data: { filter : code ,type :"card"}, + dataType: "json", + success: function(data) { + if (data[0].customer_id == false) { + swal("Alert!", data[0].message, "error"); + }else{ + customer_id = data[0].customer_id; + customer_name = data[0].name; + membership_id = data[0].membership_id; + membership_type = data[0].membership_type; + update_sale(membership_id, customer_id, customer_name,sale_id); } - }); - } - },100); + + } + }); + } }); // Read qrcode from java function getQRCode(){ - return code2lab.readQRCode(); - $("#qr_code").val(code); + return code2lab.readQRCode(); } function update_sale(membership_id, customer_id, customer_name, sale_id) { diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 92add0d2..8a149cb7 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -20,11 +20,11 @@ class ActionController::Base end else #check for license file - if check_license - current_license(ENV["SX_PROVISION_URL"]) - else - redirect_to activate_path - end + # if check_license + # current_license(ENV["SX_PROVISION_URL"]) + # else + # redirect_to activate_path + # end end end