Files
sx-fc/app/views/crm/customers/show.html.erb
2017-11-17 11:47:42 +06:30

191 lines
7.7 KiB
Plaintext
Executable File

<div class="row">
<div class="col-lg-11 col-md-11 col-sm-11">
<!-- Column One -->
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-nav-right" role="tablist">
<li role="presentation" class="active nav-item">
<a class="nav-link" data-toggle="tab" href="#customer" ><%= t :customer_details %></a>
</li>
<li role="presentation" class="nav-item" >
<a class="nav-link" data-toggle="tab" href="#order" ><%= t :order_details %></a>
</li>
<li role="presentation" class="nav-item" >
<a class="nav-link" data-toggle="tab" href="#sale" ><%= t :sale_details %></a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="min-height:670px; max-height:670px; ">
<div class="tab-pane active" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; ">
<div class="table-responsive">
<br><br>
<table class="table table-striped">
<thead>
<tr>
<th><%= t("views.right_panel.detail.card_no") %></th>
<th><%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.company") %></th>
<th><%= t("views.right_panel.detail.contact_no") %></th>
<th><%= t("views.right_panel.detail.email") %></th>
<th><%= t("views.right_panel.detail.nrc_passport_no") %></th>
<th><%= t("views.right_panel.detail.address") %></th>
<th><%= t("views.right_panel.detail.dob") %></th>
<th><%= t("views.right_panel.detail.membership_type") %></th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @customer.card_no rescue '-'%></td>
<td><%= @customer.name %></td>
<td><%= @customer.company rescue '-' %></td>
<td><%= @customer.contact_no %></td>
<td><%= @customer.email %></td>
<td><%= @customer.nrc_no rescue '-' %></td>
<td><%= @customer.address rescue '-'%></td>
<td><%= @customer.date_of_birth rescue '-'%></td>
<% if @customer.membership_type.to_f > 0%>
<td><%lookup= Lookup.find_by_value(@customer.membership_type) %>
<%= lookup.name %>
</td>
<%else%>
<td>-</td>
<%end%>
</tr>
<tr><th colspan="9"></th></tr>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th><%= t("views.right_panel.detail.date") %></th>
<!-- <th>Redeem</th> -->
<th><%= t("views.right_panel.detail.amount") %></th>
<!-- <th>Balance</th> -->
<th><%= t("views.right_panel.detail.status") %></th>
<th><%= t("views.right_panel.detail.from_account") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
</tr>
</thead>
<tbody>
<% if @response["status"] == true %>
<% @response["data"].each do |transaction| %>
<tr>
<td><%= transaction["date"]%></td>
<% if transaction["status"] == 'Rebate' || transaction["status"] == 'Discount'%>
<td><%= transaction["deposit"] %></td>
<% else %>
<td>(<%= transaction["withdraw"] %>)</td>
<% end %>
<td><%= transaction["status"] %></td>
<td><%= transaction["account_status"] %></td>
<td><%= transaction["receipt_no"] %></td>
</tr>
<% end %>
<% if @response["data"].first["status"] != 'Discount'%>
<tr >
<th>Balance</th>
<th>
<%= @response["data"].first["balance"] %>
</th>
</tr>
<%end%>
<%else%>
<tr><td colspan="5"><p class="align-center">There is no transaction coz of <%=@response["data"]%> ...</p></td></tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="order" role="tabpanel" style="min-height:670px; max-height:670px; ">
<h5><%= t :order_details %></h5>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th><%= t("views.right_panel.detail.order_id") %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.order_status") %></th>
<th><%= t("views.right_panel.detail.order_date") %></th>
<th><%= t("views.right_panel.detail.items_count") %></th>
</tr>
</thead>
<tbody>
<% @orders.each do |order| %>
<tr>
<td><%= link_to order.order_id, transactions_order_path(order) %></td>
<td><%= order.order_type %></td>
<td><%= order.status %></td>
<td><%= order.date.strftime("%d-%m-%Y %I:%m %p") %> </td>
<td><%= order.item_count %> </td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="sale" role="tabpanel" style="min-height:670px; max-height:670px; ">
<h5><%= t :sale_details %></h5>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th><%= t("views.right_panel.detail.sale_id") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t("views.right_panel.detail.total_discount") %></th>
<th><%= t("views.right_panel.detail.tax_amount") %></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t :cashier %></th>
<th><%= t("views.right_panel.detail.sales_status") %></th>
<th><%= t("views.right_panel.detail.receipt_date") %></th>
</tr>
</thead>
<tbody>
<% @sales.each do |sale| %>
<tr>
<td><%= link_to sale.sale_id, transactions_sale_path(sale) %></td>
<td><%= sale.receipt_no %></td>
<td><%= sale.total_discount %></td>
<td><%= sale.total_tax %></td>
<td><%= sale.total_amount %></td>
<td><%= sale.grand_total rescue '-' %></td>
<td><%= sale.cashier_name rescue '-' %></td>
<td> <%= sale.sale_status %> </td>
<td> <%= sale.receipt_date.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> </td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<a href="<%= crm_customers_path%>" class="btn btn-default btn-sm">
<i class="material-icons">reply</i><%= t("views.btn.back") %>
</a>
</div>
</div>