validate foodcourt origami cashier
This commit is contained in:
@@ -8,6 +8,7 @@ class Foodcourt::FoodCourtController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
if !ShiftSale.current_shift.nil?
|
||||||
if params[:sale_id].present?
|
if params[:sale_id].present?
|
||||||
sale =Sale.find(params[:sale_id])
|
sale =Sale.find(params[:sale_id])
|
||||||
if sale
|
if sale
|
||||||
@@ -50,6 +51,13 @@ class Foodcourt::FoodCourtController < ApplicationController
|
|||||||
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
|
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
|
||||||
.where("bookings.booking_status !=? and sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','completed','paid',Date.today).order("bookings.created_at desc").uniq.length
|
.where("bookings.booking_status !=? and sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','completed','paid',Date.today).order("bookings.created_at desc").uniq.length
|
||||||
render "foodcourt/addorders/detail"
|
render "foodcourt/addorders/detail"
|
||||||
|
else
|
||||||
|
if current_user.role == 'administrator' || current_user.role == 'manager'
|
||||||
|
redirect_to origami_dashboard_path
|
||||||
|
else
|
||||||
|
redirect_to new_foodcourt_shift_path
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_menu_category ()
|
def get_menu_category ()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div id="loading_wrapper" style="display:none;">
|
<div id="loading_wrapper" style="display:none;">
|
||||||
<div id="loading"></div>
|
<div id="loading"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="block-header">
|
<div class="block-header">
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<!-- Widgets -->
|
<!-- Widgets -->
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
<% if @quick_service == '1' %>
|
<% if @quick_service == '1' %>
|
||||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 qs_view">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 qs_view origami_cashier">
|
||||||
<div class="info-box bg-purple">
|
<div class="info-box bg-purple">
|
||||||
<div class="icon" >
|
<div class="icon" >
|
||||||
<i class="material-icons">arrow_forward</i>
|
<i class="material-icons">arrow_forward</i>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @food_court == '1' %>
|
<% if @food_court == '1' %>
|
||||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 fc_view">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 fc_view origami_cashier">
|
||||||
<div class="info-box bg-pink">
|
<div class="info-box bg-pink">
|
||||||
<div class="icon" >
|
<div class="icon" >
|
||||||
<i class="material-icons">arrow_forward</i>
|
<i class="material-icons">arrow_forward</i>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @dinein_cashier == '1' %>
|
<% if @dinein_cashier == '1' %>
|
||||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 cashier_view">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 cashier_view origami_cashier">
|
||||||
<div class="info-box bg-green">
|
<div class="info-box bg-green">
|
||||||
<div class="icon" >
|
<div class="icon" >
|
||||||
<i class="material-icons">arrow_forward</i>
|
<i class="material-icons">arrow_forward</i>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @reservation == '1' %>
|
<% if @reservation == '1' %>
|
||||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 reservation">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 reservation origami_cashier">
|
||||||
<div class="info-box bg-orange">
|
<div class="info-box bg-orange">
|
||||||
<div class="icon" >
|
<div class="icon" >
|
||||||
<i class="material-icons">arrow_forward</i>
|
<i class="material-icons">arrow_forward</i>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @order_reservation == '1' %>
|
<% if @order_reservation == '1' %>
|
||||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 order_reservation">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 order_reservation origami_cashier">
|
||||||
<div class="info-box bg-blue">
|
<div class="info-box bg-blue">
|
||||||
<div class="icon" >
|
<div class="icon" >
|
||||||
<i class="material-icons">arrow_forward</i>
|
<i class="material-icons">arrow_forward</i>
|
||||||
@@ -218,28 +218,41 @@
|
|||||||
</div>
|
</div>
|
||||||
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
|
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
|
||||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#loading_wrapper").show();
|
$("#loading_wrapper").show();
|
||||||
getAllMenu();
|
getAllMenu();
|
||||||
|
|
||||||
$(".cashier_view").on('click', function() {
|
$("#second_view").on('click', function () {
|
||||||
window.location.href = '/origami';
|
var url = $(this).attr("data-href");
|
||||||
|
window.open(url,'_blank');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".qs_view").on('click', function() {
|
var role = '<%= @current_user.role %>';
|
||||||
var display_type = '<%= @display_type %>';
|
var current_shift = '<%= ShiftSale.current_shift %>'
|
||||||
if (display_type.length>0) {
|
var food_court = '<%= @food_court %>'
|
||||||
display_type = '<%= @display_type %>';
|
|
||||||
}else{
|
|
||||||
display_type = null;
|
|
||||||
}
|
|
||||||
if ($('#server_mode').val() != "cloud" && display_type == 2) {
|
|
||||||
document.getElementById('second_view').click();
|
|
||||||
}
|
|
||||||
window.location.href = '/origami/quick_service';
|
|
||||||
});
|
|
||||||
|
|
||||||
|
if ((role == 'administrator' || role == 'manager') && current_shift === "") {
|
||||||
|
$(".origami_cashier").on('click', function() {
|
||||||
|
swal({
|
||||||
|
title: "There is no current open shift!",
|
||||||
|
text: "",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonClass: "btn-info",
|
||||||
|
confirmButtonText: "OK",
|
||||||
|
closeOnConfirm: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if (role == 'cashier' && current_shift === "") {
|
||||||
|
if (food_court == 1){
|
||||||
|
window.location.href = '/foodcourt/shifts/new'
|
||||||
|
}else {
|
||||||
|
window.location.href = '/origami/shifts/new'
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
$(".fc_view").on('click', function() {
|
$(".fc_view").on('click', function() {
|
||||||
var display_type = '<%= @display_type %>';
|
var display_type = '<%= @display_type %>';
|
||||||
if (display_type.length>0) {
|
if (display_type.length>0) {
|
||||||
@@ -257,13 +270,27 @@ $(function() {
|
|||||||
window.location.href = '/origami/order_reservation';
|
window.location.href = '/origami/order_reservation';
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#second_view").on('click', function () {
|
|
||||||
var url = $(this).attr("data-href");
|
|
||||||
window.open(url,'_blank');
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".reservation").on("click", function(){
|
$(".reservation").on("click", function(){
|
||||||
window.location.href = '/origami/reservation';
|
window.location.href = '/origami/reservation';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".qs_view").on('click', function() {
|
||||||
|
var display_type = '<%= @display_type %>';
|
||||||
|
if (display_type.length>0) {
|
||||||
|
display_type = '<%= @display_type %>';
|
||||||
|
}else{
|
||||||
|
display_type = null;
|
||||||
|
}
|
||||||
|
if ($('#server_mode').val() != "cloud" && display_type == 2) {
|
||||||
|
document.getElementById('second_view').click();
|
||||||
|
}
|
||||||
|
window.location.href = '/origami/quick_service';
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".cashier_view").on('click', function() {
|
||||||
|
window.location.href = '/origami';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user