@props([
    'action',
    'method' => 'POST',
    'status' => null,
    'colorOptions' => [],
    'submitLabel',
])

<form method="POST" action="{{ $action }}" novalidate>
    @csrf
    @if (strtoupper($method) !== 'POST')
        @method($method)
    @endif

    <div class="card">
        <div class="card-body">
            <div class="row g-3">
                <div class="col-md-6">
                    <x-ui.form.input
                        name="name"
                        :label="__('employment_statuses.fields.name')"
                        :value="$status?->name"
                        required
                    />
                </div>
                <div class="col-md-3">
                    <x-ui.form.select
                        name="color"
                        :label="__('employment_statuses.fields.color')"
                        :options="$colorOptions"
                        :selected="old('color', $status?->color ?? 'info')"
                        required
                    />
                </div>
                <div class="col-md-3">
                    <x-ui.form.input
                        name="sort_order"
                        type="number"
                        min="0"
                        :label="__('employment_statuses.fields.sort_order')"
                        :value="old('sort_order', $status?->sort_order ?? 0)"
                    />
                </div>
                <div class="col-12">
                    <x-ui.form.input
                        name="description"
                        :label="__('employment_statuses.fields.description')"
                        :value="$status?->description"
                        optional
                    />
                </div>
                @if ($status !== null)
                    <div class="col-md-4">
                        <x-ui.form.select
                            name="is_active"
                            :label="__('employment_statuses.fields.status')"
                            :options="[
                                1 => __('employment_statuses.status.active'),
                                0 => __('employment_statuses.status.inactive'),
                            ]"
                            :selected="$status->is_active ? 1 : 0"
                            required
                        />
                    </div>
                @endif
            </div>
        </div>
        <div class="card-footer d-flex justify-content-end gap-2 bg-white">
            <x-ui.buttons.secondary :href="route('hr.employment-statuses.index')">
                {{ __('common.cancel') }}
            </x-ui.buttons.secondary>
            <x-ui.buttons.primary type="submit">{{ $submitLabel }}</x-ui.buttons.primary>
        </div>
    </div>
</form>
