From b36801add9210e7699ecb4d2570aabf860e3e047 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Jun 2018 14:14:48 +0630 Subject: [PATCH] check reprint route --- app/views/origami/sales/show.html.erb | 30 +++++++++++---------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index 703df86b..dda2bbc8 100755 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -415,7 +415,18 @@ $(document).on('click', '.access_modal', function(event){ }else if(type == "reprint") { $('#AccessCodeModal').modal('hide'); var sale_id = $('#sale_id').val(); - window.location.href = '/origami/'+ sale_id + "/reprint" + var ajax_url = "/origami/"+ sale_id + "/reprint"; + $.ajax({ + type: "GET", + url: ajax_url, + success: function (result) { + // For Server Print - from jade + if ($("#server_mode").val() == "cloud") { + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } + location.reload(); + } + }); }else if(type == "foc"){ $('#AccessCodeModal').modal('hide'); $('#focModal').modal('show'); @@ -427,21 +438,4 @@ $(document).on('click', '.access_modal', function(event){ } }); } - -$('#re-print').click(function() { - var sale_id = $('#sale_id').val(); - var ajax_url = "/origami/"+ sale_id + "/reprint" - // return false; - $.ajax({ - type: "GET", - url: ajax_url, - success: function (result) { - // For Server Print - from jade - if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); - } - location.reload(); - } - }); - });