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() {
var role = $('#role').val();
var second_display_lookup = $("#display_type");
console.log(second_display_lookup)
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
@@ -428,7 +429,7 @@ $(function() {
var items = $('.selected-set');
if (items.length >= min_qty) {
if ($('#server_mode').val() != "cloud") {
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
item = get_set_item(items);
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-opt',JSON.stringify(option_arr));
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");
customer_display_view(item,"add");
}
@@ -768,7 +769,7 @@ $(function() {
// click plus icon for add
$(document).on('click', '.add_icon', function(event){
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");
customer_display_view(item,"add");
}
@@ -895,7 +896,7 @@ $(function() {
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");
}
}

View File

@@ -18,7 +18,12 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile
@webview = true
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"
@menus = []
@menu = []

View File

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

View File

@@ -8,7 +8,6 @@ class AssignedOrderItem < ApplicationRecord
belongs_to :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.order = order
assigned_order_item.item_code = item_code
@@ -17,7 +16,6 @@ class AssignedOrderItem < ApplicationRecord
assigned_order_item.print_status = false
assigned_order_item.delivery_status = false
assigned_order_item.save!
end
end
def self.assigned_order_item_by_job(order_id)

View File

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

View File

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

View File

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

View File

@@ -11,6 +11,7 @@
</div>
<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="display_type" id="display_type" value="<%= @display_type%>">
<div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
<li class="list-menu">