update optimization

This commit is contained in:
Aung Myo
2018-07-05 18:19:16 +06:30
parent f0df6a80ba
commit a5bb0a6746
8 changed files with 34 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
$(function() { $(function() {
var role = $('#role').val(); var role = $('#role').val();
var second_display_lookup = $("#display_type");
console.log(second_display_lookup)
type = window.location.href.indexOf("quick_service"); type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order"); modify_order = window.location.href.indexOf("modify_order");
@@ -428,7 +429,7 @@ $(function() {
var items = $('.selected-set'); var items = $('.selected-set');
if (items.length >= min_qty) { if (items.length >= min_qty) {
if ($('#server_mode').val() != "cloud") { if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
item = get_set_item(items); item = get_set_item(items);
customer_display_view(item,"set_add"); customer_display_view(item,"set_add");
} }
@@ -756,7 +757,7 @@ $(function() {
$('.add_to_order').attr('data-options',JSON.stringify(option_arr)); $('.add_to_order').attr('data-options',JSON.stringify(option_arr));
$('.add_to_order').attr('data-opt',JSON.stringify(option_arr)); $('.add_to_order').attr('data-opt',JSON.stringify(option_arr));
var item_data = $(this); var item_data = $(this);
if ($('#server_mode').val() != "cloud") { if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
item = get_item(item_data,"add_to_order"); item = get_item(item_data,"add_to_order");
customer_display_view(item,"add"); customer_display_view(item,"add");
} }
@@ -768,7 +769,7 @@ $(function() {
// click plus icon for add // click plus icon for add
$(document).on('click', '.add_icon', function(event){ $(document).on('click', '.add_icon', function(event){
var item_data = $(this); var item_data = $(this);
if ($('#server_mode').val() != "cloud") { if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
item = get_item(item_data,"add_icon"); item = get_item(item_data,"add_icon");
customer_display_view(item,"add"); customer_display_view(item,"add");
} }
@@ -895,7 +896,7 @@ $(function() {
window.location.href = "/origami/room/" + table_id window.location.href = "/origami/room/" + table_id
} }
} }
if ($('#server_mode').val() != "cloud") { if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
customer_display_view(null,"reload"); customer_display_view(null,"reload");
} }
} }

View File

@@ -18,7 +18,12 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile if check_mobile
@webview = true @webview = true
end end
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value==2
@display_type = display_type.value
else
@display_type = nil
end
# if params[:menu] == "true" # if params[:menu] == "true"
@menus = [] @menus = []
@menu = [] @menu = []

View File

@@ -8,24 +8,27 @@ class Origami::SecondDisplayController < BaseOrigamiController
end end
def customer_view def customer_view
if params[:status]!= "billed" display_type = Lookup.find_by_lookup_type("display_type")
tax_profiles = TaxProfile.all.order("order_by asc") if !display_type.nil? && display_type.value==2
else if params[:status]!= "billed"
tax_profiles = nil tax_profiles = TaxProfile.all.order("order_by asc")
end else
if ENV["SERVER_MODE"] == 'cloud' tax_profiles = nil
from = request.subdomain + "." + request.domain end
else if ENV["SERVER_MODE"] == 'cloud'
from = "" from = request.subdomain + "." + request.domain
else
from = ""
end
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status],from:from
end end
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status],from:from
# end # end
end end
#Shop Name in Navbor #Shop Name in Navbor
helper_method :shop_detail # helper_method :shop_detail
def shop_detail # def shop_detail
@shop = Shop.first # @shop = Shop.first
end # end
end end

View File

@@ -8,7 +8,6 @@ class AssignedOrderItem < ApplicationRecord
belongs_to :order_queue_station belongs_to :order_queue_station
def self.assigned_order_item (order, item_code, instance_code, order_queue_station ) def self.assigned_order_item (order, item_code, instance_code, order_queue_station )
AssignedOrderItem.transaction do
assigned_order_item = AssignedOrderItem.new() assigned_order_item = AssignedOrderItem.new()
assigned_order_item.order = order assigned_order_item.order = order
assigned_order_item.item_code = item_code assigned_order_item.item_code = item_code
@@ -17,7 +16,6 @@ class AssignedOrderItem < ApplicationRecord
assigned_order_item.print_status = false assigned_order_item.print_status = false
assigned_order_item.delivery_status = false assigned_order_item.delivery_status = false
assigned_order_item.save! assigned_order_item.save!
end
end end
def self.assigned_order_item_by_job(order_id) def self.assigned_order_item_by_job(order_id)

View File

@@ -207,7 +207,7 @@ class OrderQueueStation < ApplicationRecord
private private
#Print order_items in 1 slip #Print order_items in 1 slip
def print_slip(oqs, order, order_items) def print_slip(oqs, order, order_items)
printer = PrintSetting.all printer = PrintSetting.all.order("id ASC")
unique_code="OrderSummaryPdf" unique_code="OrderSummaryPdf"
if !printer.empty? if !printer.empty?
@@ -245,7 +245,7 @@ class OrderQueueStation < ApplicationRecord
#Print order_item in 1 slip per item #Print order_item in 1 slip per item
def print_slip_item(oqs, order, assigned_items) def print_slip_item(oqs, order, assigned_items)
printer = PrintSetting.all printer = PrintSetting.all.order("id ASC")
unique_code="OrderItemPdf" unique_code="OrderItemPdf"
if !printer.empty? if !printer.empty?

View File

@@ -70,7 +70,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
print_settings.save! print_settings.save!
end end
print_setting = PrintSetting.all print_setting = PrintSetting.all.order("id ASC")
order=print_query('order_summary', order_id) order=print_query('order_summary', order_id)
# For Print Per Item # For Print Per Item
if oqs.cut_per_item if oqs.cut_per_item
@@ -170,7 +170,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
print_settings.save! print_settings.save!
end end
print_setting = PrintSetting.all print_setting = PrintSetting.all.order("id ASC")
order=print_query('booking_summary', booking_id) order=print_query('booking_summary', booking_id)
# For Print Per Item # For Print Per Item

View File

@@ -8,12 +8,10 @@ class SaleOrder < ApplicationRecord
belongs_to :order belongs_to :order
def create_sale_order(sale, order) def create_sale_order(sale, order)
SaleOrder.transaction do
sale_order = SaleOrder.new sale_order = SaleOrder.new
sale_order.sale_id = sale sale_order.sale_id = sale
sale_order.order_id = order sale_order.order_id = order
sale_order.save! sale_order.save!
end
end end
private private

View File

@@ -11,6 +11,7 @@
</div> </div>
<input type="hidden" name="type" id="role" value="<%= current_user.role%>"> <input type="hidden" name="type" id="role" value="<%= current_user.role%>">
<input type="hidden" name="cashier_type" id="cashier_type" value="<%= type%>"> <input type="hidden" name="cashier_type" id="cashier_type" value="<%= type%>">
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
<div class="row m-t--20"> <div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data"> <div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
<li class="list-menu"> <li class="list-menu">