update add to existing for room

This commit is contained in:
Aung Myo
2018-07-20 11:09:56 +06:30
parent a1793eeb3d
commit 88f7d0d2b7
2 changed files with 91 additions and 4 deletions

View File

@@ -192,11 +192,13 @@
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card">
<% existing_class = "" %><% existing_order = false %>
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
<% if @status_sale == 'sale'
unless @order_items.nil? || @order_items.empty?%>
<% existing_class = "existing_invoice"%>
<% existing_order = true %>
<% tooltip = ' data-toggle=modal title=Add_To_Existing data-target=#invoiceModal'%>
<%end%>
<%end%>
<div class="card-header <%= existing_class %>" <%= tooltip %>>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>

View File

@@ -211,7 +211,15 @@
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<% existing_class = "" %><% existing_order = false %>
<% if @status_sale == 'sale'
unless @order_items.nil? || @order_items.empty?%>
<% existing_class = "existing_invoice"%>
<% existing_order = true %>
<% tooltip = ' data-toggle=modal title=Add_To_Existing data-target=#invoiceModal'%>
<%end%>
<%end%>
<div class="card-header <%= existing_class %>" <%= tooltip %>>
<% if @status_order == 'order' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
@@ -419,7 +427,7 @@
if @status_sale == 'sale'
unless @order_items.nil? || @order_items.empty?
%>
Pending New Order
<!-- Pending New Order
<table class="table table-striped">
<%
count = 0
@@ -466,7 +474,7 @@
%>
</table>
<button class='btn bg-primary btn-block' id='add_invoice'> Add to existing invoice </button>
<% end %>
<% end %> -->
<% if @sale_array.size > 1 %>
<br><br>
Pending Payment
@@ -673,7 +681,84 @@
</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 -->
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">