<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Order Penilaian
        </h3>
        <div class="flex items-center gap-2">
            <a href="{{ url()->previous() }}" class="btn btn-xs btn-info">
                <i class="ki-filled ki-exit-left"></i> Back
            </a>
        </div>
    </div>
    <div class="card-body">
        <div class="grid gap-5 grid-cols-2">

            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Tujuan Penilaian</label>
                <div class="flex flex-wrap items-baseline w-full">
                    @if (isset($permohonan->tujuanPenilaian))
                        <p class="text-2sm text-gray-700">{{ $permohonan->tujuanPenilaian->name }}</p>
                    @endif
                </div>
            </div>
            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Tanggal Survey</label>
                <div class="flex flex-wrap items-base line w-full">
                    <p class="text-2sm text-gray-700">{{ $permohonan->created_at->format('d/m/Y') }}</p>
                </div>
            </div>

            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Cab/Direktorat</label>
                <div class="flex flex-wrap items-baseline w-full">
                    @if (isset($permohonan->branch))
                        <p class="text-2sm text-gray-700">{{ $permohonan->branch->name }}</p>
                    @endif
                </div>
            </div>

            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">AO</label>
                <div class="flex flex-wrap items-baseline w-full">
                    @if (isset($permohonan->user))
                        <p class="text-2sm text-gray-700">{{ $permohonan->user->name }}</p>
                    @endif
                </div>
            </div>

        </div>
    </div>
</div>

<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Identitas Debitur
        </h3>
    </div>
    <div class="card-body">

        <div class="grid gap-5">

            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Nama Calon Debitur</label>
                <div class="flex flex-wrap items-baseline w-full">
                    @if (isset($permohonan->debiture->name))
                        <p class="text-2sm text-gray-700">{{ $permohonan->debiture->name }}</p>
                    @endif
                </div>
            </div>

            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Nama Wakil Debitur</label>
                <div class="flex flex-wrap items-baseline w-full">
                    <input type="text" name="nama_wakil" class="input" placeholder="Masukkan Hubungan Calon Debitur"
                        value="{{ old('nama_wakil_debitur', $forminspeksi['nama_wakil_debitur'] ?? '') }}">

                    <em id="error-nama_wakil_debitur" class="alert text-danger text-sm"></em>

                </div>
            </div>
            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Hubungan Calon Debitur</label>
                <div class="flex flex-wrap items-baseline w-full">
                    <input type="text" name="hub_calon_debitur" class="input"
                        placeholder="Masukkan Hubungan Calon Debitur"
                        value="{{ old('hub_calon_debitur', $forminspeksi['hub_calon_debitur'] ?? '') }}">


                    <em id="error-hub_calon_debitur" class="alert text-danger text-sm"></em>

                </div>
            </div>
        </div>
    </div>
</div>

<div class="card border border-agi-100 rounded-lg shadow-md">
    @include('lpj::surveyor.components.lokasi-jaminan')
</div>

