Pasted Text 1741005155187
Pasted Text 1741005155187
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RoadWatch Pro</title>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.4.0/css/all.min.css" />
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.5.3/
MarkerCluster.css" />
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.5.3/
MarkerCluster.Default.css" />
<style>
/* Original CSS styles */
:root {
--primary: #2563eb;
--primary-dark: #1e40af;
--success: #10b981;
--warning: #f59e0b;
--danger: #dc2626;
--glass: rgba(255, 255, 255, 0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', -apple-system, sans-serif;
line-height: 1.6;
background: #0f172a;
color: #f8fafc;
min-height: 100vh;
direction: ltr;
}
header {
background: rgba(15, 23, 42, 0.95);
backdrop-filter: blur(10px);
color: white;
padding: 1rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
position: sticky;
top: 0;
z-index: 1000;
}
.header-content {
max-width: 1400px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.5rem;
font-weight: bold;
}
.logo i {
color: var(--primary);
}
nav {
display: flex;
gap: 1rem;
}
nav a {
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 0.5rem;
}
nav a:hover {
background: var(--glass);
transform: translateY(-1px);
}
main {
max-width: 1400px;
margin: 2rem auto;
padding: 0 1rem;
display: grid;
grid-template-columns: 300px 1fr;
gap: 2rem;
}
.card {
background: rgba(30, 41, 59, 0.9);
border-radius: 1rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
margin-bottom: 1rem;
}
.card-header {
padding: 1.5rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
}
.card-content {
padding: 1.5rem;
}
#mapContainer {
height: 700px;
border-radius: 1rem;
overflow: hidden;
}
.form-group {
margin-bottom: 1.5rem;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: #e2e8f0;
}
input, select, textarea {
width: 100%;
padding: 0.75rem;
background: rgba(30, 41, 59, 0.9);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 0.375rem;
font-size: 1rem;
color: white;
transition: all 0.2s;
}
input:focus, select:focus, textarea:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}
button {
background: var(--primary);
color: white;
padding: 0.75rem 1.5rem;
border: none;
border-radius: 0.375rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 0.5rem;
}
button:hover {
background: var(--primary-dark);
transform: translateY(-1px);
}
.custom-marker {
border-radius: 50%;
width: 30px;
height: 30px;
border: 2px solid white;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 14px;
}
.severity-high {
background: var(--danger);
animation: pulse 2s infinite;
}
.severity-medium {
background: var(--warning);
}
.severity-low {
background: var(--success);
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 1rem;
margin-top: 1rem;
}
.stat-card {
background: rgba(30, 41, 59, 0.9);
padding: 1rem;
border-radius: 0.5rem;
text-align: center;
}
.stat-value {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 0.5rem;
}
.stat-label {
color: #94a3b8;
font-size: 0.875rem;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.leaflet-popup-content-wrapper {
background: rgba(30, 41, 59, 0.95);
color: white;
border-radius: 0.5rem;
backdrop-filter: blur(10px);
}
.leaflet-popup-tip {
background: rgba(30, 41, 59, 0.95);
}
.issue-popup {
padding: 0.5rem;
}
.issue-popup h3 {
color: var(--primary);
margin-bottom: 0.5rem;
}
.issue-meta {
display: flex;
gap: 1rem;
font-size: 0.875rem;
color: #94a3b8;
}
.admin-only {
display: none;
}
.user-only {
display: none;
}
.logged-in {
display: none;
}
.logged-out {
display: block;
}
.modal {
display: none;
position: fixed;
z-index: 1001;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
}
.modal-content {
background: #1e293b;
margin: 15% auto;
padding: 20px;
width: 300px;
border-radius: 8px;
}
</style>
</head>
<body>
<header>
<div class="header-content">
<div class="logo">
<i class="fas fa-road"></i>
RoadWatch Pro
</div>
<nav>
<a href="#report"><i class="fas fa-plus-circle"></i> Report an Issue</a>
<a href="#map"><i class="fas fa-map-marked-alt"></i> View Map</a>
<div id="authSection" class="logged-out">
<button onclick="showAuthModal()">Login</button>
</div>
<div id="userSection" class="logged-in">
<span id="usernameDisplay"></span>
<button onclick="logout()">Logout</button>
</div>
</nav>
</div>
</header>
<main>
<aside>
<!-- Report Issue Card -->
<section id="report" class="card">
<div class="card-header">
<h2><i class="fas fa-exclamation-triangle"></i> Report an Issue</h2>
</div>
<div class="card-content">
<form id="reportForm">
<div class="form-group">
<label for="location">Location (Click on the map)</label>
<input type="text" id="location" required readonly>
</div>
<div class="form-group">
<label for="type">Issue Type</label>
<select id="type" required>
<option value="">Select Type...</option>
<option value="pothole">Pothole</option>
<option value="construction">Construction</option>
<option value="flooding">Flooding</option>
<option value="debris">Debris</option>
<option value="accident">Accident</option>
<option value="signal">Traffic Signal Issue</option>
</select>
</div>
<div class="form-group">
<label for="severity">Severity</label>
<select id="severity" required>
<option value="">Select Severity...</option>
<option value="low">Low</option>
<option value="medium">Medium</option>
<option value="high">High</option>
</select>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea id="description" required rows="3"></textarea>
</div>
<div class="form-group">
<label for="photo">Upload Photo</label>
<input type="file" id="photo" accept="image/*" capture="environment">
<div id="photoPreview" class="photo-preview"></div>
</div>
<button type="submit">
<i class="fas fa-paper-plane"></i>
Submit Report
</button>
</form>
</div>
</section>
function getIconForType(type) {
const icons = {
pothole: 'fa-road',
construction: 'fa-traffic-light',
flooding: 'fa-water',
debris: 'fa-trash',
accident: 'fa-car-crash',
signal: 'fa-traffic-light'
};
return icons[type] || 'fa-exclamation-circle';
}
if (photoInput.files[0]) {
reader.readAsDataURL(photoInput.files[0]);
} else {
reader.onload({ target: { result: null } });
}
});
// Auth functions
function showAuthModal() {
document.getElementById('authModal').style.display = 'block';
}
function handleLogin() {
currentUser = document.getElementById('authEmail').value;
isAdmin = false;
updateUI();
document.getElementById('authModal').style.display = 'none';
}
function handleAdminLogin() {
currentUser = document.getElementById('authEmail').value;
isAdmin = true;
updateUI();
document.getElementById('authModal').style.display = 'none';
}
function logout() {
currentUser = null;
isAdmin = false;
updateUI();
}
document.getElementById('totalIssues').textContent = total;
document.getElementById('pendingCount').textContent = pending;
document.getElementById('inProgressCount').textContent = inProgress;
document.getElementById('resolvedCount').textContent = resolved;
function updateUI() {
const loggedIn = currentUser !== null;
document.querySelectorAll('.logged-in').forEach(el => el.style.display =
loggedIn ? 'block' : 'none');
document.querySelectorAll('.logged-out').forEach(el => el.style.display =
loggedIn ? 'none' : 'block');
document.querySelectorAll('.admin-only').forEach(el => el.style.display =
isAdmin ? 'block' : 'none');
document.querySelectorAll('.user-only').forEach(el => el.style.display =
(loggedIn && !isAdmin) ? 'block' : 'none');
if (loggedIn) {
document.getElementById('usernameDisplay').textContent = currentUser;
}
renderMarkers();
renderMyReports();
updateStatistics();
// Initialize chart if admin and chart hasn't been created
if (isAdmin && !statusChart) {
initChart();
}
}
// Initial UI setup
updateUI();
</script>
</body>
</html>