Files
sx-fc/app/views/transactions/order_reservations/index.html.erb
2020-09-09 17:19:07 +06:30

187 lines
9.6 KiB
Plaintext

<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t :order_reservation %></li>
<span class="float-right">
<%= link_to 'Back', root_path %>
</span>
</ol>
</div>
<style>
@media screen and (max-width: 785px) {
section.content{
margin: 80px 5px 0 5px !important;
}
}
</style>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="main-box-body clearfix p-l-5 p-r-5">
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td colspan="14">
<%= form_tag transactions_order_reservations_path, :method => :get do %>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 mbl-style">
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
<input type="text" id="filter" name="filter" class="form-control" placeholder="Status/Payment Type" style="margin-right: 10px;height: 34px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option>
<option value="1">Yesterday</option>
<option value="2">This week</option>
<option value="3">Last week</option>
<option value="4">Last 7 days</option>
<option value="5">This month</option>
<option value="6">Last month</option>
<option value="7">Last 30 days</option>
<option value="8">This year</option>
<option value="9">Last year</option>
</select>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 col-mbl-view mbl-style">
<label class="mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input class="form-control datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 col-mbl-view mbl-style">
<label class="mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input class="form-control datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
</div>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 mbl-right-btn mbl-style">
<label></label>
<br><input type="submit" value="Search" class='btn btn-primary btn-md'>
</div>
</div>
<% end %>
</td>
</tr>
</tbody>
</table>
</div>
<div class="card">
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th><%= t("views.right_panel.detail.order_reservation_id") %></th>
<th><%= t("views.right_panel.detail.sale_id") %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.requested_time") %></th>
<th><%= t("views.right_panel.detail.provider") %></th>
<th><%= t("views.right_panel.detail.status") %></th>
<th><%= t :payment_method %></th>
<th><%= t :payment %> <%= t("views.right_panel.detail.status")%></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.delivery_fee") %></th>
<th><%= t("views.right_panel.detail.convenience_charge") %></th>
<!-- <th><%= t("views.right_panel.detail.delivery_tax") %></th>
<th><%= t("views.right_panel.detail.convenience_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th> -->
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.transaction_fee") %></th>
</tr>
</thead>
<tbody>
<%
discount_amount = 0.0
delivery_fee = 0.0
convenience_charge = 0.0
delivery_tax = 0.0
convenience_tax = 0.0
commercial_tax = 0.0
%>
<% if @order_reservations != 0 %>
<% @order_reservations.each do |order_reservation| %>
<%
provider = ""
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
if !JSON.parse(order_reservation.taxes).nil? && !JSON.parse(order_reservation.taxes).empty?
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
end
end
%>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
elsif order_reservation.provider == 'direct_delivery'
provider = "Direct Delivery"
elsif order_reservation.provider == 'turbo'
provider = "TURBO"
else
provider = order_reservation.provider
end
%>
<tr>
<td>
<%= link_to order_reservation.order_reservation_id, transactions_order_reservation_path(order_reservation) %>
<td><%= link_to order_reservation.sale_id, transactions_sale_path(order_reservation.sale_id) rescue '-' %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.status %></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>
<td><%= number_format(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_format(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_format(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_format(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<!-- <td><%= number_format(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_format(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_format(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td> -->
<td><%= number_format(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_format(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
<td><%= number_format(order_reservation.transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
</td>
</tr>
<% end %>
<% else %>
<tr><td colspan="14"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
<% end %>
</tbody>
</table>
<br>
<% if @order_reservations != 0 %>
<%= paginate @order_reservations %>
<% end %>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
$('#from').val("<%= params[:from] %>");
$('#to').val("<%= params[:to] %>");
$('#sel_period').val("<%= params[:period] %>");
$('#filter').val("<%= params[:filter] %>");
});
</script>