Compare commits
3 Commits
b81a0166fa
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 26bf1e7b2a | |||
| 94e4ef2da4 | |||
| c507033b9e |
@@ -583,6 +583,7 @@ function renderPenduduk(item) {
|
|||||||
<span class="popup-badge ${badgeClass}">${cek.status}</span>
|
<span class="popup-badge ${badgeClass}">${cek.status}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="popup-row"><strong>NIK</strong><span>${item.nik || '-'}</span></div>
|
<div class="popup-row"><strong>NIK</strong><span>${item.nik || '-'}</span></div>
|
||||||
|
<div class="popup-row"><strong>Alamat</strong><span>${item.alamat || '-'}</span></div>
|
||||||
<div class="popup-row"><strong>Ditangani</strong><span>${cek.nama || item.fp_nama || '-'}</span></div>
|
<div class="popup-row"><strong>Ditangani</strong><span>${cek.nama || item.fp_nama || '-'}</span></div>
|
||||||
<div class="popup-row"><strong>Keterangan</strong><span>${item.keterangan || '-'}</span></div>
|
<div class="popup-row"><strong>Keterangan</strong><span>${item.keterangan || '-'}</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[phases.build]
|
||||||
|
cmds = [
|
||||||
|
"mkdir -p /app/uploads",
|
||||||
|
"chmod -R 777 /app/uploads"
|
||||||
|
]
|
||||||
@@ -50,7 +50,7 @@ function uploadFoto($file_input_name) {
|
|||||||
if ($file_size <= $max_size) {
|
if ($file_size <= $max_size) {
|
||||||
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
||||||
$new_file_name = uniqid($file_input_name . '_', true) . '.' . $file_extension;
|
$new_file_name = uniqid($file_input_name . '_', true) . '.' . $file_extension;
|
||||||
$upload_file_dir = '../uploads/';
|
$upload_file_dir = __DIR__ . '/../uploads/';
|
||||||
if (!is_dir($upload_file_dir)) {
|
if (!is_dir($upload_file_dir)) {
|
||||||
@mkdir($upload_file_dir, 0777, true);
|
@mkdir($upload_file_dir, 0777, true);
|
||||||
}
|
}
|
||||||
@@ -58,16 +58,22 @@ function uploadFoto($file_input_name) {
|
|||||||
|
|
||||||
if (@move_uploaded_file($file_tmp_path, $dest_path)) {
|
if (@move_uploaded_file($file_tmp_path, $dest_path)) {
|
||||||
return $new_file_name;
|
return $new_file_name;
|
||||||
|
} else {
|
||||||
|
throw new Exception("Gagal memindahkan file upload ke: " . $dest_path);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new Exception("Ukuran file melebihi batas 10MB.");
|
||||||
}
|
}
|
||||||
|
} else if (isset($_FILES[$file_input_name]) && $_FILES[$file_input_name]['error'] !== UPLOAD_ERR_NO_FILE) {
|
||||||
|
throw new Exception("Error upload PHP: " . $_FILES[$file_input_name]['error']);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
$foto_rumah = uploadFoto('foto_rumah');
|
$foto_rumah = uploadFoto('foto_rumah');
|
||||||
$foto_kk = uploadFoto('foto_kk');
|
$foto_kk = uploadFoto('foto_kk');
|
||||||
|
|
||||||
try {
|
|
||||||
$stmt = $pdo->prepare(
|
$stmt = $pdo->prepare(
|
||||||
"INSERT INTO penduduk_miskin (nama, nik, keterangan, alamat, latitude, longitude, status_jangkauan, fasilitas_publik_id, foto_rumah, foto_kk, status_bantuan)
|
"INSERT INTO penduduk_miskin (nama, nik, keterangan, alamat, latitude, longitude, status_jangkauan, fasilitas_publik_id, foto_rumah, foto_kk, status_bantuan)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
@@ -80,7 +86,7 @@ try {
|
|||||||
$data = $stmtSelect->fetch(PDO::FETCH_ASSOC);
|
$data = $stmtSelect->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
echo json_encode(['status'=>'success','data'=>$data]);
|
echo json_encode(['status'=>'success','data'=>$data]);
|
||||||
} catch (PDOException $e) {
|
} catch (Exception $e) {
|
||||||
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
|
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function uploadFoto($file_input_name) {
|
|||||||
if ($file_size <= $max_size) {
|
if ($file_size <= $max_size) {
|
||||||
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
||||||
$new_file_name = uniqid($file_input_name . '_', true) . '.' . $file_extension;
|
$new_file_name = uniqid($file_input_name . '_', true) . '.' . $file_extension;
|
||||||
$upload_file_dir = '../uploads/';
|
$upload_file_dir = __DIR__ . '/../uploads/';
|
||||||
if (!is_dir($upload_file_dir)) {
|
if (!is_dir($upload_file_dir)) {
|
||||||
@mkdir($upload_file_dir, 0777, true);
|
@mkdir($upload_file_dir, 0777, true);
|
||||||
}
|
}
|
||||||
@@ -55,18 +55,24 @@ function uploadFoto($file_input_name) {
|
|||||||
|
|
||||||
if (@move_uploaded_file($file_tmp_path, $dest_path)) {
|
if (@move_uploaded_file($file_tmp_path, $dest_path)) {
|
||||||
return $new_file_name;
|
return $new_file_name;
|
||||||
|
} else {
|
||||||
|
throw new Exception("Gagal memindahkan file upload ke: " . $dest_path);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new Exception("Ukuran file melebihi batas 10MB.");
|
||||||
}
|
}
|
||||||
|
} else if (isset($_FILES[$file_input_name]) && $_FILES[$file_input_name]['error'] !== UPLOAD_ERR_NO_FILE) {
|
||||||
|
throw new Exception("Error upload PHP: " . $_FILES[$file_input_name]['error']);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$foto_rumah = uploadFoto('foto_rumah');
|
|
||||||
$foto_kk = uploadFoto('foto_kk');
|
|
||||||
|
|
||||||
$alamat = trim($_POST['alamat'] ?? '');
|
$alamat = trim($_POST['alamat'] ?? '');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$foto_rumah = uploadFoto('foto_rumah');
|
||||||
|
$foto_kk = uploadFoto('foto_kk');
|
||||||
|
|
||||||
$query = "UPDATE penduduk_miskin SET nama=?, nik=?, keterangan=?, alamat=?, latitude=?, longitude=?, status_jangkauan=?, fasilitas_publik_id=?, status_bantuan=?";
|
$query = "UPDATE penduduk_miskin SET nama=?, nik=?, keterangan=?, alamat=?, latitude=?, longitude=?, status_jangkauan=?, fasilitas_publik_id=?, status_bantuan=?";
|
||||||
$params = [$nama, $nik, $keterangan, $alamat, $latitude, $longitude, $status_jangkauan, $fp_id, $status_bantuan];
|
$params = [$nama, $nik, $keterangan, $alamat, $latitude, $longitude, $status_jangkauan, $fp_id, $status_bantuan];
|
||||||
|
|
||||||
@@ -90,7 +96,7 @@ try {
|
|||||||
$data = $stmtSelect->fetch(PDO::FETCH_ASSOC);
|
$data = $stmtSelect->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
echo json_encode(['status'=>'success','data'=>$data]);
|
echo json_encode(['status'=>'success','data'=>$data]);
|
||||||
} catch (PDOException $e) {
|
} catch (Exception $e) {
|
||||||
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
|
echo json_encode(['status'=>'error','message'=>'Gagal memperbarui: '.$e->getMessage()]);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<?php require 'koneksi.php'; print_r($pdo->query('SELECT id, nama, foto_rumah, foto_kk FROM penduduk_miskin ORDER BY id DESC LIMIT 5')->fetchAll(PDO::FETCH_ASSOC));
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[phases.build]
|
||||||
|
cmds = [
|
||||||
|
"mkdir -p /app/kemiskinan/uploads",
|
||||||
|
"chmod -R 777 /app/kemiskinan/uploads"
|
||||||
|
]
|
||||||
@@ -583,6 +583,7 @@ function renderPenduduk(item) {
|
|||||||
<span class="popup-badge ${badgeClass}">${cek.status}</span>
|
<span class="popup-badge ${badgeClass}">${cek.status}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="popup-row"><strong>NIK</strong><span>${item.nik || '-'}</span></div>
|
<div class="popup-row"><strong>NIK</strong><span>${item.nik || '-'}</span></div>
|
||||||
|
<div class="popup-row"><strong>Alamat</strong><span>${item.alamat || '-'}</span></div>
|
||||||
<div class="popup-row"><strong>Ditangani</strong><span>${cek.nama || item.fp_nama || '-'}</span></div>
|
<div class="popup-row"><strong>Ditangani</strong><span>${cek.nama || item.fp_nama || '-'}</span></div>
|
||||||
<div class="popup-row"><strong>Keterangan</strong><span>${item.keterangan || '-'}</span></div>
|
<div class="popup-row"><strong>Keterangan</strong><span>${item.keterangan || '-'}</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function uploadFoto($file_input_name) {
|
|||||||
if ($file_size <= $max_size) {
|
if ($file_size <= $max_size) {
|
||||||
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
||||||
$new_file_name = uniqid($file_input_name . '_', true) . '.' . $file_extension;
|
$new_file_name = uniqid($file_input_name . '_', true) . '.' . $file_extension;
|
||||||
$upload_file_dir = '../../kemiskinan/uploads/';
|
$upload_file_dir = __DIR__ . '/../../kemiskinan/uploads/';
|
||||||
if (!is_dir($upload_file_dir)) {
|
if (!is_dir($upload_file_dir)) {
|
||||||
@mkdir($upload_file_dir, 0777, true);
|
@mkdir($upload_file_dir, 0777, true);
|
||||||
}
|
}
|
||||||
@@ -58,16 +58,22 @@ function uploadFoto($file_input_name) {
|
|||||||
|
|
||||||
if (@move_uploaded_file($file_tmp_path, $dest_path)) {
|
if (@move_uploaded_file($file_tmp_path, $dest_path)) {
|
||||||
return $new_file_name;
|
return $new_file_name;
|
||||||
|
} else {
|
||||||
|
throw new Exception("Gagal memindahkan file upload ke: " . $dest_path);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new Exception("Ukuran file melebihi batas 10MB.");
|
||||||
}
|
}
|
||||||
|
} else if (isset($_FILES[$file_input_name]) && $_FILES[$file_input_name]['error'] !== UPLOAD_ERR_NO_FILE) {
|
||||||
|
throw new Exception("Error upload PHP: " . $_FILES[$file_input_name]['error']);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
$foto_rumah = uploadFoto('foto_rumah');
|
$foto_rumah = uploadFoto('foto_rumah');
|
||||||
$foto_kk = uploadFoto('foto_kk');
|
$foto_kk = uploadFoto('foto_kk');
|
||||||
|
|
||||||
try {
|
|
||||||
$stmt = $pdo->prepare(
|
$stmt = $pdo->prepare(
|
||||||
"INSERT INTO penduduk_miskin (nama, nik, keterangan, alamat, latitude, longitude, status_jangkauan, fasilitas_publik_id, foto_rumah, foto_kk, status_bantuan)
|
"INSERT INTO penduduk_miskin (nama, nik, keterangan, alamat, latitude, longitude, status_jangkauan, fasilitas_publik_id, foto_rumah, foto_kk, status_bantuan)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
@@ -80,7 +86,7 @@ try {
|
|||||||
$data = $stmtSelect->fetch(PDO::FETCH_ASSOC);
|
$data = $stmtSelect->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
echo json_encode(['status'=>'success','data'=>$data]);
|
echo json_encode(['status'=>'success','data'=>$data]);
|
||||||
} catch (PDOException $e) {
|
} catch (Exception $e) {
|
||||||
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
|
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function uploadFoto($file_input_name) {
|
|||||||
if ($file_size <= $max_size) {
|
if ($file_size <= $max_size) {
|
||||||
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
||||||
$new_file_name = uniqid($file_input_name . '_', true) . '.' . $file_extension;
|
$new_file_name = uniqid($file_input_name . '_', true) . '.' . $file_extension;
|
||||||
$upload_file_dir = '../../kemiskinan/uploads/';
|
$upload_file_dir = __DIR__ . '/../../kemiskinan/uploads/';
|
||||||
if (!is_dir($upload_file_dir)) {
|
if (!is_dir($upload_file_dir)) {
|
||||||
@mkdir($upload_file_dir, 0777, true);
|
@mkdir($upload_file_dir, 0777, true);
|
||||||
}
|
}
|
||||||
@@ -55,18 +55,24 @@ function uploadFoto($file_input_name) {
|
|||||||
|
|
||||||
if (@move_uploaded_file($file_tmp_path, $dest_path)) {
|
if (@move_uploaded_file($file_tmp_path, $dest_path)) {
|
||||||
return $new_file_name;
|
return $new_file_name;
|
||||||
|
} else {
|
||||||
|
throw new Exception("Gagal memindahkan file upload ke: " . $dest_path);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new Exception("Ukuran file melebihi batas 10MB.");
|
||||||
}
|
}
|
||||||
|
} else if (isset($_FILES[$file_input_name]) && $_FILES[$file_input_name]['error'] !== UPLOAD_ERR_NO_FILE) {
|
||||||
|
throw new Exception("Error upload PHP: " . $_FILES[$file_input_name]['error']);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$foto_rumah = uploadFoto('foto_rumah');
|
|
||||||
$foto_kk = uploadFoto('foto_kk');
|
|
||||||
|
|
||||||
$alamat = trim($_POST['alamat'] ?? '');
|
$alamat = trim($_POST['alamat'] ?? '');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$foto_rumah = uploadFoto('foto_rumah');
|
||||||
|
$foto_kk = uploadFoto('foto_kk');
|
||||||
|
|
||||||
$query = "UPDATE penduduk_miskin SET nama=?, nik=?, keterangan=?, alamat=?, latitude=?, longitude=?, status_jangkauan=?, fasilitas_publik_id=?, status_bantuan=?";
|
$query = "UPDATE penduduk_miskin SET nama=?, nik=?, keterangan=?, alamat=?, latitude=?, longitude=?, status_jangkauan=?, fasilitas_publik_id=?, status_bantuan=?";
|
||||||
$params = [$nama, $nik, $keterangan, $alamat, $latitude, $longitude, $status_jangkauan, $fp_id, $status_bantuan];
|
$params = [$nama, $nik, $keterangan, $alamat, $latitude, $longitude, $status_jangkauan, $fp_id, $status_bantuan];
|
||||||
|
|
||||||
@@ -90,7 +96,7 @@ try {
|
|||||||
$data = $stmtSelect->fetch(PDO::FETCH_ASSOC);
|
$data = $stmtSelect->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
echo json_encode(['status'=>'success','data'=>$data]);
|
echo json_encode(['status'=>'success','data'=>$data]);
|
||||||
} catch (PDOException $e) {
|
} catch (Exception $e) {
|
||||||
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
|
echo json_encode(['status'=>'error','message'=>'Gagal memperbarui: '.$e->getMessage()]);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user