Eliminado Swal por Toastr. Refactorizadas las alertBoxes

This commit is contained in:
imnavajas
2023-07-25 23:02:39 +02:00
parent fa27f25d10
commit 3d56cd216c
7 changed files with 80 additions and 218 deletions

View File

@ -1,90 +1,41 @@
<!-- Push section css -->
<?= $this->section('css') ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-dark@4/dark.css">
<!-- <link rel="stylesheet" href="--><?php //= site_url('themes/vuexy/vendor/libs/toastr/toastr.css') ?><!--"/>-->
1 <style>
/* Toastr */
.colored-toast.swal2-icon-success {
background-color: #478921 !important;
}
.colored-toast.swal2-icon-error {
background-color: #c42a2a !important;
}
.colored-toast.swal2-icon-warning {
background-color: #f8bb86 !important;
}
.colored-toast.swal2-icon-info {
background-color: #3fc3ee !important;
}
.colored-toast.swal2-icon-question {
background-color: #87adbd !important;
}
.colored-toast .swal2-title {
color: white;
}
.colored-toast .swal2-close {
color: white;
}
.colored-toast .swal2-html-container {
color: white;
}
</style>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/toastr/toastr.css') ?>"/>
<?= $this->endSection() ?>
<!-- Push section js -->
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js"></script>
<!--<script src="--><?php //= site_url('themes/vuexy/vendor/libs/toastr/toastr.js') ?><!--"></script>-->
<script src="<?= site_url('themes/vuexy/vendor/libs/toastr/toastr.js') ?>"></script>
<?= $this->endSection() ?>
<?= $this->section('additionalInlineJs') ?>
const Toast = Swal.mixin({
toast: true,
position: 'top-right',
iconColor: 'white',
customClass: {
popup: 'colored-toast'
},
showConfirmButton: false,
timer: 6000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
});
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"
};
<?php if (session('sweet-success')) { ?>
Toast.fire({
icon: 'success',
title: '<?= session('sweet-success.') ?>'
});
<?php } ?>
<?php if (session('sweet-warning')) { ?>
Toast.fire({
icon: 'warning',
title: '<?= session('sweet-warning.') ?>'
});
<?php } ?>
<?php if (session('sweet-error')) { ?>
Toast.fire({
icon: 'error',
title: '<?= session('sweet-error.') ?>'
});
<?php } ?>
toastr.success(`<?= session('sweet-success') ?>`);
<?php } ?>
<?php if (session('sweet-warning')) { ?>
toastr.success(`<?= session('sweet-warning') ?>`);
<?php } ?>
<?php if (session('sweet-error')) { ?>
toastr.success(`<?= session('sweet-error') ?>`);
<?php } ?>
<?= $this->endSection() ?>