mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
modificados boton editar y borrar de la lista
This commit is contained in:
@ -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,12 +41,13 @@
|
|||||||
|
|
||||||
const lastColNr = $('#tableOfTarifasencuadernacion').find("tr:first th").length - 1;
|
const lastColNr = $('#tableOfTarifasencuadernacion').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 = $('#tableOfTarifasencuadernacion').DataTable({
|
theTable = $('#tableOfTarifasencuadernacion').DataTable({
|
||||||
@ -94,46 +95,29 @@
|
|||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.btn-edit', function(e) {
|
$(document).on('click', '.btn-edit', function(e) {
|
||||||
//window.location.href = `<?= route_to('tarifaEncuadernacionList') ?>/${$(this).attr('data-id')}/edit`;
|
|
||||||
window.location.href = `/tarifas/tarifasencuadernacion/edit/${$(this).attr('data-id')}`;
|
window.location.href = `/tarifas/tarifasencuadernacion/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('Tarifaencuadernacion.tarifa encuadernacion'))]) ?>',
|
});
|
||||||
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',
|
const row = $(this).closest('tr');
|
||||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
if ($.isNumeric(dataId)) {
|
||||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
$.ajax({
|
||||||
cancelButtonColor: '#d33'
|
url: `/tarifas/tarifasencuadernacion/delete/${dataId}`,
|
||||||
})
|
method: 'GET',
|
||||||
.then((result) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
const dataId = $(this).data('id');
|
$('#confirm2delete').modal('toggle');
|
||||||
const row = $(this).closest('tr');
|
theTable.clearPipeline();
|
||||||
if (result.value) {
|
theTable.row($(row)).invalidate().draw();
|
||||||
$.ajax({
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
//url: `<?= route_to('tarifaEncuadernacionList') ?>/${dataId}`,
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
//method: 'DELETE',
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
url: `/tarifas/tarifasencuadernacion/delete/${dataId}`,
|
})
|
||||||
method: 'GET',
|
}
|
||||||
}).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,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user