<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Data Data Jaminan
        </h3>
    </div>
    <div class="card-body rounded-lg  overflow-hidden">
        <div class="grid gap-5">

            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Jenis Pesawat</label>
                <div class="flex-wrap items-stretch">
                    <div class="flex flex-col items-start gap-4">
                        @if (isset($basicData['jenisKapal']))
                            @foreach ($basicData['jenisKapal'] as $item)
                                <div class="flex items-center">
                                    <label class="form-label flex items-center gap-2.5 text-nowrap">
                                        <input class="checkbox" name="jenis_kapal[]" type="checkbox"
                                            value="{{ $item->name }}"
                                            {{ in_array($item->name, old('jenis_kapal', [])) ||
                                            (isset($forminspeksi['jenis_kapal']) &&
                                                is_array($forminspeksi['jenis_kapal']) &&
                                                in_array($item->name, $forminspeksi['jenis_kapal']))
                                                ? 'checked'
                                                : '' }}
                                            onclick="toggleCheckboxVisibility('jenis_kapal', 'jenis_kapal_lainnya', ['lainnya'])" />
                                        {{ $item->name }}
                                    </label>
                                    @if (strcasecmp($item->name, 'lainnya') == 0)
                                        <input id="jenis_kapal_lainnya" type="text"
                                            style="{{ isset($forminspeksi['jenis_kapal_lainnya']) && $forminspeksi['jenis_kapal_lainnya'] ? '' : 'display: none;' }}"
                                            name="jenis_kapal_lainnya" class="input w-full mt-2"
                                            placeholder="Masukkan bentuk tanah..."
                                            value="{{ old('jenis_kapal_lainnya', $forminspeksi['jenis_kapal_lainnya'] ?? '') }}" />
                                    @endif
                                </div>
                            @endforeach
                        @endif
                    </div>
                    <em id="error-jenis_kapal" class="alert text-danger text-sm"></em>
                </div>
            </div>

            @php
                $inputDataJaminan = [
                    [
                        'label' => 'Size',
                        'value' => ['Small', 'Large', 'Medium', 'Very Large'],
                        'name' => 'size',
                        'index' => 0,
                    ],
                    [
                        'label' => 'Kondisi',
                        'value' => ['Laik Laut', 'Sekrap', 'Rusak', 'Progress', 'Konversi'],
                        'name' => 'kondisi',
                        'index' => 1,
                    ],
                    [
                        'label' => 'Klasifikasi
',
                        'value' => ['IACS', 'BKI', 'Lainnya'],
                        'name' => 'klasifikasi',
                        'index' => 2,
                    ],
                ];
            @endphp

            @if (count($inputDataJaminan) > 0)
                @foreach ($inputDataJaminan as $item)
                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 mt-2">
                        <label class="form-label max-w-56">{{ $item['label'] }}</label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <div class="flex flex-col items-start gap-4">
                                @if (isset($item['value']))
                                    @foreach ($item['value'] as $value)
                                        <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">
                                                <input class="checkbox" name="{{ $item['name'] }}[]" type="checkbox"
                                                    value="{{ $value }}"
                                                    {{ in_array($value, old($item['name'], $forminspeksi[$item['name']] ?? [])) ? 'checked' : '' }} />
                                                {{ $value }}
                                            </label>
                                        </div>
                                    @endforeach
                                @endif
                            </div>
                            <div class="w-full">
                                <em id="error-{{ $item['name'] }}" class="alert text-danger text-sm"></em>
                                <em id="error-{{ $item['name'] }}-input-{{ $loop->index }}"
                                    class="alert text-danger text-sm"></em>
                            </div>
                        </div>
                    </div>
                @endforeach
            @endif

            @php

                $inputDataJaminan = [
                    [
                        'label' => 'Nama Kapal',
                        'name' => 'nama_kapal',
                        'value' => old('nama_kapal', $forminspeksi['nama_kapal'] ?? ''),
                        'index' => 0,
                    ],
                    [
                        'label' => 'Pemilik Kapal',
                        'name' => 'pemilik_kapal',
                        'value' => old('pemilik_kapal', $forminspeksi['pemilik_kapal'] ?? ''),
                        'index' => 1,
                    ],
                    [
                        'label' => 'Bendera',
                        'name' => 'bendera',
                        'value' => old('bendera', $forminspeksi['bendera'] ?? ''),

                        'index' => 2,
                    ],
                    [
                        'label' => 'Nomor Tanda Selar',
                        'name' => 'nomor_selar',
                        'value' => old('nomor_selar', $forminspeksi['nomor_selar'] ?? ''),
                        'index' => 3,
                    ],
                    [
                        'label' => 'Kapal',
                        'name' => 'kapal',
                        'value' => old('kapal', $forminspeksi['kapal'] ?? ''),
                        'index' => 4,
                    ],
                    [
                        'label' => 'Galangan',
                        'name' => 'galangan_kapal',
                        'value' => old('galangan_kapal', $forminspeksi['galangan_kapal'] ?? ''),
                        'index' => 5,
                    ],
                    [
                        'label' => 'Kapal/Shipyard',
                        'name' => 'kapal_shipyard',
                        'value' => old('kapal_shipyard', $forminspeksi['kapal_shipyard'] ?? ''),
                        'index' => 6,
                    ],
                    [
                        'label' => 'Tahun Pembuatan',
                        'name' => 'tahun_pembuatan',
                        'value' => old('tahun_pembuatan', $forminspeksi['tahun_pembuatan'] ?? ''),
                        'index' => 7,
                    ],
                    [
                        'label' => 'Tahun Lanuncing',
                        'name' => 'tahun_launcing',
                        'value' => old('tahun_launcing', $forminspeksi['tahun_launcing'] ?? ''),
                        'index' => 8,
                    ],
                    [
                        'label' => 'DWT (ton)',
                        'name' => 'dwt',
                        'value' => old('dwt', $forminspeksi['dwt'] ?? ''),
                        'index' => 9,
                    ],
                    [
                        'label' => 'LWT (ton)',
                        'name' => 'lwt',
                        'value' => old('lwt', $forminspeksi['lwt'] ?? ''),
                        'index' => 10,
                    ],
                    [
                        'label' => 'Gross Tonnage (ton)',
                        'name' => 'gross_tonnage',
                        'value' => old('gross_tonnage', $forminspeksi['gross_tonnage'] ?? ''),
                        'index' => 11,
                    ],
                    [
                        'label' => 'Net Tonnage (ton)',
                        'name' => 'net_tonnage',
                        'value' => old('net_tonnage', $forminspeksi['net_tonnage'] ?? ''),
                        'index' => 12,
                    ],
                    [
                        'label' => 'Tenaga Mesin (HP)',
                        'name' => 'tenaga_mesin',
                        'value' => old('tenaga_mesin', $forminspeksi['tenaga_mesin'] ?? ''),
                        'index' => 13,
                    ],
                    [
                        'label' => 'LOA',
                        'name' => 'loa',
                        'value' => old('loa', $forminspeksi['loa'] ?? ''),
                        'index' => 14,
                    ],
                    [
                        'label' => 'LBP',
                        'name' => 'lbp',
                        'value' => old('lbp', $forminspeksi['lbp'] ?? ''),
                        'index' => 15,
                    ],
                    [
                        'label' => 'Beam',
                        'name' => 'beam',
                        'value' => old('beam', $forminspeksi['beam'] ?? ''),
                        'index' => 16,
                    ],
                    [
                        'label' => 'Depth',
                        'name' => 'depth',
                        'value' => old('depth', $forminspeksi['depth'] ?? ''),
                        'index' => 17,
                    ],
                    [
                        'label' => 'Draft',
                        'name' => 'draft',
                        'value' => old('draft', $forminspeksi['draft'] ?? ''),
                        'index' => 18,
                    ],
                ];
            @endphp

            @if (count($inputDataJaminan) > 0)
                @foreach ($inputDataJaminan as $item)
                    <!-- Nomor Lambung -->
                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">{{ $item['label'] }}</label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="text" name="{{ $item['name'] }}" class="input"
                                placeholder="Masukkan {{ $item['label'] }}" value="{{ $item['value'] }}">

                            <em id="error-{{ $item['name'] }}" class="alert text-danger text-sm"></em>

                        </div>
                    </div>
                @endforeach
            @endif
        </div>
    </div>
