fixes
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
@component('components.card')
|
||||
<x-card>
|
||||
@include('components.datatable', [
|
||||
'route' => route('Admin.Shop.CustomerAddresses.index'),
|
||||
'model' => 'customer_addresses',
|
||||
'with_print' => false,
|
||||
'with_filters' => false,
|
||||
])
|
||||
@endcomponent
|
||||
<x-layout.modal title="Filtres" id="modal-customer_addresses-filters">
|
||||
@include('Admin.Shop.CustomerAddresses.partials.filters', ['model' => 'customer_addresses'])
|
||||
</x-layout.modal>
|
||||
</x-card>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<form id="{{ $model }}-filters">
|
||||
<input type="text" name="customer_id" value="{{ $customer['id'] ?? false }}">
|
||||
</form>
|
||||
@@ -1,8 +1,7 @@
|
||||
f{{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form', 'autocomplete' => 'off']) }}
|
||||
<input type="hidden" name="id" value="{{ $customer['id'] ?? false }}">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
{{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form', 'autocomplete' => 'off']) }}
|
||||
<input type="hidden" name="id" value="{{ $customer['id'] ?? false }}">
|
||||
<x-card>
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
@@ -113,13 +112,13 @@ f{{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form'
|
||||
</div>
|
||||
</x-card>
|
||||
</div>
|
||||
</form>
|
||||
<div class="col-6">
|
||||
<x-layout.box-collapse title='Adresses' id='form-customer-address'>
|
||||
@include('Admin.Shop.CustomerAddresses.list', ['dataTable' => $customer_addresses])
|
||||
</x-layout.box-collapse>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<x-save />
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
'route' => route('Admin.Shop.Customers.index'),
|
||||
'model' => 'customers',
|
||||
'with_filters' => true,
|
||||
'with_print' => false,
|
||||
])
|
||||
<x-layout.modal title="Filtres" id="modal-customers-filters">
|
||||
@include('Admin.Shop.Customers.partials.filters', ['model' => 'customers'])
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger">
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
@include('components.form.input', [
|
||||
'name' => 'first_name',
|
||||
'value' => $customer['first_name'] ?? '',
|
||||
'label' => 'Prénom',
|
||||
'required' => true,
|
||||
])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
@@ -11,6 +22,7 @@
|
||||
'name' => 'last_name',
|
||||
'value' => $customer['last_name'] ?? '',
|
||||
'label' => 'Nom',
|
||||
'required' => true,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,58 +1,66 @@
|
||||
{!! Form::open(['route' => 'Shop.register.post', 'method' => 'post', 'autocomplete'=> 'off']) !!}
|
||||
<div class="row green">
|
||||
<div class="col-12">
|
||||
<x-card title='Créez votre compte' class='mt-3 mb-3'>
|
||||
{!! Form::open(['route' => 'Shop.register.post', 'method' => 'post', 'autocomplete' => 'off']) !!}
|
||||
<div class="row green">
|
||||
<div class="col-12">
|
||||
<x-card title='Créez votre compte' class='mt-3 mb-3'>
|
||||
|
||||
@include('Shop.Customers.partials.registration')
|
||||
@include('Shop.Customers.partials.registration')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}">
|
||||
<label>Mot de passe</label>
|
||||
{{ Form::password('password', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }}
|
||||
{!! $errors->first('password','<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label>Confirmation du mot de passe</label>
|
||||
<div class="form-group {{ $errors->has('password_confirmation') ? 'has-error' : '' }}">
|
||||
{{ Form::password('password_confirmation', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password_confirm'), 'required']) }}
|
||||
{!! $errors->first('password_confirmation','<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}">
|
||||
<label>Mot de passe *</label>
|
||||
{{ Form::password('password', [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => __('boilerplate::auth.fields.password'),
|
||||
'required',
|
||||
]) }}
|
||||
{!! $errors->first('password', '<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('components.form.checkboxes.icheck', [
|
||||
'name' => 'use_for_delivery',
|
||||
'value' => false,
|
||||
'label' => 'Utiliser une autre adresse pour la livraison',
|
||||
])
|
||||
<div class="col-6">
|
||||
<label>Confirmation du mot de passe *</label>
|
||||
<div class="form-group {{ $errors->has('password_confirmation') ? 'has-error' : '' }}">
|
||||
{{ Form::password('password_confirmation', [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => __('boilerplate::auth.fields.password_confirm'),
|
||||
'required',
|
||||
]) }}
|
||||
{!! $errors->first('password_confirmation', '<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row d-none" id="address_delivery">
|
||||
<div class="col-12">
|
||||
@include('Shop.Customers.partials.address', [
|
||||
'label' => 'Adresse de livraison',
|
||||
'prefix' => 'delivery_'
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</x-card>
|
||||
|
||||
<div class="row mbm">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
|
||||
<button type="submit" class="btn btn-green-dark">
|
||||
{{ __('boilerplate::auth.register.register_button') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('components.form.checkboxes.icheck', [
|
||||
'name' => 'use_for_delivery',
|
||||
'value' => false,
|
||||
'label' => 'Utiliser une autre adresse pour la livraison',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row d-none" id="address_delivery">
|
||||
<div class="col-12">
|
||||
@include('Shop.Customers.partials.address', [
|
||||
'label' => 'Adresse de livraison',
|
||||
'prefix' => 'delivery_',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</x-card>
|
||||
|
||||
<div class="row mbm">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
|
||||
<button type="submit" class="btn btn-green-dark">
|
||||
{{ __('boilerplate::auth.register.register_button') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@push('js')
|
||||
@@ -61,4 +69,4 @@
|
||||
$('#address_delivery').toggleClass('d-none');
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@endpush
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
<div class="datatable-export-buttons float-left mr-3">
|
||||
|
||||
@if (!isset($with_print) || $with_print)
|
||||
@include('components.datatables.buttons.print')
|
||||
@endif
|
||||
@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_exports) && $with_exports)
|
||||
@include('components.datatables.buttons.excel')
|
||||
@endif
|
||||
|
||||
@if (isset($with_mailing) && $with_mailing)
|
||||
@include('components.datatables.buttons.mail')
|
||||
@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($with_buttons))
|
||||
@foreach ($with_buttons as $button)
|
||||
@include($button)
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if (isset($left_buttons))
|
||||
@foreach ($left_buttons as $button)
|
||||
@include('components.form.button', [
|
||||
'class' => $button['class'] ?? null,
|
||||
'icon' => $button['icon'] ?? null,
|
||||
'txt' => $button['txt'] ?? null,
|
||||
'id' => $button['id'] ?? null,
|
||||
])
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if (isset($left_buttons))
|
||||
@foreach ($left_buttons as $button)
|
||||
@include('components.form.button', ['class' => $button['class'] ?? null, 'icon' => $button['icon'] ?? null, 'txt' => $button['txt'] ?? null, 'id' => $button['id'] ?? null ])
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
<div class="row table-header" id="{{ $model }}-table-header">
|
||||
<div class="col-lg-6 col-md-8 col-12 mb-2">
|
||||
@include('components.datatables.search')
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-3 col-6">
|
||||
@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">
|
||||
@if (isset($right_buttons))
|
||||
@foreach ($right_buttons as $button)
|
||||
@include('components.form.button', ['class' => $button['class'] ?? null, 'icon' => $button['icon'] ?? null, 'txt' => $button['txt'] ?? null, 'id' => $button['id'] ?? null ])
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if (isset($right_content))
|
||||
{!! $right_content !!}
|
||||
@endif
|
||||
<div class="col-lg-6 col-md-8 col-12 mb-2">
|
||||
@include('components.datatables.search')
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-3 col-6">
|
||||
@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">
|
||||
@if (isset($right_buttons))
|
||||
@foreach ($right_buttons as $button)
|
||||
@include('components.form.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>
|
||||
@if (isset($right_content))
|
||||
{!! $right_content !!}
|
||||
@endif
|
||||
|
||||
@if (!(isset($with_add) && !$with_add))
|
||||
@include('components.datatables.buttons.add')
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,78 +1,57 @@
|
||||
<script>
|
||||
$('#{{ $model }}-table').on('draw.dt', function() {
|
||||
|
||||
$('#{{ $model }}-table').on( 'draw.dt', function () {
|
||||
var table = getDatatable("{{ $model }}");
|
||||
|
||||
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-edit').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
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');
|
||||
@if (isset($show_callback))
|
||||
{{ $show_callback }}
|
||||
@else
|
||||
url = '{{ $route }}' + '/show/' + id;
|
||||
openURL(url);
|
||||
@endif
|
||||
});
|
||||
$('#{{ $model }}-table .btn-show').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).data('id');
|
||||
@if (isset($show_callback))
|
||||
{{ $show_callback }}
|
||||
@else
|
||||
url = '{{ $route }}' + '/show/' + id;
|
||||
openURL(url);
|
||||
@endif
|
||||
});
|
||||
|
||||
$('#{{ $model }}-table .btn-del').off('click').click(function (e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
$('#{{ $model }}-table .btn-del').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).data('id');
|
||||
|
||||
bootbox.confirm("{{ __('fg.confirmdelete') }}", function (result) {
|
||||
if (result === false) return;
|
||||
bootbox.confirm("{{ __('fg.confirmdelete') }}", function(result) {
|
||||
if (result === false) return;
|
||||
|
||||
$.ajax({
|
||||
url: '{{ $route }}' + '/destroy/' + id,
|
||||
method: 'delete',
|
||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||
success: function(){
|
||||
// line.remove();
|
||||
@if (isset($delete_callback))
|
||||
{{ $delete_callback }}
|
||||
@else
|
||||
table.draw();
|
||||
@endif
|
||||
growl("{{ __('fg.deletesuccess') }}", 'success');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
$.ajax({
|
||||
url: '{{ $route }}' + '/destroy/' + id,
|
||||
method: 'delete',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function() {
|
||||
@if (isset($delete_callback))
|
||||
{{ $delete_callback }}
|
||||
@else
|
||||
table.draw();
|
||||
@endif
|
||||
growl("{{ __('fg.deletesuccess') }}", 'success');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
{{ $callback ?? '' }}
|
||||
{{ $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);
|
||||
|
||||
var state = table.state.loaded();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,21 +1,30 @@
|
||||
@include('components.form.label')
|
||||
|
||||
@if (($disabled ?? false) || ($readonly ?? false))
|
||||
@include('components.form.input', ['type' => 'hidden', 'label' => false, 'disabled' => false, 'readonly' => false])
|
||||
@include('components.form.input', [
|
||||
'type' => 'hidden',
|
||||
'label' => false,
|
||||
'disabled' => false,
|
||||
'readonly' => false,
|
||||
])
|
||||
@endif
|
||||
|
||||
<input type="{{ $type ?? 'text'}}" name="{{ $name }}" id="{{ $id_name ?? str_slug($name,'-') }}" class="form-control {{ $class ?? ''}}" value="{{ $value ?? null}}"
|
||||
@if ($required ?? false) required @endif
|
||||
@if ($disabled ?? false) disabled @endif
|
||||
@if ($readonly ?? false) readonly @endif
|
||||
@if ($autofocus ?? false) autofocus @endif
|
||||
@if ($size ?? false) size="{{ $size }}" @endif
|
||||
@if ($autocomplete ?? false) autocomplete="{{ $autocomplete }}" @endif
|
||||
@if ($minlength ?? false) minlength={{ $minlength }} @endif
|
||||
@if ($maxlength ?? false) maxlength={{ $maxlength }} @endif
|
||||
@if ($formid ?? false) form="{{ $formid }}" @endif
|
||||
@if ($mask ?? false) data-inputmask="'mask': '{{ $mask }}'" @endif
|
||||
@if ($pattern ?? false) pattern="{{ $pattern }}" @endif
|
||||
@if ($placeholder ?? false) placeholder="{{ $placeholder }}" @endif
|
||||
@if ($step ?? false) step="{{ $step }}" @endif
|
||||
{!! $meta ?? '' !!} >
|
||||
<input type="{{ $type ?? 'text' }}" name="{{ $name }}" id="{{ $id_name ?? str_slug($name, '-') }}"
|
||||
class="form-control {{ $class ?? '' }}" value="{{ $value ?? (old($name) ?? '') }}"
|
||||
@if ($required ?? false) required @endif @if ($disabled ?? false) disabled @endif
|
||||
@if ($readonly ?? false) readonly @endif @if ($autofocus ?? false) autofocus @endif
|
||||
@if ($size ?? false) size="{{ $size }}" @endif
|
||||
@if ($autocomplete ?? false) autocomplete="{{ $autocomplete }}" @endif
|
||||
@if ($minlength ?? false) minlength={{ $minlength }} @endif
|
||||
@if ($maxlength ?? false) maxlength={{ $maxlength }} @endif
|
||||
@if ($formid ?? false) form="{{ $formid }}" @endif
|
||||
@if ($mask ?? false) data-inputmask="'mask': '{{ $mask }}'" @endif
|
||||
@if ($pattern ?? false) pattern="{{ $pattern }}" @endif
|
||||
@if ($placeholder ?? false) placeholder="{{ $placeholder }}" @endif
|
||||
@if ($step ?? false) step="{{ $step }}" @endif {!! $meta ?? '' !!}>
|
||||
|
||||
@error($name)
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
|
||||
@@ -1,131 +1,130 @@
|
||||
@if(!defined('LOAD_DATATABLES'))
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/datatables.min.css') }}">
|
||||
@endpush
|
||||
@if (!defined('LOAD_DATATABLES'))
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/datatables.min.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
@include('boilerplate::load.moment')
|
||||
<script src="{{ asset('assets/plugins/datatables.min.js') }}"></script>
|
||||
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
||||
@push('scripts')
|
||||
@include('boilerplate::load.moment')
|
||||
<script src="{{ asset('assets/plugins/datatables.min.js') }}"></script>
|
||||
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$.extend( true, $.fn.dataTable.defaults, {
|
||||
language: {
|
||||
url: "/assets/plugins/datatables_lang/{{ \App::getLocale() }}.json"
|
||||
},
|
||||
});
|
||||
<script>
|
||||
$.extend(true, $.fn.dataTable.defaults, {
|
||||
language: {
|
||||
url: "/assets/plugins/datatables_lang/{{ \App::getLocale() }}.json"
|
||||
},
|
||||
});
|
||||
|
||||
function removeAccents ( data ) {
|
||||
if ( data.normalize ) {
|
||||
return data +' '+ data.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function removeAccents(data) {
|
||||
if (data.normalize) {
|
||||
return data + ' ' + data.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function reloadDatatable(name) {
|
||||
getDatatable(name).ajax.reload(null,false);
|
||||
// getDatatable(name).columns.adjust().draw();
|
||||
}
|
||||
function reloadDatatable(name) {
|
||||
getDatatable(name).ajax.reload(null, false);
|
||||
// getDatatable(name).columns.adjust().draw();
|
||||
}
|
||||
|
||||
function getDatatable(name) {
|
||||
return (typeof(window.LaravelDataTables) !== 'undefined') ? window.LaravelDataTables[name + "-table"] : false;
|
||||
}
|
||||
function getDatatable(name) {
|
||||
return (typeof(window.LaravelDataTables) !== 'undefined') ? window.LaravelDataTables[name + "-table"] : false;
|
||||
}
|
||||
|
||||
function getDatatableOrderArray(name) {
|
||||
var order = [];
|
||||
order['name'] = getDatatableOrderName(name);
|
||||
order['sort'] = getDatatableOrderSort(name);
|
||||
return order;
|
||||
}
|
||||
function getDatatableOrderArray(name) {
|
||||
var order = [];
|
||||
order['name'] = getDatatableOrderName(name);
|
||||
order['sort'] = getDatatableOrderSort(name);
|
||||
return order;
|
||||
}
|
||||
|
||||
function getDatatableOrderJson(name) {
|
||||
return {
|
||||
'name': getDatatableOrderName(name),
|
||||
'sort': getDatatableOrderSort(name)
|
||||
};
|
||||
}
|
||||
function getDatatableOrderJson(name) {
|
||||
return {
|
||||
'name': getDatatableOrderName(name),
|
||||
'sort': getDatatableOrderSort(name)
|
||||
};
|
||||
}
|
||||
|
||||
function getDatatableOrderName(name) {
|
||||
var id = getDatatableOrderIndex(name);
|
||||
return id ? getDatatableColumnNameById(name, id) : false;
|
||||
}
|
||||
function getDatatableOrderName(name) {
|
||||
var id = getDatatableOrderIndex(name);
|
||||
return id ? getDatatableColumnNameById(name, id) : false;
|
||||
}
|
||||
|
||||
function getDatatableOrderIndex(name) {
|
||||
var table = getDatatable(name);
|
||||
var order = table.order();
|
||||
var col = order ? order[0][0] : false;
|
||||
return col;
|
||||
}
|
||||
function getDatatableOrderIndex(name) {
|
||||
var table = getDatatable(name);
|
||||
var order = table.order();
|
||||
var col = order ? order[0][0] : false;
|
||||
return col;
|
||||
}
|
||||
|
||||
function getDatatableOrderSort(name) {
|
||||
var table = getDatatable(name);
|
||||
var order = table.order();
|
||||
var sort = order[0][1];
|
||||
return sort;
|
||||
}
|
||||
function getDatatableOrderSort(name) {
|
||||
var table = getDatatable(name);
|
||||
var order = table.order();
|
||||
var sort = order[0][1];
|
||||
return sort;
|
||||
}
|
||||
|
||||
function getDatatableState(name) {
|
||||
var table = getDatatable(name);
|
||||
return table ? table.state.loaded() : false;
|
||||
}
|
||||
function getDatatableState(name) {
|
||||
var table = getDatatable(name);
|
||||
return table ? table.state.loaded() : false;
|
||||
}
|
||||
|
||||
function getDatatableColumnNameById(name, id) {
|
||||
var column = getDatatableColumnById(name, id);
|
||||
return column ? column.name : false;
|
||||
}
|
||||
function getDatatableColumnNameById(name, id) {
|
||||
var column = getDatatableColumnById(name, id);
|
||||
return column ? column.name : false;
|
||||
}
|
||||
|
||||
function getDatatableColumnById(name, id) {
|
||||
var columns = getDatatableColumns(name);
|
||||
return columns ? columns[id] : false;
|
||||
}
|
||||
function getDatatableColumnById(name, id) {
|
||||
var columns = getDatatableColumns(name);
|
||||
return columns ? columns[id] : false;
|
||||
}
|
||||
|
||||
function getDatatableColumns(name) {
|
||||
var table = getDatatable(name);
|
||||
return table ? table.settings().init().columns : false;
|
||||
}
|
||||
function getDatatableColumns(name) {
|
||||
var table = getDatatable(name);
|
||||
return table ? table.settings().init().columns : false;
|
||||
}
|
||||
|
||||
function setAlertWhenFiltered(model) {
|
||||
var selector = '#' + model + '-filters';
|
||||
if (checkFilterHasValues(selector)) {
|
||||
$(selector + '-badge').show();
|
||||
} else {
|
||||
$(selector + '-badge').hide();
|
||||
}
|
||||
}
|
||||
function setAlertWhenFiltered(model) {
|
||||
var selector = '#' + model + '-filters';
|
||||
if (checkFilterHasValues(selector)) {
|
||||
$(selector + '-badge').show();
|
||||
} else {
|
||||
$(selector + '-badge').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function checkFilterHasValues(selector) {
|
||||
var tab = $(selector).serializeArray();
|
||||
var hasValue = false;
|
||||
for (item of tab) {
|
||||
if (item.value) {
|
||||
var selector2 = selector + ' input[name="' + item.name + '"]';
|
||||
var isHidden = ( $(selector2).attr('type') == 'hidden' );
|
||||
if (!isHidden) hasValue = true;
|
||||
}
|
||||
}
|
||||
return hasValue;
|
||||
}
|
||||
function checkFilterHasValues(selector) {
|
||||
var tab = $(selector).serializeArray();
|
||||
var hasValue = false;
|
||||
for (item of tab) {
|
||||
if (item.value) {
|
||||
var selector2 = selector + ' input[name="' + item.name + '"]';
|
||||
var isHidden = ($(selector2).attr('type') == 'hidden');
|
||||
if (!isHidden) hasValue = true;
|
||||
}
|
||||
}
|
||||
return hasValue;
|
||||
}
|
||||
|
||||
(function() {
|
||||
var searchType = jQuery.fn.DataTable.ext.type.search;
|
||||
|
||||
searchType.string = function ( data ) {
|
||||
return ! data ? '' : typeof data === 'string' ? removeAccents( data ) : data;
|
||||
};
|
||||
|
||||
searchType.html = function ( data ) {
|
||||
return ! data ? '' : typeof data === 'string' ? removeAccents( data.replace( /<.*?>/g, '' ) ) : data;
|
||||
};
|
||||
});
|
||||
(function() {
|
||||
var searchType = jQuery.fn.DataTable.ext.type.search;
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
searchType.string = function(data) {
|
||||
return !data ? '' : typeof data === 'string' ? removeAccents(data) : data;
|
||||
};
|
||||
|
||||
@php(define('LOAD_DATATABLES', true))
|
||||
searchType.html = function(data) {
|
||||
return !data ? '' : typeof data === 'string' ? removeAccents(data.replace(/<.*?>/g, '')) : data;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_DATATABLES', true))
|
||||
@endif
|
||||
|
||||
@push('scripts')
|
||||
@if ($dataTable)
|
||||
{{ $dataTable->scripts() }}
|
||||
@endif
|
||||
@endpush
|
||||
@if ($dataTable)
|
||||
{{ $dataTable->scripts() }}
|
||||
@endif
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user