Añadidos desde Ozar Distribuidores de Cliente y Contactos de Cliente

This commit is contained in:
imnavajas
2023-07-19 22:04:40 +02:00
parent 511c73cc0c
commit 0f00f4e00d
16 changed files with 2045 additions and 0 deletions

View File

@ -0,0 +1,58 @@
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="clienteId" class="form-label">
<?=lang('ClienteContactos.cliente') ?>*
</label>
<select id="clienteId" name="cliente_id" required class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($clienteList) && is_array($clienteList) && !empty($clienteList) ) :
foreach ($clienteList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$clienteContactoEntity->cliente_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cargo" class="form-label">
<?=lang('ClienteContactos.cargo') ?>
</label>
<input type="text" id="cargo" name="cargo" maxLength="100" class="form-control" value="<?=old('cargo', $clienteContactoEntity->cargo) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('ClienteContactos.nombre') ?>
</label>
<input type="text" id="nombre" name="nombre" maxLength="100" class="form-control" value="<?=old('nombre', $clienteContactoEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="apellidos" class="form-label">
<?=lang('ClienteContactos.apellidos') ?>
</label>
<textarea rows="3" id="apellidos" name="apellidos" style="height: 10em;" class="form-control"><?=old('apellidos', $clienteContactoEntity->apellidos) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="telefono" class="form-label">
<?=lang('ClienteContactos.telefono') ?>
</label>
<input type="text" id="telefono" name="telefono" maxLength="20" class="form-control" value="<?=old('telefono', $clienteContactoEntity->telefono) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="email" class="form-label">
<?=lang('ClienteContactos.email') ?>
</label>
<input type="email" id="email" name="email" maxLength="150" class="form-control" value="<?=old('email', $clienteContactoEntity->email) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,65 @@
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="contactoDeClienteForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/clientes/contactos/_contactoDeClienteFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("contactoDeClienteList"), lang("Basic.global.Cancel"), [
"class" => "btn btn-secondary float-start",
]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
$('#clienteId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfClientes") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
<?= $this->endSection() ?>

View File

@ -0,0 +1,171 @@
<?=$this->include('Themes/_commonPartialsBs/select2bs5') ?>
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?>
<?=$this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('ClienteContactos.contactoDeClienteList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfContactosdecliente" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?=lang('ClienteContactos.id')?></th>
<th><?= lang('Clientes.cliente') ?></th>
<th><?= lang('ClienteContactos.cargo') ?></th>
<th><?= lang('ClienteContactos.nombre') ?></th>
<th><?= lang('ClienteContactos.apellidos') ?></th>
<th><?= lang('ClienteContactos.telefono') ?></th>
<th><?= lang('ClienteContactos.email') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newContactoDeCliente'), lang('Basic.global.addNew').' '.lang('ClienteContactos.contactoDeCliente'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfContactosdecliente').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
</div>
</td>`;
};
theTable = $('#tableOfContactosdecliente').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 10,
lengthChange: true,
"dom": 'lfrtipB', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
// "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
stateSave: true,
order: [[1, 'asc']],
language: {
url: "/assets/dt/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfContactosDeCliente') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [0,lastColNr]
}
],
columns : [
{ 'data': actionBtns },
{ 'data': 'id' },
{ 'data': 'cliente_id' },
{ 'data': 'cargo' },
{ 'data': 'nombre' },
{ 'data': 'apellidos' },
{ 'data': 'telefono' },
{ 'data': 'email' },
{ 'data': actionBtns }
]
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('contactoDeClienteList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('ClienteContactos.contacto de cliente'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
url: `<?= route_to('contactoDeClienteList') ?>/${dataId}`,
method: 'DELETE',
}).done((data, textStatus, jqXHR) => {
Toast.fire({
icon: 'success',
title: data.msg ?? jqXHR.statusText,
});
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
}).fail((jqXHR, textStatus, errorThrown) => {
Toast.fire({
icon: 'error',
title: jqXHR.responseJSON.messages.error,
});
})
}
});
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?=$this->endSection() ?>

View File

@ -0,0 +1,125 @@
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('ClienteDistribuidores.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $clienteDistribuidorEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cif" class="form-label">
<?=lang('ClienteDistribuidores.cif') ?>
</label>
<input type="text" id="cif" name="cif" maxLength="50" class="form-control" value="<?=old('cif', $clienteDistribuidorEntity->cif) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="direccion" class="form-label">
<?=lang('ClienteDistribuidores.direccion') ?>
</label>
<textarea rows="3" id="direccion" name="direccion" style="height: 10em;" class="form-control"><?=old('direccion', $clienteDistribuidorEntity->direccion) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="ciudad" class="form-label">
<?=lang('ClienteDistribuidores.ciudad') ?>
</label>
<input type="text" id="ciudad" name="ciudad" maxLength="100" class="form-control" value="<?=old('ciudad', $clienteDistribuidorEntity->ciudad) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cp" class="form-label">
<?=lang('ClienteDistribuidores.cp') ?>
</label>
<input type="text" id="cp" name="cp" maxLength="10" class="form-control" value="<?=old('cp', $clienteDistribuidorEntity->cp) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="email" class="form-label">
<?=lang('ClienteDistribuidores.email') ?>
</label>
<input type="email" id="email" name="email" maxLength="150" class="form-control" value="<?=old('email', $clienteDistribuidorEntity->email) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('ClienteDistribuidores.pais') ?>*
</label>
<select id="paisId" name="pais_id" required class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($paisList) && is_array($paisList) && !empty($paisList) ) :
foreach ($paisList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$clienteDistribuidorEntity->pais_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="provinciaId" class="form-label">
<?=lang('ClienteDistribuidores.provincia') ?>*
</label>
<select id="provinciaId" name="provincia_id" required class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($provinciaList) && is_array($provinciaList) && !empty($provinciaList) ) :
foreach ($provinciaList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$clienteDistribuidorEntity->provincia_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comunidadAutonomaId" class="form-label">
<?=lang('ClienteDistribuidores.comunidadAutonoma') ?>
</label>
<select id="comunidadAutonomaId" name="comunidad_autonoma_id" class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($comunidadAutonomaList) && is_array($comunidadAutonomaList) && !empty($comunidadAutonomaList) ) :
foreach ($comunidadAutonomaList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$clienteDistribuidorEntity->comunidad_autonoma_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="telefono" class="form-label">
<?=lang('ClienteDistribuidores.telefono') ?>
</label>
<input type="text" id="telefono" name="telefono" maxLength="60" class="form-control" value="<?=old('telefono', $clienteDistribuidorEntity->telefono) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="horariosEntrega" class="form-label">
<?=lang('ClienteDistribuidores.horariosEntrega') ?>
</label>
<textarea rows="3" id="horariosEntrega" name="horarios_entrega" style="height: 10em;" class="form-control"><?=old('horarios_entrega', $clienteDistribuidorEntity->horarios_entrega) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="personaContacto" class="form-label">
<?=lang('ClienteDistribuidores.personaContacto') ?>
</label>
<input type="text" id="personaContacto" name="persona_contacto" maxLength="100" class="form-control" value="<?=old('persona_contacto', $clienteDistribuidorEntity->persona_contacto) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="precio" class="form-label">
<?=lang('ClienteDistribuidores.precio') ?>
</label>
<input type="number" id="precio" name="precio" maxLength="31" step="0.01" class="form-control" value="<?=old('precio', $clienteDistribuidorEntity->precio) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,125 @@
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="distribuidorDeClienteForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/clientes/distribuidores/_distribuidorDeClienteFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("distribuidorDeClienteList"), lang("Basic.global.Cancel"), [
"class" => "btn btn-secondary float-start",
]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
$('#comunidadAutonomaId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfComunidadesAutonomas") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#provinciaId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfProvincias") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paisId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPaises") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
<?= $this->endSection() ?>

View File

@ -0,0 +1,185 @@
<?=$this->include('Themes/_commonPartialsBs/select2bs5') ?>
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?>
<?=$this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('ClienteDistribuidores.distribuidorDeClienteList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfDistribuidoresdecliente" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?=lang('ClienteDistribuidores.id')?></th>
<th><?= lang('ClienteDistribuidores.nombre') ?></th>
<th><?= lang('ClienteDistribuidores.cif') ?></th>
<th><?= lang('ClienteDistribuidores.direccion') ?></th>
<th><?= lang('ClienteDistribuidores.ciudad') ?></th>
<th><?= lang('ClienteDistribuidores.cp') ?></th>
<th><?= lang('ClienteDistribuidores.email') ?></th>
<th><?= lang('Paises.pais') ?></th>
<th><?= lang('Provincias.provincia') ?></th>
<th><?= lang('ComunidadesAutonomas.comunidadAutonoma') ?></th>
<th><?= lang('ClienteDistribuidores.telefono') ?></th>
<th><?= lang('ClienteDistribuidores.horariosEntrega') ?></th>
<th><?= lang('ClienteDistribuidores.personaContacto') ?></th>
<th><?= lang('ClienteDistribuidores.precio') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newDistribuidorDeCliente'), lang('Basic.global.addNew').' '.lang('ClienteDistribuidores.distribuidorDeCliente'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfDistribuidoresdecliente').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
</div>
</td>`;
};
theTable = $('#tableOfDistribuidoresdecliente').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 10,
lengthChange: true,
"dom": 'lfrtipB', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
// "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
stateSave: true,
order: [[1, 'asc']],
language: {
url: "/assets/dt/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfDistribuidoresDeCliente') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [0,lastColNr]
}
],
columns : [
{ 'data': actionBtns },
{ 'data': 'id' },
{ 'data': 'nombre' },
{ 'data': 'cif' },
{ 'data': 'direccion' },
{ 'data': 'ciudad' },
{ 'data': 'cp' },
{ 'data': 'email' },
{ 'data': 'pais' },
{ 'data': 'provincia' },
{ 'data': 'comunidad_autonoma' },
{ 'data': 'telefono' },
{ 'data': 'horarios_entrega' },
{ 'data': 'persona_contacto' },
{ 'data': 'precio' },
{ 'data': actionBtns }
]
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('distribuidorDeClienteList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('ClienteDistribuidores.distribuidor de cliente'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
url: `<?= route_to('distribuidorDeClienteList') ?>/${dataId}`,
method: 'DELETE',
}).done((data, textStatus, jqXHR) => {
Toast.fire({
icon: 'success',
title: data.msg ?? jqXHR.statusText,
});
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
}).fail((jqXHR, textStatus, errorThrown) => {
Toast.fire({
icon: 'error',
title: jqXHR.responseJSON.messages.error,
});
})
}
});
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?=$this->endSection() ?>