</div>

<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Struktur Kapal
        </h3>
    </div>
    <div class="card-body overflow-hidden">

        <div class="grid gap-5">
            @php

                $inputStrukturKapal = [
                    [
                        'label' => 'Lambung Kapal',
                        'name' => 'lambung_kapal',
                        'value' => old('lambung_kapal', $forminspeksi['lambung_kapal'] ?? ''),
                        'index' => 0,
                    ],
                    [
                        'label' => 'Dek',
                        'name' => 'dek',
                        'value' => old('dek', $forminspeksi['dek'] ?? ''),
                        'index' => 1,
                    ],
                    [
                        'label' => 'Struktur Rangka',
                        'name' => 'struktur_rangka',
                        'value' => old('struktur_rangka', $forminspeksi['struktur_rangka'] ?? ''),
                        'index' => 2,
                    ],
                    [
                        'label' => 'Palka',
                        'name' => 'palka',
                        'value' => old('palka', $forminspeksi['palka'] ?? ''),
                        'index' => 3,
                    ],
                    [
                        'label' => 'Pondasi Mesin',
                        'name' => 'pondasi_mesin',
                        'value' => old('pondasi_mesin', $forminspeksi['pondasi_mesin'] ?? ''),
                        'index' => 4,
                    ],
                    [
                        'label' => 'Area Mesin',
                        'name' => 'area_mesin',
                        'value' => old('area_mesin', $forminspeksi['area_mesin'] ?? ''),
                        'index' => 5,
                    ],
                    [
                        'label' => 'Cat dan Korosi',
                        'name' => 'cat_dan_korosi',
                        'value' => old('cat_dan_korosi', $forminspeksi['cat_dan_korosi'] ?? ''),
                        'index' => 6,
                    ],
                    [
                        'label' => 'Sistem Pengelasan',
                        'name' => 'sistem_pengelasan',
                        'value' => old('sistem_pengelasan', $forminspeksi['sistem_pengelasan'] ?? ''),
                        'index' => 7,
                    ],
                ];

            @endphp

            @if (count($inputStrukturKapal) > 0)
                @foreach ($inputStrukturKapal as $item)
                    <!-- Nomor Lambung -->
                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">{{ $item['label'] }}</label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="text" name="{{ $item['name'] }}" class="input"
                                placeholder="Masukkan {{ $item['label'] }}" value="{{ $item['value'] }}">


                            <em id="error_{{ $item['name'] }}" class="alert text-danger text-sm"></em>

                        </div>
                    </div>
                @endforeach
            @endif
            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
                <div class="flex flex-wrap items-baseline w-full">
                    <textarea name="deskripsi_struktur" id="" class="textarea">{{ old('deskripsi_struktur', $forminspeksi['deskripsi_struktur'] ?? '') }}</textarea>

                    <em id="error_deskripsi_struktur" class="alert text-danger text-sm"></em>

                </div>
            </div>
        </div>
    </div>
