mengubah sistem menjadi lebih terfokus ke poverty

This commit is contained in:
Abimanyu Ridho
2026-06-11 01:50:37 +07:00
parent 739e360018
commit 468541b1c8
46 changed files with 5753 additions and 2805 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
$pageTitle = isset($pageTitle) ? $pageTitle : 'WebGIS Poverty Mapping';
?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= htmlspecialchars($pageTitle) ?></title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/layout.css">
<link rel="stylesheet" href="css/components.css">
<?php if (isset($pageCss) && $pageCss) { ?>
<link rel="stylesheet" href="<?= htmlspecialchars($pageCss) ?>">
<?php } ?>
<!-- Auth init: store user in window, dispatch event AFTER DOM is ready -->
<script>
// Fetch auth immediately (parallel with page load), but dispatch event
// only after DOMContentLoaded so all listeners are already attached.
window._authPromise = (async function () {
try {
const res = await fetch('api/me.php');
const data = await res.json();
if (data.status !== 'success') {
window.location.href = '?page=login';
return null;
}
window.currentUser = data.data;
return data.data;
} catch (e) {
window.location.href = '?page=login';
return null;
}
})();
// Once DOM is ready, resolve the auth and dispatch event
document.addEventListener('DOMContentLoaded', async function() {
const user = await window._authPromise;
if (!user) return; // already redirecting
document.dispatchEvent(new CustomEvent('auth-ready', { detail: user }));
});
</script>