Enhance interface
This commit is contained in:
11
resources/views/components/button-cancel.blade.php
Normal file
11
resources/views/components/button-cancel.blade.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<button @if (isset($type))type="{{ $type }}"@else type="button"@endif class="btn btn-secondary cancel @if (isset($class)){{ $class }}@endif" @if (isset($id_name)) id="{{ $id_name }}"@endif>
|
||||
<i class="fa fa-fw fa-ban"></i> {{ __('cancel') }}
|
||||
</button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('.form-buttons .cancel').click(function() {
|
||||
window.history.back();
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,4 +1,13 @@
|
||||
<div id="{{ $model }}-datatable-content">
|
||||
@include('components.datatables.header')
|
||||
{{$dataTable->table(['class'=>'table table-bordered table-hover table-striped w-100'])}}
|
||||
</div>
|
||||
{{$dataTable->table(['class'=>'table table-bordered table-hover table-striped w-100 mb-0'])}}
|
||||
</div>
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/datatables.min.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('assets/plugins/datatables.min.js') }}"></script>
|
||||
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
||||
@endpush
|
||||
@@ -1,10 +1,11 @@
|
||||
<button type="button" class="btn bg-gradient-info btn-add"><i class="fa fa-plus-circle"></i></button>
|
||||
<button type="button" class="btn bg-primary btn-add"><i class="fa fa-plus-circle"></i></button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('#{{ $model }}-table-header .btn-add').click(function() {
|
||||
url = '{{ $route }}' + '/create/';
|
||||
window.location = url;
|
||||
// openUrl(url);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<button type="button" class="btn bg-gradient-secondary btn-colvis" style="border-left: 1px solid rgba(0,0,0,0.1);">
|
||||
<i class="fa fa-columns"></i>
|
||||
</button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
var $colvis = $('#{{ $model }}-table-header .btn-colvis');
|
||||
|
||||
$colvis.on( 'click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
// table.search($search.val()).draw();
|
||||
buttons = table.buttons();
|
||||
console.log(table.button('colvis'));
|
||||
console.log(buttons);
|
||||
/*
|
||||
for (var i = buttons.length - 1; i >= 0; i--) {
|
||||
console.log(buttons[i]);
|
||||
}
|
||||
*/
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,30 @@
|
||||
<span>
|
||||
<button type="button" class="btn bg-gradient-secondary dropdown-toggle btn-excel" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-download"></i>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
<li class="dropdown-item excelWithFilter"><a href="#"><i class="fa fa-file-excel"></i> Exporter la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/exportExcel"><i class="fa fa-file-excel"></i> Exporter la liste complète</a></li>
|
||||
<li class="dropdown-item"><a href="#"><i class="fa fa-file-pdf"></i> Exporter la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/exportPDF"><i class="fa fa-file-pdf"></i> Exporter la liste complète</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('.excelWithFilter').click(function() {
|
||||
/*
|
||||
var data = $('#filters').serializeJSON();
|
||||
var query = encodeURIComponent(JSON.stringify(data));
|
||||
console.log(data);
|
||||
console.log(query);
|
||||
var url = "{{ $route }}/exportExcel?filters=" + query;
|
||||
console.log(url);
|
||||
*/
|
||||
var data = $('#filters').serialize();
|
||||
var url = "{{ $route }}/exportExcel?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,8 @@
|
||||
<button type="button" class="btn bg-gradient-secondary dropdown-toggle btn-excel" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-file-excel"></i>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
<li class="dropdown-item"><a href="#">Exporter la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/export">Exporter la liste complète</a></li>
|
||||
</ul>
|
||||
@@ -1,14 +1,6 @@
|
||||
<div class="datatable-export-buttons">
|
||||
|
||||
<button type="button" class="btn bg-gradient-secondary btn-print" data-placement="top" data-original-title="Imprimer le tableau">
|
||||
<i class="fa fa-print"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn bg-gradient-secondary btn-excel">
|
||||
<i class="fa fa-file-excel"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn bg-gradient-secondary btn-pdf">
|
||||
<i class="fa fa-file-pdf"></i>
|
||||
</button>
|
||||
@include('components.datatables.buttons.print')
|
||||
@include('components.datatables.buttons.download')
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<button type="button" class="btn bg-gradient-secondary btn-filter" data-toggle="modal" data-target="#modal-filters">
|
||||
<i class="fa fa-filter"></i>
|
||||
<span class="badge badge-info"></span>
|
||||
</button>
|
||||
|
||||
@push('js')
|
||||
@@ -8,7 +7,7 @@
|
||||
var $filter = $('#{{ $model }}-table-header .btn-filter');
|
||||
|
||||
$('#modal-filters').on('shown.bs.modal', function () {
|
||||
// initSelect2();
|
||||
initSelect2();
|
||||
});
|
||||
|
||||
$('#modal-filters .apply').click(function() {
|
||||
@@ -16,5 +15,25 @@
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
table.draw();
|
||||
})
|
||||
|
||||
$('#modal-filters .reset').click(function() {
|
||||
$('#filters').trigger("reset");
|
||||
$('#filters .select2').val(null).trigger("change");
|
||||
})
|
||||
|
||||
|
||||
/*
|
||||
$filter.on( 'click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
// table.search($search.val()).draw();
|
||||
openModal('{{ __('Filters') }}', '{{ $route }}/getFiltersHtml', {
|
||||
onApply: function() {
|
||||
filters = $('#filters').serialize();
|
||||
console.log(filters);
|
||||
table.draw();
|
||||
}
|
||||
});
|
||||
} );
|
||||
*/
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,2 +1,14 @@
|
||||
@include('components.select', ['name' => 'pager', 'list' => ['5', '10','25', '50', '100']])
|
||||
@include('components.select', ['name' => 'pager', 'id_name'=> $model . '_pager', 'list' => [5 => '5', 10 => '10', 25 => '25', 50 => '50', 100 => '100']])
|
||||
|
||||
|
||||
@push('js')
|
||||
|
||||
<script>
|
||||
$('#{{ $model }}_pager').change(function() {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
var len = $(this).val();
|
||||
table.page.len(len).draw();
|
||||
});
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
@@ -0,0 +1,3 @@
|
||||
<button type="button" class="btn bg-gradient-secondary btn-pdf">
|
||||
<i class="fa fa-file-pdf"></i>
|
||||
</button>
|
||||
@@ -0,0 +1,21 @@
|
||||
<span>
|
||||
<button type="button" class="btn bg-gradient-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-print"></i>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
<li class="dropdown-item btn-print"><a href="#">Imprimer la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/print">Imprimer la liste complète</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
var $print = $('#{{ $model }}-table-header .btn-print');
|
||||
$print.on( 'click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
table.button(1).trigger();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<button type="button" class="btn btn-sm bg-gradient-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-cog"></i>
|
||||
</button>
|
||||
|
||||
<div class="dropdown-menu text-right" x-placement="bottom-start">
|
||||
<a class="dropdown-item btn-view"><i class="fa fa-eye" data-tooltip="{{ __('view') }}"></i></a>
|
||||
<a class="dropdown-item btn-edit"><i class="fa fa-pencil-alt" data-tooltip="{{ __('edit') }}"></i></a>
|
||||
<a class="dropdown-item btn-del"><i class="fa fa-trash-alt" data-tooltip="{{ __('delete') }}"></i></a>
|
||||
</div>
|
||||
@@ -1,10 +1,12 @@
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
@include('components.datatables.buttons.pageLength')
|
||||
<span class="input-group-text"><i class="fa fa-search"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control search-btn" placeholder="Rechercher..." value="">
|
||||
<div class="input-group-append">
|
||||
@include('components.datatables.buttons.filters')
|
||||
@include('components.datatables.buttons.colvis')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
$.extend( true, $.fn.dataTable.defaults, {
|
||||
language: {
|
||||
url: "/assets/vendor/boilerplate/js/datatables/i18n/French.json"
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -11,30 +11,44 @@
|
||||
<script>
|
||||
|
||||
$('#{{ $model }}-table').on( 'draw.dt', function () {
|
||||
$('.btn-edit').click(function() {
|
||||
url = '{{ $route }}' + '/edit/' + $(this).data('id');
|
||||
window.location = url;
|
||||
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
|
||||
$('.btn-edit').off('click').click(function() {
|
||||
var id = table.row(this).id();
|
||||
url = '{{ $route }}' + '/edit/' + id;
|
||||
openURL(url);
|
||||
});
|
||||
|
||||
$('.btn-show').off('click').click(function() {
|
||||
|
||||
var id = table.row(this).id();
|
||||
url = '{{ $route }}' + '/show/' + id;
|
||||
openURL(url);
|
||||
});
|
||||
|
||||
$('.btn-del').on('click', '.destroy', function (e) {
|
||||
$('.btn-del').off('click').click(function (e) {
|
||||
e.preventDefault();
|
||||
var id = table.row(this).id();
|
||||
|
||||
bootbox.confirm("{{ __('boilerplate::shop.admin.confirmdelete') }}", function (result) {
|
||||
bootbox.confirm("{{ __('admin.confirmdelete') }}", function (result) {
|
||||
if (result === false) return;
|
||||
|
||||
$.ajax({
|
||||
url: href,
|
||||
url: '{{ $route }}' + '/destroy/' + id,
|
||||
method: 'delete',
|
||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||
success: function(){
|
||||
line.remove();
|
||||
growl("{{ __('boilerplate::shop.admin.deletesuccess') }}", 'success');
|
||||
table.draw();
|
||||
growl("{{ __('admin.deletesuccess') }}", 'success');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
// datatablesHelper.getDatatableLength('{{ $model }}', 34);
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<div class="row pt-3 pb-5">
|
||||
<div class="row pt-0 pb-3">
|
||||
<div class="col-12">
|
||||
<div class="text-right mt-3">
|
||||
<div class="text-right form-buttons">
|
||||
@include('components.button-cancel')
|
||||
@include('components.button-save')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<select
|
||||
name="{{ $name }}"
|
||||
@if (isset($id_name))id="{{ $id_name }}"@endif
|
||||
class="@if (isset($class)){{ $class }} @else form-control @endif"
|
||||
class="form-control @if (isset($class)){{ $class }} @endif"
|
||||
@if (isset($style))style="{{ $style }}" @endif
|
||||
@if (isset($required))required="required"@endif
|
||||
@if (isset($multiple))multiple="multiple"@endif
|
||||
@if (isset($meta)){{ $meta }}@endif
|
||||
>
|
||||
@if (isset($with_empty))
|
||||
<option>{{ $with_empty }}</option>
|
||||
<option value=''>{{ $with_empty }}</option>
|
||||
@endif
|
||||
|
||||
@include('components.options')
|
||||
|
||||
Reference in New Issue
Block a user