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') ?>
|
||||
|
||||
function popAlert(message, alertClass, alertIcon){
|
||||
function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
|
||||
var htmlString = `
|
||||
<div class="alert ${alertClass} d-flex align-items-baseline" role="alert">
|
||||
<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>
|
||||
</div>
|
||||
</div>`;
|
||||
$(window).scrollTop(0);
|
||||
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
if(containerId == 'sk-alert'){
|
||||
$(window).scrollTop(0);
|
||||
}
|
||||
$('#' + containerId).hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
setTimeout(function(){
|
||||
$('#sk-alert').fadeOut("slow");
|
||||
$('#' + containerId).fadeOut("slow");
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function popSuccessAlert(successMsg){
|
||||
popAlert(successMsg, "alert-success", "ti-check");
|
||||
function popSuccessAlert(successMsg, containerId = 'sk-alert'){
|
||||
popAlert(successMsg, "alert-success", "ti-check", containerId);
|
||||
}
|
||||
|
||||
function popWarningAlert(warningMsg){
|
||||
popAlert(warningMsg, "alert-warning", "ti-bell");
|
||||
function popWarningAlert(warningMsg, containerId = 'sk-alert'){
|
||||
popAlert(warningMsg, "alert-warning", "ti-bell", containerId);
|
||||
}
|
||||
|
||||
function popErrorAlert(errorMsg){
|
||||
popAlert(errorMsg, "alert-danger", "ti-ban");
|
||||
function popErrorAlert(errorMsg, containerId = 'sk-alert'){
|
||||
popAlert(errorMsg, "alert-danger", "ti-ban", containerId);
|
||||
}
|
||||
|
||||
<?php if (isset($successMessage) && $successMessage){ ?>
|
||||
|
||||
Reference in New Issue
Block a user