second display

This commit is contained in:
Aung Kyaw Phyoe
2019-02-26 10:59:39 +06:30
parent 0ce267a7ac
commit ab666e7f82
6 changed files with 47 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
$(function() { $(function() {
var role = $('#role').val(); var role = $('#role').val();
var second_display_lookup = $("#display_type"); var second_display_lookup = $("#display_type").val();
console.log(second_display_lookup) console.log(second_display_lookup);
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court"); type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
modify_order = window.location.href.indexOf("modify_order"); modify_order = window.location.href.indexOf("modify_order");
@@ -984,6 +984,10 @@ $(function() {
$('#sx_itemModal').on('click','#remove', function(){ $('#sx_itemModal').on('click','#remove', function(){
$('.summary-items tr').filter(function(){ $('.summary-items tr').filter(function(){
if ($(this).attr('data-active') == 'true'){ if ($(this).attr('data-active') == 'true'){
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
item = get_item(item_data,"remove_icon");
customer_display_view(item,"remove");
}
$(this).remove(); $(this).remove();
} }
}); });
@@ -1049,6 +1053,12 @@ $(function() {
$(this).find('.item-cell-price').text(total_price); $(this).find('.item-cell-price').text(total_price);
$(this).removeAttr('data-active'); $(this).removeAttr('data-active');
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
var item_data = $(this);
item = get_item(item_data,"update_icon");
customer_display_view(item,"update_qty");
}
} }
}); });
} }

View File

@@ -74,7 +74,7 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
} }
}); });
if (append===0) { if (append===0) {
row ="<tr class='item_box' data-price ='" row ="<tr class='item_box_"+items[i].item_code+"' data-price ='"
+price+ "' 'data-instance ='" +price+ "' 'data-instance ='"
+instance+ "' data-code='"+items[i].item_code+"' data-instance-code='" +instance+ "' data-code='"+items[i].item_code+"' data-instance-code='"
+items[i].instance_code+"' data-attributes='" +items[i].instance_code+"' data-attributes='"
@@ -108,7 +108,7 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
sub_item = items[i].sub_item; sub_item = items[i].sub_item;
total = qty * price ; total = qty * price ;
// option_arr.push(option); // option_arr.push(option);
row ="<tr class='item_box' data-price ='" row ="<tr class='item_box_"+item_code+"' data-price ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='" +price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+name+ "' data-code='"+item_code+"' data-instance-code='" +name+ "' data-code='"+item_code+"' data-instance-code='"
+code+"' data-attributes='" +code+"' data-attributes='"
@@ -126,6 +126,27 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
} }
} }
//remove item
if(status == "remove"){
for(var i in items) {
var item_code = items[i].item_code;
$("#order-items-table tbody > tr.item_box_"+item_code+"").remove();
}
}
//remove item
//update item qty
if(status == "update_qty"){
for(var i in items) {
var item_code = items[i].item_code;
var item_qty = parseInt(items[i].qty);
var item_price = parseFloat(items[i].price);
var item_total = parseFloat(item_qty * item_price).toFixed(2);
$("#order-items-table tbody > tr.item_box_"+item_code+"").find("#item_qty").text(item_qty);
$("#order-items-table tbody > tr.item_box_"+item_code+"").find("#item_price").text(item_total);
}
}
//update item qty
//end apend items //end apend items
var total_price = 0; var total_price = 0;
var taxable_amount = 0; var taxable_amount = 0;

View File

@@ -20,7 +20,7 @@ class Origami::AddordersController < BaseOrigamiController
@webview = true @webview = true
end end
display_type = Lookup.find_by_lookup_type("display_type") display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value==2 if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value @display_type = display_type.value
else else
@display_type = nil @display_type = nil

View File

@@ -22,6 +22,13 @@ class Origami::QuickServiceController < ApplicationController
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc') @rooms = Room.all.active.order('status desc')
@cashier_type = "quick_service" @cashier_type = "quick_service"
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value
else
@display_type = nil
end
#checked quick_service only #checked quick_service only
@quick_service_only = true @quick_service_only = true
lookup_dine_in = Lookup.collection_of('dinein_cashier') lookup_dine_in = Lookup.collection_of('dinein_cashier')

View File

@@ -9,7 +9,7 @@ class Origami::SecondDisplayController < BaseOrigamiController
def customer_view def customer_view
display_type = Lookup.find_by_lookup_type("display_type") display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value==2 if !display_type.nil? && display_type.value.to_i == 2
if params[:status]!= "billed" if params[:status]!= "billed"
tax_profiles = TaxProfile.all.order("order_by asc") tax_profiles = TaxProfile.all.order("order_by asc")
else else

View File

@@ -10,6 +10,9 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
//html font-size for second display till 35px!
// document.getElementsByTagName( "html" )[0].style[ "font-size" ] = "35px";
$('#s_reload').on('click', function () { $('#s_reload').on('click', function () {
window.location.href = '/origami/second_display'; window.location.href = '/origami/second_display';
}); });