Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -54,12 +54,18 @@ class Api::OrdersController < Api::ApiController
|
|||||||
extra_time = ''
|
extra_time = ''
|
||||||
|
|
||||||
params[:order_items].each { |i|
|
params[:order_items].each { |i|
|
||||||
if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30'
|
if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30' || i["item_instance_code"] == 'Extie45' || i["item_instance_code"] == 'Extie15'
|
||||||
is_extra_time = true
|
is_extra_time = true
|
||||||
if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30'
|
if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30'
|
||||||
t = Time.now
|
t = Time.now
|
||||||
time = 30*60*i["quantity"].to_i
|
time = 30*60*i["quantity"].to_i
|
||||||
extra_time = Time.at(time)
|
extra_time = Time.at(time)
|
||||||
|
elsif i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie15'
|
||||||
|
time = 15*60*i["quantity"].to_i
|
||||||
|
extra_time = Time.at(time)
|
||||||
|
elsif i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extie45'
|
||||||
|
time = 45*60*i["quantity"].to_i
|
||||||
|
extra_time = Time.at(time)
|
||||||
else
|
else
|
||||||
t = Time.now
|
t = Time.now
|
||||||
time = 60*60*i["quantity"].to_i
|
time = 60*60*i["quantity"].to_i
|
||||||
|
|||||||
@@ -67,11 +67,17 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
|||||||
|
|
||||||
items_arr = []
|
items_arr = []
|
||||||
JSON.parse(params[:order_items]).each { |i|
|
JSON.parse(params[:order_items]).each { |i|
|
||||||
if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30'
|
if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30' || i["item_instance_code"] == 'Extie45' || i["item_instance_code"] == 'Extie15'
|
||||||
is_extra_time = true
|
is_extra_time = true
|
||||||
if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30'
|
if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30'
|
||||||
time = 30*60*i["quantity"].to_i
|
time = 30*60*i["quantity"].to_i
|
||||||
extra_time = Time.at(time)
|
extra_time = Time.at(time)
|
||||||
|
elsif i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie15'
|
||||||
|
time = 15*60*i["quantity"].to_i
|
||||||
|
extra_time = Time.at(time)
|
||||||
|
elsif i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extie45'
|
||||||
|
time = 45*60*i["quantity"].to_i
|
||||||
|
extra_time = Time.at(time)
|
||||||
else
|
else
|
||||||
time = 60*60*i["quantity"].to_i
|
time = 60*60*i["quantity"].to_i
|
||||||
extra_time = Time.at(time)
|
extra_time = Time.at(time)
|
||||||
|
|||||||
@@ -19,10 +19,18 @@ class Origami::MovetableController < BaseOrigamiController
|
|||||||
|
|
||||||
order = Order.find(booking_order.order_id)
|
order = Order.find(booking_order.order_id)
|
||||||
@obj_order = order
|
@obj_order = order
|
||||||
|
@customer = order.customer
|
||||||
@date = order.created_at
|
@date = order.created_at
|
||||||
|
@booking= booking
|
||||||
order.order_items.each do |item|
|
order.order_items.each do |item|
|
||||||
@order_items.push(item)
|
@order_items.push(item)
|
||||||
end
|
end
|
||||||
|
accounts = @customer.tax_profiles
|
||||||
|
@account_arr =[]
|
||||||
|
accounts.each do |acc|
|
||||||
|
account = TaxProfile.find(acc)
|
||||||
|
@account_arr.push(account)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@status_order = 'order'
|
@status_order = 'order'
|
||||||
else
|
else
|
||||||
@@ -32,9 +40,17 @@ class Origami::MovetableController < BaseOrigamiController
|
|||||||
if @status_order == 'order'
|
if @status_order == 'order'
|
||||||
@status_order = 'sale'
|
@status_order = 'sale'
|
||||||
end
|
end
|
||||||
|
@booking= booking
|
||||||
@date = sale.created_at
|
@date = sale.created_at
|
||||||
@status_sale = 'sale'
|
@status_sale = 'sale'
|
||||||
@obj_sale = sale
|
@obj_sale = sale
|
||||||
|
@customer = sale.customer
|
||||||
|
accounts = @customer.tax_profiles
|
||||||
|
@account_arr =[]
|
||||||
|
accounts.each do |acc|
|
||||||
|
account = TaxProfile.find(acc)
|
||||||
|
@account_arr.push(account)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -135,7 +135,7 @@
|
|||||||
<div id="save_order_id" data-order="">
|
<div id="save_order_id" data-order="">
|
||||||
<% end %>
|
<% end %>
|
||||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||||
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? && %>
|
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
|
||||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
|
|||||||
@@ -22,12 +22,28 @@
|
|||||||
<div class="card-columns" style="padding-top:10px;" >
|
<div class="card-columns" style="padding-top:10px;" >
|
||||||
<% @tables.each do |table| %>
|
<% @tables.each do |table| %>
|
||||||
<% if table.status == 'occupied' %>
|
<% if table.status == 'occupied' %>
|
||||||
|
<% if table.get_booking.nil? %>
|
||||||
|
<% if table.get_checkout_booking.nil? %>
|
||||||
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||||
|
<% else %>
|
||||||
|
<div class="card tables orange text-white" data-id="<%= table.id %>">
|
||||||
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.name %>
|
<%= table.name %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<% if table.get_checkout_booking.nil? %>
|
||||||
|
<div class="card tables blue text-white" data-id="<%= table.id %>">
|
||||||
|
<% else %>
|
||||||
|
<div class="card tables orange text-white" data-id="<%= table.id %>">
|
||||||
|
<% end %>
|
||||||
|
<div class="card-block">
|
||||||
|
<%= table.name %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.name %>
|
<%= table.name %>
|
||||||
@@ -59,10 +75,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--- Panel 3 - s -->
|
<!--- Panel 3 - s -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- tabs - End -->
|
<!-- tabs - End -->
|
||||||
</div>
|
</div>
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
|
|
||||||
@@ -72,25 +88,77 @@
|
|||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
|
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
|
||||||
<input type='hidden' id="change_table_value" value="" />
|
<input type='hidden' id="change_table_value" value="" />
|
||||||
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
|
<% if !@obj_order.nil? %>
|
||||||
|
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
|
||||||
|
<% else %>
|
||||||
|
<div id="save_order_id" data-order="">
|
||||||
|
<% end %>
|
||||||
|
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||||
|
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
|
||||||
|
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
|
<% else %>
|
||||||
|
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% elsif @status_sale == 'sale' %>
|
||||||
|
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||||
|
<% if !@booking.reserved_by.nil? && %>
|
||||||
|
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
|
<% else %>
|
||||||
|
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title row">
|
<div class="card-title">
|
||||||
|
<div class="row p-l-5 p-r-5">
|
||||||
|
<% if (!@sale_array.empty?) && (!@date.nil?) %>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
<p class="m-l-10"> Receipt No: <span id="receipt_no">
|
Receipt No: <span id="receipt_no">
|
||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
<%= @sale_array[0].receipt_no rescue '' %>
|
<%= @sale_array[0].receipt_no rescue '' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span></p>
|
</span>
|
||||||
|
<br>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
<p class="m-r-10">Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
|
||||||
</div>
|
<br>
|
||||||
</div>
|
|
||||||
<div class="card-title row customer_detail hide">
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
|
||||||
<p>Customer : <span id="customer_name"></span></p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<% elsif !@date.nil? %>
|
||||||
|
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||||
|
Order No: <span id="order_no">
|
||||||
|
<% if @status_order == 'order' %>
|
||||||
|
<%= @obj_order.order_id rescue '' %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
|
||||||
|
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row p-l-5 p-r-5">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
|
||||||
|
<% if @status_sale == 'sale' %>
|
||||||
|
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
|
||||||
|
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||||
|
<% elsif @status_order == 'order'
|
||||||
|
%>
|
||||||
|
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||||
|
Customer : <%= @customer.name rescue "" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="order-detail-slimscroll" data-height="130">
|
<div id="order-detail-slimscroll" data-height="130">
|
||||||
<div class="card-text" style="" >
|
<div class="card-text" style="" >
|
||||||
@@ -108,7 +176,6 @@
|
|||||||
count = 0
|
count = 0
|
||||||
sub_total = 0
|
sub_total = 0
|
||||||
if @status_sale == "sale"
|
if @status_sale == "sale"
|
||||||
puts @sale_array[0]
|
|
||||||
@sale_array[0].sale_items.each do |sale_item|
|
@sale_array[0].sale_items.each do |sale_item|
|
||||||
count += 1
|
count += 1
|
||||||
sub_total = sub_total + sale_item.price
|
sub_total = sub_total + sale_item.price
|
||||||
@@ -127,15 +194,13 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
if @status_order == 'order' && @status_sale != 'sale'
|
if @status_order == 'order' && @status_sale != 'sale'
|
||||||
unless @order_items.nil?
|
unless @order_items.nil? || @order_items.empty?
|
||||||
count = 0
|
count = 0
|
||||||
@order_items.each do |order_item |
|
@order_items.each do |order_item |
|
||||||
puts @order_items.size
|
|
||||||
puts "view"
|
|
||||||
count += 1
|
count += 1
|
||||||
sub_total = sub_total + order_item.price
|
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||||
|
|
||||||
unless order_item.price <= 0 %>
|
#unless order_item.price <= 0 %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'><%= order_item.item_name %></td>
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
@@ -143,13 +208,13 @@
|
|||||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
end
|
#end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%
|
<%
|
||||||
@@ -212,7 +277,7 @@ end
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$(".tables").on('click', function(){
|
$(".tables").on('click', function(){
|
||||||
$('.tables').removeClass('selected-item');
|
$('.tables').removeClass('selected-item');
|
||||||
$(this).addClass('selected-item');
|
$(this).addClass('selected-item');
|
||||||
@@ -288,8 +353,8 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
$('#back').on('click',function(){
|
$('#back').on('click',function(){
|
||||||
window.location.href = '/origami/table/'+ "<%= @dining.id %>";
|
window.location.href = '/origami/table/'+ "<%= @dining.id %>";
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user