Update with new price management

This commit is contained in:
Ludovic CANDELLIER
2021-03-22 00:47:44 +01:00
parent 083d358fbd
commit 37ffaa938b
64 changed files with 1118 additions and 984 deletions

View File

@@ -0,0 +1,27 @@
<div class="datatable-export-buttons float-left mr-3">
@if (!isset($with_print) || $with_print)
@include('components.datatables.buttons.print')
@endif
@if (isset($with_exports) && $with_exports)
@include('components.datatables.buttons.excel')
@endif
@if (isset($with_mailing) && $with_mailing)
@include('components.datatables.buttons.mail')
@endif
@if (isset($with_buttons))
@foreach ($with_buttons as $button)
@include($button)
@endforeach
@endif
@if (isset($left_buttons))
@foreach ($left_buttons as $button)
@include('components.button', ['class' => $button['class'] ?? null, 'icon' => $button['icon'] ?? null, 'txt' => $button['txt'] ?? null, 'id' => $button['id'] ?? null ])
@endforeach
@endif
</div>

View File

@@ -1,11 +1,15 @@
<button type="button" class="btn bg-primary btn-add"><i class="fa fa-plus-circle"></i></button>
<button type="button" class="btn bg-primary btn-add"><i class="fa fa-fw fa-plus-circle"></i></button>
@push('js')
<script>
$('#{{ $model }}-table-header .btn-add').click(function() {
url = '{{ $route }}' + '/create/';
window.location = url;
// openUrl(url);
@if (isset($create_callback))
{{ $create_callback }};
@else
url = '{{ $route }}' + '/create/';
window.location = url;
// openUrl(url);
@endif
});
</script>
@endpush

View File

