<table style="width: 100%; ">
    <tr>
        <td style="width:25%; vertical-align: top;">Informasi data pembanding</td>
        <td style="width:1%; vertical-align: top;">:</td>
        <td style="vertical-align: top;">
            @php
                $exportData = [];
                if (isset($dataPembanding['data_pembanding'])) {
                    foreach ($dataPembanding['data_pembanding'] as $index => $pembanding) {
                        $exportData['pembanding' . ($index + 1)] = $pembanding;
                    }
                }

                $fields = [
                    'jenis_aset'    => 'Jenis properti',
                    'hak_properti'  => 'Status Hak Tanah',
                    'address'       => 'Alamat Lokasi',
                    'harga'         => 'Harga Penawaran',
                    'total'         => 'Indikasi Harga Transaksi',
                    'telepon'       => 'Penjual (HP)',
                    'luas_tanah'    => 'Luas Tanah',
                    'luas_bangunan' => 'Luas Bangunan',
                    'tanggal'       => 'Tanggal Data',
                    'kordinat'      => 'Titik Kordinat',
                ];
            @endphp


            @foreach ($exportData as $index => $data)
                <table style="width: 100%; margin-bottom: 15px; border-bottom: 1px solid #ddd;">
                    <tr>
                        <td style="font-weight: bold; padding-bottom: 8px;">
                            Pembanding {{ substr($index, -1) }}
                        </td>
                    </tr>

                    @if ($inspeksi->is_mig == 1)
                        <tr>
                            <td style="width: 33%; vertical-align: top;">Keterangan</td>
                            <td style="width: 5%; vertical-align: top;">:</td>
                            <td style="width: 62%;">
                                {!! isset($data['keterangan']) ? nl2br(e(parsePembandingMigration($data['keterangan']))) : '' !!}
                            </td>
                        </tr>
                    @else
                        @foreach ($fields as $key => $label)
                            <tr>
                                <td style="width: 33%;">{{ $label }}</td>
                                <td style="width: 5%;">:</td>
                                <td style="width: 62%;">
                                    @if ($key == 'luas_tanah' || $key == 'luas_bangunan')
                                        {{ $data[$key] ?? '-' }} m²
                                    @elseif($key == 'harga' || $key == 'total')
                                        {{  isset($data[$key]) ? formatRupiah($data[$key]) : 0 }}

                                    @elseif($key == 'tanggal')
                                                {{  isset($data[$key]) ? formatTanggalIndonesia($data[$key]) : '-' }}
                                    @elseif($key == 'telepon')
                                            {{ isset($data['telepon']) ? ubahNomorHp($data['telepon']) : '-' }}

                                    @elseif($key == 'kordinat')
                                        @php
                                            $lat = $data['kordinat_lat'] ?? null;
                                            $lng = $data['kordinat_lng'] ?? null;
                                        @endphp
                                        @if ($lat && $lng)
                                            {{ $lat }},{{ $lng }}
                                        @else
                                            -
                                        @endif
                                    @else
                                        {{ $data[$key] ?? '-' }}
                                    @endif
                                </td>
                            </tr>
                        @endforeach
                    @endif
                </table>
            @endforeach
        </td>
    </tr>
</table>
