master_template/resources/views/backend/parts/notifications.blade.php

191 lines
8.9 KiB
PHP
Raw Permalink Normal View History

2024-06-10 12:21:58 +00:00
@use('App\Models\Enquiries')
@php
$enquiryList = Enquiries::where('status', 1)->where('is_read', 0)->latest()->with('class')->get();
$enquiryCount = $enquiryList->count();
@endphp
<div class="dropdown topbar-head-dropdown header-item ms-1" id="notificationDropdown">
<button type="button" class="btn btn-icon btn-topbar btn-ghost-secondary rounded-circle"
id="page-header-notifications-dropdown" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-haspopup="true"
aria-expanded="false">
<i class='bx bx-bell fs-22'></i>
<span
class="position-absolute topbar-badge fs-10 translate-middle badge rounded-pill bg-danger">{{ $enquiryCount ?? 0 }}<span
class="visually-hidden">unread messages</span></span>
</button>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end p-0"
aria-labelledby="page-header-notifications-dropdown">
<div class="dropdown-head bg-primary bg-pattern rounded-top">
<div class="p-3">
<div class="row align-items-center">
<div class="col">
<h6 class="fs-16 fw-semibold m-0 text-white"> Notifications </h6>
</div>
<div class="dropdown-tabs col-auto">
<span class="badge badge-soft-light fs-13"> {{ $enquiryCount ?? 0 }} New</span>
</div>
</div>
</div>
<div class="px-2 pt-2">
<ul class="nav nav-tabs dropdown-tabs nav-tabs-custom" data-dropdown-tabs="true" id="notificationItemsTab"
role="tablist">
<li class="nav-item waves-effect waves-light">
<a class="nav-link active" data-bs-toggle="tab" href="#all-noti-tab" role="tab" aria-selected="true">
All ({{ $enquiryCount ?? 0 }})
</a>
</li>
<li class="nav-item waves-effect waves-light">
<a class="nav-link" data-bs-toggle="tab" href="#messages-tab" role="tab" aria-selected="false">
Contact
</a>
</li>
<li class="nav-item waves-effect waves-light">
<a class="nav-link" data-bs-toggle="tab" href="#alerts-tab" role="tab" aria-selected="false">
Enquiry
</a>
</li>
</ul>
</div>
</div>
<div class="tab-content position-relative" id="notificationItemsTabContent">
<div class="tab-pane fade show active py-2 ps-2" id="all-noti-tab" role="tabpanel">
<div data-simplebar style="max-height: 300px;" class="pe-2">
@foreach ($enquiryList as $item)
<div class="text-reset notification-item d-block dropdown-item position-relative">
<div class="d-flex">
<div class="avatar-xs me-3 flex-shrink-0">
<span class="avatar-title bg-danger-subtle text-danger rounded-circle fs-16">
<i class='bx bx-message-square-dots'></i>
</span>
</div>
<div class="flex-1">
<a href="#!" class="stretched-link">
<h6 class="fs-13 fw-semibold mb-1 mt-0">{{ $item->name }}</h6>
</a>
<div class="fs-13 text-muted">
<p class="mb-1">
@if ($item->enquiry_type == 'contact')
?
{{ Str::words($item->message, 10, '...') }}
@else
Class Inquiry:
{{ $item->class->title }}({{ $item->class->classtime->format('H:i A') ?? '00:00' }})
@endif
</p>
</div>
<p class="fs-11 fw-medium text-uppercase text-muted mb-0">
<span><i class="mdi mdi-clock-outline"></i> {{ $item->created_at->diffForHumans() }}</span>
</p>
</div>
<div class="fs-15 px-2">
<div class="form-check notification-check">
<input class="form-check-input" type="checkbox" value="{{ $item->enquiry_id }}"
id="all-notification-check02">
<label class="form-check-label" for="all-notification-check02"></label>
</div>
</div>
</div>
</div>
@endforeach
<div class="view-all my-3 text-center">
<button type="button" class="btn btn-soft-success waves-effect waves-light">View
All Notifications <i class="ri-arrow-right-line align-middle"></i></button>
</div>
</div>
</div>
<div class="tab-pane fade py-2 ps-2" id="messages-tab" role="tabpanel" aria-labelledby="messages-tab">
<div data-simplebar style="max-height: 300px;" class="pe-2">
@foreach ($enquiryList->where('enquiry_type', 'contact') as $contactItem)
<div class="text-reset notification-item d-block dropdown-item">
<div class="d-flex">
<div class="avatar-xs me-3 flex-shrink-0">
<span class="avatar-title bg-danger-subtle text-danger rounded-circle fs-16">
<i class='bx bx-message-square-dots'></i>
</span>
</div>
<div class="flex-1">
<a href="#!" class="stretched-link">
<h6 class="fs-13 fw-semibold mb-1 mt-0">{{ $contactItem->name }}</h6>
</a>
<div class="fs-13 text-muted">
<p class="mb-1">{{ $contactItem->message }}</p>
</div>
<p class="fs-11 fw-medium text-uppercase text-muted mb-0">
<span><i class="mdi mdi-clock-outline"></i> {{ $contactItem->created_at->diffForHumans() }}</span>
</p>
</div>
<div class="fs-15 px-2">
<div class="form-check notification-check">
<input class="form-check-input" type="checkbox" value="{{ $contactItem->enquiry_id }}"
id="messages-notification-check01">
<label class="form-check-label" for="messages-notification-check01"></label>
</div>
</div>
</div>
</div>
@endforeach
<div class="view-all my-3 text-center">
<button type="button" class="btn btn-soft-success waves-effect waves-light">View
All Messages <i class="ri-arrow-right-line align-middle"></i></button>
</div>
</div>
</div>
<div class="tab-pane fade p-1" id="alerts-tab" role="tabpanel" aria-labelledby="alerts-tab">
<div data-simplebar style="max-height: 300px;" class="pe-2">
@foreach ($enquiryList->where('enquiry_type', 'class') as $classItem)
<div class="text-reset notification-item d-block dropdown-item">
<div class="d-flex">
<div class="avatar-xs me-3 flex-shrink-0">
<span class="avatar-title bg-danger-subtle text-danger rounded-circle fs-16">
<i class='bx bx-message-square-dots'></i>
</span>
</div>
<div class="flex-1">
<a href="#!" class="stretched-link">
<h6 class="fs-13 fw-semibold mb-1 mt-0">{{ $classItem->name }}</h6>
</a>
<div class="fs-13 text-muted">
<p class="mb-1">{{ 'Class Inquiry: ' . $classItem->class->title }}
({{ $classItem->class->classtime->format('H:i A') ?? '00:00' }})
</p>
</div>
<p class="fs-11 fw-medium text-uppercase text-muted mb-0">
<span><i class="mdi mdi-clock-outline"></i> {{ $classItem->created_at->diffForHumans() }}</span>
</p>
</div>
<div class="fs-15 px-2">
<div class="form-check notification-check">
<input class="form-check-input" type="checkbox" value="{{ $classItem->enquiry_id }}"
id="messages-notification-check01">
<label class="form-check-label" for="messages-notification-check01"></label>
</div>
</div>
</div>
</div>
@endforeach
<div class="view-all my-3 text-center">
<button type="button" class="btn btn-soft-success waves-effect waves-light">View
All Enquiry <i class="ri-arrow-right-line align-middle"></i></button>
</div>
</div>
</div>
<div class="notification-actions" id="notification-actions">
<div class="d-flex text-muted justify-content-center">
Select <div id="select-content" class="text-body fw-semibold px-1">0</div> Result <button type="button"
class="btn btn-link link-danger ms-3 p-0" data-bs-toggle="modal"
data-bs-target="#removeNotificationModal">Mark Read</button>
</div>
</div>
</div>
</div>
</div>