@extends('layouts.main')

@section('breadcrumbs')
    @if(isset($jenisLampiran->id))
    {{ Breadcrumbs::render(request()->route()->getName(),$jenisLampiran->id) }}
    @else
    {{ Breadcrumbs::render(request()->route()->getName()) }}
    @endif
@endsection

@section('content')
    <div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
        @if(isset($jenisLampiran->id))
            <form action="{{ route('basicdata.jenis-lampiran.update', $jenisLampiran->id) }}" method="POST">
                <input type="hidden" name="id" value="{{ $jenisLampiran->id }}">
                @method('PUT')
        @else
            <form method="POST" action="{{ route('basicdata.jenis-lampiran.store') }}">
        @endif
        @csrf
        <div class="card border border-agi-100 pb-2.5">
            <div class="card-header bg-agi-50" id="basic_settings">
                <h3 class="card-title">
                    {{ isset($jenisLampiran->id) ? 'Edit' : 'Tambah' }} Jenis Lampiran
                </h3>
                <div class="flex items-center gap-2">
                    <a href="{{ route('basicdata.jenis-lampiran.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
                </div>
            </div>
            <div class="card-body grid gap-5">
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        Nama
                    </label>
                    <div class="flex flex-wrap items-baseline w-full">
                        <input class="input @error('nama') border-danger bg-danger-light @enderror" type="text" name="nama" value="{{ $jenisLampiran->nama ?? old('nama') }}">
                        @error('nama')
                        <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">
                        Deskripsi
                    </label>
                    <div class="flex flex-wrap items-baseline w-full">
                        <textarea class="textarea @error('deskripsi') border-danger bg-danger-light @enderror" name="deskripsi" rows="3">{{ $jenisLampiran->deskripsi ?? old('deskripsi') }}</textarea>
                        @error('deskripsi')
                        <em class="alert text-danger text-sm">{{ $message }}</em>
                        @enderror
                    </div>
                </div>
                <div class="flex justify-end">
                    <button type="submit" class="btn btn-primary">
                        Save
                    </button>
                </div>
            </div>
        </div>
        </form>
    </div>
@endsection
