From b9f8da95583563dfd173c92c84a5004cd7290c82 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Sun, 23 Jul 2023 21:39:52 +0200 Subject: [PATCH] Creado popups de alerts para exito y error --- ci4/.env | 2 +- .../Controllers/GoBaseResourceController.php | 3 +- .../themes/_commonPartialsBs/_alertBoxes.php | 50 ++++++++++++++----- .../tarifas/acabado/viewTarifaAcabadoList.php | 15 ++---- 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/ci4/.env b/ci4/.env index d1721449..e77bc5bf 100644 --- a/ci4/.env +++ b/ci4/.env @@ -22,7 +22,7 @@ CI_ENVIRONMENT = development # APP #-------------------------------------------------------------------- -app.baseURL = 'https://sk-jjo.imnavajas.es' +app.baseURL = 'https://sk-imn.imnavajas.es' #app.baseURL = 'https://sk-imn.imnavajas.es' # app.baseURL = "http://safekat.test/" # app.forceGlobalSecureRequests = false diff --git a/ci4/app/Controllers/GoBaseResourceController.php b/ci4/app/Controllers/GoBaseResourceController.php index 363b173a..7310be40 100644 --- a/ci4/app/Controllers/GoBaseResourceController.php +++ b/ci4/app/Controllers/GoBaseResourceController.php @@ -234,7 +234,8 @@ abstract class GoBaseResourceController extends \CodeIgniter\RESTful\ResourceCon } - $message = lang('Basic.global.deleteSuccess', [$objName]); + // $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented + $message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]); $response = $this->respondDeleted(['id' => $id, 'msg' => $message]); return $response; } diff --git a/ci4/app/Views/themes/_commonPartialsBs/_alertBoxes.php b/ci4/app/Views/themes/_commonPartialsBs/_alertBoxes.php index 72f110eb..1c57a5af 100644 --- a/ci4/app/Views/themes/_commonPartialsBs/_alertBoxes.php +++ b/ci4/app/Views/themes/_commonPartialsBs/_alertBoxes.php @@ -63,24 +63,50 @@ if (session()->has('error')) {
-
section('additionalInlineJs') ?> -$('#sk-alert').on('click', function (e) { +function popSuccessAlert(successMsg){ + var htmlString = ` + `; -$(this).fadeOut("slow"); -}); + $(window).scrollTop(0); + $('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){ + setTimeout(function(){ + $('#sk-alert').fadeOut("slow"); + }, 5000); + }); +} + +function popErrorAlert(errorMsg){ + var htmlString = ` + `; + + $(window).scrollTop(0); + $('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){ + setTimeout(function(){ + $('#sk-alert').fadeOut("slow"); + }, 5000); + }); +} endSection() ?> diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/acabado/viewTarifaAcabadoList.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/acabado/viewTarifaAcabadoList.php index 32d34dec..2420f8e8 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/acabado/viewTarifaAcabadoList.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/acabado/viewTarifaAcabadoList.php @@ -107,25 +107,16 @@ const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1; url: `/tarifas/tarifaacabado/delete/${dataId}`, method: 'GET', }).done((data, textStatus, jqXHR) => { - $('#confirm2delete').modal('toggle'), - Toast.fire({ - icon: 'success', - title: data.msg ?? jqXHR.statusText, - }); - + $('#confirm2delete').modal('toggle'); theTable.clearPipeline(); theTable.row($(row)).invalidate().draw(); + popSuccessAlert(data.msg ?? jqXHR.statusText); }).fail((jqXHR, textStatus, errorThrown) => { - Toast.fire({ - icon: 'error', - title: jqXHR.responseJSON.messages.error, - }); + popErrorAlert(jqXHR.responseJSON.messages.error) }) } }); - - endSection() ?>