Añadida funcionalidad de modal de confirmacion _modalConfirmDialog

This commit is contained in:
imnavajas
2023-09-21 23:44:54 +02:00
parent 46cff7dd2f
commit 9b38a685e4
5 changed files with 73 additions and 131 deletions

View File

@ -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();
}