@if (@isset($dokumen))
    @foreach ($dokumen->detail as $detail)
        @if (!empty($detail->name) && isset($detail->details) && !empty($detail->dokumen_jaminan))
            <tr>
                <td width="25%"><strong>{{ $detail->name ?? '' }}</strong></td>
            </tr>
        @endif

        @if (isset($detail->details))
            @php
                $details = json_decode($detail->details, true);
            @endphp

            @if (is_array($details) && count($details) > 0)
                @foreach ($details as $value)
                    @if (is_array($value))
                        @foreach ($value as $key => $item)
                            @if (!empty($item))
                                <tr>
                                    <td style="padding: 2px;">
                                        {{ formatLabel($key) }}
                                    </td>
                                    <td style="width:1%; padding: 2px; vertical-align: top;">:</td>
                                    <td style="padding: 2px;">
                                        @if (strpos(strtolower($key), 'tanggal') !== false)
                                            {{ formatTanggalIndonesia($item) }}
                                        @else
                                            {{ $item }}
                                            @if ($key == 'luas_bangunan' || $key == 'luas_tanah')
                                            <span>m²</span>
                                            @endif
                                        @endif
                                    </td>
                                </tr>
                            @endif
                        @endforeach
                    @endif
                @endforeach
            @endif
        @endif
    @endforeach
@endif
