Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Nweni
2017-06-22 14:27:12 +06:30
70 changed files with 2291 additions and 712 deletions

View File

@@ -94,7 +94,7 @@
<!-- tabs - End -->
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-block"> Refresh </button>
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
</div>
</div>
<!-- Column One -->
@@ -117,4 +117,70 @@ $(document).ready(function(){
window.location.href = '/origami/order/' + order_id;
})
});
$(function() {
var timer;
function start() {
timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 30000); //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");
}
}
});
</script>

View File

@@ -142,7 +142,10 @@
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<% unless sale_item.price <= 0 %>
<%
# Can't check for discount
unless sale_item.price == 0
%>
<tr>
<td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td>
@@ -150,7 +153,7 @@
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
end
end
end
end
@@ -161,7 +164,7 @@
count += 1
sub_total = sub_total + order_item.price
unless order_item.price <= 0 %>
unless order_item.price == 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
@@ -185,7 +188,7 @@
</tr>
<tr>
<td class="charges-name"><strong>Discount:</strong></td>
<td class="item-attr"><strong id="order-discount">(<%= @obj_order.total_discount rescue 0%>)</strong></td>
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
</tr>
<% if @status_sale == "sale" %>
<tr>
@@ -284,20 +287,58 @@ $(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;
})
});
// bind customer to order or sale
$("#customer").on('click', function(){
var sale = $('#sale_id').val();
if (sale!="") {
var sale_id = sale
}else{
var sale_id = $('#save_order_id').attr('data-order');
}
window.location.href = '/origami/'+ sale_id + "/customers"
});
// Discount for Payment
$('#discount').click(function() {
var sale = $('#sale_id').val();
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 + '/discount'
}
else {
alert("Please select an table!");
}
return false;
});
});
$('#pay').on('click',function() {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/'+ sale_id + "/payment";