for all items

This commit is contained in:
phyusin
2018-02-15 13:24:29 +06:30
6 changed files with 128 additions and 39 deletions

View File

@@ -26,7 +26,7 @@
<div class="row m-l-5">
<div class="col-lg-3 col-md-3 col-sm-3">
<ul class="nav nav-tabs tabs-left sideways">
<li class="active">
<li class="order-row active">
<a href="#all_order" data-toggle="tab">All</a>
</li>
<% @orders.each.with_index(0) do |order, order_index| %>
@@ -38,12 +38,75 @@
</div>
<div class="col-lg-8 col-md-8 col-sm-8">
<div class="tab-content">
<div class="tab-pane active" id="all_order">
<div class="card-title">
<p class="m-l-2">Order Items</p>
</div>
<div id="order-detail-slimscroll-all_order" data-height="200">
<div class="card-text dining">
<table class="table table-default" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if !@order_items.nil? %>
<% sub_total = 0 %>
<% @order_items.each do |order_item| %>
<% if order_item.include? ('all_order') %>
<% order_item['all_order'].each do |odr_item| %>
<%
sub_total += odr_item['qty'].to_f * odr_item['price'].to_f
%>
<tr class="item-row" id=<%= odr_item['order_items_id'] %> >
<td style="width:60%; text-align:left">
<span id="item-order-id" class="hidden"><%=odr_item['order_id'] %></span>
<span id="item-account-type" class="hidden"><%=odr_item['account_id'] %></span>
<span id="item-name-price">
<%=odr_item['item_name'] %>
<% if !odr_item['set_menu_items'].nil?
odr_item['set_menu_items'].each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
<% end
end %>
</span>
</td>
<td style="width:20%; text-align:right">
<span id="item-qty"><%=odr_item['qty']%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-total-price"><%=(odr_item['qty'].to_f * odr_item['price'].to_f)%></span>
</td>
</tr>
<% end %>
<% end %>
<%
end
%>
<% end %>
</tbody>
</table>
</div>
</div>
<!-- <div class="card-footer"> -->
<table class="table m-b-20" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr align-right"><strong id="order-sub-total"><%=sub_total%></strong></td>
</tr>
</table>
<!-- </div> -->
</div>
<% @orders.each.with_index(0) do |order, order_index| %>
<% active_class = "" %>
<% if order_index == 0 %>
<% active_class = "active" %>
<% end %>
<div class="tab-pane <%= active_class %>" id="<%= order.order_id %>">
<div class="tab-pane" id="<%= order.order_id %>">
<div class="card-title">
<p class="m-l-2">Order Items</p>
</div>
@@ -150,6 +213,7 @@
<!-- Action Panel -->
<div>
<button type="button" class="btn bg-default btn-block waves-effect" id="back" ><i class="material-icons">reply</i> Back </button>
<button id="equal_split" class="btn btn-primary text-center action-btn waves-effect">= Split </button>
<button id="order_split" class="btn btn-primary text-center action-btn waves-effect">By Order &nbsp;</button>
<button id="order_item_split" class="btn btn-primary text-center action-btn waves-effect">By Order Item</button>
</div>
@@ -308,6 +372,15 @@
railBorderRadius: '0'
});
$('#order-detail-slimscroll-all_order').slimScroll({
height: height-$('#split-receipt-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0'
});
var orders = JSON.parse('<%= @orders.to_json.html_safe %>');
if(orders.length > 0){
$.each(orders, function(key,order){