@can('update', $employee)
    <form method="POST" action="{{ route('hr.employees.employment-histories.store', $employee) }}" class="mb-4">
        @csrf
        <h6>{{ __('employees.employment_history.add') }}</h6>
        @include('pages.hr.employees._partials.employment-history-fields')
        <x-ui.buttons.primary type="submit" icon="fe fe-plus">{{ __('employees.employment_history.add') }}</x-ui.buttons.primary>
    </form>
@endcan

@if ($tabData->isEmpty())
    <x-ui.operational.empty-state :title="__('employees.empty_tab.employment_history')" />
@else
    <x-ui.table.table :columns="[
        ['label'=>__('employees.employment_history.type')],
        ['label'=>__('employees.employment_history.effective_date')],
        ['label'=>__('employees.employment_history.change')],
        ['label'=>__('employees.employment_history.reason')],
        ['label'=>__('common.actions'),'align'=>'end'],
    ]">
        @foreach ($tabData as $history)
            <x-ui.table.row>
                <td>{{ __('employees.employment_history.types.'.$history->type->value) }}</td>
                <td>{{ $history->effective_date->format('Y-m-d') }}</td>
                <td>{{ $history->previous_value ?: '—' }} → {{ $history->new_value ?: '—' }}</td>
                <td>{{ $history->reason ?: '—' }}</td>
                <td class="text-end">
                    @can('update', $employee)
                        <form method="POST" action="{{ route('hr.employees.employment-histories.destroy', [$employee, $history]) }}">
                            @csrf @method('DELETE')
                            <x-ui.buttons.danger outline size="sm" type="submit">{{ __('common.delete') }}</x-ui.buttons.danger>
                        </form>
                    @endcan
                </td>
            </x-ui.table.row>
        @endforeach
    </x-ui.table.table>
@endif
