diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index b65561e9..fdd66e15 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -762,7 +762,7 @@ $(function() { $('#sub_total').empty(); $('#sub_total').append(fixed_total_price); - if (fixed_total_price > 0) { + if (item_row.length > 0) { $('.create').removeAttr("disabled", false); }else{ $('.create').attr("disabled", true); @@ -886,27 +886,33 @@ $(function() { $('.keypress_qty').keyup(function(e){ - id = $(this).attr('id'); + id = $(this).attr('id'); value = $(this).val(); - $('.change_qty').attr('value',value); - if (id=="count") { - price = $("#unit_price").text(); - $("#total_price").text(value*price); - }else{ - var item_row = $('.selected-instance'); - price = $("#set_unit_price").text(); - set_total_price = $("#set_total_price").text(); - $(".set_change_qty").val(value); - if (item_row.length > 1) { - total = 0 ; - $(item_row).each(function(i){ - total += value * $(item_row[i]).attr('data-price'); - total_price = total; - }); + + if ($.isNumeric(value)) { + $('.change_qty').attr('value',value); + if (id=="count") { + price = $("#unit_price").text(); + $("#total_price").text(value*price); }else{ - total_price = value*price; + var item_row = $('.selected-instance'); + price = $("#set_unit_price").text(); + set_total_price = $("#set_total_price").text(); + $(".set_change_qty").val(value); + if (item_row.length > 1) { + total = 0 ; + $(item_row).each(function(i){ + total += value * $(item_row[i]).attr('data-price'); + total_price = total; + }); + }else{ + total_price = value*price; + } + $("#set_total_price").text(total_price); } - $("#set_total_price").text(total_price); + }else{ + $('#'+id).val(1); + swal("Opps","Please enter number for qty","warning"); } }); diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss index 9e9daa84..ec599464 100755 --- a/app/assets/stylesheets/CRM.scss +++ b/app/assets/stylesheets/CRM.scss @@ -6,9 +6,6 @@ @import "sweetalert/sweetalert.css"; @import "multi-select/css/multi-select.css"; @import "bootstrap-material-datetimepicker/css/bootstrap-material-datetimepicker"; -@import "jquery-ui/jquery-ui.css"; -@import "jquery-ui/jquery-ui.structure.css"; -@import "jquery-ui/jquery-ui.theme.css"; @import "morrisjs/morris"; @import "BSBMaterial/style"; @import "BSBMaterial/themes/all-themes"; @@ -120,3 +117,32 @@ .bottom{ margin-bottom:1px; } + +/*Pagination*/ +nav.pagination { + margin:10px; + +} +nav.pagination .current{ + background-color:#1f91f3; + color:#fff; + padding:4px 10px; + margin-top:-4px; +} +nav.pagination .page a,.next a,.last a,.prev a,.first a{ + padding:6.5px 10px; + margin-left: 3px; +} + +nav.pagination .page a:hover, +a:focus { + background-color: #ccc; + text-decoration: none; + +} +nav.pagination .page a:hover, +.first a:hover,.last a:hover,.prev a:hover,.next a:hover{ + background-color: #ccc; + text-decoration: none; + +} diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 2a277144..f95b54a9 100755 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -33,12 +33,14 @@ class Crm::CustomersController < BaseCrmController end end end - @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(15) + @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(20) @crm_customer = Customer.new @count_customer = Customer.count_customer @taxes = TaxProfile.all.order("order_by asc") + @filter = filter + # if flash["errors"] # @crm_customer.valid? # end diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 13e56c77..656f3e85 100755 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -125,7 +125,7 @@ class Oqs::HomeController < BaseOqsController left join booking_orders as bo on bo.order_id = assigned_order_items.order_id left join bookings as bk on bk.booking_id = bo.booking_id left join dining_facilities as df on df.id = bk.dining_facility_id") - .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs} ") + .where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs} ") query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",) .order("assigned_order_items.assigned_order_item_id desc") .group("odt.order_items_id") @@ -143,7 +143,7 @@ class Oqs::HomeController < BaseOqsController left join booking_orders as bo on bo.order_id = assigned_order_items.order_id left join bookings as bk on bk.booking_id = bo.booking_id left join dining_facilities as df on df.id = bk.dining_facility_id") - .where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'") + .where("assigned_order_items.delivery_status = true AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'") query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",) .group("assigned_order_items.order_id") .limit(20) @@ -162,7 +162,7 @@ class Oqs::HomeController < BaseOqsController left join booking_orders as bo on bo.order_id = assigned_order_items.order_id left join bookings as bk on bk.booking_id = bo.booking_id left join dining_facilities as df on df.id = bk.dining_facility_id") - .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ") + .where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ") query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",) .group("oqs.id") diff --git a/app/controllers/settings/membership_actions_controller.rb b/app/controllers/settings/membership_actions_controller.rb index 4f22a285..a41f7ad2 100755 --- a/app/controllers/settings/membership_actions_controller.rb +++ b/app/controllers/settings/membership_actions_controller.rb @@ -72,6 +72,6 @@ class Settings::MembershipActionsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def settings_membership_action_params - params.require(:membership_action).permit(:membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by, :additional_parameter) + params.require(:membership_action).permit(:membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by) end end diff --git a/app/controllers/settings/shops_controller.rb b/app/controllers/settings/shops_controller.rb index 25c8456d..a48bcb9a 100644 --- a/app/controllers/settings/shops_controller.rb +++ b/app/controllers/settings/shops_controller.rb @@ -71,6 +71,6 @@ class Settings::ShopsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def shop_params - params.require(:shop).permit(:name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order) + params.require(:shop).permit(:name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order,:show_account_info) end end diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index 7bc1e969..a76fa385 100755 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -34,7 +34,7 @@ class Transactions::OrdersController < ApplicationController def show @order = Order.find(params[:id]) - + @dining = BookingOrder.find_by_order_id(@order.order_id).booking.dining_facility respond_to do |format| format.html # show.html.erb format.json { render json: @order } diff --git a/app/jobs/order_queue_processor_job.rb b/app/jobs/order_queue_processor_job.rb index 96b08220..d8e5d6e1 100755 --- a/app/jobs/order_queue_processor_job.rb +++ b/app/jobs/order_queue_processor_job.rb @@ -5,14 +5,15 @@ class OrderQueueProcessorJob < ApplicationJob # Do something later #Order ID - order = Order.find(order_id) - assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id) + order = Order.find(order_id) #Execute orders and send to order stations if order oqs = OrderQueueStation.new oqs.process_order(order, table_id) end + + assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id) ActionCable.server.broadcast "order_queue_station_channel",order: assign_order end diff --git a/app/models/assigned_order_item.rb b/app/models/assigned_order_item.rb index 85dd71c7..ea1b9b39 100755 --- a/app/models/assigned_order_item.rb +++ b/app/models/assigned_order_item.rb @@ -35,7 +35,7 @@ class AssignedOrderItem < ApplicationRecord left join booking_orders as bo on bo.order_id = assigned_order_items.order_id left join bookings as bk on bk.booking_id = bo.booking_id left join dining_facilities as df on df.id = bk.dining_facility_id") - .where("assigned_order_items.order_id = '#{order_id}' AND assigned_order_items.delivery_status = false AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ") + .where("assigned_order_items.order_id = '#{order_id}' AND assigned_order_items.delivery_status = false AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ") .order("assigned_order_items.assigned_order_item_id desc") .group("assigned_order_items.assigned_order_item_id") return order_item diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 9ed86b85..fcdb4983 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -69,10 +69,10 @@ class OrderQueueStation < ApplicationRecord # AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) # else - if (order_item.price != 0) + # if (order_item.price != 0) AssignedOrderItem.assigned_order_item(order, order_item.item_code, order_item.item_instance_code, oqs) oqs_order_items.push(order_item) - end + # end # end end end diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index a003cbce..13d8a20a 100755 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -9,7 +9,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker filename = "tmp/order_item.pdf" # check for item not to show - if order_item[0].price != 0 + # if order_item[0].price != 0 pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) pdf.render_file filename @@ -22,7 +22,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker else self.print(filename, oqs.printer_name) end - end + # end end # Query for per order @@ -40,7 +40,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker options = odi.options == "[]"? "" : odi.options # check for item not to show - if odi.price != 0 + #if odi.price != 0 pdf = OrderItemPdf.new(print_settings,odi, print_status, options, oqs.use_alternate_name) # pdf.render_file "tmp/order_item.pdf" pdf.render_file filename @@ -51,7 +51,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker else self.print(filename, oqs.printer_name) end - end + #end end # For Print Order Summary else @@ -81,7 +81,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker options = odi.options == "[]"? "" : odi.options # check for item not to show - if odi.price != 0 + #if odi.price != 0 pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) pdf.render_file filename @@ -94,7 +94,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker else self.print(filename, oqs.printer_name) end - end + #end end # For Print Order Summary else @@ -123,7 +123,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join dining_facilities AS df ON df.id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id left join menu_items as item ON item.item_code = order_items.item_code") - .where("order_items.item_instance_code = '#{ id }' AND order_items.price != 0") + .where("order_items.item_instance_code = '#{ id }'") .group("order_items.item_code") elsif type == "order_summary" OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name") @@ -133,7 +133,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join dining_facilities AS df ON df.id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id left join menu_items as item ON item.item_code = order_items.item_code") - .where("orders.order_id = '#{ id }' AND order_items.price != 0") + .where("orders.order_id = '#{ id }'") .group("order_items.order_items_id") else # order summary for booking @@ -144,7 +144,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join dining_facilities AS df ON df.id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id left join menu_items as item ON item.item_code = order_items.item_code") - .where("b.booking_id = '#{ id }' AND order_items.price != 0") + .where("b.booking_id = '#{ id }'") end end diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 50858c47..ea0d4502 100755 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -104,7 +104,7 @@ class OrderSummaryPdf < Prawn::Document order_item.each do|odi| # check for item not to show - if odi.price != 0 + # if odi.price != 0 y_position = cursor bounding_box([0,y_position], :width => self.item_width) do @@ -148,7 +148,7 @@ class OrderSummaryPdf < Prawn::Document dash(1, :space => 1, :phase => 1) stroke_horizontal_line 0, (self.page_width - self.margin) move_down 5 - end + # end end end end diff --git a/app/views/api/restaurant/menu/_menu_item.json.jbuilder b/app/views/api/restaurant/menu/_menu_item.json.jbuilder index fe7c1979..810daf6d 100755 --- a/app/views/api/restaurant/menu/_menu_item.json.jbuilder +++ b/app/views/api/restaurant/menu/_menu_item.json.jbuilder @@ -90,26 +90,28 @@ json.options opt_format # json.item_attributes = item_instance.item_attributes json.instances item.menu_item_instances do |is| - # Convert id to name for attributes - instance_attr = [] + if is.is_available + # Convert id to name for attributes + instance_attr = [] - is.item_attributes.each do |ia| - # mItemAttr = MenuItemAttribute.find(is) - # instance_attr.push(ia) - mItemAttr = MenuItemAttribute.find(ia).name - instance_attr.push(mItemAttr) + is.item_attributes.each do |ia| + # mItemAttr = MenuItemAttribute.find(is) + # instance_attr.push(ia) + mItemAttr = MenuItemAttribute.find(ia).name + instance_attr.push(mItemAttr) + end + + json.id is.id + json.code is.item_instance_code + json.name is.item_instance_name + json.price is.price + json.is_available is.is_available + json.is_default is.is_default + json.is_on_promotion is.is_on_promotion + json.promotion_price is.promotion_price + json.values instance_attr + # json.item_sets is.item_sets end - - json.id is.id - json.code is.item_instance_code - json.name is.item_instance_name - json.price is.price - json.is_available is.is_available - json.is_default is.is_default - json.is_on_promotion is.is_on_promotion - json.promotion_price is.promotion_price - json.values instance_attr - # json.item_sets is.item_sets end #Child Menu items diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 168afe28..091d8e51 100755 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -13,8 +13,6 @@
-
-
-
diff --git a/app/views/origami/addorders/_menu_item.json.jbuilder b/app/views/origami/addorders/_menu_item.json.jbuilder index 32451524..a18645c8 100755 --- a/app/views/origami/addorders/_menu_item.json.jbuilder +++ b/app/views/origami/addorders/_menu_item.json.jbuilder @@ -90,23 +90,25 @@ json.options opt_format # json.item_attributes = item_instance.item_attributes json.instances item.menu_item_instances do |is| - # Convert id to name for attributes - instance_attr = [] - is.item_attributes.each do |ia| - mItemAttr = MenuItemAttribute.find(ia).name - instance_attr.push(mItemAttr) + if is.is_available + # Convert id to name for attributes + instance_attr = [] + is.item_attributes.each do |ia| + mItemAttr = MenuItemAttribute.find(ia).name + instance_attr.push(mItemAttr) + end + + json.id is.id + json.code is.item_instance_code + json.name is.item_instance_name + json.price is.price + json.is_available is.is_available + json.is_default is.is_default + json.is_on_promotion is.is_on_promotion + json.promotion_price is.promotion_price + json.values instance_attr + # json.item_sets is.item_sets end - - json.id is.id - json.code is.item_instance_code - json.name is.item_instance_name - json.price is.price - json.is_available is.is_available - json.is_default is.is_default - json.is_on_promotion is.is_on_promotion - json.promotion_price is.promotion_price - json.values instance_attr - # json.item_sets is.item_sets end #Child Menu items diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 150ea55d..59e782b4 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -140,7 +140,7 @@ - + - +
diff --git a/app/views/transactions/orders/index.html.erb b/app/views/transactions/orders/index.html.erb index c0846ac8..ce8a7607 100755 --- a/app/views/transactions/orders/index.html.erb +++ b/app/views/transactions/orders/index.html.erb @@ -48,6 +48,9 @@ + + + @@ -57,10 +60,14 @@ - <% @orders.each do |order| %> + <% @orders.each do |order| + @dining = BookingOrder.find_by_order_id(order.order_id).booking.dining_facility + %> + + diff --git a/app/views/transactions/orders/show.html.erb b/app/views/transactions/orders/show.html.erb index 58ff8de4..0a487437 100755 --- a/app/views/transactions/orders/show.html.erb +++ b/app/views/transactions/orders/show.html.erb @@ -17,21 +17,25 @@
<%= t("views.right_panel.detail.order_id") %><%= t :table %>/<%= t :room %><%= t("views.right_panel.detail.order_by") %> <%= t("views.right_panel.detail.type") %> <%= t :customer %> <%= t("views.right_panel.detail.order_status") %>
<%= link_to order.order_id, transactions_order_path(order) %><%= @dining.type %>-<%= @dining.name %><%= order.waiters %> <%= order.order_type %> <%= order.customer.name rescue '-' %> <%= order.status %>
+ + - + + + - +
<%= t :table %>/<%= t :room %><%= t("views.right_panel.detail.order_by") %> <%= t("views.right_panel.detail.type") %> <%= t :customer %> <%= t("views.right_panel.detail.order_status") %> <%= t("views.right_panel.detail.order_date") %><%= t("views.right_panel.detail.order_by") %>
<%= @dining.type %>-<%= @dining.name %> <%= @order.waiters rescue '-' %> <%= @order.order_type %> <%= @order.customer.name rescue '-' %> <%= @order.status %> <%= @order.date.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> <%= @order.waiters rescue '-' %>