update transaction

This commit is contained in:
Aung Myo
2017-11-14 15:48:22 +06:30
parent 937576856f
commit f927d99807
7 changed files with 58 additions and 30 deletions

View File

@@ -23,15 +23,6 @@
//= require bootstrap-notify/bootstrap-notify.js
//= require node-waves/waves.js
//= require sweetalert/sweetalert.min.js
//=require jquery-datatable/jquery.dataTables.js
//=require jquery-datatable/skin/bootstrap/js/dataTables.bootstrap.js
//=require jquery-datatable/extensions/export/dataTables.buttons.min.js
//=require jquery-datatable/extensions/export/buttons.flash.min.js
//=require jquery-datatable/extensions/export/jszip.min.js
//=require jquery-datatable/extensions/export/pdfmake.min.js
//=require jquery-datatable/extensions/export/vfs_fonts.js
//=require jquery-datatable/extensions/export/buttons.html5.min.js
//=require jquery-datatable/extensions/export/buttons.print.min.js
//= require autosize/autosize.js
//= require jquery-countto/jquery.countTo.js
//= require raphael/raphael.min
@@ -60,7 +51,7 @@ $(document).ready(function() {
$('.datepicker').bootstrapMaterialDatePicker({
format: 'DD-MM-YYYY',
clearButton: false,
clearButton: true,
weekStart: 1,
time: false
});
@@ -351,21 +342,7 @@ $(document).ready(function(){
}
});
});
$(function () {
$('.js-basic-example').DataTable({
responsive: true,
bLengthChange: false
});
//Exportable table
$('.js-exportable').DataTable({
dom: 'Bfrtip',
responsive: true,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
});
});

View File

@@ -5,7 +5,6 @@
@import "animate-css/animate";
@import "sweetalert/sweetalert.css";
@import "multi-select/css/multi-select.css";
@import "jquery-datatable/skin/bootstrap/css/dataTables.bootstrap.css";
@import "bootstrap-material-datetimepicker/css/bootstrap-material-datetimepicker";
@import "morrisjs/morris";
@import "fileinput.min";

View File

@@ -4,7 +4,22 @@ class Transactions::BookingsController < ApplicationController
def index
@bookings = Booking.all.order("booking_id desc")
filter = params[:filter]
from = params[:from]
to = params[:to]
if filter.nil? && from.nil? && to.nil?
@bookings = Booking.all.order("sale_id desc")
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2)
else
sale = Sale.search(filter,from,to)
if sale.count > 0
@bookings = sale
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2)
else
@bookings = 0
end
end
respond_to do |format|
format.html # index.html.erb

View File

@@ -145,6 +145,7 @@
// OK button is clicked
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
console.log(date);
$('#from').val(date.format("DD-MM-YYYY"))
search_by_date();
});

View File

@@ -10,10 +10,40 @@
<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 table-">
<tbody>
<tr>
<td colspan="8">
<%= form_tag transactions_orders_path, :method => :get do %>
<div class="row clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
<input type="text" name="receipt_no" class="form-control" placeholder="" style="margin-right: 10px">
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<label class=""><%= t("views.right_panel.detail.from") %></label>
<input class="form-control datepicker" name="from" id="from date" type="text" placeholder="From date">
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<label class=""><%= t("views.right_panel.detail.to") %></label>
<input class="form-control datepicker" name="to" id="to date" type="text" placeholder="To date">
</div>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
<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 js-basic-example dataTable">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th><%= t("views.right_panel.detail.booking_id") %></th>
@@ -48,6 +78,10 @@
<% end %>
</tbody>
</table>
<br>
<% if @bookings != 0 %>
<%= paginate @bookings %>
<% end %>
</div>
</div>
</div>

View File

@@ -100,7 +100,9 @@
</tbody>
</table>
<br>
<% if @sales != 0 %>
<%= paginate @sales %>
<% end %>
</div>
</div>
</div>

View File

@@ -73,7 +73,7 @@
</table>
<br>
<%if !@order.nil?%>
<%if !@orders.nil?%>
<%= paginate @orders %>
<%end%>
</div>