Creating modalDialog functionality

This commit is contained in:
imnavajas
2023-09-14 14:15:31 +02:00
parent d5ffd39b5f
commit 3a09e6166a
4 changed files with 118 additions and 18 deletions

2
.idea/deployment.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" autoUpload="Always" serverName="SK-JJO" remoteFilesAllowedToDisappearOnAutoupload="false" confirmBeforeUploading="false">
<component name="PublishConfigData" autoUpload="Always" serverName="SK-IMN" remoteFilesAllowedToDisappearOnAutoupload="false" confirmBeforeUploading="false">
<option name="confirmBeforeUploading" value="false" />
<serverData>
<paths name="SK-IMN">

View File

@ -0,0 +1,72 @@
<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">&times;</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() ?>

View File

@ -11,21 +11,21 @@
<?= $this->section('additionalInlineJs') ?>
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
<?php if (session('sweet-success')) {

View File

@ -99,7 +99,8 @@
</div>
</div> <!-- //.accordion -->
<?php endif; ?>
<?= $this->endSection() ?>
@ -140,8 +141,10 @@
});
$('#isRotativa').on("click",function(el){
AsyncConfirmYesNo('title', 'msg', MyYesFunction, MyNoFunction);
Swal.fire({
/*Swal.fire({
title: '<?= lang('MaquinasPapelImpresion.sureToChangeRotativaTitle') ?>',
text: '<?= lang('MaquinasPapelImpresion.sureToChangeRotativaText') ?>',
icon: 'warning',
@ -172,8 +175,33 @@
yeniden(response.<?= csrf_token() ?>);
}
});
*/
});
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 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");
}
$('#isPadre').on("click",function(el){
if($(this).is(':checked')){