@extends('layouts.admin')

@section('title', __('admin.events.edit'))

@section('content')
<form method="POST" action="{{ route('admin.events.update', $event) }}">
    @csrf
    @method('PUT')
    @include('admin.events._form', ['event' => $event])
    <div class="mt-4">
        <button type="submit" class="btn-arena btn-primary">{{ __('admin.actions.update') }}</button>
    </div>
</form>

<div class="d-flex gap-2 mt-3 flex-wrap">
    @if($event->status === \App\Enums\EventStatus::Draft)
        <form method="POST" action="{{ route('admin.events.publish', $event) }}">
            @csrf
            <button type="submit" class="btn-arena btn-ghost">{{ __('admin.actions.publish') }}</button>
        </form>
    @endif
    @if($event->status !== \App\Enums\EventStatus::Cancelled)
        <form method="POST" action="{{ route('admin.events.cancel', $event) }}" onsubmit="return confirm(@json(__('admin.confirm.cancel_event')))">
            @csrf
            <button type="submit" class="btn-arena btn-danger">{{ __('admin.actions.cancel_event') }}</button>
        </form>
    @endif
    <a href="{{ route('admin.events.registrations.index', $event) }}" class="btn-arena btn-ghost">
        {{ __('admin.nav.registrations') }}
    </a>
</div>
@endsection
