@can('update', $offer)
    <div class="d-flex flex-wrap gap-2 mb-3">
        @if ($offer->status === 'draft')
            <form method="POST" action="{{ route('hr.recruitment.offer-letters.submit', $offer) }}">@csrf
                <x-ui.buttons.primary size="sm" type="submit">{{ __('recruitment.offer_letters.actions.submit') }}</x-ui.buttons.primary>
            </form>
            <x-ui.buttons.secondary size="sm" :href="route('hr.recruitment.offer-letters.edit', $offer)">{{ __('common.edit') }}</x-ui.buttons.secondary>
        @endif
        @if ($offer->status === 'under_review')
            <form method="POST" action="{{ route('hr.recruitment.offer-letters.approve', $offer) }}">@csrf
                <x-ui.buttons.primary size="sm" type="submit">{{ __('recruitment.offer_letters.actions.approve') }}</x-ui.buttons.primary>
            </form>
        @endif
        @if ($offer->status === 'approved')
            <form method="POST" action="{{ route('hr.recruitment.offer-letters.send', $offer) }}">@csrf
                <x-ui.buttons.primary size="sm" type="submit">{{ __('recruitment.offer_letters.actions.send') }}</x-ui.buttons.primary>
            </form>
        @endif
        @if ($offer->status === 'sent')
            <form method="POST" action="{{ route('hr.recruitment.offer-letters.resend', $offer) }}">@csrf
                <x-ui.buttons.secondary size="sm" type="submit">{{ __('recruitment.offer_letters.actions.resend') }}</x-ui.buttons.secondary>
            </form>
            <form method="POST" action="{{ route('hr.recruitment.offer-letters.accept', $offer) }}">@csrf
                <x-ui.buttons.primary size="sm" type="submit">{{ __('recruitment.offer_letters.actions.accept') }}</x-ui.buttons.primary>
            </form>
            <form method="POST" action="{{ route('hr.recruitment.offer-letters.reject', $offer) }}">@csrf
                <x-ui.buttons.danger outline size="sm" type="submit">{{ __('recruitment.offer_letters.actions.reject') }}</x-ui.buttons.danger>
            </form>
            <form method="POST" action="{{ route('hr.recruitment.offer-letters.expire', $offer) }}">@csrf
                <x-ui.buttons.secondary size="sm" type="submit">{{ __('recruitment.offer_letters.actions.expire') }}</x-ui.buttons.secondary>
            </form>
        @endif
        @if (in_array($offer->status, ['draft', 'under_review', 'approved', 'sent'], true))
            <form method="POST" action="{{ route('hr.recruitment.offer-letters.withdraw', $offer) }}">@csrf
                <x-ui.buttons.danger outline size="sm" type="submit">{{ __('recruitment.offer_letters.actions.withdraw') }}</x-ui.buttons.danger>
            </form>
        @endif
        @if ($offer->status === 'accepted' && $offer->employee_id === null)
            @can('hire', $offer)
                <x-ui.buttons.primary size="sm" :href="route('hr.recruitment.hiring.wizard', $offer)">
                    {{ __('recruitment.hiring.actions.start_wizard') }}
                </x-ui.buttons.primary>
            @endcan
        @endif
    </div>
@endcan

@can('create', App\Modules\HR\Recruitment\Models\RecruitmentOfferLetter::class)
    <form method="POST" action="{{ route('hr.recruitment.offer-letters.duplicate', $offer) }}" class="d-inline">@csrf
        <x-ui.buttons.secondary size="sm" type="submit">{{ __('recruitment.offer_letters.actions.duplicate') }}</x-ui.buttons.secondary>
    </form>
@endcan

<a class="btn btn-sm btn-outline-secondary" href="{{ route('hr.recruitment.offer-letters.print', $offer) }}" target="_blank">
    {{ __('recruitment.offer_letters.actions.print') }}
</a>
<a class="btn btn-sm btn-outline-secondary" href="{{ route('hr.recruitment.offer-letters.pdf', $offer) }}">
    {{ __('recruitment.offer_letters.actions.download_pdf') }}
</a>
