186 lines
11 KiB
HTML
186 lines
11 KiB
HTML
{% extends "common/base.html" %}
|
|
{% from "components/header.html" import header %}
|
|
|
|
{% block title %}Notifications - DocuPulse{% endblock %}
|
|
|
|
{% block content %}
|
|
{{ header(
|
|
title="Notifications",
|
|
description="View and manage your notifications",
|
|
icon="fa-bell"
|
|
) }}
|
|
|
|
<div class="container-fluid py-4">
|
|
<div class="card shadow-sm">
|
|
<div class="card-body">
|
|
<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>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 %}" data-notif-id="{{ notif.id }}">
|
|
<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 + ' ' + notif.sender.last_name if notif.sender else 'System' }}</td>
|
|
<td>
|
|
{% if notif.read %}
|
|
<span class="badge bg-success">Read</span>
|
|
{% else %}
|
|
<span class="badge bg-warning">Unread</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<div class="btn-group">
|
|
{% if notif.notif_type in ['room_invite', 'room_invite_removed'] and notif.details and notif.details.room_id %}
|
|
<a href="{{ url_for('rooms.room', room_id=notif.details.room_id) }}"
|
|
class="btn btn-sm btn-primary"
|
|
data-bs-toggle="tooltip"
|
|
title="View Room">
|
|
<i class="fas fa-door-open"></i>
|
|
</a>
|
|
{% elif notif.notif_type in ['conversation_invite', 'conversation_invite_removed', 'conversation_message'] and notif.details and notif.details.conversation_id %}
|
|
<a href="{{ url_for('conversations.conversation', conversation_id=notif.details.conversation_id) }}"
|
|
class="btn btn-sm btn-primary"
|
|
data-bs-toggle="tooltip"
|
|
title="View Conversation">
|
|
<i class="fas fa-comments"></i>
|
|
</a>
|
|
{% endif %}
|
|
<button class="btn btn-sm btn-secondary"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#notifDetailsModal"
|
|
data-notif-id="{{ notif.id }}"
|
|
data-bs-toggle="tooltip"
|
|
title="View Details">
|
|
<i class="fas fa-info-circle"></i>
|
|
</button>
|
|
{% if not notif.read %}
|
|
<button class="btn btn-sm btn-success mark-read"
|
|
data-notif-id="{{ notif.id }}"
|
|
data-bs-toggle="tooltip"
|
|
title="Mark as Read">
|
|
<i class="fas fa-check"></i>
|
|
</button>
|
|
{% endif %}
|
|
<button class="btn btn-sm btn-danger delete-notif"
|
|
data-notif-id="{{ notif.id }}"
|
|
data-bs-toggle="tooltip"
|
|
title="Delete">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="5" 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={{ 'js/notifications.js'|asset_version }}"></script>
|
|
{% endblock %}
|
|
{% endblock %} |