update search

This commit is contained in:
Aung Myo
2017-06-14 00:11:03 +06:30
parent 3db6252304
commit 871c37f04e
8 changed files with 430 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
//= require jquery
//= require bootstrap
//= require jquery_ujs
//= require turbolinks
//= require cable
//= require jquery-ui
//= require bootstrap-datepicker

View File

@@ -0,0 +1,5 @@
@import "bootstrap";
@import "font-awesome";
@import "theme";
@import "jquery-ui";
@import "bootstrap-datepicker3";

View File

@@ -0,0 +1,32 @@
class Transactions::OrdersController < ApplicationController
def index
filter = params[:filter]
if filter.nil?
orders = Order.order("order_id desc")
else
order = Order.search(filter)
if order.count > 0
orders = order
else
orders = Order.order("order_id desc")
end
end
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @orders }
end
end
def show
@order = Order.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @order }
end
end
end

View File

@@ -0,0 +1,85 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= crm_customers_path %>">Customer</a>
</li>
<li class="active">Details
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<hr>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Contact no</th>
<th>Company</th>
<th>Date Of Birth</th>
<th>Membership Account</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @crm_customer.name %></td>
<td><%= @crm_customer.email %></td>
<td><%= @crm_customer.contact_no %></td>
<td><%= @crm_customer.company %></td>
<td><%= @crm_customer.date_of_birth %> </td>
</tr>
</tbody>
</table>
<br>
<h3>Sale Items</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Tax Price</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @sale_items.each do |sale_item| %>
<tr>
<td><%= sale_item.sale_id %></td>
<td><%= sale_item.product_name %></td>
<td><%= sale_item.qty %></td>
<td><%= sale_item.unit_price %></td>
<td><%= sale_item.taxable_price %></td>
<td><%= sale_item.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,68 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= transactions_orders_path %>">Order</a>
</li>
</ol>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td colspan="6">
<%= form_tag transactions_orders_path, :method => :get do %>
<div class="input-append form-group pull-right">
<input type="text" name="filter" placeholder="Order ID" class="form-control input-sm col-md-8">
<button type="submit" class="btn btn-primary btn-sm">Search</button>
</div>
<% end %>
</td>
</tr>
<tr>
<th>Order ID </th>
<th>Type</th>
<th>Customer</th>
<th>Order status</th>
<th>Order date</th>
<th>Items Count</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% @orders.each do |order| %>
<tr>
<td><%= order.order_id %></td>
<td><%= order.order_type %></td>
<td><%= order.customer.name rescue '-' %></td>
<td><%= order.status %></td>
<td> <%= order.date.strftime("%d-%m-%Y") %> </td>
<td> <%= order.item_count %> </td>
<td><%= link_to 'Show', transactions_order_path(order) %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= paginate @orders %>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,85 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_orders_path %>">Order</a>
</li>
<li class="active">
<a href="<%= settings_orders_path %>"><%= @order.order_id %></a>
</li>
</ol>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Type</th>
<th>Customer</th>
<th>Order status</th>
<th>Order date</th>
<th>Order By</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @order.order_type %></td>
<td><%= @order.customer.name rescue '-' %></td>
<td><%= @order.status %></td>
<td> <%= @order.date.strftime("%d-%m-%Y") %> </td>
<td> <%= @order.waiter rescue '-' %> </td>
</tr>
</tbody>
</table>
<h3>Order Items</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Item Name</th>
<th>Qty</th>
<th> Unit Price</th>
<th>Total Price</th>
<th>Option</th>
<th>Status</th>
<th>Order By</th>
<th>Created at</th>
</tr>
</thead>
<tbody>
<% @order.order_items.each do |order| %>
<tr>
<td><%= order.item_name %></td>
<td><%= order.qty %></td>
<td><%= order.price %></td>
<td><%= order.qty * order.price %></td>
<td> <%= order.options %> </td>
<td> <%= order.order_item_status %> </td>
<td> <%= order.item_order_by %> </td>
<td> <%= order.created_at.strftime("%d-%m-%Y") %> </td>
</tr>
<% end %>
</tbody>
</table>
<a href="<%= settings_orders_path%>" class="btn btn-primary pull-left">
<i class="fa fa-arrow-left fa-xs"></i> Back
</a>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,59 @@
<p id="notice"><%= notice %></p>
<h1>Transactions Sales</h1>
<table>
<thead>
<tr>
<th>Cashier</th>
<th>Cashier name</th>
<th>Requested by</th>
<th>Requested at</th>
<th>Receipt no</th>
<th>Receipt date</th>
<th>Customer</th>
<th>Payment status</th>
<th>Sale status</th>
<th>Total amount</th>
<th>Total discount</th>
<th>Total tax</th>
<th>Tax type</th>
<th>Grand total</th>
<th>Rounding adjustment</th>
<th>Amount received</th>
<th>Amount changed</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @transactions_sales.each do |transactions_sale| %>
<tr>
<td><%= transactions_sale.cashier %></td>
<td><%= transactions_sale.cashier_name %></td>
<td><%= transactions_sale.requested_by %></td>
<td><%= transactions_sale.requested_at %></td>
<td><%= transactions_sale.receipt_no %></td>
<td><%= transactions_sale.receipt_date %></td>
<td><%= transactions_sale.customer %></td>
<td><%= transactions_sale.payment_status %></td>
<td><%= transactions_sale.sale_status %></td>
<td><%= transactions_sale.total_amount %></td>
<td><%= transactions_sale.total_discount %></td>
<td><%= transactions_sale.total_tax %></td>
<td><%= transactions_sale.tax_type %></td>
<td><%= transactions_sale.grand_total %></td>
<td><%= transactions_sale.rounding_adjustment %></td>
<td><%= transactions_sale.amount_received %></td>
<td><%= transactions_sale.amount_changed %></td>
<td><%= link_to 'Show', transactions_sale %></td>
<td><%= link_to 'Edit', edit_transactions_sale_path(transactions_sale) %></td>
<td><%= link_to 'Destroy', transactions_sale, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Transactions Sale', new_transactions_sale_path %>

