mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Terminada funcionalidad eliminar basada en Modal y SweetAlert. Aplicada a tarifas, papeles y maquinas existentes
This commit is contained in:
@ -328,6 +328,7 @@ $routes->group('cliente', ['namespace' => 'App\Controllers\Clientes'], function
|
|||||||
$routes->post('create', 'Cliente::create', ['as' => 'ajaxCreateCliente']);
|
$routes->post('create', 'Cliente::create', ['as' => 'ajaxCreateCliente']);
|
||||||
$routes->put('(:num)/update', 'Cliente::update/$1', ['as' => 'ajaxUpdateCliente']);
|
$routes->put('(:num)/update', 'Cliente::update/$1', ['as' => 'ajaxUpdateCliente']);
|
||||||
$routes->post('(:num)/edit', 'Cliente::edit/$1', ['as' => 'updateCliente']);
|
$routes->post('(:num)/edit', 'Cliente::edit/$1', ['as' => 'updateCliente']);
|
||||||
|
$routes->get('delete/(:num)', 'Cliente::delete/$1', ['as' => 'deleteCliente']);
|
||||||
$routes->post('datatable', 'Cliente::datatable', ['as' => 'dataTableOfClientes']);
|
$routes->post('datatable', 'Cliente::datatable', ['as' => 'dataTableOfClientes']);
|
||||||
$routes->post('allmenuitems', 'Cliente::allItemsSelect', ['as' => 'select2ItemsOfClientes']);
|
$routes->post('allmenuitems', 'Cliente::allItemsSelect', ['as' => 'select2ItemsOfClientes']);
|
||||||
$routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']);
|
$routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']);
|
||||||
|
|||||||
@ -41,6 +41,12 @@ class Cliente extends \App\Controllers\GoBaseResourceController {
|
|||||||
$this->viewData['pageTitle'] = lang('Clientes.moduleTitle');
|
$this->viewData['pageTitle'] = lang('Clientes.moduleTitle');
|
||||||
$this->viewData['usingSweetAlert'] = true;
|
$this->viewData['usingSweetAlert'] = true;
|
||||||
|
|
||||||
|
// Se indica que este controlador trabaja con soft_delete
|
||||||
|
$this->soft_delete = true;
|
||||||
|
// Se indica el flag para los ficheros borrados
|
||||||
|
$this->delete_flag = 1;
|
||||||
|
|
||||||
|
|
||||||
// Breadcrumbs (IMN)
|
// Breadcrumbs (IMN)
|
||||||
$this->viewData['breadcrumb'] = [
|
$this->viewData['breadcrumb'] = [
|
||||||
['title' => lang("App.menu_clientes"), 'route' => "", 'active' => false],
|
['title' => lang("App.menu_clientes"), 'route' => "", 'active' => false],
|
||||||
@ -70,7 +76,6 @@ class Cliente extends \App\Controllers\GoBaseResourceController {
|
|||||||
public function add() {
|
public function add() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$requestMethod = $this->request->getMethod();
|
$requestMethod = $this->request->getMethod();
|
||||||
|
|
||||||
if ($requestMethod === 'post') :
|
if ($requestMethod === 'post') :
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default"
|
<button type="button" class="btn btn-default"
|
||||||
data-bs-dismiss="modal"><?= lang('Basic.global.deleteConfirmationCancel') ?></button>
|
data-bs-dismiss="modal"><?= lang('Basic.global.deleteConfirmationCancel') ?></button>
|
||||||
<a class="btn btn-danger btn-confirm btn-remove"><?= lang('Basic.global.deleteConfirmationButton') ?></a>
|
<a href="javascript:void(0);" class="btn btn-danger btn-confirm btn-remove"><?= lang('Basic.global.deleteConfirmationButton') ?></a>
|
||||||
</div><!--//.modal-footer -->
|
</div><!--//.modal-footer -->
|
||||||
</div><!--//.modal-content -->
|
</div><!--//.modal-content -->
|
||||||
</div><!--//.modal-dialog -->
|
</div><!--//.modal-dialog -->
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
<?= $this->section('content'); ?>
|
<?= $this->section('content'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@ -46,8 +47,8 @@
|
|||||||
return `
|
return `
|
||||||
<td class="text-right py-0 align-middle">
|
<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<div class="btn-group btn-group-sm">
|
||||||
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
};
|
};
|
||||||
@ -101,47 +102,30 @@
|
|||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.btn-edit', function(e) {
|
$(document).on('click', '.btn-edit', function(e) {
|
||||||
//window.location.href = `<?= site_url('/cliente/edit') ?>/${$(this).attr('data-id')}/edit`;
|
|
||||||
window.location.href = `/clientes/cliente/edit/${$(this).attr('data-id')}`;
|
window.location.href = `/clientes/cliente/edit/${$(this).attr('data-id')}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
$(document).on('click', '.btn-delete', function(e) {
|
||||||
Swal.fire({
|
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Clientes.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('clienteList') ?>/${dataId}`,
|
|
||||||
method: 'DELETE',
|
|
||||||
}).done((data, textStatus, jqXHR) => {
|
|
||||||
Toast.fire({
|
|
||||||
icon: 'success',
|
|
||||||
title: data.msg ?? jqXHR.statusText,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.btn-remove', function(e) {
|
||||||
|
const dataId = $(this).attr('data-id');
|
||||||
|
const row = $(this).closest('tr');
|
||||||
|
if ($.isNumeric(dataId)) {
|
||||||
|
$.ajax({
|
||||||
|
url: `/clientes/cliente/delete/${dataId}`,
|
||||||
|
method: 'GET',
|
||||||
|
}).done((data, textStatus, jqXHR) => {
|
||||||
|
$('#confirm2delete').modal('toggle');
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable.row($(row)).invalidate().draw();
|
||||||
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
Toast.fire({
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
icon: 'error',
|
|
||||||
title: jqXHR.responseJSON.messages.error,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
<?= $this->section('content'); ?>
|
<?= $this->section('content'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@ -51,10 +52,11 @@
|
|||||||
|
|
||||||
const lastColNr = $('#tableOfMaquinas').find("tr:first th").length - 1;
|
const lastColNr = $('#tableOfMaquinas').find("tr:first th").length - 1;
|
||||||
const actionBtns = function(data) {
|
const actionBtns = function(data) {
|
||||||
return `<td class="text-right py-0 align-middle">
|
return `
|
||||||
|
<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<div class="btn-group btn-group-sm">
|
||||||
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
};
|
};
|
||||||
@ -118,55 +120,33 @@
|
|||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="text-success bi bi-check-lg"></i>' : '';
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="text-success bi bi-check-lg"></i>' : '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-edit', function(e) {
|
$(document).on('click', '.btn-edit', function(e) {
|
||||||
//window.location.href = `<?= route_to('maquinaList') ?>/${$(this).attr('data-id')}/edit`;
|
|
||||||
window.location.href = `/configuracion/maquinas/edit/${$(this).attr('data-id')}`;
|
window.location.href = `/configuracion/maquinas/edit/${$(this).attr('data-id')}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
$(document).on('click', '.btn-delete', function(e) {
|
||||||
Swal.fire({
|
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Maquinas.maquina'))]) ?>',
|
});
|
||||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
|
||||||
icon: 'warning',
|
$(document).on('click', '.btn-remove', function(e) {
|
||||||
showCancelButton: true,
|
const dataId = $(this).attr('data-id');
|
||||||
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');
|
const row = $(this).closest('tr');
|
||||||
if (result.value) {
|
if ($.isNumeric(dataId)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
//url: `<?= route_to('maquinaList') ?>/${dataId}`,
|
|
||||||
//method: 'DELETE',
|
|
||||||
url: `/configuracion/maquinas/delete/${dataId}`,
|
url: `/configuracion/maquinas/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
Toast.fire({
|
$('#confirm2delete').modal('toggle');
|
||||||
icon: 'success',
|
|
||||||
title: data.msg ?? jqXHR.statusText,
|
|
||||||
});
|
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable.row($(row)).invalidate().draw();
|
||||||
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
Toast.fire({
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
icon: 'error',
|
|
||||||
title: jqXHR.responseJSON.messages.error,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
<?= $this->section('content'); ?>
|
<?= $this->section('content'); ?>
|
||||||
@ -50,8 +50,8 @@
|
|||||||
const actionBtns = function(data) {
|
const actionBtns = function(data) {
|
||||||
return `<td class="text-right py-0 align-middle">
|
return `<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<div class="btn-group btn-group-sm">
|
||||||
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
};
|
};
|
||||||
@ -122,42 +122,26 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
$(document).on('click', '.btn-delete', function(e) {
|
||||||
Swal.fire({
|
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('MaquinasPorDefecto.maquinadefecto'))]) ?>',
|
});
|
||||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
|
||||||
icon: 'warning',
|
$(document).on('click', '.btn-remove', function(e) {
|
||||||
showCancelButton: true,
|
const dataId = $(this).attr('data-id');
|
||||||
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');
|
const row = $(this).closest('tr');
|
||||||
if (result.value) {
|
if ($.isNumeric(dataId)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
//url: `<?= route_to('maquinaPorDefectoList') ?>/${dataId}`,
|
|
||||||
//method: 'DELETE',
|
|
||||||
url: `/configuracion/maquinasdefecto/delete/${dataId}`,
|
url: `/configuracion/maquinasdefecto/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
Toast.fire({
|
$('#confirm2delete').modal('toggle');
|
||||||
icon: 'success',
|
|
||||||
title: data.msg ?? jqXHR.statusText,
|
|
||||||
});
|
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable.row($(row)).invalidate().draw();
|
||||||
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
Toast.fire({
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
icon: 'error',
|
|
||||||
title: jqXHR.responseJSON.messages.error,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
<?= $this->section('content'); ?>
|
<?= $this->section('content'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
<div class="card card-info">
|
<div class="card card-info">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><?=lang('PapelGenerico.papelGenericoList') ?></h3>
|
<h3 class="card-title"><?=lang('PapelGenerico.papelGenericoList') ?></h3>
|
||||||
@ -29,7 +29,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div><!--//.card-body -->
|
</div><!--//.card-body -->
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
|
|
||||||
</div><!--//.card-footer -->
|
</div><!--//.card-footer -->
|
||||||
</div><!--//.card -->
|
</div><!--//.card -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
@ -41,13 +40,15 @@
|
|||||||
<?=$this->section('additionalInlineJs') ?>
|
<?=$this->section('additionalInlineJs') ?>
|
||||||
const lastColNr = $('#tableOfPapelesgenericos').find("tr:first th").length - 1;
|
const lastColNr = $('#tableOfPapelesgenericos').find("tr:first th").length - 1;
|
||||||
const actionBtns = function(data) {
|
const actionBtns = function(data) {
|
||||||
return `<td class="text-right py-0 align-middle">
|
return `
|
||||||
|
<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<div class="btn-group btn-group-sm">
|
||||||
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
};
|
};
|
||||||
|
|
||||||
theTable = $('#tableOfPapelesgenericos').DataTable({
|
theTable = $('#tableOfPapelesgenericos').DataTable({
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
@ -105,47 +106,31 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-edit', function(e) {
|
$(document).on('click', '.btn-edit', function(e) {
|
||||||
//window.location.href = `<?= route_to('papelGenericoList') ?>/edit/${$(this).attr('data-id')}`;
|
|
||||||
window.location.href = `/configuracion/papelesgenericos/edit/${$(this).attr('data-id')}`;
|
window.location.href = `/configuracion/papelesgenericos/edit/${$(this).attr('data-id')}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
$(document).on('click', '.btn-delete', function(e) {
|
||||||
Swal.fire({
|
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('PapelGenerico.papel generico'))]) ?>',
|
});
|
||||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
|
||||||
icon: 'warning',
|
$(document).on('click', '.btn-remove', function(e) {
|
||||||
showCancelButton: true,
|
const dataId = $(this).attr('data-id');
|
||||||
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');
|
const row = $(this).closest('tr');
|
||||||
if (result.value) {
|
if ($.isNumeric(dataId)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
//url: `<?= route_to('papelGenericoList') ?>/${dataId}`,
|
|
||||||
//method: 'DELETE',
|
|
||||||
url: `/configuracion/papelesgenericos/delete/${dataId}`,
|
url: `/configuracion/papelesgenericos/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
Toast.fire({
|
$('#confirm2delete').modal('toggle');
|
||||||
icon: 'success',
|
|
||||||
title: data.msg ?? jqXHR.statusText,
|
|
||||||
});
|
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable.row($(row)).invalidate().draw();
|
||||||
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
Toast.fire({
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
icon: 'error',
|
|
||||||
title: jqXHR.responseJSON.messages.error,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?=$this->include('themes/_commonPartialsBs/select2bs5') ?>
|
<?=$this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||||
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
<?=$this->section('content'); ?>
|
<?=$this->section('content'); ?>
|
||||||
@ -49,10 +49,11 @@
|
|||||||
|
|
||||||
const lastColNr = $('#tableOfPapelesimpresion').find("tr:first th").length - 1;
|
const lastColNr = $('#tableOfPapelesimpresion').find("tr:first th").length - 1;
|
||||||
const actionBtns = function(data) {
|
const actionBtns = function(data) {
|
||||||
return `<td class="text-right py-0 align-middle">
|
return `
|
||||||
|
<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<div class="btn-group btn-group-sm">
|
||||||
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
};
|
};
|
||||||
@ -117,50 +118,30 @@ theTable.on( 'draw.dt', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-edit', function(e) {
|
$(document).on('click', '.btn-edit', function(e) {
|
||||||
//window.location.href = `<?= route_to('papelImpresionList') ?>/${$(this).attr('data-id')}/edit`;
|
|
||||||
window.location.href = `/configuracion/papelesimpresion/edit/${$(this).attr('data-id')}`;
|
window.location.href = `/configuracion/papelesimpresion/edit/${$(this).attr('data-id')}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
$(document).on('click', '.btn-delete', function(e) {
|
||||||
Swal.fire({
|
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('PapelImpresion.papel impresion'))]) ?>',
|
});
|
||||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
|
||||||
icon: 'warning',
|
$(document).on('click', '.btn-remove', function(e) {
|
||||||
showCancelButton: true,
|
const dataId = $(this).attr('data-id');
|
||||||
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');
|
const row = $(this).closest('tr');
|
||||||
if (result.value) {
|
if ($.isNumeric(dataId)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
//url: `<?= route_to('papelImpresionList') ?>/${dataId}`,
|
|
||||||
//method: 'DELETE',
|
|
||||||
url: `/configuracion/papelesimpresion/delete/${dataId}`,
|
url: `/configuracion/papelesimpresion/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
Toast.fire({
|
$('#confirm2delete').modal('toggle');
|
||||||
icon: 'success',
|
|
||||||
title: data.msg ?? jqXHR.statusText,
|
|
||||||
});
|
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable.row($(row)).invalidate().draw();
|
||||||
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
Toast.fire({
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
icon: 'error',
|
|
||||||
title: jqXHR.responseJSON.messages.error,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
@ -172,13 +153,11 @@ $(document).on('click', '.btn-delete', function(e) {
|
|||||||
|
|
||||||
<?= $this->section('additionalExternalJs') ?>
|
<?= $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/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.bootstrap5.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.html5.min.js"></script>
|
||||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.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/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/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>
|
<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() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?php $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
<?php $this->include('themes/_commonPartialsBs/sweetalert') ?>
|
|
||||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
<?= $this->section('content'); ?>
|
<?= $this->section('content'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
<?=$this->section('content'); ?>
|
<?=$this->section('content'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -41,8 +41,8 @@
|
|||||||
const actionBtns = function(data) {
|
const actionBtns = function(data) {
|
||||||
return `<td class="text-right py-0 align-middle">
|
return `<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<div class="btn-group btn-group-sm">
|
||||||
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
};
|
};
|
||||||
@ -90,48 +90,30 @@
|
|||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.btn-edit', function(e) {
|
$(document).on('click', '.btn-edit', function(e) {
|
||||||
//window.location.href = `<?= route_to('tarifaManipuladoList') ?>/${$(this).attr('data-id')}/edit`;
|
|
||||||
window.location.href = `/tarifas/tarifasmanipulado/edit/${$(this).attr('data-id')}`;
|
window.location.href = `/tarifas/tarifasmanipulado/edit/${$(this).attr('data-id')}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
$(document).on('click', '.btn-delete', function(e) {
|
||||||
Swal.fire({
|
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Tarifamanipulado.tarifa manipulado'))]) ?>',
|
});
|
||||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
|
||||||
icon: 'warning',
|
$(document).on('click', '.btn-remove', function(e) {
|
||||||
showCancelButton: true,
|
const dataId = $(this).attr('data-id');
|
||||||
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');
|
const row = $(this).closest('tr');
|
||||||
if (result.value) {
|
if ($.isNumeric(dataId)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
//url: `<?= route_to('tarifaManipuladoList') ?>/${dataId}`,
|
|
||||||
//method: 'DELETE',
|
|
||||||
url: `/tarifas/tarifasmanipulado/delete/${dataId}`,
|
url: `/tarifas/tarifasmanipulado/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
Toast.fire({
|
$('#confirm2delete').modal('toggle');
|
||||||
icon: 'success',
|
|
||||||
title: data.msg ?? jqXHR.statusText,
|
|
||||||
});
|
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable.row($(row)).invalidate().draw();
|
||||||
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
Toast.fire({
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
icon: 'error',
|
|
||||||
title: jqXHR.responseJSON.messages.error,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user