feat(landing-page):penambahan landing page utama pdemisah antar fitur

This commit is contained in:
2026-06-11 09:58:07 +07:00
parent 6b7fa7e467
commit d78ee0a79e
35 changed files with 5007 additions and 4753 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
header('Content-Type: application/json');
include __DIR__ . '/../../db_config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = (int)($_POST['id'] ?? 0);
if ($id <= 0) {
http_response_code(400);
echo json_encode(['status' => 'error', 'message' => 'ID tidak valid']);
exit;
}
$stmt = $conn->prepare("DELETE FROM locations WHERE id = ?");
if (!$stmt) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $conn->error]);
$conn->close();
exit;
}
$stmt->bind_param("i", $id);
if ($stmt->execute()) {
echo json_encode(['status' => 'success', 'message' => 'SPBU berhasil dihapus']);
} else {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $stmt->error]);
}
$stmt->close();
}
$conn->close();
?>
+25
View File
@@ -0,0 +1,25 @@
<?php
header('Content-Type: application/json');
include __DIR__ . '/../../db_config.php';
$sql = "SELECT * FROM locations ORDER BY created_at DESC";
$result = $conn->query($sql);
$locations = [];
if (!$result) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => 'Query gagal: ' . $conn->error]);
$conn->close();
exit;
}
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$locations[] = $row;
}
}
echo json_encode($locations);
$conn->close();
?>
+39
View File
@@ -0,0 +1,39 @@
<?php
header('Content-Type: application/json');
include __DIR__ . '/../../db_config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$nama = $_POST['nama'] ?? '';
$nomor = $_POST['nomor'] ?? '';
$status = $_POST['status'] ?? 'tidak';
$lat = $_POST['lat'] ?? '';
$lng = $_POST['lng'] ?? '';
// Validasi sederhana
if(empty($nama) || empty($nomor) || empty($lat) || empty($lng)) {
http_response_code(400);
echo json_encode(['status' => 'error', 'message' => 'Data tidak lengkap']);
exit;
}
$stmt = $conn->prepare("INSERT INTO locations (nama, nomor, buka_24jam, latitude, longitude) VALUES (?, ?, ?, ?, ?)");
if (!$stmt) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $conn->error]);
$conn->close();
exit;
}
$stmt->bind_param("sssdd", $nama, $nomor, $status, $lat, $lng);
if ($stmt->execute()) {
echo json_encode(['status' => 'success', 'message' => 'Data SPBU berhasil disimpan']);
} else {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $stmt->error]);
}
$stmt->close();
}
$conn->close();
?>
+36
View File
@@ -0,0 +1,36 @@
<?php
header('Content-Type: application/json');
include __DIR__ . '/../../db_config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = (int)($_POST['id'] ?? 0);
$lat = $_POST['lat'] ?? '';
$lng = $_POST['lng'] ?? '';
if ($id <= 0 || empty($lat) || empty($lng)) {
http_response_code(400);
echo json_encode(['status' => 'error', 'message' => 'Data tidak lengkap']);
exit;
}
$stmt = $conn->prepare("UPDATE locations SET latitude = ?, longitude = ? WHERE id = ?");
if (!$stmt) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $conn->error]);
$conn->close();
exit;
}
$stmt->bind_param("ddi", $lat, $lng, $id);
if ($stmt->execute()) {
echo json_encode(['status' => 'success', 'message' => 'Koordinat SPBU berhasil diperbarui']);
} else {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $stmt->error]);
}
$stmt->close();
}
$conn->close();
?>
+37
View File
@@ -0,0 +1,37 @@
<?php
header('Content-Type: application/json');
include __DIR__ . '/../../db_config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = (int)($_POST['id'] ?? 0);
$nama = $_POST['nama'] ?? '';
$nomor = $_POST['nomor'] ?? '';
$status = $_POST['status'] ?? 'tidak';
if ($id <= 0 || empty($nama) || empty($nomor)) {
http_response_code(400);
echo json_encode(['status' => 'error', 'message' => 'Data tidak lengkap']);
exit;
}
$stmt = $conn->prepare("UPDATE locations SET nama = ?, nomor = ?, buka_24jam = ? WHERE id = ?");
if (!$stmt) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $conn->error]);
$conn->close();
exit;
}
$stmt->bind_param("sssi", $nama, $nomor, $status, $id);
if ($stmt->execute()) {
echo json_encode(['status' => 'success', 'message' => 'Detail SPBU berhasil diperbarui']);
} else {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $stmt->error]);
}
$stmt->close();
}
$conn->close();
?>