update pending ordre

This commit is contained in:
Aung Myo
2018-07-12 18:36:35 +06:30
parent eef4af4cc6
commit d254ff744d
3 changed files with 261 additions and 218 deletions

View File

@@ -82,7 +82,15 @@ $(document).ready(function() {
touchScrollStep : 45 touchScrollStep : 45
}); });
$('#pending-order-slimscroll').slimScroll({
height: height-$('#pending-order-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
// $('.delete').click(function(){ // $('.delete').click(function(){
// var method = $(this).attr('data-method'); // var method = $(this).attr('data-method');
// var url = $(this).attr('data-ref'); // var url = $(this).attr('data-ref');

View File

@@ -520,3 +520,8 @@ nav.pagination .page a:hover,
filter: alpha(opacity=100); /* ie */ filter: alpha(opacity=100); /* ie */
-moz-opacity: 1; /* mozilla */ -moz-opacity: 1; /* mozilla */
} }
.existing_invoice{
background-color:#009688;
color:#fff;
}

View File

@@ -50,11 +50,6 @@
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span> <span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div> <div style="font-size:12px;"></div>
</div> </div>
@@ -67,11 +62,6 @@
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> new</span> <span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div> </div>
</div> </div>
@@ -101,11 +91,6 @@
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span> <span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
</div> </div>
</div> </div>
@@ -117,11 +102,6 @@
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> new</span> <span class="float-right font-12 new_text_<%= room.id %>"> new</span>
</div> </div>
</div> </div>
@@ -144,22 +124,22 @@
<% @orders.each do |order| %> <% @orders.each do |order| %>
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>"> <div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block"> <div class="card-block">
<% <% order_status = "" %>
order_status = "" <% sale_order = order.sale_orders.first %>
sale_order = order.sale_orders.first <% if sale_order %>
if sale_order <% unless sale_order.sale_id.nil? %>
unless sale_order.sale_id.nil? <% sale = Sale.find(sale_order.sale_id) %>
sale = Sale.find(sale_order.sale_id) <% order_status = sale.sale_status %>
order_status = sale.sale_status <% if order_status == 'new' %>
if order_status == 'new' <% order_status = order.status %>
order_status = order.status <% end %>
end <% end %>
end <% else %>
else <% order_status = order.status %>
order_status = order.status <% end %>
end <%= order.order_id %>
%> <% if !order_status.empty? %>| <%= order_status %>
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %> <% end %>
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -174,7 +154,12 @@
<!-- Column Two --> <!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5"> <div class="col-lg-5 col-md-5 col-sm-5">
<div class="card"> <div class="card">
<div class="card-header"> <% existing_class = "" %>
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
<% existing_class = "existing_invoice"%>
<% tooltip = ' data-toggle=modal title=Add_To_Existing data-target=#invoiceModal'%>
<%end%>
<div class="card-header <%= existing_class %>" <%= tooltip %>>
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %> <% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"> <div id="save_order_id" data-order="<%= @obj_order.order_id %>">
@@ -222,7 +207,6 @@
&nbsp; Order No: <span id="order_no"> &nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %> <% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %> <%= @obj_order.order_id rescue '' %>
<% end %> <% end %>
</span> </span>
<br> <br>
@@ -235,7 +219,6 @@
</div> </div>
<div class="row p-l-5 p-r-5"> <div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' %> <% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p> <p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %> &nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
@@ -244,7 +227,6 @@
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p> <p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %> &nbsp; Customer : <%= @customer.name rescue "" %>
<% end %> <% end %>
</div> </div>
</div> </div>
</div> </div>
@@ -253,73 +235,54 @@
<table class="table table-striped" id="order-items-table"> <table class="table table-striped" id="order-items-table">
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th class="item-name">Items</th> <th class="item-name">Items</th>
<th class="item-attr">QTY <th class="item-attr">QTY</th>
</th> <th class="item-attr">Price</th>
<th class="item-attr">Price
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% <% count = 0
count = 0
sub_total = 0 sub_total = 0
if @status_sale == "sale" if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item| @sale_array[0].sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price%>
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>"> <input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<% <%count += 1 %>
# Can't check for discount
# unless sale_item.price == 0
count += 1
%>
<tr> <tr>
<td><%= count %></td> <td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td> <td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td> <td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td> <td class='item-attr'><%= sale_item.price %></td>
</tr> </tr>
<%end %>
<% <% end %>
end <% if @status_order == 'order' && @status_sale != 'sale'
end
if @status_order == 'order' && @status_sale != 'sale'
puts
unless @order_items.nil? || @order_items.empty? unless @order_items.nil? || @order_items.empty?
count = 0 count = 0
@order_items.each do |order_item| @order_items.each do |order_item|
set_item_prices = 0 set_item_prices = 0
count += 1 count += 1
sub_total = sub_total + (order_item.price * order_item.qty) sub_total = sub_total + (order_item.price * order_item.qty)
# unless order_item.price == 0 %> # unless order_item.price == 0 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'> <tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td> <td><%= count %></td>
<td class='item-name'> <td class='item-name'><%= order_item.item_name %>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %> <% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %> <% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13"> <br><span class="font-13"><%= option %></span>
<%= option %>
</span>
<% end %> <% end %>
<% end %> <% end %>
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]' <% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
JSON.parse(order_item.set_menu_items).each do |item_instance| JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %> set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
<br><span class="font-13"> <br>
<span class="font-13">
<%= item_instance["item_instance_name"] %> <%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %> <% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
<% (item_instance["options"]).each do |set_item_option| %> <% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13"> <br><span class="font-13"> <%= set_item_option %></span>
<%= set_item_option %>
</span>
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
@@ -330,13 +293,9 @@
<td class='item-attr'><%= order_item.qty %></td> <td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td> <td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr> </tr>
<% <% end %>
<% end %>
# end <% end %>
end
end
end
%>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -390,18 +349,14 @@
</table> </table>
</div> </div>
<% <% if @status_sale == 'sale'
if @status_sale == 'sale' unless @order_items.nil? || @order_items.empty?%>
unless @order_items.nil? || @order_items.empty? <!-- Pending New Order
%>
Pending New Order
<table class="table table-striped"> <table class="table table-striped">
<% <% count = 0
count = 0
@order_items.each do |order_item| @order_items.each do |order_item|
set_item_prices = 0 set_item_prices = 0
count += 1 count += 1 %>
%>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'> <tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %> <td><%= count %>
<td class='item-name'> <td class='item-name'>
@@ -438,9 +393,9 @@
<% <%
end end
%> %>
</table> </table> -->
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button> <!-- <button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button> -->
<% end %> <% end %>
<% if @sale_array.size > 1 %> <% if @sale_array.size > 1 %>
<br><br> <br><br>
@@ -450,7 +405,6 @@
if @sale_array.size > 1 if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no unless sale.receipt_no == @sale_array[0].receipt_no
%> %>
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<td>Receipt No - <%= sale.receipt_no %></td> <td>Receipt No - <%= sale.receipt_no %></td>
@@ -461,12 +415,10 @@
</td> </td>
</tr> </tr>
</table> </table>
<% <%end%>
end <% end%>
end <% end%>
end <%end %>
end
%>
</div> </div>
</div> </div>
</div> </div>
@@ -642,6 +594,84 @@
</div> </div>
</div> </div>
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
<div class="modal fade" id="invoiceModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="invoiceModalLabel">Pending New Order</h4>
</div>
<div class="modal-body">
<div class="card">
<div id="pending-order-slimscroll" data-height="160">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% count = 0
@order_items.each do |order_item|
set_item_prices = 0
count += 1 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr>
<%end %>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-9">
<button class='btn btn-link bg-blue waves-effect' data-dismiss="modal" id='add_invoice'> Add to existing invoice</button>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<%end%>
<!-- change tax modal --> <!-- change tax modal -->
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog"> <div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document"> <div class="modal-dialog modal-md" role="document">