perabaikan team activity, form inspeksi rap,laporan memo, rap, resume dan penambahan basic data perizinan
This commit is contained in:
@@ -250,8 +250,9 @@ class ActivityController extends Controller
|
||||
])
|
||||
->whereHas('userPenilai', function ($q) use ($id) {
|
||||
$q->where('user_id', $id);
|
||||
})->whereHas('permohonan', function ($q) {
|
||||
$q->where('status', 'assign');
|
||||
})
|
||||
->whereHas('permohonan', function ($q) {
|
||||
$q->whereIn('status', ['assign', 'proses-laporan', 'done']);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ use Illuminate\Support\Facades\App;
|
||||
use App\Helpers\Lpj;
|
||||
use Modules\Lpj\Http\Requests\FormSurveyorRequest;
|
||||
|
||||
|
||||
class PenilaiController extends Controller
|
||||
{
|
||||
public $user;
|
||||
@@ -68,13 +67,7 @@ class PenilaiController extends Controller
|
||||
return view('lpj::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
public function sederhana(Request $request, $id)
|
||||
{
|
||||
@@ -143,46 +136,48 @@ class PenilaiController extends Controller
|
||||
if ($resume) {
|
||||
$resumeData = json_decode($resume->resume, true);
|
||||
}
|
||||
$forminspeksi = null;
|
||||
|
||||
return view('lpj::penilai.components.resume', compact('permohonan', 'resumeData'));
|
||||
if ($inspeksi) {
|
||||
$forminspeksi = json_decode($inspeksi->data_form, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.resume', compact('permohonan', 'resumeData','forminspeksi'));
|
||||
}
|
||||
|
||||
public function memo(Request $request)
|
||||
{
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
$documentId = $request->query('documentId');
|
||||
$inspeksiId = $request->query('inspeksiId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
$req = $this->getRequestQueryId($request);
|
||||
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
$penilai = Penilai::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
$data = $this->getDataPermohonanWithPenilaiAndInspeksi($req['permohonanId'], $req['documentId'], $req['jaminanId']);
|
||||
$permohonan = $data['permohonan'];
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $req['permohonanId'])->where('dokument_id', $req['documentId'])->first();
|
||||
$penilai = Penilai::where('permohonan_id', $req['permohonanId'])->where('dokument_id', $req['documentId'])->firstska();
|
||||
$provinces = Province::all();
|
||||
$basicData = $this->surveyorController->getCommonData();
|
||||
|
||||
$formFoto = $formPeta = $cities = $districts = $villages= $memo = null;
|
||||
$formFoto = $formPeta = $cities = $districts = $villages = $memo = null;
|
||||
if ($inspeksi) {
|
||||
$formFoto = json_decode($inspeksi->foto_form, true);
|
||||
$formPeta = json_decode($inspeksi->data_form, true);
|
||||
if(isset($penilai->memo)) {
|
||||
if (isset($penilai->memo)) {
|
||||
$memo = json_decode($penilai->memo);
|
||||
}
|
||||
if(isset($memo->lokasi->province_code)){
|
||||
if (isset($memo->lokasi->province_code)) {
|
||||
$cities = City::where('province_code', $memo->lokasi->province_code)->get();
|
||||
}
|
||||
|
||||
if(isset($memo->lokasi->city_code)){
|
||||
if (isset($memo->lokasi->city_code)) {
|
||||
$districts = District::where('city_code', $memo->lokasi->city_code)->get();
|
||||
}
|
||||
|
||||
if(isset($memo->lokasi->district_code)) {
|
||||
if (isset($memo->lokasi->district_code)) {
|
||||
$villages = Village::where('district_code', $memo->lokasi->district_code)->get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return view('lpj::penilai.components.memo', compact('permohonan', 'formFoto', 'formPeta', 'provinces', 'basicData','memo','cities', 'districts', 'villages'));
|
||||
return view('lpj::penilai.components.memo', compact('permohonan', 'formFoto', 'formPeta', 'provinces', 'basicData', 'memo', 'cities', 'districts', 'villages'));
|
||||
}
|
||||
|
||||
|
||||
@@ -193,6 +188,7 @@ class PenilaiController extends Controller
|
||||
{
|
||||
$permohonan = Permohonan::with(['debiture.documents.jenisjaminan', 'region.teams.teamsUsers.user', 'penilaian', 'documents.inspeksi'])->find($id);
|
||||
|
||||
|
||||
// return response()->json(['permohonan' => $permohonan]);
|
||||
return view('lpj::penilai.show', compact('permohonan'));
|
||||
}
|
||||
@@ -231,8 +227,26 @@ class PenilaiController extends Controller
|
||||
|
||||
public function rap(Request $request)
|
||||
{
|
||||
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
return view('lpj::penilai.components.paparan');
|
||||
$documentId = $request->query('documentId');
|
||||
$inspeksiId = $request->query('inspeksiId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
$provinces = Province::all();
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
|
||||
|
||||
$resume = Penilai::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
$lpjData = null;
|
||||
$rap = null;
|
||||
$forminspeksi= null;
|
||||
if ($resume) {
|
||||
$forminspeksi = json_decode($inspeksi->data_form, true);
|
||||
$rap = json_decode($resume->rap, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.rap-penilai', compact('permohonan', 'rap', 'provinces','forminspeksi'));
|
||||
}
|
||||
|
||||
|
||||
@@ -480,7 +494,7 @@ class PenilaiController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil menyimpan penilaian'
|
||||
'message' => 'Berhasil Megirim reported ke so'
|
||||
], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@@ -640,6 +654,8 @@ class PenilaiController extends Controller
|
||||
|
||||
public function print_out(Request $request)
|
||||
{
|
||||
|
||||
|
||||
$documentId = $request->query('documentId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
@@ -677,6 +693,7 @@ class PenilaiController extends Controller
|
||||
|
||||
if ($lpj) {
|
||||
$lpjData = json_decode($lpj->lpj, true);
|
||||
$memo = json_decode($lpj->memoe, true);
|
||||
}
|
||||
|
||||
$inputAddress = $forminspeksi['asset']['alamat']['sesuai'] ?? $forminspeksi['asset']['alamat']['tidak sesuai'];
|
||||
@@ -689,36 +706,25 @@ class PenilaiController extends Controller
|
||||
'province_code' => $this->getWilayahName($inputAddress['province_code'] ?? null, 'province')
|
||||
];
|
||||
|
||||
$laporan = $lpj->type == 'sederhana' ? true : false;
|
||||
['sederhana', 'resume'];
|
||||
|
||||
['memo'];
|
||||
['rap'];
|
||||
|
||||
|
||||
// $laporan = $lpj->type == ;
|
||||
|
||||
// $laporanPenilai = $lpj
|
||||
$viewLaporan = null;
|
||||
if ($laporan) {
|
||||
$viewLaporan = 'penilai.components.print-out-sederhana';
|
||||
} else {
|
||||
$viewLaporan = 'penilai.components.print-out-standard';
|
||||
}
|
||||
|
||||
// $viewLaporan = 'penilai.components.print-out-sederhana';
|
||||
// $viewLaporan = 'penilai.components.print-out-standard';
|
||||
// $viewLaporan = 'penilai.components.print-resume';
|
||||
// $viewLaporan = 'penilai.components.print-memo';
|
||||
// $viewLaporan = 'penilai.components.print-rap';
|
||||
try {
|
||||
|
||||
if ($statusLpj) {
|
||||
$pdf= PDF::loadView('lpj::' . $viewLaporan, compact(
|
||||
'permohonan',
|
||||
'forminspeksi',
|
||||
'lpjData',
|
||||
'formFoto',
|
||||
'basicData',
|
||||
'inspeksi',
|
||||
'lpj',
|
||||
'statusLpj',
|
||||
'alamat',
|
||||
'dataPembanding',
|
||||
'nomorLaporan'
|
||||
));
|
||||
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
return $pdf->stream();
|
||||
|
||||
} else {
|
||||
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
|
||||
'permohonan',
|
||||
'forminspeksi',
|
||||
@@ -734,7 +740,28 @@ class PenilaiController extends Controller
|
||||
));
|
||||
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
return $pdf->download('laporan.pdf');
|
||||
return $pdf->stream();
|
||||
|
||||
} else {
|
||||
$pdf = view('lpj::' . $viewLaporan, compact(
|
||||
// $pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
|
||||
'permohonan',
|
||||
'forminspeksi',
|
||||
'lpjData',
|
||||
'formFoto',
|
||||
'basicData',
|
||||
'inspeksi',
|
||||
'lpj',
|
||||
'statusLpj',
|
||||
'alamat',
|
||||
'dataPembanding',
|
||||
'nomorLaporan',
|
||||
'memo'
|
||||
));
|
||||
|
||||
return $pdf;
|
||||
// $pdf->setPaper('A4', 'portrait');
|
||||
// return $pdf->download('laporan.pdf');
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@@ -779,4 +806,26 @@ class PenilaiController extends Controller
|
||||
}
|
||||
|
||||
|
||||
// mengambil data dari fungsi permohonan di surveyor, dan table
|
||||
// penilai, inspeksi
|
||||
private function getDataPermohonanWithPenilaiAndInspeksi($permohonanId, $documentId, $jaminanId)
|
||||
{
|
||||
return [
|
||||
'permohonan' => $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId),
|
||||
'penilai' => Penilai::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first(),
|
||||
'inspeksi' => Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first()
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// pengunaan request query by id permohonan, dokument, jaminan , inspeksi
|
||||
protected function getRequestQueryId(Request $request)
|
||||
{
|
||||
return [
|
||||
'permohonanId' => $request->query('permohonanId'),
|
||||
'documentId' => $request->query('documentId'),
|
||||
'jaminanId' => $request->query('jaminanId'),
|
||||
'inspeksiId' => $request->query('inspeksiId')
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ use Modules\Location\Models\Village;
|
||||
use Modules\Lpj\Models\PosisiKavling;
|
||||
use Modules\Lpj\Models\KondisiFisikTanah;
|
||||
use Modules\Lpj\Models\FotoObjekJaminan;
|
||||
use Modules\Lpj\Models\Perizinan;
|
||||
use Modules\Lpj\Models\KetinggianTanah;
|
||||
use Modules\Lpj\Models\SifatBangunan;
|
||||
use Modules\Lpj\Models\JenisJaminan;
|
||||
@@ -114,7 +115,18 @@ class SurveyorController extends Controller
|
||||
$bentukTanah = BentukTanah::all();
|
||||
|
||||
// Get all inspeksi data for this permohonan
|
||||
$inspeksiData = Inspeksi::where('permohonan_id', $id)
|
||||
if (strtolower($permohonan->tujuanPenilaian->name) == 'rap') {
|
||||
$inspeksiData = Inspeksi::where('permohonan_id', $id)
|
||||
->get()
|
||||
->keyBy('dokument_id')
|
||||
->map(function ($item) {
|
||||
return [
|
||||
'data_form' => json_decode($item->data_form, true),
|
||||
'foto_form' => json_decode($item->foto_form, true)
|
||||
];
|
||||
});
|
||||
} else {
|
||||
$inspeksiData = Inspeksi::where('permohonan_id', $id)
|
||||
->get()
|
||||
->keyBy('dokument_id')
|
||||
->map(function ($item) {
|
||||
@@ -125,7 +137,7 @@ class SurveyorController extends Controller
|
||||
'data_pembanding' => json_decode($item->data_pembanding, true),
|
||||
];
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return view('lpj::surveyor.detail', compact(
|
||||
'permohonan',
|
||||
@@ -192,12 +204,13 @@ class SurveyorController extends Controller
|
||||
'pesawat' => 'getPesawatData',
|
||||
'alat-berat' => 'getAlatBeratData',
|
||||
'lingkungan' => 'getLingkunganData',
|
||||
'fakta' => 'getFactData'
|
||||
'fakta' => 'getFactData',
|
||||
'rap' => 'getRapData',
|
||||
];
|
||||
|
||||
$rules = [];
|
||||
$hasAssetDescriptionRules = false;
|
||||
|
||||
$hasFactaDat = false;
|
||||
$pisah = array_filter(
|
||||
explode(',', $action),
|
||||
function ($act) use ($allowedActions) {
|
||||
@@ -212,15 +225,23 @@ class SurveyorController extends Controller
|
||||
$actionRules = $this->$method($data, $request);
|
||||
$rules = array_merge($rules, $actionRules);
|
||||
|
||||
if (in_array($act, ['apartemen-kantor', 'tanah', 'bangunan'])) {
|
||||
if (in_array($act, ['apartemen-kantor', 'tanah', 'bangunan', 'rap'])) {
|
||||
$hasAssetDescriptionRules = true;
|
||||
}
|
||||
|
||||
if (in_array($act, ['rap'])) {
|
||||
$hasFactaData = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($hasAssetDescriptionRules) {
|
||||
$rules = array_merge($rules, $this->getAssetData($data));
|
||||
}
|
||||
|
||||
if ($hasFactaData) {
|
||||
$rules = array_merge($rules, $this->getFactData($data, $request));
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
@@ -388,73 +409,73 @@ class SurveyorController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a photo
|
||||
* Process a photo
|
||||
*/
|
||||
protected function processFotoLantaiUnit(Request $request, &$formatFotojson)
|
||||
{
|
||||
// Pastikan foto_lantai_unit sudah ada di formatFotojson
|
||||
if (!isset($formatFotojson['foto_lantai_unit'])) {
|
||||
$formatFotojson['foto_lantai_unit'] = [];
|
||||
}
|
||||
|
||||
// Ambil nama-nama lantai dari request
|
||||
$lantaiNama = $request->input('lantai_nama', []);
|
||||
|
||||
// Tambahan: gunakan lantai_index jika tersedia
|
||||
$lantaiIndex = $request->input('lantai_index', null);
|
||||
|
||||
// Cek apakah ada file foto lantai yang diunggah
|
||||
$lantaiFiles = $request->file('foto_lantai_unit', []);
|
||||
|
||||
// Proses setiap file foto lantai
|
||||
foreach ($lantaiFiles as $index => $files) {
|
||||
// Pastikan $files adalah array
|
||||
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
|
||||
if (!isset($formatFotojson['foto_lantai_unit'][$lantaiNomor])) {
|
||||
$formatFotojson['foto_lantai_unit'][$lantaiNomor] = [];
|
||||
}
|
||||
|
||||
foreach ($files as $fileIndex => $file) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
protected function processFotoLantaiUnit(Request $request, &$formatFotojson)
|
||||
{
|
||||
// Pastikan foto_lantai_unit sudah ada di formatFotojson
|
||||
if (!isset($formatFotojson['foto_lantai_unit'])) {
|
||||
$formatFotojson['foto_lantai_unit'] = [];
|
||||
}
|
||||
|
||||
// Ambil nama-nama lantai dari request
|
||||
$lantaiNama = $request->input('lantai_nama', []);
|
||||
|
||||
// Tambahan: gunakan lantai_index jika tersedia
|
||||
$lantaiIndex = $request->input('lantai_index', null);
|
||||
|
||||
// Cek apakah ada file foto lantai yang diunggah
|
||||
$lantaiFiles = $request->file('foto_lantai_unit', []);
|
||||
|
||||
// Proses setiap file foto lantai
|
||||
foreach ($lantaiFiles as $index => $files) {
|
||||
// Pastikan $files adalah array
|
||||
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
|
||||
if (!isset($formatFotojson['foto_lantai_unit'][$lantaiNomor])) {
|
||||
$formatFotojson['foto_lantai_unit'][$lantaiNomor] = [];
|
||||
}
|
||||
|
||||
foreach ($files as $fileIndex => $file) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function handleFileUpload(Request $request, $paramName, &$formatFotojson)
|
||||
{
|
||||
@@ -670,10 +691,10 @@ class SurveyorController extends Controller
|
||||
{
|
||||
$permohonanId = $request->permohonan_id;
|
||||
$dokumentId = $request->dokument_id;
|
||||
|
||||
|
||||
// Normalisasi path foto
|
||||
$cleanRequestPath = str_replace(['storage/', 'surveyor/'], '', $request->foto_path);
|
||||
|
||||
|
||||
$inspeksi = Inspeksi::firstOrNew(
|
||||
['permohonan_id' => $permohonanId, 'dokument_id' => $dokumentId]
|
||||
);
|
||||
@@ -681,7 +702,7 @@ class SurveyorController extends Controller
|
||||
|
||||
// Konversi lantai ke string untuk konsistensi
|
||||
$lantai = (string)$request->lantai;
|
||||
|
||||
|
||||
// Cek apakah lantai ada di array
|
||||
$pat = null;
|
||||
if (isset($fotoLantaiUnit['foto_lantai_unit'][$lantai])) {
|
||||
@@ -691,7 +712,7 @@ class SurveyorController extends Controller
|
||||
function ($foto) use ($cleanRequestPath) {
|
||||
// Normalisasi path foto yang tersimpan
|
||||
$storedPath = str_replace(['storage/', 'surveyor/'], '', $foto['path']);
|
||||
|
||||
|
||||
// Jika path cocok, hapus file dari storage
|
||||
if ($storedPath === $cleanRequestPath) {
|
||||
// Hapus file dari storage dengan berbagai kemungkinan path
|
||||
@@ -701,14 +722,14 @@ class SurveyorController extends Controller
|
||||
'storage/' . $cleanRequestPath,
|
||||
$cleanRequestPath
|
||||
];
|
||||
|
||||
|
||||
foreach ($possiblePaths as $path) {
|
||||
if (Storage::disk('public')->exists($path)) {
|
||||
Storage::disk('public')->delete($path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false; // Hapus dari array
|
||||
}
|
||||
return true;
|
||||
@@ -717,28 +738,28 @@ class SurveyorController extends Controller
|
||||
|
||||
// Reset index array
|
||||
$fotoLantaiUnit['foto_lantai_unit'][$lantai] = array_values($fotoLantaiUnit['foto_lantai_unit'][$lantai]);
|
||||
|
||||
|
||||
// Hapus lantai jika tidak ada foto
|
||||
if (empty($fotoLantaiUnit['foto_lantai_unit'][$lantai])) {
|
||||
unset($fotoLantaiUnit['foto_lantai_unit'][$lantai]);
|
||||
}
|
||||
|
||||
|
||||
// Update inspeksi
|
||||
$inspeksi->foto_form = json_encode($fotoLantaiUnit);
|
||||
$inspeksi->save();
|
||||
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'foto_lantai_unit' => $pat
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'gagal menghapus'
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
private function processPhotoLainnya(Request $request, array $fields, array $existingPhotos = [])
|
||||
{
|
||||
$result = $existingPhotos; // Start with existing photos
|
||||
@@ -869,30 +890,40 @@ class SurveyorController extends Controller
|
||||
return response()->json(['buttonDisable' => true]);
|
||||
}
|
||||
|
||||
$rapComplete = false;
|
||||
foreach ($inspeksiRecords as $inspeksi) {
|
||||
$dataForm = json_decode($inspeksi->data_form, true);
|
||||
$fotoForm = json_decode($inspeksi->foto_form, true);
|
||||
$denahForm = json_decode($inspeksi->denah_form, true);
|
||||
$dataPembanding = json_decode($inspeksi->data_pembanding, true);
|
||||
if (strtolower($inspeksi->name) === 'rap') {
|
||||
$dataForm = json_decode($inspeksi->data_form, true);
|
||||
$fotoForm = json_decode($inspeksi->foto_form, true);
|
||||
$isInvalid = empty($dataForm) &&
|
||||
empty($fotoForm);
|
||||
if ($isInvalid) {
|
||||
return response()->json(['buttonDisable' => true]);
|
||||
}
|
||||
} else {
|
||||
$dataForm = json_decode($inspeksi->data_form, true);
|
||||
$fotoForm = json_decode($inspeksi->foto_form, true);
|
||||
$denahForm = json_decode($inspeksi->denah_form, true);
|
||||
$dataPembanding = json_decode($inspeksi->data_pembanding, true);
|
||||
|
||||
$jenisJaminan = $inspeksi->dokument->jenisJaminan->name ?? '';
|
||||
$jenisJaminan = $inspeksi->dokument->jenisJaminan->name ?? '';
|
||||
|
||||
$isTanahBangunan = !in_array(
|
||||
strtoupper($jenisJaminan->name ?? ''),
|
||||
['KAPAL', 'PESAWAT', 'KENDARAAN', 'ALAT BERAT']
|
||||
);
|
||||
$isTanahBangunan = !in_array(
|
||||
strtoupper($jenisJaminan->name ?? ''),
|
||||
['KAPAL', 'PESAWAT', 'KENDARAAN', 'ALAT BERAT']
|
||||
);
|
||||
|
||||
$isInvalid =
|
||||
empty($dataForm) ||
|
||||
empty($fotoForm) ||
|
||||
(($isTanahBangunan && empty($denahForm)) ||
|
||||
empty($dataPembanding));
|
||||
$isInvalid =
|
||||
empty($dataForm) ||
|
||||
empty($fotoForm) ||
|
||||
(($isTanahBangunan && empty($denahForm)) ||
|
||||
empty($dataPembanding));
|
||||
|
||||
if ($isInvalid) {
|
||||
return response()->json(['buttonDisable' => true]);
|
||||
if ($isInvalid) {
|
||||
return response()->json(['buttonDisable' => true]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, all checks passed
|
||||
return response()->json(['buttonDisable' => false]);
|
||||
|
||||
@@ -1880,6 +1911,7 @@ class SurveyorController extends Controller
|
||||
'Merupakan Daerah' => MerupakanDaerah::class,
|
||||
'Jenis unit' => JenisUnit::class,
|
||||
'Foto Objek Jaminan' => FotoObjekJaminan::class,
|
||||
'Perizinan' => Perizinan::class,
|
||||
];
|
||||
|
||||
|
||||
@@ -2023,7 +2055,8 @@ class SurveyorController extends Controller
|
||||
'merupakan-daerah' => MerupakanDaerah::class,
|
||||
'jenis-unit' => JenisUnit::class,
|
||||
'perkerasan-jalan' => PerkerasanJalan::class,
|
||||
'foto-objek-jaminan' => FotoObjekJaminan::class
|
||||
'foto-objek-jaminan' => FotoObjekJaminan::class,
|
||||
'perizinan' => Perizinan::class
|
||||
];
|
||||
|
||||
|
||||
@@ -2065,12 +2098,11 @@ class SurveyorController extends Controller
|
||||
'hubPenghuni' => HubunganPenghuniJaminan::all(),
|
||||
'perkerasanJalan' => PerkerasanJalan::all(),
|
||||
'terletakDiArea' => TerletakArea::all(),
|
||||
'tujuanPenilaian' => TujuanPenilaian::all()
|
||||
'tujuanPenilaian' => TujuanPenilaian::all(),
|
||||
'perizinan' => Perizinan::all()
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
private const HEADERS = [
|
||||
'bentuk-tanah' => ['Bentuk Tanah', 'bentuk-tanah'],
|
||||
'kontur-tanah' => ['Kontur Tanah', 'kontur-tanah'],
|
||||
@@ -2100,6 +2132,7 @@ class SurveyorController extends Controller
|
||||
'bentuk-unit' => ['Bentuk unit', 'bentuk-unit'],
|
||||
'fasilitas-objek' => ['Fasilitas Umum Dekat Objek', 'fasilitas-objek'],
|
||||
'foto-objek-jaminan' => ['Foto Objek Jaminan', 'foto-objek-jaminan'],
|
||||
'perizinan' => ['Perizinan', 'perizinan'],
|
||||
];
|
||||
|
||||
private function getAssetData(array $data): array
|
||||
@@ -2338,6 +2371,39 @@ class SurveyorController extends Controller
|
||||
return $factData;
|
||||
}
|
||||
|
||||
private function getRapData($data, $request): array
|
||||
{
|
||||
$rapData = [
|
||||
'perizinan' => $data['perizinan'] ?? null,
|
||||
'perizinan_file' => $data['perizinan_file'] ?? null,
|
||||
'brosur_price_list' => $data['brosur_price_list'] ?? null,
|
||||
'brosur_price_file' => $data['brosur_price_file'] ?? null,
|
||||
'pengalaman_developer' => $data['pengalaman_developer'] ?? null,
|
||||
'developer_anggota' => $data['developer_anggota'] ?? null,
|
||||
'lainnya_developer' => $data['lainnya_developer'] ?? null,
|
||||
'kapan_mulai_dibangun' => $data['kapan_mulai_dibangun'] ?? null,
|
||||
'kondisi_perumahan' => $data['kondisi_perumahan'] ?? null,
|
||||
'progres_pembangunan' => $data['progres_pembangunan'] ?? null,
|
||||
'kontraktor' => $data['kontraktor'] ?? null,
|
||||
'lingkungan_sekitar' => $data['lingkungan_sekitar'] ?? null,
|
||||
'komplek_disekitar' => $data['komplek_disekitar'] ?? null,
|
||||
'pusat_keramaian' => $data['pusat_keramaian'] ?? null,
|
||||
'transportasi_umum' => $data['transportasi_umum'] ?? null,
|
||||
'lainnya_kondisi' => $data['lainnya_kondisi'] ?? null,
|
||||
'partisi' => $data['partisi'] ?? null,
|
||||
'jumlah_unit' => $data['jumlah_unit'] ?? null,
|
||||
'batas_batas_perumahan' => $data['batas_batas_perumahan'] ?? null,
|
||||
'fasus_fasum' => $data['fasus_fasum'] ?? null,
|
||||
'progres_penjualan' => $data['progres_penjualan'] ?? null,
|
||||
'harga_unit' => $data['harga_unit'] ?? null,
|
||||
'target_market' => $data['target_market'] ?? null,
|
||||
'kerjasama_dengan_bank' => $data['kerjasama_dengan_bank'] ?? null,
|
||||
'rute_menuju_lokasi' => $data['rute_menuju_lokasi'] ?? null,
|
||||
];
|
||||
|
||||
return $rapData;
|
||||
}
|
||||
|
||||
private function updateOrDeleteFile($data, $request, $fileKey)
|
||||
{
|
||||
if ($request->hasFile($fileKey)) {
|
||||
|
||||
Reference in New Issue
Block a user