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() {
var role = $('#role').val();
var second_display_lookup = $("#display_type");
console.log(second_display_lookup)
var second_display_lookup = $("#display_type").val();
console.log(second_display_lookup);
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
modify_order = window.location.href.indexOf("modify_order");
@@ -984,6 +984,10 @@ $(function() {
$('#sx_itemModal').on('click','#remove', function(){
$('.summary-items tr').filter(function(){
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();
}
});
@@ -1049,6 +1053,12 @@ $(function() {
$(this).find('.item-cell-price').text(total_price);
$(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) {
row ="<tr class='item_box' data-price ='"
row ="<tr class='item_box_"+items[i].item_code+"' data-price ='"
+price+ "' 'data-instance ='"
+instance+ "' data-code='"+items[i].item_code+"' data-instance-code='"
+items[i].instance_code+"' data-attributes='"
@@ -108,7 +108,7 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
sub_item = items[i].sub_item;
total = qty * price ;
// 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 ='"
+name+ "' data-code='"+item_code+"' data-instance-code='"
+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
var total_price = 0;
var taxable_amount = 0;