diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionList.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionList.php
index a9445187..6810c9af 100644
--- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionList.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionList.php
@@ -1,5 +1,5 @@
=$this->include('themes/_commonPartialsBs/datatables') ?>
-=$this->include('themes/_commonPartialsBs/sweetalert') ?>
+= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
=$this->section('content'); ?>
@@ -41,12 +41,13 @@
const lastColNr = $('#tableOfTarifasencuadernacion').find("tr:first th").length - 1;
const actionBtns = function(data) {
- return `
+ return `
+ |
- | `;
+ `;
};
theTable = $('#tableOfTarifasencuadernacion').DataTable({
@@ -94,46 +95,29 @@
$(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')}`;
});
-
+
$(document).on('click', '.btn-delete', function(e) {
- Swal.fire({
- title: '= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Tarifaencuadernacion.tarifa encuadernacion'))]) ?>',
- 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('tarifaEncuadernacionList') ?>/${dataId}`,
- //method: 'DELETE',
- 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,
- });
- })
- }
- });
+ $(".btn-remove").attr('data-id', $(this).attr('data-id'));
+ });
+
+ $(document).on('click', '.btn-remove', function(e) {
+ const dataId = $(this).attr('data-id');
+ const row = $(this).closest('tr');
+ if ($.isNumeric(dataId)) {
+ $.ajax({
+ url: `/tarifas/tarifasencuadernacion/delete/${dataId}`,
+ method: 'GET',
+ }).done((data, textStatus, jqXHR) => {
+ $('#confirm2delete').modal('toggle');
+ theTable.clearPipeline();
+ theTable.row($(row)).invalidate().draw();
+ popSuccessAlert(data.msg ?? jqXHR.statusText);
+ }).fail((jqXHR, textStatus, errorThrown) => {
+ popErrorAlert(jqXHR.responseJSON.messages.error)
+ })
+ }
});