@extends('admin.layouts.app')

@section('title', $kategori->exists ? 'Edit Kategori' : 'Tambah Kategori')
@section('page_title', $kategori->exists ? 'Edit Kategori' : 'Tambah Kategori')
@section('page_subtitle', 'Kategori membantu Flutter memfilter destinasi')

@section('content')
<div class="card soft-card">
    <div class="card-body">
        <form method="POST" action="{{ $kategori->exists ? route('admin.kategori.update', $kategori) : route('admin.kategori.store') }}">
            @csrf
            @if($kategori->exists) @method('PUT') @endif
            <div class="mb-3">
                <label class="form-label">Nama Kategori</label>
                <input class="form-control @error('nama') is-invalid @enderror" name="nama" value="{{ old('nama', $kategori->nama) }}" required>
                @error('nama')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
                <label class="form-label">Deskripsi</label>
                <textarea class="form-control @error('deskripsi') is-invalid @enderror" name="deskripsi" rows="4">{{ old('deskripsi', $kategori->deskripsi) }}</textarea>
                @error('deskripsi')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="d-flex gap-2">
                <button class="btn btn-nature" type="submit"><i class="bi bi-check2 me-1"></i>Simpan</button>
                <a class="btn btn-outline-secondary" href="{{ route('admin.kategori.index') }}">Batal</a>
            </div>
        </form>
    </div>
</div>
@endsection
