Merge branch 'split_bill' of bitbucket.org:code2lab/sxrestaurant into quick_service
This commit is contained in:
@@ -78,12 +78,14 @@ $(document).on('turbolinks:load', function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data[field]["table_type"]=null) {
|
var table_type = '';
|
||||||
table_type = data[field]["table_type"] +'-'+data[field]["zone"]
|
if (data[field]["table_type"]!=null) {
|
||||||
}else{
|
table_type = data[field]["table_type"] +'-'+data[field]["zone"]
|
||||||
table_type = "No Table"
|
}else{
|
||||||
|
table_type = "No Table"
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
row ='<div class="card queue_station animated " data-order-no="'+data[field]["order_id"]+'">'
|
row ='<div class="card queue_station animated " data-order-no="'+data[field]["order_id"]+'">'
|
||||||
+'<div class="card-block">'
|
+'<div class="card-block">'
|
||||||
+'<div class="row">'
|
+'<div class="row">'
|
||||||
@@ -151,9 +153,22 @@ $(document).on('turbolinks:load', function() {
|
|||||||
url: '/oqs/' + orderNo,
|
url: '/oqs/' + orderNo,
|
||||||
data: { 'status' : order_status },
|
data: { 'status' : order_status },
|
||||||
success: function(res){
|
success: function(res){
|
||||||
for (i = 0; i < res.length; i++) {
|
// console.log(res);
|
||||||
var data = JSON.stringify(res[i]);
|
for (i = 0; i < res["items"].length; i++) {
|
||||||
|
var data = JSON.stringify(res["items"][i]);
|
||||||
var parse_data = JSON.parse(data);
|
var parse_data = JSON.parse(data);
|
||||||
|
var assigned_order_items = [];
|
||||||
|
var assigned_order_item_id = '';
|
||||||
|
if(res["assigned_order_items"]!= undefined && res["assigned_order_items"]!=''){
|
||||||
|
assigned_order_items = JSON.parse(JSON.stringify(res["assigned_order_items"]));
|
||||||
|
$.each(assigned_order_items,function(key,value){
|
||||||
|
if(value[parse_data.order_items_id] != undefined){
|
||||||
|
assigned_order_item_id = value[parse_data.order_items_id];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// console.log(assigned_order_item_id);
|
||||||
|
|
||||||
var set_menu_items = parse_data.set_menu_items;
|
var set_menu_items = parse_data.set_menu_items;
|
||||||
var set_instance_items = "";
|
var set_instance_items = "";
|
||||||
if(set_menu_items!=null){
|
if(set_menu_items!=null){
|
||||||
@@ -165,10 +180,18 @@ $(document).on('turbolinks:load', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (oqs_id > 0){
|
if (oqs_id > 0){
|
||||||
var order_item_row = "<tr id='edit_"+assigned_item_id+"' class='order-item-edit'>" +
|
if(assigned_order_item_id != ''){
|
||||||
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
var order_item_row = "<tr id='edit_"+assigned_order_item_id+"' class='order-item-edit'>" +
|
||||||
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
||||||
"</tr>";
|
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
}else{
|
||||||
|
var order_item_row = "<tr>" +
|
||||||
|
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
||||||
|
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
var order_item_row = "<tr>" +
|
var order_item_row = "<tr>" +
|
||||||
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
||||||
@@ -191,7 +214,7 @@ $(document).on('turbolinks:load', function() {
|
|||||||
$(document).on('click', '.order-item-edit', function(event){
|
$(document).on('click', '.order-item-edit', function(event){
|
||||||
var _self = $(this); // To know in ajax return
|
var _self = $(this); // To know in ajax return
|
||||||
var assigned_item_id=$(this).attr('id').substr(5);
|
var assigned_item_id=$(this).attr('id').substr(5);
|
||||||
window.location.href = '/oqs/'+ assigned_item_id + "/edit"
|
window.location.href = '/oqs/'+ assigned_item_id + "/edit/oqs";
|
||||||
});
|
});
|
||||||
|
|
||||||
// complete for queue item
|
// complete for queue item
|
||||||
|
|||||||
@@ -46,9 +46,12 @@ class HomeController < ApplicationController
|
|||||||
elsif @employee.role == "manager"
|
elsif @employee.role == "manager"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to dashboard_path
|
redirect_to dashboard_path
|
||||||
elsif @employee.role == "supervisor" || @employee.role == "waiter"
|
elsif @employee.role == "supervisor"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to origami_root_path
|
redirect_to origami_root_path
|
||||||
|
elsif @employee.role == "waiter"
|
||||||
|
session[:session_token] = @employee.token_session
|
||||||
|
redirect_to origami_dashboard_path
|
||||||
elsif @employee.role == "account"
|
elsif @employee.role == "account"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to reports_dailysale_index_path
|
redirect_to reports_dailysale_index_path
|
||||||
@@ -160,7 +163,7 @@ class HomeController < ApplicationController
|
|||||||
elsif employee.role == "manager"
|
elsif employee.role == "manager"
|
||||||
redirect_to dashboard_path
|
redirect_to dashboard_path
|
||||||
elsif employee.role == "waiter"
|
elsif employee.role == "waiter"
|
||||||
redirect_to oqs_root_path
|
redirect_to origami_dashboard_path
|
||||||
elsif employee.role == "crm"
|
elsif employee.role == "crm"
|
||||||
redirect_to crm_root_path
|
redirect_to crm_root_path
|
||||||
elsif @employee.role == "supervisor"
|
elsif @employee.role == "supervisor"
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
class Oqs::EditController < BaseOqsController
|
class Oqs::EditController < BaseOqsController
|
||||||
def index
|
def index
|
||||||
assigned_item_id = params[:id]
|
assigned_item_id = params[:id]
|
||||||
|
@link_type = params[:type]
|
||||||
|
@dining_type = nil
|
||||||
|
if params[:type] != 'oqs'
|
||||||
|
dining = DiningFacility.find_by_id(params[:type])
|
||||||
|
@dining_type = dining.type
|
||||||
|
end
|
||||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
|
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
# Get Order items
|
# Get Order items
|
||||||
def get_order_items
|
def get_order_items
|
||||||
items = []
|
items = []
|
||||||
|
assigned_items = []
|
||||||
order_no = params[:order_no]
|
order_no = params[:order_no]
|
||||||
status = params[:status]
|
status = params[:status]
|
||||||
# dining = DiningFacility.find_by_name(table_name);
|
# dining = DiningFacility.find_by_name(table_name);
|
||||||
@@ -90,6 +91,11 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
|
|
||||||
if !items.empty?
|
if !items.empty?
|
||||||
items.each do |item|
|
items.each do |item|
|
||||||
|
assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||||
|
if !assigned_order_items.nil?
|
||||||
|
assigned_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id})
|
||||||
|
end
|
||||||
|
|
||||||
if !item.set_menu_items.nil?
|
if !item.set_menu_items.nil?
|
||||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
instance_item_sets = JSON.parse(item.set_menu_items)
|
||||||
arr_instance_item_sets = Array.new
|
arr_instance_item_sets = Array.new
|
||||||
@@ -101,7 +107,7 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
render :json => items.to_json
|
render :json => {'items' => items, 'assigned_order_items' => assigned_items }
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_items_by_oqs
|
def get_items_by_oqs
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class Origami::DashboardController < BaseOrigamiController
|
|||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
@print_settings = PrintSetting.get_precision_delimiter()
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
|
@current_user = current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :shop_detail
|
helper_method :shop_detail
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@dining.bookings.active.each do |booking|
|
@dining.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@order_items = Array.new
|
@order_items = Array.new
|
||||||
|
@assigned_order_items = Array.new
|
||||||
if booking.booking_orders.empty?
|
if booking.booking_orders.empty?
|
||||||
@booking = booking
|
@booking = booking
|
||||||
else
|
else
|
||||||
@@ -84,6 +85,10 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
item.set_menu_items = arr_instance_item_sets
|
item.set_menu_items = arr_instance_item_sets
|
||||||
end
|
end
|
||||||
@order_items.push(item)
|
@order_items.push(item)
|
||||||
|
assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||||
|
if !assigned_order_items.nil?
|
||||||
|
@assigned_order_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
accounts = @customer.tax_profiles
|
accounts = @customer.tax_profiles
|
||||||
puts accounts.to_json
|
puts accounts.to_json
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
@orders = Array.new
|
@orders = Array.new
|
||||||
@order_items = Array.new
|
@order_items = Array.new
|
||||||
@sale_data = Array.new
|
@sale_data = Array.new
|
||||||
|
@current_user = current_user
|
||||||
|
|
||||||
table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL")
|
table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL")
|
||||||
if !table_bookings.nil?
|
if !table_bookings.nil?
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ class Origami::TableInvoicesController < BaseOrigamiController
|
|||||||
if !lookup_spit_bill[0].nil?
|
if !lookup_spit_bill[0].nil?
|
||||||
@split_bill = lookup_spit_bill[0][1]
|
@split_bill = lookup_spit_bill[0][1]
|
||||||
end
|
end
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
#Shop Name in Navbor
|
||||||
|
|||||||
@@ -191,6 +191,9 @@ class Ability
|
|||||||
elsif user.role == "waiter"
|
elsif user.role == "waiter"
|
||||||
can :index, :home
|
can :index, :home
|
||||||
can :show, :home
|
can :show, :home
|
||||||
|
#ability for split_bill
|
||||||
|
can :index, :split_bill
|
||||||
|
can :create, :split_bill
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -487,17 +487,17 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width+50) do
|
bounding_box([0,y_position], :width =>self.label_width+50) do
|
||||||
text "Individual amount for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
|
text "Split Bill for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.label_width) do
|
bounding_box([0,y_position], :width =>self.label_width) do
|
||||||
move_down 15
|
move_down 15
|
||||||
text "Total Amount", :size => self.item_font_size,:align => :left
|
text "Amount Due (per person)", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
move_down 15
|
move_down 15
|
||||||
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -488,17 +488,17 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width+50) do
|
bounding_box([0,y_position], :width =>self.label_width+50) do
|
||||||
text "Individual amount for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
|
text "Split Bill for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.label_width) do
|
bounding_box([0,y_position], :width =>self.label_width) do
|
||||||
move_down 15
|
move_down 15
|
||||||
text "Total Amount", :size => self.item_font_size,:align => :left
|
text "Amount Due (per person)", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
move_down 15
|
move_down 15
|
||||||
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<a href="javascript:void(0);" class="bars"></a>
|
<a href="javascript:void(0);" class="bars"></a>
|
||||||
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
|
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
|
||||||
<% else %>
|
<% else %>
|
||||||
<a class="navbar-brand m-0" href="<%=dashboard_path%>">
|
<a class="navbar-brand m-0" href="<%= origami_dashboard_path%>">
|
||||||
<%end%>
|
<%end%>
|
||||||
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
||||||
<span class="navbar-brand-txt">SX Restaurant</span>
|
<span class="navbar-brand-txt">SX Restaurant</span>
|
||||||
|
|||||||
@@ -118,13 +118,45 @@ $(document).ready(function(){
|
|||||||
data: params,
|
data: params,
|
||||||
success: function(result){
|
success: function(result){
|
||||||
// alert("Updated!");
|
// alert("Updated!");
|
||||||
window.location.href = '/oqs';
|
<% if !@link_type.nil? %>
|
||||||
|
<% if @link_type == 'oqs' %>
|
||||||
|
window.location.href = '/oqs';
|
||||||
|
<% else %>
|
||||||
|
<% if !@dining_type.nil? %>
|
||||||
|
<% if @dining_type == 'Table' %>
|
||||||
|
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||||
|
<% else %>
|
||||||
|
window.location.href = '/origami/room/'+<%=@link_type%>;
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
window.location.href = '/oqs';
|
||||||
|
<% end %>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#back').on('click', function () {
|
$('#back').on('click', function () {
|
||||||
|
<% if !@link_type.nil? %>
|
||||||
|
<% if @link_type == 'oqs' %>
|
||||||
|
window.location.href = '/oqs';
|
||||||
|
<% else %>
|
||||||
|
<% if !@dining_type.nil? %>
|
||||||
|
<% if @dining_type == 'Table' %>
|
||||||
|
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||||
|
<% else %>
|
||||||
|
window.location.href = '/origami/room/'+<%=@link_type%>;
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
window.location.href = '/oqs';
|
window.location.href = '/oqs';
|
||||||
|
<% end %>
|
||||||
})
|
})
|
||||||
|
|
||||||
// number key pad
|
// number key pad
|
||||||
|
|||||||
@@ -14,55 +14,7 @@
|
|||||||
delimiter = ""
|
delimiter = ""
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
<!-- Widgets -->
|
|
||||||
<div class="row clearfix">
|
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
|
||||||
<div class="info-box bg-cyan hover-expand-effect">
|
|
||||||
<div class="icon">
|
|
||||||
<i class="material-icons">help</i>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<div class="text"><%= t :sale_count %></div>
|
|
||||||
<div class="number count-to" data-from="0" data-to="<%= @total_count%>" data-speed="1000" data-fresh-interval="20"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
|
||||||
<div class="info-box bg-pink hover-expand-effect">
|
|
||||||
<div class="icon">
|
|
||||||
<i class="material-icons">attach_money</i>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<div class="text"><%= t :total_sale %></div>
|
|
||||||
<div class="number count-to" data-from="0" data-to="<%= @total_sale%>" data-speed="15" data-fresh-interval="20"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
|
||||||
<div class="info-box bg-light-green hover-expand-effect">
|
|
||||||
<div class="icon">
|
|
||||||
<i class="material-icons">person_add</i>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<div class="text"><%= t :total_credit %></div>
|
|
||||||
<div class="number count-to" data-from="0" data-to="<%= @total_credit%>" data-speed="1000" data-fresh-interval="20"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
|
||||||
<div class="info-box bg-orange hover-expand-effect">
|
|
||||||
<div class="icon">
|
|
||||||
<i class="material-icons">credit_card</i>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<div class="text"><%= t :total_card %></div>
|
|
||||||
<div class="number count-to" data-from="0" data-to="<%= @total_card%>" data-speed="1000" data-fresh-interval="20"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- #END# Widgets -->
|
|
||||||
<!-- Widgets -->
|
<!-- Widgets -->
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 qs_view">
|
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 qs_view">
|
||||||
@@ -83,6 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- #END# Widgets -->
|
<!-- #END# Widgets -->
|
||||||
|
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
|
||||||
<!-- CPU Usage -->
|
<!-- CPU Usage -->
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
|
|
||||||
@@ -230,6 +183,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -288,19 +288,39 @@
|
|||||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||||
|
|
||||||
# unless order_item.price == 0 %>
|
# unless order_item.price == 0 %>
|
||||||
<tr>
|
<% if !@assigned_order_items.nil? %>
|
||||||
<td><%= count %></td>
|
<% @assigned_order_items.each do |assigned_order_item| %>
|
||||||
<td class='item-name'>
|
<% if assigned_order_item.include? (order_item.order_items_id) %>
|
||||||
<%= order_item.item_name %>
|
<tr class="edit_order" data-id='<%= assigned_order_item[order_item.order_items_id] %>'>
|
||||||
<% if !order_item.set_menu_items.nil?
|
<td><%= count %></td>
|
||||||
order_item.set_menu_items.each do |item_instance| %>
|
<td class='item-name'>
|
||||||
<br><span class="font-13"><%= item_instance %></span>
|
<%= order_item.item_name %>
|
||||||
<% end
|
<% if !order_item.set_menu_items.nil?
|
||||||
end %>
|
order_item.set_menu_items.each do |item_instance| %>
|
||||||
</td>
|
<br><span class="font-13"><%= item_instance %></span>
|
||||||
<td class='item-attr'><%= order_item.qty %></td>
|
<% end
|
||||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
end %>
|
||||||
</tr>
|
</td>
|
||||||
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<tr>
|
||||||
|
<td><%= count %></td>
|
||||||
|
<td class='item-name'>
|
||||||
|
<%= order_item.item_name %>
|
||||||
|
<% if !order_item.set_menu_items.nil?
|
||||||
|
order_item.set_menu_items.each do |item_instance| %>
|
||||||
|
<br><span class="font-13"><%= item_instance %></span>
|
||||||
|
<% end
|
||||||
|
end %>
|
||||||
|
</td>
|
||||||
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
# end
|
# end
|
||||||
@@ -427,7 +447,6 @@
|
|||||||
<%= t("views.btn.back") %>
|
<%= t("views.btn.back") %>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||||
<% if current_login_employee.role != "waiter" %>
|
|
||||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||||
<% if @dining.status != "available" %>
|
<% if @dining.status != "available" %>
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
@@ -447,13 +466,23 @@
|
|||||||
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled> Void</button> -->
|
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled> Void</button> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
|
<% end %>
|
||||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
||||||
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
||||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||||
|
<% end %>
|
||||||
|
<% if !@split_bill.nil? %>
|
||||||
|
<% if @split_bill == '1' %>
|
||||||
|
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<!-- first bill not used in cloud -->
|
<!-- first bill not used in cloud -->
|
||||||
<% if ENV["SERVER_MODE"] == "cloud" %>
|
<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
@@ -465,13 +494,8 @@
|
|||||||
<%end%>
|
<%end%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||||
<% if !@split_bill.nil? %>
|
|
||||||
<% if @split_bill == '1' %>
|
|
||||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
|
|
||||||
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
|
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
|
||||||
@@ -509,7 +533,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -898,4 +921,13 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*edit order in oqs*/
|
||||||
|
$('.edit_order').on('click',function(){
|
||||||
|
var assigned_order_item_id = $(this).attr('data-id');
|
||||||
|
var dining_id = "<%= @dining.id %>";
|
||||||
|
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
|
||||||
|
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -125,7 +125,13 @@
|
|||||||
<% if !@individual_total[0].nil? %>
|
<% if !@individual_total[0].nil? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name">
|
<td class="charges-name">
|
||||||
<strong>Individual amount for <%= @individual_total[0]['total_customer'] %> persons</strong>
|
<strong>Split Bill for <%= @individual_total[0]['total_customer'] %> persons</strong>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name">
|
||||||
|
<strong>Amount Due (per person)</strong>
|
||||||
</td>
|
</td>
|
||||||
<td class="item-attr"><strong><span><%= number_with_precision(@individual_total[0]['per_person_amount'], precision: precision.to_i )%></span></strong></td>
|
<td class="item-attr"><strong><span><%= number_with_precision(@individual_total[0]['per_person_amount'], precision: precision.to_i )%></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -445,7 +451,7 @@ console.log("fffffffffffff")
|
|||||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
swal("Opps","You are not authorized for Discount","warning")
|
swal("Oops","You are not authorized for Discount","warning")
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@@ -461,7 +467,7 @@ console.log("fffffffffffff")
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
swal("Opps","You are not authorized for void","warning")
|
swal("Oops","You are not authorized for void","warning")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -548,23 +554,23 @@ console.log("fffffffffffff")
|
|||||||
$('#pay').click(function() {
|
$('#pay').click(function() {
|
||||||
sub_total = $('#sub-total').text();
|
sub_total = $('#sub-total').text();
|
||||||
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
|
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
|
||||||
swal("Opps","Please Pay with MPU Payment","warning");
|
swal("Oops","Please Pay with MPU Payment","warning");
|
||||||
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
|
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
|
||||||
swal("Opps","Please Pay with Redeem Payment","warning");
|
swal("Oops","Please Pay with Redeem Payment","warning");
|
||||||
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
|
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
|
||||||
swal("Opps","Please Pay with Visa Payment","warning");
|
swal("Oops","Please Pay with Visa Payment","warning");
|
||||||
|
|
||||||
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
|
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
|
||||||
swal("Opps","Please Pay with jcb Payment","warning");
|
swal("Oops","Please Pay with jcb Payment","warning");
|
||||||
}
|
}
|
||||||
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
|
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
|
||||||
swal("Opps","Please Pay with Master Payment","warning");
|
swal("Oops","Please Pay with Master Payment","warning");
|
||||||
}
|
}
|
||||||
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
|
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
|
||||||
swal("Opps","Please Pay with UNIONPAY Payment","warning");
|
swal("Oops","Please Pay with UNIONPAY Payment","warning");
|
||||||
}
|
}
|
||||||
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
|
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
|
||||||
swal("Opps","Please Pay with Credit Payment","warning");
|
swal("Oops","Please Pay with Credit Payment","warning");
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$( "#loading_wrapper").show();
|
$( "#loading_wrapper").show();
|
||||||
@@ -664,7 +670,7 @@ console.log("fffffffffffff")
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
swal("Opps","You are not authorized for void","warning")
|
swal("Oops","You are not authorized for void","warning")
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -722,7 +728,7 @@ console.log("fffffffffffff")
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
swal("Opps","You are not authorized for foc","warning")
|
swal("Oops","You are not authorized for foc","warning")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -420,6 +420,7 @@
|
|||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
|
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
|
||||||
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||||
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
||||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||||
@@ -427,6 +428,13 @@
|
|||||||
|
|
||||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
|
<% end %>
|
||||||
|
<% if !@split_bill.nil? %>
|
||||||
|
<% if @split_bill == '1' %>
|
||||||
|
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<!-- first bill not used in cloud -->
|
<!-- first bill not used in cloud -->
|
||||||
<% if ENV["SERVER_MODE"] == "cloud" %>
|
<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
@@ -437,14 +445,11 @@
|
|||||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
<%end%>
|
<%end%>
|
||||||
<% if !@split_bill.nil? %>
|
|
||||||
<% if @split_bill == '1' %>
|
|
||||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||||
|
<% end %>
|
||||||
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
|
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||||
@@ -475,7 +480,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
|
<% end %>
|
||||||
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Column Two -->
|
<!-- Column Two -->
|
||||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||||
@@ -63,7 +63,8 @@
|
|||||||
<span id="<%= sale_item.id %>_qtyErr" style="color:red;"></span>
|
<span id="<%= sale_item.id %>_qtyErr" style="color:red;"></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="p-1" width="10%">
|
<td class="p-1" width="10%">
|
||||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
|
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" onkeypress="return isNumberKey(event);"/>
|
||||||
|
<span id="<%= sale_item.id %>_priceErr" style="color:red;"></span>
|
||||||
</td>
|
</td>
|
||||||
<!-- <td class='' width="17%">
|
<!-- <td class='' width="17%">
|
||||||
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||||
@@ -168,8 +169,40 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
var qty = $('#' + sale_item_id + "_qty").val();
|
var qty = $('#' + sale_item_id + "_qty").val();
|
||||||
var price = $('#' + sale_item_id + "_price").val();
|
var price = $('#' + sale_item_id + "_price").val();
|
||||||
console.log(qty + "|" + price);
|
console.log(qty + "|" + price);
|
||||||
if(qty > 0){
|
var qty_status = true;
|
||||||
|
var price_status = true;
|
||||||
|
if((qty > 0) && (price > 0)){
|
||||||
|
qty_status = true;
|
||||||
|
price_status = true;
|
||||||
$('#' + sale_item_id + "_qtyErr").html("");
|
$('#' + sale_item_id + "_qtyErr").html("");
|
||||||
|
$('#' + sale_item_id + "_priceErr").html("");
|
||||||
|
}else if((qty > 0) && (price <= 0 || price == '')){
|
||||||
|
price_status = false;
|
||||||
|
$('#' + sale_item_id + "_qtyErr").html("");
|
||||||
|
if(price == ''){
|
||||||
|
$('#' + sale_item_id + "_priceErr").html("can't be blank");
|
||||||
|
}else{
|
||||||
|
$('#' + sale_item_id + "_price").val("");
|
||||||
|
$('#' + sale_item_id + "_priceErr").html("Price must be greater than 0");
|
||||||
|
}
|
||||||
|
}else if((qty <= 0 || qty == '') && (price > 0)){
|
||||||
|
qty_status = false;
|
||||||
|
if(qty == ''){
|
||||||
|
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||||
|
}else{
|
||||||
|
$('#' + sale_item_id + "_qty").val("");
|
||||||
|
$('#' + sale_item_id + "_qtyErr").html("Quantity must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#' + sale_item_id + "_priceErr").html("");
|
||||||
|
}else{
|
||||||
|
qty_status = false;
|
||||||
|
price_status = false;
|
||||||
|
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||||
|
$('#' + sale_item_id + "_priceErr").html("can't be blank");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(qty_status && price_status){
|
||||||
var ajax_url = "/origami/item_edit";
|
var ajax_url = "/origami/item_edit";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -184,10 +217,7 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
|
||||||
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.void').on('click', function () {
|
$('.void').on('click', function () {
|
||||||
@@ -334,4 +364,8 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
$("#"+sale_item_id+"_qty").val('1');
|
$("#"+sale_item_id+"_qty").val('1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkPrice(obj_value,sale_item_id) {
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -65,6 +65,8 @@
|
|||||||
<td style="width:60%; text-align:left">
|
<td style="width:60%; text-align:left">
|
||||||
<span id="item-order-id" class="hidden"><%=odr_item['order_id'] %></span>
|
<span id="item-order-id" class="hidden"><%=odr_item['order_id'] %></span>
|
||||||
<span id="item-account-type" class="hidden"><%=odr_item['account_id'] %></span>
|
<span id="item-account-type" class="hidden"><%=odr_item['account_id'] %></span>
|
||||||
|
<span id="item-code" class="hidden"><%=odr_item['item_code'] %></span>
|
||||||
|
<span id="item-instance-code" class="hidden"><%=odr_item['item_instance_code'] %></span>
|
||||||
<span id="item-name-price">
|
<span id="item-name-price">
|
||||||
<%=odr_item['item_name'] %>
|
<%=odr_item['item_name'] %>
|
||||||
<% if !odr_item['set_menu_items'].nil?
|
<% if !odr_item['set_menu_items'].nil?
|
||||||
@@ -132,6 +134,8 @@
|
|||||||
<td style="width:60%; text-align:left">
|
<td style="width:60%; text-align:left">
|
||||||
<span id="item-order-id" class="hidden"><%=order_item[order.order_id.to_s]['order_id'] %></span>
|
<span id="item-order-id" class="hidden"><%=order_item[order.order_id.to_s]['order_id'] %></span>
|
||||||
<span id="item-account-type" class="hidden"><%=order_item[order.order_id.to_s]['account_id'] %></span>
|
<span id="item-account-type" class="hidden"><%=order_item[order.order_id.to_s]['account_id'] %></span>
|
||||||
|
<span id="item-code" class="hidden"><%=order_item[order.order_id.to_s]['item_code'] %></span>
|
||||||
|
<span id="item-instance-code" class="hidden"><%=order_item[order.order_id.to_s]['item-instance-code'] %></span>
|
||||||
<span id="item-name-price">
|
<span id="item-name-price">
|
||||||
<%=order_item[order.order_id.to_s]['item_name'] %>
|
<%=order_item[order.order_id.to_s]['item_name'] %>
|
||||||
<% if !order_item[order.order_id.to_s]['set_menu_items'].nil?
|
<% if !order_item[order.order_id.to_s]['set_menu_items'].nil?
|
||||||
@@ -194,7 +198,9 @@
|
|||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th>Receipt No.</th>
|
<th>Receipt No.</th>
|
||||||
<th>Total</th>
|
<th>Total</th>
|
||||||
|
<% if !@current_user.nil? && @current_user.role == 'cashier' %>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
|
<% end %>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @sale_data.each_with_index do |sale_data, sale_index| %>
|
<% @sale_data.each_with_index do |sale_data, sale_index| %>
|
||||||
@@ -207,9 +213,12 @@
|
|||||||
<td><input type="radio" name="rdn_receipt" id="rdn_receipt" value="<%= sale_data.sale_id %>" <%= checked %>></td>
|
<td><input type="radio" name="rdn_receipt" id="rdn_receipt" value="<%= sale_data.sale_id %>" <%= checked %>></td>
|
||||||
<td><span id="receipt_no"><%= sale_data.receipt_no %></span></td>
|
<td><span id="receipt_no"><%= sale_data.receipt_no %></span></td>
|
||||||
<td><span id="grand_total"><%= sale_data.grand_total %></span></td>
|
<td><span id="grand_total"><%= sale_data.grand_total %></span></td>
|
||||||
|
|
||||||
|
<% if !@current_user.nil? && @current_user.role == 'cashier' %>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-block waves-effect btn-primary btn_pay" id=<%= sale_data.sale_id %> >Pay</button>
|
<button type="button" class="btn btn-block waves-effect btn-primary btn_pay" id=<%= sale_data.sale_id %> >Pay</button>
|
||||||
</td>
|
</td>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -228,7 +237,9 @@
|
|||||||
<!-- Action Panel -->
|
<!-- Action Panel -->
|
||||||
<div>
|
<div>
|
||||||
<button type="button" class="btn bg-default btn-block waves-effect" id="back" ><i class="material-icons">reply</i> Back </button>
|
<button type="button" class="btn bg-default btn-block waves-effect" id="back" ><i class="material-icons">reply</i> Back </button>
|
||||||
<button id="equal_split" class="btn btn-block waves-effect bg-blue">= Split</button>
|
<% if !@current_user.nil? && @current_user.role == 'cashier' %>
|
||||||
|
<button id="equal_split" class="btn btn-block waves-effect bg-blue">= Split</button>
|
||||||
|
<% end %>
|
||||||
<% if !@orders.empty? %>
|
<% if !@orders.empty? %>
|
||||||
<button id="order_split" class="btn btn-block waves-effect bg-blue">By Order</button>
|
<button id="order_split" class="btn btn-block waves-effect bg-blue">By Order</button>
|
||||||
<button id="order_item_split" class="btn btn-block waves-effect bg-blue">By Order Item</button>
|
<button id="order_item_split" class="btn btn-block waves-effect bg-blue">By Order Item</button>
|
||||||
@@ -689,6 +700,8 @@ function get_selected_order_items(){
|
|||||||
var order_item = {};
|
var order_item = {};
|
||||||
order_item.id = $(this).attr('id').substr(0,16);
|
order_item.id = $(this).attr('id').substr(0,16);
|
||||||
order_item.order_id = $(this).find('#item-order-id').text().trim();
|
order_item.order_id = $(this).find('#item-order-id').text().trim();
|
||||||
|
order_item.item_code = $(this).find('#item-code').text().trim();
|
||||||
|
order_item.item_instance_code = $(this).find('#item-instance-code').text().trim();
|
||||||
order_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
order_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||||
order_item.account_id = $(this).find('#item-account-type').text();
|
order_item.account_id = $(this).find('#item-account-type').text();
|
||||||
order_item.qty = $(this).find('#item-qty').text();
|
order_item.qty = $(this).find('#item-qty').text();
|
||||||
|
|||||||
@@ -1,11 +1,26 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<% if !@print_settings.nil? %>
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="col-lg-4 col-md-6 col-sm-6">
|
<div class="col-lg-4 col-md-6 col-sm-6">
|
||||||
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
|
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
|
||||||
<% @sale_array.each do |sale| %>
|
<% @sale_array.each do |sale| %>
|
||||||
<div class="card tables" data-id="<%= sale.id %>">
|
<div class="card tables receipt_block" data-id="<%= sale.id %>">
|
||||||
<% if sale.id == @sale.id %>
|
<% if sale.id == @sale.id %>
|
||||||
<div class="card-block" style="background-color:#6080f0;">
|
<div class="card-block selected-item">
|
||||||
<%= sale.receipt_no %>
|
<%= sale.receipt_no %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
@@ -15,7 +30,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-7 col-md-5 col-sm-5">
|
<div class="col-lg-7 col-md-5 col-sm-5">
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
@@ -74,7 +89,7 @@
|
|||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'><%= sale_item.product_name %></td>
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
<td class='item-attr'><%= sale_item.price %></td>
|
<td class='item-attr'><%= number_with_precision(sale_item.price, precision: precision.to_i ) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
# end
|
# end
|
||||||
@@ -93,7 +108,7 @@
|
|||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'><%= order_item.item_name %></td>
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
<td class='item-attr'><%= order_item.qty %></td>
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
<td class='item-attr'><%= number_with_precision(order_item.qty*order_item.price, precision: precision.to_i ) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
end
|
end
|
||||||
@@ -109,7 +124,7 @@
|
|||||||
<table class="table" id="order-charges-table" border="0">
|
<table class="table" id="order-charges-table" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
<td class="item-attr"><strong id="order-sub-total"><span id="sub_total"><%= number_with_precision(sub_total, precision: precision.to_i ) %></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<%if @sale.discount_type == 'member_discount'%>
|
<%if @sale.discount_type == 'member_discount'%>
|
||||||
@@ -117,19 +132,19 @@
|
|||||||
<%else%>
|
<%else%>
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
<%end%>
|
<%end%>
|
||||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
<td class="item-attr"><strong id="order-discount">(<%= number_with_precision(@sale.total_discount, precision: precision.to_i ) rescue 0%>)</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@sale.total_tax, precision: precision.to_i ) rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-round-adj"><%= number_with_precision(@sale.rounding_adjustment, precision: precision.to_i ) rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><span id="grand_total"><%= number_with_precision(@sale.grand_total, precision: precision.to_i ) rescue 0%></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rebate_amount"></tr>
|
<tr class="rebate_amount"></tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -142,7 +157,8 @@
|
|||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||||
<button type="button" id="void" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true" > Void </button>
|
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
|
||||||
|
<button type="button" id="void" class="btn bg-danger btn-block" active="<%= can? :overall_void, :void %>" > Void </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -200,13 +216,45 @@ $('#void').on('click',function () {
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
success: function () {
|
success: function () {
|
||||||
window.location.href = '/origami/';
|
window.location.href = '/origami';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
swal("Opps","You are not authorized for void","warning")
|
swal("Opps","You are not authorized for void","warning");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#foc').click(function() {
|
||||||
|
var cash = $('#grand_total').text();
|
||||||
|
var sub_total = $('#sub_total').text();
|
||||||
|
var sale_id = '';
|
||||||
|
if($('.receipt_block > div').hasClass('selected-item')){
|
||||||
|
sale_id = $('.receipt_block > div.selected-item').parent().attr('data-id');
|
||||||
|
}
|
||||||
|
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
|
||||||
|
// console.log(sale_id);
|
||||||
|
if(sale_id != ''){
|
||||||
|
if ($(this).attr('active')=== "true") {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "<%= origami_payment_foc_path %>",
|
||||||
|
data: params,
|
||||||
|
success:function(result){
|
||||||
|
if (cash >= 0) {
|
||||||
|
swal({
|
||||||
|
title: "Information!",
|
||||||
|
text: 'Thank You !',
|
||||||
|
}, function () {
|
||||||
|
window.location.href = '/origami';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
swal("Oops","You are not authorized for foc","warning")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post 'update_delivery', to: "home#update_delivery_status"
|
post 'update_delivery', to: "home#update_delivery_status"
|
||||||
|
|
||||||
# qty update
|
# qty update
|
||||||
get "/:id/edit", to: "edit#index"
|
get "/:id/edit/:type", to: "edit#index"
|
||||||
post "/:id", to: "edit#update"
|
post "/:id", to: "edit#update"
|
||||||
|
|
||||||
# Pass assigned_order_item_id
|
# Pass assigned_order_item_id
|
||||||
|
|||||||
Reference in New Issue
Block a user