perbaikan upload foto
This commit is contained in:
@@ -339,18 +339,6 @@ class SurveyorController extends Controller
|
|||||||
{
|
{
|
||||||
$validatedData = $this->validateFotoRequest($request);
|
$validatedData = $this->validateFotoRequest($request);
|
||||||
try {
|
try {
|
||||||
$log = [];
|
|
||||||
$photoCategories = [
|
|
||||||
'rute_menuju_lokasi',
|
|
||||||
'foto_lingkungan',
|
|
||||||
];
|
|
||||||
|
|
||||||
$lainnya = [
|
|
||||||
'foto_rute_lainnya' => ['foto_rute_lainnya', 'name_rute_lainnya'],
|
|
||||||
'foto_lantai_lainnya' => ['foto_lantai_lainnya', 'name_lantai_lainnya']
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
$inspeksi = Inspeksi::firstOrNew([
|
$inspeksi = Inspeksi::firstOrNew([
|
||||||
'permohonan_id' => $request->input('permohonan_id'),
|
'permohonan_id' => $request->input('permohonan_id'),
|
||||||
'dokument_id' => $request->input('dokument_id')
|
'dokument_id' => $request->input('dokument_id')
|
||||||
@@ -363,48 +351,7 @@ class SurveyorController extends Controller
|
|||||||
$formatFotojson = $existingData;
|
$formatFotojson = $existingData;
|
||||||
|
|
||||||
// Upload berbagai jenis foto
|
// Upload berbagai jenis foto
|
||||||
$this->handleFileUpload($request, 'rute_menuju_lokasi', $formatFotojson);
|
$this->handleFileUploadBaru($request, 'rute_menuju_lokasi', $formatFotojson);
|
||||||
$this->handleFileUpload($request, 'foto_lingkungan', $formatFotojson);
|
|
||||||
|
|
||||||
$this->processFotoLantaiUnit($request, $formatFotojson);
|
|
||||||
|
|
||||||
if ($request->hasFile('foto_objek')) {
|
|
||||||
$existingObjekJaminan = $formatFotojson['object_jaminan'] ?? [];
|
|
||||||
$formatFotojson['object_jaminan'] = $this->processObjekJaminanPhotos(
|
|
||||||
$request,
|
|
||||||
$existingObjekJaminan
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($lainnya as $category => $fields) {
|
|
||||||
$photoField = $fields[0];
|
|
||||||
$nameField = $fields[1];
|
|
||||||
$descriptionField = $fields[2] ?? null;
|
|
||||||
|
|
||||||
if ($request->hasFile($photoField)) {
|
|
||||||
$newPhotos = $this->processPhotoLainnya(
|
|
||||||
$request,
|
|
||||||
$fields,
|
|
||||||
$existingData[$category] ?? []
|
|
||||||
);
|
|
||||||
|
|
||||||
$formatFotojson[$category] = $newPhotos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// // Process single files
|
|
||||||
$singleFiles = ['foto_basement', 'foto_gerbang', 'pendamping'];
|
|
||||||
foreach ($singleFiles as $file) {
|
|
||||||
if ($request->hasFile($file)) {
|
|
||||||
// Hapus file lama jika ada
|
|
||||||
if (isset($formatFotojson[$file])) {
|
|
||||||
$this->deleteOfFile($formatFotojson[$file]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Upload dan simpan file baru
|
|
||||||
$formatFotojson[$file] = $this->uploadFile($request->file($file), $file);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update record
|
// Update record
|
||||||
if (!empty($formatFotojson)) {
|
if (!empty($formatFotojson)) {
|
||||||
@@ -414,8 +361,7 @@ class SurveyorController extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'message' => 'Data berhasil disimpan',
|
'message' => 'Data berhasil disimpan',
|
||||||
'data' => $formatFotojson,
|
'data' => $formatFotojson
|
||||||
'log' => $log
|
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,77 +374,95 @@ class SurveyorController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Process a photo
|
public function updateFoto(Request $request)
|
||||||
*/
|
|
||||||
protected function processFotoLantaiUnit(Request $request, &$formatFotojson)
|
|
||||||
{
|
{
|
||||||
// Pastikan foto_lantai_unit sudah ada di formatFotojson
|
try {
|
||||||
if (!isset($formatFotojson['foto_lantai_unit'])) {
|
// Validasi input
|
||||||
$formatFotojson['foto_lantai_unit'] = [];
|
$validated = $request->validate([
|
||||||
}
|
'permohonan_id' => 'required',
|
||||||
|
'dokument_id' => 'required|string',
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
'category' => 'required|string|max:255',
|
||||||
|
'sub' => 'nullable|string|max:255',
|
||||||
|
'path' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
// Ambil nama-nama lantai dari request
|
$inspeksi = Inspeksi::firstOrNew([
|
||||||
$lantaiNama = $request->input('lantai_nama', []);
|
'permohonan_id' => $validated['permohonan_id'],
|
||||||
|
'dokument_id' => $validated['dokument_id'],
|
||||||
|
]);
|
||||||
|
|
||||||
// Tambahan: gunakan lantai_index jika tersedia
|
$cleanRequestPath = str_replace('/storage/', '', $validated['path']);
|
||||||
$lantaiIndex = $request->input('lantai_index', null);
|
|
||||||
|
|
||||||
// Cek apakah ada file foto lantai yang diunggah
|
$fotoForm = json_decode($inspeksi->foto_form, true) ?? [];
|
||||||
$lantaiFiles = $request->file('foto_lantai_unit', []);
|
|
||||||
|
|
||||||
// Proses setiap file foto lantai
|
|
||||||
foreach ($lantaiFiles as $index => $files) {
|
if (!isset($fotoForm['rute_menuju_lokasi'])) {
|
||||||
// Pastikan $files adalah array
|
$fotoForm['rute_menuju_lokasi'] = [];
|
||||||
if (!is_array($files)) {
|
|
||||||
$files = [$files];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gunakan lantai_index jika tersedia, jika tidak gunakan cara sebelumnya
|
|
||||||
$lantaiNomor = $lantaiIndex ?? ($index + 1);
|
|
||||||
|
|
||||||
// Inisialisasi array untuk lantai ini jika belum ada
|
$existingIndex = null;
|
||||||
if (!isset($formatFotojson['foto_lantai_unit'][$lantaiNomor])) {
|
if (!empty($validated['path'])) {
|
||||||
$formatFotojson['foto_lantai_unit'][$lantaiNomor] = [];
|
foreach ($fotoForm['rute_menuju_lokasi'] as $index => $foto) {
|
||||||
}
|
if ($foto['path'] === $cleanRequestPath) {
|
||||||
|
$existingIndex = $index;
|
||||||
foreach ($files as $fileIndex => $file) {
|
break;
|
||||||
// Validasi file
|
}
|
||||||
if (!$file->isValid()) {
|
|
||||||
continue; // Lewati file yang tidak valid
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Generate nama file unik
|
|
||||||
$uniqueFileName = 'lantai_unit_' . $lantaiNomor . '_' . $fileIndex . '_' . Str::random(10) . '.' . $file->getClientOriginalExtension();
|
|
||||||
|
|
||||||
// Simpan file dengan nama asli
|
|
||||||
$path = $file->storeAs(
|
|
||||||
'surveyor/lantai_unit',
|
|
||||||
$uniqueFileName . '/' . time() . '_' . $file->getClientOriginalName(),
|
|
||||||
'public'
|
|
||||||
);
|
|
||||||
|
|
||||||
// Buat nama foto
|
|
||||||
$fotoName = "Foto Lantai {$lantaiNomor} - " . ($fileIndex + 1);
|
|
||||||
|
|
||||||
// Tambahkan detail foto ke array
|
|
||||||
$fotoDetail = [
|
|
||||||
'path' => $path,
|
|
||||||
'name' => $fotoName
|
|
||||||
];
|
|
||||||
|
|
||||||
// Tambahkan ke array foto lantai unit sesuai struktur
|
|
||||||
$formatFotojson['foto_lantai_unit'][$lantaiNomor][] = $fotoDetail;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $formatFotojson;
|
// Siapkan data baru
|
||||||
|
$newFotoData = [
|
||||||
|
'name' => $validated['name'],
|
||||||
|
'description' => $validated['description'],
|
||||||
|
'category' => $validated['category'],
|
||||||
|
'sub' => $validated['sub'],
|
||||||
|
'path' => $cleanRequestPath,
|
||||||
|
'created_by' => Auth::user()->name,
|
||||||
|
'created_at' => now()->toDateTimeString(),
|
||||||
|
'updated_by' => Auth::user()->name,
|
||||||
|
'updated_at' => now()->toDateTimeString(),
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($existingIndex !== null) {
|
||||||
|
$existingFoto = $fotoForm['rute_menuju_lokasi'][$existingIndex];
|
||||||
|
$fotoForm['rute_menuju_lokasi'][$existingIndex] = [
|
||||||
|
'name' => $validated['name'],
|
||||||
|
'description' => $validated['description'],
|
||||||
|
'category' => $validated['category'],
|
||||||
|
'sub' => $validated['sub'],
|
||||||
|
'path' => $cleanRequestPath,
|
||||||
|
'created_by' => $existingFoto['created_by'] ?? Auth::user()->name,
|
||||||
|
'created_at' => $existingFoto['created_at'] ?? now()->toDateTimeString(),
|
||||||
|
'updated_by' => Auth::user()->name,
|
||||||
|
'updated_at' => now()->toDateTimeString(),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$fotoForm['rute_menuju_lokasi'][] = $newFotoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simpan kembali data ke database
|
||||||
|
$inspeksi->foto_form = json_encode($fotoForm);
|
||||||
|
$inspeksi->save();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'Data berhasil diperbarui.',
|
||||||
|
], 200);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Gagal memperbarui data: ' . $e->getMessage(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function handleFileUploadBaru(Request $request, $paramName, &$formatFotojson)
|
||||||
private function handleFileUpload(Request $request, $paramName, &$formatFotojson)
|
|
||||||
{
|
{
|
||||||
if ($request->hasFile($paramName)) {
|
if ($request->hasFile($paramName)) {
|
||||||
$files = $request->file($paramName);
|
$files = $request->file($paramName);
|
||||||
@@ -509,45 +473,54 @@ class SurveyorController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$formatFotoData = [];
|
$formatFotoData = [];
|
||||||
|
$nomor_registrasi = $request->nomor_registrasi;
|
||||||
|
|
||||||
foreach ($files as $index => $file) {
|
foreach ($files as $index => $file) {
|
||||||
|
|
||||||
$timestamp = time();
|
$timestamp = time();
|
||||||
$originalName = $file->getClientOriginalName();
|
$originalName = $file->getClientOriginalName();
|
||||||
$uniqueFileName = "{$timestamp}_{$originalName}";
|
$extension = $file->getClientOriginalExtension();
|
||||||
|
// Validasi nama file
|
||||||
|
if (empty($originalName)) {
|
||||||
|
$originalName = "file_{$timestamp}";
|
||||||
|
}
|
||||||
|
$uniqueFileName = "{$timestamp}.{$extension}";
|
||||||
|
|
||||||
// Simpan file
|
// Simpan file
|
||||||
$path = $file->storeAs("surveyor/{$paramName}", $uniqueFileName, 'public');
|
$nomor_registrasi = $request->nomor_registrasi;
|
||||||
|
$path = $file->storeAs("surveyor/{$paramName}/{$nomor_registrasi}", $uniqueFileName, 'public');
|
||||||
|
|
||||||
$fotoData = [
|
$fotoData = [
|
||||||
|
'name' => pathinfo($originalName, PATHINFO_FILENAME),
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
'name' => ucwords(str_replace('_', ' ', $paramName)) . ' - ' . ($index + 1)
|
'category' => 'lainnya',
|
||||||
|
'sub' => null,
|
||||||
|
'description' => null,
|
||||||
|
'created_by' => Auth::user()->name,
|
||||||
|
'created_at' => now()->toDateTimeString(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$formatFotoData[] = $fotoData;
|
$formatFotoData[] = $fotoData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Struktur JSON yang konsisten
|
// Struktur JSON yang konsisten
|
||||||
if (!isset($formatFotojson[$paramName][$paramName][0])) {
|
if (!isset($formatFotojson[$paramName])) {
|
||||||
$formatFotojson[$paramName] = [
|
$formatFotojson[$paramName] = $formatFotoData;
|
||||||
$paramName => [
|
|
||||||
$formatFotoData
|
|
||||||
]
|
|
||||||
];
|
|
||||||
} else {
|
} else {
|
||||||
$formatFotojson[$paramName][$paramName][0] = array_merge(
|
$formatFotojson[$paramName] = array_merge(
|
||||||
$formatFotojson[$paramName][$paramName][0] ?? [],
|
$formatFotojson[$paramName] ?? [],
|
||||||
$formatFotoData
|
$formatFotoData
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $formatFotoData;
|
return $formatFotoData;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function hapusFoto(Request $request)
|
public function hapusFoto(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -562,39 +535,35 @@ class SurveyorController extends Controller
|
|||||||
);
|
);
|
||||||
$fotoForm = json_decode($inspeksi->foto_form, true);
|
$fotoForm = json_decode($inspeksi->foto_form, true);
|
||||||
|
|
||||||
if (isset($fotoForm[$paramName][$paramName][0])) {
|
if (isset($fotoForm[$paramName]) && is_array($fotoForm[$paramName])) {
|
||||||
// Filter foto yang akan dihapus
|
// Filter foto yang tidak sesuai dengan path yang akan dihapus
|
||||||
|
$fotoForm[$paramName] = array_values(array_filter(
|
||||||
$tes = null;
|
$fotoForm[$paramName],
|
||||||
$fotoForm[$paramName][$paramName][0] = array_values(
|
function ($foto) use ($cleanRequestPath) {
|
||||||
array_filter(
|
if ($foto['path'] === $cleanRequestPath) {
|
||||||
$fotoForm[$paramName][$paramName][0],
|
// Hapus file dari storage
|
||||||
function ($foto) use ($cleanRequestPath) {
|
\Storage::disk('public')->delete($cleanRequestPath);
|
||||||
if ($foto['path'] === $cleanRequestPath) {
|
return false;
|
||||||
// Hapus file dari storage
|
|
||||||
\Storage::disk('public')->delete($cleanRequestPath);
|
|
||||||
return false; // Hapus elemen ini dari array
|
|
||||||
}
|
|
||||||
$tes = $foto['path'];
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
)
|
return true;
|
||||||
);
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
// Simpan kembali data ke database
|
||||||
// Reset array index
|
$inspeksi->foto_form = json_encode($fotoForm);
|
||||||
$fotoForm[$paramName][$paramName][0] = array_values($fotoForm[$paramName][$paramName][0]);
|
|
||||||
|
|
||||||
$inspeksi->foto_form = $fotoForm;
|
|
||||||
$inspeksi->save();
|
$inspeksi->save();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'message' => 'Foto berhasil dihapus',
|
'message' => 'Foto berhasil dihapus',
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['success' => false], 400);
|
// Jika parameter tidak ditemukan
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Foto atau parameter tidak ditemukan',
|
||||||
|
], 400);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => false,
|
'success' => false,
|
||||||
@@ -621,37 +590,32 @@ class SurveyorController extends Controller
|
|||||||
$fotos = $this->findFotoByParamName($fotoForm, $paramName);
|
$fotos = $this->findFotoByParamName($fotoForm, $paramName);
|
||||||
|
|
||||||
|
|
||||||
$param = $paramName == 'rute_menuju_lokasi' ? $fotos['rute_menuju_lokasi'][0] : $fotos['foto_lingkungan'][0];
|
|
||||||
$data = array_map(function ($foto) {
|
$data = array_map(function ($foto) {
|
||||||
return [
|
return [
|
||||||
'name' => $foto['name'] ?? 'Foto',
|
'name' => $foto['name'] ?? 'Foto',
|
||||||
'path' => \Storage::url($foto['path']),
|
'path' => \Storage::url($foto['path'] ?? ''),
|
||||||
|
'category' => $foto['category'] ?? 'lainnya',
|
||||||
|
'sub' => $foto['sub'] ?? null,
|
||||||
|
'description' => $foto['description'] ?? null,
|
||||||
|
'upload_by' => $foto['upload_by'] ?? null,
|
||||||
];
|
];
|
||||||
}, $param);
|
}, $fotos);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'fotos' => $data,
|
'fotos' => $data,
|
||||||
'success' => !empty($data)
|
'success' => !empty($data),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function findFotoByParamName($fotoForm, $paramName)
|
private function findFotoByParamName($fotoForm, $paramName)
|
||||||
{
|
{
|
||||||
// Mapping parameter name ke struktur JSON
|
// Mapping parameter name ke struktur JSON
|
||||||
$paramMapping = [
|
if (isset($fotoForm[$paramName]) && is_array($fotoForm[$paramName])) {
|
||||||
'rute_menuju_lokasi' => ['rute_menuju_lokasi'],
|
return $fotoForm[$paramName]; // Kembalikan array foto jika ditemukan
|
||||||
'foto_lingkungan' => ['foto_lingkungan'],
|
|
||||||
];
|
|
||||||
|
|
||||||
// // Traverse array menggunakan mapping
|
|
||||||
$fotos = $fotoForm;
|
|
||||||
if (isset($paramMapping[$paramName])) {
|
|
||||||
foreach ($paramMapping[$paramName] as $key) {
|
|
||||||
$fotos = $fotos[$key] ?? [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return is_array($fotos) ? $fotos : [];
|
// Jika parameter tidak ditemukan atau bukan array, kembalikan array kosong
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -783,38 +747,7 @@ class SurveyorController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processPhotoLainnya(Request $request, array $fields, array $existingPhotos = [])
|
|
||||||
{
|
|
||||||
$result = $existingPhotos; // Start with existing photos
|
|
||||||
$photoField = $fields[0];
|
|
||||||
$nameField = $fields[1];
|
|
||||||
$descriptionField = $fields[2] ?? null;
|
|
||||||
|
|
||||||
if ($request->hasFile($photoField)) {
|
|
||||||
$newFiles = $request->file($photoField, []);
|
|
||||||
$newNames = $request->input($nameField, []);
|
|
||||||
$newDescriptions = $descriptionField ? $request->input($descriptionField, []) : [];
|
|
||||||
|
|
||||||
// Process each new file
|
|
||||||
foreach ($newFiles as $key => $file) {
|
|
||||||
// Create new photo entry
|
|
||||||
$newPhotoEntry = [
|
|
||||||
$nameField => $newNames[$key] ?? '', // Use new name if provided
|
|
||||||
$photoField => $this->uploadFile($file, $photoField . '.' . $key)
|
|
||||||
];
|
|
||||||
|
|
||||||
// Add description if field exists
|
|
||||||
if ($descriptionField) {
|
|
||||||
$newPhotoEntry[$descriptionField] = $newDescriptions[$key] ?? '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add to result
|
|
||||||
$result[] = $newPhotoEntry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function generateUniqueFileName($file, $prefix = '')
|
private function generateUniqueFileName($file, $prefix = '')
|
||||||
{
|
{
|
||||||
@@ -838,27 +771,8 @@ class SurveyorController extends Controller
|
|||||||
return $request->validate([
|
return $request->validate([
|
||||||
'permohonan_id' => 'required',
|
'permohonan_id' => 'required',
|
||||||
'dokument_id' => 'required',
|
'dokument_id' => 'required',
|
||||||
'pendamping' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
'nomor_registrasi' => 'required',
|
||||||
'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
|
||||||
'name_objek.*' => 'required|string|max:255',
|
|
||||||
|
|
||||||
'name_lingkungan.*' => 'required|string|max:255',
|
|
||||||
'foto_rute.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
'foto_rute.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||||
'name_rute.*' => 'required|string|max:255',
|
|
||||||
'lantai.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
|
||||||
|
|
||||||
'name_rute_lainnya.*' => 'nullable|string',
|
|
||||||
'foto_rute_lainnya.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
|
||||||
'foto_lantai_lainnya.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
|
||||||
'name_lantai_lainnya.*' => 'nullable|string|max:255',
|
|
||||||
'foto_basement.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
|
||||||
'name_basement.*' => 'nullable|string|max:255',
|
|
||||||
'foto_gerbang' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
|
||||||
'name_gerbang' => 'nullable|string|max:255',
|
|
||||||
|
|
||||||
|
|
||||||
'name_lantai_unit' => 'array',
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1708,6 +1622,7 @@ class SurveyorController extends Controller
|
|||||||
|
|
||||||
$permohonan = $this->getPermohonanJaminanId($id, $dokumentId, $jaminanId);
|
$permohonan = $this->getPermohonanJaminanId($id, $dokumentId, $jaminanId);
|
||||||
|
|
||||||
|
|
||||||
$surveyor = $id;
|
$surveyor = $id;
|
||||||
$branches = Branch::all();
|
$branches = Branch::all();
|
||||||
$provinces = Province::all();
|
$provinces = Province::all();
|
||||||
@@ -2343,7 +2258,8 @@ class SurveyorController extends Controller
|
|||||||
'perkerasanJalan' => PerkerasanJalan::all(),
|
'perkerasanJalan' => PerkerasanJalan::all(),
|
||||||
'terletakDiArea' => TerletakArea::all(),
|
'terletakDiArea' => TerletakArea::all(),
|
||||||
'tujuanPenilaian' => TujuanPenilaian::all(),
|
'tujuanPenilaian' => TujuanPenilaian::all(),
|
||||||
'perizinan' => Perizinan::all()
|
'perizinan' => Perizinan::all(),
|
||||||
|
'foto' => FotoObjekJaminan::all()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
27
resources/views/surveyor/components/data.json
Normal file
27
resources/views/surveyor/components/data.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"rute_menuju_lokasi": [
|
||||||
|
{
|
||||||
|
"name": "Tampak Depan Objek",
|
||||||
|
"description": "terdapat jalan depan rumah",
|
||||||
|
"category": "Tampak Depan Objek",
|
||||||
|
"sub": null,
|
||||||
|
"path": "surveyor/rute_menuju_lokasi/REG0000008/1738724858.png",
|
||||||
|
"created_by": "Administrator",
|
||||||
|
"created_at": "2025-02-05 04:29:33",
|
||||||
|
"updated_by": "Administrator",
|
||||||
|
"updated_at": "2025-02-05 04:31:04"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Tampak Akses Jalan",
|
||||||
|
"description": "ada",
|
||||||
|
"category": "Tampak Samping Kiri",
|
||||||
|
"sub": null,
|
||||||
|
"path": "surveyor/rute_menuju_lokasi/REG0000008/1738730127.png",
|
||||||
|
"created_by": "Administrator",
|
||||||
|
"created_at": "2025-02-05 04:35:27",
|
||||||
|
"updated_by": "Administrator",
|
||||||
|
"updated_at": "2025-02-05 04:38:53"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foto_lantai_unit": []
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,8 @@
|
|||||||
<i class="ki-filled ki-save-2"></i>
|
<i class="ki-filled ki-save-2"></i>
|
||||||
<span id="saveButtonText">Save</span>
|
<span id="saveButtonText">Save</span>
|
||||||
</button>
|
</button>
|
||||||
<a href="{{ route('surveyor.print_out_inspeksi', ['permohonan_id' => $permohonan->id, 'dokument_id' => request('dokument'), 'jenis_jaminan_id' => request('jenis_jaminan')]) }}" class="btn btn-info" id="saveButton">
|
<a href="{{ route('surveyor.print_out_inspeksi', ['permohonan_id' => $permohonan->id, 'dokument_id' => request('dokument'), 'jenis_jaminan_id' => request('jenis_jaminan')]) }}"
|
||||||
|
class="btn btn-info" id="saveButton">
|
||||||
<i class="ki-filled ki-printer"></i>
|
<i class="ki-filled ki-printer"></i>
|
||||||
<span>Print Out</span>
|
<span>Print Out</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -80,9 +81,8 @@
|
|||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script src="https://cdn.jsdelivr.net/npm/signature_pad@4.1.7/dist/signature_pad.umd.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/signature_pad@4.1.7/dist/signature_pad.umd.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
const datas = @json($forminspeksi);
|
||||||
const datas = @json($forminspeksi);
|
console.log(datas);
|
||||||
console.log(datas);
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const signaturePads = {};
|
const signaturePads = {};
|
||||||
@@ -238,10 +238,10 @@ const datas = @json($forminspeksi);
|
|||||||
fetch(`{{ url('/surveyor/signatures/${type}') }}`, {
|
fetch(`{{ url('/surveyor/signatures/${type}') }}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|||||||
@@ -149,6 +149,8 @@
|
|||||||
function jadwal(id) {
|
function jadwal(id) {
|
||||||
document.getElementById('ids').value = id;
|
document.getElementById('ids').value = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function surveyorFreeze(permohonanId, noReg, debitur) {
|
function surveyorFreeze(permohonanId, noReg, debitur) {
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ use Modules\Lpj\Http\Controllers\JenisPenilaianController;
|
|||||||
use Modules\Lpj\Http\Controllers\KJPPController;
|
use Modules\Lpj\Http\Controllers\KJPPController;
|
||||||
use Modules\Lpj\Http\Controllers\LaporanController;
|
use Modules\Lpj\Http\Controllers\LaporanController;
|
||||||
use Modules\Lpj\Http\Controllers\NilaiPlafondController;
|
use Modules\Lpj\Http\Controllers\NilaiPlafondController;
|
||||||
use Modules\Lpj\Http\Controllers\NocController;
|
use Modules\Lpj\Http\Controllers\NocController;
|
||||||
use Modules\Lpj\Http\Controllers\PembatalanController;
|
use Modules\Lpj\Http\Controllers\PembatalanController;
|
||||||
use Modules\Lpj\Http\Controllers\PemilikJaminanController;
|
use Modules\Lpj\Http\Controllers\PemilikJaminanController;
|
||||||
use Modules\Lpj\Http\Controllers\PenilaianController;
|
use Modules\Lpj\Http\Controllers\PenilaianController;
|
||||||
use Modules\Lpj\Http\Controllers\PenilaiController;
|
use Modules\Lpj\Http\Controllers\PenilaiController;
|
||||||
use Modules\Lpj\Http\Controllers\PermohonanController;
|
use Modules\Lpj\Http\Controllers\PermohonanController;
|
||||||
@@ -543,6 +543,7 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::put('storeAproved/{storeAproved}', [SurveyorController::class, 'storeAproved'])->name('storeAproved');
|
Route::put('storeAproved/{storeAproved}', [SurveyorController::class, 'storeAproved'])->name('storeAproved');
|
||||||
Route::post('storeFreeze/{id}', [SurveyorController::class, 'storeFreeze'])->name('storeFreeze');
|
Route::post('storeFreeze/{id}', [SurveyorController::class, 'storeFreeze'])->name('storeFreeze');
|
||||||
Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
|
Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
|
||||||
|
Route::put('updateFoto', [SurveyorController::class, 'updateFoto'])->name('updateFoto');
|
||||||
Route::delete('/surveyor/hapus-foto', [SurveyorController::class, 'hapusFoto'])->name('hapusFoto');
|
Route::delete('/surveyor/hapus-foto', [SurveyorController::class, 'hapusFoto'])->name('hapusFoto');
|
||||||
|
|
||||||
Route::delete('/hapus-lantai', [SurveyorController::class, 'hapusLantai'])->name('hapusLantai');
|
Route::delete('/hapus-lantai', [SurveyorController::class, 'hapusLantai'])->name('hapusLantai');
|
||||||
|
|||||||
Reference in New Issue
Block a user