Date filter added income, expense, banking
This commit is contained in:
parent
2f4911dd67
commit
a355f56e4f
@ -28,4 +28,13 @@ class Transactions extends ModelFilter
|
||||
|
||||
return $this->where('category_id', $category_id);
|
||||
}
|
||||
|
||||
public function date($date)
|
||||
{
|
||||
$dates = explode('_', $date);
|
||||
$dates[0] .= ' 00:00:00';
|
||||
$dates[1] .= ' 23:59:59';
|
||||
|
||||
return $this->whereBetween('paid_at', $dates);
|
||||
}
|
||||
}
|
@ -23,4 +23,13 @@ class Transfers extends ModelFilter
|
||||
{
|
||||
return $this->related('revenue', 'revenues.account_id', '=', $account_id);
|
||||
}
|
||||
|
||||
public function date($date)
|
||||
{
|
||||
$dates = explode('_', $date);
|
||||
$dates[0] .= ' 00:00:00';
|
||||
$dates[1] .= ' 23:59:59';
|
||||
|
||||
return $this->whereBetween('paid_at', $dates);
|
||||
}
|
||||
}
|
||||
|
@ -28,4 +28,13 @@ class Bills extends ModelFilter
|
||||
{
|
||||
return $this->where('bill_status_code', $status);
|
||||
}
|
||||
|
||||
public function billDate($date)
|
||||
{
|
||||
$dates = explode('_', $date);
|
||||
$dates[0] .= ' 00:00:00';
|
||||
$dates[1] .= ' 23:59:59';
|
||||
|
||||
return $this->whereBetween('billed_at', $dates);
|
||||
}
|
||||
}
|
@ -33,4 +33,13 @@ class Payments extends ModelFilter
|
||||
{
|
||||
return $this->where('account_id', $account);
|
||||
}
|
||||
|
||||
public function date($date)
|
||||
{
|
||||
$dates = explode('_', $date);
|
||||
$dates[0] .= ' 00:00:00';
|
||||
$dates[1] .= ' 23:59:59';
|
||||
|
||||
return $this->whereBetween('paid_at', $dates);
|
||||
}
|
||||
}
|
@ -28,4 +28,13 @@ class Invoices extends ModelFilter
|
||||
{
|
||||
return $this->where('invoice_status_code', $status);
|
||||
}
|
||||
|
||||
public function invoiceDate($date)
|
||||
{
|
||||
$dates = explode('_', $date);
|
||||
$dates[0] .= ' 00:00:00';
|
||||
$dates[1] .= ' 23:59:59';
|
||||
|
||||
return $this->whereBetween('invoiced_at', $dates);
|
||||
}
|
||||
}
|
@ -33,4 +33,13 @@ class Revenues extends ModelFilter
|
||||
{
|
||||
return $this->where('account_id', $account);
|
||||
}
|
||||
|
||||
public function date($date)
|
||||
{
|
||||
$dates = explode('_', $date);
|
||||
$dates[0] .= ' 00:00:00';
|
||||
$dates[1] .= ' 23:59:59';
|
||||
|
||||
return $this->whereBetween('paid_at', $dates);
|
||||
}
|
||||
}
|
7
public/css/app.css
vendored
7
public/css/app.css
vendored
@ -46,6 +46,7 @@
|
||||
|
||||
.btn-filter {
|
||||
margin-bottom: 1px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.setting-buttons {
|
||||
@ -729,3 +730,9 @@ input[type="number"] {
|
||||
#role-permissions .nav-tabs-custom .tab-content .form-group.col-md-12 .col-md-3 .input-checkbox {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.btn-filter.date-range-btn {
|
||||
background-color: inherit;
|
||||
border-radius: 0px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
19
public/js/app.js
vendored
19
public/js/app.js
vendored
@ -291,3 +291,22 @@ $(document).on('change', '.input-group-recurring #recurring_frequency', function
|
||||
recurring_count.removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
function convertDateFormat(date, split_character) {
|
||||
var result = [];
|
||||
var formats = {
|
||||
'd': 'DD',
|
||||
'M': 'MMM',
|
||||
'Y': 'YYYY',
|
||||
'F': 'MMMM',
|
||||
'm': 'MM'
|
||||
};
|
||||
|
||||
dates = date.split(split_character);
|
||||
|
||||
dates.forEach(function(value) {
|
||||
result.push(formats[value]);
|
||||
});
|
||||
|
||||
return result.join(split_character);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
{!! Form::select('account', $accounts, request('account'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('type', $types, request('type'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('category', $categories, request('category'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::dateRange('date', trans('general.date'), 'calendar', []) !!}
|
||||
{!! Form::button('<span class="fa fa-filter"></span> ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
@ -58,3 +59,15 @@
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/moment.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
|
||||
@endpush
|
||||
|
@ -17,6 +17,7 @@
|
||||
<span class="title-filter hidden-xs">{{ trans('general.search') }}:</span>
|
||||
{!! Form::select('from_account', $accounts, request('from_account'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('to_account', $accounts, request('to_account'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::dateRange('date', trans('general.date'), 'calendar', []) !!}
|
||||
{!! Form::button('<span class="fa fa-filter"></span> ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
@ -74,3 +75,15 @@
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/moment.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
|
||||
@endpush
|
||||
|
@ -20,6 +20,7 @@
|
||||
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
|
||||
{!! Form::select('vendor', $vendors, request('vendor'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('status', $statuses, request('status'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::dateRange('bill_date', trans('bills.bill_date'), 'calendar', []) !!}
|
||||
{!! Form::button('<span class="fa fa-filter"></span> ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
@ -88,3 +89,15 @@
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/moment.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
|
||||
@endpush
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
{!! Form::select('vendor', $vendors, request('vendor'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('category', $categories, request('category'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('account', $accounts, request('account'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::dateRange('date', trans('general.date'), 'calendar', []) !!}
|
||||
{!! Form::button('<span class="fa fa-filter"></span> ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
@ -87,3 +88,15 @@
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/moment.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
|
||||
@endpush
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
|
||||
{!! Form::select('customer', $customers, request('customer'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('status', $status, request('status'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::dateRange('order_number', trans('invoices.order_number'), 'shopping-cart', []) !!}
|
||||
{!! Form::dateRange('invoice_date', trans('invoices.invoice_date'), 'calendar', []) !!}
|
||||
{!! Form::button('<span class="fa fa-filter"></span> ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
@ -87,3 +87,16 @@
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/moment.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
|
||||
@endpush
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
{!! Form::select('customer', $customers, request('customer'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('category', $categories, request('category'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('account', $accounts, request('account'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::dateRange('date', trans('general.date'), 'calendar', []) !!}
|
||||
{!! Form::button('<span class="fa fa-filter"></span> ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
@ -87,3 +88,15 @@
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/moment.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
|
||||
@endpush
|
||||
|
||||
|
@ -1,30 +1,46 @@
|
||||
<div class="input-group">
|
||||
<button type="button" class="btn btn-default pull-right" id="daterange-btn">
|
||||
<span>
|
||||
<i class="fa fa-calendar"></i> Date range picker
|
||||
</span>
|
||||
<i class="fa fa-caret-down"></i>
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-default btn-filter date-range-btn">
|
||||
<span>
|
||||
<i class="fa fa-{{ $icon }}"></i> {{ $text }}
|
||||
</span>
|
||||
<i class="fa fa-caret-down"></i>
|
||||
{!! Form::hidden($name, null, []) !!}
|
||||
</button>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#daterange-btn').daterangepicker(
|
||||
{
|
||||
ranges : {
|
||||
'Today' : [moment(), moment()],
|
||||
'Yesterday' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month' : [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
},
|
||||
startDate: moment().subtract(29, 'days'),
|
||||
endDate : moment()
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.date-range-btn').daterangepicker(
|
||||
{
|
||||
ranges : {
|
||||
'Today' : [moment(), moment()],
|
||||
'Yesterday' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month' : [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
},
|
||||
function (start, end) {
|
||||
$('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
|
||||
}
|
||||
)
|
||||
})
|
||||
startDate: moment().subtract(29, 'days'),
|
||||
endDate : moment()
|
||||
},
|
||||
function (start, end) {
|
||||
$('input[name={{ $name }}]').val(start.format('YYYY-MM-DD') + '_' + end.format('YYYY-MM-DD'));
|
||||
|
||||
date_format = convertDateFormat('{{ setting('general.date_format') }}', ' ');
|
||||
$('.date-range-btn span').html(start.format(date_format) + ' - ' + end.format(date_format));
|
||||
}
|
||||
);
|
||||
|
||||
@if(request($name))
|
||||
var setDate = '{{ request($name) }}';
|
||||
var setDates = setDate.split('_');
|
||||
|
||||
date_format = convertDateFormat('{{ setting('general.date_format') }}', ' ');
|
||||
|
||||
start_date = moment(setDates[0], 'YYYY-MM-DD'); //new Date(setDates[0]);
|
||||
finish_date = moment(setDates[1], 'YYYY-MM-DD'); //new Date(setDates[1]);
|
||||
|
||||
$('.date-range-btn span').html(start_date.format(date_format) + ' - ' + finish_date.format(date_format));
|
||||
@endif
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
Loading…
x
Reference in New Issue
Block a user