first push

This commit is contained in:
2025-05-23 14:44:12 +08:00
commit abefd1b19b
817 changed files with 580289 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
{% extends 'layouts/main-layout.html' %}
{% block content %}
<div class="page-heading">
<div class="page-title">
<div class="row">
<div class="col-12 col-md-6 order-md-1 order-last">
<h3>Notifications</h3>
</div>
<div class="col-12 col-md-6 order-md-2 order-first">
<nav aria-label="breadcrumb" class="breadcrumb-header float-start float-lg-end">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page">Notifications</li>
</ol>
</nav>
</div>
</div>
</div>
<section class="section">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-end my-2 gap-2">
<input name="search_text" type="search" class='dataTable-input' autocomplete="off" placeholder='Search here...'
hx-get="{% url 'notifications:search' page_object.number %}" hx-trigger="keyup changed delay:500ms, search" hx-target="#search_result">
</div>
<table class="table table-hover" id="table1">
<thead>
<tr>
<th>Sl No.</th>
<th>Icon</th>
<th>Title</th>
<th>Notification Text</th>
<th>Datetime</th>
<th>Action</th>
</tr>
</thead>
{% if page_object %}
<tbody id="search_result">
{% for user_notification in page_object %}
<tr>
<td>{{page_object.start_index|add:forloop.counter0}}</td>
<td><i class='bi {{user_notification.notification.icon}} bi-sub fs-4 text-muted'></i></td>
<td>{{user_notification.notification.notification_title | title}}</td>
<td>{{user_notification.notification.notification_text}}</td>
<td>{{user_notification.notification.created_at}}</td>
<td>
<div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
{% if user_notification.notification.link is not None %}
<a class="btn btn-success" href="{{user_notification.notification.link}}" class="btn btn-success" ><i class="bi bi-eye-fill"></i></a>
{% else %}
<button class="btn btn-danger" ><i class="bi bi-eye-fill"></i></button>
{% endif %}
</div>
</td>
<td>{{user_notification.last_login}}</td>
</tr>
{% endfor %}
</tbody>
{% else %}
<div class="alert alert-info" role="alert">
No record available!
</div>
{% endif %}
</table>
{% include 'commons/pagination.html' %}
</div>
</div>
</section>
</div>
{% endblock content%}
@@ -0,0 +1,10 @@
{% if not_authenticated %}
<script>location.reload()</script>
{% endif %}
{% if notification_count %}
<span class="badge bg-danger text-white position-absolute d-flex align-items-center justify-content-center rounded-circle"
style="top:10px; right:22px; height:1.2rem; width:1.2rem; font-size: 10px;">
{{notification_count}}
</span>
{% endif %}
@@ -0,0 +1,48 @@
{% if notifications %}
<li class="d-flex justify-content-between px-4 py-1 ">
<a href="{% url 'notifications:list' %}" class="btn btn-sm btn-primary">See All</a>
<a
class="btn btn-sm btn-danger"
hx-post="{% url 'notifications:clear' %}"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-trigger="click"
>Clear All</a>
</li>
{% endif %}
{% if notifications %}
{% for user_notification in notifications %}
<li class="m-2 rounded">
<div class="dropdown-item d-flex p-2 alert alert-dismissible show fade" style="cursor: pointer;">
<div><i class="bi {{user_notification.notification.icon}} fs-2 text-muted"></i></div>
<div
class="justify-content-between px-3"
{% if user_notification.notification.link is not None %}
onclick="location.href='{{user_notification.notification.link}}';"
hx-post="{% url 'notifications:seen' user_notification.id %}"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-trigger="click"
{% endif %}
>
<div class="d-flex flex-start gap-3">
<strong class="fs-6" >{{user_notification.notification.notification_title}}</strong>
<small>{{user_notification.notification.created_at}}</small>
</div>
<small>{{user_notification.notification.notification_text}}</small>
</div>
<button
hx-post="{% url 'notifications:seen' user_notification.id %}"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-trigger="click"
class="btn-close btn-sm p-1 m-2"
data-bs-dismiss="alert"
aria-label="Close">
</button>
</div>
</li>
{% endfor %}
{% else %}
<li><a class="dropdown-item">No notification available</a></li>
{% endif %}
@@ -0,0 +1,30 @@
{% if page_object %}
{% for user_notification in page_object %}
<tr>
<td>
{% if page_object.start_index %}
{{page_object.start_index|add:forloop.counter0}}
{% else %}
{{forloop.counter}}
{% endif %}
</td>
<td><i class='bi {{user_notification.notification.icon}} bi-sub fs-4 text-muted'></i></td>
<td>{{user_notification.notification.notification_title | title}}</td>
<td>{{user_notification.notification.notification_text}}</td>
<td>{{user_notification.notification.created_at}}</td>
<td>
<div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
{% if user_notification.notification.link is not None %}
<a class="btn btn-success" href="{{user_notification.notification.link}}" class="btn btn-success" ><i class="bi bi-eye-fill"></i></a>
{% else %}
<button class="btn btn-danger" ><i class="bi bi-eye-fill"></i></button>
{% endif %}
</div>
</td>
<td>{{user_notification.last_login}}</td>
</tr>
{% endfor %}
{% else %}
<td colspan="8" class="text-center"> No record found related to your search keyword</td>
{% endif %}