</div>

{{-- Peralatan Keselamatan --}}
<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Peralatan Keselamatan
        </h3>
    </div>
    <div class="card-body overflow-hidden">

        <div class="grid gap-5">
            @php
                $inputPeralatan = [
                    [
                        'label' => 'Sekoci/Lifeboat',
                        'name' => 'sekoci',
                        'value' => old('sekoci', $forminspeksi['sekoci'] ?? ''),
                        'index' => 0,
                    ],
                    [
                        'label' => 'Jaket Pelampung',
                        'name' => 'jaket_pelampung',
                        'value' => old('jaket_pelampung', $forminspeksi['jaket_pelampung'] ?? ''),
                        'index' => 1,
                    ],
                    [
                        'label' => 'Alat Pemadam',
                        'name' => 'alat_pemadaman',
                        'value' => old('alat_pemadaman', $forminspeksi['alat_pemadaman'] ?? ''),
                        'index' => 2,
                    ],
                    [
                        'label' => 'Rambu Darurat',
                        'name' => 'rambu_darurat',
                        'value' => old('rambu_darurat', $forminspeksi['rambu_darurat'] ?? ''),
                        'index' => 3,
                    ],
                    [
                        'label' => 'Sistem Alarm',
                        'name' => 'sistem_alarm',
                        'value' => old('sistem_alarm', $forminspeksi['sistem_alarm'] ?? ''),
                        'index' => 4,
                    ],
                    [
                        'label' => 'Sistem Pencegah',
                        'name' => 'sistem_pencegah',
                        'value' => old('sistem_pencegah', $forminspeksi['sistem_pencegah'] ?? ''),
                        'index' => 5,
                    ],
                    [
                        'label' => 'Kebakaran',
                        'name' => 'kebakaran',
                        'value' => old('kebakaran', $forminspeksi['kebakaran'] ?? ''),
                        'index' => 6,
                    ],
                    [
                        'label' => 'Lampu Darurat',
                        'name' => 'lampu_darurat',
                        'value' => old('lampu_darurat', $forminspeksi['lampu_darurat'] ?? ''),
                        'index' => 7,
                    ],
                ];

            @endphp

            @if (count($inputPeralatan) > 0)
                @foreach ($inputPeralatan as $item)
                    <!-- Nomor Lambung -->
                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">{{ $item['label'] }}</label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="text" name="{{ $item['name'] }}" class="input"
                                placeholder="Masukkan {{ $item['label'] }}" value="{{ $item['value'] }}">
                            <em id="error-{{ $item['name'] }}" class="alert text-danger text-sm"></em>
                        </div>
                    </div>
                @endforeach
            @endif
            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
                <div class="flex flex-wrap items-baseline w-full">
                    <textarea name="deskripsi_peralatan" id="" class="textarea">{{ old('deskripsi_peralatan', $forminspeksi['deskripsi_peralatan'] ?? '') }}</textarea>

                    <em id="error-deskripsi_peralatan" class="alert text-danger text-sm"></em>

                </div>
            </div>
        </div>
    </div>
