mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Añadida funcionalidad de generar alertas en base al id de un contenedor especifico
This commit is contained in:
@ -24,7 +24,7 @@ if (session()->has('error')) {
|
|||||||
|
|
||||||
<?= $this->section('additionalInlineJs') ?>
|
<?= $this->section('additionalInlineJs') ?>
|
||||||
|
|
||||||
function popAlert(message, alertClass, alertIcon){
|
function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
|
||||||
var htmlString = `
|
var htmlString = `
|
||||||
<div class="alert ${alertClass} d-flex align-items-baseline" role="alert">
|
<div class="alert ${alertClass} d-flex align-items-baseline" role="alert">
|
||||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||||
@ -34,24 +34,26 @@ function popAlert(message, alertClass, alertIcon){
|
|||||||
<h5 class="alert-heading mb-2">${message}</h5>
|
<h5 class="alert-heading mb-2">${message}</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
$(window).scrollTop(0);
|
if(containerId == 'sk-alert'){
|
||||||
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
|
$(window).scrollTop(0);
|
||||||
|
}
|
||||||
|
$('#' + containerId).hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('#sk-alert').fadeOut("slow");
|
$('#' + containerId).fadeOut("slow");
|
||||||
}, 5000);
|
}, 5000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function popSuccessAlert(successMsg){
|
function popSuccessAlert(successMsg, containerId = 'sk-alert'){
|
||||||
popAlert(successMsg, "alert-success", "ti-check");
|
popAlert(successMsg, "alert-success", "ti-check", containerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function popWarningAlert(warningMsg){
|
function popWarningAlert(warningMsg, containerId = 'sk-alert'){
|
||||||
popAlert(warningMsg, "alert-warning", "ti-bell");
|
popAlert(warningMsg, "alert-warning", "ti-bell", containerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function popErrorAlert(errorMsg){
|
function popErrorAlert(errorMsg, containerId = 'sk-alert'){
|
||||||
popAlert(errorMsg, "alert-danger", "ti-ban");
|
popAlert(errorMsg, "alert-danger", "ti-ban", containerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
<?php if (isset($successMessage) && $successMessage){ ?>
|
<?php if (isset($successMessage) && $successMessage){ ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user