Merge branch 'r-1902001-01-dev' of https://gitlab.com/code2lab/SXRestaurant into r-1902001-01-dev
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
var role = $('#role').val();
|
var role = $('#role').val();
|
||||||
var second_display_lookup = $("#display_type").val();
|
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");
|
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");
|
||||||
|
|
||||||
@@ -26,7 +25,6 @@ $(function() {
|
|||||||
if (type ==-1 && modify_order == -1){
|
if (type ==-1 && modify_order == -1){
|
||||||
url_item = url_item
|
url_item = url_item
|
||||||
}
|
}
|
||||||
console.log(url_item)
|
|
||||||
//Start Ajax
|
//Start Ajax
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@@ -816,7 +814,7 @@ $(function() {
|
|||||||
}); //End Add Icon Click
|
}); //End Add Icon Click
|
||||||
|
|
||||||
function show_item_detail(data,click_type){
|
function show_item_detail(data,click_type){
|
||||||
|
testqty = parseInt($('.item_box').children('data_qty').text());
|
||||||
qty = parseInt(data.attr('data-qty'));
|
qty = parseInt(data.attr('data-qty'));
|
||||||
append = 0;
|
append = 0;
|
||||||
price = data.attr('data-price');
|
price = data.attr('data-price');
|
||||||
@@ -863,8 +861,8 @@ $(function() {
|
|||||||
});
|
});
|
||||||
if (append===0) {
|
if (append===0) {
|
||||||
row ="<tr class='item_box' data-price ='"
|
row ="<tr class='item_box' data-price ='"
|
||||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
+price+ " 'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||||
+instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
|
+instance+ "' data-qty='"+qty +"' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
|
||||||
+data.attr('data-instance-code')+"' data-attributes='"
|
+data.attr('data-instance-code')+"' data-attributes='"
|
||||||
+data.attr('data-attributes')+"' data-options ='"
|
+data.attr('data-attributes')+"' data-options ='"
|
||||||
+data_option+"' data-opt ='"
|
+data_option+"' data-opt ='"
|
||||||
@@ -1031,6 +1029,7 @@ $(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) {
|
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
|
||||||
|
var item_data = $(this);
|
||||||
item = get_item(item_data,"remove_icon");
|
item = get_item(item_data,"remove_icon");
|
||||||
customer_display_view(item,"remove");
|
customer_display_view(item,"remove");
|
||||||
}
|
}
|
||||||
@@ -1053,6 +1052,7 @@ $(function() {
|
|||||||
if ($('#modal-qty').val()>0) {
|
if ($('#modal-qty').val()>0) {
|
||||||
summary_items_filter();
|
summary_items_filter();
|
||||||
calculate_sub_total();
|
calculate_sub_total();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
swal("Opps", "Please enter number for qty ","warning");
|
swal("Opps", "Please enter number for qty ","warning");
|
||||||
}
|
}
|
||||||
@@ -1092,6 +1092,7 @@ $(function() {
|
|||||||
$('.summary-items tr').filter(function(){
|
$('.summary-items tr').filter(function(){
|
||||||
if ($(this).attr('data-active') == 'true'){
|
if ($(this).attr('data-active') == 'true'){
|
||||||
qty = $('#modal-qty').val();
|
qty = $('#modal-qty').val();
|
||||||
|
$(this).attr('data-qty',qty);
|
||||||
price = parseFloat($(this).attr('data-price'));
|
price = parseFloat($(this).attr('data-price'));
|
||||||
total_price = parseFloat(price*qty).toFixed(2);
|
total_price = parseFloat(price*qty).toFixed(2);
|
||||||
|
|
||||||
@@ -1337,11 +1338,11 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get Item rows */
|
/* Get Item rows */
|
||||||
function get_item(data,click_type){
|
function get_item(data,click_type){
|
||||||
var sale_items = [];
|
var sale_items = [];
|
||||||
|
|
||||||
var sale_item = {};
|
var sale_item = {};
|
||||||
sale_item.qty = parseInt(data.attr('data-qty'))
|
sale_item.qty = parseInt(data.attr('data-qty'));
|
||||||
sale_item.name = data.attr('data-name');
|
sale_item.name = data.attr('data-name');
|
||||||
sale_item.price = data.attr('data-price');
|
sale_item.price = data.attr('data-price');
|
||||||
sale_item.item_code = data.attr('data-item-code')
|
sale_item.item_code = data.attr('data-item-code')
|
||||||
@@ -1352,8 +1353,8 @@ $(function() {
|
|||||||
sale_item.click_type = click_type
|
sale_item.click_type = click_type
|
||||||
sale_item.instance = data.attr('data-instance')
|
sale_item.instance = data.attr('data-instance')
|
||||||
sale_items.push(sale_item);
|
sale_items.push(sale_item);
|
||||||
|
|
||||||
return sale_items;
|
return sale_items;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get Item rows */
|
/* Get Item rows */
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (append===0) {
|
if (append===0) {
|
||||||
row ="<tr class='item_box_"+items[i].item_code+"' data-price ='"
|
row ="<tr class='item_box_"+items[i].instance_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='"
|
||||||
@@ -130,15 +130,16 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
|||||||
//remove item
|
//remove item
|
||||||
if(status == "remove"){
|
if(status == "remove"){
|
||||||
for(var i in items) {
|
for(var i in items) {
|
||||||
var item_code = items[i].item_code;
|
var item_code = items[i].instance_code;
|
||||||
$("#order-items-table tbody > tr.item_box_"+item_code+"").remove();
|
$("#order-items-table tbody > tr.item_box_"+item_code+"").remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//remove item
|
//remove item
|
||||||
//update item qty
|
//update item qty
|
||||||
if(status == "update_qty"){
|
if(status == "update_qty"){
|
||||||
|
|
||||||
for(var i in items) {
|
for(var i in items) {
|
||||||
var item_code = items[i].item_code;
|
var item_code = items[i].instance_code;
|
||||||
var item_qty = parseInt(items[i].qty);
|
var item_qty = parseInt(items[i].qty);
|
||||||
var item_price = parseFloat(items[i].price);
|
var item_price = parseFloat(items[i].price);
|
||||||
var item_total = parseFloat(item_qty * item_price).toFixed(2);
|
var item_total = parseFloat(item_qty * item_price).toFixed(2);
|
||||||
@@ -186,4 +187,3 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -280,8 +280,12 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
puts current_user
|
display_type = Lookup.find_by_lookup_type("display_type")
|
||||||
puts "Hello current_user"
|
if !display_type.nil? && display_type.value.to_i ==2
|
||||||
|
@display_type = display_type.value
|
||||||
|
else
|
||||||
|
@display_type = nil
|
||||||
|
end
|
||||||
path = request.fullpath
|
path = request.fullpath
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
@trans_flag = true
|
@trans_flag = true
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ class InventoryDefinition < ApplicationRecord
|
|||||||
|
|
||||||
def self.calculate_product_count(saleObj=nil,saleobj_after_req_bill=nil)
|
def self.calculate_product_count(saleObj=nil,saleobj_after_req_bill=nil)
|
||||||
if !saleObj.nil?
|
if !saleObj.nil?
|
||||||
Rails.logger.debug "Hello count"
|
|
||||||
Rails.logger.debug saleObj.sale_items.count
|
|
||||||
saleObj.sale_items.each do |item|
|
saleObj.sale_items.each do |item|
|
||||||
found, inventory_definition = find_product_in_inventory(item)
|
found, inventory_definition = find_product_in_inventory(item)
|
||||||
if found
|
if found
|
||||||
@@ -37,7 +35,7 @@ class InventoryDefinition < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.check_balance(item,inventory_definition) # item => saleItemOBj
|
def self.check_balance(item,inventory_definition) # item => saleItemOBj
|
||||||
stock = StockJournal.where('item_code=?', item.item_instance_code).last
|
stock = StockJournal.where('item_code=?', item.item_instance_code).order("id DESC").first
|
||||||
unless stock.nil?
|
unless stock.nil?
|
||||||
modify_balance(item, stock, inventory_definition)
|
modify_balance(item, stock, inventory_definition)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
def generate_invoice_from_booking(booking_id, requested_by, cashier, order_source = nil, current_checkin_induties_count)
|
def generate_invoice_from_booking(booking_id, requested_by, cashier, order_source = nil, current_checkin_induties_count)
|
||||||
|
saleObj =''
|
||||||
booking = Booking.find(booking_id)
|
booking = Booking.find(booking_id)
|
||||||
status = false
|
status = false
|
||||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||||
@@ -71,13 +72,17 @@ class Sale < ApplicationRecord
|
|||||||
#get all order attached to this booking and combine into 1 invoice
|
#get all order attached to this booking and combine into 1 invoice
|
||||||
|
|
||||||
booking.booking_orders.each do |order|
|
booking.booking_orders.each do |order|
|
||||||
|
# puts "Hello order"
|
||||||
if booking.sale_id
|
if booking.sale_id
|
||||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier, order_source)
|
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier, order_source)
|
||||||
else
|
else
|
||||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier, order_source)
|
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier, order_source)
|
||||||
end
|
end
|
||||||
booking.sale_id = sale_id
|
booking.sale_id = sale_id
|
||||||
|
saleObj = Sale.find(sale_id)
|
||||||
end
|
end
|
||||||
|
# InventoryJob.perform_now(self.id)
|
||||||
|
InventoryDefinition.calculate_product_count(saleObj)
|
||||||
|
|
||||||
order = booking.booking_orders.take.order
|
order = booking.booking_orders.take.order
|
||||||
link_order_sale(order.id)
|
link_order_sale(order.id)
|
||||||
@@ -135,7 +140,13 @@ class Sale < ApplicationRecord
|
|||||||
# shift with terminal zone
|
# shift with terminal zone
|
||||||
|
|
||||||
# set cashier
|
# set cashier
|
||||||
if order_source.downcase == "emenu"
|
if !order_source.nil?
|
||||||
|
orderSoure = order_source.downcase
|
||||||
|
else
|
||||||
|
orderSoure = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if orderSoure == "emenu"
|
||||||
if !booking.dining_facility_id.nil?
|
if !booking.dining_facility_id.nil?
|
||||||
table = DiningFacility.find(booking.dining_facility_id)
|
table = DiningFacility.find(booking.dining_facility_id)
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
@@ -225,7 +236,7 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
# InventoryJob.perform_now(self.id)
|
# InventoryJob.perform_now(self.id)
|
||||||
saleObj = Sale.find(self.id)
|
saleObj = Sale.find(self.id)
|
||||||
InventoryDefinition.calculate_product_count(saleObj)
|
# InventoryDefinition.calculate_product_count(saleObj)
|
||||||
|
|
||||||
return true, self.id
|
return true, self.id
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -139,7 +139,16 @@
|
|||||||
<span class="font-15 shopinfo" >Team Viewer</span>
|
<span class="font-15 shopinfo" >Team Viewer</span>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
<%if current_login_employee.role =="cashier" %>
|
||||||
<li>
|
<li>
|
||||||
|
<p class="waves-effect waves-block p-l-30 m-b-5">
|
||||||
|
<a href="/origami/second_display" onclick="window.open('/origami/second_display', 'newwindow', 'width=700,height=500'); return false;" style="text-decoration: none;">
|
||||||
|
<i class="material-icons font-7 logout_icon shopinfo">info</i>
|
||||||
|
<span class="font-15 shopinfo" >Second Display</span>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
<!-- <p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
|
<!-- <p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
|
||||||
<i class="material-icons font-10 logout_icon">exit_to_app</i>
|
<i class="material-icons font-10 logout_icon">exit_to_app</i>
|
||||||
<span class="font-18">Logout</span>
|
<span class="font-18">Logout</span>
|
||||||
|
|||||||
@@ -795,8 +795,21 @@
|
|||||||
$(".summary-items tbody").empty();
|
$(".summary-items tbody").empty();
|
||||||
$('#sub_total').text("0.00");
|
$('#sub_total').text("0.00");
|
||||||
$(".create").attr("disabled","disabled");
|
$(".create").attr("disabled","disabled");
|
||||||
|
customer_display_view(null,"reload");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function customer_display_view(data,status) {
|
||||||
|
url = '../../../../origami/customer_view';
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
data: {"data":data,"status":status},
|
||||||
|
dataType: "json",
|
||||||
|
success:function(result){
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
if(event.handled !== true) {
|
if(event.handled !== true) {
|
||||||
var original_value;
|
var original_value;
|
||||||
|
|||||||
@@ -387,6 +387,8 @@
|
|||||||
<div class="cashier_number border-top border- border-left payment-long" data-value="10000" data-type="add">10000</div>
|
<div class="cashier_number border-top border- border-left payment-long" data-value="10000" data-type="add">10000</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row bottom">
|
<div class="row bottom">
|
||||||
|
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||||
|
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
|
||||||
<div class="pay border-top border- border-left purple payment-left" id="pay">Pay</div>
|
<div class="pay border-top border- border-left purple payment-left" id="pay">Pay</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -930,8 +932,24 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var second_display_lookup = $("#display_type").val();
|
||||||
|
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
|
||||||
|
customer_display_view(null,"reload");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function customer_display_view(data,status) {
|
||||||
|
url = '../../../../origami/customer_view';
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
data: {"data":data,"status":status},
|
||||||
|
dataType: "json",
|
||||||
|
success:function(result){
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// $('#void').on('click',function () {
|
// $('#void').on('click',function () {
|
||||||
// if ($(this).attr('active') === "true") {
|
// if ($(this).attr('active') === "true") {
|
||||||
// var sale_id = $('#sale_id').text();
|
// var sale_id = $('#sale_id').text();
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
class ChangeImageToAddLimitInDisplayImages < ActiveRecord::Migration[5.1]
|
||||||
|
|
||||||
|
def up
|
||||||
|
change_column :display_images, :image, :binary, :limit => 10.megabyte
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
change_column :display_images, :image, :binary, :limit => nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user