From 9b38a685e4dd338114ae7a23db47e9b4f8dd4ddd Mon Sep 17 00:00:00 2001 From: imnavajas Date: Thu, 21 Sep 2023 23:44:54 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adida=20funcionalidad=20de=20modal=20de?= =?UTF-8?q?=20confirmacion=20=5FmodalConfirmDialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Language/es/MaquinasPapelImpresion.php | 2 +- ci4/app/Language/es/PapelImpresion.php | 2 +- .../_commonPartialsBs/_modalConfirmDialog.php | 45 ++++++++++ .../themes/_commonPartialsBs/_modalDialog.php | 72 ---------------- .../maquinas/viewMaquinaForm.php | 83 ++++++------------- 5 files changed, 73 insertions(+), 131 deletions(-) create mode 100644 ci4/app/Views/themes/_commonPartialsBs/_modalConfirmDialog.php delete mode 100644 ci4/app/Views/themes/_commonPartialsBs/_modalDialog.php diff --git a/ci4/app/Language/es/MaquinasPapelImpresion.php b/ci4/app/Language/es/MaquinasPapelImpresion.php index 65f6e453..281f6933 100644 --- a/ci4/app/Language/es/MaquinasPapelImpresion.php +++ b/ci4/app/Language/es/MaquinasPapelImpresion.php @@ -6,6 +6,6 @@ return [ 'papel_impresion_maquinas' => 'Papeles impresion', 'activo' => 'Activo', 'gramaje_duplicado' => 'No se pueden seleccionar dos papeles con el mismo gramaje', - 'sureToChangeRotativaTitle' => 'Está seguro de cambiar esta opción?', + 'sureToChangeRotativaTitle' => '¿Está seguro de cambiar esta opción?', 'sureToChangeRotativaText' => 'Está operación no se puede deshacer y cambiará la lista de papeles.', ]; \ No newline at end of file diff --git a/ci4/app/Language/es/PapelImpresion.php b/ci4/app/Language/es/PapelImpresion.php index aae90965..c730654d 100644 --- a/ci4/app/Language/es/PapelImpresion.php +++ b/ci4/app/Language/es/PapelImpresion.php @@ -37,7 +37,7 @@ return [ 'consumo_tintas_rotativas' => 'Consumo tintas rotativas', 'maquinas_papel' => 'Máquinas seleccionadas', - 'sureToChangeRotativaTitle' => 'Está seguro de cambiar esta opción?', + 'sureToChangeRotativaTitle' => '¿Está seguro de cambiar esta opción?', 'sureToChangeRotativaText' => 'Está operación no se puede deshacer, cambiará la lista de máquinas y el consumo de tintas.', 'validation' => [ diff --git a/ci4/app/Views/themes/_commonPartialsBs/_modalConfirmDialog.php b/ci4/app/Views/themes/_commonPartialsBs/_modalConfirmDialog.php new file mode 100644 index 00000000..e2b6d8c3 --- /dev/null +++ b/ci4/app/Views/themes/_commonPartialsBs/_modalConfirmDialog.php @@ -0,0 +1,45 @@ + + + +section('additionalInlineJs') ?> + + +function asyncConfirmDialog(title, msg, yesCallbackFn, noCallbackFn) { + var $confirmDialog = $("#modalConfirmYesNo"); + $confirmDialog.modal('show'); + $("#labelTitleConfirmDialog").html(title); + $("#labelMsgConfirmDialog").html(msg); + $("#btnYesConfirmDialog").off('click').click(function () { + yesCallbackFn(); + $confirmDialog.modal("hide"); + }); + $("#btnNoConfirmDialog").off('click').click(function () { + noCallbackFn(); + $confirmDialog.modal("hide"); + }); + } + +endSection() ?> + + diff --git a/ci4/app/Views/themes/_commonPartialsBs/_modalDialog.php b/ci4/app/Views/themes/_commonPartialsBs/_modalDialog.php deleted file mode 100644 index d04b309d..00000000 --- a/ci4/app/Views/themes/_commonPartialsBs/_modalDialog.php +++ /dev/null @@ -1,72 +0,0 @@ - - - - -section('additionalInlineJs') ?> - -function popAlert(message, alertClass, alertIcon){ - var htmlString = ` - `; - $(window).scrollTop(0); - $('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){ - setTimeout(function(){ - $('#sk-alert').fadeOut("slow"); - }, 5000); - }); -} - -function popSuccessAlert(successMsg){ - popAlert(successMsg, "alert-success", "ti-check"); -} - -function popWarningAlert(warningMsg){ - popAlert(warningMsg, "alert-warning", "ti-bell"); -} - -function popErrorAlert(errorMsg){ - popAlert(errorMsg, "alert-danger", "ti-ban"); -} - - - popSuccessAlert(``); - - - - popWarningAlert(``); - - - - popErrorAlert(``); - - -endSection() ?> - - diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php index df27a19a..f6dfb40d 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php @@ -98,10 +98,15 @@ + + + + + endSection() ?> @@ -141,73 +146,37 @@ }); $('#isRotativa').on("click",function(el){ - - AsyncConfirmYesNo('title', 'msg', MyYesFunction, MyNoFunction); - - /*Swal.fire({ - title: '', - text: '', - icon: 'warning', - showCancelButton: true, - confirmButtonColor: '#3085d6', - confirmButtonText: '', - cancelButtonText: '', - cancelButtonColor: '#d33' - }) - .then((result) => { - if (result.value) { - - if($(this).is(':checked')){ - isRotativa.watch = 1; - $("#datosRotativa").show(); - }else{ - document.getElementById("precioTintaNegro").value = null; - document.getElementById("precioTintaColor").value = null; - document.getElementById("velocidadCorte").value = null; - document.getElementById("precioHoraCorte").value = null; - document.getElementById("metrosxminuto").value = null; - $("#datosRotativa").hide(); - isRotativa.watch = 0; - } - - theTable2.clearPipeline(); - theTable2.draw(); - yeniden(response.); - } - }); - */ + asyncConfirmDialog('', + '', yesCallback, noCallback); }); - function AsyncConfirmYesNo(title, msg, yesFn, noFn) { - var $confirm = $("#modalConfirmYesNo"); - $confirm.modal('show'); - $("#lblTitleConfirmYesNo").html(title); - $("#lblMsgConfirmYesNo").html(msg); - $("#btnYesConfirmYesNo").off('click').click(function () { - yesFn(); - $confirm.modal("hide"); - }); - $("#btnNoConfirmYesNo").off('click').click(function () { - noFn(); - $confirm.modal("hide"); - }); + function yesCallback() { + if($('#isRotativa').is(':checked')){ + isRotativa.watch = 1; + $("#datosRotativa").show(); + }else{ + document.getElementById("precioTintaNegro").value = 0; + document.getElementById("precioTintaColor").value = 0; + document.getElementById("velocidadCorte").value = 0; + document.getElementById("precioHoraCorte").value = 0; + document.getElementById("metrosxminuto").value = 0; + $("#datosRotativa").hide(); + isRotativa.watch = 0; + } + theTable2.clearPipeline(); + theTable2.draw(); + //yeniden(response.); esto da error JJO? } - function MyYesFunction() { - alert("Time to get off your workstation!"); - $("#lblTestResult").html("You are hungry"); - } - function MyNoFunction() { - alert("Well... just continue working."); - $("#lblTestResult").html("You are not hungry"); + function noCallback() { + // Toggle behaviour + $('#isRotativa').prop("checked", !$('#isRotativa').prop("checked")); } $('#isPadre').on("click",function(el){ if($(this).is(':checked')){ - $("#selectVariante").show(); }else{ - $("#padreId").select2('val', -1); $("#selectVariante").hide(); }