</div>
{{-- Sistwm Navigasi dan Komunikasi --}}
<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Sistem Navigasi dan Komunikasi
        </h3>
    </div>
    <div class="card-body overflow-hidden">

        <div class="grid gap-5">
            @php

                $inputDataLoaksi = [
                    [
                        'label' => 'Gps',
                        'name' => 'gps',
                        'value' => old('gps', $forminspeksi['gps'] ?? ''),
                        'index' => 0,
                    ],
                    [
                        'label' => 'Radar',
                        'name' => 'radar',
                        'value' => old('radar', $forminspeksi['radar'] ?? ''),
                        'index' => 1,
                    ],
                    [
                        'label' => 'Radio Komunikasi',
                        'name' => 'radio_komunikasi',
                        'value' => old('radio_komunikasi', $forminspeksi['radio_komunikasi'] ?? ''),
                        'index' => 2,
                    ],
                    [
                        'label' => 'Lampu Navigasi',
                        'name' => 'lampu_navigasi',
                        'value' => old('lampu_navigasi', $forminspeksi['lampu_navigasi'] ?? ''),
                        'index' => 3,
                    ],
                    [
                        'label' => 'Sistem Kendali otomatis',
                        'name' => 'sistem_kendali_otomatis',
                        'value' => old('sistem_kendali_otomatis', $forminspeksi['sistem_kendali_otomatis'] ?? ''),
                        'index' => 4,
                    ],
                    [
                        'label' => 'Kompas',
                        'name' => 'kompas',
                        'value' => old('kompas', $forminspeksi['kompas'] ?? ''),
                        'index' => 5,
                    ],
                ];

            @endphp

            @if (count($inputDataLoaksi) > 0)
                @foreach ($inputDataLoaksi as $item)
                    <!-- Nomor Lambung -->
                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">{{ $item['label'] }}</label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="text" name="{{ $item['name'] }}" class="input"
                                placeholder="Masukkan {{ $item['label'] }}" value="{{ $item['value'] }}">
                            <em id="error-{{ $item['name'] }}" class="alert text-danger text-sm"></em>
                        </div>
                    </div>
                @endforeach
            @endif
            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
                <div class="flex flex-wrap items-baseline w-full">
                    <textarea name="deskripsi_navigasi" id="" class="textarea">{{ old('deskripsi_navigasi', $forminspeksi['deskripsi_navigasi'] ?? '') }}</textarea>
                    <em id="error-deskripsi_navigasi" class="alert text-danger text-sm"></em>
                </div>
            </div>
        </div>
    </div>
