update admin light/dark mode
This commit is contained in:
+663
-77
@@ -37,94 +37,680 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<html lang="id" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login - WebGIS Smart City</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
|
||||
<title>Login — WebGIS Smart City</title>
|
||||
<meta name="description" content="Masuk ke sistem WebGIS Smart City Pontianak.">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
|
||||
<link rel="stylesheet" href="public_assets/css/global.css">
|
||||
<link rel="stylesheet" href="public_assets/css/auth.css">
|
||||
<style>
|
||||
/* ══ DESIGN TOKENS ══ */
|
||||
:root {
|
||||
--font-sans: 'Inter', sans-serif;
|
||||
--font-display: 'Space Grotesk', sans-serif;
|
||||
--ease: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--transition: all 0.25s var(--ease);
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--bg-page: #0A0F1E;
|
||||
--bg-card: #111827;
|
||||
--bg-input: #1A2234;
|
||||
--border: rgba(255,255,255,0.08);
|
||||
--border-focus: #6366F1;
|
||||
--text-primary: #F1F5F9;
|
||||
--text-secondary:#94A3B8;
|
||||
--text-muted: #64748B;
|
||||
--primary: #6366F1;
|
||||
--primary-dark: #4F46E5;
|
||||
--primary-glow: rgba(99,102,241,0.25);
|
||||
--accent: #06B6D4;
|
||||
--error-bg: rgba(244,63,94,0.12);
|
||||
--error-border: rgba(244,63,94,0.3);
|
||||
--error-text: #FB7185;
|
||||
--role-border: rgba(255,255,255,0.08);
|
||||
--role-active-bg: rgba(99,102,241,0.15);
|
||||
--role-active-border: #6366F1;
|
||||
--shadow-card: 0 8px 48px rgba(0,0,0,0.5);
|
||||
--dot-color: rgba(255,255,255,0.03);
|
||||
}
|
||||
|
||||
[data-theme="light"] {
|
||||
--bg-page: #EEF2FF;
|
||||
--bg-card: #FFFFFF;
|
||||
--bg-input: #F8FAFF;
|
||||
--border: #E2E8F0;
|
||||
--border-focus: #4F46E5;
|
||||
--text-primary: #0F172A;
|
||||
--text-secondary:#475569;
|
||||
--text-muted: #94A3B8;
|
||||
--primary: #4F46E5;
|
||||
--primary-dark: #3730A3;
|
||||
--primary-glow: rgba(79,70,229,0.12);
|
||||
--accent: #0891B2;
|
||||
--error-bg: #FFF1F2;
|
||||
--error-border: #FECDD3;
|
||||
--error-text: #BE123C;
|
||||
--role-border: #E2E8F0;
|
||||
--role-active-bg: #EEF2FF;
|
||||
--role-active-border: #4F46E5;
|
||||
--shadow-card: 0 8px 48px rgba(79,70,229,0.1);
|
||||
--dot-color: rgba(79,70,229,0.04);
|
||||
}
|
||||
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
html { scroll-behavior: smooth; }
|
||||
|
||||
body {
|
||||
font-family: var(--font-sans);
|
||||
background: var(--bg-page);
|
||||
color: var(--text-primary);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
transition: background 0.3s var(--ease), color 0.3s var(--ease);
|
||||
}
|
||||
|
||||
/* Dot grid */
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
|
||||
background-size: 28px 28px;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
/* Ambient glow */
|
||||
.orb {
|
||||
position: fixed;
|
||||
border-radius: 50%;
|
||||
filter: blur(100px);
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
.orb-1 { width: 400px; height: 400px; background: var(--primary-glow); top: -80px; right: -80px; opacity: 0.7; }
|
||||
.orb-2 { width: 300px; height: 300px; background: rgba(6,182,212,0.08); bottom: -60px; left: -60px; opacity: 0.6; }
|
||||
|
||||
/* ── Top Bar ── */
|
||||
.topbar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
width: 100%;
|
||||
padding: 0 24px;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.btn-back {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 16px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
background: var(--bg-card);
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
transition: var(--transition);
|
||||
}
|
||||
.btn-back:hover {
|
||||
background: var(--primary);
|
||||
border-color: var(--primary);
|
||||
color: white;
|
||||
transform: translateX(-2px);
|
||||
}
|
||||
.btn-back i { font-size: 0.75rem; }
|
||||
|
||||
.theme-toggle {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
background: var(--bg-card);
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 0.95rem;
|
||||
transition: var(--transition);
|
||||
}
|
||||
.theme-toggle:hover {
|
||||
background: var(--primary);
|
||||
border-color: var(--primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* ── Main Layout ── */
|
||||
.login-page {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
width: 100%;
|
||||
max-width: 960px;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 24px;
|
||||
box-shadow: var(--shadow-card);
|
||||
overflow: hidden;
|
||||
animation: fadeIn 0.4s var(--ease) both;
|
||||
}
|
||||
|
||||
/* ── Left panel (branding) ── */
|
||||
.login-left {
|
||||
background: linear-gradient(145deg, var(--primary) 0%, #4338CA 60%, #312E81 100%);
|
||||
padding: 48px 40px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login-left::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.06);
|
||||
bottom: -80px;
|
||||
right: -80px;
|
||||
}
|
||||
.login-left::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.04);
|
||||
top: -40px;
|
||||
left: -40px;
|
||||
}
|
||||
|
||||
.left-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.brand-icon {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
background: rgba(255,255,255,0.15);
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.2rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.brand-name {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.left-body {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.left-title {
|
||||
font-family: var(--font-display);
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.left-desc {
|
||||
font-size: 0.9rem;
|
||||
color: rgba(255,255,255,0.7);
|
||||
line-height: 1.7;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.feature-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.feature-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 0.85rem;
|
||||
color: rgba(255,255,255,0.85);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255,255,255,0.12);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 0.85rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.left-footer {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
font-size: 0.75rem;
|
||||
color: rgba(255,255,255,0.4);
|
||||
}
|
||||
|
||||
/* ── Right panel (form) ── */
|
||||
.login-right {
|
||||
padding: 48px 44px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.form-header {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.8rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.02em;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.form-subtitle {
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ── Role selector ── */
|
||||
.role-selector {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.role-card { position: relative; cursor: pointer; }
|
||||
|
||||
.role-card input[type="radio"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0; height: 0;
|
||||
}
|
||||
|
||||
.role-card-label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 14px 10px;
|
||||
border-radius: 12px;
|
||||
border: 1.5px solid var(--role-border);
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
transition: var(--transition);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.role-card input:checked + .role-card-label {
|
||||
border-color: var(--role-active-border);
|
||||
background: var(--role-active-bg);
|
||||
}
|
||||
|
||||
.role-card-label:hover {
|
||||
border-color: var(--border-focus);
|
||||
background: var(--role-active-bg);
|
||||
}
|
||||
|
||||
.role-card-icon {
|
||||
font-size: 1.3rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.role-card input:checked + .role-card-label .role-card-icon {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.role-card-name {
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.role-card input:checked + .role-card-label .role-card-name {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.role-card-desc {
|
||||
font-size: 0.72rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* ── Error alert ── */
|
||||
.alert-error {
|
||||
background: var(--error-bg);
|
||||
border: 1px solid var(--error-border);
|
||||
border-radius: 10px;
|
||||
padding: 12px 16px;
|
||||
color: var(--error-text);
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
animation: shake 0.4s var(--ease);
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0%, 100% { transform: translateX(0); }
|
||||
20% { transform: translateX(-6px); }
|
||||
40% { transform: translateX(6px); }
|
||||
60% { transform: translateX(-4px); }
|
||||
80% { transform: translateX(4px); }
|
||||
}
|
||||
|
||||
/* ── Form fields ── */
|
||||
.field-group {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
display: block;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.field-wrap {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.field-icon {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: var(--text-muted);
|
||||
font-size: 0.9rem;
|
||||
pointer-events: none;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.field-control {
|
||||
width: 100%;
|
||||
padding: 11px 14px 11px 40px;
|
||||
border-radius: 10px;
|
||||
border: 1.5px solid var(--border);
|
||||
background: var(--bg-input);
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9rem;
|
||||
font-family: var(--font-sans);
|
||||
outline: none;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.field-control:focus {
|
||||
border-color: var(--border-focus);
|
||||
box-shadow: 0 0 0 3px var(--primary-glow);
|
||||
}
|
||||
|
||||
.field-control:focus ~ .field-icon,
|
||||
.field-wrap:focus-within .field-icon {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.field-control::placeholder { color: var(--text-muted); }
|
||||
|
||||
.btn-eye {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
border-radius: 6px;
|
||||
font-size: 0.9rem;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
.btn-eye:hover { color: var(--primary); }
|
||||
|
||||
/* ── Submit button ── */
|
||||
.btn-login {
|
||||
width: 100%;
|
||||
padding: 13px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
background: linear-gradient(135deg, var(--primary), var(--primary-dark));
|
||||
color: white;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
font-family: var(--font-sans);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
transition: var(--transition);
|
||||
box-shadow: 0 4px 12px var(--primary-glow);
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.btn-login:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 20px var(--primary-glow);
|
||||
filter: brightness(1.05);
|
||||
}
|
||||
|
||||
.btn-login:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* ── Animations ── */
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: scale(0.97) translateY(12px); }
|
||||
to { opacity: 1; transform: scale(1) translateY(0); }
|
||||
}
|
||||
|
||||
/* ── Responsive ── */
|
||||
@media (max-width: 768px) {
|
||||
.login-container { grid-template-columns: 1fr; }
|
||||
.login-left { display: none; }
|
||||
.login-right { padding: 36px 28px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="auth-page">
|
||||
<body>
|
||||
|
||||
<div class="auth-center">
|
||||
<div class="auth-form-wrap">
|
||||
<h2 class="auth-form-title">Selamat Datang</h2>
|
||||
<p class="auth-form-subtitle">Masuk ke sistem WebGIS Smart City Pontianak.</p>
|
||||
<div class="orb orb-1"></div>
|
||||
<div class="orb orb-2"></div>
|
||||
|
||||
<div class="role-selector">
|
||||
<label class="role-card">
|
||||
<input type="radio" name="role_display" value="admin" checked>
|
||||
<div class="role-card-label">
|
||||
<div class="role-card-icon"><i class="fas fa-user-shield"></i></div>
|
||||
<div class="role-card-name">Admin</div>
|
||||
<div class="role-card-desc">Kelola semua data</div>
|
||||
</div>
|
||||
</label>
|
||||
<label class="role-card">
|
||||
<input type="radio" name="role_display" value="user">
|
||||
<div class="role-card-label">
|
||||
<div class="role-card-icon"><i class="fas fa-user"></i></div>
|
||||
<div class="role-card-name">Pengguna</div>
|
||||
<div class="role-card-desc">Lihat & analisis peta</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="auth-error">
|
||||
<i class="fas fa-exclamation-circle"></i>
|
||||
<?= htmlspecialchars($error) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<form method="POST" class="auth-form">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Username</label>
|
||||
<div class="input-with-icon">
|
||||
<i class="fas fa-user input-icon"></i>
|
||||
<input type="text" name="username" class="form-control"
|
||||
placeholder="Masukkan username"
|
||||
value="<?= htmlspecialchars($_POST['username'] ?? '') ?>"
|
||||
required autocomplete="username">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Password</label>
|
||||
<div class="input-with-icon">
|
||||
<i class="fas fa-lock input-icon"></i>
|
||||
<input type="password" name="password" class="form-control"
|
||||
placeholder="Masukkan password"
|
||||
required autocomplete="current-password"
|
||||
id="passwordInput">
|
||||
<button type="button" class="input-icon" style="right:12px;left:auto;cursor:pointer;background:none;border:none;color:var(--text-muted);" onclick="togglePass()">
|
||||
<i class="fas fa-eye" id="eyeIcon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-login">
|
||||
<i class="fas fa-sign-in-alt"></i>
|
||||
Masuk ke Sistem
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<!-- Top bar -->
|
||||
<div class="topbar">
|
||||
<a href="../portal.html" class="btn-back" id="backToPortal">
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
Kembali ke Portal
|
||||
</a>
|
||||
<button class="theme-toggle" id="themeToggle" title="Toggle tema" aria-label="Toggle dark/light mode">
|
||||
<i class="fas fa-moon" id="themeIcon"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Login page -->
|
||||
<main class="login-page">
|
||||
<div class="login-container">
|
||||
|
||||
<!-- Left branding -->
|
||||
<div class="login-left">
|
||||
<div class="left-brand">
|
||||
<div class="brand-icon"><i class="fas fa-map-marked-alt"></i></div>
|
||||
<span class="brand-name">WebGIS Smart City</span>
|
||||
</div>
|
||||
|
||||
<div class="left-body">
|
||||
<h2 class="left-title">Selamat Datang di<br>Sistem Informasi Geografis</h2>
|
||||
<p class="left-desc">Platform manajemen data spasial kawasan kota Pontianak dengan visualisasi peta interaktif real-time.</p>
|
||||
|
||||
<div class="feature-list">
|
||||
<div class="feature-item">
|
||||
<div class="feature-icon"><i class="fas fa-map"></i></div>
|
||||
Peta Interaktif Real-time
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<div class="feature-icon"><i class="fas fa-chart-bar"></i></div>
|
||||
Dashboard Analitik
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<div class="feature-icon"><i class="fas fa-shield-alt"></i></div>
|
||||
Autentikasi Multi-Peran
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="left-footer">
|
||||
D1041231071 — Naufal Zaky Ramadhan © 2025
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right form -->
|
||||
<div class="login-right">
|
||||
<div class="form-header">
|
||||
<h1 class="form-title">Masuk ke Sistem</h1>
|
||||
<p class="form-subtitle">Pilih peran dan masukkan kredensial Anda.</p>
|
||||
</div>
|
||||
|
||||
<!-- Role selector -->
|
||||
<div class="role-selector">
|
||||
<label class="role-card">
|
||||
<input type="radio" name="role_display" value="admin" checked>
|
||||
<div class="role-card-label">
|
||||
<div class="role-card-icon"><i class="fas fa-user-shield"></i></div>
|
||||
<div class="role-card-name">Admin</div>
|
||||
<div class="role-card-desc">Kelola semua data</div>
|
||||
</div>
|
||||
</label>
|
||||
<label class="role-card">
|
||||
<input type="radio" name="role_display" value="user">
|
||||
<div class="role-card-label">
|
||||
<div class="role-card-icon"><i class="fas fa-user"></i></div>
|
||||
<div class="role-card-name">Pengguna</div>
|
||||
<div class="role-card-desc">Lihat & analisis peta</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="alert-error">
|
||||
<i class="fas fa-exclamation-circle"></i>
|
||||
<?= htmlspecialchars($error) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="POST" autocomplete="on">
|
||||
<div class="field-group">
|
||||
<label class="field-label" for="usernameInput">Username</label>
|
||||
<div class="field-wrap">
|
||||
<i class="fas fa-user field-icon"></i>
|
||||
<input type="text" name="username" id="usernameInput" class="field-control"
|
||||
placeholder="Masukkan username"
|
||||
value="<?= htmlspecialchars($_POST['username'] ?? '') ?>"
|
||||
required autocomplete="username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label class="field-label" for="passwordInput">Password</label>
|
||||
<div class="field-wrap">
|
||||
<i class="fas fa-lock field-icon"></i>
|
||||
<input type="password" name="password" id="passwordInput" class="field-control"
|
||||
placeholder="Masukkan password"
|
||||
required autocomplete="current-password">
|
||||
<button type="button" class="btn-eye" onclick="togglePass()" aria-label="Toggle password visibility">
|
||||
<i class="fas fa-eye" id="eyeIcon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-login" id="loginBtn">
|
||||
<i class="fas fa-sign-in-alt"></i>
|
||||
Masuk ke Sistem
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
function togglePass() {
|
||||
const inp = document.getElementById('passwordInput');
|
||||
const ico = document.getElementById('eyeIcon');
|
||||
if (inp.type === 'password') {
|
||||
inp.type = 'text';
|
||||
ico.className = 'fas fa-eye-slash';
|
||||
} else {
|
||||
inp.type = 'password';
|
||||
ico.className = 'fas fa-eye';
|
||||
// ── Password toggle ──
|
||||
function togglePass() {
|
||||
const inp = document.getElementById('passwordInput');
|
||||
const ico = document.getElementById('eyeIcon');
|
||||
const isPass = inp.type === 'password';
|
||||
inp.type = isPass ? 'text' : 'password';
|
||||
ico.className = isPass ? 'fas fa-eye-slash' : 'fas fa-eye';
|
||||
}
|
||||
}
|
||||
|
||||
// ── Theme toggle ──
|
||||
const html = document.documentElement;
|
||||
const btn = document.getElementById('themeToggle');
|
||||
const icon = document.getElementById('themeIcon');
|
||||
|
||||
const saved = localStorage.getItem('portal-theme') || 'dark';
|
||||
setTheme(saved);
|
||||
|
||||
btn.addEventListener('click', () => {
|
||||
const next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
|
||||
setTheme(next);
|
||||
localStorage.setItem('portal-theme', next);
|
||||
});
|
||||
|
||||
function setTheme(t) {
|
||||
html.setAttribute('data-theme', t);
|
||||
icon.className = t === 'dark' ? 'fas fa-sun' : 'fas fa-moon';
|
||||
}
|
||||
|
||||
// ── Loading state on submit ──
|
||||
document.querySelector('form').addEventListener('submit', function() {
|
||||
const loginBtn = document.getElementById('loginBtn');
|
||||
loginBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Memproses...';
|
||||
loginBtn.disabled = true;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once __DIR__ . '/../core_config/database.php';
|
||||
require_once __DIR__ . '/../core_config/middleware_auth.php';
|
||||
requireRole('admin');
|
||||
@@ -47,11 +47,11 @@ require_once __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
|
||||
<!-- ── Quick Access Map ── -->
|
||||
<div class="card" style="background: #EFF6FF; border: 1px solid #BFDBFE; margin-bottom: 24px;">
|
||||
<div class="card" style="background: var(--primary-glow); border: 1px solid var(--primary-light); margin-bottom: 24px;">
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px;">
|
||||
<div>
|
||||
<h3 style="font-size:1.1rem; font-weight:700; margin-bottom:6px; color:#1E3A8A;">🗺️ Buka Peta Interaktif</h3>
|
||||
<p style="color:#3B82F6; font-size:0.88rem; max-width:500px;">
|
||||
<h3 style="font-size:1.1rem; font-weight:700; margin-bottom:6px; color:var(--text-primary);">🗺️ Buka Peta Interaktif</h3>
|
||||
<p style="color:var(--text-secondary); font-size:0.88rem; max-width:500px;">
|
||||
Tambahkan, edit, dan analisis data spasial langsung di peta. Mendukung drawing tool untuk semua layer data.
|
||||
</p>
|
||||
</div>
|
||||
@@ -127,9 +127,9 @@ require_once __DIR__ . '/partials/header.php';
|
||||
<?php if ($recentSpbu): ?>
|
||||
<div style="display:flex; flex-direction:column; gap:8px;">
|
||||
<?php foreach ($recentSpbu as $s): ?>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; padding:10px 12px; background:#F9FAFB; border:1px solid #E5E7EB; border-radius:8px;">
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; padding:10px 12px; background:var(--bg-elevated); border:1px solid var(--border-light); border-radius:8px;">
|
||||
<div>
|
||||
<div style="font-weight:600; font-size:0.88rem;"><?= htmlspecialchars($s['nama']) ?></div>
|
||||
<div style="font-weight:600; font-size:0.88rem; color:var(--text-primary);"><?= htmlspecialchars($s['nama']) ?></div>
|
||||
<div style="font-size:0.75rem; color:var(--text-muted);"><?= date('d M Y', strtotime($s['created_at'])) ?></div>
|
||||
</div>
|
||||
<span class="badge <?= $s['buka_24_jam'] ? 'badge-success' : 'badge-danger' ?>">
|
||||
@@ -152,9 +152,9 @@ require_once __DIR__ . '/partials/header.php';
|
||||
<?php if ($recentWarga): ?>
|
||||
<div style="display:flex; flex-direction:column; gap:8px;">
|
||||
<?php foreach ($recentWarga as $w): ?>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; padding:10px 12px; background:#F9FAFB; border:1px solid #E5E7EB; border-radius:8px;">
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; padding:10px 12px; background:var(--bg-elevated); border:1px solid var(--border-light); border-radius:8px;">
|
||||
<div>
|
||||
<div style="font-weight:600; font-size:0.88rem;"><?= htmlspecialchars($w['nama_kk']) ?></div>
|
||||
<div style="font-weight:600; font-size:0.88rem; color:var(--text-primary);"><?= htmlspecialchars($w['nama_kk']) ?></div>
|
||||
<div style="font-size:0.75rem; color:var(--text-muted);">Rp <?= number_format($w['penghasilan'],0,',','.') ?>/bln · <?= $w['jumlah_tanggungan'] ?> tanggungan</div>
|
||||
</div>
|
||||
<span class="badge badge-warning"><?= $w['jumlah_tanggungan'] ?> org</span>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once __DIR__ . '/../core_config/database.php';
|
||||
require_once __DIR__ . '/../core_config/middleware_auth.php';
|
||||
requireRole('admin');
|
||||
@@ -64,10 +64,10 @@ foreach($rows as $r) {
|
||||
</div>
|
||||
<div class="form-group"><label class="form-label">Radius Bantuan (meter) *</label><input type="number" name="radius_bantuan_meter" class="form-control" min="100" max="10000" step="50" value="1000" required></div>
|
||||
<div class="form-group"><label class="form-label">Pilih Lokasi di Peta</label>
|
||||
<div id="miniMapTambah" style="height:200px;border-radius:8px;border:1px solid #E5E7EB;margin-bottom:10px;z-index:1;"></div>
|
||||
<div id="miniMapTambah" style="height:200px;border-radius:8px;border:1px solid var(--border-light);margin-bottom:10px;z-index:1;"></div>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:10px;">
|
||||
<input type="number" name="lat" id="latTambah" class="form-control" placeholder="Latitude" step="any" readonly style="background:#F9FAFB;">
|
||||
<input type="number" name="lng" id="lngTambah" class="form-control" placeholder="Longitude" step="any" readonly style="background:#F9FAFB;">
|
||||
<input type="number" name="lat" id="latTambah" class="form-control" placeholder="Latitude" step="any" readonly style="background:var(--bg-base); border-color:var(--border-light);">
|
||||
<input type="number" name="lng" id="lngTambah" class="form-control" placeholder="Longitude" step="any" readonly style="background:var(--bg-base); border-color:var(--border-light);">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -104,7 +104,11 @@ window.openModal = function(id) {
|
||||
setTimeout(() => {
|
||||
if(!miniMap) {
|
||||
miniMap = L.map('miniMapTambah').setView([-0.0583, 109.3448], 13);
|
||||
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png').addTo(miniMap);
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
const tileUrl = isDark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
|
||||
L.tileLayer(tileUrl).addTo(miniMap);
|
||||
miniMap.on('click', function(e) {
|
||||
const lat = e.latlng.lat;
|
||||
const lng = e.latlng.lng;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once __DIR__ . '/../core_config/database.php';
|
||||
require_once __DIR__ . '/../core_config/middleware_auth.php';
|
||||
requireRole('admin');
|
||||
@@ -113,7 +113,7 @@ function badgeStatus($status) {
|
||||
<strong id="mapKategori"></strong><br>
|
||||
<span style="color: var(--text-secondary);" id="mapDeskripsi"></span>
|
||||
</div>
|
||||
<div id="miniMapLihat" style="height:300px;border-radius:8px;border:1px solid #E5E7EB;"></div>
|
||||
<div id="miniMapLihat" style="height:300px;border-radius:8px;border:1px solid var(--border-light);"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -177,7 +177,11 @@ function lihatLokasi(r) {
|
||||
setTimeout(() => {
|
||||
if(!mapInstance) {
|
||||
mapInstance = L.map('miniMapLihat');
|
||||
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png').addTo(mapInstance);
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
const tileUrl = isDark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
|
||||
L.tileLayer(tileUrl).addTo(mapInstance);
|
||||
}
|
||||
if(mapMarker) mapInstance.removeLayer(mapMarker);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once __DIR__ . '/../core_config/database.php';
|
||||
require_once __DIR__ . '/../core_config/middleware_auth.php';
|
||||
requireRole('admin');
|
||||
@@ -59,10 +59,10 @@ require_once __DIR__ . '/partials/header.php';
|
||||
<div class="form-group"><label class="form-label" style="display:flex;align-items:center;gap:10px;cursor:pointer;"><input type="checkbox" name="buka_24_jam" id="cb24jam" style="width:16px;height:16px;accent-color:var(--accent);"> Buka 24 Jam</label></div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Pilih Lokasi di Peta *</label>
|
||||
<div id="miniMapTambah" style="height:200px;border-radius:8px;border:1px solid #E5E7EB;margin-bottom:10px;z-index:1;"></div>
|
||||
<div id="miniMapTambah" style="height:200px;border-radius:8px;border:1px solid var(--border-light);margin-bottom:10px;z-index:1;"></div>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:10px;">
|
||||
<input type="number" name="lat" id="latTambah" class="form-control" placeholder="Latitude" step="any" required readonly style="background:#F9FAFB;">
|
||||
<input type="number" name="lng" id="lngTambah" class="form-control" placeholder="Longitude" step="any" required readonly style="background:#F9FAFB;">
|
||||
<input type="number" name="lat" id="latTambah" class="form-control" placeholder="Latitude" step="any" required readonly style="background:var(--bg-base); border-color:var(--border-light);">
|
||||
<input type="number" name="lng" id="lngTambah" class="form-control" placeholder="Longitude" step="any" required readonly style="background:var(--bg-base); border-color:var(--border-light);">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -104,7 +104,11 @@ window.openModal = function(id) {
|
||||
setTimeout(() => {
|
||||
if(!miniMap) {
|
||||
miniMap = L.map('miniMapTambah').setView([-0.0583, 109.3448], 13);
|
||||
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png').addTo(miniMap);
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
const tileUrl = isDark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
|
||||
L.tileLayer(tileUrl).addTo(miniMap);
|
||||
miniMap.on('click', function(e) {
|
||||
const lat = e.latlng.lat;
|
||||
const lng = e.latlng.lng;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once __DIR__ . '/../core_config/database.php';
|
||||
require_once __DIR__ . '/../core_config/middleware_auth.php';
|
||||
requireRole('admin');
|
||||
@@ -45,10 +45,10 @@ require_once __DIR__ . '/partials/header.php';
|
||||
<div class="form-group"><label class="form-label">Penghasilan per Bulan (Rp)</label><input type="number" name="penghasilan" class="form-control" placeholder="0" min="0"></div>
|
||||
<div class="form-group"><label class="form-label">Jumlah Tanggungan (jiwa)</label><input type="number" name="jumlah_tanggungan" class="form-control" placeholder="0" min="0" max="20"></div>
|
||||
<div class="form-group"><label class="form-label">Pilih Lokasi di Peta *</label>
|
||||
<div id="miniMapTambah" style="height:200px;border-radius:8px;border:1px solid #E5E7EB;margin-bottom:10px;z-index:1;"></div>
|
||||
<div id="miniMapTambah" style="height:200px;border-radius:8px;border:1px solid var(--border-light);margin-bottom:10px;z-index:1;"></div>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:10px;">
|
||||
<input type="number" name="lat" id="latTambah" class="form-control" placeholder="Latitude" step="any" required readonly style="background:#F9FAFB;">
|
||||
<input type="number" name="lng" id="lngTambah" class="form-control" placeholder="Longitude" step="any" required readonly style="background:#F9FAFB;">
|
||||
<input type="number" name="lat" id="latTambah" class="form-control" placeholder="Latitude" step="any" required readonly style="background:var(--bg-base); border-color:var(--border-light);">
|
||||
<input type="number" name="lng" id="lngTambah" class="form-control" placeholder="Longitude" step="any" required readonly style="background:var(--bg-base); border-color:var(--border-light);">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -77,7 +77,11 @@ window.openModal = function(id) {
|
||||
setTimeout(() => {
|
||||
if(!miniMap) {
|
||||
miniMap = L.map('miniMapTambah').setView([-0.0583, 109.3448], 13);
|
||||
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png').addTo(miniMap);
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
const tileUrl = isDark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
|
||||
L.tileLayer(tileUrl).addTo(miniMap);
|
||||
miniMap.on('click', function(e) {
|
||||
const lat = e.latlng.lat;
|
||||
const lng = e.latlng.lng;
|
||||
|
||||
@@ -5,6 +5,32 @@
|
||||
<div class="toast-container" id="toastContainer"></div>
|
||||
|
||||
<script>
|
||||
// ── Theme toggle ──
|
||||
(function() {
|
||||
const html = document.documentElement;
|
||||
const saved = localStorage.getItem('portal-theme') || 'dark';
|
||||
setAdminTheme(saved);
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const btn = document.getElementById('adminThemeToggle');
|
||||
const icon = document.getElementById('adminThemeIcon');
|
||||
if (!btn) return;
|
||||
btn.addEventListener('click', () => {
|
||||
const next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
|
||||
setAdminTheme(next);
|
||||
localStorage.setItem('portal-theme', next);
|
||||
});
|
||||
function updateIcon() {
|
||||
if (icon) icon.className = html.getAttribute('data-theme') === 'dark' ? 'fas fa-sun' : 'fas fa-moon';
|
||||
}
|
||||
updateIcon();
|
||||
});
|
||||
function setAdminTheme(t) {
|
||||
html.setAttribute('data-theme', t);
|
||||
const icon = document.getElementById('adminThemeIcon');
|
||||
if (icon) icon.className = t === 'dark' ? 'fas fa-sun' : 'fas fa-moon';
|
||||
}
|
||||
})();
|
||||
|
||||
// ── Clock ──
|
||||
function updateClock() {
|
||||
const now = new Date();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/**
|
||||
* Admin Layout — sidebar + topbar
|
||||
* Include di awal setiap halaman admin setelah auth check.
|
||||
@@ -8,7 +8,7 @@ $user = currentUser();
|
||||
$initial = strtoupper(substr($user['nama_lengkap'] ?: $user['username'], 0, 1));
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<html lang="id" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -105,6 +105,12 @@ $initial = strtoupper(substr($user['nama_lengkap'] ?: $user['username'], 0, 1));
|
||||
<a href="<?= app_url('panel_admin/peta_admin.php') ?>" class="btn btn-primary btn-sm">
|
||||
<i class="fas fa-map"></i> Buka Peta
|
||||
</a>
|
||||
<button class="btn btn-ghost btn-sm" id="adminThemeToggle" title="Toggle tema" aria-label="Toggle dark/light mode" style="padding:8px 10px;">
|
||||
<i class="fas fa-moon" id="adminThemeIcon"></i>
|
||||
</button>
|
||||
<a href="<?= app_url('../portal.html') ?>" class="btn btn-ghost btn-sm" title="Kembali ke Portal WebGIS">
|
||||
<i class="fas fa-home"></i> Portal
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-content">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once __DIR__ . '/../core_config/database.php';
|
||||
require_once __DIR__ . '/../core_config/middleware_auth.php';
|
||||
requireRole('user');
|
||||
@@ -107,10 +107,10 @@ function badgeStatus($status) {
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Pilih Lokasi di Peta *</label>
|
||||
<div id="miniMapTambah" style="height:200px;border-radius:8px;border:1px solid #E5E7EB;margin-bottom:10px;z-index:1;"></div>
|
||||
<div id="miniMapTambah" style="height:200px;border-radius:8px;border:1px solid var(--border-light);margin-bottom:10px;z-index:1;"></div>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:10px;">
|
||||
<input type="number" name="lat" id="latTambah" class="form-control" placeholder="Latitude" step="any" required readonly style="background:#F9FAFB;">
|
||||
<input type="number" name="lng" id="lngTambah" class="form-control" placeholder="Longitude" step="any" required readonly style="background:#F9FAFB;">
|
||||
<input type="number" name="lat" id="latTambah" class="form-control" placeholder="Latitude" step="any" required readonly style="background:var(--bg-base); border-color:var(--border-light);">
|
||||
<input type="number" name="lng" id="lngTambah" class="form-control" placeholder="Longitude" step="any" required readonly style="background:var(--bg-base); border-color:var(--border-light);">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -134,7 +134,11 @@ window.openModal = function(id) {
|
||||
setTimeout(() => {
|
||||
if(!miniMap) {
|
||||
miniMap = L.map('miniMapTambah').setView([-0.0583, 109.3448], 13);
|
||||
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png').addTo(miniMap);
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
const tileUrl = isDark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
|
||||
L.tileLayer(tileUrl).addTo(miniMap);
|
||||
miniMap.on('click', function(e) {
|
||||
const lat = e.latlng.lat;
|
||||
const lng = e.latlng.lng;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once __DIR__ . '/../core_config/database.php';
|
||||
require_once __DIR__ . '/../core_config/middleware_auth.php';
|
||||
requireRole('user');
|
||||
@@ -39,7 +39,7 @@ $activeNav = 'dashboard';
|
||||
require_once __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
|
||||
<div class="card" style="background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);">
|
||||
<div class="card" style="background: var(--bg-surface); border: 1px solid var(--border-light); margin-bottom: 24px;">
|
||||
<h2 style="font-size:1.4rem;font-weight:700;margin-bottom:6px;color:var(--text-primary);">👋 Selamat Datang, <?= htmlspecialchars(currentUser()['nama_lengkap'] ?: currentUser()['username']) ?>!</h2>
|
||||
<p style="color:var(--text-secondary);font-size:0.9rem;max-width:600px;">
|
||||
Anda masuk sebagai <strong>Pengguna</strong>. Anda dapat melihat seluruh data spasial, analisis, dan berpartisipasi dengan mengirim Laporan Warga atau memberikan ulasan fasilitas.
|
||||
@@ -97,10 +97,10 @@ require_once __DIR__ . '/partials/header.php';
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);">
|
||||
<div class="card" style="background: var(--primary-glow); border: 1px solid var(--primary-light); margin-bottom: 24px;">
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px;">
|
||||
<div>
|
||||
<h3 style="font-size:1.1rem; font-weight:700; margin-bottom:6px;">🗺️ Buka Peta Interaktif</h3>
|
||||
<h3 style="font-size:1.1rem; font-weight:700; margin-bottom:6px; color:var(--text-primary);">🗺️ Buka Peta Interaktif</h3>
|
||||
<p style="color:var(--text-secondary); font-size:0.88rem; max-width:500px;">
|
||||
Lihat semua layer data spasial: SPBU, jalan, kavling, rumah ibadah, warga miskin, kawasan kumuh, dan analisis spasial.
|
||||
</p>
|
||||
|
||||
@@ -5,6 +5,32 @@
|
||||
<div class="toast-container" id="toastContainer"></div>
|
||||
|
||||
<script>
|
||||
// ── Theme toggle ──
|
||||
(function() {
|
||||
const html = document.documentElement;
|
||||
const saved = localStorage.getItem('portal-theme') || 'dark';
|
||||
setUserTheme(saved);
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const btn = document.getElementById('userThemeToggle');
|
||||
const icon = document.getElementById('userThemeIcon');
|
||||
if (!btn) return;
|
||||
btn.addEventListener('click', () => {
|
||||
const next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
|
||||
setUserTheme(next);
|
||||
localStorage.setItem('portal-theme', next);
|
||||
});
|
||||
function updateIcon() {
|
||||
if (icon) icon.className = html.getAttribute('data-theme') === 'dark' ? 'fas fa-sun' : 'fas fa-moon';
|
||||
}
|
||||
updateIcon();
|
||||
});
|
||||
function setUserTheme(t) {
|
||||
html.setAttribute('data-theme', t);
|
||||
const icon = document.getElementById('userThemeIcon');
|
||||
if (icon) icon.className = t === 'dark' ? 'fas fa-sun' : 'fas fa-moon';
|
||||
}
|
||||
})();
|
||||
|
||||
// ── Clock ──
|
||||
function updateClock() {
|
||||
const now = new Date();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/**
|
||||
* User Layout — sidebar + topbar (read-only mode, beda style dari admin)
|
||||
* Variables expected from parent: $pageTitle, $activeNav
|
||||
@@ -7,7 +7,7 @@ $user = currentUser();
|
||||
$initial = strtoupper(substr($user['nama_lengkap'] ?: $user['username'], 0, 1));
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<html lang="id" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -80,6 +80,12 @@ $initial = strtoupper(substr($user['nama_lengkap'] ?: $user['username'], 0, 1));
|
||||
<span class="badge badge-success" style="font-size:0.7rem;padding:5px 10px;">
|
||||
<i class="fas fa-eye"></i> Mode Baca
|
||||
</span>
|
||||
<button class="btn btn-ghost btn-sm" id="userThemeToggle" title="Toggle tema" aria-label="Toggle dark/light mode" style="padding:8px 10px;">
|
||||
<i class="fas fa-moon" id="userThemeIcon"></i>
|
||||
</button>
|
||||
<a href="<?= app_url('../portal.html') ?>" class="btn btn-ghost btn-sm" title="Kembali ke Portal WebGIS">
|
||||
<i class="fas fa-home"></i> Portal
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-content">
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
/* =========================================================
|
||||
WEBGIS PROJECT FINAL — Design System (main.css)
|
||||
WEBGIS PROJECT FINAL — Design System (global.css)
|
||||
========================================================= */
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
|
||||
|
||||
:root {
|
||||
/* Colors - Clean Light Theme */
|
||||
--primary: #2563EB; /* Professional Blue */
|
||||
/* ── Light Theme (default) ── */
|
||||
:root, [data-theme="light"] {
|
||||
/* Colors */
|
||||
--primary: #2563EB;
|
||||
--primary-light: #3B82F6;
|
||||
--primary-dark: #1D4ED8;
|
||||
--primary-glow: rgba(37, 99, 235, 0.08);
|
||||
--accent: #10B981;
|
||||
--danger: #EF4444;
|
||||
--warning: #F59E0B;
|
||||
--info: #0EA5E9;
|
||||
|
||||
/* Backgrounds */
|
||||
--bg-base: #F9FAFB; /* Very light gray */
|
||||
--bg-surface: #FFFFFF; /* Pure white */
|
||||
--bg-base: #F9FAFB;
|
||||
--bg-surface: #FFFFFF;
|
||||
--bg-elevated: #FFFFFF;
|
||||
--bg-card: #FFFFFF;
|
||||
|
||||
@@ -25,9 +27,9 @@
|
||||
--border-hover: #D1D5DB;
|
||||
|
||||
/* Text */
|
||||
--text-primary: #111827; /* Near black */
|
||||
--text-secondary: #4B5563; /* Dark gray */
|
||||
--text-muted: #6B7280; /* Medium gray */
|
||||
--text-primary: #111827;
|
||||
--text-secondary: #4B5563;
|
||||
--text-muted: #6B7280;
|
||||
|
||||
/* Sidebar */
|
||||
--sidebar-w: 260px;
|
||||
@@ -42,7 +44,34 @@
|
||||
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
||||
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||
--transition: all 0.2s ease-in-out;
|
||||
--transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
/* ── Dark Theme ── */
|
||||
[data-theme="dark"] {
|
||||
--primary: #818CF8;
|
||||
--primary-light: #A5B4FC;
|
||||
--primary-dark: #6366F1;
|
||||
--primary-glow: rgba(129, 140, 248, 0.15);
|
||||
--accent: #34D399;
|
||||
--danger: #F87171;
|
||||
--warning: #FCD34D;
|
||||
--info: #38BDF8;
|
||||
|
||||
--bg-base: #0F172A;
|
||||
--bg-surface: #1E293B;
|
||||
--bg-elevated: #293548;
|
||||
--bg-card: #1E293B;
|
||||
|
||||
--border-light: rgba(255,255,255,0.08);
|
||||
--border-hover: rgba(129,140,248,0.45);
|
||||
|
||||
--text-primary: #F1F5F9;
|
||||
--text-secondary: #94A3B8;
|
||||
--text-muted: #64748B;
|
||||
|
||||
--sidebar-bg: #0F172A;
|
||||
--sidebar-border: rgba(255,255,255,0.07);
|
||||
}
|
||||
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
@@ -57,6 +86,7 @@ body {
|
||||
line-height: 1.6;
|
||||
min-height: 100vh;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
transition: background 0.25s ease, color 0.25s ease;
|
||||
}
|
||||
|
||||
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
|
||||
@@ -67,6 +97,7 @@ a:hover { color: var(--primary-dark); }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
|
||||
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
|
||||
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #334155; }
|
||||
|
||||
/* ── Buttons ── */
|
||||
.btn {
|
||||
@@ -83,7 +114,7 @@ a:hover { color: var(--primary-dark); }
|
||||
.btn-danger { background: var(--danger); color: #fff; }
|
||||
.btn-danger:hover { filter: brightness(0.95); }
|
||||
.btn-ghost { background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary); }
|
||||
.btn-ghost:hover { background: #F3F4F6; color: var(--text-primary); border-color: var(--border-hover); }
|
||||
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-hover); }
|
||||
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
|
||||
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
|
||||
|
||||
@@ -94,6 +125,7 @@ a:hover { color: var(--primary-dark); }
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 24px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
transition: background 0.25s ease, border-color 0.25s ease;
|
||||
}
|
||||
|
||||
/* ── Form Elements ── */
|
||||
@@ -101,18 +133,18 @@ a:hover { color: var(--primary-dark); }
|
||||
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
|
||||
.form-control {
|
||||
width: 100%; padding: 10px 14px; border-radius: var(--radius-md);
|
||||
background: #FFFFFF; border: 1px solid var(--border-light);
|
||||
background: var(--bg-surface); border: 1px solid var(--border-light);
|
||||
color: var(--text-primary); font-size: 0.9rem; font-family: 'Inter', sans-serif;
|
||||
outline: none; transition: var(--transition); box-shadow: var(--shadow-sm);
|
||||
}
|
||||
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
|
||||
.form-control::placeholder { color: #9CA3AF; }
|
||||
select.form-control {
|
||||
appearance: none;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 12px center;
|
||||
padding-right: 36px;
|
||||
.form-control::placeholder { color: var(--text-muted); }
|
||||
select.form-control {
|
||||
appearance: none;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 12px center;
|
||||
padding-right: 36px;
|
||||
}
|
||||
textarea.form-control { resize: vertical; min-height: 80px; }
|
||||
|
||||
@@ -124,20 +156,26 @@ textarea.form-control { resize: vertical; min-height: 80px; }
|
||||
.badge-warning { background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A; }
|
||||
.badge-info { background: #F0F9FF; color: #0369A1; border: 1px solid #BAE6FD; }
|
||||
|
||||
[data-theme="dark"] .badge-primary { background: rgba(129,140,248,0.15); color: #A5B4FC; border-color: rgba(129,140,248,0.3); }
|
||||
[data-theme="dark"] .badge-success { background: rgba(52,211,153,0.15); color: #6EE7B7; border-color: rgba(52,211,153,0.3); }
|
||||
[data-theme="dark"] .badge-danger { background: rgba(248,113,113,0.15); color: #FCA5A5; border-color: rgba(248,113,113,0.3); }
|
||||
[data-theme="dark"] .badge-warning { background: rgba(252,211,77,0.15); color: #FDE68A; border-color: rgba(252,211,77,0.3); }
|
||||
[data-theme="dark"] .badge-info { background: rgba(56,189,248,0.15); color: #7DD3FC; border-color: rgba(56,189,248,0.3); }
|
||||
|
||||
/* ── Tables ── */
|
||||
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-light); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
|
||||
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
|
||||
.data-table thead th { background: #F9FAFB; padding: 14px 16px; text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; border-bottom: 1px solid var(--border-light); }
|
||||
.data-table thead th { background: var(--bg-elevated); padding: 14px 16px; text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; border-bottom: 1px solid var(--border-light); }
|
||||
.data-table tbody tr { border-bottom: 1px solid var(--border-light); transition: background 0.15s; }
|
||||
.data-table tbody tr:last-child { border-bottom: none; }
|
||||
.data-table tbody tr:hover { background: #F3F4F6; }
|
||||
.data-table tbody tr:hover { background: var(--bg-elevated); }
|
||||
.data-table td { padding: 14px 16px; color: var(--text-primary); vertical-align: middle; }
|
||||
.data-table .actions { display: flex; gap: 6px; }
|
||||
|
||||
/* ── Modal ── */
|
||||
.modal-overlay {
|
||||
display: none; position: fixed; inset: 0; z-index: 9999;
|
||||
background: rgba(17, 24, 39, 0.4); backdrop-filter: blur(2px);
|
||||
background: rgba(17, 24, 39, 0.5); backdrop-filter: blur(4px);
|
||||
align-items: center; justify-content: center;
|
||||
}
|
||||
.modal-overlay.active { display: flex; }
|
||||
@@ -152,7 +190,7 @@ textarea.form-control { resize: vertical; min-height: 80px; }
|
||||
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
|
||||
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
|
||||
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.4rem; padding: 4px; border-radius: var(--radius-sm); transition: all 0.15s; }
|
||||
.modal-close:hover { background: #F3F4F6; color: var(--text-primary); }
|
||||
.modal-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
|
||||
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border-light); }
|
||||
|
||||
/* ── Toast ── */
|
||||
@@ -176,7 +214,7 @@ textarea.form-control { resize: vertical; min-height: 80px; }
|
||||
width: min(360px, calc(100vw - 32px));
|
||||
padding: 13px 14px;
|
||||
color: var(--text-primary);
|
||||
background: #FFFFFF;
|
||||
background: var(--bg-surface);
|
||||
border: 1px solid #A7F3D0;
|
||||
border-left: 4px solid var(--accent);
|
||||
border-radius: var(--radius-md);
|
||||
@@ -229,7 +267,7 @@ textarea.form-control { resize: vertical; min-height: 80px; }
|
||||
.page-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
|
||||
.page-header p { color: var(--text-secondary); margin-top: 6px; font-size: 0.9rem; }
|
||||
.page-header .breadcrumb { display: flex; gap: 8px; align-items: center; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px; }
|
||||
.page-header .breadcrumb .sep { color: #D1D5DB; }
|
||||
.page-header .breadcrumb .sep { color: var(--border-hover); }
|
||||
|
||||
/* ── Utilities ── */
|
||||
.text-muted { color: var(--text-muted); }
|
||||
|
||||
@@ -763,3 +763,120 @@
|
||||
bottom: 66px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ══════════════════════════════
|
||||
DARK THEME OVERRIDES FOR MAPS
|
||||
══════════════════════════════ */
|
||||
[data-theme="dark"] {
|
||||
.map-wrap,
|
||||
#admin-map,
|
||||
#user-map,
|
||||
.leaflet-container {
|
||||
background: #0f172a;
|
||||
}
|
||||
|
||||
.leaflet-control-attribution {
|
||||
background: rgba(15, 23, 42, 0.9) !important;
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.leaflet-control-zoom a,
|
||||
.leaflet-draw-toolbar a {
|
||||
background: var(--bg-surface) !important;
|
||||
color: var(--text-primary) !important;
|
||||
border-color: var(--border-light) !important;
|
||||
}
|
||||
|
||||
.leaflet-control-zoom a:hover,
|
||||
.leaflet-draw-toolbar a:hover {
|
||||
background: var(--bg-elevated) !important;
|
||||
color: var(--primary-light) !important;
|
||||
}
|
||||
|
||||
.map-sidebar {
|
||||
background: rgba(30, 41, 59, 0.95);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.map-panel-icon {
|
||||
background: rgba(99, 102, 241, 0.15);
|
||||
color: var(--primary-light);
|
||||
border-color: rgba(99, 102, 241, 0.3);
|
||||
}
|
||||
|
||||
.layer-item:hover {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.qs-item {
|
||||
background: var(--bg-base);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.map-analysis {
|
||||
background: rgba(30, 41, 59, 0.95);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.map-analysis button {
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-secondary);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.map-analysis button:hover {
|
||||
background: var(--bg-elevated);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.map-analysis button.active {
|
||||
color: #FFFFFF;
|
||||
background: var(--primary-dark);
|
||||
border-color: var(--primary-dark);
|
||||
}
|
||||
|
||||
.spbu-panel {
|
||||
background: rgba(30, 41, 59, 0.95);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.spbu-result {
|
||||
background: var(--bg-base);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.spbu-result-distance {
|
||||
color: var(--primary-light);
|
||||
}
|
||||
|
||||
.leaflet-popup-content-wrapper {
|
||||
background: var(--bg-surface) !important;
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.leaflet-popup-tip {
|
||||
background: var(--bg-surface) !important;
|
||||
}
|
||||
|
||||
.map-legend {
|
||||
background: rgba(30, 41, 59, 0.95);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.legend-area {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.map-loading {
|
||||
color: var(--text-primary);
|
||||
background: rgba(15, 23, 42, 0.85);
|
||||
}
|
||||
|
||||
.read-only-badge {
|
||||
color: #6EE7B7;
|
||||
background: rgba(52, 211, 153, 0.15);
|
||||
border-color: rgba(52, 211, 153, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -362,3 +362,55 @@ body.admin-page {
|
||||
.admin-main { margin-left: 0; }
|
||||
.stats-grid { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
/* ══════════════════════════════
|
||||
DARK THEME OVERRIDES FOR PANEL
|
||||
══════════════════════════════ */
|
||||
[data-theme="dark"] {
|
||||
.nav-item:hover {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.nav-item.active {
|
||||
background: var(--primary-glow);
|
||||
color: var(--primary-light);
|
||||
}
|
||||
|
||||
.sidebar-footer {
|
||||
background: #090d16;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
background: #111827;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
background: var(--primary-glow);
|
||||
color: var(--primary-light);
|
||||
}
|
||||
|
||||
.topbar-time {
|
||||
background: var(--bg-elevated);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.search-box input {
|
||||
background: var(--bg-surface);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
.map-sidebar-floating {
|
||||
background: var(--bg-surface);
|
||||
border-color: var(--border-light);
|
||||
}
|
||||
|
||||
/* Stat card styles for dark theme */
|
||||
.stat-card.primary .stat-icon { background: rgba(37, 99, 235, 0.15); color: #818CF8; }
|
||||
.stat-card.success .stat-icon { background: rgba(16, 185, 129, 0.15); color: #34D399; }
|
||||
.stat-card.danger .stat-icon { background: rgba(239, 68, 68, 0.15); color: #F87171; }
|
||||
.stat-card.warning .stat-icon { background: rgba(245, 158, 11, 0.15); color: #FCD34D; }
|
||||
.stat-card.info .stat-icon { background: rgba(14, 165, 233, 0.15); color: #38BDF8; }
|
||||
.stat-card.violet .stat-icon { background: rgba(124, 58, 237, 0.15); color: #A78BFA; }
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +87,26 @@ function initMap() {
|
||||
|
||||
L.control.zoom({ position: 'bottomright' }).addTo(state.map);
|
||||
|
||||
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
const tileUrl = isDark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
|
||||
|
||||
const tileLayer = L.tileLayer(tileUrl, {
|
||||
attribution: '© OpenStreetMap, © CARTO',
|
||||
subdomains: 'abcd',
|
||||
maxZoom: 20
|
||||
}).addTo(state.map);
|
||||
|
||||
// Dynamic theme updater for tile layer
|
||||
const observer = new MutationObserver(() => {
|
||||
const dark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
tileLayer.setUrl(dark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png'
|
||||
);
|
||||
});
|
||||
observer.observe(document.documentElement, { attributes: true });
|
||||
}
|
||||
|
||||
/* ── Fetch GeoJSON ── */
|
||||
|
||||
@@ -81,11 +81,26 @@ function initMap() {
|
||||
|
||||
L.control.zoom({ position: 'bottomright' }).addTo(state.map);
|
||||
|
||||
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
const tileUrl = isDark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
|
||||
|
||||
const tileLayer = L.tileLayer(tileUrl, {
|
||||
attribution: '© OpenStreetMap, © CARTO',
|
||||
subdomains: 'abcd',
|
||||
maxZoom: 20
|
||||
}).addTo(state.map);
|
||||
|
||||
// Dynamic theme updater for tile layer
|
||||
const observer = new MutationObserver(() => {
|
||||
const dark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
tileLayer.setUrl(dark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png'
|
||||
);
|
||||
});
|
||||
observer.observe(document.documentElement, { attributes: true });
|
||||
}
|
||||
|
||||
async function fetchLayer(path) {
|
||||
|
||||
Reference in New Issue
Block a user