Merge remote-tracking branch 'composer/feature/senior-officer' into staging
This commit is contained in:
@@ -102,6 +102,7 @@ class SurveyorController extends Controller
|
|||||||
'tujuanPenilaian',
|
'tujuanPenilaian',
|
||||||
'penilaian',
|
'penilaian',
|
||||||
'documents.jenisJaminan',
|
'documents.jenisJaminan',
|
||||||
|
'documents',
|
||||||
])->findOrFail($id);
|
])->findOrFail($id);
|
||||||
|
|
||||||
$surveyor = $id;
|
$surveyor = $id;
|
||||||
@@ -112,7 +113,7 @@ class SurveyorController extends Controller
|
|||||||
// Get all inspeksi data for this permohonan
|
// Get all inspeksi data for this permohonan
|
||||||
$inspeksiData = Inspeksi::where('permohonan_id', $id)
|
$inspeksiData = Inspeksi::where('permohonan_id', $id)
|
||||||
->get()
|
->get()
|
||||||
->keyBy('jenis_jaminan_id')
|
->keyBy('dokument_id')
|
||||||
->map(function ($item) {
|
->map(function ($item) {
|
||||||
return [
|
return [
|
||||||
'data_form' => json_decode($item->data_form, true),
|
'data_form' => json_decode($item->data_form, true),
|
||||||
@@ -153,7 +154,7 @@ class SurveyorController extends Controller
|
|||||||
$inspeksi = Inspeksi::updateOrCreate(
|
$inspeksi = Inspeksi::updateOrCreate(
|
||||||
[
|
[
|
||||||
'permohonan_id' => $request->input('permohonan_id'),
|
'permohonan_id' => $request->input('permohonan_id'),
|
||||||
'jenis_jaminan_id' => $request->input('jenis_jaminan_id')
|
'dokument_id' => $request->input('dokument_id')
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'data_form' => json_encode($processedData),
|
'data_form' => json_encode($processedData),
|
||||||
@@ -164,6 +165,7 @@ class SurveyorController extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'message' => 'Data berhasil disimpan',
|
'message' => 'Data berhasil disimpan',
|
||||||
|
'data' => $processedData
|
||||||
], 200);
|
], 200);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -227,7 +229,7 @@ class SurveyorController extends Controller
|
|||||||
$validationRules = [
|
$validationRules = [
|
||||||
'luas' => 'required|numeric',
|
'luas' => 'required|numeric',
|
||||||
'permohonan_id' => 'required',
|
'permohonan_id' => 'required',
|
||||||
'jenis_jaminan_id' => 'required'
|
'dokument_id' => 'required'
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($request->hasFile('foto_denah')) {
|
if ($request->hasFile('foto_denah')) {
|
||||||
@@ -247,7 +249,7 @@ class SurveyorController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
|
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
|
||||||
->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))
|
->where('dokument_id', $request->input('dokument_id'))
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($inspeksi) {
|
if ($inspeksi) {
|
||||||
@@ -261,7 +263,7 @@ class SurveyorController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
Inspeksi::create([
|
Inspeksi::create([
|
||||||
'permohonan_id' => $request->input('permohonan_id'),
|
'permohonan_id' => $request->input('permohonan_id'),
|
||||||
'jenis_jaminan_id' => $request->input('jenis_jaminan_id'),
|
'dokument_id' => $request->input('dokument_id'),
|
||||||
'denah_form' => json_encode($formatJsonDenah)
|
'denah_form' => json_encode($formatJsonDenah)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -293,7 +295,7 @@ class SurveyorController extends Controller
|
|||||||
|
|
||||||
$inspeksi = Inspeksi::firstOrNew([
|
$inspeksi = Inspeksi::firstOrNew([
|
||||||
'permohonan_id' => $request->input('permohonan_id'),
|
'permohonan_id' => $request->input('permohonan_id'),
|
||||||
'jenis_jaminan_id' => $request->input('jenis_jaminan_id')
|
'dokument_id' => $request->input('dokument_id')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Get existing foto_form data if it exists
|
// Get existing foto_form data if it exists
|
||||||
@@ -398,24 +400,24 @@ class SurveyorController extends Controller
|
|||||||
$maxSize = getMaxFileSize('Foto');
|
$maxSize = getMaxFileSize('Foto');
|
||||||
return $request->validate([
|
return $request->validate([
|
||||||
'permohonan_id' => 'required',
|
'permohonan_id' => 'required',
|
||||||
'jenis_jaminan_id' => 'required',
|
'dokument_id' => 'required',
|
||||||
'pendamping' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:'. $maxSize,
|
'pendamping' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||||
'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:'. $maxSize,
|
'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||||
'name_objek.*' => 'required|string|max:255',
|
'name_objek.*' => 'required|string|max:255',
|
||||||
'foto_lingkungan.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:'. $maxSize,
|
'foto_lingkungan.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||||
'name_lingkungan.*' => 'required|string|max:255',
|
'name_lingkungan.*' => 'required|string|max:255',
|
||||||
'foto_rute.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|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',
|
'name_rute.*' => 'required|string|max:255',
|
||||||
'lantai.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:'. $maxSize,
|
'lantai.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||||
'name_lantai_unit.*' => 'nullable|string|max:255',
|
'name_lantai_unit.*' => 'nullable|string|max:255',
|
||||||
'foto_lantai_unit.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:'. $maxSize,
|
'foto_lantai_unit.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||||
'name_rute_lainnya.*' => 'nullable|string',
|
'name_rute_lainnya.*' => 'nullable|string',
|
||||||
'foto_rute_lainnya.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:'. $maxSize,
|
'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|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',
|
'name_lantai_lainnya.*' => 'nullable|string|max:255',
|
||||||
'foto_basement.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:'. $maxSize,
|
'foto_basement.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||||
'name_basement.*' => 'nullable|string|max:255',
|
'name_basement.*' => 'nullable|string|max:255',
|
||||||
'foto_gerbang' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:'. $maxSize,
|
'foto_gerbang' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||||
'name_gerbang' => 'nullable|string|max:255',
|
'name_gerbang' => 'nullable|string|max:255',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -585,9 +587,9 @@ class SurveyorController extends Controller
|
|||||||
$fotoPembanding = $request->file('foto_objek_pembanding') ?? [];
|
$fotoPembanding = $request->file('foto_objek_pembanding') ?? [];
|
||||||
|
|
||||||
$existingData = null;
|
$existingData = null;
|
||||||
if ($request->has('permohonan_id') && $request->has('jenis_jaminan_id')) {
|
if ($request->has('permohonan_id') && $request->has('dokument_id')) {
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
|
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
|
||||||
->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))
|
->where('dokument_id', $request->input('dokument_id'))
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($inspeksi) {
|
if ($inspeksi) {
|
||||||
@@ -682,7 +684,7 @@ class SurveyorController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
|
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
|
||||||
->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))
|
->where('dokument_id', $request->input('dokument_id'))
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($inspeksi) {
|
if ($inspeksi) {
|
||||||
@@ -809,7 +811,7 @@ class SurveyorController extends Controller
|
|||||||
$inspeksi = Inspeksi::updateOrCreate(
|
$inspeksi = Inspeksi::updateOrCreate(
|
||||||
[
|
[
|
||||||
'permohonan_id' => $formattedData['permohonan_id'],
|
'permohonan_id' => $formattedData['permohonan_id'],
|
||||||
'jenis_jaminan_id' => $formattedData['jenis_jaminan_id']
|
'dokument_id' => $formattedData['dokument_id']
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'data_pembanding' => json_encode($formattedData),
|
'data_pembanding' => json_encode($formattedData),
|
||||||
@@ -828,7 +830,7 @@ class SurveyorController extends Controller
|
|||||||
$validator = $request->validate([
|
$validator = $request->validate([
|
||||||
'permohonan_id' => 'required|exists:permohonan,id',
|
'permohonan_id' => 'required|exists:permohonan,id',
|
||||||
'type' => 'required|string',
|
'type' => 'required|string',
|
||||||
'jenis_jaminan_id' => 'required',
|
'dokument_id' => 'required',
|
||||||
'foto_objek' => 'nullable|image|max:'.$maxSize,
|
'foto_objek' => 'nullable|image|max:'.$maxSize,
|
||||||
'foto_objek_pembanding.*' => 'nullable|image|max:'.$maxSize,
|
'foto_objek_pembanding.*' => 'nullable|image|max:'.$maxSize,
|
||||||
]);
|
]);
|
||||||
@@ -843,7 +845,7 @@ class SurveyorController extends Controller
|
|||||||
|
|
||||||
// Update foto_form
|
// Update foto_form
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
|
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
|
||||||
->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))
|
->where('dokument_id', $request->input('dokument_id'))
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($inspeksi) {
|
if ($inspeksi) {
|
||||||
@@ -868,7 +870,7 @@ class SurveyorController extends Controller
|
|||||||
$formattedData = [
|
$formattedData = [
|
||||||
'permohonan_id' => $request->input('permohonan_id'),
|
'permohonan_id' => $request->input('permohonan_id'),
|
||||||
'type' => $request->input('type'),
|
'type' => $request->input('type'),
|
||||||
'jenis_jaminan_id' => $request->input('jenis_jaminan_id'),
|
'dokument_id' => $request->input('dokument_id'),
|
||||||
'objek_penilaian' => $objekPenilaian,
|
'objek_penilaian' => $objekPenilaian,
|
||||||
'data_pembanding' => $this->formatDataPembanding($request)
|
'data_pembanding' => $this->formatDataPembanding($request)
|
||||||
];
|
];
|
||||||
@@ -899,9 +901,21 @@ class SurveyorController extends Controller
|
|||||||
* Form inspeksi.
|
* Form inspeksi.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function formInspeksi($id, $jaminanId)
|
public function formInspeksi(Request $request, $id)
|
||||||
{
|
{
|
||||||
$permohonan = $this->getPermohonanJaminanId($id, $jaminanId);
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'form' => 'required|in:create-inspeksi',
|
||||||
|
'inspeksi' => 'required|exists:permohonan,id',
|
||||||
|
'dokument' => 'required',
|
||||||
|
'jenisjaminan' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$dokumentId = $validated['dokument'];
|
||||||
|
$jaminanId = $validated['jenisjaminan'];
|
||||||
|
|
||||||
|
$permohonan = $this->getPermohonanJaminanId($id, $dokumentId, $jaminanId);
|
||||||
|
|
||||||
$link_url_region = Teams::with('regions', 'teamsUsers')
|
$link_url_region = Teams::with('regions', 'teamsUsers')
|
||||||
->whereHas('teamsUsers', function ($query) {
|
->whereHas('teamsUsers', function ($query) {
|
||||||
$query->where('user_id', Auth::user()->id);
|
$query->where('user_id', Auth::user()->id);
|
||||||
@@ -915,7 +929,7 @@ class SurveyorController extends Controller
|
|||||||
$surveyor = $id;
|
$surveyor = $id;
|
||||||
$basicData = $this->getCommonData();
|
$basicData = $this->getCommonData();
|
||||||
|
|
||||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $dokumentId)->first();
|
||||||
$forminspeksi = null;
|
$forminspeksi = null;
|
||||||
if ($inpeksi) {
|
if ($inpeksi) {
|
||||||
$forminspeksi = json_decode($inpeksi->data_form, true);
|
$forminspeksi = json_decode($inpeksi->data_form, true);
|
||||||
@@ -962,13 +976,23 @@ class SurveyorController extends Controller
|
|||||||
* Denah.
|
* Denah.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function denah($id, $jaminanId)
|
public function denah(Request $request, $id)
|
||||||
{
|
{
|
||||||
$permohonan = $this->getPermohonanJaminanId($id, $jaminanId);
|
$validated = $request->validate([
|
||||||
|
'form' => 'required|in:create-denah',
|
||||||
|
'denah' => 'required|exists:permohonan,id',
|
||||||
|
'dokument' => 'required',
|
||||||
|
'jenisjaminan' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$dokumentId = $validated['dokument'];
|
||||||
|
$jaminanId = $validated['jenisjaminan'];
|
||||||
|
|
||||||
|
$permohonan = $this->getPermohonanJaminanId($id, $dokumentId, $jaminanId);
|
||||||
|
|
||||||
$denah = null;
|
$denah = null;
|
||||||
|
|
||||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $dokumentId)->first();
|
||||||
$formDenah = null;
|
$formDenah = null;
|
||||||
if ($inpeksi) {
|
if ($inpeksi) {
|
||||||
$formDenah = json_decode($inpeksi->denah_form, true);
|
$formDenah = json_decode($inpeksi->denah_form, true);
|
||||||
@@ -982,14 +1006,25 @@ class SurveyorController extends Controller
|
|||||||
* Foto.
|
* Foto.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function foto($id, $jaminanId)
|
public function foto(Request $request, $id)
|
||||||
{
|
{
|
||||||
$permohonan = $this->getPermohonanJaminanId($id, $jaminanId);
|
$validated = $request->validate([
|
||||||
|
'form' => 'required|in:create-foto',
|
||||||
|
'foto' => 'required|exists:permohonan,id',
|
||||||
|
'dokument' => 'required',
|
||||||
|
'jenisjaminan' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$dokumentId = $validated['dokument'];
|
||||||
|
$jaminanId = $validated['jenisjaminan'];
|
||||||
|
|
||||||
|
$permohonan = $this->getPermohonanJaminanId($id, $dokumentId, $jaminanId);
|
||||||
|
|
||||||
$surveyor = $id;
|
$surveyor = $id;
|
||||||
$branches = Branch::all();
|
$branches = Branch::all();
|
||||||
$provinces = Province::all();
|
$provinces = Province::all();
|
||||||
|
|
||||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $dokumentId)->first();
|
||||||
|
|
||||||
$formFoto = null;
|
$formFoto = null;
|
||||||
if ($inpeksi) {
|
if ($inpeksi) {
|
||||||
@@ -1003,25 +1038,28 @@ class SurveyorController extends Controller
|
|||||||
* Data pembanding.
|
* Data pembanding.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function dataPembanding($id, $jaminanId)
|
public function dataPembanding(Request $request, $id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// Ambil data permohonan dengan eager loading
|
// Ambil data permohonan dengan eager loading
|
||||||
$permohonan = Permohonan::with([
|
|
||||||
'user',
|
$validated = $request->validate([
|
||||||
'debiture.province',
|
'form' => 'required|in:data-pembanding',
|
||||||
'debiture.city',
|
'pembanding' => 'required|exists:permohonan,id',
|
||||||
'debiture.district',
|
'dokument' => 'required',
|
||||||
'debiture.village',
|
'jenisjaminan' => 'required'
|
||||||
'branch',
|
]);
|
||||||
'tujuanPenilaian',
|
|
||||||
'penilaian'
|
$dokumentId = $validated['dokument'];
|
||||||
])->findOrFail($id);
|
$jaminanId = $validated['jenisjaminan'];
|
||||||
|
|
||||||
|
$permohonan = $this->getPermohonanJaminanId($id, $dokumentId, $jaminanId);
|
||||||
|
|
||||||
|
|
||||||
// Ambil data inspeksi
|
// Ambil data inspeksi
|
||||||
$inspeksi = Inspeksi::where([
|
$inspeksi = Inspeksi::where([
|
||||||
'permohonan_id' => $id,
|
'permohonan_id' => $id,
|
||||||
'jenis_jaminan_id' => $jaminanId
|
'dokument_id' => $dokumentId
|
||||||
])->first();
|
])->first();
|
||||||
|
|
||||||
// Inisialisasi variabel
|
// Inisialisasi variabel
|
||||||
@@ -1496,7 +1534,7 @@ class SurveyorController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function getPermohonanJaminanId($id, $jaminanId)
|
public function getPermohonanJaminanId($id, $dokumentId, $jaminanId)
|
||||||
{
|
{
|
||||||
return Permohonan::with([
|
return Permohonan::with([
|
||||||
'user',
|
'user',
|
||||||
@@ -1507,15 +1545,11 @@ class SurveyorController extends Controller
|
|||||||
'branch',
|
'branch',
|
||||||
'tujuanPenilaian',
|
'tujuanPenilaian',
|
||||||
'penilaian',
|
'penilaian',
|
||||||
'debiture.documents.jenisJaminan',
|
'debiture.documents' => function ($query) use ($dokumentId, $jaminanId) {
|
||||||
'debiture.documents' => function ($query) use ($jaminanId) {
|
$query->where('id', $dokumentId)
|
||||||
$query->where('jenis_jaminan_id', $jaminanId);
|
->where('jenis_jaminan_id', $jaminanId);
|
||||||
}
|
}
|
||||||
])
|
])->findOrFail($id);
|
||||||
->whereHas('debiture.documents', function ($query) use ($jaminanId) {
|
|
||||||
$query->where('jenis_jaminan_id', $jaminanId);
|
|
||||||
})
|
|
||||||
->findOrFail($id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1763,10 +1797,8 @@ class SurveyorController extends Controller
|
|||||||
'sifat_bangunan' => $data['sifat_bangunan'] ?? null,
|
'sifat_bangunan' => $data['sifat_bangunan'] ?? null,
|
||||||
'sifat_bangunan_input' => $data['sifat_bangunan_input'] ?? null,
|
'sifat_bangunan_input' => $data['sifat_bangunan_input'] ?? null,
|
||||||
'spesifikasi_bangunan' => $result ?? null,
|
'spesifikasi_bangunan' => $result ?? null,
|
||||||
'sarana_pelengkap' => $this->mapArrayWithInputs(
|
'sarana_pelengkap' => $data['sarana_pelengkap'] ?? null,
|
||||||
$data['sarana_pelengkap'] ?? [],
|
'sarana_pelengkap_input' => $data['sarana_pelengkap_input'] ?? null,
|
||||||
$data['sarana_pelengkap_input'] ?? []
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1808,10 +1840,8 @@ class SurveyorController extends Controller
|
|||||||
'jarak_tps' => $data['jarak_tps'] ?? null,
|
'jarak_tps' => $data['jarak_tps'] ?? null,
|
||||||
'nama_tps' => $data['nama_tps'] ?? null,
|
'nama_tps' => $data['nama_tps'] ?? null,
|
||||||
'merupakan_daerah' => $data['merupakan_daerah'] ?? null,
|
'merupakan_daerah' => $data['merupakan_daerah'] ?? null,
|
||||||
'fasilitas_dekat_object' => $this->mapArrayWithInputs(
|
'fasilitas_dekat_object' => $data['fasilitas_dekat_object'] ?? null,
|
||||||
$data['fasilitas_dekat_object'] ?? [],
|
'fasilitas_dekat_object_input' => $data['fasilitas_dekat_object_input'] ?? null,
|
||||||
$data['fasilitas_dekat_object_input'] ?? []
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1823,10 +1853,8 @@ class SurveyorController extends Controller
|
|||||||
'fakta_positif' => $data['fakta_positif'] ?? null,
|
'fakta_positif' => $data['fakta_positif'] ?? null,
|
||||||
'fakta_negatif' => $data['fakta_negatif'] ?? null,
|
'fakta_negatif' => $data['fakta_negatif'] ?? null,
|
||||||
'rute_menuju' => $data['rute_menuju'] ?? null,
|
'rute_menuju' => $data['rute_menuju'] ?? null,
|
||||||
'batas_batas' => $this->mapArrayWithInputs(
|
'batas_batas' => $data['batas_batas'] ?? null,
|
||||||
$data['batas_batas'] ?? [],
|
'batas_batas_input' => $data['batas_batas_input'] ?? null,
|
||||||
$data['batas_batas_input'] ?? []
|
|
||||||
),
|
|
||||||
'kondisi_lingkungan' => $data['kondisi_lingkungan'] ?? null,
|
'kondisi_lingkungan' => $data['kondisi_lingkungan'] ?? null,
|
||||||
'kondisi_lain_bangunan' => $data['kondisi_lain_bangunan'] ?? null,
|
'kondisi_lain_bangunan' => $data['kondisi_lain_bangunan'] ?? null,
|
||||||
'informasi_dokument' => $data['informasi_dokument'] ?? null,
|
'informasi_dokument' => $data['informasi_dokument'] ?? null,
|
||||||
@@ -1844,7 +1872,7 @@ class SurveyorController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))->first();
|
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('dokument_id', $request->input('dokument_id'))->first();
|
||||||
|
|
||||||
|
|
||||||
$fotoTypes = [
|
$fotoTypes = [
|
||||||
@@ -2306,8 +2334,10 @@ class SurveyorController extends Controller
|
|||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
foreach ($keys as $index => $key) {
|
foreach ($keys as $key) {
|
||||||
$result[$key] = $values[$index] ?? null;
|
// Jika checkbox dicentang, ambil nilai input yang sesuai
|
||||||
|
// Gunakan nilai dari $values berdasarkan nama checkbox
|
||||||
|
$result[$key] = $values[$key] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -2315,6 +2345,7 @@ class SurveyorController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method generic untuk mengambil data field
|
* Helper method generic untuk mengambil data field
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -258,33 +258,21 @@
|
|||||||
|
|
||||||
<!-- Sarana pelengkap -->
|
<!-- Sarana pelengkap -->
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label class="form-label max-w-56">Sarana pelengkap</label>
|
<label class="form-label max-w-56">Sarana Pelengkap</label>
|
||||||
<div class="flex-wrap items-stretch">
|
<div class="flex-wrap items-stretch">
|
||||||
<div class="flex flex-col items-start gap-4">
|
<div class="flex flex-col items-start gap-4">
|
||||||
@if (isset($basicData['saranaPelengkap']))
|
@if (isset($basicData['saranaPelengkap']))
|
||||||
@foreach ($basicData['saranaPelengkap'] as $item)
|
@foreach ($basicData['saranaPelengkap'] as $item)
|
||||||
@php
|
|
||||||
$isChecked = false;
|
|
||||||
$inputValue = '';
|
|
||||||
|
|
||||||
if (isset($forminspeksi['bangunan']['sarana_pelengkap'])) {
|
|
||||||
foreach ($forminspeksi['bangunan']['sarana_pelengkap'] as $key => $value) {
|
|
||||||
if ($key === $item->name) {
|
|
||||||
$isChecked = true;
|
|
||||||
$inputValue = $value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@endphp
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
||||||
<input class="checkbox" name="sarana_pelengkap[]" type="checkbox"
|
<input class="checkbox" name="sarana_pelengkap[]" type="checkbox"
|
||||||
value="{{ $item->name }}" {{ $isChecked ? 'checked' : '' }} />
|
value="{{ $item->name }}"
|
||||||
|
{{ in_array($item->name, old('sarana_pelengkap', $forminspeksi['bangunan']['sarana_pelengkap'] ?? [])) ? 'checked' : '' }} />
|
||||||
{{ $item->name }}
|
{{ $item->name }}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="sarana_pelengkap_input[]" class="input w-full"
|
<input type="text" name="sarana_pelengkap_input[]" class="input w-full"
|
||||||
placeholder="Masukkan {{ $item->name }}..." value="{{ $inputValue }}">
|
placeholder="Masukkan {{ $item->name }}..."
|
||||||
|
value="{{ old('sarana_pelengkap_input.' . $loop->index, $forminspeksi['bangunan']['sarana_pelengkap_input'][$loop->index] ?? '') }}">
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@@ -293,6 +281,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -77,24 +77,20 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label class="form-label max-w-56">Batas batas</label>
|
<label class="form-label max-w-56">Batas Batas</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<div class="grid grid-cols-1 gap-4 items-center w-full">
|
<div class="grid grid-cols-1 gap-4 items-center w-full">
|
||||||
@if (isset($basicData['arahMataAngin']))
|
@if (isset($basicData['arahMataAngin']))
|
||||||
@foreach ($basicData['arahMataAngin'] as $item)
|
@foreach ($basicData['arahMataAngin'] as $item)
|
||||||
@php
|
@php
|
||||||
$isChecked = false;
|
$isChecked = in_array(
|
||||||
$inputValue = '';
|
$item->name,
|
||||||
|
old('batas_batas', $forminspeksi['fakta']['batas_batas'] ?? []),
|
||||||
if (isset($forminspeksi['fakta']['batas_batas'])) {
|
);
|
||||||
foreach ($forminspeksi['fakta']['batas_batas'] as $key => $value) {
|
$inputValue = old(
|
||||||
if ($key === $item->name) {
|
'batas_batas_input.' . $item->name,
|
||||||
$isChecked = true;
|
$forminspeksi['fakta']['batas_batas_input'][$item->name] ?? '',
|
||||||
$inputValue = $value;
|
);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@endphp
|
@endphp
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
||||||
@@ -102,8 +98,8 @@
|
|||||||
value="{{ $item->name }}" {{ $isChecked ? 'checked' : '' }} />
|
value="{{ $item->name }}" {{ $isChecked ? 'checked' : '' }} />
|
||||||
{{ $item->name }}
|
{{ $item->name }}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="batas_batas_input[]" class="input w-full"
|
<input type="text" name="batas_batas_input[{{ $item->name }}]"
|
||||||
placeholder="Masukkan Batas {{ $item->name }}..."
|
class="input w-full" placeholder="Masukkan Batas {{ $item->name }}..."
|
||||||
value="{{ $inputValue }}">
|
value="{{ $inputValue }}">
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
@@ -369,35 +369,27 @@
|
|||||||
@if (isset($basicData['fasilitasObjek']))
|
@if (isset($basicData['fasilitasObjek']))
|
||||||
@foreach ($basicData['fasilitasObjek'] as $item)
|
@foreach ($basicData['fasilitasObjek'] as $item)
|
||||||
@php
|
@php
|
||||||
$isChecked = false;
|
$isChecked = in_array(
|
||||||
$inputValue = '';
|
$item->name,
|
||||||
|
old(
|
||||||
// Cek old input terlebih dahulu
|
'fasilitas_dekat_object',
|
||||||
if (old('fasilitas_dekat_object') && in_array($item->name, old('fasilitas_dekat_object'))) {
|
$forminspeksi['lingkungan']['fasilitas_dekat_object'] ?? [],
|
||||||
$isChecked = true;
|
),
|
||||||
$oldInputIndex = array_search($item->name, old('fasilitas_dekat_object'));
|
);
|
||||||
$inputValue = old('fasilitas_dekat_object_input')[$oldInputIndex] ?? '';
|
$inputValue = old(
|
||||||
}
|
'fasilitas_dekat_object_input.' . $item->name,
|
||||||
elseif (isset($forminspeksi['lingkungan']['fasilitas_dekat_object'])) {
|
$forminspeksi['lingkungan']['fasilitas_dekat_object_input'][$item->name] ?? '',
|
||||||
foreach ($forminspeksi['lingkungan']['fasilitas_dekat_object'] as $key => $value) {
|
);
|
||||||
if ($key === $item->name) {
|
|
||||||
$isChecked = true;
|
|
||||||
$inputValue = $value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
||||||
<input class="checkbox" name="fasilitas_dekat_object[]" type="checkbox"
|
<input class="checkbox" name="fasilitas_dekat_object[]" type="checkbox"
|
||||||
value="{{ $item->name }}"
|
value="{{ $item->name }}" {{ $isChecked ? 'checked' : '' }} />
|
||||||
{{ $isChecked ? 'checked' : '' }} />
|
|
||||||
{{ $item->name }}
|
{{ $item->name }}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="fasilitas_dekat_object_input[]" class="input w-full"
|
<input type="text" name="fasilitas_dekat_object_input[{{ $item->name }}]"
|
||||||
placeholder="Masukkan fasilitas {{ $item->name }}..."
|
class="input w-full" placeholder="Masukkan fasilitas {{ $item->name }}..."
|
||||||
value="{{ $inputValue }}">
|
value="{{ $inputValue }}">
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
Reference in New Issue
Block a user