@extends('layouts.main')

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

@section('content')
    <div class="grid gap-5 mx-auto w-full lg:gap-7.5">
        @if (isset($nilaiPlafond->id))
            <form action="{{ route('basicdata.nilai-plafond.update', $nilaiPlafond->id) }}" method="POST">
                <input type="hidden" name="id" value="{{ $nilaiPlafond->id }}">
                @method('PUT')
            @else
                <form method="POST" action="{{ route('basicdata.nilai-plafond.store') }}">
        @endif
        @csrf
        <div class="pb-2.5 border card border-agi-100">
            <div class="card-header bg-agi-50" id="basic_settings">
                <h3 class="card-title">
                    {{ isset($nilaiPlafond->id) ? 'Edit' : 'Tambah' }} Nilai Plafond
                </h3>
                <div class="flex gap-2 items-center">
                    <a href="{{ route('basicdata.nilai-plafond.index') }}" class="btn btn-xs btn-info"><i
                            class="ki-filled ki-exit-left"></i> Back</a>
                </div>
            </div>
            <div class="grid gap-5 card-body">
                <div class="flex flex-wrap gap-2.5 items-baseline lg:flex-nowrap">
                    <label class="form-label max-w-56">
                        Code
                    </label>
                    <div class="flex flex-wrap items-baseline w-full">
                        <input class="input  @error('code') border-danger bg-danger-light @enderror" type="text"
                            name="code" value="{{ $nilaiPlafond->code ?? '' }}">
                        @error('code')
                            <em class="text-sm alert text-danger">{{ $message }}</em>
                        @enderror
                    </div>
                </div>
                <div class="flex flex-wrap gap-2.5 items-baseline lg:flex-nowrap">
                    <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="{{ $nilaiPlafond->name ?? '' }}">
                        @error('name')
                            <em class="text-sm alert text-danger">{{ $message }}</em>
                        @enderror
                    </div>
                </div>
                {{-- Field Biaya --}}
                <div class="mt-3">
                    <label class="text-gray-900 form-label">Biaya</label>
                    <input class="input @error('biaya') border-danger bg-danger-light @enderror" type="number"
                        step="0.01" name="biaya" value="{{ $nilaiPlafond->biaya ?? old('biaya') }}" placeholder="0">
                    @error('biaya')
                        <div class="text-danger">{{ $message }}</div>
                    @enderror
                    <div class="mt-1 text-xs text-muted">Contoh: 1500000 untuk satu juta lima ratus ribu</div>
                </div>
            </div>
            <div class="flex justify-end">
                <button type="submit" class="btn btn-primary">
                    Save
                </button>
            </div>
        </div>
    </div>
    </form>
    </div>
@endsection
