Files
sx-fc/app/views/origami/home/index.html.erb
2017-11-10 18:08:48 +06:30

234 lines
7.9 KiB
Plaintext
Executable File

<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-10 col-md-10 col-sm-10">
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#complete" role="tab"><%= t :competed %></a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab"><%= t :tables %></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab"><%= t :rooms %></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#orders" role="tab"><%= t :orders %></a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content m-t-10" id="custom-slimscroll">
<!--- Panel 0 - Completed Orders -->
<div class="tab-pane dining" id="complete" role="tabpanel">
<div class="card-columns">
<% @complete.each do |sale| %>
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %>
<span class="pull-right"><%= sale.sale_status %></span>
</div>
</div>
<% end %>
</div>
</div>
<!--- Panel 1 - Table Orders -->
<div class="tab-pane dining active" id="tables" role="tabpanel">
<div class="card-columns">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% else %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.get_booking %>
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 2 - Room Orders -->
<div class="tab-pane dining" id="rooms" role="tabpanel">
<div class="card-columns">
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<div class="card rooms red text-white" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="orders" role="tabpanel">
<div class="card-columns">
<% @orders.each do |order| %>
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
<div class="card-block">
<%= order.order_id %>
</div>
</div>
<% end %>
</div>
</div>
</div>
<!-- tabs - End -->
</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> -->
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
<!-- Temporary Disabled -->
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></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="fa fa-home fa-lg"></i> <%= t("views.btn.back") %>
</button>
<%end%>
</div>
</div>
</div>
<!-- Column One -->
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id;
});
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/sale/' + sale_id;
});
$(".rooms").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/room/' + dining_id;
});
$(".orders").on('click',function(){
var order_id = $(this).attr("data-id");
window.location.href = '/origami/order/' + order_id;
});
$('#sale_summary').on('click',function(){
window.location.href = '/origami/shift/sale_summary';
})
});
// $(function() {
// var timer;
// function start() {
// timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 10000); //10000
// };
// function stop() {
// clearTimeout(timer);
// };
// if(localStorage.getItem("refreshflag") != null){
// if (localStorage.getItem("refreshflag") == 0) {
// $('#refreshbutton').html("Refresh off");
// $('#refreshbutton').css("background-color","red");
// stop();
// }
// else{
// $('#refreshbutton').html("Refresh on");
// $('#refreshbutton').css("background-color","green");
// start();
// }
// }
// else{
// localStorage.setItem("refreshflag", 0);
// }
// var url = location.href;
// if (location.href.slice(-1) == "/"){
// url = url.substring(0, url.length - 1);
// }
// var arr = url.split("/");
// if(arr[arr.length-1] != "origami"){
// stop();
// }
// $('#refreshbutton').bind("click", function(){
// if(localStorage.getItem("refreshflag") == "0"){
// localStorage.setItem("refreshflag", 1);
// $(this).html("Refresh on");
// $(this).css("background-color","green");
// // $(this).html("Auto Refresh on<span class='glyphicon glyphicon-ok'></span>");
// start();
// }
// else{
// stop();
// localStorage.setItem("refreshflag", 0);
// $(this).html("Refresh off");
// $(this).css("background-color","red");
// }
// });
// function refreshing(){
// if(localStorage.getItem("refreshflag") == "0"){
// localStorage.setItem("refreshflag", 1);
// $(this).html("Refresh on");
// $(this).css("background-color","green");
// // $(this).html("Auto Refresh on<span class='glyphicon glyphicon-ok'></span>");
// start();
// }
// else{
// stop();
// localStorage.setItem("refreshflag", 0);
// $(this).html("Refresh off");
// $(this).css("background-color","red");
// }
// }
// });
$('#cash_in').on('click',function(){
window.location.href = '/origami/cash_ins/new';
})
$('#cash_out').on('click',function(){
window.location.href = '/origami/cash_outs/new';
})
$('#close_cashier').on('click',function(){
window.location.href = '/origami/shift/close';
})
$('#back').on('click',function(){
window.location.href = '/dashboard';
})
</script>