forked from iarv/mc-webui
- Remove separate "Copy Key" button - Make public key prefix clickable to copy - Add fallback for HTTP contexts (execCommand) - Add hover and copied state styling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
525 lines
16 KiB
HTML
525 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
|
<title>{% block title %}Contact Management - mc-webui{% endblock %}</title>
|
|
|
|
<!-- Favicon -->
|
|
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='images/apple-touch-icon.png') }}">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='images/favicon-32x32.png') }}">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='images/favicon-16x16.png') }}">
|
|
<link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
|
|
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
|
|
|
<!-- Bootstrap 5 CSS -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<!-- Bootstrap Icons -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.css">
|
|
|
|
<!-- Leaflet CSS -->
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
|
|
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
|
crossorigin="" />
|
|
|
|
<!-- Custom CSS -->
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
|
|
|
<style>
|
|
/* Mobile-first custom styles for Contact Management */
|
|
/* Compact manual approval section */
|
|
.compact-setting {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
padding: 0.75rem;
|
|
background-color: #f8f9fa;
|
|
border-radius: 0.5rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.info-icon {
|
|
color: #6c757d;
|
|
cursor: help;
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
.info-icon:hover {
|
|
color: #0d6efd;
|
|
}
|
|
|
|
.pending-contact-card {
|
|
background-color: white;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
padding: 1rem;
|
|
margin-bottom: 0.75rem;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.contact-name {
|
|
font-size: 1.1rem;
|
|
font-weight: 600;
|
|
color: #212529;
|
|
margin-bottom: 0.5rem;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
.contact-key {
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 0.85rem;
|
|
color: #6c757d;
|
|
word-break: break-all;
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
.contact-key.clickable-key {
|
|
cursor: pointer;
|
|
transition: color 0.15s, background-color 0.15s;
|
|
padding: 0.15rem 0.3rem;
|
|
margin-left: -0.3rem;
|
|
border-radius: 0.25rem;
|
|
}
|
|
|
|
.contact-key.clickable-key:hover {
|
|
color: #0d6efd;
|
|
background-color: #e7f1ff;
|
|
}
|
|
|
|
.contact-key.clickable-key.copied {
|
|
color: #198754;
|
|
background-color: #d1e7dd;
|
|
}
|
|
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 1.5rem 1rem;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.empty-state i {
|
|
font-size: 2rem;
|
|
margin-bottom: 0.5rem;
|
|
opacity: 0.5;
|
|
}
|
|
|
|
.empty-state.compact {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.empty-state.compact i {
|
|
font-size: 1.5rem;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.info-badge {
|
|
display: inline-block;
|
|
background-color: #e7f3ff;
|
|
color: #0c5460;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 0.375rem;
|
|
font-size: 0.9rem;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
/* Existing Contacts Styles */
|
|
.existing-contact-card {
|
|
background-color: white;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
padding: 1rem;
|
|
margin-bottom: 0.75rem;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
transition: box-shadow 0.2s;
|
|
}
|
|
|
|
.existing-contact-card:hover {
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.type-badge {
|
|
font-size: 0.75rem;
|
|
padding: 0.25rem 0.5rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* Protected contact styling */
|
|
.protection-indicator {
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.btn-outline-danger:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Clickable type filter badges */
|
|
.type-filter-badge {
|
|
display: inline-block;
|
|
padding: 0.25rem 0.6rem;
|
|
font-size: 0.8rem;
|
|
font-weight: 600;
|
|
border-radius: 0.375rem;
|
|
cursor: pointer;
|
|
transition: all 0.15s ease-in-out;
|
|
user-select: none;
|
|
}
|
|
|
|
.type-filter-badge[data-type="CLI"] {
|
|
color: #0d6efd;
|
|
background-color: white;
|
|
border: 2px solid #0d6efd;
|
|
}
|
|
.type-filter-badge[data-type="CLI"].active {
|
|
color: white;
|
|
background-color: #0d6efd;
|
|
}
|
|
|
|
.type-filter-badge[data-type="REP"] {
|
|
color: #198754;
|
|
background-color: white;
|
|
border: 2px solid #198754;
|
|
}
|
|
.type-filter-badge[data-type="REP"].active {
|
|
color: white;
|
|
background-color: #198754;
|
|
}
|
|
|
|
.type-filter-badge[data-type="ROOM"] {
|
|
color: #0dcaf0;
|
|
background-color: white;
|
|
border: 2px solid #0dcaf0;
|
|
}
|
|
.type-filter-badge[data-type="ROOM"].active {
|
|
color: white;
|
|
background-color: #0dcaf0;
|
|
}
|
|
|
|
.type-filter-badge[data-type="SENS"] {
|
|
color: #ffc107;
|
|
background-color: white;
|
|
border: 2px solid #ffc107;
|
|
}
|
|
.type-filter-badge[data-type="SENS"].active {
|
|
color: #212529;
|
|
background-color: #ffc107;
|
|
}
|
|
|
|
.contact-info-row {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
margin-bottom: 0.5rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.counter-badge {
|
|
font-size: 1rem;
|
|
padding: 0.35rem 0.75rem;
|
|
}
|
|
|
|
.counter-ok {
|
|
background-color: #28a745;
|
|
}
|
|
|
|
.counter-warning {
|
|
background-color: #ffc107;
|
|
color: #212529;
|
|
}
|
|
|
|
.counter-alarm {
|
|
background-color: #dc3545;
|
|
animation: pulse 1.5s infinite;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% { opacity: 1; }
|
|
50% { opacity: 0.7; }
|
|
}
|
|
|
|
.search-toolbar {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
margin-bottom: 1rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.search-toolbar input,
|
|
.search-toolbar select {
|
|
flex: 1;
|
|
min-width: 150px;
|
|
}
|
|
|
|
/* Scrollable contacts lists */
|
|
#pendingList {
|
|
height: calc(100vh - 280px);
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
-webkit-overflow-scrolling: touch;
|
|
min-height: 300px;
|
|
}
|
|
|
|
#existingList {
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
-webkit-overflow-scrolling: touch;
|
|
height: calc(100vh - 260px);
|
|
min-height: 300px;
|
|
}
|
|
|
|
/* Custom scrollbar styling */
|
|
#existingList::-webkit-scrollbar,
|
|
#pendingList::-webkit-scrollbar {
|
|
width: 8px;
|
|
}
|
|
|
|
#existingList::-webkit-scrollbar-track,
|
|
#pendingList::-webkit-scrollbar-track {
|
|
background: #f1f1f1;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
#existingList::-webkit-scrollbar-thumb,
|
|
#pendingList::-webkit-scrollbar-thumb {
|
|
background: #888;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
#existingList::-webkit-scrollbar-thumb:hover,
|
|
#pendingList::-webkit-scrollbar-thumb:hover {
|
|
background: #555;
|
|
}
|
|
|
|
/* Compact section headers */
|
|
.section-compact {
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
/* NEW: Full-screen lists for dedicated pages */
|
|
.contacts-list-fullscreen {
|
|
height: calc(100vh - 240px);
|
|
overflow-y: auto;
|
|
-webkit-overflow-scrolling: touch;
|
|
padding: 0;
|
|
}
|
|
|
|
/* NEW: Navigation cards on manage page */
|
|
.nav-card {
|
|
background: white;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
padding: 1.25rem;
|
|
margin-bottom: 1rem;
|
|
cursor: pointer;
|
|
transition: box-shadow 0.2s;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.nav-card:hover {
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.nav-card h6 {
|
|
margin: 0;
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* Sort toolbar */
|
|
.filter-sort-toolbar {
|
|
display: flex;
|
|
gap: 0.375rem;
|
|
margin-bottom: 1rem;
|
|
align-items: center;
|
|
}
|
|
|
|
.filter-sort-toolbar .form-select {
|
|
width: auto;
|
|
padding: 0.35rem 2rem 0.35rem 0.5rem;
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.sort-buttons {
|
|
display: flex;
|
|
gap: 0.375rem;
|
|
}
|
|
|
|
.sort-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.2rem;
|
|
padding: 0.35rem 0.5rem;
|
|
background: #f8f9fa;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.375rem;
|
|
cursor: pointer;
|
|
font-size: 0.85rem;
|
|
transition: all 0.2s;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.sort-btn:hover {
|
|
background: #e9ecef;
|
|
}
|
|
|
|
.sort-btn.active {
|
|
background-color: #0d6efd;
|
|
color: white;
|
|
border-color: #0d6efd;
|
|
}
|
|
|
|
.sort-btn i {
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
/* NEW: Back buttons */
|
|
.back-buttons {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.back-buttons button {
|
|
flex: 1;
|
|
padding: 0.75rem;
|
|
min-height: 44px;
|
|
}
|
|
|
|
/* NEW: Cleanup section on manage page */
|
|
.cleanup-section {
|
|
background-color: #fff3cd;
|
|
border: 1px solid #ffc107;
|
|
border-radius: 0.5rem;
|
|
padding: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.cleanup-section h6 {
|
|
color: #856404;
|
|
margin-bottom: 0.75rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
/* Override global overflow: hidden from style.css for Contact Management pages */
|
|
html, body {
|
|
overflow: auto !important;
|
|
}
|
|
|
|
main {
|
|
overflow: auto !important;
|
|
}
|
|
|
|
/* Mobile responsiveness */
|
|
@media (max-width: 768px) {
|
|
#existingList {
|
|
height: calc(100vh - 300px);
|
|
}
|
|
|
|
#pendingList {
|
|
height: calc(100vh - 320px);
|
|
}
|
|
|
|
.contacts-list-fullscreen {
|
|
height: calc(100vh - 300px);
|
|
}
|
|
}
|
|
</style>
|
|
|
|
{% block extra_head %}{% endblock %}
|
|
</head>
|
|
<body>
|
|
<!-- Main Content -->
|
|
<main>
|
|
<div class="container-fluid p-0">
|
|
<div class="row g-0">
|
|
<div class="col-12">
|
|
{% block page_content %}
|
|
<!-- Content will be provided by child templates -->
|
|
{% endblock %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Delete Confirmation Modal (shared across all contact pages) -->
|
|
<div class="modal fade" id="deleteContactModal" tabindex="-1" aria-labelledby="deleteContactModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header bg-danger text-white">
|
|
<h5 class="modal-title" id="deleteContactModalLabel">
|
|
<i class="bi bi-exclamation-triangle"></i> Confirm Delete
|
|
</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p class="mb-2">Are you sure you want to delete this contact?</p>
|
|
<div class="alert alert-warning mb-0">
|
|
<strong id="deleteContactName"></strong><br>
|
|
<small class="font-monospace" id="deleteContactKey"></small>
|
|
</div>
|
|
<p class="text-muted small mt-2 mb-0">This action cannot be undone.</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-danger" id="confirmDeleteBtn">
|
|
<i class="bi bi-trash"></i> Delete Contact
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Toast container for notifications (shared across all contact pages) -->
|
|
<div class="toast-container position-fixed top-0 start-0 p-3">
|
|
<div id="contactToast" class="toast" role="alert">
|
|
<div class="toast-header">
|
|
<strong class="me-auto">Contact Management</strong>
|
|
<button type="button" class="btn-close" data-bs-dismiss="toast"></button>
|
|
</div>
|
|
<div class="toast-body"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Map Modal (Leaflet) -->
|
|
<div class="modal fade" id="mapModal" tabindex="-1">
|
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title"><i class="bi bi-geo-alt"></i> <span id="mapModalTitle">Map</span></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body p-0">
|
|
<!-- Type filter (hidden for single contact view) -->
|
|
<div id="mapTypeFilter" class="d-none px-3 py-2 border-bottom bg-light">
|
|
<div class="d-flex flex-wrap gap-2 align-items-center">
|
|
<span class="small text-muted me-1">Show:</span>
|
|
<span class="map-filter-badge active" data-type="1" id="mapFilterCLI">CLI</span>
|
|
<span class="map-filter-badge active" data-type="2" id="mapFilterREP">REP</span>
|
|
<span class="map-filter-badge active" data-type="3" id="mapFilterROOM">ROOM</span>
|
|
<span class="map-filter-badge active" data-type="4" id="mapFilterSENS">SENS</span>
|
|
</div>
|
|
</div>
|
|
<div id="leafletMap" style="height: 400px; width: 100%;"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Bootstrap 5 JS Bundle -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
<!-- Leaflet JS -->
|
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
|
|
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
|
|
crossorigin=""></script>
|
|
|
|
<!-- Contact Management JavaScript -->
|
|
<script src="{{ url_for('static', filename='js/contacts.js') }}"></script>
|
|
|
|
{% block extra_scripts %}{% endblock %}
|
|
</body>
|
|
</html>
|