Fix some enhancements & new features
This commit is contained in:
@@ -5,9 +5,7 @@
|
||||
])
|
||||
|
||||
@section('content')
|
||||
@include('components.datatable', ['route' => route('Botanic.Admin.Families.create'), 'label' => __('Botanic.families.add')])
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Botanic/Admin/Families', 'model' => 'families'])
|
||||
@endpush
|
||||
@component('components.card')
|
||||
@include('components.datatable', ['route' => route('Botanic.Admin.Families.index'), 'model' => 'families'])
|
||||
@endcomponent
|
||||
@endsection
|
||||
@@ -5,10 +5,8 @@
|
||||
])
|
||||
|
||||
@section('content')
|
||||
@include('components.datatable', ['route' => route('Botanic.Admin.Genres.create'), 'label' => __('Botanic.genres.add')])
|
||||
@component('components.card')
|
||||
@include('components.datatable', ['route' => route('Botanic.Admin.Genres.index'), 'model' => 'BotanicGenres'])
|
||||
@endcomponent
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Botanic/Admin/Genres', 'model' => 'genres'])
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
])
|
||||
|
||||
@section('content')
|
||||
@include('components.datatable', ['route' => route('Botanic.Admin.Species.create'), 'label' => __('Botanic.species.add')])
|
||||
@component('components.card')
|
||||
@include('components.datatable', ['route' => route('Botanic.Admin.Species.index'), 'model' => 'BotanicSpecies'])
|
||||
@endcomponent
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Botanic/Admin/Species', 'model' => 'species'])
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
])
|
||||
|
||||
@section('content')
|
||||
@include('components.datatable', ['route' => route('Botanic.Admin.Varieties.create'), 'label' => __('Botanic.varieties.add')])
|
||||
@component('components.card')
|
||||
@include('components.datatable', ['route' => route('Botanic.Admin.Varieties.index'), 'model' => 'BotanicVarieties'])
|
||||
@endcomponent
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Botanic/Admin/Varieties', 'model' => 'varieties'])
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('Shop.article_attributes.title'),
|
||||
'subtitle' => __('Shop.article_attributes.list'),
|
||||
'breadcrumb' => [__('Shop.article_attributes.title')]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.select2')
|
||||
|
||||
@section('content')
|
||||
|
||||
<nav>
|
||||
<div class="nav nav-tabs">
|
||||
<a href="#families" data-toggle="tab" class="nav-item nav-link active" role="tab" aria-controls="families" aria-selected="true">
|
||||
{{ __('Shop.article_attribute_families.title') }}
|
||||
</a>
|
||||
<a href="#values" data-toggle="tab" class="nav-item nav-link" role="tab" aria-controls="values" aria-selected="false">
|
||||
{{ __('Shop.article_attribute_values.title') }}
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="tab-content mb-0">
|
||||
|
||||
<div class="tab-pane fade show active" id="families">
|
||||
@component('components.card')
|
||||
@include('components.datatable', ['route' => route('Shop.Admin.ArticleAttributeFamilies.index'), 'model' => 'ArticleAttributeFamilies'])
|
||||
@endcomponent
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="values">
|
||||
@component('components.card')
|
||||
@include('components.datatable', ['route' => route('Shop.Admin.ArticleAttributeValues.index'), 'model' => 'ArticleAttributeValues'])
|
||||
@endcomponent
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@@ -14,7 +14,3 @@
|
||||
@endcomponent
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => route('Shop.Admin.ArticleAttributeValues.index'), 'model' => 'articleattributevalues'])
|
||||
@endpush
|
||||
@@ -1,13 +1,10 @@
|
||||
@include('load.datatables')
|
||||
|
||||
<div id="{{ $model }}-datatable-content">
|
||||
@include('components.datatables.header')
|
||||
{{$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>
|
||||
@push('js')
|
||||
@include('components.js.datatable', ['route' => $route, 'model' => $model])
|
||||
@endpush
|
||||
@@ -8,10 +8,28 @@
|
||||
|
||||
$colvis.on( 'click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
console.log(table);
|
||||
|
||||
console.log(table.column(1).dataSrc());
|
||||
var header = table.column(1).header();
|
||||
console.log($(header).html());
|
||||
var visible = table.column(1).visible();
|
||||
console.log(visible);
|
||||
|
||||
/*
|
||||
// var names = table.columns().names();
|
||||
columns = table.columns();
|
||||
console.log(columns);
|
||||
|
||||
var names = columns.names();
|
||||
console.log(names);
|
||||
|
||||
// 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]);
|
||||
|
||||
@@ -4,27 +4,25 @@
|
||||
</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="#" class="excelWithFilter"><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>
|
||||
<div class="dropdown-divider"></div>
|
||||
<li class="dropdown-item"><a href="#" class="pdfWithFilter"><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
|
||||
<script>
|
||||
$('.excelWithFilter').click(function() {
|
||||
var data = $('#filters').serialize();
|
||||
var url = "{{ $route }}/exportExcel?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
$('.pdfWithFilter').click(function() {
|
||||
var data = $('#filters').serialize();
|
||||
var url = "{{ $route }}/exportPDF?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<div class="datatable-export-buttons">
|
||||
|
||||
@include('components.datatables.buttons.print')
|
||||
@include('components.datatables.buttons.download')
|
||||
|
||||
@if (isset($with_exports) && $with_exports)
|
||||
@include('components.datatables.buttons.download')
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
</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>
|
||||
<li class="dropdown-item printWithFilter"><a href="#" target="_BLANK">Imprimer la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/print" target="_BLANK">Imprimer la liste complète</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
table.button(1).trigger();
|
||||
});
|
||||
|
||||
$('.printWithFilter').click(function() {
|
||||
var data = $('#filters').serialize();
|
||||
var url = "{{ $route }}/print?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -3,11 +3,17 @@
|
||||
@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>
|
||||
<input type="text" class="form-control search-btn" placeholder="Rechercher..." value="">
|
||||
@if ((isset($with_filters) and $with_filters) || (isset($with_colvis) and $with_colvis))
|
||||
<div class="input-group-append">
|
||||
@if (isset($with_filters) && $with_filters)
|
||||
@include('components.datatables.buttons.filters')
|
||||
@endif
|
||||
@if (isset($with_colvis) && $with_colvis)
|
||||
@include('components.datatables.buttons.colvis')
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
@@ -15,7 +21,7 @@
|
||||
var $search = $('#{{ $model }}-table-header .search-btn');
|
||||
$search.on( 'keyup click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
table.search($search.val()).draw();
|
||||
} );
|
||||
table.search($search.val()).draw();
|
||||
} );
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,11 +1,3 @@
|
||||
<script>
|
||||
$.extend( true, $.fn.dataTable.defaults, {
|
||||
language: {
|
||||
url: "/assets/vendor/boilerplate/js/datatables/i18n/French.json"
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
{{$dataTable->scripts()}}
|
||||
|
||||
<script>
|
||||
@@ -14,22 +6,27 @@
|
||||
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
|
||||
$('.btn-edit').off('click').click(function() {
|
||||
var id = table.row(this).id();
|
||||
$('.btn-edit').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
url = '{{ $route }}' + '/edit/' + id;
|
||||
console.log(url);
|
||||
openURL(url);
|
||||
});
|
||||
|
||||
$('.btn-show').off('click').click(function() {
|
||||
|
||||
var id = table.row(this).id();
|
||||
$('.btn-show').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
url = '{{ $route }}' + '/show/' + id;
|
||||
openURL(url);
|
||||
});
|
||||
|
||||
$('.btn-del').off('click').click(function (e) {
|
||||
e.preventDefault();
|
||||
var id = table.row(this).id();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
|
||||
bootbox.confirm("{{ __('admin.confirmdelete') }}", function (result) {
|
||||
if (result === false) return;
|
||||
@@ -39,7 +36,7 @@
|
||||
method: 'delete',
|
||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||
success: function(){
|
||||
line.remove();
|
||||
// line.remove();
|
||||
table.draw();
|
||||
growl("{{ __('admin.deletesuccess') }}", 'success');
|
||||
}
|
||||
|
||||
@@ -44,9 +44,7 @@
|
||||
<script src="{{ mix('/admin-lte.min.js', '/assets/vendor/boilerplate') }}"></script>
|
||||
<script src="{{ mix('/boilerplate.min.js', '/assets/vendor/boilerplate') }}"></script>
|
||||
|
||||
<script src="/js/datatables.min.js"></script>
|
||||
<script src="/js/main.min.js"></script>
|
||||
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
||||
@stack('scripts')
|
||||
<script>
|
||||
$.ajaxSetup({headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'}});
|
||||
|
||||
23
resources/views/load/datatables.blade.php
Normal file
23
resources/views/load/datatables.blade.php
Normal file
@@ -0,0 +1,23 @@
|
||||
@if(!defined('LOAD_DATATABLES'))
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('css/datatables.min.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('js/datatables.min.js') }}"></script>
|
||||
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$.extend( true, $.fn.dataTable.defaults, {
|
||||
language: {
|
||||
url: "/assets/vendor/boilerplate/js/datatables/i18n/French.json"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_DATATABLES', true))
|
||||
|
||||
@endif
|
||||
Reference in New Issue
Block a user