validate foodcourt origami cashier

This commit is contained in:
NyanLinHtut
2020-05-18 14:23:33 +06:30
parent 1dc01d6055
commit 871403382e
2 changed files with 270 additions and 235 deletions

View File

@@ -8,6 +8,7 @@ class Foodcourt::FoodCourtController < ApplicationController
end
def index
if !ShiftSale.current_shift.nil?
if params[:sale_id].present?
sale =Sale.find(params[:sale_id])
if sale
@@ -50,6 +51,13 @@ class Foodcourt::FoodCourtController < ApplicationController
.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
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
def get_menu_category ()

View File

@@ -10,7 +10,7 @@
<!-- Widgets -->
<div class="row clearfix">
<% 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="icon" >
<i class="material-icons">arrow_forward</i>
@@ -20,7 +20,7 @@
</div>
<% end %>
<% 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="icon" >
<i class="material-icons">arrow_forward</i>
@@ -30,7 +30,7 @@
</div>
<% end %>
<% 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="icon" >
<i class="material-icons">arrow_forward</i>
@@ -40,7 +40,7 @@
</div>
<% end %>
<% 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="icon" >
<i class="material-icons">arrow_forward</i>
@@ -50,7 +50,7 @@
</div>
<% end %>
<% 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="icon" >
<i class="material-icons">arrow_forward</i>
@@ -218,28 +218,41 @@
</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>
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
<script>
$(function() {
$("#loading_wrapper").show();
getAllMenu();
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
$("#second_view").on('click', function () {
var url = $(this).attr("data-href");
window.open(url,'_blank');
});
$(".qs_view").on('click', function() {
var display_type = '<%= @display_type %>';
if (display_type.length>0) {
display_type = '<%= @display_type %>';
var role = '<%= @current_user.role %>';
var current_shift = '<%= ShiftSale.current_shift %>'
var food_court = '<%= @food_court %>'
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 {
display_type = null;
window.location.href = '/origami/shifts/new'
}
if ($('#server_mode').val() != "cloud" && display_type == 2) {
document.getElementById('second_view').click();
}
window.location.href = '/origami/quick_service';
});
} else {
$(".fc_view").on('click', function() {
var display_type = '<%= @display_type %>';
if (display_type.length>0) {
@@ -257,13 +270,27 @@ $(function() {
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(){
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>