From fcd26d13de3101e750ba75dee797b94acdf9d036 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Thu, 16 Jul 2020 15:48:31 +0200 Subject: [PATCH] Enhance interface --- .../partials/prices/block_attribute.blade.php | 4 +-- .../partials/prices/block_price.blade.php | 35 ++++++++++++------- .../views/components/button-cancel.blade.php | 11 ++++++ .../views/components/datatable.blade.php | 13 +++++-- .../datatables/buttons/add.blade.php | 3 +- .../datatables/buttons/colvis.blade.php | 22 ++++++++++++ .../datatables/buttons/download.blade.php | 30 ++++++++++++++++ .../datatables/buttons/excel.blade.php | 8 +++++ .../datatables/buttons/exports.blade.php | 14 ++------ .../datatables/buttons/filters.blade.php | 23 ++++++++++-- .../datatables/buttons/pageLength.blade.php | 14 +++++++- .../datatables/buttons/pdf.blade.php | 3 ++ .../datatables/buttons/print.blade.php | 21 +++++++++++ .../datatables/buttons/row_action.blade.php | 9 +++++ .../components/datatables/search.blade.php | 2 ++ .../views/components/js/datatable.blade.php | 32 ++++++++++++----- resources/views/components/save.blade.php | 5 +-- resources/views/components/select.blade.php | 5 ++- 18 files changed, 208 insertions(+), 46 deletions(-) create mode 100644 resources/views/components/button-cancel.blade.php create mode 100644 resources/views/components/datatables/buttons/colvis.blade.php create mode 100644 resources/views/components/datatables/buttons/download.blade.php create mode 100644 resources/views/components/datatables/buttons/excel.blade.php create mode 100644 resources/views/components/datatables/buttons/pdf.blade.php create mode 100644 resources/views/components/datatables/buttons/print.blade.php create mode 100644 resources/views/components/datatables/buttons/row_action.blade.php diff --git a/resources/views/Shop/Admin/Articles/partials/prices/block_attribute.blade.php b/resources/views/Shop/Admin/Articles/partials/prices/block_attribute.blade.php index c4930b77..d156e1e4 100644 --- a/resources/views/Shop/Admin/Articles/partials/prices/block_attribute.blade.php +++ b/resources/views/Shop/Admin/Articles/partials/prices/block_attribute.blade.php @@ -3,7 +3,7 @@ -
+
{{ Form::label('attribute_family_id', 'Attributs') }}
@include('components.select', [ 'name' => "prices[$key][attributes][attribute_family_id]", @@ -14,7 +14,7 @@ ])
-
+
{{ Form::label('attribute_value_id', 'Valeur') }}
@include('components.select', [ 'name' => "prices[$key][attributes][attribute_value_id]", diff --git a/resources/views/Shop/Admin/Articles/partials/prices/block_price.blade.php b/resources/views/Shop/Admin/Articles/partials/prices/block_price.blade.php index 86e0a284..8adde3ba 100644 --- a/resources/views/Shop/Admin/Articles/partials/prices/block_price.blade.php +++ b/resources/views/Shop/Admin/Articles/partials/prices/block_price.blade.php @@ -8,27 +8,36 @@
- {{ Form::label('quantity', 'Quantité') }}
+ {{ Form::label('quantity', 'Qté.') }}
@include('components.number', ['name' => "prices[$key][quantity]", 'value' => (isset($price['quantity'])) ? $price['quantity'] : 1, 'required' => true, 'class' => 'form-control-sm'])
-
+
@include('Shop.Admin.Articles.partials.prices.block_attribute', ['attribute' => $price['article_attributes'][0]])
-
- {{ Form::label('tax_id', 'TVA') }}
- @include('components.select', ['name' => "prices[$key][tax_id]", 'value' => (isset($price['tax_id'])) ? $price['tax_id'] : null, 'list' => isset($taxes_options) ? $taxes_options : null, 'required' => true, 'class' => 'form-control form-control-sm']) -
+
+
+
+ {{ Form::label('tax_id', 'TVA') }}
+ @include('components.select', ['name' => "prices[$key][tax_id]", 'value' => (isset($price['tax_id'])) ? $price['tax_id'] : null, 'list' => isset($taxes_options) ? $taxes_options : null, 'required' => true, 'class' => 'form-control form-control-sm']) +
-
- {{ Form::label('price', 'Prix HT') }} - @include('components.money', ['name' => "prices[$key][price]", 'value' => (isset($price['price'])) ? $price['price'] : 0, 'required' => true, 'class' => 'form-control-sm price-item']) -
+
+ {{ Form::label('generic_price_id', 'Générique') }}
+ @include('components.select', ['name' => "prices[$key][generic_price_id]", 'value' => (isset($price['generic_price_id'])) ? $price['generic_price_id'] : null, 'list' => ['Tarif barquette','Tarif semences'], 'required' => false, 'class' => 'form-control-sm']) +
-
- {{ Form::label('price_taxed', 'Prix TTC') }} - @include('components.money', ['name' => "prices[$key][price_taxed]", 'value' => (isset($price['price_taxed'])) ? $price['price_taxed'] : 0, 'required' => true, 'class' => 'form-control-sm price-taxed-item']) +
+ {{ Form::label('price', 'Prix HT') }} + @include('components.money', ['name' => "prices[$key][price]", 'value' => (isset($price['price'])) ? $price['price'] : 0, 'required' => true, 'class' => 'form-control-sm price-item']) +
+ +
+ {{ Form::label('price_taxed', 'Prix TTC') }} + @include('components.money', ['name' => "prices[$key][price_taxed]", 'value' => (isset($price['price_taxed'])) ? $price['price_taxed'] : 0, 'required' => true, 'class' => 'form-control-sm price-taxed-item']) +
+
diff --git a/resources/views/components/button-cancel.blade.php b/resources/views/components/button-cancel.blade.php new file mode 100644 index 00000000..ccd68316 --- /dev/null +++ b/resources/views/components/button-cancel.blade.php @@ -0,0 +1,11 @@ + + +@push('js') + +@endpush \ No newline at end of file diff --git a/resources/views/components/datatable.blade.php b/resources/views/components/datatable.blade.php index d8cf1bd1..0b66b12d 100644 --- a/resources/views/components/datatable.blade.php +++ b/resources/views/components/datatable.blade.php @@ -1,4 +1,13 @@
@include('components.datatables.header') - {{$dataTable->table(['class'=>'table table-bordered table-hover table-striped w-100'])}} -
\ No newline at end of file + {{$dataTable->table(['class'=>'table table-bordered table-hover table-striped w-100 mb-0'])}} +
+ +@push('css') + +@endpush + +@push('scripts') + + +@endpush \ No newline at end of file diff --git a/resources/views/components/datatables/buttons/add.blade.php b/resources/views/components/datatables/buttons/add.blade.php index e08194e0..9ff67c85 100644 --- a/resources/views/components/datatables/buttons/add.blade.php +++ b/resources/views/components/datatables/buttons/add.blade.php @@ -1,10 +1,11 @@ - + @push('js') @endpush diff --git a/resources/views/components/datatables/buttons/colvis.blade.php b/resources/views/components/datatables/buttons/colvis.blade.php new file mode 100644 index 00000000..a4cb7704 --- /dev/null +++ b/resources/views/components/datatables/buttons/colvis.blade.php @@ -0,0 +1,22 @@ + + +@push('js') + +@endpush diff --git a/resources/views/components/datatables/buttons/download.blade.php b/resources/views/components/datatables/buttons/download.blade.php new file mode 100644 index 00000000..0f1cb855 --- /dev/null +++ b/resources/views/components/datatables/buttons/download.blade.php @@ -0,0 +1,30 @@ + + + + + + +@push('js') + +@endpush \ No newline at end of file diff --git a/resources/views/components/datatables/buttons/excel.blade.php b/resources/views/components/datatables/buttons/excel.blade.php new file mode 100644 index 00000000..33baf83f --- /dev/null +++ b/resources/views/components/datatables/buttons/excel.blade.php @@ -0,0 +1,8 @@ + + + diff --git a/resources/views/components/datatables/buttons/exports.blade.php b/resources/views/components/datatables/buttons/exports.blade.php index 8be3f8fc..e4434a71 100644 --- a/resources/views/components/datatables/buttons/exports.blade.php +++ b/resources/views/components/datatables/buttons/exports.blade.php @@ -1,14 +1,6 @@
- - - - - + @include('components.datatables.buttons.print') + @include('components.datatables.buttons.download') +
diff --git a/resources/views/components/datatables/buttons/filters.blade.php b/resources/views/components/datatables/buttons/filters.blade.php index 3c104f94..569e285a 100644 --- a/resources/views/components/datatables/buttons/filters.blade.php +++ b/resources/views/components/datatables/buttons/filters.blade.php @@ -1,6 +1,5 @@ @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(); + } + }); + } ); + */ @endpush \ No newline at end of file diff --git a/resources/views/components/datatables/buttons/pageLength.blade.php b/resources/views/components/datatables/buttons/pageLength.blade.php index 265903cb..91e2cdd4 100644 --- a/resources/views/components/datatables/buttons/pageLength.blade.php +++ b/resources/views/components/datatables/buttons/pageLength.blade.php @@ -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') + + + +@endpush \ No newline at end of file diff --git a/resources/views/components/datatables/buttons/pdf.blade.php b/resources/views/components/datatables/buttons/pdf.blade.php new file mode 100644 index 00000000..ef993702 --- /dev/null +++ b/resources/views/components/datatables/buttons/pdf.blade.php @@ -0,0 +1,3 @@ + diff --git a/resources/views/components/datatables/buttons/print.blade.php b/resources/views/components/datatables/buttons/print.blade.php new file mode 100644 index 00000000..893ee7f7 --- /dev/null +++ b/resources/views/components/datatables/buttons/print.blade.php @@ -0,0 +1,21 @@ + + + + + + +@push('js') + +@endpush + diff --git a/resources/views/components/datatables/buttons/row_action.blade.php b/resources/views/components/datatables/buttons/row_action.blade.php new file mode 100644 index 00000000..d550a1ab --- /dev/null +++ b/resources/views/components/datatables/buttons/row_action.blade.php @@ -0,0 +1,9 @@ + + + diff --git a/resources/views/components/datatables/search.blade.php b/resources/views/components/datatables/search.blade.php index 01af6bdb..b3cfc872 100644 --- a/resources/views/components/datatables/search.blade.php +++ b/resources/views/components/datatables/search.blade.php @@ -1,10 +1,12 @@
+ @include('components.datatables.buttons.pageLength')
@include('components.datatables.buttons.filters') + @include('components.datatables.buttons.colvis')
diff --git a/resources/views/components/js/datatable.blade.php b/resources/views/components/js/datatable.blade.php index fca832f4..113d9af0 100644 --- a/resources/views/components/js/datatable.blade.php +++ b/resources/views/components/js/datatable.blade.php @@ -2,7 +2,7 @@ $.extend( true, $.fn.dataTable.defaults, { language: { url: "/assets/vendor/boilerplate/js/datatables/i18n/French.json" - } + }, }); @@ -11,30 +11,44 @@ diff --git a/resources/views/components/save.blade.php b/resources/views/components/save.blade.php index 25a496b3..cb69156f 100644 --- a/resources/views/components/save.blade.php +++ b/resources/views/components/save.blade.php @@ -1,6 +1,7 @@ -
+
-
+
+ @include('components.button-cancel') @include('components.button-save')
diff --git a/resources/views/components/select.blade.php b/resources/views/components/select.blade.php index 9d87b9e9..70bc81a0 100644 --- a/resources/views/components/select.blade.php +++ b/resources/views/components/select.blade.php @@ -1,14 +1,13 @@