</div>

{{-- Sistwm Mesin dan Penggerak Kapal --}}
<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Sistem Mesin dan Penggerak Kapal
        </h3>
    </div>
    <div class="card-body overflow-hidden">

        <div class="grid gap-5">
            @php

                $inputSistemPengerak = [
                    [
                        'label' => 'Mesin Utama',
                        'name' => 'mesin_utama',
                        'value' => old('mesin_utama', $forminspeksi['mesin_utama'] ?? ''),
                        'index' => 0,
                    ],
                    [
                        'label' => 'Mesin Bantu',
                        'name' => 'mesin_bantu',
                        'value' => old('mesin_bantu', $forminspeksi['mesin_bantu'] ?? ''),
                        'index' => 1,
                    ],
                    [
                        'label' => 'Pompa Pendingin',
                        'name' => 'pompa_pendingin',
                        'value' => old('pompa_pendingin', $forminspeksi['pompa_pendingin'] ?? ''),
                        'index' => 2,
                    ],
                    [
                        'label' => 'Sistem Pelumasan',
                        'name' => 'sistem_pelumasan',
                        'value' => old('sistem_pelumasan', $forminspeksi['sistem_pelumasan'] ?? ''),
                        'index' => 3,
                    ],
                    [
                        'label' => 'Propeller',
                        'name' => 'propeller',
                        'value' => old('propeller', $forminspeksi['propeller'] ?? ''),
                        'index' => 4,
                    ],
                    [
                        'label' => 'Sistem Kelistrikan',
                        'name' => 'sistem_kelistrikan',
                        'value' => old('sistem_kelistrikan', $forminspeksi['sistem_kelistrikan'] ?? ''),
                        'index' => 5,
                    ],
                ];

            @endphp

            @if (count($inputSistemPengerak) > 0)
                @foreach ($inputSistemPengerak as $item)
                    <!-- Nomor Lambung -->
                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">{{ $item['label'] }}</label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="text" name="{{ $item['name'] }}" class="input"
                                placeholder="Masukkan {{ $item['label'] }}" value={{ $item['value'] }}>
                            <em id="error-{{ $item['name'] }}" class="alert text-danger text-sm"></em>
                        </div>
                    </div>
                @endforeach
            @endif
            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
                <div class="flex flex-wrap items-baseline w-full">
                    <textarea name="deskripsi_mesin_penggerak" id="" class="textarea">{{ old('deskripsi_mesin_penggerak', $forminspeksi['deskripsi_mesin_penggerak'] ?? '') }}</textarea>
                    <em id="error-deskripsi_mesin_penggerak" class="alert text-danger text-sm"></em>
                </div>
            </div>
        </div>
    </div>
</div>

