Enhance interface

This commit is contained in:
Ludovic CANDELLIER
2020-07-16 15:48:31 +02:00
parent cc6edb2480
commit fcd26d13de
18 changed files with 208 additions and 46 deletions

View File

@@ -3,7 +3,7 @@
<input type="hidden" name="prices[{{ $key }}][attributes][quantity]" value="1">
<input type="hidden" name="prices[{{ $key }}][attributes][id]" value="{{ (isset($attribute['id'])) ? $attribute['id'] : null }}">
<div class="col-12 col-lg-6">
<div class="col-12 col-lg-7">
{{ Form::label('attribute_family_id', 'Attributs') }}<br/>
@include('components.select', [
'name' => "prices[$key][attributes][attribute_family_id]",
@@ -14,7 +14,7 @@
])
</div>
<div class="col-12 col-lg-6">
<div class="col-12 col-lg-5">
{{ Form::label('attribute_value_id', 'Valeur') }}<br/>
@include('components.select', [
'name' => "prices[$key][attributes][attribute_value_id]",

View File

@@ -8,27 +8,36 @@
<div class="row">
<div class="col-lg-1">
{{ Form::label('quantity', 'Quantité') }}<br/>
{{ Form::label('quantity', 'Qté.') }}<br/>
@include('components.number', ['name' => "prices[$key][quantity]", 'value' => (isset($price['quantity'])) ? $price['quantity'] : 1, 'required' => true, 'class' => 'form-control-sm'])
</div>
<div class="col-lg-5">
<div class="col-lg-4">
@include('Shop.Admin.Articles.partials.prices.block_attribute', ['attribute' => $price['article_attributes'][0]])
</div>
<div class="col-lg-1">
{{ Form::label('tax_id', 'TVA') }}<br/>
@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'])
</div>
<div class="col-lg-6">
<div class="row">
<div class="col-3">
{{ Form::label('tax_id', 'TVA') }}<br/>
@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'])
</div>
<div class="col-lg-2">
{{ 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'])
</div>
<div class="col-3">
{{ Form::label('generic_price_id', 'Générique') }}<br/>
@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'])
</div>
<div class="col-lg-2">
{{ 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'])
<div class="col-3">
{{ 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'])
</div>
<div class="col-3">
{{ 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'])
</div>
</div>
</div>
<div class="col-lg-1 text-right">

View 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

View File

@@ -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'])}}
{{$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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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>
@include('components.datatables.buttons.print')
@include('components.datatables.buttons.download')
<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>
</div>

View File

@@ -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

View File

@@ -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']])
&nbsp;&nbsp;
@push('js')
<script>
$('#{{ $model }}_pager').change(function() {
var table = window.LaravelDataTables["{{ $model }}-table"];
var len = $(this).val();
table.page.len(len).draw();
});
</script>
@endpush

View File

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

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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() {
$('.btn-del').on('click', '.destroy', function (e) {
var id = table.row(this).id();
url = '{{ $route }}' + '/show/' + id;
openURL(url);
});
$('.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>

View File

@@ -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>

View File

@@ -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')