@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">
                <h3 class="card-title">Form Pembatalan Permohonan</h3>
                <div class="flex items-center gap-2">
                    <a href="{{ route('permohonan.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
                </div>
            </div>
            <div class="card-body">
                <form action="{{ route('permohonan.pembatalan', $permohonan) }}" method="POST" class="grid gap-5" enctype="multipart/form-data">
                    @csrf

                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">
                            Nomor Registrasi
                        </label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
                            <input type="text" class="input" value="{{ $permohonan->nomor_registrasi ?? '' }}" readonly>
                        </div>
                    </div>

                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">
                            Nama Debitur
                        </label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="text" class="input" value="{{ $permohonan->debiture->name ?? '' }}" readonly>
                        </div>
                    </div>

                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">
                            Alasan Pembatalan
                        </label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <textarea class="textarea @error('alasan_pembatalan') border-danger bg-danger-light @enderror"
                                      name="alasan_pembatalan"
                                      rows="4">{{ old('alasan_pembatalan') }}</textarea>
                            @error('alasan_pembatalan')
                            <em class="alert text-danger text-sm">{{ $message }}</em>
                            @enderror
                        </div>
                    </div>

                    <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                        <label class="form-label max-w-56">
                            Dokumen Pendukung
                        </label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input type="file" class="file-input @error('file_pembatalan') border-danger bg-danger-light @enderror"
                                   name="file_pembatalan">
                            @error('file_pembatalan')
                            <em class="alert text-danger text-sm">{{ $message }}</em>
                            @enderror
                        </div>
                    </div>

                    <div class="flex justify-end">
                        <button type="submit" class="btn btn-primary">Submit Pembatalan</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection
