From 0751216ccbff7554bc96e256155d878a132973ce Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 1 Jun 2018 13:42:14 +0630 Subject: [PATCH 1/5] add clickable check --- app/views/origami/home/show.html.erb | 11 +++++++++-- app/views/origami/payments/show.html.erb | 4 ++++ app/views/origami/rooms/show.html.erb | 6 ++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index f1979aef..986bed5f 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -869,6 +869,10 @@ // Bill Request $('#request_bills').click(function () { + if($('#request_bills').is(":visible")) { + $('#request_bills').prop("disabled",true); + } + var order_id = $('#save_order_id').attr('data-order'); var ajax_url = "/origami/" + order_id + "/request_bills"; $.ajax({ @@ -893,8 +897,11 @@ }); $('#move').on('click', function () { - var dining_id = "<%= @dining.id %>"; - window.location.href = '/origami/table/' + dining_id + "/movetable"; + if($('#move').is(":visible")) { + $('#move').prop("disabled",true); + } + var dining_id = "<%= @dining.id %>"; + window.location.href = '/origami/table/' + dining_id + "/movetable"; }) $('#back').on('click', function () { diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 46ec8fde..499d7724 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -1050,6 +1050,10 @@ var pdf_view = '<%=@pdf_view%>'; }); function print_receipt() { + if($('.print_receipt').is(":visible")) { + $('.print_receipt').prop("disabled",true); + } + var sale_id = $('#sale_id').text(); var filename = $("#filename").val(); var printer_name = $("#printer_name").val(); diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 61e1f9fe..ee1573ea 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -870,6 +870,9 @@ $('#pay').on('click',function() { }); // Bill Request $('#request_bills').click(function() { + if($('#request_bills').is(":visible")) { + $('#request_bills').prop("disabled",true); + } var order_id = $('#save_order_id').attr('data-order'); var ajax_url = "/origami/" + order_id + "/request_bills"; $.ajax({ @@ -894,6 +897,9 @@ $('#split_bills').click(function(){ }); $('#move').on('click',function(){ + if($('#move').is(":visible")) { + $('#move').prop("disabled",true); + } var dining_id = "<%= @room.id %>" window.location.href = '/origami/table/'+ dining_id + "/moveroom"; }) From a1ab3fac47ace0e5cf36184d245159ff1625402a Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 1 Jun 2018 14:04:46 +0630 Subject: [PATCH 2/5] clickable checked --- app/views/origami/discounts/index.html.erb | 7 +++++-- app/views/origami/other_charges/index.html.erb | 3 +++ app/views/origami/payments/show.html.erb | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index 59341bcb..ac94fd18 100755 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -211,7 +211,7 @@ -
+
@@ -432,6 +432,9 @@ var cashier_type = "<%= @cashier_type %>"; // Pay Discount for Payment $("#pay-discount").on('click', function(e){ e.preventDefault(); + if($('#pay-discount').is(":visible")) { + $('#pay-discount').prop("disabled",true); + } $("#loading_wrapper").show(); var sale_id = $('#sale-id').text(); var discount_items = JSON.stringify(get_discount_item_rows()); diff --git a/app/views/origami/other_charges/index.html.erb b/app/views/origami/other_charges/index.html.erb index b9dbbc60..bf119be0 100755 --- a/app/views/origami/other_charges/index.html.erb +++ b/app/views/origami/other_charges/index.html.erb @@ -308,6 +308,9 @@ var cashier_type = "<%= @cashier_type %>"; // Calculate Other Charges for Payment $("#charge_other").on('click', function(e){ e.preventDefault(); + if($('#charge_other').is(":visible")) { + $('#charge_other').prop("disabled",true); + } var sale_id = $('#sale-id').text(); var sub_total = $('#order-sub-total').text(); var other_charges_items = JSON.stringify(get_other_item_rows()); diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 499d7724..e8062d46 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -1054,6 +1054,10 @@ var pdf_view = '<%=@pdf_view%>'; $('.print_receipt').prop("disabled",true); } + if($('#pay').is(":visible")) { + $('#pay').prop("disabled",true); + } + var sale_id = $('#sale_id').text(); var filename = $("#filename").val(); var printer_name = $("#printer_name").val(); From 864bf46df96893eceee841faaf7b33fef13d4ef9 Mon Sep 17 00:00:00 2001 From: EikhantMon Date: Fri, 1 Jun 2018 14:15:49 +0630 Subject: [PATCH 3/5] change api --- app/controllers/api/orders_controller.rb | 34 +++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 1dced300..59fbd864 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -233,25 +233,23 @@ class Api::OrdersController < Api::ApiController printer = PrintSetting.all unique_code="OrderItemPdf" - if !order_slim_pdf.empty? - if !printer.empty? - printer.each do |printer_setting| - if printer_setting.unique_code == 'OrderItemPdf' - unique_code="OrderItemPdf" - elsif printer_setting.unique_code == 'OrderItemSlimPdf' - unique_code="OrderItemSlimPdf" - elsif printer_setting.unique_code == 'OrderSetItemPdf' - unique_code="OrderSetItemPdf" - elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf' - unique_code="OrderItemSlimCustomisePdf" - elsif printer_setting.unique_code == 'OrderItemCustomisePdf' - unique_code="OrderItemCustomisePdf" - elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf' - unique_code="OrderSetItemCustomisePdf" - end - end + if !printer.empty? + printer.each do |printer_setting| + if printer_setting.unique_code == 'OrderItemPdf' + unique_code="OrderItemPdf" + elsif printer_setting.unique_code == 'OrderItemSlimPdf' + unique_code="OrderItemSlimPdf" + elsif printer_setting.unique_code == 'OrderSetItemPdf' + unique_code="OrderSetItemPdf" + elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf' + unique_code="OrderItemSlimCustomisePdf" + elsif printer_setting.unique_code == 'OrderItemCustomisePdf' + unique_code="OrderItemCustomisePdf" + elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf' + unique_code="OrderSetItemCustomisePdf" + end end - end + end print_settings=PrintSetting.find_by_unique_code(unique_code) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) From 04f6d845470a6f8133a18b6f48b1f721fce0dba3 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 1 Jun 2018 14:54:23 +0630 Subject: [PATCH 4/5] check clickable in payment print --- app/views/origami/payments/show.html.erb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index e8062d46..78f39173 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -468,7 +468,7 @@