{{-- Sistwm kelistrikan dan Elektronik --}}
<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Sistem Kelistrikan dan Elektronik
        </h3>
    </div>
    <div class="card-body overflow-hidden">

        <div class="grid gap-5">
            @php
                $inputSistemKelistrikan = [];

                $inputSistemKelistrikan = [
                    [
                        'label' => 'Lampu Navigasi',
                        'name' => 'lampu_navigasi',
                        'value' => old('lampu_navigasi', $forminspeksi['lampu_navigasi'] ?? ''),
                        'index' => 0,
                    ],
                    [
                        'label' => 'Sistem Penerangan',
                        'name' => 'sistem_penerangan',
                        'value' => old('sistem_penerangan', $forminspeksi['sistem_penerangan'] ?? ''),
                        'index' => 1,
                    ],
                    [
                        'label' => 'Sistem Panel Distribusi',
                        'name' => 'sistem_panel_distribusi',
                        'value' => old('sistem_panel_distribusi', $forminspeksi['sistem_panel_distribusi'] ?? ''),
                        'index' => 2,
                        'index' => 2,
                    ],
                    [
                        'label' => 'Kabel dan Perangkat Pendukung',
                        'name' => 'kabel_perangkat',
                        'value' => old('kabel_perangkat', $forminspeksi['kabel_perangkat'] ?? ''),
                        'index' => 3,
                    ],
                ];

            @endphp

            @if (count($inputSistemKelistrikan) > 0)
                @foreach ($inputSistemKelistrikan as $item)
                    <!-- Nomor Lambung -->
                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">{{ $item['label'] }}</label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="text" name="{{ $item['name'] }}" class="input"
                                placeholder="Masukkan {{ $item['label'] }}" value="{{ $item['value'] }}">

                            <em id="error-{{ $item['name'] }}" class="alert text-danger text-sm"></em>

                        </div>
                    </div>
                @endforeach
            @endif
            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
                <div class="flex flex-wrap items-baseline w-full">
                    <textarea name="deskripsi_kelistrikan" id="" class="textarea">{{ old('deskripsi_kelistrikan', $forminspeksi['deskripsi_kelistrikan'] ?? '') }}</textarea>

                    <em id="error_deskripsi_kelistrikan" class="alert text-danger text-sm"></em>

                </div>
            </div>
        </div>
    </div>
</div>
{{-- Linkungan dan Kebersihan Kapal --}}
<div class="card border border-agi-100 bg-white rounded-lg shadow-md overflow-hidden">
    <div class="card-header bg-agi-50">
        <h3 class="card-title uppercase">
            Linkungan dan Kebersihan Kapal
        </h3>
    </div>
    <div class="card-body overflow-hidden">

        <div class="grid gap-5">
            @php

                $inputLinkungan = [
                    [
                        'label' => 'Kebersihan Dek Luar',
                        'name' => 'kebersihan_dek_luar',
                        'value' => old('kebersihan_dek_luar', $forminspeksi['kebersihan_dek_luar'] ?? ''),
                        'index' => 0,
                    ],
                    [
                        'label' => 'Tangki Limbah',
                        'name' => 'tangki_limbah',
                        'value' => old('tangki_limbah', $forminspeksi['tangki_limbah'] ?? ''),
                        'index' => 1,
                    ],
                    [
                        'label' => 'Sistem Pengelolaan Limbah',
                        'name' => 'sistem_pengelolaan_limbah',
                        'value' => old('sistem_pengelolaan_limbah', $forminspeksi['sistem_pengelolaan_limbah'] ?? ''),
                        'index' => 2,
                    ],
                    [
                        'label' => 'Pengelolaan Air Ballast',
                        'name' => 'pengelolaan_air_ballast',
                        'value' => old('pengelolaan_air_ballast', $forminspeksi['pengelolaan_air_ballast'] ?? ''),
                        'index' => 3,
                        'index' => 3,
                    ],
                ];

            @endphp

            @if (count($inputLinkungan) > 0)
                @foreach ($inputLinkungan as $item)
                    <!-- Nomor Lambung -->
                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">{{ $item['label'] }}</label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="text" name="{{ $item['name'] }}" class="input"
                                placeholder="Masukkan {{ $item['label'] }}" value={{ $item['value'] }}>


                            <em id="error_{{ $item['name'] }}" class="alert text-danger text-sm"></em>

                        </div>
                    </div>
                @endforeach
            @endif
            <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                <label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
                <div class="flex flex-wrap items-baseline w-full">
                    <textarea name="deskripsi_kebersihan" id="" class="textarea">{{ old('deskripsi_kebersihan', $forminspeksi['deskripsi_kebersihan'] ?? '') }}</textarea>

                    <em id="error_deskripsi_kebersihan" class="alert text-danger text-sm"></em>

                </div>
            </div>
        </div>
    </div>
