diff --git a/app/Http/Controllers/DokumenJaminanController.php b/app/Http/Controllers/DokumenJaminanController.php index 78a11c2..f272eaa 100644 --- a/app/Http/Controllers/DokumenJaminanController.php +++ b/app/Http/Controllers/DokumenJaminanController.php @@ -14,6 +14,7 @@ use Modules\Location\Models\Province; use Modules\Location\Models\Village; use Modules\Lpj\Http\Requests\DokumenJaminanRequest; + use Modules\Lpj\Models\customField; use Modules\Lpj\Models\Debiture; use Modules\Lpj\Models\DetailDokumenJaminan; use Modules\Lpj\Models\DokumenJaminan; @@ -88,7 +89,7 @@ 'jenis_legalitas_jaminan_id' => $value, 'name' => $request->name[$key], 'keterangan' => $request->keterangan[$key], - 'details' => isset($request->custom_field[$key]) ? json_encode($request->custom_field[$key]) : '' + 'details' => isset($request->custom_field[$value]) ? json_encode($request->custom_field[$value]) : '' ]; $dokumenJaminan = []; @@ -247,7 +248,7 @@ 'jenis_legalitas_jaminan_id' => $value, 'name' => $request->name[$key], 'keterangan' => $request->keterangan[$key], - 'details' => isset($request->custom_field[$key]) ? json_encode($request->custom_field[$key]) : '' + 'details' => isset($request->custom_field[$value]) ? json_encode($request->custom_field[$value]) : '' ]; $dokumenJaminan = []; @@ -496,6 +497,12 @@ foreach ($document->detail as $detail) { // Only include existing legalitas if its id is in the new set if (in_array($detail->jenis_legalitas_jaminan_id, $newLegalitasIds)) { + $customFields = []; + if($detail->jenisLegalitasJaminan->custom_fields) { + $customFields = CustomField::whereIn('id', $detail->jenisLegalitasJaminan->custom_fields) + ->get(); + } + $existingLegalitas[] = [ 'id' => $detail->id, 'jenis_legalitas_jaminan_id' => $detail->jenis_legalitas_jaminan_id, @@ -507,6 +514,7 @@ $detail->dokumen_nomor, ) ?? $detail->dokumen_nomor, 'custom_field' => $detail->jenisLegalitasJaminan->custom_field, + 'custom_fields' => $customFields, 'custom_field_type' => $detail->jenisLegalitasJaminan->custom_field_type, 'details' => $detail->details, 'keterangan' => $detail->keterangan, diff --git a/resources/views/debitur/components/dokumen.blade.php b/resources/views/debitur/components/dokumen.blade.php index ed7805f..80cd597 100644 --- a/resources/views/debitur/components/dokumen.blade.php +++ b/resources/views/debitur/components/dokumen.blade.php @@ -16,16 +16,16 @@

-
- -
-

- {{ $permohonan->nomor_registrasi ?? "-" }} -

-
+
+ +
+

+ {{ $permohonan->nomor_registrasi ?? "-" }} +

+
@if($detail->details) - @if($detail->jenisLegalitasJaminan->custom_field) - @php $custom_field = json_decode($detail->details,true) @endphp -
- -
- + @if($detail->jenisLegalitasJaminan->custom_fields) + @php $custom_field = json_decode($detail->details) @endphp + {{ $custom_field->luas_tanah }} + @foreach($custom_field as $key => $value) +
+ +
+ +
-
+ @endforeach @endif - @else - @if($detail->jenisLegalitasJaminan->custom_field) -
- -
- @if($detail->jenisLegalitasJaminan->custom_field_type === "text") - - @elseif($detail->jenisLegalitasJaminan->custom_field_type === "number") - - @elseif($detail->jenisLegalitasJaminan->custom_field_type === "date") - - @elseif($detail->jenisLegalitasJaminan->custom_field_type === "textarea") - - @else - - @endif + @if($detail->jenisLegalitasJaminan->custom_fields) + @foreach($detail->jenisLegalitasJaminan->custom_fields as $key) +
+ +
+ +
-
+ @endforeach @endif @endif @@ -393,25 +387,17 @@
- @if($item->custom_field) -
- -
- @if($item->custom_field_type === "text") - - @elseif($item->custom_field_type === "number") - - @elseif($item->custom_field_type === "date") - - @elseif($item->custom_field_type === "textarea") - - @else - - @endif + @if($item->custom_fields) + @foreach($item->custom_fields as $field) +
+ +
+ +
-
+ @endforeach @endif
@@ -437,13 +423,13 @@ @push('scripts') {{--Pemilik Jaminan--}}