<x-app-layout title="Edit department">
    <div class="mx-auto max-w-lg">
        <h1 class="text-xl font-semibold text-slate-900">Edit department</h1>
        <form method="POST" action="{{ route('care.departments.update', $department) }}" class="mt-6 space-y-4 rounded-2xl border border-slate-200 bg-white p-6">
            @csrf @method('PUT')
            <div><label class="block text-sm font-medium">Name</label><input type="text" name="name" value="{{ old('name', $department->name) }}" required class="mt-1 w-full rounded-lg border-slate-300 text-sm"></div>
            <div>
                <label class="block text-sm font-medium">Type</label>
                <select name="type" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
                    @foreach ($types as $value => $label)
                        <option value="{{ $value }}" @selected(old('type', $department->type) === $value)>{{ $label }}</option>
                    @endforeach
                </select>
            </div>
            <label class="flex items-center gap-2 text-sm"><input type="checkbox" name="is_active" value="1" @checked(old('is_active', $department->is_active))> Active</label>
            <button type="submit" class="btn-primary w-full">Save changes</button>
        </form>
    </div>
</x-app-layout>
