chore: prepare docker webgis deployment

This commit is contained in:
Andrie
2026-06-11 18:14:21 +07:00
parent d2214ad9c8
commit a90748d9c1
149 changed files with 20844 additions and 5 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
// api/point/ambil.php — Ambil semua POI
header('Content-Type: application/json');
require_once '../../koneksi.php';
$result = $conn->query("SELECT id, nama_tempat, no_wa, buka_24jam, latitude, longitude FROM lokasi_usaha ORDER BY id DESC");
if (!$result) {
echo json_encode(['status' => 'error', 'message' => $conn->error]);
exit;
}
$data = [];
while ($row = $result->fetch_assoc()) {
$data[] = $row;
}
echo json_encode([
'status' => 'success',
'total' => count($data),
'data' => $data
]);
$conn->close();
+27
View File
@@ -0,0 +1,27 @@
<?php
// api/point/hapus.php — Hapus POI
header('Content-Type: application/json');
require_once '../../koneksi.php';
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['status' => 'error', 'message' => 'Method not allowed']);
exit;
}
$id = (int) ($_POST['id'] ?? 0);
if (!$id) {
echo json_encode(['status' => 'error', 'message' => 'ID tidak valid']);
exit;
}
$stmt = $conn->prepare("DELETE FROM lokasi_usaha WHERE id = ?");
$stmt->bind_param('i', $id);
if ($stmt->execute() && $stmt->affected_rows > 0) {
echo json_encode(['status' => 'success', 'message' => 'Data berhasil dihapus']);
} else {
echo json_encode(['status' => 'error', 'message' => 'Data tidak ditemukan atau gagal dihapus']);
}
$stmt->close();
$conn->close();
+44
View File
@@ -0,0 +1,44 @@
<?php
// api/point/simpan.php — Simpan POI baru
header('Content-Type: application/json');
require_once '../../koneksi.php';
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['status' => 'error', 'message' => 'Method not allowed']);
exit;
}
$nama = trim($_POST['nama_tempat'] ?? '');
$wa = trim($_POST['no_wa'] ?? '');
$buka24 = isset($_POST['buka_24jam']) ? (int) $_POST['buka_24jam'] : 0;
$lat = (float) ($_POST['latitude'] ?? 0);
$lng = (float) ($_POST['longitude'] ?? 0);
if (!$nama) {
echo json_encode(['status' => 'error', 'message' => 'Nama tempat tidak boleh kosong']);
exit;
}
$stmt = $conn->prepare("INSERT INTO lokasi_usaha (nama_tempat, no_wa, buka_24jam, latitude, longitude) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param('ssidd', $nama, $wa, $buka24, $lat, $lng);
if ($stmt->execute()) {
$id = $conn->insert_id;
echo json_encode([
'status' => 'success',
'message' => 'Data berhasil disimpan',
'data' => [
'id' => $id,
'nama_tempat' => $nama,
'no_wa' => $wa,
'buka_24jam' => $buka24,
'latitude' => $lat,
'longitude' => $lng
]
]);
} else {
echo json_encode(['status' => 'error', 'message' => 'Gagal menyimpan: ' . $stmt->error]);
}
$stmt->close();
$conn->close();
+30
View File
@@ -0,0 +1,30 @@
<?php
// api/point/update_posisi.php — Update koordinat POI (drag marker)
header('Content-Type: application/json');
require_once '../../koneksi.php';
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['status' => 'error', 'message' => 'Method not allowed']);
exit;
}
$id = (int) ($_POST['id'] ?? 0);
$lat = (float) ($_POST['latitude'] ?? 0);
$lng = (float) ($_POST['longitude'] ?? 0);
if (!$id) {
echo json_encode(['status' => 'error', 'message' => 'ID tidak valid']);
exit;
}
$stmt = $conn->prepare("UPDATE lokasi_usaha SET latitude = ?, longitude = ? WHERE id = ?");
$stmt->bind_param('ddi', $lat, $lng, $id);
if ($stmt->execute() && $stmt->affected_rows > 0) {
echo json_encode(['status' => 'success', 'message' => 'Posisi diperbarui']);
} else {
echo json_encode(['status' => 'error', 'message' => 'Gagal memperbarui posisi']);
}
$stmt->close();
$conn->close();