diff --git a/app/assets/javascripts/orgiami.js b/app/assets/javascripts/orgiami.js
index 2ecdba13..a12ed790 100644
--- a/app/assets/javascripts/orgiami.js
+++ b/app/assets/javascripts/orgiami.js
@@ -21,6 +21,10 @@ $(document).ready(function(){
var zone_name=$(this).find(".orders-table").text();
var receipt_no=$(this).find(".orders-receipt-no").text();
var unique_id=$(this).find(".orders-id").text();
+ var order_status=$(this).find(".orders-order-status").text().trim();
+
+ // Enable/Disable Button
+ control_button(order_status);
var cashier="";
var receipt_date="";
@@ -85,15 +89,26 @@ $(document).ready(function(){
// Bill Request
$('#request_bills').click(function() {
- var order_id=$(".selected-item").find(".orders-id").text();
- window.location.href = '/origami/request_bills/'+ order_id
+ var order_id=$(".selected-item").find(".orders-id").text();
+ if(order_id!=""){
+ window.location.href = '/origami/request_bills/'+ order_id
+ }
+ else {
+ alert("Please select an order!");
+ }
return false;
});
// Discount for Payment
$('#discount').click(function() {
- var order_id=$(".selected-item").find(".orders-id").text();
- window.location.href = '/origami/discount/'+ order_id
+ var order_id=$(".selected-item").find(".orders-id").text();
+ if(order_id!=""){
+ window.location.href = '/origami/discount/'+ order_id
+ }
+ else {
+ alert("Please select an order!");
+ }
+
return false;
});
@@ -122,8 +137,14 @@ $(document).ready(function(){
// Payment for Bill
$('#pay').click(function() {
- var sale_id=$(".selected-item").find(".orders-id").text();
- window.location.href = '/origami/sale/'+ sale_id + "/payment"
+ var sale_id=$(".selected-item").find(".orders-id").text();
+ if(order_id!=""){
+ window.location.href = '/origami/sale/'+ sale_id + "/payment"
+ }
+ else {
+ alert("Please select an order!");
+ }
+
return false;
});
});
@@ -174,6 +195,20 @@ $(document).on('click', '.cashier_number', function(event){
}
});
+/* Button Control by Status */
+function control_button(order_status){
+ if(order_status=="billed"){
+ $("#request_bills").prop('disabled', true);
+ $("#discount").prop('disabled', false);
+ $("#pay").prop('disabled', false);
+ }
+ else if(order_status=="new") {
+ $("#request_bills").prop('disabled', false);
+ $("#discount").prop('disabled', true);
+ $("#pay").prop('disabled', true);
+ }
+}
+
/* For Receipt - Update Balance */
function update_balance(){
var discount_type = $('#discount-type').val();
diff --git a/app/models/order.rb b/app/models/order.rb
index 8c456a2c..4817c3ce 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -48,7 +48,7 @@ class Order < ApplicationRecord
process_order_queue
#send order to broadcast job
- send_order_broadcast
+ #send_order_broadcast
return true, booking
diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb
index ba11124a..58478998 100644
--- a/app/views/origami/home/index.html.erb
+++ b/app/views/origami/home/index.html.erb
@@ -218,7 +218,7 @@
-
+
diff --git a/db/seeds.rb b/db/seeds.rb
index 55f15be5..66ded4f3 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -140,6 +140,9 @@ admin_employee = Employee.create({name: "Administrator", role: "Administrator",
food = Account.create({title: "Food", account_type: "0"})
beverage = Account.create({title: "Beverage", account_type: "1"})
+order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"})
+order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"})
+
# shop = Shop.create(
# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
# country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",