add for room tab and complete
This commit is contained in:
@@ -15,7 +15,7 @@ class Sale < ApplicationRecord
|
||||
has_many :bookings
|
||||
|
||||
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||
scope :complete_sale, -> { where("sale_status = 'completed' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||
scope :complete_sale, -> { where("sale_status = 'completed' and receipt_date BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") }
|
||||
|
||||
REPORT_TYPE = {
|
||||
"daily" => 0,
|
||||
|
||||
@@ -338,6 +338,7 @@ $('#pay').on('click',function() {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var order_id = $('#save_order_id').attr('data-order');
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<% if @status == "order" %>
|
||||
<div><strong id="order-title">ORDER DETAILS </strong></div>
|
||||
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong></div>
|
||||
<% else %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
<% end %>
|
||||
@@ -139,7 +139,7 @@
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @obj.sale_id %>">
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<% unless sale_item.price == 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
@@ -155,7 +155,7 @@
|
||||
@order_items.each do |order_item |
|
||||
sub_total = sub_total + order_item.price
|
||||
|
||||
unless order_item.price <= 0 %>
|
||||
unless order_item.price == 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
@@ -259,15 +259,65 @@ $(document).ready(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";
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var order_id = $('#save_order_id').attr('data-order');
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'order_id='+ order_id,
|
||||
success:function(result){
|
||||
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#move').on('click',function(){
|
||||
var dining_id = "<%= @room.id %>"
|
||||
window.location.href = '/origami/table/'+ dining_id + "/moveroom";
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user