print settings ActionCable

This commit is contained in:
Thein Lin Kyaw
2020-08-18 16:11:17 +06:30
parent 583d7ee473
commit 5dfdc7353e
25 changed files with 1050 additions and 802 deletions

View File

@@ -164,6 +164,8 @@
</div>
</div>
<%= print_settings %>
<!-- membership paymentmodal -->
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
@@ -243,7 +245,6 @@
</div>
</div>
</div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
@@ -303,31 +304,6 @@ $(document).ready(function(){
})
});
// $('#pay').on('click',function() {
// window.location.href = '/origami/sale/<%= @sale.id %>/payment';
// });
// Print for first bill
// $("#first_bill").on('click', function () {
// var sale_id = '<%= @sale.id %>';
// var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
// $.ajax({
// type: "GET",
// url: ajax_url,
// success: function (result) {
// receipt_no = ($("#receipt_no").html()).trim();
// if((receipt_no!=undefined) && (receipt_no!=""))
// createReceiptNoInFirstBillData(receipt_no,"");
// // For Server Print - from jade
// if ($("#server_mode").val() == "cloud") {
// code2lab.printFile(result.filepath.substr(6), result.printer_url);
// }
// location.reload();
// }
// });
// });
// Print for first bill
$("#first_bill").on('click', function () {
swal({
@@ -353,11 +329,12 @@ $(document).ready(function(){
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
@@ -385,17 +362,20 @@ $(document).ready(function(){
type: "GET",
url: ajax_url,
success: function (result) {
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
location.reload();
}
}
location.reload();
}
});
});
@@ -463,13 +443,15 @@ $('#void').on('click',function () {
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id + "&access_code=" + access_code ,
success: function (result) {
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami';
}
window.location.href = '/origami';
}
});
}
@@ -499,17 +481,19 @@ $('#foc').click(function() {
success:function(result){
if (cash >= 0) {
swal({
title: "Information!",
text: 'Thank You !',
}, function () {
// For Server Print - from jade
title: "Information!",
text: 'Thank You !',
}, function () {
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami';
});
}
window.location.href = '/origami';
});
}
}
});
@@ -531,31 +515,30 @@ $(document).on('click', '.access_modal', function(event){
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
if (type == "edit") {
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
} else if(type == "void") {
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
} else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
} else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
} else if(type == "foc") {
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
} else {
swal("Opps",result.message,"warning")
}
}
});
}