592 lines
14 KiB
HTML
592 lines
14 KiB
HTML
{% extends "layout.html" %}
|
|
|
|
{% block content %}
|
|
<div class="announcements-container">
|
|
<!-- Header Section -->
|
|
<div class="page-header">
|
|
<div class="header-content">
|
|
<div class="header-left">
|
|
<h1 class="page-title">
|
|
<span class="page-icon"><i class="ti ti-speakerphone"></i></span>
|
|
System Announcements
|
|
</h1>
|
|
<p class="page-subtitle">Manage system-wide announcements and notifications</p>
|
|
</div>
|
|
<div class="header-actions">
|
|
<a href="{{ url_for('system_admin.system_admin_dashboard') }}" class="btn btn-secondary">
|
|
<i class="ti ti-arrow-left"></i>
|
|
Back to Dashboard
|
|
</a>
|
|
<a href="{{ url_for('announcements.create') }}" class="btn btn-primary">
|
|
<i class="ti ti-plus"></i>
|
|
New Announcement
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Announcements Table -->
|
|
{% if announcements.items %}
|
|
<div class="card">
|
|
<div class="card-body no-padding">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Title</th>
|
|
<th>Type</th>
|
|
<th>Status</th>
|
|
<th>Start Date</th>
|
|
<th>End Date</th>
|
|
<th>Target</th>
|
|
<th>Created</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for announcement in announcements.items %}
|
|
<tr class="{% if not announcement.is_active %}inactive-row{% endif %}">
|
|
<td>
|
|
<div class="announcement-title">
|
|
<strong>{{ announcement.title }}</strong>
|
|
{% if announcement.is_urgent %}
|
|
<span class="badge badge-urgent">URGENT</span>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<span class="type-badge type-{{ announcement.announcement_type }}">
|
|
{{ announcement.announcement_type.title() }}
|
|
</span>
|
|
</td>
|
|
<td>
|
|
{% if announcement.is_active %}
|
|
{% if announcement.is_visible_now() %}
|
|
<span class="status-badge status-active">Active</span>
|
|
{% else %}
|
|
<span class="status-badge status-scheduled">Scheduled</span>
|
|
{% endif %}
|
|
{% else %}
|
|
<span class="status-badge status-inactive">Inactive</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if announcement.start_date %}
|
|
<span class="date-text">{{ announcement.start_date.strftime('%Y-%m-%d %H:%M') }}</span>
|
|
{% else %}
|
|
<em class="text-muted">Immediate</em>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if announcement.end_date %}
|
|
<span class="date-text">{{ announcement.end_date.strftime('%Y-%m-%d %H:%M') }}</span>
|
|
{% else %}
|
|
<em class="text-muted">No expiry</em>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if announcement.target_all_users %}
|
|
<span class="target-badge target-all">
|
|
<i class="ti ti-users"></i>
|
|
All Users
|
|
</span>
|
|
{% else %}
|
|
<span class="target-badge target-specific">
|
|
<i class="ti ti-target"></i>
|
|
Targeted
|
|
</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<span class="date-text">{{ announcement.created_at.strftime('%Y-%m-%d') }}</span>
|
|
</td>
|
|
<td>
|
|
<div class="action-buttons">
|
|
<a href="{{ url_for('announcements.edit', id=announcement.id) }}"
|
|
class="btn-icon" title="Edit">
|
|
<i class="ti ti-pencil"></i>
|
|
</a>
|
|
<form method="POST" action="{{ url_for('announcements.delete', id=announcement.id) }}"
|
|
style="display: inline-block;"
|
|
onsubmit="return confirm('Are you sure you want to delete this announcement?')">
|
|
<button type="submit" class="btn-icon danger" title="Delete">
|
|
<i class="ti ti-trash"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if announcements.pages > 1 %}
|
|
<div class="pagination-container">
|
|
<div class="pagination">
|
|
{% if announcements.has_prev %}
|
|
<a href="{{ url_for('announcements.index', page=announcements.prev_num) }}" class="page-link">
|
|
<i class="ti ti-chevron-left"></i>
|
|
Previous
|
|
</a>
|
|
{% endif %}
|
|
|
|
<div class="page-numbers">
|
|
{% for page_num in announcements.iter_pages() %}
|
|
{% if page_num %}
|
|
{% if page_num != announcements.page %}
|
|
<a href="{{ url_for('announcements.index', page=page_num) }}" class="page-link">{{ page_num }}</a>
|
|
{% else %}
|
|
<span class="page-link current">{{ page_num }}</span>
|
|
{% endif %}
|
|
{% else %}
|
|
<span class="page-dots">...</span>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if announcements.has_next %}
|
|
<a href="{{ url_for('announcements.index', page=announcements.next_num) }}" class="page-link">
|
|
Next
|
|
<i class="ti ti-chevron-right"></i>
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="pagination-info">
|
|
Showing {{ announcements.per_page * (announcements.page - 1) + 1 }} -
|
|
{{ announcements.per_page * (announcements.page - 1) + announcements.items|length }} of {{ announcements.total }} announcements
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
<!-- Empty State -->
|
|
<div class="empty-state">
|
|
<div class="empty-icon"><i class="ti ti-speakerphone"></i></div>
|
|
<h3 class="empty-title">No announcements found</h3>
|
|
<p class="empty-message">Create your first announcement to communicate with users.</p>
|
|
<a href="{{ url_for('announcements.create') }}" class="btn btn-primary">
|
|
<i class="ti ti-plus"></i>
|
|
Create Announcement
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<style>
|
|
/* Container */
|
|
.announcements-container {
|
|
max-width: 1400px;
|
|
margin: 0 auto;
|
|
padding: 2rem;
|
|
}
|
|
|
|
/* Page Header */
|
|
.page-header {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
border-radius: 16px;
|
|
padding: 2rem;
|
|
margin-bottom: 2rem;
|
|
color: white;
|
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.header-content {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
gap: 2rem;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 2rem;
|
|
font-weight: 700;
|
|
margin: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.page-icon {
|
|
font-size: 2.5rem;
|
|
display: inline-block;
|
|
animation: pulse 2s ease-in-out infinite;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% { transform: scale(1); }
|
|
50% { transform: scale(1.05); }
|
|
}
|
|
|
|
.page-subtitle {
|
|
font-size: 1.1rem;
|
|
opacity: 0.9;
|
|
margin: 0.5rem 0 0 0;
|
|
}
|
|
|
|
.header-actions {
|
|
display: flex;
|
|
gap: 1rem;
|
|
}
|
|
|
|
/* Cards */
|
|
.card {
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
border: 1px solid #e5e7eb;
|
|
margin-bottom: 1.5rem;
|
|
overflow: hidden;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.card:hover {
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.card-body {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.card-body.no-padding {
|
|
padding: 0;
|
|
}
|
|
|
|
/* Table */
|
|
.table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin: 0;
|
|
}
|
|
|
|
.table th,
|
|
.table td {
|
|
padding: 1rem;
|
|
text-align: left;
|
|
border-bottom: 1px solid #e5e7eb;
|
|
}
|
|
|
|
.table th {
|
|
background: #f8f9fa;
|
|
font-weight: 600;
|
|
color: #374151;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
font-size: 0.8rem;
|
|
}
|
|
|
|
.table tr:hover {
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.inactive-row {
|
|
opacity: 0.6;
|
|
}
|
|
|
|
/* Announcement Title */
|
|
.announcement-title {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
/* Badges */
|
|
.badge,
|
|
.status-badge,
|
|
.type-badge,
|
|
.target-badge {
|
|
padding: 0.25rem 0.75rem;
|
|
border-radius: 20px;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.badge-urgent {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
}
|
|
|
|
/* Type Badges */
|
|
.type-info {
|
|
background: #dbeafe;
|
|
color: #1e40af;
|
|
}
|
|
|
|
.type-warning {
|
|
background: #fef3c7;
|
|
color: #92400e;
|
|
}
|
|
|
|
.type-success {
|
|
background: #d1fae5;
|
|
color: #065f46;
|
|
}
|
|
|
|
.type-danger {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
}
|
|
|
|
/* Status Badges */
|
|
.status-active {
|
|
background: #d1fae5;
|
|
color: #065f46;
|
|
}
|
|
|
|
.status-scheduled {
|
|
background: #fef3c7;
|
|
color: #92400e;
|
|
}
|
|
|
|
.status-inactive {
|
|
background: #e5e7eb;
|
|
color: #374151;
|
|
}
|
|
|
|
/* Target Badges */
|
|
.target-badge {
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.target-all {
|
|
background: #ede9fe;
|
|
color: #5b21b6;
|
|
}
|
|
|
|
.target-specific {
|
|
background: #dbeafe;
|
|
color: #1e40af;
|
|
}
|
|
|
|
/* Date Text */
|
|
.date-text {
|
|
color: #6b7280;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.text-muted {
|
|
color: #9ca3af;
|
|
font-style: italic;
|
|
}
|
|
|
|
/* Action Buttons */
|
|
.action-buttons {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.btn-icon {
|
|
color: #6b7280;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 36px;
|
|
height: 36px;
|
|
border-radius: 8px;
|
|
background: #f3f4f6;
|
|
border: 1px solid #e5e7eb;
|
|
transition: all 0.2s ease;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.btn-icon:hover {
|
|
background: #667eea;
|
|
color: white;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-icon.danger:hover {
|
|
background: #dc2626;
|
|
}
|
|
|
|
/* Pagination */
|
|
.pagination-container {
|
|
padding: 1.5rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
gap: 1rem;
|
|
background: white;
|
|
border-radius: 12px;
|
|
border: 1px solid #e5e7eb;
|
|
}
|
|
|
|
.pagination {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.page-numbers {
|
|
display: flex;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.page-link {
|
|
padding: 0.5rem 1rem;
|
|
border: 1px solid #e5e7eb;
|
|
color: #667eea;
|
|
text-decoration: none;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
transition: all 0.2s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.page-link:hover {
|
|
background: #f3f4f6;
|
|
border-color: #667eea;
|
|
}
|
|
|
|
.page-link.current {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
border-color: transparent;
|
|
}
|
|
|
|
.page-dots {
|
|
padding: 0.5rem;
|
|
color: #6b7280;
|
|
}
|
|
|
|
.pagination-info {
|
|
color: #6b7280;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
/* Empty State */
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 4rem 2rem;
|
|
background: white;
|
|
border-radius: 12px;
|
|
border: 1px solid #e5e7eb;
|
|
}
|
|
|
|
.empty-icon {
|
|
font-size: 4rem;
|
|
margin-bottom: 1.5rem;
|
|
opacity: 0.3;
|
|
}
|
|
|
|
.empty-title {
|
|
font-size: 1.75rem;
|
|
font-weight: 700;
|
|
color: #1f2937;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.empty-message {
|
|
font-size: 1.1rem;
|
|
color: #6b7280;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
/* Buttons */
|
|
.btn {
|
|
padding: 0.75rem 1.5rem;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-weight: 600;
|
|
font-size: 1rem;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: white;
|
|
color: #667eea;
|
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
border-color: rgba(255, 255, 255, 0.5);
|
|
}
|
|
|
|
/* Responsive Design */
|
|
@media (max-width: 768px) {
|
|
.announcements-container {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.page-header {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.header-content {
|
|
flex-direction: column;
|
|
text-align: center;
|
|
}
|
|
|
|
.header-actions {
|
|
width: 100%;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.table {
|
|
font-size: 0.8rem;
|
|
}
|
|
|
|
.table th,
|
|
.table td {
|
|
padding: 0.5rem;
|
|
}
|
|
|
|
.action-buttons {
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.pagination-container {
|
|
flex-direction: column;
|
|
}
|
|
}
|
|
|
|
/* Animations */
|
|
@keyframes slideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(20px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
.card {
|
|
animation: slideIn 0.3s ease-out;
|
|
animation-fill-mode: both;
|
|
}
|
|
|
|
.card:nth-child(1) { animation-delay: 0.1s; }
|
|
.card:nth-child(2) { animation-delay: 0.2s; }
|
|
.card:nth-child(3) { animation-delay: 0.3s; }
|
|
</style>
|
|
{% endblock %} |