fix childplay code and qr code

This commit is contained in:
Yan
2018-04-20 11:51:33 +06:30
parent d0293a762a
commit 223404a3b0
4 changed files with 55 additions and 55 deletions

View File

@@ -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();

View File

@@ -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

View File

@@ -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) {

View File

@@ -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