fix alert
This commit is contained in:
parent
49caec88af
commit
e7063b16f7
|
@ -1,44 +1,28 @@
|
||||||
<!-- Toast Notification (Hidden by default) -->
|
<!-- Toast Notification (Hidden by default) -->
|
||||||
<div class="position-fixed top-0 end-0 p-3" style="z-index: 1111">
|
@if (session()->has('success') || session()->has('error') || session()->has('warning'))
|
||||||
<div id="toast-container" class="toast overflow-hidden mt-3 fade hide" role="alert" aria-live="assertive" aria-atomic="true">
|
<div class="position-fixed top-0 end-0 p-3" style="z-index: 1111">
|
||||||
@if (session('success'))
|
<div id="toastContainer" class="toast fade hide mt-3 overflow-hidden" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
<div class="align-items-center text-white bg-success border-0">
|
@foreach (['success' => 'bg-success', 'error' => 'bg-danger', 'warning' => 'bg-warning'] as $type => $class)
|
||||||
<div class="d-flex">
|
@if (session()->has($type))
|
||||||
<div class="toast-body">
|
<div class="align-items-center text-white {{ $class }} border-0">
|
||||||
{{ session('success') }}
|
<div class="d-flex">
|
||||||
</div>
|
<div class="toast-body">
|
||||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
{{ session($type) }}
|
||||||
</div>
|
</div>
|
||||||
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
@if (session('error'))
|
|
||||||
<div class="align-items-center text-white bg-danger border-0">
|
|
||||||
<div class="d-flex">
|
|
||||||
<div class="toast-body">
|
|
||||||
{{ session('error') }}
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@if (session('warning'))
|
|
||||||
<div class="align-items-center text-white bg-warning border-0">
|
|
||||||
<div class="d-flex">
|
|
||||||
<div class="toast-body">
|
|
||||||
{{ session('warning') }}
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
|
|
||||||
<!-- Toast JavaScript -->
|
<!-- Toast JavaScript -->
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
// Show the toast when a message is flashed
|
// Show the toast when a message is flashed
|
||||||
const toastTrigger = document.getElementById("toast-container");
|
const toastTrigger = document.getElementById("toastContainer");
|
||||||
if (toastTrigger) {
|
if (toastTrigger) {
|
||||||
const toast = new bootstrap.Toast(toastTrigger, { delay: 3000 });
|
const toast = new bootstrap.Toast(toastTrigger, { delay: 3000 });
|
||||||
toast.show();
|
toast.show();
|
||||||
|
|
Loading…
Reference in New Issue