mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Añadida funcionalidad de modal de confirmacion _modalConfirmDialog
This commit is contained in:
@ -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.',
|
||||
];
|
||||
@ -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' => [
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
<div id="modalConfirmYesNo" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 id="labelTitleConfirmDialog" class="modal-title"></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="labelMsgConfirmDialog"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="btnYesConfirmDialog"
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
><?= lang('Basic.global.yes') ?></button>
|
||||
<button id="btnNoConfirmDialog"
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
><?= lang('Basic.global.Cancel') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->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");
|
||||
});
|
||||
}
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
|
||||
<div id="modalConfirmYesNo" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 id="lblTitleConfirmYesNo" class="modal-title">Confirmation</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="lblMsgConfirmYesNo"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="btnYesConfirmYesNo"
|
||||
type="button" class="btn btn-primary">Yes</button>
|
||||
<button id="btnNoConfirmYesNo"
|
||||
type="button" class="btn btn-default">No</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
function popAlert(message, alertClass, alertIcon){
|
||||
var htmlString = `
|
||||
<div class="alert ${alertClass} d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ${alertIcon} ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">${message}</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
$(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");
|
||||
}
|
||||
|
||||
<?php if (isset($successMessage) && $successMessage){ ?>
|
||||
popSuccessAlert(`<?= $successMessage ?>`);
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($warningMessage) && $warningMessage){ ?>
|
||||
popWarningAlert(`<?= $warningMessage ?>`);
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($errorMessage) && $errorMessage){ ?>
|
||||
popErrorAlert(`<?= $errorMessage ?>`);
|
||||
<?php } ?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -98,10 +98,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -141,73 +146,37 @@
|
||||
});
|
||||
|
||||
$('#isRotativa').on("click",function(el){
|
||||
|
||||
AsyncConfirmYesNo('title', 'msg', MyYesFunction, MyNoFunction);
|
||||
|
||||
/*Swal.fire({
|
||||
title: '<?= lang('MaquinasPapelImpresion.sureToChangeRotativaTitle') ?>',
|
||||
text: '<?= lang('MaquinasPapelImpresion.sureToChangeRotativaText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.yes') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
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.<?= csrf_token() ?>);
|
||||
}
|
||||
});
|
||||
*/
|
||||
asyncConfirmDialog('<?= lang('MaquinasPapelImpresion.sureToChangeRotativaTitle') ?>',
|
||||
'<?= lang('MaquinasPapelImpresion.sureToChangeRotativaText') ?>', 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.<?= csrf_token() ?>); 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user