From 21c3e0c0dc8edcc5bc09b64b11c5f7068573d016 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 30 Aug 2018 10:53:19 +0630 Subject: [PATCH] first bill for table invoice --- .../origami/table_invoices/show.html.erb | 51 ++++++++++++++++--- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb index 2065af6d..5fb864fe 100644 --- a/app/views/origami/table_invoices/show.html.erb +++ b/app/views/origami/table_invoices/show.html.erb @@ -322,25 +322,62 @@ $(document).ready(function(){ // }); // Print for first bill - $("#first_bill").on('click', function () { - var sale_id = '<%= @sale.id %>'; - var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; + // $("#first_bill").on('click', function () { + // var sale_id = '<%= @sale.id %>'; + // var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; - $.ajax({ + // $.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({ + title: "Alert", + text: "Are you sure want to print First Bill?", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "Yes, print it!", + closeOnConfirm: false + }, function (isConfirm) { + $('.confirm').off("click touchstart touchend"); + $('.confirm').attr("disabled","disabled"); + if (isConfirm) { + + 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(); - } - }); - }); + } + }); + } + }); + }); $(".choose_payment").on('click', function () { $( "#loading_wrapper").show();