<x-ui.layout.page :title="__('offboarding.title')" :subtitle="__('offboarding.subtitle')" page-icon="fe fe-log-out">
    @can('offboarding.create')
        <div class="card mb-3"><div class="card-body">
            <form method="POST" action="{{ route('hr.offboarding.store') }}" class="row g-3">@csrf
                <div class="col-md-4"><x-ui.form.search-select name="employee_id" lookup="employees" :label="__('offboarding.fields.employee')" :options="$employees" required /></div>
                <div class="col-md-3"><x-ui.form.select name="type" :label="__('offboarding.fields.type')" :options="['resignation'=>__('offboarding.types.resignation'),'termination'=>__('offboarding.types.termination')]" required /></div>
                <div class="col-md-3"><x-ui.form.input name="last_working_date" type="date" :label="__('offboarding.fields.last_working_date')" required /></div>
                <div class="col-md-10"><x-ui.form.input name="reason" :label="__('offboarding.fields.reason')" required /></div>
                <div class="col-md-2 d-flex align-items-end"><x-ui.buttons.primary type="submit">{{ __('common.save') }}</x-ui.buttons.primary></div>
            </form>
        </div></div>
    @endcan
    <x-ui.operational.index-shell>
        <x-ui.table.table :columns="[['label'=>'#'],['label'=>__('offboarding.fields.employee')],['label'=>__('offboarding.fields.type')],['label'=>__('offboarding.fields.last_working_date')],['label'=>__('offboarding.fields.status')],['label'=>__('common.actions'),'align'=>'end']]">
            @forelse($cases as $case)
                <x-ui.table.row><td>{{ $case->id }}</td><td>{{ $case->employee?->full_name }}</td><td>{{ __('offboarding.types.'.$case->type) }}</td><td>{{ $case->last_working_date?->format('Y-m-d') }}</td><td>{{ __('offboarding.status.'.$case->status) }}</td><td class="text-end"><x-ui.buttons.secondary size="sm" :href="route('hr.offboarding.show',$case)">{{ __('common.view') }}</x-ui.buttons.secondary></td></x-ui.table.row>
            @empty<x-ui.table.row><td colspan="6"><x-ui.operational.empty-state :title="__('offboarding.empty')" /></td></x-ui.table.row>@endforelse
        </x-ui.table.table>
        <x-slot:pagination>{{ $cases->links() }}</x-slot:pagination>
    </x-ui.operational.index-shell>
</x-ui.layout.page>
