Add notif page
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{% extends "common/base.html" %}
|
||||
{% from "components/header.html" import header %}
|
||||
|
||||
{% block title %}Notifications - {{ super() }}{% endblock %}
|
||||
{% block title %}Notifications - DocuPulse{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ header(
|
||||
@@ -11,10 +11,154 @@
|
||||
) }}
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="card">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<p class="text-muted">No notifications at this time.</p>
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h5 class="card-title mb-0"></h5>
|
||||
<div class="d-flex gap-2">
|
||||
<select id="notifTypeFilter" class="form-select form-select-sm">
|
||||
<option value="">All Notification Types</option>
|
||||
<option value="account_created">Account Created</option>
|
||||
<option value="password_reset">Password Reset</option>
|
||||
<option value="account_deleted">Account Deleted</option>
|
||||
<option value="account_updated">Account Updated</option>
|
||||
<option value="room_invite">Room Invite</option>
|
||||
<option value="room_invite_removed">Room Invite Removed</option>
|
||||
<option value="conversation_invite">Conversation Invite</option>
|
||||
<option value="conversation_invite_removed">Conversation Invite Removed</option>
|
||||
<option value="conversation_message">Conversation Message</option>
|
||||
</select>
|
||||
<select id="dateRangeFilter" class="form-select form-select-sm">
|
||||
<option value="24h">Last 24 Hours</option>
|
||||
<option value="7d" selected>Last 7 Days</option>
|
||||
<option value="30d">Last 30 Days</option>
|
||||
<option value="all">All Time</option>
|
||||
</select>
|
||||
<button id="clearFilters" class="btn btn-secondary btn-sm">
|
||||
<i class="fas fa-times me-1"></i>Clear Filters
|
||||
</button>
|
||||
<button id="markAllRead" class="btn btn-primary btn-sm">
|
||||
<i class="fas fa-check-double"></i> Mark All as Read
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>Type</th>
|
||||
<th>From</th>
|
||||
<th>Details</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="notifsTableBody">
|
||||
{% if notifications %}
|
||||
{% for notif in notifications %}
|
||||
<tr class="{% if not notif.read %}table-warning{% endif %}">
|
||||
<td>{{ notif.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}</td>
|
||||
<td>
|
||||
{% if notif.notif_type == 'account_created' %}
|
||||
<span class="badge bg-success">Account Created</span>
|
||||
{% elif notif.notif_type == 'password_reset' %}
|
||||
<span class="badge bg-warning">Password Reset</span>
|
||||
{% elif notif.notif_type == 'account_deleted' %}
|
||||
<span class="badge bg-danger">Account Deleted</span>
|
||||
{% elif notif.notif_type == 'account_updated' %}
|
||||
<span class="badge bg-info">Account Updated</span>
|
||||
{% elif notif.notif_type == 'room_invite' %}
|
||||
<span class="badge bg-primary">Room Invite</span>
|
||||
{% elif notif.notif_type == 'room_invite_removed' %}
|
||||
<span class="badge bg-secondary">Room Invite Removed</span>
|
||||
{% elif notif.notif_type == 'conversation_invite' %}
|
||||
<span class="badge bg-primary">Conversation Invite</span>
|
||||
{% elif notif.notif_type == 'conversation_invite_removed' %}
|
||||
<span class="badge bg-secondary">Conversation Invite Removed</span>
|
||||
{% elif notif.notif_type == 'conversation_message' %}
|
||||
<span class="badge bg-info">Conversation Message</span>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary">{{ notif.notif_type }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ notif.sender.username if notif.sender else 'System' }}</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-secondary"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#notifDetailsModal"
|
||||
data-notif-id="{{ notif.id }}">
|
||||
<i class="fas fa-info-circle"></i> View Details
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
{% if notif.read %}
|
||||
<span class="badge bg-success">Read</span>
|
||||
{% else %}
|
||||
<span class="badge bg-warning">Unread</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if not notif.read %}
|
||||
<button class="btn btn-sm btn-primary mark-read" data-notif-id="{{ notif.id }}">
|
||||
<i class="fas fa-check"></i> Mark as Read
|
||||
</button>
|
||||
{% endif %}
|
||||
<button class="btn btn-sm btn-danger delete-notif" data-notif-id="{{ notif.id }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="6" class="text-center">No notifications found</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mt-3">
|
||||
<div>
|
||||
<button id="prevPage" class="btn btn-outline-primary btn-sm"
|
||||
style="border-color:var(--primary-color); color:var(--primary-color);"
|
||||
onmouseover="this.style.backgroundColor='var(--primary-color)'; this.style.color='white'"
|
||||
onmouseout="this.style.backgroundColor='transparent'; this.style.color='var(--primary-color)'"
|
||||
{% if current_page == 1 %}disabled{% endif %}>
|
||||
<i class="fas fa-chevron-left me-1"></i>Previous
|
||||
</button>
|
||||
<span class="mx-2">Page <span id="currentPage">{{ current_page }}</span> of <span id="totalPages">{{ total_pages }}</span></span>
|
||||
<button id="nextPage" class="btn btn-outline-primary btn-sm"
|
||||
style="border-color:var(--primary-color); color:var(--primary-color);"
|
||||
onmouseover="this.style.backgroundColor='var(--primary-color)'; this.style.color='white'"
|
||||
onmouseout="this.style.backgroundColor='transparent'; this.style.color='var(--primary-color)'"
|
||||
{% if current_page == total_pages %}disabled{% endif %}>
|
||||
Next<i class="fas fa-chevron-right ms-1"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Notification Details Modal -->
|
||||
<div class="modal fade" id="notifDetailsModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Notification Details</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre id="notifDetailsContent" class="bg-light p-3 rounded"></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block extra_js %}
|
||||
<script src="{{ url_for('static', filename='js/notifications.js', v=config.CSS_VERSION) }}"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user