Merge branch 'quick_service' of bitbucket.org:code2lab/sxrestaurant into split_bill
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
$(function() {
|
||||
|
||||
type = $('#type').val();
|
||||
modify_order = $('#modify_order').val();
|
||||
//click menu sidebar menu category
|
||||
$(".product").on("click", function(){
|
||||
var url = $(this).attr('data-ref');
|
||||
@@ -83,9 +86,17 @@ $(function() {
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_item_list(url_item){
|
||||
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
if (modify_order=="true" && type =="true") {
|
||||
url_item = '../../../addorders/'+url_item;
|
||||
}if(modify_order=="false" && type =="true"){
|
||||
url_item = 'addorders/'+url_item
|
||||
}else{
|
||||
url_item = url_item;
|
||||
}
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -112,8 +123,10 @@ $(function() {
|
||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
||||
fa_plus = '';
|
||||
add = '';
|
||||
menu_item_box = 'set_item_box';
|
||||
menu_item_box = 'add_icon';
|
||||
data_target = 'sx_item_set_detailModal';
|
||||
data_modal = 'modal'
|
||||
add_icon = "set_item_box"
|
||||
code = menu_items[field].code;
|
||||
name = menu_items[field].name;
|
||||
instances = menu_items[field].instances;
|
||||
@@ -133,6 +146,8 @@ $(function() {
|
||||
add = 'add'
|
||||
menu_item_box = 'menu_item_box';
|
||||
data_target = 'sx_item_detailModal';
|
||||
data_modal = ''
|
||||
add_icon = "add_icon"
|
||||
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default === true) {
|
||||
@@ -149,39 +164,51 @@ $(function() {
|
||||
}
|
||||
|
||||
if (menu_items[field].image) {
|
||||
image_path = menu_items[field].image;
|
||||
if (modify_order) {
|
||||
image_path = "../../"+menu_items[field].image;
|
||||
}else{
|
||||
image_path = "/image/logo.png";
|
||||
image_path = menu_items[field].image;
|
||||
}
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">'
|
||||
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
|
||||
+"<div class='col-md-3 add_icon' data-item-code='"
|
||||
+ menu_items[field].code +"' data-name='"
|
||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"'>"
|
||||
+"<i class='fa "+fa_plus+" '>"
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
}else{
|
||||
if (modify_order) {
|
||||
image_path = "../../image/logo.png";
|
||||
}else{
|
||||
image_path = "image/logo.png";
|
||||
}
|
||||
}
|
||||
|
||||
+"<div class='"+menu_item_box+"' data-item-code='"
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
|
||||
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
|
||||
+"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
|
||||
+ menu_items[field].code +"' data-instance = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"'>"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
|
||||
+"<i class='fa "+fa_plus+" '>"
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+" p-t-65 m-r--5' data-item-code='"
|
||||
+ menu_items[field].code +"' data-name='"
|
||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"' data-toggle='"
|
||||
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"'>"
|
||||
|
||||
+"<div class='card-block custom-card-block'>"
|
||||
+"<img id='logo' height='125px' src='"+image_path+"'>"
|
||||
+"</div>"
|
||||
// +"<div class='card-block custom-card-block'>"
|
||||
// +"<img id='logo' height='' src='"+image_path+"'>"
|
||||
// +"</div>"
|
||||
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
|
||||
+'<span>'+ price +'</span>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
@@ -203,9 +230,11 @@ $(function() {
|
||||
$('.set_change_qty').val(1);
|
||||
change_qty_plus_minus("set_count","set_plus","set_minus");
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
|
||||
instances = $(this).data('instance');
|
||||
// data = $(this).parent().siblings('.add_icon');
|
||||
//instances = $(this).data('instance');
|
||||
item_sets = $(this).data('item-sets');
|
||||
instances = $(this).data('instances');
|
||||
// item_sets = $(data).attr('data-item-sets');
|
||||
|
||||
for(var field in item_sets) {
|
||||
|
||||
@@ -259,11 +288,11 @@ $(function() {
|
||||
|
||||
$('#set_change_qty').val(1);
|
||||
$('#set_item_instances').text(instances);
|
||||
$('#set_name').text(data.attr('data-name'));
|
||||
$('#set_item_code').text(data.attr('data-item-code'));
|
||||
$('#set_total_price').text(data.attr('data-price'));
|
||||
$('#set_name').text($(this).attr('data-name'));
|
||||
$('#set_item_code').text($(this).attr('data-item-code'));
|
||||
$('#set_total_price').text($(this).attr('data-price'));
|
||||
// $('#set_total_price').text(0);
|
||||
$('#set_unit_price').text(data.attr('data-price'));
|
||||
$('#set_unit_price').text($(this).attr('data-price'));
|
||||
// $('#set_unit_price').text(0);
|
||||
});
|
||||
// click instance for add item set
|
||||
@@ -423,7 +452,8 @@ $(function() {
|
||||
|
||||
change_qty_plus_minus("count","plus","minus");
|
||||
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
// data = $(this).parent().children().children('.add_icon');
|
||||
data = $(this).parent().siblings('.add_icon');
|
||||
|
||||
$('#total_price').text(data.attr('data-price'));
|
||||
attributes = $(this).data('id');
|
||||
@@ -432,11 +462,21 @@ $(function() {
|
||||
item_options = $(this).data('option');
|
||||
|
||||
if (data.attr('data-image')) {
|
||||
if (modify_order) {
|
||||
image = "<img id='' width='200px' src='../../"+data.attr('data-image')+"'>";
|
||||
}else{
|
||||
image = "<img id='' width='200px' src='"+data.attr('data-image')+"'>";
|
||||
}
|
||||
|
||||
}else{
|
||||
if (modify_order) {
|
||||
image = "<img id='' width='200px' src='../../image/logo.png'>";
|
||||
}else{
|
||||
image = "<img id='' width='200px' src='/image/logo.png'>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('#modal_box_img').append(image);
|
||||
|
||||
instance_attributes = []
|
||||
@@ -708,52 +748,117 @@ $(function() {
|
||||
}
|
||||
}
|
||||
|
||||
// Pay Discount for Payment
|
||||
// Create Order
|
||||
$("#create_order").on('click', function(e){
|
||||
|
||||
$(this).attr('disabled', 'disabled');
|
||||
e.preventDefault();
|
||||
$("#oqs_loading_wrapper").show();
|
||||
|
||||
type = $('#type').val();
|
||||
if (type == 'true') {
|
||||
type = 'cashier'
|
||||
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').val();
|
||||
var customer_id = $('#customer_id').val();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var ajax_url = 'addorders/create';
|
||||
}else{
|
||||
type = 'cashier'
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').text();
|
||||
var customer_id = $('#customer_id').text();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var ajax_url = '../addorders/create';
|
||||
}
|
||||
if (!booking_id.length > 0) {
|
||||
|
||||
var params = {'order_source': "cashier", 'order_type': "dine_in",
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
}
|
||||
var table_type = $('#table_type').text();
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
var ajax_url = '../addorders/create';
|
||||
|
||||
var params = {'order_source': "cashier", 'order_type': "dine_in",
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
if (table_id.length>0) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
// $("#oqs_loading_wrapper").hide();
|
||||
// swal({
|
||||
// title: "Information !",
|
||||
// text: 'Order has been successfully created',
|
||||
// confirmButtonColor: "green",
|
||||
// confirmButtonText: "Yes!",
|
||||
// closeOnConfirm: false,
|
||||
// }, function (isConfirm) {
|
||||
// if (isConfirm) {
|
||||
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$(this).removeAttr('disabled', '');
|
||||
$("#oqs_loading_wrapper").hide();
|
||||
|
||||
swal("Opps","Please Select Table or Room","warning");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Pay Discount for Payment
|
||||
$("#create_pay_order").on('click', function(e){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
e.preventDefault();
|
||||
type = "quick_service"
|
||||
$("#oqs_loading_wrapper").show();
|
||||
console.log(modify_order)
|
||||
if (modify_order == "true") {
|
||||
console.log($('#sale_id').text())
|
||||
var ajax_url = '../../../quick_service/update_modify_order';
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').text();
|
||||
var customer_id = $('#customer_id').text();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
}else{
|
||||
var ajax_url = 'addorders/create';
|
||||
var table_type = $('#table_id').find("option:selected").data('type');
|
||||
var table_id = $('#table_id').val();
|
||||
var customer_id = $('#customer_id').val();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var sale_id = ""
|
||||
}
|
||||
|
||||
if (!booking_id.length > 0) {
|
||||
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
}
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items,'sale_id': sale_id };
|
||||
console.log(params)
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
console.log(result)
|
||||
if (result.status) {
|
||||
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -869,11 +974,21 @@ $(function() {
|
||||
$("#back").on("click", function(){
|
||||
var table_id = $('#table_id').text();
|
||||
var table_type = $('#table_type').text();
|
||||
type = $('#type').val();
|
||||
if (type == 'true') {
|
||||
var table_type = $('#table_id').find("option:selected").data('type');
|
||||
var table_id = $('#table_id').val();
|
||||
window.location.href = "/origami/dashboard"
|
||||
}else{
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').text();
|
||||
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get Selected Class
|
||||
@@ -984,6 +1099,14 @@ $(function() {
|
||||
//show menu item list when click menu category
|
||||
function show_sub_category_list(url,sub_category){
|
||||
|
||||
if (modify_order == "true" && type =="true") {
|
||||
var url = "../../../addorders/"+url;
|
||||
}if(modify_order=="false" && type =="true"){
|
||||
var url = 'addorders/'+url;
|
||||
}else{
|
||||
var url = url;
|
||||
}
|
||||
|
||||
var menu_list = $('.sub_category_list');
|
||||
menu_list.empty();
|
||||
//Start Ajax
|
||||
@@ -998,7 +1121,12 @@ $(function() {
|
||||
data = data.sub_category;
|
||||
|
||||
if (data.length>0) {
|
||||
if ((sub_category.hasClass('hidden'))) {
|
||||
$(sub_category).removeClass('hidden');
|
||||
}else{
|
||||
$(sub_category).addClass('hidden');
|
||||
}
|
||||
|
||||
for(var i in data) {
|
||||
|
||||
row = '<li class="menu_category fadeInTop animated" data-id="'+data[i].id+'">'
|
||||
|
||||
@@ -3,9 +3,11 @@ section .content{
|
||||
}
|
||||
.custom-card-head{
|
||||
height: 40px;
|
||||
background-color: #54A5AF;
|
||||
#background-color: #54A5AF;
|
||||
background-color: #a1aade;
|
||||
opacity: 0.8;
|
||||
padding:5px;
|
||||
color :#fff;
|
||||
color :#000000;
|
||||
|
||||
}
|
||||
.custom-card {
|
||||
@@ -53,8 +55,13 @@ section .content{
|
||||
|
||||
.nav-tabs .nav-item {
|
||||
border-bottom: 1px solid #fff;
|
||||
margin-left:2px;
|
||||
|
||||
}
|
||||
#ul-navbar{
|
||||
border-left: 1px solid #54A5AF;
|
||||
border-right: 1px solid #54A5AF;
|
||||
|
||||
}
|
||||
.nav > li > a{
|
||||
color:#54A5AF;
|
||||
@@ -174,3 +181,64 @@ i.logout_icon{
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.text-white{
|
||||
color: #fff;
|
||||
}
|
||||
/* Colors */
|
||||
.purple {
|
||||
background-color:#7a62d3;
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color:#FF7F50;
|
||||
}
|
||||
|
||||
.red {
|
||||
background-color:#F44336;
|
||||
}
|
||||
|
||||
.green{
|
||||
background-color: #009900;
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color: #FF8C00;
|
||||
}
|
||||
|
||||
.blue{
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
/*For Menu List*/
|
||||
.dropdown-toggle:after{
|
||||
margin-left:15px;
|
||||
}
|
||||
.my-toggle{
|
||||
padding: 15px 20px 10px 10px;
|
||||
line-height:2;
|
||||
|
||||
}
|
||||
.list-menu{
|
||||
list-style: none;
|
||||
margin-top:5px;
|
||||
background-color: #eee;
|
||||
border-bottom: 1px solid #fff;
|
||||
}
|
||||
.menu_list{
|
||||
display: block;
|
||||
background-color: #eeeeee;
|
||||
border-bottom: .214rem solid #fff;
|
||||
border-left: 1px solid #54A5AF;
|
||||
border-right: 1px solid #54A5AF;
|
||||
margin-bottom: -1px;
|
||||
margin-top: 5px
|
||||
}
|
||||
.menu_click{
|
||||
list-style: none;
|
||||
margin-left:-40px;
|
||||
border-bottom: .014rem solid #fff;
|
||||
}
|
||||
.list-menu > a:hover{
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -8,7 +8,8 @@ class BaseOrigamiController < ActionController::Base
|
||||
protect_from_forgery with: :exception
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to origami_root_path
|
||||
# redirect_to origami_root_path
|
||||
redirect_to origami_dashboard_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
|
||||
@@ -126,6 +126,12 @@ class HomeController < ApplicationController
|
||||
render :json => {:status=> "Success", :url => root_path }.to_json
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
@@ -146,7 +152,8 @@ class HomeController < ApplicationController
|
||||
#check if cashier has existing open cashier
|
||||
shift = ShiftSale.current_open_shift(employee.id)
|
||||
if !shift.nil?
|
||||
redirect_to origami_root_path
|
||||
redirect_to origami_dashboard_path
|
||||
# redirect_to origami_root_path
|
||||
else
|
||||
redirect_to new_origami_shift_path
|
||||
end
|
||||
@@ -162,4 +169,5 @@ class HomeController < ApplicationController
|
||||
redirect_to reports_dailysale_index_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -9,7 +9,10 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
end
|
||||
|
||||
def detail
|
||||
@menu = MenuCategory.all.active
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
@menus = Menu.all
|
||||
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||
@table_id = params[:id]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
@booking = @table.get_booking
|
||||
@@ -44,6 +47,18 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def get_menu()
|
||||
if (params[:id])
|
||||
puts params[:id]
|
||||
#Pull this menu
|
||||
@menu = Menu.find_by_id(params[:id])
|
||||
@menu_category = MenuCategory.where("menu_id='#{@menu.id}'").order("order_by asc")
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
Menu.current_menu
|
||||
end
|
||||
end
|
||||
|
||||
def get_menu_sub_category ()
|
||||
id = params[:id]
|
||||
@@ -102,9 +117,13 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
if !params["booking_id"].nil?
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
|
||||
if params[:table_id].to_i > 0
|
||||
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
|
||||
else
|
||||
table_status = true
|
||||
end
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||
if table_status && booking.booking_status != 'moved'
|
||||
if !booking.sale_id.nil?
|
||||
sale_status = check_order_with_booking(booking)
|
||||
if sale_status
|
||||
@@ -115,22 +134,32 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
else
|
||||
if params[:table_id].to_i > 0
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end
|
||||
end
|
||||
end #booking exists
|
||||
else
|
||||
if params[:table_id].to_i > 0
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
if sale_status
|
||||
# return false , @message = "bill requested"
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
|
||||
if @status && @booking && @order.source == 'quick_service'
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
result = {:status=> @status, :data => @sale }
|
||||
render :json => result.to_json
|
||||
end
|
||||
end
|
||||
|
||||
# render json for http status code
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
|
||||
@@ -49,9 +49,16 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
def add_customer
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
|
||||
if(@sale_id[0,3] == "SAL")
|
||||
@booking = Booking.find_by_sale_id(@sale_id)
|
||||
if @booking.dining_facility_id.to_i > 0
|
||||
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
|
||||
else
|
||||
@dining_facility = nil
|
||||
end
|
||||
|
||||
else
|
||||
@booking_order = BookingOrder.find_by_order_id(@sale_id)
|
||||
@booking = Booking.find(@booking_order.booking_id)
|
||||
|
||||
64
app/controllers/origami/dashboard_controller.rb
Normal file
64
app/controllers/origami/dashboard_controller.rb
Normal file
@@ -0,0 +1,64 @@
|
||||
class Origami::DashboardController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@shop = Shop.first
|
||||
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
# @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
# @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
|
||||
# @top_products = Sale.top_products(today).sum('i.qty')
|
||||
# @bottom_products = Sale.bottom_products(today).sum('i.qty')
|
||||
# @hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
|
||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
||||
# .sum(:grand_total)
|
||||
# @employee_sales = Sale.employee_sales(today)
|
||||
# .sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
|
||||
# @inventories = StockJournal.inventory_balances(today).sum(:balance)
|
||||
|
||||
@total_sale = Sale.total_sale(today)
|
||||
@total_count = Sale.total_count(today)
|
||||
@total_card = Sale.total_card_sale(today)
|
||||
@total_credit = Sale.credit_payment(today)
|
||||
|
||||
@sale_data = Array.new
|
||||
@total_payment_methods = Sale.total_payment_methods(today)
|
||||
|
||||
@total_payment_methods.each do |payment|
|
||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
||||
pay = Sale.payment_sale('card', today)
|
||||
@sale_data.push({'card' => pay.payment_amount})
|
||||
else
|
||||
pay = Sale.payment_sale(payment.payment_method, today)
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
end
|
||||
end
|
||||
@summ_sale = Sale.summary_sale_receipt(today)
|
||||
@total_customer = Sale.total_customer(today)
|
||||
@total_dinein = Sale.total_dinein(today)
|
||||
@total_takeaway = Sale.total_takeaway(today)
|
||||
@total_other_customer = Sale.total_other_customer(today)
|
||||
@total_membership = Sale.total_membership(today)
|
||||
|
||||
@total_order = Sale.total_order(today)
|
||||
@total_accounts = Sale.total_account(today)
|
||||
@account_data = Array.new
|
||||
@total_accounts.each do |account|
|
||||
acc = Sale.account_data(account.account_id, today)
|
||||
if !acc.nil?
|
||||
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||
end
|
||||
end
|
||||
|
||||
@top_items = Sale.top_items(today)
|
||||
@total_foc_items = Sale.total_foc_items(today)
|
||||
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
end
|
||||
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
@@ -4,9 +4,14 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
#discount page show from origami index with selected order
|
||||
def index
|
||||
sale_id = params[:id]
|
||||
@cashier_type = params[:type]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
if @sale_data.bookings[0].dining_facility_id.to_i > 0
|
||||
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
|
||||
else
|
||||
@table = nil
|
||||
end
|
||||
end
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@@ -22,8 +27,15 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
if sale.bookings[0].dining_facility_id.to_i > 0
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table = DiningFacility.find(table_id)
|
||||
else
|
||||
table = nil
|
||||
table_id = nil
|
||||
end
|
||||
|
||||
|
||||
# sale.total_discount = overall_discount.to_f
|
||||
# sale.total_amount = sub_total.to_f
|
||||
# sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
|
||||
@@ -33,7 +45,6 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
#save sale item for discount
|
||||
discount_items.each do |di|
|
||||
origin_sale_item = SaleItem.find(di["id"])
|
||||
puts origin_sale_item.to_json
|
||||
sale_item = SaleItem.new
|
||||
|
||||
sale_item.sale_id = sale_id
|
||||
@@ -54,6 +65,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
|
||||
action_by = current_user.id
|
||||
remark = "Discount Item Name ->#{sale_item.product_name}-Product Code ->#{sale_item.product_code} | Price [#{sale_item.price}] | Receipt No #{sale.receipt_no} "
|
||||
|
||||
sale_audit = SaleAudit.record_audit_discount(sale_item.sale_id,sale.cashier_id, action_by,remark,"ITEMDISCOUNT" )
|
||||
|
||||
end
|
||||
@@ -62,13 +74,26 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
# Re-calc All Amount in Sale
|
||||
if overall_discount.to_f > 0
|
||||
action_by = current_user.id
|
||||
if table.nil?
|
||||
remark = "Discount Overall Price [#{overall_discount}]| Receipt No #{sale.receipt_no} | Table- no Table "
|
||||
else
|
||||
remark = "Discount Overall Price [#{overall_discount}]| Receipt No #{sale.receipt_no} | Table- #{table.name} "
|
||||
end
|
||||
|
||||
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"OVERALLDISCOUNT" )
|
||||
end
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
|
||||
if !table.nil?
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table.type }
|
||||
else
|
||||
result = {:status=> "Success" }
|
||||
end
|
||||
else
|
||||
if !table.nil?
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table.type }
|
||||
else
|
||||
result = {:status=> "Please, Check Again!" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -81,8 +106,14 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
discount_items = JSON.parse(params[:discount_items])
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
if sale.bookings[0].dining_facility_id.to_i > 0
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table = DiningFacility.find(table_id)
|
||||
else
|
||||
table_id = nil
|
||||
table = nil
|
||||
end
|
||||
|
||||
|
||||
if discount_items.length > 0
|
||||
#destroy sale item for discount
|
||||
@@ -91,7 +122,11 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale.total_amount = (sale.total_amount + sale_item.price.abs)
|
||||
|
||||
action_by = current_user.id
|
||||
if table.nil?
|
||||
remark = "Remove Item Discount Item Name ->#{sale_item.product_name}-Product Code ->#{sale_item.product_code} | Price [#{sale_item.price}] | Receipt No #{sale.receipt_no} | Table- No Table "
|
||||
else
|
||||
remark = "Remove Item Discount Item Name ->#{sale_item.product_name}-Product Code ->#{sale_item.product_code} | Price [#{sale_item.price}] | Receipt No #{sale.receipt_no} | Table- #{table.name} "
|
||||
end
|
||||
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEITEMDISCOUNT" )
|
||||
|
||||
sale_item.destroy
|
||||
@@ -102,11 +137,21 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
# sale.save
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
|
||||
if table.nil?
|
||||
result = {:status=> "Success"}
|
||||
else
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table.type }
|
||||
end
|
||||
|
||||
else
|
||||
if table.nil?
|
||||
result = {:status=> "Please, Check Again!"}
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table.type }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
@@ -116,9 +161,16 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
|
||||
if sale.bookings[0].dining_facility_id.to_i > 0
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
dining = DiningFacility.find(table_id)
|
||||
table_type = dining.type
|
||||
table = DiningFacility.find(table_id)
|
||||
table_type = table.type
|
||||
else
|
||||
table_id = nil
|
||||
table = nil
|
||||
table_type = nil
|
||||
end
|
||||
|
||||
discount_items = []
|
||||
#destroy all discount sale item
|
||||
@@ -137,14 +189,28 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale.sale_items.destroy(discount_items)
|
||||
|
||||
action_by = current_user.id
|
||||
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{dining.name} "
|
||||
if table.nil?
|
||||
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- No Table"
|
||||
else
|
||||
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{table.name} "
|
||||
end
|
||||
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEALLDISCOUNT" )
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
|
||||
result = {:status=> "Success", :table_id => table_id, :dining => dining.name, :table_type => table_type }
|
||||
if table.nil?
|
||||
result = {:status=> "Success"}
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :dining => dining.name, :table_type => table_type }
|
||||
result = {:status=> "Success", :table_id => table_id, :dining => table.name, :table_type => table_type }
|
||||
end
|
||||
|
||||
else
|
||||
if table.nil?
|
||||
result = {:status=> "Please, Check Again!"}
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :dining => table.name, :table_type => table_type }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
render :json => result.to_json
|
||||
|
||||
@@ -2,7 +2,7 @@ class Origami::JcbController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@cashier_type = params[:type]
|
||||
# limit jcb_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
|
||||
@@ -2,7 +2,7 @@ class Origami::MasterController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@cashier_type = params[:type]
|
||||
# limit master_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Origami::MpuController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@cashier_type = params[:type]
|
||||
# limit mpu_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
|
||||
@@ -3,9 +3,15 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
if @sale_data.bookings[0].dining_facility_id.to_i > 0
|
||||
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
|
||||
else
|
||||
@table = nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,8 +22,14 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
if sale.bookings[0].dining_facility_id.to_i > 0
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table = DiningFacility.find(table_id)
|
||||
else
|
||||
table_id = nil
|
||||
table = nil
|
||||
end
|
||||
|
||||
|
||||
# sale.total_amount = sub_total.to_f
|
||||
# sale.grand_total = sub_total.to_f + sale.total_tax;
|
||||
@@ -44,7 +56,12 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
sale_item.save
|
||||
|
||||
action_by = current_user.id
|
||||
if table.nil?
|
||||
remark = "Add Other Charges - Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} |Charges ->#{di["price"]} For ->#{di["name"]}- Table ->"
|
||||
else
|
||||
remark = "Add Other Charges - Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} |Charges ->#{di["price"]} For ->#{di["name"]}- Table ->#{table.name}"
|
||||
end
|
||||
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_id, action_by,remark,"ADDOTHERCHARGES" )
|
||||
|
||||
end
|
||||
@@ -53,11 +70,13 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
|
||||
end
|
||||
|
||||
if !table.nil?
|
||||
dining = {:table_id => table_id, :table_type => table.type }
|
||||
render :json => dining.to_json
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
|
||||
@@ -2,6 +2,7 @@ class Origami::OthersPaymentsController < BaseOrigamiController
|
||||
def index
|
||||
@membership_rebate_balance = 0
|
||||
@sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
@payment_method_setting = PaymentMethodSetting.all
|
||||
|
||||
@rebate = MembershipSetting.find_by_rebate(1)
|
||||
|
||||
@@ -12,15 +12,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
else
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
end
|
||||
# if bookings.count > 1
|
||||
# # for Multiple Booking
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# else
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# end
|
||||
|
||||
if bookings[0].dining_facility_id.to_i > 0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
else
|
||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# Print for First Bill to Customer
|
||||
@@ -96,15 +102,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
else
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
end
|
||||
# if bookings.count > 1
|
||||
# # for Multiple Booking
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# else
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# end
|
||||
|
||||
if bookings[0].dining_facility_id.to_i > 0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
else
|
||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
# For Print
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
@@ -142,12 +154,20 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data,survey)
|
||||
|
||||
if params[:type] == "quick_service"
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
booking.booking_orders.each do |order|
|
||||
Order.pay_process_order_queue(order.order_id,booking.dining_facility_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
|
||||
@@ -164,6 +184,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@balance = 0.00
|
||||
@accountable_type = ''
|
||||
@table_no = ''
|
||||
@dining = ''
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
|
||||
@@ -213,10 +234,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
#end customer amount
|
||||
|
||||
@sale_data.bookings.each do |sbk|
|
||||
if sbk.dining_facility_id.to_i >0
|
||||
df = DiningFacility.find(sbk.dining_facility_id)
|
||||
@table_no = df.type + ' ' + df.name
|
||||
@checkin_time = sbk.checkin_at
|
||||
@dining = df
|
||||
break
|
||||
else
|
||||
@table_no = nil
|
||||
@checkin_time = nil
|
||||
@dining = nil
|
||||
end
|
||||
end
|
||||
|
||||
@sale_data.sale_payments.each do |spay|
|
||||
@@ -251,15 +279,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
else
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
end
|
||||
# if bookings.count > 1
|
||||
# # for Multiple Booking
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# else
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# end
|
||||
|
||||
if bookings[0].dining_facility_id.to_i > 0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
else
|
||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
unique_code = "ReceiptBillPdf"
|
||||
@@ -321,15 +355,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
# if bookings.count > 1
|
||||
# # for Multiple Booking
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# else
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# end
|
||||
if bookings[0].dining_facility_id.to_i > 0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
else
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
end
|
||||
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
else
|
||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
|
||||
# Re-call Sale Data
|
||||
saleObj = Sale.find(sale_id)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Origami::PayparPaymentsController < BaseOrigamiController
|
||||
def create
|
||||
sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
redeem_amount = params[:redeem_amount]
|
||||
membership_id = params[:membership_id]
|
||||
payment_method = "paypar"
|
||||
|
||||
26
app/controllers/origami/pending_order_controller.rb
Normal file
26
app/controllers/origami/pending_order_controller.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
class Origami::PendingOrderController < BaseOrigamiController
|
||||
def index
|
||||
# @dining= DiningFacility.where("status = 'occupied'")
|
||||
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@sale = Sale.pending_order
|
||||
end
|
||||
def show
|
||||
@sales = Sale.pending_order
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||
puts "sssssssssss"
|
||||
puts @booking
|
||||
if Booking.find(@booking).dining_facility_id.to_i > 0
|
||||
@table_id = Booking.find(@booking).dining_facility_id
|
||||
@dining = DiningFacility.find(@table_id)
|
||||
else
|
||||
@table_id = nil
|
||||
@dining = nil
|
||||
end
|
||||
end
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
221
app/controllers/origami/quick_service_controller.rb
Normal file
221
app/controllers/origami/quick_service_controller.rb
Normal file
@@ -0,0 +1,221 @@
|
||||
class Origami::QuickServiceController < ApplicationController
|
||||
# before_action :set_dining, only: [:detail]
|
||||
|
||||
def index
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
@menus = Menu.all
|
||||
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||
@zone = Zone.all
|
||||
@customer = Customer.all
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
# @tables = Table.all.active.order('zone_id asc').group("zone_id")
|
||||
# @rooms = Room.all.active.order('zone_id asc').group("zone_id")
|
||||
# @all_table = Table.all.active.order('status desc')
|
||||
# @all_room = Room.all.active.order('status desc')
|
||||
render "origami/addorders/detail"
|
||||
end
|
||||
|
||||
def modify_order
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
@menus = Menu.all
|
||||
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||
if(params[:id][0,3] == "BKI")
|
||||
@table_id = nil
|
||||
@table = nil
|
||||
@booking = Booking.find(params[:id])
|
||||
else
|
||||
@table_id = params[:id]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
@booking = @table.get_booking
|
||||
end
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
if @booking
|
||||
@booking_id = @booking.booking_id
|
||||
@order_items = Array.new
|
||||
@booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
if (order.status == "new")
|
||||
@obj_order = order
|
||||
@customer = order.customer
|
||||
@date = order.created_at
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@booking = nil
|
||||
end
|
||||
render "origami/addorders/detail"
|
||||
end
|
||||
|
||||
def update_modify_order
|
||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
||||
is_extra_time = false
|
||||
extra_time = ''
|
||||
|
||||
items_arr = []
|
||||
JSON.parse(params[:order_items]).each { |i|
|
||||
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
|
||||
if i["item_instance_code"].include? "ext"
|
||||
is_extra_time = true
|
||||
arr_exts = i["item_instance_code"].split("_")
|
||||
if arr_exts[1].match(/^(\d)+$/)
|
||||
time = arr_exts[1].to_i*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
if i["parent_order_item_id"]
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]}
|
||||
else
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
@order.items = items_arr
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
|
||||
#Create Table Booking or Room Booking
|
||||
if !params["booking_id"].nil?
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if params[:table_id].to_i > 0
|
||||
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
|
||||
else
|
||||
table_status = true
|
||||
end
|
||||
if booking
|
||||
if table_status && booking.booking_status != 'moved'
|
||||
if !booking.sale_id.nil?
|
||||
sale_status = check_order_with_booking(booking)
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
else
|
||||
if params[:table_id].to_i > 0
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end
|
||||
end
|
||||
end #booking exists
|
||||
else
|
||||
if params[:table_id].to_i > 0
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
if sale_status
|
||||
# return false , @message = "bill requested"
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
|
||||
if @status && @booking && @order.source == 'quick_service'
|
||||
if params[:sale_id]
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
if @order.table_id.to_i > 0
|
||||
@table_id = @order.table_id
|
||||
else
|
||||
@table_id = nil
|
||||
end
|
||||
update = Sale.add_to_existing_pending_invoice(@table_id,params[:sale_id],@booking)
|
||||
end
|
||||
|
||||
result = {:status=> true, :data => @sale }
|
||||
render :json => result.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def get_menu_category ()
|
||||
if (params[:id])
|
||||
puts params[:id]
|
||||
#Pull this menu
|
||||
@menu = MenuCategory.find_by_id(params[:id])
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
MenuCategory.current_menu
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_menu_sub_category ()
|
||||
id = params[:id]
|
||||
if (id)
|
||||
#Pull this menu
|
||||
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @sub_menu
|
||||
end
|
||||
end
|
||||
|
||||
def get_all_product()
|
||||
@product = Product.all
|
||||
end
|
||||
|
||||
# render json for http status code
|
||||
def return_json_status_with_code(code, msg)
|
||||
render status: code, json: {
|
||||
message: msg,
|
||||
booking_id: booking_id
|
||||
}.to_json
|
||||
end
|
||||
|
||||
def check_order_with_table(table_id)
|
||||
table = DiningFacility.find(table_id)
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
# puts booking
|
||||
if booking
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||
@order.new_booking = true
|
||||
return false
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = booking.booking_id
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# this can always true
|
||||
def check_order_with_booking(booking)
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||
@order.new_booking = true
|
||||
return false
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -2,6 +2,7 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
payment_method = params[:payment_method]
|
||||
@cashier_type = params[:type]
|
||||
@membership_rebate_balance=0
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
|
||||
|
||||
@@ -3,7 +3,13 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
# Index for sale item void OR edit
|
||||
def edit
|
||||
sale_id = params[:sale_id]
|
||||
if params[:table_id]
|
||||
@table_id = params[:table_id]
|
||||
else
|
||||
@table_id = nil
|
||||
end
|
||||
|
||||
@cashier_type = params[:type]
|
||||
@saleobj = Sale.find(sale_id)
|
||||
end
|
||||
|
||||
|
||||
@@ -7,8 +7,13 @@ class Origami::SalesController < BaseOrigamiController
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||
if Booking.find(@booking).dining_facility_id.to_i>0
|
||||
@table_id = Booking.find(@booking).dining_facility_id
|
||||
@dining = DiningFacility.find(@table_id)
|
||||
else
|
||||
@table_id = nil
|
||||
@dining = nil
|
||||
end
|
||||
end
|
||||
|
||||
def add_to_existing_invoice
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
class Origami::SurveysController < BaseOrigamiController
|
||||
def new
|
||||
@survey = Survey.new()
|
||||
|
||||
@survey = Survey.new
|
||||
@id = params[:id]
|
||||
@cashier_type = params[:type]
|
||||
|
||||
|
||||
if(@id[0,3] == "SAL")
|
||||
@sale = Sale.find(@id)
|
||||
@receipt_no = @sale.receipt_no
|
||||
@grand_total = @sale.grand_total
|
||||
@booking = Booking.find_by_sale_id(@id)
|
||||
|
||||
if @booking.dining_facility_id.to_i>0
|
||||
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
|
||||
@table_type = @dining_facility.type
|
||||
@survey_data = Survey.find_by_dining_name(@dining_facility.name)
|
||||
@@ -15,6 +20,11 @@ class Origami::SurveysController < BaseOrigamiController
|
||||
if !survey_process.nil?
|
||||
@survey_data = survey_process
|
||||
end
|
||||
else
|
||||
@dining_facility = nil
|
||||
@table_type = nil
|
||||
end
|
||||
|
||||
else
|
||||
@dining_facility = DiningFacility.find(@id)
|
||||
@table_type = @dining_facility.type
|
||||
@@ -25,10 +35,25 @@ class Origami::SurveysController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def create
|
||||
@type = params[:cashier_type]
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
if params[:table_id].to_i>0
|
||||
@dining_facility = DiningFacility.find(params[:table_id])
|
||||
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(@dining_facility.zone_id)
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
else
|
||||
sale = Sale.find(@sale_id)
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(shift.cashier_terminal_id,nil)
|
||||
end
|
||||
|
||||
if @type == "quick_service"
|
||||
@url = "/origami/sale/"+@sale_id+"/"+@type+"/payment"
|
||||
else
|
||||
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
|
||||
end
|
||||
|
||||
|
||||
if params[:survey_id].nil? || params[:survey_id] == ""
|
||||
@survey = Survey.new(survey_params)
|
||||
@@ -61,15 +86,34 @@ class Origami::SurveysController < BaseOrigamiController
|
||||
|
||||
def create_survey
|
||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
@type = params[:cashier_type]
|
||||
@sale_id = params[:sale_id]
|
||||
sale = Sale.find(@sale_id)
|
||||
|
||||
if @type != "quick_service"
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
cashier_zone = cashier_zone.cashier_terminal_id
|
||||
else
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_zone = shift.cashier_terminal_id
|
||||
end
|
||||
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_terminal_id,nil)
|
||||
|
||||
if @type != "quick_service"
|
||||
survey = Survey.find_by_dining_name(dining_facility.name)
|
||||
else
|
||||
survey = nil
|
||||
end
|
||||
|
||||
|
||||
if survey.nil?
|
||||
survey = Survey.new
|
||||
if @type != "quick_service"
|
||||
survey.dining_name = dining_facility.name
|
||||
end
|
||||
|
||||
survey.receipt_no = params[:receipt_no]
|
||||
survey.shift_id = shift_by_terminal.id
|
||||
survey.created_by = current_user.name
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Origami::UnionpayController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@cashier_type = params[:type]
|
||||
# limit unionpay_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@@ -23,8 +23,6 @@ class Origami::UnionpayController < BaseOrigamiController
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
puts "unionpaycount"
|
||||
puts @unionpaycount
|
||||
@can_unionpay = total - @unionpaycount - others
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Origami::VisaController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
@cashier_type = params[:type]
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
|
||||
@@ -41,6 +41,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
# end
|
||||
# end
|
||||
|
||||
if sale.bookings[0].dining_facility_id.to_i > 0
|
||||
table_avaliable = true
|
||||
table_count = 0
|
||||
table = sale.bookings[0].dining_facility
|
||||
@@ -64,10 +65,17 @@ class Origami::VoidController < BaseOrigamiController
|
||||
table.status = 'available'
|
||||
table.save
|
||||
end
|
||||
else
|
||||
table = nil
|
||||
end
|
||||
|
||||
# FOr Sale Audit
|
||||
action_by = current_user.id
|
||||
if table.nil?
|
||||
remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table -> nil"
|
||||
else
|
||||
remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||
end
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
|
||||
|
||||
# For Print
|
||||
@@ -80,13 +88,21 @@ class Origami::VoidController < BaseOrigamiController
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
else
|
||||
if bookings[0].dining_facility_id.to_i>0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
if bookings[0].dining_facility_id.to_i > 0
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
else
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
unique_code = "ReceiptBillPdf"
|
||||
|
||||
@@ -165,4 +165,5 @@ class DiningFacility < ApplicationRecord
|
||||
ActionCable.server.broadcast "checkin_channel",table: table
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class Menu < ApplicationRecord
|
||||
validates_presence_of :name, :valid_days, :valid_time_from, :valid_time_to
|
||||
# validates_format_of :valid_days, :with => /\A([0-7]{1}(,[0-7]{1})*)?\Z/i
|
||||
#Default Scope to pull the active version only
|
||||
default_scope { where(is_active: true).order("created_at desc") }
|
||||
default_scope { where(is_active: true).order("created_at asc") }
|
||||
|
||||
def self.current_menu
|
||||
today = DateTime.now
|
||||
|
||||
@@ -23,25 +23,31 @@ class Order < ApplicationRecord
|
||||
|
||||
def generate
|
||||
booking = nil
|
||||
|
||||
if self.new_booking
|
||||
if self.table_id.to_i > 0
|
||||
table_id = self.table_id
|
||||
else
|
||||
table_id = nil
|
||||
end
|
||||
#add extra time
|
||||
if self.is_extra_time && self.extra_time
|
||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||
booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i,
|
||||
:checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
else
|
||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||
booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
end
|
||||
#end extra time
|
||||
|
||||
|
||||
if self.table_id.to_i > 0
|
||||
table = DiningFacility.find(self.table_id)
|
||||
table.status = "occupied"
|
||||
table.save
|
||||
end
|
||||
|
||||
else
|
||||
booking = Booking.find(self.booking_id)
|
||||
#add extra time
|
||||
@@ -65,7 +71,9 @@ class Order < ApplicationRecord
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
||||
|
||||
#Send order to queue one it done!
|
||||
if self.source != "quick_service"
|
||||
process_order_queue
|
||||
end
|
||||
|
||||
#send order to broadcast job
|
||||
send_order_broadcast(booking)
|
||||
@@ -100,7 +108,9 @@ class Order < ApplicationRecord
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
||||
|
||||
#Send order to queue one it done!
|
||||
if self.source != "quick_service"
|
||||
process_order_queue
|
||||
end
|
||||
|
||||
#send order to broadcast job
|
||||
send_order_broadcast(booking)
|
||||
@@ -203,8 +213,6 @@ class Order < ApplicationRecord
|
||||
def re_order_items(form_items) #reorder inputs items as parents and child
|
||||
parent_id = Array.new
|
||||
parents = Array.new
|
||||
puts form_items
|
||||
puts "hhhhh"
|
||||
parents_and_children_items = Array.new
|
||||
|
||||
new_items_list = Array.new
|
||||
@@ -300,6 +308,12 @@ class Order < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
#Process order items and send to order queue
|
||||
def self.pay_process_order_queue(id,table_id)
|
||||
#Send to background job for processing
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
end
|
||||
|
||||
def check_cup_status(status)
|
||||
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
|
||||
return true
|
||||
@@ -309,12 +323,14 @@ class Order < ApplicationRecord
|
||||
|
||||
#send order items and send to order queue
|
||||
def send_order_broadcast(booking)
|
||||
if self.table_id.to_i > 0
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
type = 'order'
|
||||
#Send to background job for processing
|
||||
# OrderBroadcastJob.perform_later(table,type)
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type
|
||||
end
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view order Table
|
||||
def self.get_order_table
|
||||
|
||||
@@ -1225,6 +1225,83 @@ end
|
||||
return query
|
||||
end
|
||||
|
||||
def self.add_to_existing_pending_invoice(dining,sale_id,booking)
|
||||
|
||||
existing_booking = Booking.find_by_sale_id(sale_id)
|
||||
if dining.to_i > 0
|
||||
table = DiningFacility.find(dining)
|
||||
table.bookings.each do |booking|
|
||||
# if !booking.checkout_at.nil?
|
||||
# existing_booking.update_attributes(checkout_at: checkout_at)
|
||||
# end
|
||||
if booking.sale_id.nil?
|
||||
booking.booking_orders.each do |booking_order|
|
||||
|
||||
booking.booking_status = 'moved'
|
||||
order = Order.find(booking_order.order_id)
|
||||
order.status = 'billed'
|
||||
order.order_items.each do |item|
|
||||
item.order_item_status = 'billed'
|
||||
end
|
||||
# create sale item
|
||||
saleobj = Sale.find(sale_id)
|
||||
order.order_items.each do |orer_item|
|
||||
saleobj.add_item (orer_item)
|
||||
end
|
||||
|
||||
# Re-compute for add
|
||||
saleobj.compute
|
||||
saleobj.save
|
||||
order.save
|
||||
booking.save
|
||||
end
|
||||
|
||||
booking_order = BookingOrder.where('booking_id=?',booking)
|
||||
booking_order.each do |bo|
|
||||
bo.booking_id = existing_booking.booking_id
|
||||
bo.save
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if booking.sale_id.nil?
|
||||
booking.booking_orders.each do |booking_order|
|
||||
|
||||
booking.booking_status = 'moved'
|
||||
order = Order.find(booking_order.order_id)
|
||||
order.status = 'billed'
|
||||
order.order_items.each do |item|
|
||||
item.order_item_status = 'billed'
|
||||
end
|
||||
# create sale item
|
||||
saleobj = Sale.find(sale_id)
|
||||
order.order_items.each do |orer_item|
|
||||
saleobj.add_item (orer_item)
|
||||
end
|
||||
|
||||
# Re-compute for add
|
||||
saleobj.compute
|
||||
saleobj.save
|
||||
order.save
|
||||
booking.save
|
||||
end
|
||||
|
||||
booking_order = BookingOrder.where('booking_id=?',booking)
|
||||
booking_order.each do |bo|
|
||||
bo.booking_id = existing_booking.booking_id
|
||||
bo.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.pending_order
|
||||
query = Sale.all
|
||||
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
|
||||
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
|
||||
query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
@@ -385,6 +385,7 @@ class SalePayment < ApplicationRecord
|
||||
sale_count = 0
|
||||
booking = Booking.find_by_sale_id(sale_obj.id)
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i > 0
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
bookings = table.bookings
|
||||
bookings.each do |tablebooking|
|
||||
@@ -413,6 +414,7 @@ class SalePayment < ApplicationRecord
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def rebat(sObj)
|
||||
rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
||||
|
||||
@@ -110,9 +110,12 @@ class ReceiptBillPdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||
text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
if sale_data.bookings[0].dining_facility_id.to_i > 0
|
||||
bounding_box([self.description_width - 2,y_position], :width => self.price_num_width, :height => self.item_height) do
|
||||
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
y_position = cursor
|
||||
@@ -125,8 +128,14 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
y_position = cursor
|
||||
if sale_data.bookings[0].dining_facility_id.to_i > 0
|
||||
time =sale_data.receipt_date.strftime('%d-%m-%Y') +"("+ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') +"-"+ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p')+")"
|
||||
else
|
||||
time = time = sale_data.receipt_date.strftime('%d-%m-%Y %H:%M %p')
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
|
||||
text "Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
|
||||
text "Date : #{ time }",:size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<% end %>
|
||||
<% if can? :index, :home %>
|
||||
<li>
|
||||
<a href="<%= origami_root_path %>">
|
||||
<a href="<%= origami_dashboard_path %>">
|
||||
<i class="material-icons">monetization_on</i>
|
||||
<span><%= t :origami %></span>
|
||||
</a>
|
||||
|
||||
@@ -1,15 +1,61 @@
|
||||
|
||||
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
|
||||
<% type = request.path_info.include?('quick_service')%>
|
||||
<% modify_order = request.path_info.include?('modify_order')%>
|
||||
<input type="hidden" name="type" id="type" value="<%=type%>">
|
||||
<input type="hidden" name="type" id="modify_order" value="<%=modify_order%>">
|
||||
<div class="row m-t--20">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<ul class="nav nav-tabs flex-column" role="tablist" >
|
||||
<!-- <a href="javascript:void(0);" class="dropdown-toggle waves-block p-t-15 p-l-15 p-b-15" data-toggle="dropdown" aria-haspopup="" aria-expanded="true" style="background-color: #eeeeee;border-bottom: .214rem solid #fff;border-left: 1px solid #54A5AF;
|
||||
border-right: 1px solid #54A5AF;">
|
||||
<span class="main_menu" id="main_menu" ><%= @menus[0].name %></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu menu_list" style="width:90%">
|
||||
<% @menus.each do |menu| %>
|
||||
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab"><%=menu.name%></a>
|
||||
</li>
|
||||
<%end%>
|
||||
</ul> -->
|
||||
<li class="list-menu">
|
||||
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
|
||||
|
||||
<span class="main_menu" id="main_menu" ><%= @menus[0].name %></span>
|
||||
<!-- <i class="material-icons material-icons m-l-50 p-r-30">arrow_drop_down</i> -->
|
||||
</a>
|
||||
<ul class="ml-menu menu_list aria-hidden " style="">
|
||||
<% @menus.each do |menu| %>
|
||||
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>" style="">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab" style="text-transform: lowercase;"><%=menu.name%></a>
|
||||
</li>
|
||||
<%end%>
|
||||
</ul>
|
||||
</li>
|
||||
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
|
||||
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
|
||||
</li>
|
||||
<% @menu.each do |menu| %>
|
||||
<% if !menu.valid_time.nil? %>
|
||||
<% if menu.menu_category_id.nil? %>
|
||||
<!--if type quick_service or cashier for table -->
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
</ul>
|
||||
</a>
|
||||
</li>
|
||||
<% end%>
|
||||
<!-- else quick_service or cashier for table -->
|
||||
<% else %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
||||
@@ -29,42 +75,120 @@
|
||||
</a>
|
||||
</li>
|
||||
<% end%>
|
||||
<!-- end quick_service or cashier for table -->
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<%end %>
|
||||
|
||||
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10">
|
||||
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 10px;">
|
||||
<!-- append data -->
|
||||
<% @menu.each do |menu| %>
|
||||
<% if !menu.valid_time.nil? %>
|
||||
<% if menu.menu_category_id.nil? %>
|
||||
<!--if type quick_service or cashier for table -->
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- else quick_service or cashier for table -->
|
||||
<% else %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- end quick_service or cashier for table -->
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
|
||||
<% if type && modify_order%>
|
||||
<button type="button" class="btn btn-lg btn-default waves-effect col-md-4" id='back'>
|
||||
<!-- <i class="material-icons">reply</i> -->
|
||||
Back
|
||||
</button>
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-7" id='pending_order'>Pending Order
|
||||
</button>
|
||||
<%elsif !modify_order && type%>
|
||||
<button type="button" class="btn btn-lg btn-default waves-effect col-md-2" id='back' style=" padding: .5rem 0.15rem !important;">
|
||||
<!-- <i class="material-icons">reply</i> -->
|
||||
Back
|
||||
</button>
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
||||
</button>
|
||||
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
|
||||
<input type="hidden" name="table_id" value="" id="table_id">
|
||||
|
||||
<%else%>
|
||||
<button type="button" class="btn btn-lg btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>Back
|
||||
</button>
|
||||
<%end%>
|
||||
<br>
|
||||
<div class="card-header">
|
||||
<div class="card-header" style="padding: 0.5rem 0.25rem">
|
||||
<% if type %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-md-6 col-lg-6 col-sm-12">
|
||||
<strong id="order-title" class="font-14">ORDER DETAILS </strong>
|
||||
</div>
|
||||
|
||||
<% if modify_order %>
|
||||
<% if @table.nil? %>
|
||||
<div class="col-md-6 col-lg-6 col-sm-6">Table : </div>
|
||||
<p class="hidden" id="table_id"><%=@table_id%></p>
|
||||
<p class="hidden" id="table_type"></p>
|
||||
<% else%>
|
||||
<div class="col-md-6 col-lg-6 col-sm-6">Table : <%=@table.name%></div>
|
||||
<p class="hidden" id="table_id"><%=@table_id%></p>
|
||||
<p class="hidden" id="table_type"><%=@table.type%></p>
|
||||
<% end%>
|
||||
|
||||
<p class="hidden" id="booking_id"><%=@booking_id%></p>
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
|
||||
<p class="hidden" id="sale_id"><%=@sale_id%></p>
|
||||
<% else%>
|
||||
<p class="hidden" id="table_type"></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<div>
|
||||
<strong id="order-title" class="font-14">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span>
|
||||
<p class="hidden" id="table_id"><%=@table_id%></p>
|
||||
<p class="hidden" id="table_type"><%=@table.type%></p>
|
||||
<p class="hidden" id="booking_id"><%=@booking_id%></p>
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-text" style="max-height:550px; overflow:auto"">
|
||||
<table class="table table-striped summary-items">
|
||||
<div class="card-text" id="order-detail-slimscroll" data-height="180">
|
||||
<table class="table table-striped summary-items" id="order-items-table" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
@@ -73,19 +197,33 @@
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="font-13">
|
||||
<tbody class="font-13" >
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer custom-card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
|
||||
|
||||
<!-- <table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-primary btn-block create" id="create_order" disabled="disabled">Create Order</button>
|
||||
</table> -->
|
||||
<% if type && modify_order%>
|
||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||
|
||||
<button type="button" class="btn btn-primary btn-lg create col-md-10" id="create_pay_order" disabled="disabled">Update Order & Pay</button>
|
||||
<%elsif !modify_order && type%>
|
||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||
|
||||
<button type="button" class="btn btn-primary btn-lg create col-md-6" id="create_pay_order" disabled="disabled">Create & Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-lg create col-md-5" id="create_order" disabled="disabled">Create Order</button>
|
||||
<%else%>
|
||||
<button type="button" class="btn btn-primary btn-lg create col-md-10" id="create_order" disabled="disabled">Create Order</button>
|
||||
<%end%>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -180,7 +318,6 @@
|
||||
<div class="col-md-7 item-detail">
|
||||
<h5>Attributes</h5>
|
||||
<div class="attributes-list">
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
<h5>Options</h5>
|
||||
@@ -194,11 +331,7 @@
|
||||
<div class="mr-auto">
|
||||
<h4 class=" pull-left">Total : <span id="total_price"></span></h4>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<button type="button" class="btn btn-default " data-dismiss="modal" id="close">Close</button>
|
||||
</div>
|
||||
@@ -281,4 +414,147 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if type && !modify_order%>
|
||||
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="margin-top: -1rem;">
|
||||
<!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> -->
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
|
||||
<%@zone.each do |zone| %>
|
||||
<h5>Zone : <%=zone.name%></h5>
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<%zone.tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(".tables").on('click', function () {
|
||||
$('.tables').css('background-color','');
|
||||
$('.tables').removeClass('purple')
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var type = $(this).attr("data-type");
|
||||
$(this).css('background-color','purple');
|
||||
$(this).addClass('purple')
|
||||
$('.confirm_table').attr("data-id",dining_id)
|
||||
$('.confirm_table').attr("data-name",name)
|
||||
$('.confirm_table').attr("data-type",type)
|
||||
|
||||
});
|
||||
$(".confirm_table").on('click', function () {
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var type = $(this).attr("data-type");
|
||||
$('#table_id').val(dining_id)
|
||||
$('#table_type').text(type)
|
||||
$('.select_table').text(name)
|
||||
|
||||
console.log(type)
|
||||
|
||||
});
|
||||
|
||||
$('#pending_order').on('click', function () {
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
});
|
||||
|
||||
$(document).on('click', '.menu_click', function(event){
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var url = "get_menu/"+menu_id;
|
||||
show_menu_cat_list(name, url);
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_cat_list(name, url_item){
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
var menu_cat = $('.category_list');
|
||||
menu_cat.empty();
|
||||
|
||||
$(".main_menu").text(name)
|
||||
if (modify_order=="true" && type =="true") {
|
||||
url_item = '../../../addorders/'+url_item;
|
||||
}if(modify_order=="false" && type =="true"){
|
||||
url_item = 'addorders/'+url_item
|
||||
}else{
|
||||
url_item = url_item;
|
||||
}
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url_item,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
||||
for(var i in data) {
|
||||
if (data[i].is_available == true) {
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
|
||||
+' <div class="card-block custom-card-block">'
|
||||
+' <p>'+ data[i].name +'<p>'
|
||||
+' <p>'+ data[i].code +' <p>'
|
||||
+' </div>'
|
||||
+' </div>';
|
||||
$('.menu_items_list').append(row);
|
||||
|
||||
list = '<li class="nav-item menu_category sub_click" data-id="'+ data[i].id +'">'
|
||||
+'<p class="hidden menu-id">'+ data[i].id +'</p> '
|
||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab"> '+ data[i].name +''
|
||||
+'<ul class=" sub_category_list hidden fadeInTop animated"'
|
||||
+'id="sub_category_list">'
|
||||
+'</ul>'
|
||||
+'</a>'
|
||||
+'</li>';
|
||||
$('.category_list').append(list);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
//end show list function
|
||||
});
|
||||
</script>
|
||||
1
app/views/origami/addorders/get_menu.json.jbuilder
Normal file
1
app/views/origami/addorders/get_menu.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @menu_category
|
||||
@@ -111,10 +111,11 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 m-t-10">
|
||||
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span id="cashier_type" class="hidden"><%=@cashier_type%></span>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
@@ -122,6 +123,7 @@
|
||||
$('#validamount').attr("value",parseFloat("<%= @can_credit %>") - parseFloat(localStorage.getItem("cash")));
|
||||
}
|
||||
});
|
||||
cashier_type = $('#cashier_type').text();
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
@@ -165,6 +167,7 @@
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#credit_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
@@ -184,7 +187,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+ cashier_type + "/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
|
||||
|
||||
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
|
||||
<!-- <input type="hidden" name="type" id="type" value="<%= @dining_facility.type %>"> -->
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
|
||||
@@ -115,8 +114,13 @@
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<%if !@dining_facility.nil?%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||
<%else%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="" />
|
||||
<input type="hidden" id="type" name="type" value="" />
|
||||
<%end%>
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
<div class="form-group">
|
||||
@@ -258,6 +262,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(function() {
|
||||
/*$('.datepicker').datepicker({
|
||||
setDate: '12-12-1999',
|
||||
@@ -416,6 +421,7 @@
|
||||
if(customer_name != ""){
|
||||
customer = '(' + customer_name + ')';
|
||||
}
|
||||
|
||||
swal({
|
||||
title: "Confirmation !",
|
||||
text: 'Are You Sure to assign this customer' + customer + '!',
|
||||
@@ -435,11 +441,15 @@
|
||||
{
|
||||
var id = $("#table_id").val();
|
||||
var type = $("#type").val();
|
||||
if (cashier_type == "quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if (type=="Table") {
|
||||
window.location.href = '/origami/table/'+id
|
||||
}else{
|
||||
window.location.href = '/origami/room/'+id
|
||||
}
|
||||
}
|
||||
}else{
|
||||
swal("Alert!", "Record not found!", "error");
|
||||
location.reload();
|
||||
@@ -452,11 +462,17 @@
|
||||
$('#back').on('click',function(){
|
||||
var id = $("#table_id").val()
|
||||
var type = $("#type").val()
|
||||
var sale_id = $("#sale_id").val()
|
||||
if (cashier_type == "quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if (type=="Table") {
|
||||
window.location.href = '/origami/table/'+id
|
||||
}else{
|
||||
window.location.href = '/origami/room/'+id
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
245
app/views/origami/dashboard/index.html.erb
Normal file
245
app/views/origami/dashboard/index.html.erb
Normal file
@@ -0,0 +1,245 @@
|
||||
<div class="container-fluid">
|
||||
<div class="block-header">
|
||||
<h2><%= t :dashboard %></h2>
|
||||
</div>
|
||||
<% 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
|
||||
%>
|
||||
<!-- 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 -->
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 qs_view">
|
||||
<div class="info-box bg-purple">
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;">Quick Service</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
|
||||
<div class="info-box bg-green">
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;">Cashier</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<!-- CPU Usage -->
|
||||
<div class="row clearfix">
|
||||
|
||||
<% if !@summ_sale.nil? %>
|
||||
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h6><%= t :sale %></h6>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.receipt") %> : </td>
|
||||
<td align="right"><%= @summ_sale.total_receipt %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t :sale %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table">
|
||||
<% if !(@total_payment_methods.nil?) %>
|
||||
<% @total_payment_methods.each do |payment| %>
|
||||
<% if !@sale_data[0].empty? %>
|
||||
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
|
||||
<tr>
|
||||
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<% pay_mth = payment.payment_method %>
|
||||
<%= data[""+pay_mth+""] %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
|
||||
<% if !total_card.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.card_sale") %> : </td>
|
||||
<td align="right">
|
||||
<%= total_card["card"].to_f %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h6><%= t :customer %></h6>
|
||||
<table class="table">
|
||||
<% if !@total_customer.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t :customer %> : </td>
|
||||
<td align="right"><%= @total_customer %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_dinein.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.dine_in") %> : </td>
|
||||
<td align="right"><%= @total_dinein.total_dinein_cus %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_takeaway.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.takeaway") %> : </td>
|
||||
<td align="right"><%= @total_takeaway.total_take_cus %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_other_customer.nil? %>
|
||||
<tr>
|
||||
<td><%= t :customer %> : </td>
|
||||
<td align="right"><%= @total_other_customer.total_cus %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_membership.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.membership") %> : </td>
|
||||
<td align="right"><%= @total_membership.total_memb_cus %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h6><%= t("views.right_panel.detail.order") %></h6>
|
||||
<table class="table">
|
||||
<% if !@total_order.nil? %>
|
||||
<tr>
|
||||
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.order") %> : </td>
|
||||
<td align="right" width="60px"><%= @total_order.total_order %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% if !@total_accounts.nil? %>
|
||||
<% @total_accounts.each do |account| %>
|
||||
<tr>
|
||||
<td width="40px"><%= account.title %> (Account) : </td>
|
||||
<td align="right" width="60px">
|
||||
<% @account_data.each do |data| %>
|
||||
<% acc = account.title %>
|
||||
<%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !@top_items.nil? %>
|
||||
<tr>
|
||||
<td width="40px"><%= t :top %> <%= t("views.right_panel.detail.item") %> : </td>
|
||||
<td align="right" width="60px"><%= @top_items.item_name %>
|
||||
<br>(<%= @top_items.item_total_price %>)</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_foc_items.nil? %>
|
||||
<tr>
|
||||
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : </td>
|
||||
<td align="right" width="60px"><%= @total_foc_items.to_int %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$(".cashier_view").on('click', function() {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
|
||||
$(".qs_view").on('click', function() {
|
||||
window.location.href = '/origami/quick_service';
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -13,8 +13,14 @@
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<%if !@table.nil?%>
|
||||
<span class="hidden" id ="table_id" value="<%=@table.id%>"><%=@table.id%></span>
|
||||
<span class="hidden" id="table_type" value="<%=@table.type%>"><%=@table.type%></span>
|
||||
<%else%>
|
||||
<span class="hidden" id ="table_id" value="<%=@table%>"><%=@table%></span>
|
||||
<span class="hidden" id="table_type" value="<%=@table%>"><%=@table%></span>
|
||||
<%end%>
|
||||
|
||||
<p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p>
|
||||
<p class="m-l-10">Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p>
|
||||
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
|
||||
@@ -225,18 +231,22 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#back').on('click',function(){
|
||||
var id = $("#table_id").text();
|
||||
var type = $("#table_type").text();
|
||||
console.log(id);
|
||||
console.log(type);
|
||||
var sale_id = $('#sale-id').text();
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if (type=="Table") {
|
||||
window.location.href = '/origami/table/'+id
|
||||
}else{
|
||||
window.location.href = '/origami/room/'+id
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$(".cashier_number").on('click', function(event){
|
||||
@@ -404,12 +414,16 @@
|
||||
title: "Information!",
|
||||
text: result.status,
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -451,12 +465,16 @@
|
||||
text: result.status,
|
||||
type: "success",
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -474,12 +492,16 @@
|
||||
text: result.status,
|
||||
type: "success",
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -519,12 +541,16 @@
|
||||
confirmButtonText: 'OK',
|
||||
confirmButtonColor: btn_color,
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -118,9 +118,13 @@
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <button id="refreshbutton" type="button" class="btn btn-block radius-btn"> Refresh off </button> -->
|
||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<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" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<!-- <button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||
</button> -->
|
||||
<%end%>
|
||||
<%if current_login_employee.role != "waiter" %>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
@@ -242,7 +246,7 @@ $('#close_cashier').on('click',function(e){
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/dashboard';
|
||||
window.location.href = '/origami/dashboard';
|
||||
})
|
||||
|
||||
function warnBeforeRedirect(linkURL) {
|
||||
|
||||
@@ -514,6 +514,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
cashier_type = "cashier"
|
||||
$(document).ready(function () {
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
@@ -583,7 +584,7 @@
|
||||
var sale_id = "<%= @dining.id %>";
|
||||
}
|
||||
//var table_id = $('.tables').attr("data-id");
|
||||
window.location.href = '/origami/' + sale_id + "/surveys"
|
||||
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys"
|
||||
});
|
||||
|
||||
// bind customer to order or sale
|
||||
@@ -596,7 +597,7 @@
|
||||
}
|
||||
var table_id = $('.tables').attr("data-id");
|
||||
|
||||
window.location.href = '/origami/' + sale_id + "/customers"
|
||||
window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers"
|
||||
|
||||
});
|
||||
|
||||
@@ -617,7 +618,7 @@
|
||||
}
|
||||
|
||||
if (sale_id != "") {
|
||||
window.location.href = '/origami/' + sale_id + '/other_charges'
|
||||
window.location.href = '/origami/' + sale_id + "/"+cashier_type+ '/other_charges'
|
||||
}
|
||||
else {
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
@@ -638,7 +639,7 @@
|
||||
}
|
||||
|
||||
if (sale_id != "") {
|
||||
window.location.href = '/origami/' + sale_id + '/discount'
|
||||
window.location.href = '/origami/' + sale_id+ "/"+cashier_type+'/discount'
|
||||
}
|
||||
else {
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
@@ -714,7 +715,7 @@
|
||||
|
||||
$('#pay').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/' + sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
@@ -812,7 +813,7 @@
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
if ($(this).attr('active')=== "true") {
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit";
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit";
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
|
||||
@@ -114,11 +114,12 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
@@ -140,7 +141,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -228,7 +229,7 @@ $('#jcb_pay').on('click',function(){
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,11 +115,12 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
<button type="button" class="btn btn-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
@@ -141,7 +142,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -226,7 +227,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-1 col-lg-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,6 +125,7 @@
|
||||
$(document).ready(function() {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
else {
|
||||
$('#validamount').attr("value",parseFloat("<%= @can_mpu %>") - parseFloat(localStorage.getItem("cash")));
|
||||
@@ -143,7 +144,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -198,6 +199,7 @@
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
@@ -230,7 +232,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,13 +197,19 @@
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Action Panel -->
|
||||
<div>
|
||||
<%if !@table.nil?%>
|
||||
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/<%=@table.type.downcase%>/<%=@table.id%>'"><i class="material-icons">reply</i> Back </button>
|
||||
<%else%>
|
||||
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%=@sale_data.sale_id%>/<%=@cashier_type%>/payment'"><i class="material-icons">reply</i> Back </button>
|
||||
<%end%>
|
||||
<button id="charge_other" class="btn bg-primary btn-block action-btn">Enter</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
@@ -313,12 +319,16 @@
|
||||
title: "Information!",
|
||||
text: "Success",
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}s
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-11col-md-11 col-sm-11">
|
||||
<div >
|
||||
@@ -22,13 +21,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 m-t-10">
|
||||
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<script type="text/javascript">
|
||||
/* start check first bill or not*/
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
@@ -47,10 +47,10 @@
|
||||
$('.others-payment').on('click',function(){
|
||||
var input_type = $(this).attr("data-type");
|
||||
var sale_id = $(this).attr("data-sale-id");
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment/" + input_type;
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+ cashier_type + "/payment/others_payment/" + input_type;
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/sale/<%= @sale_id %>/payment/';
|
||||
window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/';
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<div class="card">
|
||||
@@ -14,13 +13,15 @@
|
||||
</div>
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Table No :</strong> <%=@table_no%></div>
|
||||
<span class="hidden" id="dining"><%if !@dining.nil?%><%= @dining.id%><%end%></span>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Sale ID :</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></div>
|
||||
</div>
|
||||
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Customer :</strong> <%= @sale_data.customer.name%> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
|
||||
<span class="hidden" id="member_discount"><%= @member_discount%></span></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||
<%end%></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -296,13 +297,23 @@
|
||||
</button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
|
||||
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
|
||||
<% if @cashier_type=="quick_service" %>
|
||||
<hr>
|
||||
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</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="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>
|
||||
<!-- Waiter Buttons -->
|
||||
<%end %>
|
||||
</div>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function(){
|
||||
/* start check first bill or not*/
|
||||
var member_id = $('#membership_id').text();
|
||||
@@ -315,9 +326,10 @@
|
||||
payment_type = '';
|
||||
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
console.log("ssssssssssss")
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||
if (member_id && member_discount) {
|
||||
|
||||
console.log("fffffffffffff")
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
} else{
|
||||
@@ -337,7 +349,11 @@
|
||||
|
||||
$("#back").on('click', function() {
|
||||
localStorage.removeItem('cash');
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami/table/'+ dining_id;
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
});
|
||||
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){
|
||||
@@ -349,6 +365,83 @@
|
||||
update_balance();
|
||||
});
|
||||
|
||||
// bind survey to order or sale
|
||||
$("#survey").on('click', function () {
|
||||
var sale = $('#sale_id').text();
|
||||
if (sale) {
|
||||
var sale_id = sale
|
||||
} else {
|
||||
var sale_id = $('#dining').text();
|
||||
}
|
||||
//var table_id = $('.tables').attr("data-id");
|
||||
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys"
|
||||
});
|
||||
|
||||
// bind customer to order or sale
|
||||
$("#customer").on('click', function () {
|
||||
var sale = $('#sale_id').text();
|
||||
if (sale) {
|
||||
var sale_id = sale
|
||||
} else {
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
var table_id = $('.tables').attr("data-id");
|
||||
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers"
|
||||
});
|
||||
|
||||
// Add Other Charges
|
||||
$('#other-charges').click(function () {
|
||||
var sale = $('#sale_id').text();
|
||||
if (sale != "") {
|
||||
var sale_id = sale
|
||||
} else {
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
if (sale_id != "") {
|
||||
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges'
|
||||
}
|
||||
else {
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// Discount for Payment
|
||||
$('#discount').click(function () {
|
||||
if ($(this).attr('active')=== "true") {
|
||||
var sale = $('#sale_id').text();
|
||||
if (sale != "") {
|
||||
var sale_id = sale
|
||||
} else {
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
|
||||
if (sale_id != "") {
|
||||
window.location.href = '/origami/' + sale_id + "/"+cashier_type+'/discount'
|
||||
}
|
||||
else {
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
}else{
|
||||
swal("Opps","You are not authorized for Discount","warning")
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#edit').on('click', function () {
|
||||
var dining_id = $('#dining').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
if ($(this).attr('active')=== "true") {
|
||||
if (dining_id) {
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||
}else{
|
||||
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||
}
|
||||
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
@@ -407,19 +500,20 @@
|
||||
});
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
// Disable click event cash to prevent
|
||||
$(".payment .cash-color").off('click');
|
||||
|
||||
$('#credit_payment').click(function() {
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/credit_payment"
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/credit_payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#card_payment').click(function() {
|
||||
localStorage.setItem("cash",$('#cash').text() );
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -465,7 +559,7 @@
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
|
||||
async: false,
|
||||
success:function(result){
|
||||
/* start delete receipt no in first bill*/
|
||||
@@ -492,7 +586,11 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$('#pay').text("Pay");
|
||||
@@ -504,7 +602,11 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -525,7 +627,11 @@
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -573,7 +679,11 @@
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
}, function () {
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 m-t-10">
|
||||
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment';"> Back </button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
47
app/views/origami/pending_order/index.html.erb
Normal file
47
app/views/origami/pending_order/index.html.erb
Normal file
@@ -0,0 +1,47 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row clearfix">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong id="order-title"> PENDING ORDER </strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div id="custom-slimscroll">
|
||||
<div class="card-columns">
|
||||
<% @sale.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
cashier_type = "quick_service"
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
||||
})
|
||||
$('#pay').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
|
||||
});
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '/origami/quick_service';
|
||||
})
|
||||
</script>
|
||||
147
app/views/origami/pending_order/show.html.erb
Normal file
147
app/views/origami/pending_order/show.html.erb
Normal file
@@ -0,0 +1,147 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong id="order-title"> PENDING ORDER </strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div id="custom-slimscroll">
|
||||
<div class="card-columns">
|
||||
<% @sales.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<%= @sale.receipt_no rescue '' %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Customer : <%= @sale.customer.name rescue "-" %>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<div class="card-text" style="">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
sub_total = 0
|
||||
@sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<% #unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
|
||||
#end
|
||||
end
|
||||
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
||||
})
|
||||
$('#pay').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
|
||||
});
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '/origami/quick_service';
|
||||
});
|
||||
$('#addorder').on('click', function () {
|
||||
var table_id = "<%=@table_id%>";
|
||||
var booking_id = "<%=@booking%>";
|
||||
if (table_id) {
|
||||
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+$('#sale_id').val();
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/modify_order/'+ booking_id+"/" +$('#sale_id').val();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
0
app/views/origami/quick_service/index.html.erb
Normal file
0
app/views/origami/quick_service/index.html.erb
Normal file
@@ -103,11 +103,12 @@
|
||||
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
else {
|
||||
@@ -185,7 +186,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"
|
||||
});
|
||||
|
||||
}else{
|
||||
|
||||
@@ -714,7 +714,7 @@ $('#pay').on('click',function() {
|
||||
type: "POST",
|
||||
url: '/origami/sale/'+ sale_id + "/rounding_adj",
|
||||
success:function(result){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
// Bill Request
|
||||
$(document).ready(function () {
|
||||
|
||||
@@ -196,7 +197,12 @@
|
||||
|
||||
$('#back').on('click', function () {
|
||||
var table_id = '<%= @table_id %>'
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
window.location.href = '/origami/table/' + table_id;
|
||||
}
|
||||
})
|
||||
|
||||
$('#cancel_all_void').on('click', function () {
|
||||
@@ -221,8 +227,13 @@
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
success: function (result) {
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
window.location.href = '/origami/table/' + table_id;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
data: "opening_balance=" + amount + "&cashier_terminal="+ cashier_terminal,
|
||||
success:function(result){
|
||||
if(result){
|
||||
window.location.href = '/origami';
|
||||
window.location.href = '/origami/dashboard';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -73,13 +73,25 @@
|
||||
<div class="hidden" id="newTemplate" >
|
||||
|
||||
</div>
|
||||
<%if !@dining_facility.nil?%>
|
||||
<input type="hidden" name="table_id" value="<%= @dining_facility.id %>">
|
||||
<input type="hidden" name="table_type" value="<%= @table_type %>">
|
||||
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %>
|
||||
<%else%>
|
||||
<input type="hidden" name="table_id" value="0">
|
||||
<input type="hidden" name="table_type" value="0">
|
||||
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => 0 } %>
|
||||
<%end%>
|
||||
<input type="hidden" name="sale_id" value="<%=@id%>">
|
||||
<input type="hidden" name="cashier_type" value="<%=@cashier_type%>">
|
||||
|
||||
<% if !@survey_data.nil? %>
|
||||
<input type="hidden" name="survey_id" value=<%= @survey_data.id %> />
|
||||
<% else %>
|
||||
<input type="hidden" name="survey_id" />
|
||||
<% end %>
|
||||
<input type="hidden" name="table_id" value="<%=@dining_facility.id%>">
|
||||
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %>
|
||||
|
||||
|
||||
<%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %>
|
||||
<%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %>
|
||||
<%= f.input :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %>
|
||||
@@ -182,6 +194,7 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function(){
|
||||
//click add button for new row
|
||||
$('#addForeigner').on('click',function(){
|
||||
@@ -260,17 +273,21 @@
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// click back button for redirect
|
||||
$('#back').on('click',function(){
|
||||
table_type = '<%=@table_type%>';
|
||||
table_id = '<%=@dining_facility.id%>';
|
||||
table_type = $('#table_type').val()
|
||||
table_id = $('#table_id').val()
|
||||
|
||||
if (cashier_type == "quick_service") {
|
||||
window.location.href = '/origami/sale/<%= @id %>/<%= @cashier_type %>/payment/';
|
||||
}else{
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
<!-- <div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= '/origami/table/@dining_facility.id' %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.survey") %></li>
|
||||
|
||||
<span class="float-right">
|
||||
<%= link_to t('.back',:default => t("views.btn.back")),'/origami/table/'+@dining_facility.id.to_s %>
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
|
||||
<%= render 'form', survey: @survey %>
|
||||
|
||||
@@ -170,7 +170,7 @@ $('#pay').on('click',function() {
|
||||
// location.reload();
|
||||
}
|
||||
});
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment";
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
var lookup_split_bill = '<%= @split_bill %>';
|
||||
|
||||
@@ -115,11 +115,13 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
<button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
|
||||
$(document).ready(function() {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
@@ -143,7 +145,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -230,7 +232,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,11 +115,12 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
<button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
@@ -143,7 +144,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -232,7 +233,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
|
||||
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -84,6 +84,17 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
#--------- Cashier ------------#
|
||||
namespace :origami do
|
||||
get "dashboard" => "dashboard#index"
|
||||
|
||||
get "quick_service" => "quick_service#index"
|
||||
|
||||
get "quick_service/pending_order" => "pending_order#index"
|
||||
get "quick_service/pending_order/:sale_id" => "pending_order#show"
|
||||
|
||||
get "quick_service/modify_order/:id/:sale_id" => "quick_service#modify_order"
|
||||
get "quick_service/modify_order/:sale_id" => "quick_service#modify_order"
|
||||
post 'quick_service/update_modify_order' => "quick_service#update_modify_order", :defaults => { :format => 'json' }
|
||||
|
||||
|
||||
resources :cash_ins, only: [:new, :create]
|
||||
resources :cash_outs, only: [:new, :create]
|
||||
@@ -93,7 +104,8 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
resources :customers #add customer type
|
||||
end
|
||||
post 'moving' => "movetable#moving"
|
||||
get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit"
|
||||
get "/table/:table_id/sale/:sale_id/:type/edit" => "sale_edit#edit"
|
||||
get "/table/sale/:sale_id/:type/edit" => "sale_edit#edit"
|
||||
post 'item_void' => "sale_edit#item_void"
|
||||
post 'item_foc' => "sale_edit#item_foc"
|
||||
post 'item_edit' => "sale_edit#item_edit"
|
||||
@@ -119,11 +131,11 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
# post '/:booking_id' => 'home#item_show'
|
||||
|
||||
# Other Charges
|
||||
get "/:sale_id/other_charges" => "other_charges#index"
|
||||
get "/:sale_id/:type/other_charges" => "other_charges#index"
|
||||
post "/:sale_id/other_charges" => "other_charges#create"
|
||||
|
||||
# Discount
|
||||
get "/:id/discount" => "discounts#index"
|
||||
get "/:id/:type/discount" => "discounts#index"
|
||||
post "/:id/discount" => "discounts#create"
|
||||
get "/:id/remove_all_discount" => "discounts#remove_all_discount"
|
||||
post "/:id/remove_discount_items" => "discounts#remove_discount_items"
|
||||
@@ -152,7 +164,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
#--------- Payment ------------#
|
||||
post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj', :as => "calculate_rouding_adjs"
|
||||
get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => {:format => 'json'}
|
||||
get 'sale/:sale_id/payment' => 'payments#show'
|
||||
get 'sale/:sale_id/:type/payment' => 'payments#show'
|
||||
|
||||
post 'payment/foc' => 'payments#foc', :defaults => {:format => 'json'}
|
||||
post 'payment/cash' => 'payments#create'
|
||||
@@ -165,15 +177,15 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
post 'payment/credit' => 'credit_payments#create'
|
||||
post 'payment/voucher' => 'voucher_payments#create'
|
||||
|
||||
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
|
||||
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
||||
get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index"
|
||||
get 'sale/:sale_id/payment/others_payment/VISA' => "visa#index"
|
||||
get 'sale/:sale_id/payment/others_payment/Master' => "master#index"
|
||||
get 'sale/:sale_id/payment/others_payment/JCB' => "jcb#index"
|
||||
get 'sale/:sale_id/payment/others_payment/UNIONPAY' => "unionpay#index"
|
||||
get 'sale/:sale_id/payment/others_payment/Redeem' => "redeem_payments#index"
|
||||
get 'sale/:sale_id/payment/others_payment/Voucher' => "voucher#index"
|
||||
get 'sale/:sale_id/:type/payment/credit_payment' => "credit_payments#index"
|
||||
get 'sale/:sale_id/:type/payment/others_payment' => "others_payments#index"
|
||||
get 'sale/:sale_id/:type/payment/others_payment/MPU' => "mpu#index"
|
||||
get 'sale/:sale_id/:type/payment/others_payment/VISA' => "visa#index"
|
||||
get 'sale/:sale_id/:type/payment/others_payment/Master' => "master#index"
|
||||
get 'sale/:sale_id/:type/payment/others_payment/JCB' => "jcb#index"
|
||||
get 'sale/:sale_id/:type/payment/others_payment/UNIONPAY' => "unionpay#index"
|
||||
get 'sale/:sale_id/:type/payment/others_payment/Redeem' => "redeem_payments#index"
|
||||
get 'sale/:sale_id/:type/payment/others_payment/Voucher' => "voucher#index"
|
||||
|
||||
#---------Void --------------#
|
||||
post 'sale/:sale_id/void' => 'void#overall_void'
|
||||
@@ -186,26 +198,27 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
#---------Add Customer --------------#
|
||||
#resources :customers
|
||||
get '/:sale_id/customers', to: "customers#add_customer"
|
||||
get '/:sale_id/:type/customers', to: "customers#add_customer"
|
||||
get '/:customer_id/get_customer' => 'home#get_customer', :as => "show_customer_details"
|
||||
post '/:sale_id/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
|
||||
post '/:sale_id/:type/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
|
||||
|
||||
post '/:sale_id/get_customer' => "customers#get_customer"
|
||||
|
||||
get '/:id/surveys', to: "surveys#new"
|
||||
get '/:id/:type/surveys', to: "surveys#new"
|
||||
match '/:id/create_survey', to: "surveys#create", as: "create_surveys", via: [:post, :patch, :put]
|
||||
|
||||
get '/addorders/get_menu/:id' => "addorders#get_menu",:as => "get_menu", :defaults => { :format => 'json' }
|
||||
get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' }
|
||||
get '/addorders/get_menu_sub_category/:id' => "addorders#get_menu_sub_category",:as => "get_menu_sub_category", :defaults => { :format => 'json' }
|
||||
get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' }
|
||||
|
||||
get '/:addorders/:id' => "addorders#detail"
|
||||
post '/:addorders/create' => "addorders#create", :defaults => { :format => 'json' }
|
||||
post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' }
|
||||
|
||||
resources :commissions
|
||||
resources :commissioners
|
||||
|
||||
resources :addorders
|
||||
# resources :addorders
|
||||
resources :in_duties
|
||||
|
||||
# product_commission
|
||||
@@ -224,7 +237,9 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get '/table/:dining_id/split_bills' => 'split_bill#index'
|
||||
get '/room/:dining_id/split_bills' => 'split_bill#index'
|
||||
post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills"
|
||||
|
||||
post '/split_bills/surveys', to: 'surveys#create_survey'
|
||||
|
||||
end
|
||||
|
||||
#--------- Waiter/Ordering Station ------------#
|
||||
|
||||
Reference in New Issue
Block a user