</div>

    <div class="card border border-agi-100 rounded-lg  overflow-hidden">
        <div class="card-header bg-agi-50">
            <h3 class="card-title uppercase">
                Analisis Fakta
            </h3>
        </div>
        <div class="card-body">
            <div class="grid gap-5">
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">Faktor Positif</label>
                    <div id="fakta-positif-container" class="flex flex-wrap items-baseline w-full">
                        @if (!empty($forminspeksi['fakta_positif']))
                            @foreach ($forminspeksi['fakta_positif'] as $index => $positif)
                                <div class="fakta_positif flex items-center gap-2 mt-2 textarea-group w-full">
                                    <textarea class="textarea mt-2" name="fakta_positif[]" rows="10">{{ old("fakta_positif.$index", $positif) }}</textarea>
                                    <button class="btn btn-danger btn-sm remove-btn" type="button"
                                        style="display: none;">
                                        <i class="ki-outline ki-trash"></i>
                                    </button>
                                </div>
                            @endforeach
                        @else
                            <div class="fakta_positif flex items-center gap-2 mt-2 textarea-group w-full">
                                <textarea class="textarea mt-2" name="fakta_positif[]" rows="10">{{ old('fakta_positif.0', '') }}</textarea>
                                <button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
                                    <i class="ki-outline ki-trash"></i>
                                </button>
                            </div>
                        @endif
                        <button type="button" class="btn btn-primary btn-sm mt-5"
                            onclick="addClonableItem('fakta-positif-container', 'fakta_positif')">
                            <i class="ki-outline ki-plus"></i>
                        </button>
                    </div>
                </div>

                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">Faktor Negatif</label>
                    <div id="fakta-negatif-container" class="flex flex-wrap items-baseline w-full">

                        @if (!empty($forminspeksi['fakta_negatif']))
                            @foreach ($forminspeksi['fakta_negatif'] as $index => $negatif)
                                <div class="fakta_negatif flex items-center gap-2 mt-2 textarea-group w-full">
                                    <textarea class="textarea mt-2" name="fakta_negatif[]" rows="10">{{ old("fakta_negatif.$index", $negatif) }}</textarea>
                                    <button class="btn btn-danger btn-sm remove-btn" type="button"
                                        style="display: none;">
                                        <i class="ki-outline ki-trash"></i>
                                    </button>
                                </div>
                            @endforeach
                        @else
                            <div class="fakta_negatif flex items-center gap-2 mt-2 textarea-group w-full">
                                <textarea class="textarea mt-2" name="fakta_negatif[]" rows="10">{{ old('fakta_negatif.0', $forminspeksi['fakta_negatif'][0] ?? '') }}</textarea>
                                <button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
                                    <i class="ki-outline ki-trash"></i>
                                </button>
                                <em id="error-fakta_negatif" class="alert text-danger text-sm"></em>
                            </div>
                        @endif
                        <button type="button" class="btn btn-primary btn-sm mt-5"
                            onclick="addClonableItem('fakta-negatif-container', 'fakta_negatif')">
                            <i class="ki-outline ki-plus"></i>
                        </button>
                    </div>
                </div>

                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">Catatan Yang Perlu Diperhatikan</label>
                    <div id="catatan-container" class="flex flex-wrap items-baseline w-full">
                        <div class="catatan flex items-center gap-2 mt-2 textarea-group w-full">
                            <textarea class="textarea mt-2" name="catatan[]" rows="10">{{ old('catatan.0', $forminspeksi['catatan'][0] ?? '') }}</textarea>
                            <button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
                                <i class="ki-outline ki-trash"></i>
                            </button>
                            <em id="error-catatan" class="alert text-danger text-sm"></em>
                        </div>
                        <button type="button"
                            onclick="addClonableItem('catatan-container', 'catatan')"
                            class="btn btn-primary btn-sm mt-5 ">
                            <i class="ki-outline ki-plus"></i>
                        </button>
                    </div>

                </div>

            </div>
        </div>
    </div>
