@extends('layouts.main')

@section('breadcrumbs')
    {{ Breadcrumbs::render(request()->route()->getName()) }}
@endsection

@section('content')
    @push('styles')
        <style>
            .border-l-primary {
                border-left-color: #0d6efd !important;
            }
        </style>
    @endpush
    <div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
        <div class="card">
            <div class="card-header bg-agi-50" id="advanced_settings_appearance">
                <h3 class="card-title uppercase">
                    Activity Permohonan
                </h3>
                <div class="flex items-center gap-2">
                    <a href="{{ route('activity.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i>
                        Back</a>
                </div>
            </div>
            <div class="card-body lg:py-7.5 grid grid-cols-3">
                <div class="mb-5">
                    <h3 class="text-md font-medium text-gray-900">
                        Nomor Register Permohonan:
                    </h3>
                    <span class="text-2sm text-gray-700">
                        {{ $permohonan->nomor_registrasi }}
                    </span>
                </div>

                <div class="mb-5">
                    <h3 class="text-md font-medium text-gray-900">
                        Pemohon:
                    </h3>
                    <span class="text-2sm text-gray-700">
                        {{ $permohonan->user->nik ?? '' }} | {{ $permohonan->user->name ?? '' }} | {{ $permohonan->user->branch->name ?? '' }}
                    </span>
                </div>

                <div class="mb-5">
                    <h3 class="text-md font-medium text-gray-900">
                        Tujuan Permohonan:
                    </h3>
                    <span class="text-2sm text-gray-700">
                        {{ $permohonan->tujuanPenilaian->name }}
                    </span>
                </div>

            </div>
        </div>


        @if ($permohonan->status === 'done')

            @foreach ($permohonan->documents as $dokumen)
                @php
                    $inspeksiId = null;

                    foreach ($dokumen->inspeksi as $item) {
                        $inspeksiId = $item->id;
                    }

                    $jaminanId = $dokumen->id;
                    $currentInspeksi = $inspeksiData[$jaminanId] ?? null;
                    $tanahBangunanTypes = ['KAPAL', 'PESAWAT', 'ALAT BERAT'];
                @endphp
                <div class="card border border-agi-100 grow" id="activity_2024">

                    <div class="card-header bg-agi-50">
                        <h3 class="card-title uppercase">
                            Hasil Laporan Penilaian
                        </h3>
                    </div>

                    <div class="card-body">

                        <a class="btn btn-info" href="{{ route('penilai.lampiran') }}?permohonanId={{ $permohonan->id }}&documentId={{ $dokumen->id }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $dokumen->jenis_jaminan_id }}&statusLpj=1">
                            LAMPIRAN FOTO DAN DOKUMEN
                        </a>
                        <a href="{{ route('surveyor.print_out_inspeksi', ['permohonan_id' => $permohonan->id, 'dokument_id' =>  $dokumen->id, 'jenis_jaminan_id' => $dokumen->jenis_jaminan_id ]) }}" class="btn btn-light">
                            <i class="ki-filled ki-printer"></i> Hasil Inspeksi
                        </a>
                        <a class="btn btn-success" href="{{ route('penilai.print-out-laporan', ['permohonan_id' => $permohonan->id, 'dokument_id' =>  $dokumen->id, 'jenis_jaminan_id' => $dokumen->jenis_jaminan_id ]) }}">
                            <i class="ki-filled ki-printer"></i> Print Laporan
                        </a>
                    </div>
                </div>
            @endforeach
        @endif

        @include('lpj::component.lampiran-dokumen')

        <div class="card border border-agi-100 grow" id="activity_2024">
            @include('lpj::component.history-permohonan')
        </div>
    </div>
@endsection
{{-- @include('lpj::surveyor.js.utils') --}}
