@extends('layouts.main')

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

@section('content')
    <div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
        <div class="card border border-agi-100 pb-2.5">
            <div class="card-header bg-agi-50" id="basic_settings">
                <div class="card-title flex flex-row gap-1.5">
                    @if(request()->get('permohonan_id'))
                        <a href="{{ route('permohonan.edit',['permohonan'=>request()->get('permohonan_id')]) }}" class="btn btn-xs {{ request()->routeIs('permohonan.edit') ? 'btn-outline btn-primary' : 'btn-light' }}">Data Permohonan</a>
                    @endif
                    <a href="{{ route('debitur.edit',array_merge(request()->query(),['debitur'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.edit') ? 'btn-outline btn-primary' : 'btn-light' }}">Data Debitur</a>
                    <a href="{{ route('debitur.jaminan.index',array_merge(request()->query(),['id'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.jaminan.index') ? 'btn-outline btn-primary' : 'btn-light' }}">Dokumen Jaminan</a>
                    <a href="{{ route('debitur.pemilik.index',array_merge(request()->query(),['id'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.pemilik.index') ? 'btn-outline btn-primary' : 'btn-light' }}">Pemilk Jaminan</a>
                </div>
                <div class="flex items-center gap-2">
                    @if(isset($debitur->id) && request()->get('permohonan_id') == null)
                        <a class="btn btn-sm btn-primary" href="{{ route('permohonan.create.debitur', $debitur->id) }}"> Buat Permohonan </a>
                    @endif

                    @if(request()->get('from') == 'permohonan')
                        <a href="{{ route('permohonan.create') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
                    @elseif(request()->get('permohonan_id'))
                        <a href="{{ route('permohonan.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
                    @else
                        <a href="{{ route('debitur.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
                    @endif
                </div>
            </div>
            <div class="card-body">
                @if(request()->routeIs('debitur.edit', $debitur))
                    @include('lpj::debitur.components.debitur')
                @elseif(request()->routeIs('debitur.pemilik.index', $debitur))
                    @include('lpj::debitur.components.pemilik')
                @else
                    @include('lpj::debitur.components.jaminan')
                @endif
            </div>
        </div>
    </div>
@endsection
