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/[email protected]/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; | |
| } | |
| .title { | |
| margin-bottom: 20px; | |
| text-align: center; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <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> | |
| </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/[email protected]/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> | |