@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">
        <form action="{{ isset($statusPermohonan->id) ? route('basicdata.status-permohonan.update', $statusPermohonan->id) : route('basicdata.status-permohonan.store') }}" method="POST">
            @if(isset($statusPermohonan->id))
                @method('PUT')
                <input type="hidden" name="id" value="{{ $statusPermohonan->id }}">
            @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($statusPermohonan->id) ? 'Edit' : 'Tambah' }} Status Permohonan
                    </h3>
                    <div class="flex items-center gap-2">
                        <a href="{{ route('basicdata.status-permohonan.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">
                            Name
                        </label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <input class="input  @error('name') border-danger bg-danger-light @enderror" type="text" name="name" value="{{ $statusPermohonan->name ?? '' }}">
                            @error('name')
                            <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">
                            Description
                        </label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <textarea class="textarea  @error('description') border-danger bg-danger-light @enderror" rows="3" type="number" id="description" name="description">{{ $statusPermohonan->description ?? '' }}</textarea>
                            @error('description')
                            <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">
                            Status
                        </label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <label class="switch">
                                    <input type="checkbox" value="1" name="status" {{ isset($statusPermohonan->status) && $statusPermohonan->status==1 ? 'checked' : null }} />
                                <span class="switch-label">
                                    Aktif
                                </span>
                            </label>
                        </div>
                    </div>
                    <div class="flex justify-end">
                        <button type="submit" class="btn btn-primary">
                            Save
                        </button>
                    </div>

                </div>
            </div>
        </form>
    </div>
@endsection
