Initial commit: Retribusi frontend dengan dashboard, event logs, dan settings

This commit is contained in:
mwpn
2025-12-18 11:21:40 +07:00
commit b3573ed390
35 changed files with 7368 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-API-KEY");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
http_response_code(200);
exit;
}
header('Content-Type: application/json');
// TODO: Implementasi logic chart monthly di sini
// Validasi Authorization token
/*
$headers = getallheaders();
if (!isset($headers['Authorization'])) {
http_response_code(401);
echo json_encode(['error' => 'unauthorized']);
exit;
}
// Validasi X-API-KEY
if (!isset($_SERVER['HTTP_X_API_KEY']) || $_SERVER['HTTP_X_API_KEY'] !== 'RETRIBUSI-DASHBOARD-KEY') {
http_response_code(401);
echo json_encode(['error' => 'unauthorized']);
exit;
}
// Logic chart monthly
$month = $_GET['month'] ?? date('Y-m');
$location_code = $_GET['location_code'] ?? null;
// ... kode chart monthly yang sudah ada ...
$daysInMonth = date('t', strtotime($month . '-01'));
echo json_encode([
'labels' => range(1, $daysInMonth),
'motor' => array_fill(0, $daysInMonth, 0),
'car' => array_fill(0, $daysInMonth, 0),
'person' => array_fill(0, $daysInMonth, 0),
'amount' => array_fill(0, $daysInMonth, 0)
]);
*/