@@ -1,5 +1,5 @@
<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>
<i class="fa fa-fw fa-columns"></i>
</button>
@push('js')
@@ -7,14 +7,14 @@
var $colvis = $('#{{ $model }}-table-header .btn-colvis');
$colvis.on( 'click', function () {
var table = window.LaravelDataTables["{{ $model }}-table"];
console.log(table);
var table = getDatatable("{{ $model }}");
// console.log(table);
console.log(table.column(1).dataSrc());
// console.log(table.column(1).dataSrc());
var header = table.column(1).header();
console.log($(header).html());
// console.log($(header).html());
var visible = table.column(1).visible();
console.log(visible);
// console.log(visible);
/*
// var names = table.columns().names();

View File

@@ -1,6 +1,6 @@
<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>
<i class="fa fa-fw fa-download"></i>
</button>
<ul class="dropdown-menu" x-placement="bottom-start">

View File

@@ -1,8 +1,15 @@
<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 type="button" class="btn bg-gradient-secondary {{ $model }}-excel">
<i class="fa fa-fw 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>
@push('js')
<script>
$('.{{ $model }}-excel').click(function() {
var data = $('#{{ $model }}-filters').serialize();
var url = "{{ $route }}/exportExcel?" + data;
window.location = url;
});
</script>
@endpush

View File

@@ -1,30 +1,31 @@
<button type="button" class="btn bg-gradient-secondary btn-filter" data-toggle="modal" data-target="#modal-filters">
<i class="fa fa-filter"></i>
<button id="btn-{{ $model ?? null }}-filters" type="button" class="btn bg-gradient-secondary btn-filter" data-toggle="modal" data-target="#modal-{{ $model ?? null }}-filters">
<i class="fa fa-fw fa-filter"></i>
</button>
@push('js')
<script>
var $filter = $('#{{ $model }}-table-header .btn-filter');
var $filter = $('#{{ $model ?? null }}-table-header .btn-filter');
$('#modal-filters').on('shown.bs.modal', function () {
$('#modal-{{ $model ?? null }}-filters').on('shown.bs.modal', function () {
initSelect2();
});
$('#modal-filters .apply').click(function() {
$('#modal-filters').modal('hide');
var table = window.LaravelDataTables["{{ $model }}-table"];
$('#modal-{{ $model ?? null }}-filters .apply').click(function() {
$('#modal-{{ $model ?? null }}-filters').modal('hide');
var table = window.LaravelDataTables["{{ $model ?? null }}-table"];
table.draw();
})
$('#modal-filters .reset').click(function() {
$('#filters').trigger("reset");
$('#filters .select2').val(null).trigger("change");
$('#modal-{{ $model ?? null }}-filters .reset').click(function() {
// $('#{{ $model ?? null }}-filters').trigger("reset");
$('#{{ $model ?? null }}-filters').closest('form').find("input[type=text], select").val("");
$('#{{ $model ?? null }}-filters .select2').val(null).trigger("change");
})
/*
$filter.on( 'click', function () {
var table = window.LaravelDataTables["{{ $model }}-table"];
var table = window.LaravelDataTables["{{ $model ?? null }}-table"];
// table.search($search.val()).draw();
openModal('{{ __('Filters') }}', '{{ $route }}/getFiltersHtml', {
onApply: function() {

View File

@@ -0,0 +1,10 @@
<span>
<button type="button" class="btn bg-gradient-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i class="fa fa-fw fa-envelope-open-text"></i>
</button>
<ul class="dropdown-menu" x-placement="bottom-start">
<li class="dropdown-item"><a href="{{ $route }}/mailSelection">{{ __('admin.mail_the_selection') }}</a></li>
<li class="dropdown-item"><a href="{{ $route }}/mailAll">{{ __('admin.mail_the_complete_list') }}</a></li>
</ul>
</span>

View File

@@ -4,10 +4,17 @@
@push('js')
<script>
$('#{{ $model }}_pager').change(function() {
var table = window.LaravelDataTables["{{ $model }}-table"];
var len = $(this).val();
table.page.len(len).draw();
$( document ).ready(function() {
var table = getDatatable("{{ $model }}");
var state = getDatatableState("{{ $model }}");
if (state && (typeof(state.length) != 'undefined')) {
$('#{{ $model }}_pager').val(state.length);
}
$('#{{ $model }}_pager').change(function() {
table.page.len($(this).val()).draw();
});
});
</script>

View File

@@ -1,3 +1,5 @@
<button type="button" class="btn bg-gradient-secondary btn-pdf">
<i class="fa fa-file-pdf"></i>
</button>
<span>
<button type="button" class="btn bg-gradient-secondary btn-pdf">
<i class="fa fa-fw fa-file-pdf"></i>
</button>
</span>

View File

@@ -1,27 +1,15 @@
<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 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>
<button type="button" class="btn bg-gradient-secondary {{ $model }}-print">
<i class="fa fa-fw fa-print"></i>
</button>
@push('js')
<script>
var $print = $('#{{ $model }}-table-header .btn-print');
$print.on( 'click', function () {
var table = window.LaravelDataTables["{{ $model }}-table"];
table.button(1).trigger();
});
$('.printWithFilter').click(function() {
var data = $('#filters').serialize();
$('.{{ $model }}-print').click(function() {
var data = $('#{{ $model }}-filters').serialize();
var url = "{{ $route }}/print?" + data;
window.location = url;
})
// window.location = url;
var print = window.open(url, 'print');
});
</script>
@endpush

View File

@@ -3,9 +3,19 @@
@include('components.datatables.search')
</div>
<div class="col-lg-4 col-md-3 col-6">
@include('components.datatables.buttons.exports')
@include('components.datatables.buttons')
@if (isset($add_buttons))
@include($add_buttons)
@endif
</div>
<div class="col-lg-2 col-md-1 col-6 text-right">
@include('components.datatables.buttons.add')
@if (isset($right_buttons))
@foreach ($right_buttons as $button)
@include('components.button', ['class' => $button['class'] ?? null, 'icon' => $button['icon'] ?? null, 'txt' => $button['txt'] ?? null, 'id' => $button['id'] ?? null ])
@endforeach
@endif
@if (!(isset($with_add) && (!$with_add)))
@include('components.datatables.buttons.add')
@endif
</div>
</div>

View File

@@ -0,0 +1,70 @@
<script>
$('#{{ $model }}-table').on( 'draw.dt', function () {
var table = getDatatable("{{ $model }}");
$('#{{ $model }}-table .btn-edit').off('click').click(function(e) {
e.preventDefault();
// var id = table.row(this).id();
var id = $(this).data('id');
@if (isset($edit_callback))
{{ $edit_callback }}
@else
url = '{{ $route }}' + '/edit/' + id;
openURL(url);
@endif
});
$('#{{ $model }}-table .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);
});
$('#{{ $model }}-table .btn-del').off('click').click(function (e) {
e.preventDefault();
// var id = table.row(this).id();
var id = $(this).data('id');
bootbox.confirm("{{ __('admin.confirmdelete') }}", function (result) {
if (result === false) return;
$.ajax({
url: '{{ $route }}' + '/destroy/' + id,
method: 'delete',
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
success: function(){
// line.remove();
table.draw();
growl("{{ __('admin.deletesuccess') }}", 'success');
}
});
});
});
{{ $callback ?? '' }}
var state = table.state.loaded();
// console.log('state');
// console.log(state);
if ( state ) {
/*
table.columns().eq( 0 ).each( function ( colIdx ) {
var colSearch = state.columns[colIdx].search;
if ( colSearch.search ) {
$('.search-input-text').eq(colIdx).val( colSearch.search );
}
});
*/
}
});
// datatablesHelper.getDatatableLength('{{ $model }}', 34);
</script>

View File

@@ -1,9 +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="">
<input type="text" class="form-control search-btn" placeholder="{{ __('search') }}" 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)
@@ -14,14 +17,26 @@
@endif
</div>
@endif
</div>
@include('load.functions')
@push('js')
<script>
var $search = $('#{{ $model }}-table-header .search-btn');
$search.on( 'keyup click', function () {
var table = window.LaravelDataTables["{{ $model }}-table"];
table.search($search.val()).draw();
} );
$( document ).ready(function() {
var table = getDatatable("{{ $model }}");
var $search = $('#{{ $model }}-table-header .search-btn');
var state = getDatatableState("{{ $model }}");
if (state && (typeof(state.search.search) != 'undefined')) {
$search.val(state.search.search);
}
$search.on('keyup', delay(function () {
table.search($search.val()).draw();
}, 500));
});
</script>
@endpush