View File

@@ -0,0 +1,89 @@
<p id="notice"><%= notice %></p>
<p>
<strong>Cashier:</strong>
<%= @transactions_sale.cashier %>
</p>
<p>
<strong>Cashier name:</strong>
<%= @transactions_sale.cashier_name %>
</p>
<p>
<strong>Requested by:</strong>
<%= @transactions_sale.requested_by %>
</p>
<p>
<strong>Requested at:</strong>
<%= @transactions_sale.requested_at %>
</p>
<p>
<strong>Receipt no:</strong>
<%= @transactions_sale.receipt_no %>
</p>
<p>
<strong>Receipt date:</strong>
<%= @transactions_sale.receipt_date %>
</p>
<p>
<strong>Customer:</strong>
<%= @transactions_sale.customer %>
</p>
<p>
<strong>Payment status:</strong>
<%= @transactions_sale.payment_status %>
</p>
<p>
<strong>Sale status:</strong>
<%= @transactions_sale.sale_status %>
</p>
<p>
<strong>Total amount:</strong>
<%= @transactions_sale.total_amount %>
</p>
<p>
<strong>Total discount:</strong>
<%= @transactions_sale.total_discount %>
</p>
<p>
<strong>Total tax:</strong>
<%= @transactions_sale.total_tax %>
</p>
<p>
<strong>Tax type:</strong>
<%= @transactions_sale.tax_type %>
</p>
<p>
<strong>Grand total:</strong>
<%= @transactions_sale.grand_total %>
</p>
<p>
<strong>Rounding adjustment:</strong>
<%= @transactions_sale.rounding_adjustment %>
</p>
<p>
<strong>Amount received:</strong>
<%= @transactions_sale.amount_received %>
</p>
<p>
<strong>Amount changed:</strong>
<%= @transactions_sale.amount_changed %>
</p>
<%= link_to 'Edit', edit_transactions_sale_path(@transactions_sale) %> |
<%= link_to 'Back', transactions_sales_path %>