From 2dec217bccb1adf26d2be58bdc6f1b6d1154259d Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 30 Mar 2018 17:23:59 +0630 Subject: [PATCH] update waste and spoile --- app/views/origami/home/show.html.erb | 9 +++--- app/views/origami/payments/show.html.erb | 38 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 4810cf13..b108c46d 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -488,11 +488,6 @@ + <% if @cashier_type=="quick_service" %>
@@ -1160,4 +1162,40 @@ var customer_name = "<%= @customer.name %>"; var sale_id = $("#sale_id").text() || 0; update_sale("", customer_id, customer_name, sale_id); }); + + function waste_and_spoilage(remark) { + var sale_id = $('#sale_id').text(); + console.log(sale_id) + swal({ + title: "Alert", + text: "Are you sure want to " + remark +" ?", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "Yes, " +remark+ " it!", + closeOnConfirm: false + }, function (isConfirm) { + if (isConfirm) { + var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage'; + $.ajax({ + type: 'POST', + url: url, + data: "remark="+ remark + "&sale_id=" + sale_id, + 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"); + } + } + }); + } + }); + } \ No newline at end of file