check flag for transaction payment

This commit is contained in:
phyusin
2018-09-25 17:49:33 +06:30
parent 3d44c570b2
commit 3cf4abe9ce
8 changed files with 303 additions and 39 deletions

View File

@@ -737,7 +737,7 @@ var trans_flag = <%= @trans_flag %>;
customer_display_view(null,"reload");
var sale_id = $('#sale_id').text();
var flag = localStorage.getItem("trans_flag");
if(flag != "true"){
if((flag!=null) && (flag != "true")){
window.location.href = '/transactions/sales/'+sale_id;
}else{
if (cashier_type=="cashier") {
@@ -1151,7 +1151,7 @@ var trans_flag = <%= @trans_flag %>;
if (pdf_view ==1) {
var flag = localStorage.getItem("trans_flag");
if(flag != "true"){
if((flag!=null) && (flag != "true")){
window.location.href = "/transactions/sales/"+sale_id;
}else{
if (cashier_type=="cashier") {
@@ -1185,19 +1185,24 @@ var trans_flag = <%= @trans_flag %>;
closeOnCancel: false,
allowOutsideClick: false
}, function () {
if (cashier_type=="cashier") {
window.location.href = '/origami';
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){
window.location.href = '/transactions/sales/'+sale_id;
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
}
}
});
}
$(".btn_pdf_close").on('click',function(){
var flag = localStorage.getItem("trans_flag");
if(flag != "true"){
if((flag!=null) && (flag != "true")){
var sale_id = $('#sale_id').text();
window.location.href = "/transactions/sales/"+sale_id;
}else{
@@ -1430,16 +1435,21 @@ var trans_flag = <%= @trans_flag %>;
title: "Information!",
text: 'Thank You !',
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
});
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){
window.location.href = '/transactions/sales/'+sale_id;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}
});
}
}
});
@@ -1472,11 +1482,16 @@ var trans_flag = <%= @trans_flag %>;
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){
window.location.href = '/transactions/sales/'+sale_id;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}
}
})
}
@@ -1503,18 +1518,23 @@ var trans_flag = <%= @trans_flag %>;
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// console.log(result)
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
}
}
});
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){
window.location.href = '/transactions/sales/'+sale_id;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
}
}
}
});
}
});
}