Skip to content

Commit

Permalink
Changed: Closed santa register
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Dec 17, 2024
1 parent c991eeb commit 7d02ed4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
15 changes: 11 additions & 4 deletions app/Http/Controllers/SantaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,18 @@ public function update(Request $request): RedirectResponse
->secretSantaParticipant()
->firstOrNew();

if (!$participant->exists) {
Toast::warning('К сожалению, регистрация на Тайного Санту уже закрыта.')
->disableAutoHide();

return redirect()->route('santa');
}

$data = $request->validate([
'telegram' => ['string', 'required_without:tracking_number'],
'phone' => ['string', 'required_without:tracking_number'],
'address' => ['string', 'required_without:tracking_number'],
'about' => ['string', 'required_without:tracking_number'],
//'telegram' => ['string', 'required_without:tracking_number'],
//'phone' => ['string', 'required_without:tracking_number'],
//'address' => ['string', 'required_without:tracking_number'],
//'about' => ['string', 'required_without:tracking_number'],
'tracking_number' => [
'nullable',
'string',
Expand Down
14 changes: 13 additions & 1 deletion resources/views/santa/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
</x-slot>

<x-slot:actions>
<a href="{{ route('santa.game') }}" class="btn btn-primary btn-lg px-4">{{ $participant->exists ? 'Посмотреть статус' : 'Присоединиться' }}</a>

@if($participant->exists)
<a href="{{ route('santa.game') }}" class="btn btn-primary btn-lg px-4">
Посмотреть статус
</a>
@else
<a href="{{ route('santa.game') }}" class="btn btn-primary btn-lg px-4 disabled pe-none" disabled>
Санта уже укомплектован 🎅
{{-- Присоединиться --}}
</a>
@endif


<a href="{{ route('santa.rules') }}" class="d-none d-md-inline-flex link-body-emphasis text-decoration-none icon-link icon-link-hover">
Полные правила
<x-icon path="i.arrow-right" class="bi"/>
Expand Down

0 comments on commit 7d02ed4

Please sign in to comment.