Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Aung Myo
2018-04-20 17:03:34 +06:30
4 changed files with 55 additions and 55 deletions

View File

@@ -142,7 +142,7 @@ $(function() {
}); });
// QR Code Reader // QR Code Reader
$("#qr_code").on('sclick', function(e){ $("#qr_code").on('click', function(e){
var code = ""; var code = "";
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();

View File

@@ -358,7 +358,7 @@
} }
// QR Code Reader // QR Code Reader
$("#qr_code").on('click', function(e){ $("#qr_code").on('click', function(e){
var code = ""; var code = "";
var customer_id = ''; var customer_id = '';
var customer_name = ''; var customer_name = '';
@@ -368,35 +368,34 @@
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
setQRCode(code); setQRCode(code);
}, 100);
customer_mamber_card_no = $("#search").val(); customer_mamber_card_no = $("#search").val();
if(sale_id != 0 && customer_mamber_card_no != 0){ if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/"+sale_id+"/get_customer" , url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"}, data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
if (data[0].customer_id == false) { if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error"); swal("Alert!", data[0].message, "error");
// $.alert({ // $.alert({
// title: 'Alert!', // title: 'Alert!',
// content: data[0].message, // content: data[0].message,
// type: 'red', // type: 'red',
// typeAnimated: true, // typeAnimated: true,
// btnClass: 'btn-danger', // btnClass: 'btn-danger',
// }); // });
}else{ }else{
customer_id = data[0].customer_id; customer_id = data[0].customer_id;
customer_name = data[0].name; customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id); update_sale(customer_id, customer_name,sale_id);
}
} }
}); }
} });
},100); }
}); });
// Read qrcode from java // Read qrcode from java

View File

@@ -1134,33 +1134,34 @@ var customer_name = "<%= @customer.name %>";
var membership_type = ''; var membership_type = '';
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
if(sale_id != 0 && code != ""){ $("#qr_code").val(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);
}
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 // Read qrcode from java
function getQRCode(){ function getQRCode(){
return code2lab.readQRCode(); return code2lab.readQRCode();
$("#qr_code").val(code);
} }
function update_sale(membership_id, customer_id, customer_name, sale_id) { function update_sale(membership_id, customer_id, customer_name, sale_id) {

View File

@@ -20,11 +20,11 @@ class ActionController::Base
end end
else else
#check for license file #check for license file
if check_license # if check_license
current_license(ENV["SX_PROVISION_URL"]) # current_license(ENV["SX_PROVISION_URL"])
else # else
redirect_to activate_path # redirect_to activate_path
end # end
end end
end end