Spaces:
Sleeping
Sleeping
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Signal Tracker Map</title> | |
| <!-- Bootstrap CSS --> | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" /> | |
| <style> | |
| body { | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| height: 100vh; | |
| margin: 0; | |
| background-color: #f0f0f0; | |
| } | |
| .container { | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| height: 100%; | |
| } | |
| #map { | |
| width: 80%; | |
| height: 500px; | |
| box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.3); | |
| margin-bottom: 150px; /* Thêm khoảng cách phía dưới bản đồ */ | |
| } | |
| .filter-form { | |
| margin-bottom: 20px; | |
| background: white; | |
| padding: 15px; | |
| border-radius: 5px; | |
| box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); | |
| width: 80%; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| } | |
| .title { | |
| margin-bottom: 20px; | |
| text-align: center; | |
| } | |
| .btn-download { | |
| padding: 8px 15px; | |
| font-size: 14px; | |
| background-color: #007bff; | |
| color: white; | |
| border: none; | |
| border-radius: 5px; | |
| cursor: pointer; | |
| transition: background-color 0.3s; | |
| text-decoration: none; | |
| margin-left: 15px; | |
| } | |
| .btn-download:hover { | |
| background-color: #0056b3; | |
| } | |
| .user-info { | |
| position: absolute; | |
| top: 20px; | |
| right: 20px; | |
| background-color: white; | |
| padding: 10px 15px; | |
| border-radius: 25px; | |
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); | |
| display: flex; | |
| align-items: center; | |
| font-family: Arial, sans-serif; | |
| font-size: 14px; | |
| } | |
| .user-info span { | |
| font-weight: bold; | |
| margin-right: 10px; | |
| } | |
| .user-info a { | |
| text-decoration: none; | |
| color: #007bff; | |
| padding: 5px 10px; | |
| border-radius: 15px; | |
| transition: background-color 0.3s, color 0.3s; | |
| } | |
| .user-info a:hover { | |
| background-color: #007bff; | |
| color: white; | |
| } | |
| .user-info .separator { | |
| margin: 0 5px; | |
| color: #ccc; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <div class="user-info"> | |
| {% if current_user %} | |
| <span>Welcome, {{ current_user.username }}</span> | |
| {% if current_user.is_admin %} | |
| <a href="/admin">Admin Panel</a> | |
| <span class="separator">|</span> | |
| {% endif %} | |
| <a href="/logout">Logout</a> | |
| {% else %} | |
| <a href="/login">Login</a> | |
| {% endif %} | |
| </div> | |
| <h1 class="title">Signal Tracker Map</h1> | |
| <form class="filter-form" id="date-form" method="GET" action="/"> | |
| <div class="row g-3 align-items-center"> | |
| <div class="col-auto"> | |
| <label for="start_date" class="col-form-label">Start Date:</label> | |
| </div> | |
| <div class="col-auto"> | |
| <input type="date" id="start_date" name="start_date" class="form-control" | |
| value="{{ start_date or '' }}"> | |
| </div> | |
| <div class="col-auto"> | |
| <label for="end_date" class="col-form-label">End Date:</label> | |
| </div> | |
| <div class="col-auto"> | |
| <input type="date" id="end_date" name="end_date" class="form-control" | |
| value="{{ end_date or '' }}"> | |
| </div> | |
| <div class="col-auto"> | |
| <a href="/download-csv" class="btn-download">Download CSV</a> | |
| </div> | |
| </div> | |
| </form> | |
| <div id="map"> | |
| {{ map_html|safe }} | |
| </div> | |
| </div> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script> | |
| <!-- Bootstrap JS (Optional) --> | |
| <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> | |
| <script> | |
| // JavaScript để tự động submit form khi thay đổi ngày nếu cả hai ngày đều có giá trị | |
| function updateMapIfDatesFilled() { | |
| const startDate = document.getElementById('start_date').value; | |
| const endDate = document.getElementById('end_date').value; | |
| if (startDate && endDate) { | |
| document.getElementById('date-form').submit(); | |
| } | |
| } | |
| document.getElementById('start_date').addEventListener('change', updateMapIfDatesFilled); | |
| document.getElementById('end_date').addEventListener('change', updateMapIfDatesFilled); | |
| </script> | |
| </body> | |
| </html> | |