From 8609f020cee590955890d422366ce9d286cfb287 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Mon, 2 Oct 2023 17:17:28 +0200 Subject: [PATCH 01/59] Adding time to Announcements for #530 --- src/resources/views/events/home.blade.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/resources/views/events/home.blade.php b/src/resources/views/events/home.blade.php index d82e23db..81df510b 100644 --- a/src/resources/views/events/home.blade.php +++ b/src/resources/views/events/home.blade.php @@ -78,7 +78,12 @@
@lang('events.noannouncements')
@else @foreach ($event->announcements as $announcement) -
{{ $announcement->message }}
+
+ {{ $announcement->message }} + + {{ $announcement->created_at->format('M d, h:s A') }} + +
@endforeach @endif From 95f85b57a00675986de38474c5b8f56ed7abd4a7 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Tue, 3 Oct 2023 15:02:36 +0200 Subject: [PATCH 02/59] Fixing BUG #528 by creating a purchase and resulting, checking for a ticket in purchases --- .../Admin/Events/EventsController.php | 26 ++++++++++- .../views/admin/purchases/show.blade.php | 45 ++++++++++++++----- .../views/admin/users/show.blade.php | 24 ++++++++-- 3 files changed, 78 insertions(+), 17 deletions(-) diff --git a/src/app/Http/Controllers/Admin/Events/EventsController.php b/src/app/Http/Controllers/Admin/Events/EventsController.php index d62a4684..3ced023c 100644 --- a/src/app/Http/Controllers/Admin/Events/EventsController.php +++ b/src/app/Http/Controllers/Admin/Events/EventsController.php @@ -12,6 +12,7 @@ use App\EventParticipant; use App\EventTicket; use App\EventAnnouncement; +use App\Purchase; use App\Http\Requests; use App\Http\Controllers\Controller; @@ -236,13 +237,28 @@ public function destroy(Event $event) */ public function freeGift(Request $request, Event $event) { + $purchase = new Purchase(); + $purchase->user_id = $request->user_id; + $purchase->type = 'free'; + $purchase->status = "Success"; + $purchase->transaction_id = "Granted by ". $request->user()->username; + + ; + $purchase->setSuccess(); + + if (!$purchase->save()) { + Session::flash('alert-danger', 'Could not save "free" purchase!'); + } + $participant = new EventParticipant(); $participant->user_id = $request->user_id; $participant->event_id = $event->id; $participant->free = 1; $participant->staff_free_assigned_by = Auth::id(); + $participant->purchase_id = $purchase->id; $participant->generateQRCode(); - + + if (!$participant->save()) { Session::flash('alert-danger', 'Could not add Gift!'); return Redirect::to('admin/events/' . $event->slug . '/tickets'); @@ -260,12 +276,20 @@ public function freeGift(Request $request, Event $event) */ public function freeStaff(Request $request, Event $event) { + $purchase = new Purchase(); + $purchase->user_id = $request->user_id; + $purchase->type = 'free'; + $purchase->status = "Success"; + $purchase->transaction_id = "Appointed by ". $request->user()->username; + + $purchase->setSuccess(); $participant = new EventParticipant(); $participant->user_id = $request->user_id; $participant->event_id = $event->id; $participant->staff = 1; $participant->staff_free_assigned_by = Auth::id(); + $participant->purchase_id = $purchase->id; $participant->generateQRCode(); if (!$participant->save()) { diff --git a/src/resources/views/admin/purchases/show.blade.php b/src/resources/views/admin/purchases/show.blade.php index 890c5cfa..266c471d 100644 --- a/src/resources/views/admin/purchases/show.blade.php +++ b/src/resources/views/admin/purchases/show.blade.php @@ -69,23 +69,44 @@ @elseif (!$purchase->participants->isEmpty()) @foreach ($purchase->participants as $participant) - - {{ $participant->ticket->name }} for {{ $participant->event->display_name }} - + + @if($participant->ticket) + {{ $participant->ticket->name }} for {{ $participant->event->display_name }} + @endif + @php + $labels = []; + if ($participant->free == 1) { + $labels[] = 'Freebie Ticket'; + } + if ($participant->staff == 1) { + $labels[] = 'Staff Ticket'; + } + @endphp + @if (!empty($labels)) + {{ implode(', ', $labels) }} for + {{ $participant->event->display_name }} + @endif + + 1 - @if ($participant->ticket->price != null) - {{ Settings::getCurrencySymbol() }}{{ $participant->ticket->price }} - @if ($participant->ticket->price_credit != null && Settings::isCreditEnabled()) - / - @endif - @endif - @if ($participant->ticket->price_credit != null && Settings::isCreditEnabled()) - {{ $item->price_credit }} Credits - @endif + @if($participant->ticket) + @if ($participant->ticket->price != null) + {{ Settings::getCurrencySymbol() }}{{ $participant->ticket->price }} + @if ($participant->ticket->price_credit != null && Settings::isCreditEnabled()) + / + @endif + @endif + @if ($participant->ticket->price_credit != null && Settings::isCreditEnabled()) + {{ $participant->ticket->price_credit }} Credits + @endif + @else + 0,- {{ Settings::getCurrencySymbol() }} + @endif + @endforeach @endif diff --git a/src/resources/views/admin/users/show.blade.php b/src/resources/views/admin/users/show.blade.php index eb025762..f9833ec4 100644 --- a/src/resources/views/admin/users/show.blade.php +++ b/src/resources/views/admin/users/show.blade.php @@ -90,10 +90,26 @@ @if (!$purchase->participants->isEmpty()) @foreach ($purchase->participants as $participant) - {{ $participant->event->display_name }} - {{ $participant->ticket->name }} - @if (!$loop->last) -
- @endif + {{ $participant->event->display_name }} - + @php + $labels = []; + if ($participant->ticket) { + $labels[] = $participant->ticket->name; + } + if ($participant->free == 1) { + $labels[] = 'Freebie'; + } + if ($participant->staff == 1) { + $labels[] = 'Admin'; + } + if (empty($labels)) { + $labels[] = 'No Ticket!'; + } + @endphp + {{ implode(', ', $labels) }} + @if (!$loop->last) +
+ @endif @endforeach @elseif ($purchase->order != null) @foreach ($purchase->order->items as $item) From 9f66ab6d5a18c5aef7b9a77cec1c5ce867609ee0 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Wed, 4 Oct 2023 09:56:47 +0200 Subject: [PATCH 03/59] Introducing new Attributes to Event for Staff and Freebie Tournament participation --- src/app/Event.php | 6 +++- .../Admin/Events/EventsController.php | 4 +++ .../2023_10_03_131811_matchmaking_staff.php | 33 +++++++++++++++++++ ...2023_10_03_131817_matchmaking_freebies.php | 32 ++++++++++++++++++ .../views/admin/events/show.blade.php | 14 ++++++++ 5 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 src/database/migrations/2023_10_03_131811_matchmaking_staff.php create mode 100644 src/database/migrations/2023_10_03_131817_matchmaking_freebies.php diff --git a/src/app/Event.php b/src/app/Event.php index 5ff74e40..401c3766 100644 --- a/src/app/Event.php +++ b/src/app/Event.php @@ -37,7 +37,11 @@ class Event extends Model 'seating_cap', 'spectator_cap', 'ticket_spectator', - 'ticket_weekend' + 'ticket_weekend', + 'private_participants', + 'matchmaking_enabled', + 'matchmaking_freebies', + 'matchmaking_staff' ]; /** diff --git a/src/app/Http/Controllers/Admin/Events/EventsController.php b/src/app/Http/Controllers/Admin/Events/EventsController.php index 3ced023c..58f1d464 100644 --- a/src/app/Http/Controllers/Admin/Events/EventsController.php +++ b/src/app/Http/Controllers/Admin/Events/EventsController.php @@ -99,6 +99,8 @@ public function store(Request $request) $event->online_event = ($request->online_event ? true : false); $event->private_participants = ($request->private_participants ? true : false); $event->matchmaking_enabled = ($request->matchmaking_enabled ? true : false); + $event->matchmaking_reebies = ($request->matchmaking_freebies ? true : false); + $event->matchmaking_staff = ($request->matchmaking_staff ? true : false); if (!$event->save()) { Session::flash('alert-danger', 'Cannot Save Event!'); @@ -194,6 +196,8 @@ public function update(Event $event, Request $request) $event->online_event = ($request->online_event ? true : false); $event->private_participants = ($request->private_participants ? true : false); $event->matchmaking_enabled = ($request->matchmaking_enabled ? true : false); + $event->matchmaking_freebies = ($request->matchmaking_freebies ? true : false); + $event->matchmaking_staff = ($request->matchmaking_staff ? true : false); if (isset($request->capacity)) { $event->capacity = $request->capacity; diff --git a/src/database/migrations/2023_10_03_131811_matchmaking_staff.php b/src/database/migrations/2023_10_03_131811_matchmaking_staff.php new file mode 100644 index 00000000..a53a236d --- /dev/null +++ b/src/database/migrations/2023_10_03_131811_matchmaking_staff.php @@ -0,0 +1,33 @@ +boolean('matchmaking_staff')->after('private_participants')->default(false); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('events', function (Blueprint $table) { + $table->dropColumn('matchmaking_staff'); + }); + } +}; diff --git a/src/database/migrations/2023_10_03_131817_matchmaking_freebies.php b/src/database/migrations/2023_10_03_131817_matchmaking_freebies.php new file mode 100644 index 00000000..579f770a --- /dev/null +++ b/src/database/migrations/2023_10_03_131817_matchmaking_freebies.php @@ -0,0 +1,32 @@ +boolean('matchmaking_freebies')->after('matchmaking_staff')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('events', function (Blueprint $table) { + $table->dropColumn('matchmaking_freebies'); + }); + } +}; diff --git a/src/resources/views/admin/events/show.blade.php b/src/resources/views/admin/events/show.blade.php index 0e0aea17..86e906db 100644 --- a/src/resources/views/admin/events/show.blade.php +++ b/src/resources/views/admin/events/show.blade.php @@ -139,6 +139,20 @@ +
+
+ +
+
+
+
+ +
+
From 56f70643f4a18580371f2f09b80d00ceac91089f Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Wed, 4 Oct 2023 10:43:40 +0200 Subject: [PATCH 04/59] Changed the position of the new colums after matchmaking_enabled for convinience --- src/database/migrations/2023_10_03_131811_matchmaking_staff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/database/migrations/2023_10_03_131811_matchmaking_staff.php b/src/database/migrations/2023_10_03_131811_matchmaking_staff.php index a53a236d..a3327d24 100644 --- a/src/database/migrations/2023_10_03_131811_matchmaking_staff.php +++ b/src/database/migrations/2023_10_03_131811_matchmaking_staff.php @@ -14,7 +14,7 @@ public function up() { Schema::table('events', function (Blueprint $table) { - $table->boolean('matchmaking_staff')->after('private_participants')->default(false); + $table->boolean('matchmaking_staff')->after('matchmaking_enabled')->default(false); }); } From 8e8cef78721f317bdfff55e4178570bc4b329c09 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Wed, 4 Oct 2023 11:04:03 +0200 Subject: [PATCH 05/59] Refactored matchmaking_staff and freebies to tournaments_.. because matchmaking was simply the wrong name --- src/app/Event.php | 4 ++-- .../Controllers/Admin/Events/EventsController.php | 8 ++++---- .../Controllers/Events/TournamentsController.php | 12 ++++++++++++ ...f.php => 2023_10_03_131811_tournaments_staff.php} | 4 ++-- ...hp => 2023_10_03_131817_tournaments_freebies.php} | 4 ++-- src/resources/views/admin/events/index.blade.php | 10 ++++++++++ src/resources/views/admin/events/show.blade.php | 4 ++-- 7 files changed, 34 insertions(+), 12 deletions(-) rename src/database/migrations/{2023_10_03_131811_matchmaking_staff.php => 2023_10_03_131811_tournaments_staff.php} (83%) rename src/database/migrations/{2023_10_03_131817_matchmaking_freebies.php => 2023_10_03_131817_tournaments_freebies.php} (78%) diff --git a/src/app/Event.php b/src/app/Event.php index 401c3766..f22bf85a 100644 --- a/src/app/Event.php +++ b/src/app/Event.php @@ -40,8 +40,8 @@ class Event extends Model 'ticket_weekend', 'private_participants', 'matchmaking_enabled', - 'matchmaking_freebies', - 'matchmaking_staff' + 'tournaments_freebies', + 'tournaments_staff' ]; /** diff --git a/src/app/Http/Controllers/Admin/Events/EventsController.php b/src/app/Http/Controllers/Admin/Events/EventsController.php index 58f1d464..51b2f28b 100644 --- a/src/app/Http/Controllers/Admin/Events/EventsController.php +++ b/src/app/Http/Controllers/Admin/Events/EventsController.php @@ -99,8 +99,8 @@ public function store(Request $request) $event->online_event = ($request->online_event ? true : false); $event->private_participants = ($request->private_participants ? true : false); $event->matchmaking_enabled = ($request->matchmaking_enabled ? true : false); - $event->matchmaking_reebies = ($request->matchmaking_freebies ? true : false); - $event->matchmaking_staff = ($request->matchmaking_staff ? true : false); + $event->matchmaking_reebies = ($request->tournaments_freebies ? true : false); + $event->tournaments_staff = ($request->tournaments_staff ? true : false); if (!$event->save()) { Session::flash('alert-danger', 'Cannot Save Event!'); @@ -196,8 +196,8 @@ public function update(Event $event, Request $request) $event->online_event = ($request->online_event ? true : false); $event->private_participants = ($request->private_participants ? true : false); $event->matchmaking_enabled = ($request->matchmaking_enabled ? true : false); - $event->matchmaking_freebies = ($request->matchmaking_freebies ? true : false); - $event->matchmaking_staff = ($request->matchmaking_staff ? true : false); + $event->tournaments_freebies = ($request->tournaments_freebies ? true : false); + $event->tournaments_staff = ($request->tournaments_staff ? true : false); if (isset($request->capacity)) { $event->capacity = $request->capacity; diff --git a/src/app/Http/Controllers/Events/TournamentsController.php b/src/app/Http/Controllers/Events/TournamentsController.php index 3ad368cb..d347fb97 100644 --- a/src/app/Http/Controllers/Events/TournamentsController.php +++ b/src/app/Http/Controllers/Events/TournamentsController.php @@ -83,6 +83,18 @@ public function registerSingle(Event $event, EventTournament $tournament, Reques return Redirect::back(); } + // Check if staff is trying to register and tournaments_staff is set to 0 + if ($tournament->event->eventParticipants()->where('id', $request->event_participant_id)->first()->staff && !$event->tournaments_staff) { + Session::flash('alert-danger', __('events.staff_not_permitted_for_matchmaking')); + return Redirect::back(); + } + + // Check if a freebie is trying to register and matchmaking_freebie is set to 0 + if ($tournament->event->eventParticipants()->where('id', $request->event_participant_id)->first()->freebie && !$event->matchmaking_freebie) { + Session::flash('alert-danger', __('events.freebie_not_permitted_for_matchmaking')); + return Redirect::back(); + } + if ( isset($request->event_tournament_team_id) && $tournamentTeam = $tournament->tournamentTeams()->where('id', $request->event_tournament_team_id)->first() diff --git a/src/database/migrations/2023_10_03_131811_matchmaking_staff.php b/src/database/migrations/2023_10_03_131811_tournaments_staff.php similarity index 83% rename from src/database/migrations/2023_10_03_131811_matchmaking_staff.php rename to src/database/migrations/2023_10_03_131811_tournaments_staff.php index a3327d24..37f38091 100644 --- a/src/database/migrations/2023_10_03_131811_matchmaking_staff.php +++ b/src/database/migrations/2023_10_03_131811_tournaments_staff.php @@ -14,7 +14,7 @@ public function up() { Schema::table('events', function (Blueprint $table) { - $table->boolean('matchmaking_staff')->after('matchmaking_enabled')->default(false); + $table->boolean('tournaments_staff')->after('matchmaking_enabled')->default(false); }); } @@ -27,7 +27,7 @@ public function up() public function down() { Schema::table('events', function (Blueprint $table) { - $table->dropColumn('matchmaking_staff'); + $table->dropColumn('tournaments_staff'); }); } }; diff --git a/src/database/migrations/2023_10_03_131817_matchmaking_freebies.php b/src/database/migrations/2023_10_03_131817_tournaments_freebies.php similarity index 78% rename from src/database/migrations/2023_10_03_131817_matchmaking_freebies.php rename to src/database/migrations/2023_10_03_131817_tournaments_freebies.php index 579f770a..a198bd6d 100644 --- a/src/database/migrations/2023_10_03_131817_matchmaking_freebies.php +++ b/src/database/migrations/2023_10_03_131817_tournaments_freebies.php @@ -14,7 +14,7 @@ public function up() { Schema::table('events', function (Blueprint $table) { - $table->boolean('matchmaking_freebies')->after('matchmaking_staff')->default(false); + $table->boolean('tournaments_freebies')->after('tournaments_staff')->default(false); }); } @@ -26,7 +26,7 @@ public function up() public function down() { Schema::table('events', function (Blueprint $table) { - $table->dropColumn('matchmaking_freebies'); + $table->dropColumn('tournaments_freebies'); }); } }; diff --git a/src/resources/views/admin/events/index.blade.php b/src/resources/views/admin/events/index.blade.php index 33b18dc0..61bb573a 100644 --- a/src/resources/views/admin/events/index.blade.php +++ b/src/resources/views/admin/events/index.blade.php @@ -137,6 +137,16 @@ {{ Form::checkbox('private_participants', null, false, array('id'=>'private_participants')) }} Private participants (show participants only to participants)
+
+ +
+
+ +
+ +
+
+ +
+
-
-
- -
-
- @if ($eventTags)
diff --git a/src/resources/views/admin/events/show.blade.php b/src/resources/views/admin/events/show.blade.php index 1a613ff4..25196045 100644 --- a/src/resources/views/admin/events/show.blade.php +++ b/src/resources/views/admin/events/show.blade.php @@ -142,14 +142,14 @@
From 979e529769f3224065fc2b8570cc0ee083675991 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Wed, 4 Oct 2023 13:23:20 +0200 Subject: [PATCH 07/59] Final implementation for #416 and fixing some typos + lang for en and de --- src/app/EventParticipant.php | 2 ++ .../Events/TournamentsController.php | 28 +++++++++++-------- src/lang/de/events.php | 2 ++ src/lang/en/events.php | 4 +-- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/app/EventParticipant.php b/src/app/EventParticipant.php index 3b8f53c7..da0e4747 100644 --- a/src/app/EventParticipant.php +++ b/src/app/EventParticipant.php @@ -34,6 +34,8 @@ class EventParticipant extends Model 'event_id', 'ticket_id', 'purchase_id', + 'staff', + 'free', ]; public static function boot() diff --git a/src/app/Http/Controllers/Events/TournamentsController.php b/src/app/Http/Controllers/Events/TournamentsController.php index f1bd5f07..30f63a81 100644 --- a/src/app/Http/Controllers/Events/TournamentsController.php +++ b/src/app/Http/Controllers/Events/TournamentsController.php @@ -72,6 +72,8 @@ public function registerSingle(Event $event, EventTournament $tournament, Reques Session::flash('alert-danger', __('events.tournament_signups_not_permitted')); return Redirect::back(); } + + if (!$tournament->event->eventParticipants()->where('id', $request->event_participant_id)->first()) { Session::flash('alert-danger', __('events.tournament_not_signed_in')); @@ -83,18 +85,6 @@ public function registerSingle(Event $event, EventTournament $tournament, Reques return Redirect::back(); } - // Check if staff is trying to register - if ($tournament->event->eventParticipants()->where('id', $request->event_participant_id)->first()->staff && !$event->tournaments_staff) { - Session::flash('alert-danger', __('events.staff_not_permitted_for_matchmaking')); - return Redirect::back(); - } - - // Check if a freebie is trying to register - if ($tournament->event->eventParticipants()->where('id', $request->event_participant_id)->first()->freebie && !$event->tournaments_freebie) { - Session::flash('alert-danger', __('events.freebie_not_permitted_for_matchmaking')); - return Redirect::back(); - } - if ( isset($request->event_tournament_team_id) && $tournamentTeam = $tournament->tournamentTeams()->where('id', $request->event_tournament_team_id)->first() @@ -115,6 +105,20 @@ public function registerSingle(Event $event, EventTournament $tournament, Reques } + // Get the EventParticipant only Once is better? + $eventParticipant = $event->eventParticipants()->where('id', $request->event_participant_id)->first(); + // Check if staff is trying to register + if ($eventParticipant->staff && !$event->tournaments_staff) { + Session::flash('alert-danger', __('events.tournament_staff_not_permitted')); + return Redirect::back(); + } + + // Check if a freebie is trying to register + if ($eventParticipant->free && !$event->tournaments_freebie) { + Session::flash('alert-danger', __('events.tournament_freebie_not_permitted')); + return Redirect::back(); + } + // TODO - Refactor $tournamentParticipant = new EventTournamentParticipant(); $tournamentParticipant->event_participant_id = $request->event_participant_id; diff --git a/src/lang/de/events.php b/src/lang/de/events.php index a82b2d11..236e1b56 100644 --- a/src/lang/de/events.php +++ b/src/lang/de/events.php @@ -117,6 +117,8 @@ 'tournament_cannot_remove' => 'Löschvorgang konnte nicht abgeschlossen werden. Bitte versuch es erneut.', 'tournament_sucessfully_removed' => 'Du wurdest erfolgreich vom Turnier abgemeldet.', 'tournament_cannot_join_thirdparty' => 'Du kannst dich für dieses Turnier nicht anmelden, da die notwendige Authentifizierung zu einem Drittherstellerdienst in deinem Konto nicht hergestellt ist. Prüfe die Single Sign-On Einstellungen in deinem Profil', + 'tournament_staff_not_permitted' => 'Die Teilnahme an Turnieren von Orgas ist auf diesem Event nicht erlaubt', + 'tournament_freebie_not_permitted' => 'Die Teilnahme an Turnieren von Freebies ist auf diesem Event nicht erlaubt', /* Ticket Partial*/ 'remove_seating' => 'Sitzplatz entfernen', ]; diff --git a/src/lang/en/events.php b/src/lang/en/events.php index d0f103ed..4f4fe941 100644 --- a/src/lang/en/events.php +++ b/src/lang/en/events.php @@ -117,8 +117,8 @@ 'tournament_cannot_remove' => 'Cannot remove. Please try again.', 'tournament_sucessfully_removed' => 'You have been successfully removed from the Tournament.', 'tournament_cannot_join_thirdparty' => 'you cannot sign up for this tournament because the nessecary third party account link on your user is missing. Please check your signle sign-on settings in your profile.', - 'tornament_staff_not_permitted' => 'Tournament participation of staff members is not allowed at this event.', - 'tornament_freebies_not_permitted' => 'Tournament participation of freebies is not allowed at this event.', + 'tournament_staff_not_permitted' => 'Tournament participation of staff members is not allowed at this event.', + 'tournament_freebie_not_permitted' => 'Tournament participation of freebies is not allowed at this event.', /* Ticket Partial*/ 'remove_seating' => 'Remove Seating', ]; From ef0a4e45335b6402ab514d7b0029a97d7027384c Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Wed, 4 Oct 2023 14:29:39 +0200 Subject: [PATCH 08/59] Slight Improvement for Tournaments on the home screen of running events #529 --- src/resources/views/events/home.blade.php | 64 ++++++++++++----------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/resources/views/events/home.blade.php b/src/resources/views/events/home.blade.php index 81df510b..131bfa84 100644 --- a/src/resources/views/events/home.blade.php +++ b/src/resources/views/events/home.blade.php @@ -332,40 +332,20 @@ function copyToClipBoard(inputId) {
-
- @if ($tournament->game && $tournament->game->image_thumbnail_path) - - - - {{ $tournament->game->name }} - - @endif -

{{ $tournament->name }}

-
+ @if ($tournament->game && $tournament->game->image_thumbnail_path) + + + + {{ $tournament->game->name }} + + @endif
+
+

{{ $tournament->name }}

+
- - @if ($tournament->status == 'COMPLETE') - @lang('events.ended') - @endif - @if ($tournament->status == 'LIVE') - @lang('events.live') - @endif - @if ($tournament->status != 'COMPLETE' && $user && $user->active_event_participant && !$tournament->getParticipant($user->active_event_participant->id)) - @lang('events.notsignedup') - @endif - @if ($tournament->status != 'COMPLETE' && $user && $user->active_event_participant && $tournament->getParticipant($user->active_event_participant->id)) - @lang('events.signedup') - @endif - @if ($tournament->status != 'COMPLETE' && $user && !$user->active_event_participant && $user->getAllTickets($event->id)->isEmpty()) - @lang('events.purchaseticketosignup') - @else - @if ($tournament->status != 'COMPLETE' && $user && !$user->active_event_participant && !$event->online_event) - @lang('events.signuponlywhenlive') - @endif - @endif - + @if ($tournament->status != 'COMPLETE')
@@ -448,6 +428,28 @@ function copyToClipBoard(inputId) {
+ +
+
From 8236c99231fe1da4827ca81cd331cb7645aa2643 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Wed, 4 Oct 2023 14:47:28 +0200 Subject: [PATCH 09/59] Add Event Name to User Profile EventParticipant Ticket Partial --- src/resources/views/layouts/_partials/_tickets/index.blade.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/resources/views/layouts/_partials/_tickets/index.blade.php b/src/resources/views/layouts/_partials/_tickets/index.blade.php index 7b4b0940..d1da883f 100644 --- a/src/resources/views/layouts/_partials/_tickets/index.blade.php +++ b/src/resources/views/layouts/_partials/_tickets/index.blade.php @@ -1,5 +1,8 @@
+ + {{ $participant->event->display_name }} + @if ($participant->ticket) {{ $participant->ticket->name }} @if ($participant->ticket && $participant->ticket->seatable) - @lang('events.seat'): @if ($participant->seat) {{$participant->seat->seat}} in {{$participant->seat->seatingPlan->name}} @else @lang('events.notseated') @endif @endif @else From 0c7a51048934cd2db5e6d5db35d7addeb9c5fb16 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Thu, 5 Oct 2023 15:55:34 +0200 Subject: [PATCH 10/59] Simple Sign In/Out on the overview page and better sorting of freebies --- .../Admin/Events/ParticipantsController.php | 18 +++++++++++++++++- src/app/Http/routes.php | 1 + .../admin/events/participants/index.blade.php | 13 +++++++++++++ .../admin/events/participants/show.blade.php | 10 +++++++++- .../admin/events/tickets/index.blade.php | 19 +++++++++++++++++-- 5 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php index 8fa26437..bc76598d 100644 --- a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php +++ b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php @@ -72,7 +72,7 @@ public function signIn(Event $event, EventParticipant $participant) return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); } Session::flash('alert-success', 'Participant Signed in!'); - return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); } public function transfer(Event $event, EventParticipant $participant, Request $request) @@ -120,6 +120,22 @@ public function signoutall(Event $event) return Redirect::to('admin/events/' . $event->slug . '/participants/'); } + /** + * Sign out a single participant for the event + * @param Event $event + * @param EventParticipant $participant + * @return View + */ + public function signout(Event $event, EventParticipant $participant) + { + if (!$event->getEventParticipant($participant->id)->setSignIn(false)) { + Session::flash('alert-danger', 'Cannot sign out Participant! '. $participant->name); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } + + Session::flash('alert-success', 'Participant ' . $participant->name . ' signed out!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } diff --git a/src/app/Http/routes.php b/src/app/Http/routes.php index bc5b6f4a..d71f260d 100644 --- a/src/app/Http/routes.php +++ b/src/app/Http/routes.php @@ -459,6 +459,7 @@ */ Route::get('/admin/events/{event}/participants', 'Admin\Events\ParticipantsController@index'); Route::get('/admin/events/{event}/participants/signoutall', 'Admin\Events\ParticipantsController@signoutall'); + Route::get('/admin/events/{event}/participants/{participant}/signout', 'Admin\Events\ParticipantsController@signout'); Route::get('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@show'); Route::post('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@update'); Route::post( diff --git a/src/resources/views/admin/events/participants/index.blade.php b/src/resources/views/admin/events/participants/index.blade.php index 9e0fbd04..0abe8ca3 100644 --- a/src/resources/views/admin/events/participants/index.blade.php +++ b/src/resources/views/admin/events/participants/index.blade.php @@ -97,6 +97,19 @@ + + @if(!$participant->signed_in) + {{ Form::open(array('url'=>'/admin/events/' . $event->slug . '/participants/' . $participant->id . '/signin')) }} + + + + {{ Form::close() }} + @else + + + + @endif + @endforeach diff --git a/src/resources/views/admin/events/participants/show.blade.php b/src/resources/views/admin/events/participants/show.blade.php index 6ab82735..55fb7518 100644 --- a/src/resources/views/admin/events/participants/show.blade.php +++ b/src/resources/views/admin/events/participants/show.blade.php @@ -128,13 +128,21 @@ {{ Form::open(array('url'=>'/admin/events/' . $event->slug . '/participants/' . $participant->id . '/signin')) }}
-
{{ Form::close() }}
+ @else +
+ + @endif + @if ((!$participant->signed_in) && ($participant->ticket) && ($participant->purchase->status != "Success"))
complete payment to transfer or sign in the user diff --git a/src/resources/views/admin/events/tickets/index.blade.php b/src/resources/views/admin/events/tickets/index.blade.php index bd6aa9a0..b03479af 100644 --- a/src/resources/views/admin/events/tickets/index.blade.php +++ b/src/resources/views/admin/events/tickets/index.blade.php @@ -152,12 +152,27 @@
+ @php + $users = $users->sortByDesc(function($user) use ($event) { + return [ + $user->getFreeTickets($event->id)->count(), + $user->getStaffTickets($event->id)->count() + ]; + })->values(); + $totalFreeTickets = $users->sum(function($user) use ($event) { + return $user->getFreeTickets($event->id)->count(); + }); + + $totalStaffTickets = $users->sum(function($user) use ($event) { + return $user->getStaffTickets($event->id)->count(); + }); + @endphp - - + + From 95b24e03c36e03bce951a477839a4ed7cb826dcc Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Tue, 24 Oct 2023 07:46:55 +0200 Subject: [PATCH 11/59] added public/js/* to gitignore --- src/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/.gitignore b/src/.gitignore index 65fec7e6..6274b9c0 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -14,3 +14,4 @@ public/css/app\.css public/css/admin\.css\.map public/css/app\.css\.map public/uploads/gallery/ +public/js/* From fd6c3473355ef754acca6287fabb326b10908ce1 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Tue, 24 Oct 2023 07:48:24 +0200 Subject: [PATCH 12/59] gitignore specification of vendor.js and .min.js --- src/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/.gitignore b/src/.gitignore index 6274b9c0..ef328098 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -14,4 +14,5 @@ public/css/app\.css public/css/admin\.css\.map public/css/app\.css\.map public/uploads/gallery/ -public/js/* +public/js/vendor.js +public/js/vendor.min.js From 47d34c90cc13723b87a067cd1453c00f4564a645 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Tue, 24 Oct 2023 07:49:16 +0200 Subject: [PATCH 13/59] use the correct .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cfb735cf..f36f64e4 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ docs/build docker-compose.local.yml docker-compose-dev.local.yml -dbfile.sql \ No newline at end of file +dbfile.sql +src/public/js/vendor.js +src/public/js/vendor.min.js From c883f48a46f46ab146ad2332297802de375172ca Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Tue, 24 Oct 2023 07:53:03 +0200 Subject: [PATCH 14/59] Stopped tracking compiled JS assets --- src/public/js/vendor.js | 1 - src/public/js/vendor.min.js | 1 - 2 files changed, 2 deletions(-) delete mode 100644 src/public/js/vendor.js delete mode 100644 src/public/js/vendor.min.js diff --git a/src/public/js/vendor.js b/src/public/js/vendor.js deleted file mode 100644 index c14c2fa4..00000000 --- a/src/public/js/vendor.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,(function(t,e){"use strict";var i=[],n=Object.getPrototypeOf,o=i.slice,s=i.flat?function(t){return i.flat.call(t)}:function(t){return i.concat.apply([],t)},r=i.push,a=i.indexOf,l={},c=l.toString,u=l.hasOwnProperty,h=u.toString,d=h.call(Object),f={},p=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType&&"function"!=typeof t.item},m=function(t){return null!=t&&t===t.window},g=t.document,v={type:!0,src:!0,nonce:!0,noModule:!0};function b(t,e,i){var n,o,s=(i=i||g).createElement("script");if(s.text=t,e)for(n in v)(o=e[n]||e.getAttribute&&e.getAttribute(n))&&s.setAttribute(n,o);i.head.appendChild(s).parentNode.removeChild(s)}function y(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?l[c.call(t)]||"object":typeof t}var _="3.7.1",w=/HTML$/i,k=function(t,e){return new k.fn.init(t,e)};function x(t){var e=!!t&&"length"in t&&t.length,i=y(t);return!p(t)&&!m(t)&&("array"===i||0===e||"number"==typeof e&&e>0&&e-1 in t)}function C(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}k.fn=k.prototype={jquery:_,constructor:k,length:0,toArray:function(){return o.call(this)},get:function(t){return null==t?o.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=k.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return k.each(this,t)},map:function(t){return this.pushStack(k.map(this,(function(e,i){return t.call(e,i,e)})))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(k.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(k.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,i=+t+(t<0?e:0);return this.pushStack(i>=0&&i+~]|"+E+")"+E+"*"),B=new RegExp(E+"|>"),$=new RegExp(R),W=new RegExp("^"+H+"$"),q={ID:new RegExp("^#("+H+")"),CLASS:new RegExp("^\\.("+H+")"),TAG:new RegExp("^("+H+"|[*])"),ATTR:new RegExp("^"+L),PSEUDO:new RegExp("^"+R),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),bool:new RegExp("^(?:"+O+")$","i"),needsContext:new RegExp("^"+E+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)","i")},U=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,V=/[+~]/,X=new RegExp("\\\\[\\da-fA-F]{1,6}"+E+"?|\\\\([^\\r\\n\\f])","g"),G=function(t,e){var i="0x"+t.slice(1)-65536;return e||(i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320))},Q=function(){lt()},Z=dt((function(t){return!0===t.disabled&&C(t,"fieldset")}),{dir:"parentNode",next:"legend"});try{g.apply(i=o.call(N.childNodes),N.childNodes),i[N.childNodes.length].nodeType}catch(t){g={apply:function(t,e){M.apply(t,o.call(e))},call:function(t){M.apply(t,o.call(arguments,1))}}}function J(t,e,i,n){var o,s,r,a,l,u,h,m=e&&e.ownerDocument,b=e?e.nodeType:9;if(i=i||[],"string"!=typeof t||!t||1!==b&&9!==b&&11!==b)return i;if(!n&&(lt(e),e=e||c,d)){if(11!==b&&(l=K.exec(t)))if(o=l[1]){if(9===b){if(!(r=e.getElementById(o)))return i;if(r.id===o)return g.call(i,r),i}else if(m&&(r=m.getElementById(o))&&J.contains(e,r)&&r.id===o)return g.call(i,r),i}else{if(l[2])return g.apply(i,e.getElementsByTagName(t)),i;if((o=l[3])&&e.getElementsByClassName)return g.apply(i,e.getElementsByClassName(o)),i}if(!(P[t+" "]||p&&p.test(t))){if(h=t,m=e,1===b&&(B.test(t)||j.test(t))){for((m=V.test(t)&&at(e.parentNode)||e)==e&&f.scope||((a=e.getAttribute("id"))?a=k.escapeSelector(a):e.setAttribute("id",a=v)),s=(u=ut(t)).length;s--;)u[s]=(a?"#"+a:":scope")+" "+ht(u[s]);h=u.join(",")}try{return g.apply(i,m.querySelectorAll(h)),i}catch(e){P(t,!0)}finally{a===v&&e.removeAttribute("id")}}}return bt(t.replace(I,"$1"),e,i,n)}function tt(){var t=[];return function e(i,o){return t.push(i+" ")>n.cacheLength&&delete e[t.shift()],e[i+" "]=o}}function et(t){return t[v]=!0,t}function it(t){var e=c.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function nt(t){return function(e){return C(e,"input")&&e.type===t}}function ot(t){return function(e){return(C(e,"input")||C(e,"button"))&&e.type===t}}function st(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&Z(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function rt(t){return et((function(e){return e=+e,et((function(i,n){for(var o,s=t([],i.length,e),r=s.length;r--;)i[o=s[r]]&&(i[o]=!(n[o]=i[o]))}))}))}function at(t){return t&&void 0!==t.getElementsByTagName&&t}function lt(t){var e,i=t?t.ownerDocument||t:N;return i!=c&&9===i.nodeType&&i.documentElement?(h=(c=i).documentElement,d=!k.isXMLDoc(c),m=h.matches||h.webkitMatchesSelector||h.msMatchesSelector,h.msMatchesSelector&&N!=c&&(e=c.defaultView)&&e.top!==e&&e.addEventListener("unload",Q),f.getById=it((function(t){return h.appendChild(t).id=k.expando,!c.getElementsByName||!c.getElementsByName(k.expando).length})),f.disconnectedMatch=it((function(t){return m.call(t,"*")})),f.scope=it((function(){return c.querySelectorAll(":scope")})),f.cssHas=it((function(){try{return c.querySelector(":has(*,:jqfake)"),!1}catch(t){return!0}})),f.getById?(n.filter.ID=function(t){var e=t.replace(X,G);return function(t){return t.getAttribute("id")===e}},n.find.ID=function(t,e){if(void 0!==e.getElementById&&d){var i=e.getElementById(t);return i?[i]:[]}}):(n.filter.ID=function(t){var e=t.replace(X,G);return function(t){var i=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return i&&i.value===e}},n.find.ID=function(t,e){if(void 0!==e.getElementById&&d){var i,n,o,s=e.getElementById(t);if(s){if((i=s.getAttributeNode("id"))&&i.value===t)return[s];for(o=e.getElementsByName(t),n=0;s=o[n++];)if((i=s.getAttributeNode("id"))&&i.value===t)return[s]}return[]}}),n.find.TAG=function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):e.querySelectorAll(t)},n.find.CLASS=function(t,e){if(void 0!==e.getElementsByClassName&&d)return e.getElementsByClassName(t)},p=[],it((function(t){var e;h.appendChild(t).innerHTML="",t.querySelectorAll("[selected]").length||p.push("\\["+E+"*(?:value|"+O+")"),t.querySelectorAll("[id~="+v+"-]").length||p.push("~="),t.querySelectorAll("a#"+v+"+*").length||p.push(".#.+[+~]"),t.querySelectorAll(":checked").length||p.push(":checked"),(e=c.createElement("input")).setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),h.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&p.push(":enabled",":disabled"),(e=c.createElement("input")).setAttribute("name",""),t.appendChild(e),t.querySelectorAll("[name='']").length||p.push("\\["+E+"*name"+E+"*="+E+"*(?:''|\"\")")})),f.cssHas||p.push(":has"),p=p.length&&new RegExp(p.join("|")),A=function(t,e){if(t===e)return l=!0,0;var i=!t.compareDocumentPosition-!e.compareDocumentPosition;return i||(1&(i=(t.ownerDocument||t)==(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!f.sortDetached&&e.compareDocumentPosition(t)===i?t===c||t.ownerDocument==N&&J.contains(N,t)?-1:e===c||e.ownerDocument==N&&J.contains(N,e)?1:r?a.call(r,t)-a.call(r,e):0:4&i?-1:1)},c):c}for(e in J.matches=function(t,e){return J(t,null,null,e)},J.matchesSelector=function(t,e){if(lt(t),d&&!P[e+" "]&&(!p||!p.test(e)))try{var i=m.call(t,e);if(i||f.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){P(e,!0)}return J(e,c,null,[t]).length>0},J.contains=function(t,e){return(t.ownerDocument||t)!=c&<(t),k.contains(t,e)},J.attr=function(t,e){(t.ownerDocument||t)!=c&<(t);var i=n.attrHandle[e.toLowerCase()],o=i&&u.call(n.attrHandle,e.toLowerCase())?i(t,e,!d):void 0;return void 0!==o?o:t.getAttribute(e)},J.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},k.uniqueSort=function(t){var e,i=[],n=0,s=0;if(l=!f.sortStable,r=!f.sortStable&&o.call(t,0),S.call(t,A),l){for(;e=t[s++];)e===t[s]&&(n=i.push(s));for(;n--;)D.call(t,i[n],1)}return r=null,t},k.fn.uniqueSort=function(){return this.pushStack(k.uniqueSort(o.apply(this)))},n=k.expr={cacheLength:50,createPseudo:et,match:q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(X,G),t[3]=(t[3]||t[4]||t[5]||"").replace(X,G),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||J.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&J.error(t[0]),t},PSEUDO:function(t){var e,i=!t[6]&&t[2];return q.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":i&&$.test(i)&&(e=ut(i,!0))&&(e=i.indexOf(")",i.length-e)-i.length)&&(t[0]=t[0].slice(0,e),t[2]=i.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(X,G).toLowerCase();return"*"===t?function(){return!0}:function(t){return C(t,e)}},CLASS:function(t){var e=_[t+" "];return e||(e=new RegExp("(^|"+E+")"+t+"("+E+"|$)"))&&_(t,(function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")}))},ATTR:function(t,e,i){return function(n){var o=J.attr(n,t);return null==o?"!="===e:!e||(o+="","="===e?o===i:"!="===e?o!==i:"^="===e?i&&0===o.indexOf(i):"*="===e?i&&o.indexOf(i)>-1:"$="===e?i&&o.slice(-i.length)===i:"~="===e?(" "+o.replace(F," ")+" ").indexOf(i)>-1:"|="===e&&(o===i||o.slice(0,i.length+1)===i+"-"))}},CHILD:function(t,e,i,n,o){var s="nth"!==t.slice(0,3),r="last"!==t.slice(-4),a="of-type"===e;return 1===n&&0===o?function(t){return!!t.parentNode}:function(e,i,l){var c,u,h,d,f,p=s!==r?"nextSibling":"previousSibling",m=e.parentNode,g=a&&e.nodeName.toLowerCase(),y=!l&&!a,_=!1;if(m){if(s){for(;p;){for(h=e;h=h[p];)if(a?C(h,g):1===h.nodeType)return!1;f=p="only"===t&&!f&&"nextSibling"}return!0}if(f=[r?m.firstChild:m.lastChild],r&&y){for(_=(d=(c=(u=m[v]||(m[v]={}))[t]||[])[0]===b&&c[1])&&c[2],h=d&&m.childNodes[d];h=++d&&h&&h[p]||(_=d=0)||f.pop();)if(1===h.nodeType&&++_&&h===e){u[t]=[b,d,_];break}}else if(y&&(_=d=(c=(u=e[v]||(e[v]={}))[t]||[])[0]===b&&c[1]),!1===_)for(;(h=++d&&h&&h[p]||(_=d=0)||f.pop())&&(!(a?C(h,g):1===h.nodeType)||!++_||(y&&((u=h[v]||(h[v]={}))[t]=[b,_]),h!==e)););return(_-=o)===n||_%n==0&&_/n>=0}}},PSEUDO:function(t,e){var i,o=n.pseudos[t]||n.setFilters[t.toLowerCase()]||J.error("unsupported pseudo: "+t);return o[v]?o(e):o.length>1?(i=[t,t,"",e],n.setFilters.hasOwnProperty(t.toLowerCase())?et((function(t,i){for(var n,s=o(t,e),r=s.length;r--;)t[n=a.call(t,s[r])]=!(i[n]=s[r])})):function(t){return o(t,0,i)}):o}},pseudos:{not:et((function(t){var e=[],i=[],n=vt(t.replace(I,"$1"));return n[v]?et((function(t,e,i,o){for(var s,r=n(t,null,o,[]),a=t.length;a--;)(s=r[a])&&(t[a]=!(e[a]=s))})):function(t,o,s){return e[0]=t,n(e,null,s,i),e[0]=null,!i.pop()}})),has:et((function(t){return function(e){return J(t,e).length>0}})),contains:et((function(t){return t=t.replace(X,G),function(e){return(e.textContent||k.text(e)).indexOf(t)>-1}})),lang:et((function(t){return W.test(t||"")||J.error("unsupported lang: "+t),t=t.replace(X,G).toLowerCase(),function(e){var i;do{if(i=d?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(i=i.toLowerCase())===t||0===i.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var i=t.location&&t.location.hash;return i&&i.slice(1)===e.id},root:function(t){return t===h},focus:function(t){return t===function(){try{return c.activeElement}catch(t){}}()&&c.hasFocus()&&!!(t.type||t.href||~t.tabIndex)},enabled:st(!1),disabled:st(!0),checked:function(t){return C(t,"input")&&!!t.checked||C(t,"option")&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!n.pseudos.empty(t)},header:function(t){return Y.test(t.nodeName)},input:function(t){return U.test(t.nodeName)},button:function(t){return C(t,"input")&&"button"===t.type||C(t,"button")},text:function(t){var e;return C(t,"input")&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:rt((function(){return[0]})),last:rt((function(t,e){return[e-1]})),eq:rt((function(t,e,i){return[i<0?i+e:i]})),even:rt((function(t,e){for(var i=0;ie?e:i;--n>=0;)t.push(n);return t})),gt:rt((function(t,e,i){for(var n=i<0?i+e:i;++n1?function(e,i,n){for(var o=t.length;o--;)if(!t[o](e,i,n))return!1;return!0}:t[0]}function pt(t,e,i,n,o){for(var s,r=[],a=0,l=t.length,c=null!=e;a-1&&(s[u]=!(r[u]=d))}}else f=pt(f===r?f.splice(v,f.length):f),o?o(null,r,f,c):g.apply(r,f)}))}function gt(t){for(var e,i,o,r=t.length,l=n.relative[t[0].type],c=l||n.relative[" "],u=l?1:0,h=dt((function(t){return t===e}),c,!0),d=dt((function(t){return a.call(e,t)>-1}),c,!0),f=[function(t,i,n){var o=!l&&(n||i!=s)||((e=i).nodeType?h(t,i,n):d(t,i,n));return e=null,o}];u1&&ft(f),u>1&&ht(t.slice(0,u-1).concat({value:" "===t[u-2].type?"*":""})).replace(I,"$1"),i,u0,o=t.length>0,r=function(r,a,l,u,h){var f,p,m,v=0,y="0",_=r&&[],w=[],x=s,C=r||o&&n.find.TAG("*",h),S=b+=null==x?1:Math.random()||.1,D=C.length;for(h&&(s=a==c||a||h);y!==D&&null!=(f=C[y]);y++){if(o&&f){for(p=0,a||f.ownerDocument==c||(lt(f),l=!d);m=t[p++];)if(m(f,a||c,l)){g.call(u,f);break}h&&(b=S)}i&&((f=!m&&f)&&v--,r&&_.push(f))}if(v+=y,i&&y!==v){for(p=0;m=e[p++];)m(_,w,a,l);if(r){if(v>0)for(;y--;)_[y]||w[y]||(w[y]=T.call(u));w=pt(w)}g.apply(u,w),h&&!r&&w.length>0&&v+e.length>1&&k.uniqueSort(u)}return h&&(b=S,s=x),_};return i?et(r):r}(r,o)),a.selector=t}return a}function bt(t,e,i,o){var s,r,a,l,c,u="function"==typeof t&&t,h=!o&&ut(t=u.selector||t);if(i=i||[],1===h.length){if((r=h[0]=h[0].slice(0)).length>2&&"ID"===(a=r[0]).type&&9===e.nodeType&&d&&n.relative[r[1].type]){if(!(e=(n.find.ID(a.matches[0].replace(X,G),e)||[])[0]))return i;u&&(e=e.parentNode),t=t.slice(r.shift().value.length)}for(s=q.needsContext.test(t)?0:r.length;s--&&(a=r[s],!n.relative[l=a.type]);)if((c=n.find[l])&&(o=c(a.matches[0].replace(X,G),V.test(r[0].type)&&at(e.parentNode)||e))){if(r.splice(s,1),!(t=o.length&&ht(r)))return g.apply(i,o),i;break}}return(u||vt(t,h))(o,e,!d,i,!e||V.test(t)&&at(e.parentNode)||e),i}ct.prototype=n.filters=n.pseudos,n.setFilters=new ct,f.sortStable=v.split("").sort(A).join("")===v,lt(),f.sortDetached=it((function(t){return 1&t.compareDocumentPosition(c.createElement("fieldset"))})),k.find=J,k.expr[":"]=k.expr.pseudos,k.unique=k.uniqueSort,J.compile=vt,J.select=bt,J.setDocument=lt,J.tokenize=ut,J.escape=k.escapeSelector,J.getText=k.text,J.isXML=k.isXMLDoc,J.selectors=k.expr,J.support=k.support,J.uniqueSort=k.uniqueSort}();var O=function(t,e,i){for(var n=[],o=void 0!==i;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(o&&k(t).is(i))break;n.push(t)}return n},H=function(t,e){for(var i=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&i.push(t);return i},L=k.expr.match.needsContext,R=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function F(t,e,i){return p(e)?k.grep(t,(function(t,n){return!!e.call(t,n,t)!==i})):e.nodeType?k.grep(t,(function(t){return t===e!==i})):"string"!=typeof e?k.grep(t,(function(t){return a.call(e,t)>-1!==i})):k.filter(e,t,i)}k.filter=function(t,e,i){var n=e[0];return i&&(t=":not("+t+")"),1===e.length&&1===n.nodeType?k.find.matchesSelector(n,t)?[n]:[]:k.find.matches(t,k.grep(e,(function(t){return 1===t.nodeType})))},k.fn.extend({find:function(t){var e,i,n=this.length,o=this;if("string"!=typeof t)return this.pushStack(k(t).filter((function(){for(e=0;e1?k.uniqueSort(i):i},filter:function(t){return this.pushStack(F(this,t||[],!1))},not:function(t){return this.pushStack(F(this,t||[],!0))},is:function(t){return!!F(this,"string"==typeof t&&L.test(t)?k(t):t||[],!1).length}});var z,j=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(k.fn.init=function(t,e,i){var n,o;if(!t)return this;if(i=i||z,"string"==typeof t){if(!(n="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:j.exec(t))||!n[1]&&e)return!e||e.jquery?(e||i).find(t):this.constructor(e).find(t);if(n[1]){if(e=e instanceof k?e[0]:e,k.merge(this,k.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:g,!0)),R.test(n[1])&&k.isPlainObject(e))for(n in e)p(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}return(o=g.getElementById(n[2]))&&(this[0]=o,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):p(t)?void 0!==i.ready?i.ready(t):t(k):k.makeArray(t,this)}).prototype=k.fn,z=k(g);var B=/^(?:parents|prev(?:Until|All))/,$={children:!0,contents:!0,next:!0,prev:!0};function W(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}k.fn.extend({has:function(t){var e=k(t,this),i=e.length;return this.filter((function(){for(var t=0;t-1:1===i.nodeType&&k.find.matchesSelector(i,t))){s.push(i);break}return this.pushStack(s.length>1?k.uniqueSort(s):s)},index:function(t){return t?"string"==typeof t?a.call(k(t),this[0]):a.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(k.uniqueSort(k.merge(this.get(),k(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),k.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return O(t,"parentNode")},parentsUntil:function(t,e,i){return O(t,"parentNode",i)},next:function(t){return W(t,"nextSibling")},prev:function(t){return W(t,"previousSibling")},nextAll:function(t){return O(t,"nextSibling")},prevAll:function(t){return O(t,"previousSibling")},nextUntil:function(t,e,i){return O(t,"nextSibling",i)},prevUntil:function(t,e,i){return O(t,"previousSibling",i)},siblings:function(t){return H((t.parentNode||{}).firstChild,t)},children:function(t){return H(t.firstChild)},contents:function(t){return null!=t.contentDocument&&n(t.contentDocument)?t.contentDocument:(C(t,"template")&&(t=t.content||t),k.merge([],t.childNodes))}},(function(t,e){k.fn[t]=function(i,n){var o=k.map(this,e,i);return"Until"!==t.slice(-5)&&(n=i),n&&"string"==typeof n&&(o=k.filter(n,o)),this.length>1&&($[t]||k.uniqueSort(o),B.test(t)&&o.reverse()),this.pushStack(o)}}));var q=/[^\x20\t\r\n\f]+/g;function U(t){return t}function Y(t){throw t}function K(t,e,i,n){var o;try{t&&p(o=t.promise)?o.call(t).done(e).fail(i):t&&p(o=t.then)?o.call(t,e,i):e.apply(void 0,[t].slice(n))}catch(t){i.apply(void 0,[t])}}k.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return k.each(t.match(q)||[],(function(t,i){e[i]=!0})),e}(t):k.extend({},t);var e,i,n,o,s=[],r=[],a=-1,l=function(){for(o=o||t.once,n=e=!0;r.length;a=-1)for(i=r.shift();++a-1;)s.splice(i,1),i<=a&&a--})),this},has:function(t){return t?k.inArray(t,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return o=r=[],s=i="",this},disabled:function(){return!s},lock:function(){return o=r=[],i||e||(s=i=""),this},locked:function(){return!!o},fireWith:function(t,i){return o||(i=[t,(i=i||[]).slice?i.slice():i],r.push(i),e||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},k.extend({Deferred:function(e){var i=[["notify","progress",k.Callbacks("memory"),k.Callbacks("memory"),2],["resolve","done",k.Callbacks("once memory"),k.Callbacks("once memory"),0,"resolved"],["reject","fail",k.Callbacks("once memory"),k.Callbacks("once memory"),1,"rejected"]],n="pending",o={state:function(){return n},always:function(){return s.done(arguments).fail(arguments),this},catch:function(t){return o.then(null,t)},pipe:function(){var t=arguments;return k.Deferred((function(e){k.each(i,(function(i,n){var o=p(t[n[4]])&&t[n[4]];s[n[1]]((function(){var t=o&&o.apply(this,arguments);t&&p(t.promise)?t.promise().progress(e.notify).done(e.resolve).fail(e.reject):e[n[0]+"With"](this,o?[t]:arguments)}))})),t=null})).promise()},then:function(e,n,o){var s=0;function r(e,i,n,o){return function(){var a=this,l=arguments,c=function(){var t,c;if(!(e=s&&(n!==Y&&(a=void 0,l=[t]),i.rejectWith(a,l))}};e?u():(k.Deferred.getErrorHook?u.error=k.Deferred.getErrorHook():k.Deferred.getStackHook&&(u.error=k.Deferred.getStackHook()),t.setTimeout(u))}}return k.Deferred((function(t){i[0][3].add(r(0,t,p(o)?o:U,t.notifyWith)),i[1][3].add(r(0,t,p(e)?e:U)),i[2][3].add(r(0,t,p(n)?n:Y))})).promise()},promise:function(t){return null!=t?k.extend(t,o):o}},s={};return k.each(i,(function(t,e){var r=e[2],a=e[5];o[e[1]]=r.add,a&&r.add((function(){n=a}),i[3-t][2].disable,i[3-t][3].disable,i[0][2].lock,i[0][3].lock),r.add(e[3].fire),s[e[0]]=function(){return s[e[0]+"With"](this===s?void 0:this,arguments),this},s[e[0]+"With"]=r.fireWith})),o.promise(s),e&&e.call(s,s),s},when:function(t){var e=arguments.length,i=e,n=Array(i),s=o.call(arguments),r=k.Deferred(),a=function(t){return function(i){n[t]=this,s[t]=arguments.length>1?o.call(arguments):i,--e||r.resolveWith(n,s)}};if(e<=1&&(K(t,r.done(a(i)).resolve,r.reject,!e),"pending"===r.state()||p(s[i]&&s[i].then)))return r.then();for(;i--;)K(s[i],a(i),r.reject);return r.promise()}});var V=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;k.Deferred.exceptionHook=function(e,i){t.console&&t.console.warn&&e&&V.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,i)},k.readyException=function(e){t.setTimeout((function(){throw e}))};var X=k.Deferred();function G(){g.removeEventListener("DOMContentLoaded",G),t.removeEventListener("load",G),k.ready()}k.fn.ready=function(t){return X.then(t).catch((function(t){k.readyException(t)})),this},k.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--k.readyWait:k.isReady)||(k.isReady=!0,!0!==t&&--k.readyWait>0||X.resolveWith(g,[k]))}}),k.ready.then=X.then,"complete"===g.readyState||"loading"!==g.readyState&&!g.documentElement.doScroll?t.setTimeout(k.ready):(g.addEventListener("DOMContentLoaded",G),t.addEventListener("load",G));var Q=function(t,e,i,n,o,s,r){var a=0,l=t.length,c=null==i;if("object"===y(i))for(a in o=!0,i)Q(t,e,a,i[a],!0,s,r);else if(void 0!==n&&(o=!0,p(n)||(r=!0),c&&(r?(e.call(t,n),e=null):(c=e,e=function(t,e,i){return c.call(k(t),i)})),e))for(;a1,null,!0)},removeData:function(t){return this.each((function(){st.remove(this,t)}))}}),k.extend({queue:function(t,e,i){var n;if(t)return e=(e||"fx")+"queue",n=ot.get(t,e),i&&(!n||Array.isArray(i)?n=ot.access(t,e,k.makeArray(i)):n.push(i)),n||[]},dequeue:function(t,e){e=e||"fx";var i=k.queue(t,e),n=i.length,o=i.shift(),s=k._queueHooks(t,e);"inprogress"===o&&(o=i.shift(),n--),o&&("fx"===e&&i.unshift("inprogress"),delete s.stop,o.call(t,(function(){k.dequeue(t,e)}),s)),!n&&s&&s.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return ot.get(t,i)||ot.access(t,i,{empty:k.Callbacks("once memory").add((function(){ot.remove(t,[e+"queue",i])}))})}}),k.fn.extend({queue:function(t,e){var i=2;return"string"!=typeof t&&(e=t,t="fx",i--),arguments.length\x20\t\r\n\f]*)/i,Ct=/^$|^module$|\/(?:java|ecma)script/i;_t=g.createDocumentFragment().appendChild(g.createElement("div")),(wt=g.createElement("input")).setAttribute("type","radio"),wt.setAttribute("checked","checked"),wt.setAttribute("name","t"),_t.appendChild(wt),f.checkClone=_t.cloneNode(!0).cloneNode(!0).lastChild.checked,_t.innerHTML="",f.noCloneChecked=!!_t.cloneNode(!0).lastChild.defaultValue,_t.innerHTML="",f.option=!!_t.lastChild;var Tt={thead:[1,"
NameFree TicketsStaff TicketsFree Tickets (total: {{ $totalFreeTickets }})Staff Tickets (total: {{ $totalStaffTickets }})
","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function St(t,e){var i;return i=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&C(t,e)?k.merge([t],i):i}function Dt(t,e){for(var i=0,n=t.length;i",""]);var Et=/<|&#?\w+;/;function It(t,e,i,n,o){for(var s,r,a,l,c,u,h=e.createDocumentFragment(),d=[],f=0,p=t.length;f-1)o&&o.push(s);else if(c=ft(s),r=St(h.appendChild(s),"script"),c&&Dt(r),i)for(u=0;s=r[u++];)Ct.test(s.type||"")&&i.push(s);return h}var Pt=/^([^.]*)(?:\.(.+)|)/;function At(){return!0}function Nt(){return!1}function Mt(t,e,i,n,o,s){var r,a;if("object"==typeof e){for(a in"string"!=typeof i&&(n=n||i,i=void 0),e)Mt(t,a,i,n,e[a],s);return t}if(null==n&&null==o?(o=i,n=i=void 0):null==o&&("string"==typeof i?(o=n,n=void 0):(o=n,n=i,i=void 0)),!1===o)o=Nt;else if(!o)return t;return 1===s&&(r=o,o=function(t){return k().off(t),r.apply(this,arguments)},o.guid=r.guid||(r.guid=k.guid++)),t.each((function(){k.event.add(this,e,o,n,i)}))}function Ot(t,e,i){i?(ot.set(t,e,!1),k.event.add(t,e,{namespace:!1,handler:function(t){var i,n=ot.get(this,e);if(1&t.isTrigger&&this[e]){if(n)(k.event.special[e]||{}).delegateType&&t.stopPropagation();else if(n=o.call(arguments),ot.set(this,e,n),this[e](),i=ot.get(this,e),ot.set(this,e,!1),n!==i)return t.stopImmediatePropagation(),t.preventDefault(),i}else n&&(ot.set(this,e,k.event.trigger(n[0],n.slice(1),this)),t.stopPropagation(),t.isImmediatePropagationStopped=At)}})):void 0===ot.get(t,e)&&k.event.add(t,e,At)}k.event={global:{},add:function(t,e,i,n,o){var s,r,a,l,c,u,h,d,f,p,m,g=ot.get(t);if(it(t))for(i.handler&&(i=(s=i).handler,o=s.selector),o&&k.find.matchesSelector(dt,o),i.guid||(i.guid=k.guid++),(l=g.events)||(l=g.events=Object.create(null)),(r=g.handle)||(r=g.handle=function(e){return void 0!==k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(q)||[""]).length;c--;)f=m=(a=Pt.exec(e[c])||[])[1],p=(a[2]||"").split(".").sort(),f&&(h=k.event.special[f]||{},f=(o?h.delegateType:h.bindType)||f,h=k.event.special[f]||{},u=k.extend({type:f,origType:m,data:n,handler:i,guid:i.guid,selector:o,needsContext:o&&k.expr.match.needsContext.test(o),namespace:p.join(".")},s),(d=l[f])||((d=l[f]=[]).delegateCount=0,h.setup&&!1!==h.setup.call(t,n,p,r)||t.addEventListener&&t.addEventListener(f,r)),h.add&&(h.add.call(t,u),u.handler.guid||(u.handler.guid=i.guid)),o?d.splice(d.delegateCount++,0,u):d.push(u),k.event.global[f]=!0)},remove:function(t,e,i,n,o){var s,r,a,l,c,u,h,d,f,p,m,g=ot.hasData(t)&&ot.get(t);if(g&&(l=g.events)){for(c=(e=(e||"").match(q)||[""]).length;c--;)if(f=m=(a=Pt.exec(e[c])||[])[1],p=(a[2]||"").split(".").sort(),f){for(h=k.event.special[f]||{},d=l[f=(n?h.delegateType:h.bindType)||f]||[],a=a[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),r=s=d.length;s--;)u=d[s],!o&&m!==u.origType||i&&i.guid!==u.guid||a&&!a.test(u.namespace)||n&&n!==u.selector&&("**"!==n||!u.selector)||(d.splice(s,1),u.selector&&d.delegateCount--,h.remove&&h.remove.call(t,u));r&&!d.length&&(h.teardown&&!1!==h.teardown.call(t,p,g.handle)||k.removeEvent(t,f,g.handle),delete l[f])}else for(f in l)k.event.remove(t,f+e[c],i,n,!0);k.isEmptyObject(l)&&ot.remove(t,"handle events")}},dispatch:function(t){var e,i,n,o,s,r,a=new Array(arguments.length),l=k.event.fix(t),c=(ot.get(this,"events")||Object.create(null))[l.type]||[],u=k.event.special[l.type]||{};for(a[0]=l,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(s=[],r={},i=0;i-1:k.find(o,this,null,[c]).length),r[o]&&s.push(n);s.length&&a.push({elem:c,handlers:s})}return c=this,l\s*$/g;function Ft(t,e){return C(t,"table")&&C(11!==e.nodeType?e:e.firstChild,"tr")&&k(t).children("tbody")[0]||t}function zt(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function jt(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function Bt(t,e){var i,n,o,s,r,a;if(1===e.nodeType){if(ot.hasData(t)&&(a=ot.get(t).events))for(o in ot.remove(e,"handle events"),a)for(i=0,n=a[o].length;i1&&"string"==typeof g&&!f.checkClone&&Lt.test(g))return t.each((function(o){var s=t.eq(o);v&&(e[0]=g.call(this,o,s.html())),Wt(s,e,i,n)}));if(d&&(r=(o=It(e,t[0].ownerDocument,!1,t,n)).firstChild,1===o.childNodes.length&&(o=r),r||n)){for(l=(a=k.map(St(o,"script"),zt)).length;h0&&Dt(r,!l&&St(t,"script")),a},cleanData:function(t){for(var e,i,n,o=k.event.special,s=0;void 0!==(i=t[s]);s++)if(it(i)){if(e=i[ot.expando]){if(e.events)for(n in e.events)o[n]?k.event.remove(i,n):k.removeEvent(i,n,e.handle);i[ot.expando]=void 0}i[st.expando]&&(i[st.expando]=void 0)}}}),k.fn.extend({detach:function(t){return qt(this,t,!0)},remove:function(t){return qt(this,t)},text:function(t){return Q(this,(function(t){return void 0===t?k.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)}))}),null,t,arguments.length)},append:function(){return Wt(this,arguments,(function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Ft(this,t).appendChild(t)}))},prepend:function(){return Wt(this,arguments,(function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=Ft(this,t);e.insertBefore(t,e.firstChild)}}))},before:function(){return Wt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this)}))},after:function(){return Wt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)}))},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(k.cleanData(St(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map((function(){return k.clone(this,t,e)}))},html:function(t){return Q(this,(function(t){var e=this[0]||{},i=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Ht.test(t)&&!Tt[(xt.exec(t)||["",""])[1].toLowerCase()]){t=k.htmlPrefilter(t);try{for(;i=0&&(l+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-s-l-a-.5))||0),l+c}function ae(t,e,i){var n=Kt(t),o=(!f.boxSizingReliable()||i)&&"border-box"===k.css(t,"boxSizing",!1,n),s=o,r=Gt(t,e,n),a="offset"+e[0].toUpperCase()+e.slice(1);if(Ut.test(r)){if(!i)return r;r="auto"}return(!f.boxSizingReliable()&&o||!f.reliableTrDimensions()&&C(t,"tr")||"auto"===r||!parseFloat(r)&&"inline"===k.css(t,"display",!1,n))&&t.getClientRects().length&&(o="border-box"===k.css(t,"boxSizing",!1,n),(s=a in t)&&(r=t[a])),(r=parseFloat(r)||0)+re(t,e,i||(o?"border":"content"),s,n,r)+"px"}function le(t,e,i,n,o){return new le.prototype.init(t,e,i,n,o)}k.extend({cssHooks:{opacity:{get:function(t,e){if(e){var i=Gt(t,"opacity");return""===i?"1":i}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(t,e,i,n){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var o,s,r,a=et(e),l=Yt.test(e),c=t.style;if(l||(e=ee(a)),r=k.cssHooks[e]||k.cssHooks[a],void 0===i)return r&&"get"in r&&void 0!==(o=r.get(t,!1,n))?o:c[e];"string"===(s=typeof i)&&(o=ut.exec(i))&&o[1]&&(i=gt(t,e,o),s="number"),null!=i&&i==i&&("number"!==s||l||(i+=o&&o[3]||(k.cssNumber[a]?"":"px")),f.clearCloneStyle||""!==i||0!==e.indexOf("background")||(c[e]="inherit"),r&&"set"in r&&void 0===(i=r.set(t,i,n))||(l?c.setProperty(e,i):c[e]=i))}},css:function(t,e,i,n){var o,s,r,a=et(e);return Yt.test(e)||(e=ee(a)),(r=k.cssHooks[e]||k.cssHooks[a])&&"get"in r&&(o=r.get(t,!0,i)),void 0===o&&(o=Gt(t,e,n)),"normal"===o&&e in oe&&(o=oe[e]),""===i||i?(s=parseFloat(o),!0===i||isFinite(s)?s||0:o):o}}),k.each(["height","width"],(function(t,e){k.cssHooks[e]={get:function(t,i,n){if(i)return!ie.test(k.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?ae(t,e,n):Vt(t,ne,(function(){return ae(t,e,n)}))},set:function(t,i,n){var o,s=Kt(t),r=!f.scrollboxSize()&&"absolute"===s.position,a=(r||n)&&"border-box"===k.css(t,"boxSizing",!1,s),l=n?re(t,e,n,a,s):0;return a&&r&&(l-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(s[e])-re(t,e,"border",!1,s)-.5)),l&&(o=ut.exec(i))&&"px"!==(o[3]||"px")&&(t.style[e]=i,i=k.css(t,e)),se(0,i,l)}}})),k.cssHooks.marginLeft=Qt(f.reliableMarginLeft,(function(t,e){if(e)return(parseFloat(Gt(t,"marginLeft"))||t.getBoundingClientRect().left-Vt(t,{marginLeft:0},(function(){return t.getBoundingClientRect().left})))+"px"})),k.each({margin:"",padding:"",border:"Width"},(function(t,e){k.cssHooks[t+e]={expand:function(i){for(var n=0,o={},s="string"==typeof i?i.split(" "):[i];n<4;n++)o[t+ht[n]+e]=s[n]||s[n-2]||s[0];return o}},"margin"!==t&&(k.cssHooks[t+e].set=se)})),k.fn.extend({css:function(t,e){return Q(this,(function(t,e,i){var n,o,s={},r=0;if(Array.isArray(e)){for(n=Kt(t),o=e.length;r1)}}),k.Tween=le,le.prototype={constructor:le,init:function(t,e,i,n,o,s){this.elem=t,this.prop=i,this.easing=o||k.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=s||(k.cssNumber[i]?"":"px")},cur:function(){var t=le.propHooks[this.prop];return t&&t.get?t.get(this):le.propHooks._default.get(this)},run:function(t){var e,i=le.propHooks[this.prop];return this.options.duration?this.pos=e=k.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):le.propHooks._default.set(this),this}},le.prototype.init.prototype=le.prototype,le.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=k.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){k.fx.step[t.prop]?k.fx.step[t.prop](t):1!==t.elem.nodeType||!k.cssHooks[t.prop]&&null==t.elem.style[ee(t.prop)]?t.elem[t.prop]=t.now:k.style(t.elem,t.prop,t.now+t.unit)}}},le.propHooks.scrollTop=le.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},k.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},k.fx=le.prototype.init,k.fx.step={};var ce,ue,he=/^(?:toggle|show|hide)$/,de=/queueHooks$/;function fe(){ue&&(!1===g.hidden&&t.requestAnimationFrame?t.requestAnimationFrame(fe):t.setTimeout(fe,k.fx.interval),k.fx.tick())}function pe(){return t.setTimeout((function(){ce=void 0})),ce=Date.now()}function me(t,e){var i,n=0,o={height:t};for(e=e?1:0;n<4;n+=2-e)o["margin"+(i=ht[n])]=o["padding"+i]=t;return e&&(o.opacity=o.width=t),o}function ge(t,e,i){for(var n,o=(ve.tweeners[e]||[]).concat(ve.tweeners["*"]),s=0,r=o.length;s1)},removeAttr:function(t){return this.each((function(){k.removeAttr(this,t)}))}}),k.extend({attr:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===t.getAttribute?k.prop(t,e,i):(1===s&&k.isXMLDoc(t)||(o=k.attrHooks[e.toLowerCase()]||(k.expr.match.bool.test(e)?be:void 0)),void 0!==i?null===i?void k.removeAttr(t,e):o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:(t.setAttribute(e,i+""),i):o&&"get"in o&&null!==(n=o.get(t,e))?n:null==(n=k.find.attr(t,e))?void 0:n)},attrHooks:{type:{set:function(t,e){if(!f.radioValue&&"radio"===e&&C(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},removeAttr:function(t,e){var i,n=0,o=e&&e.match(q);if(o&&1===t.nodeType)for(;i=o[n++];)t.removeAttribute(i)}}),be={set:function(t,e,i){return!1===e?k.removeAttr(t,i):t.setAttribute(i,i),i}},k.each(k.expr.match.bool.source.match(/\w+/g),(function(t,e){var i=ye[e]||k.find.attr;ye[e]=function(t,e,n){var o,s,r=e.toLowerCase();return n||(s=ye[r],ye[r]=o,o=null!=i(t,e,n)?r:null,ye[r]=s),o}}));var _e=/^(?:input|select|textarea|button)$/i,we=/^(?:a|area)$/i;function ke(t){return(t.match(q)||[]).join(" ")}function xe(t){return t.getAttribute&&t.getAttribute("class")||""}function Ce(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(q)||[]}k.fn.extend({prop:function(t,e){return Q(this,k.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each((function(){delete this[k.propFix[t]||t]}))}}),k.extend({prop:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&k.isXMLDoc(t)||(e=k.propFix[e]||e,o=k.propHooks[e]),void 0!==i?o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:t[e]=i:o&&"get"in o&&null!==(n=o.get(t,e))?n:t[e]},propHooks:{tabIndex:{get:function(t){var e=k.find.attr(t,"tabindex");return e?parseInt(e,10):_e.test(t.nodeName)||we.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),f.optSelected||(k.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),k.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){k.propFix[this.toLowerCase()]=this})),k.fn.extend({addClass:function(t){var e,i,n,o,s,r;return p(t)?this.each((function(e){k(this).addClass(t.call(this,e,xe(this)))})):(e=Ce(t)).length?this.each((function(){if(n=xe(this),i=1===this.nodeType&&" "+ke(n)+" "){for(s=0;s-1;)i=i.replace(" "+o+" "," ");r=ke(i),n!==r&&this.setAttribute("class",r)}})):this:this.attr("class","")},toggleClass:function(t,e){var i,n,o,s,r=typeof t,a="string"===r||Array.isArray(t);return p(t)?this.each((function(i){k(this).toggleClass(t.call(this,i,xe(this),e),e)})):"boolean"==typeof e&&a?e?this.addClass(t):this.removeClass(t):(i=Ce(t),this.each((function(){if(a)for(s=k(this),o=0;o-1)return!0;return!1}});var Te=/\r/g;k.fn.extend({val:function(t){var e,i,n,o=this[0];return arguments.length?(n=p(t),this.each((function(i){var o;1===this.nodeType&&(null==(o=n?t.call(this,i,k(this).val()):t)?o="":"number"==typeof o?o+="":Array.isArray(o)&&(o=k.map(o,(function(t){return null==t?"":t+""}))),(e=k.valHooks[this.type]||k.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))}))):o?(e=k.valHooks[o.type]||k.valHooks[o.nodeName.toLowerCase()])&&"get"in e&&void 0!==(i=e.get(o,"value"))?i:"string"==typeof(i=o.value)?i.replace(Te,""):null==i?"":i:void 0}}),k.extend({valHooks:{option:{get:function(t){var e=k.find.attr(t,"value");return null!=e?e:ke(k.text(t))}},select:{get:function(t){var e,i,n,o=t.options,s=t.selectedIndex,r="select-one"===t.type,a=r?null:[],l=r?s+1:o.length;for(n=s<0?l:r?s:0;n-1)&&(i=!0);return i||(t.selectedIndex=-1),s}}}}),k.each(["radio","checkbox"],(function(){k.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=k.inArray(k(t).val(),e)>-1}},f.checkOn||(k.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})}));var Se=t.location,De={guid:Date.now()},Ee=/\?/;k.parseXML=function(e){var i,n;if(!e||"string"!=typeof e)return null;try{i=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){}return n=i&&i.getElementsByTagName("parsererror")[0],i&&!n||k.error("Invalid XML: "+(n?k.map(n.childNodes,(function(t){return t.textContent})).join("\n"):e)),i};var Ie=/^(?:focusinfocus|focusoutblur)$/,Pe=function(t){t.stopPropagation()};k.extend(k.event,{trigger:function(e,i,n,o){var s,r,a,l,c,h,d,f,v=[n||g],b=u.call(e,"type")?e.type:e,y=u.call(e,"namespace")?e.namespace.split("."):[];if(r=f=a=n=n||g,3!==n.nodeType&&8!==n.nodeType&&!Ie.test(b+k.event.triggered)&&(b.indexOf(".")>-1&&(y=b.split("."),b=y.shift(),y.sort()),c=b.indexOf(":")<0&&"on"+b,(e=e[k.expando]?e:new k.Event(b,"object"==typeof e&&e)).isTrigger=o?2:3,e.namespace=y.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),i=null==i?[e]:k.makeArray(i,[e]),d=k.event.special[b]||{},o||!d.trigger||!1!==d.trigger.apply(n,i))){if(!o&&!d.noBubble&&!m(n)){for(l=d.delegateType||b,Ie.test(l+b)||(r=r.parentNode);r;r=r.parentNode)v.push(r),a=r;a===(n.ownerDocument||g)&&v.push(a.defaultView||a.parentWindow||t)}for(s=0;(r=v[s++])&&!e.isPropagationStopped();)f=r,e.type=s>1?l:d.bindType||b,(h=(ot.get(r,"events")||Object.create(null))[e.type]&&ot.get(r,"handle"))&&h.apply(r,i),(h=c&&r[c])&&h.apply&&it(r)&&(e.result=h.apply(r,i),!1===e.result&&e.preventDefault());return e.type=b,o||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),i)||!it(n)||c&&p(n[b])&&!m(n)&&((a=n[c])&&(n[c]=null),k.event.triggered=b,e.isPropagationStopped()&&f.addEventListener(b,Pe),n[b](),e.isPropagationStopped()&&f.removeEventListener(b,Pe),k.event.triggered=void 0,a&&(n[c]=a)),e.result}},simulate:function(t,e,i){var n=k.extend(new k.Event,i,{type:t,isSimulated:!0});k.event.trigger(n,null,e)}}),k.fn.extend({trigger:function(t,e){return this.each((function(){k.event.trigger(t,e,this)}))},triggerHandler:function(t,e){var i=this[0];if(i)return k.event.trigger(t,e,i,!0)}});var Ae=/\[\]$/,Ne=/\r?\n/g,Me=/^(?:submit|button|image|reset|file)$/i,Oe=/^(?:input|select|textarea|keygen)/i;function He(t,e,i,n){var o;if(Array.isArray(e))k.each(e,(function(e,o){i||Ae.test(t)?n(t,o):He(t+"["+("object"==typeof o&&null!=o?e:"")+"]",o,i,n)}));else if(i||"object"!==y(e))n(t,e);else for(o in e)He(t+"["+o+"]",e[o],i,n)}k.param=function(t,e){var i,n=[],o=function(t,e){var i=p(e)?e():e;n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==i?"":i)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!k.isPlainObject(t))k.each(t,(function(){o(this.name,this.value)}));else for(i in t)He(i,t[i],e,o);return n.join("&")},k.fn.extend({serialize:function(){return k.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=k.prop(this,"elements");return t?k.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&!k(this).is(":disabled")&&Oe.test(this.nodeName)&&!Me.test(t)&&(this.checked||!kt.test(t))})).map((function(t,e){var i=k(this).val();return null==i?null:Array.isArray(i)?k.map(i,(function(t){return{name:e.name,value:t.replace(Ne,"\r\n")}})):{name:e.name,value:i.replace(Ne,"\r\n")}})).get()}});var Le=/%20/g,Re=/#.*$/,Fe=/([?&])_=[^&]*/,ze=/^(.*?):[ \t]*([^\r\n]*)$/gm,je=/^(?:GET|HEAD)$/,Be=/^\/\//,$e={},We={},qe="*/".concat("*"),Ue=g.createElement("a");function Ye(t){return function(e,i){"string"!=typeof e&&(i=e,e="*");var n,o=0,s=e.toLowerCase().match(q)||[];if(p(i))for(;n=s[o++];)"+"===n[0]?(n=n.slice(1)||"*",(t[n]=t[n]||[]).unshift(i)):(t[n]=t[n]||[]).push(i)}}function Ke(t,e,i,n){var o={},s=t===We;function r(a){var l;return o[a]=!0,k.each(t[a]||[],(function(t,a){var c=a(e,i,n);return"string"!=typeof c||s||o[c]?s?!(l=c):void 0:(e.dataTypes.unshift(c),r(c),!1)})),l}return r(e.dataTypes[0])||!o["*"]&&r("*")}function Ve(t,e){var i,n,o=k.ajaxSettings.flatOptions||{};for(i in e)void 0!==e[i]&&((o[i]?t:n||(n={}))[i]=e[i]);return n&&k.extend(!0,t,n),t}Ue.href=Se.href,k.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Se.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Se.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":qe,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":k.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?Ve(Ve(t,k.ajaxSettings),e):Ve(k.ajaxSettings,t)},ajaxPrefilter:Ye($e),ajaxTransport:Ye(We),ajax:function(e,i){"object"==typeof e&&(i=e,e=void 0),i=i||{};var n,o,s,r,a,l,c,u,h,d,f=k.ajaxSetup({},i),p=f.context||f,m=f.context&&(p.nodeType||p.jquery)?k(p):k.event,v=k.Deferred(),b=k.Callbacks("once memory"),y=f.statusCode||{},_={},w={},x="canceled",C={readyState:0,getResponseHeader:function(t){var e;if(c){if(!r)for(r={};e=ze.exec(s);)r[e[1].toLowerCase()+" "]=(r[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=r[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return c?s:null},setRequestHeader:function(t,e){return null==c&&(t=w[t.toLowerCase()]=w[t.toLowerCase()]||t,_[t]=e),this},overrideMimeType:function(t){return null==c&&(f.mimeType=t),this},statusCode:function(t){var e;if(t)if(c)C.always(t[C.status]);else for(e in t)y[e]=[y[e],t[e]];return this},abort:function(t){var e=t||x;return n&&n.abort(e),T(0,e),this}};if(v.promise(C),f.url=((e||f.url||Se.href)+"").replace(Be,Se.protocol+"//"),f.type=i.method||i.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(q)||[""],null==f.crossDomain){l=g.createElement("a");try{l.href=f.url,l.href=l.href,f.crossDomain=Ue.protocol+"//"+Ue.host!=l.protocol+"//"+l.host}catch(t){f.crossDomain=!0}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=k.param(f.data,f.traditional)),Ke($e,f,i,C),c)return C;for(h in(u=k.event&&f.global)&&0==k.active++&&k.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!je.test(f.type),o=f.url.replace(Re,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(Le,"+")):(d=f.url.slice(o.length),f.data&&(f.processData||"string"==typeof f.data)&&(o+=(Ee.test(o)?"&":"?")+f.data,delete f.data),!1===f.cache&&(o=o.replace(Fe,"$1"),d=(Ee.test(o)?"&":"?")+"_="+De.guid+++d),f.url=o+d),f.ifModified&&(k.lastModified[o]&&C.setRequestHeader("If-Modified-Since",k.lastModified[o]),k.etag[o]&&C.setRequestHeader("If-None-Match",k.etag[o])),(f.data&&f.hasContent&&!1!==f.contentType||i.contentType)&&C.setRequestHeader("Content-Type",f.contentType),C.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+qe+"; q=0.01":""):f.accepts["*"]),f.headers)C.setRequestHeader(h,f.headers[h]);if(f.beforeSend&&(!1===f.beforeSend.call(p,C,f)||c))return C.abort();if(x="abort",b.add(f.complete),C.done(f.success),C.fail(f.error),n=Ke(We,f,i,C)){if(C.readyState=1,u&&m.trigger("ajaxSend",[C,f]),c)return C;f.async&&f.timeout>0&&(a=t.setTimeout((function(){C.abort("timeout")}),f.timeout));try{c=!1,n.send(_,T)}catch(t){if(c)throw t;T(-1,t)}}else T(-1,"No Transport");function T(e,i,r,l){var h,d,g,_,w,x=i;c||(c=!0,a&&t.clearTimeout(a),n=void 0,s=l||"",C.readyState=e>0?4:0,h=e>=200&&e<300||304===e,r&&(_=function(t,e,i){for(var n,o,s,r,a=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===n&&(n=t.mimeType||e.getResponseHeader("Content-Type"));if(n)for(o in a)if(a[o]&&a[o].test(n)){l.unshift(o);break}if(l[0]in i)s=l[0];else{for(o in i){if(!l[0]||t.converters[o+" "+l[0]]){s=o;break}r||(r=o)}s=s||r}if(s)return s!==l[0]&&l.unshift(s),i[s]}(f,C,r)),!h&&k.inArray("script",f.dataTypes)>-1&&k.inArray("json",f.dataTypes)<0&&(f.converters["text script"]=function(){}),_=function(t,e,i,n){var o,s,r,a,l,c={},u=t.dataTypes.slice();if(u[1])for(r in t.converters)c[r.toLowerCase()]=t.converters[r];for(s=u.shift();s;)if(t.responseFields[s]&&(i[t.responseFields[s]]=e),!l&&n&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=s,s=u.shift())if("*"===s)s=l;else if("*"!==l&&l!==s){if(!(r=c[l+" "+s]||c["* "+s]))for(o in c)if((a=o.split(" "))[1]===s&&(r=c[l+" "+a[0]]||c["* "+a[0]])){!0===r?r=c[o]:!0!==c[o]&&(s=a[0],u.unshift(a[1]));break}if(!0!==r)if(r&&t.throws)e=r(e);else try{e=r(e)}catch(t){return{state:"parsererror",error:r?t:"No conversion from "+l+" to "+s}}}return{state:"success",data:e}}(f,_,C,h),h?(f.ifModified&&((w=C.getResponseHeader("Last-Modified"))&&(k.lastModified[o]=w),(w=C.getResponseHeader("etag"))&&(k.etag[o]=w)),204===e||"HEAD"===f.type?x="nocontent":304===e?x="notmodified":(x=_.state,d=_.data,h=!(g=_.error))):(g=x,!e&&x||(x="error",e<0&&(e=0))),C.status=e,C.statusText=(i||x)+"",h?v.resolveWith(p,[d,x,C]):v.rejectWith(p,[C,x,g]),C.statusCode(y),y=void 0,u&&m.trigger(h?"ajaxSuccess":"ajaxError",[C,f,h?d:g]),b.fireWith(p,[C,x]),u&&(m.trigger("ajaxComplete",[C,f]),--k.active||k.event.trigger("ajaxStop")))}return C},getJSON:function(t,e,i){return k.get(t,e,i,"json")},getScript:function(t,e){return k.get(t,void 0,e,"script")}}),k.each(["get","post"],(function(t,e){k[e]=function(t,i,n,o){return p(i)&&(o=o||n,n=i,i=void 0),k.ajax(k.extend({url:t,type:e,dataType:o,data:i,success:n},k.isPlainObject(t)&&t))}})),k.ajaxPrefilter((function(t){var e;for(e in t.headers)"content-type"===e.toLowerCase()&&(t.contentType=t.headers[e]||"")})),k._evalUrl=function(t,e,i){return k.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(t){k.globalEval(t,e,i)}})},k.fn.extend({wrapAll:function(t){var e;return this[0]&&(p(t)&&(t=t.call(this[0])),e=k(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t})).append(this)),this},wrapInner:function(t){return p(t)?this.each((function(e){k(this).wrapInner(t.call(this,e))})):this.each((function(){var e=k(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)}))},wrap:function(t){var e=p(t);return this.each((function(i){k(this).wrapAll(e?t.call(this,i):t)}))},unwrap:function(t){return this.parent(t).not("body").each((function(){k(this).replaceWith(this.childNodes)})),this}}),k.expr.pseudos.hidden=function(t){return!k.expr.pseudos.visible(t)},k.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},k.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var Xe={0:200,1223:204},Ge=k.ajaxSettings.xhr();f.cors=!!Ge&&"withCredentials"in Ge,f.ajax=Ge=!!Ge,k.ajaxTransport((function(e){var i,n;if(f.cors||Ge&&!e.crossDomain)return{send:function(o,s){var r,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(r in e.xhrFields)a[r]=e.xhrFields[r];for(r in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest"),o)a.setRequestHeader(r,o[r]);i=function(t){return function(){i&&(i=n=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===t?a.abort():"error"===t?"number"!=typeof a.status?s(0,"error"):s(a.status,a.statusText):s(Xe[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=i(),n=a.onerror=a.ontimeout=i("error"),void 0!==a.onabort?a.onabort=n:a.onreadystatechange=function(){4===a.readyState&&t.setTimeout((function(){i&&n()}))},i=i("abort");try{a.send(e.hasContent&&e.data||null)}catch(t){if(i)throw t}},abort:function(){i&&i()}}})),k.ajaxPrefilter((function(t){t.crossDomain&&(t.contents.script=!1)})),k.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return k.globalEval(t),t}}}),k.ajaxPrefilter("script",(function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")})),k.ajaxTransport("script",(function(t){var e,i;if(t.crossDomain||t.scriptAttrs)return{send:function(n,o){e=k("
diff --git a/src/resources/views/events/show.blade.php b/src/resources/views/events/show.blade.php index 27a2222d..c45c73cf 100644 --- a/src/resources/views/events/show.blade.php +++ b/src/resources/views/events/show.blade.php @@ -83,9 +83,6 @@

@lang('events.eventinfo')

- - -
@@ -218,144 +215,8 @@
- - @if (!$event->online_event && - !$event->seatingPlans->isEmpty() && - ( - in_array('PUBLISHED', $event->seatingPlans->pluck('status')->toArray()) || - in_array('PREVIEW', $event->seatingPlans->pluck('status')->toArray()) - ) - ) -
- -

@lang('events.seatingplans') - {{ $event->getSeatingCapacity() - $event->getSeatedCount() }} / {{ $event->getSeatingCapacity() }} @lang('events.seatsremaining')

-
-
- @foreach ($event->seatingPlans as $seatingPlan) - @if ($seatingPlan->status != 'DRAFT') -
- -
-
-
- - - - @for ($row = 1; $row <= $seatingPlan->rows; $row++) - - - @for ($column = 1; $column <= $seatingPlan->columns; $column++) - - - @endfor - - @endfor - -
-

{{ Helpers::getLatinAlphabetUpperLetterByIndex($row) }}

-
- @if ($event->getSeat($seatingPlan->id, $column, $row)) - @if($event->getSeat($seatingPlan->id, $column, $row)->status == 'ACTIVE') - @if ($seatingPlan->locked) - - @else - - @endif - @endif - @else - @if ($seatingPlan->locked) - - @else - @if (Auth::user() - && $event->getEventParticipant() - && ($event->getEventParticipant()->staff - || $event->getEventParticipant()->free - || $event->getEventParticipant()->ticket->seatable - ) - ) - - @else - - @endif - @endif - @endif -
- @if ($seatingPlan->locked) -

@lang('events.seatingplanlocked')

- @endif -
-
- -
-
- @endif - @endforeach -
- @endif + @include ('layouts._partials._events.seating') +
@@ -762,61 +623,5 @@ @endif - -
- - - - - - @endsection \ No newline at end of file diff --git a/src/resources/views/layouts/_partials/_events/seating.blade.php b/src/resources/views/layouts/_partials/_events/seating.blade.php new file mode 100644 index 00000000..479c334a --- /dev/null +++ b/src/resources/views/layouts/_partials/_events/seating.blade.php @@ -0,0 +1,191 @@ + +@if (!$event->online_event && +!$event->seatingPlans->isEmpty() && +( +in_array('PUBLISHED', $event->seatingPlans->pluck('status')->toArray()) || +in_array('PREVIEW', $event->seatingPlans->pluck('status')->toArray()) +) +) +
+ +

@lang('events.seatingplans') - {{ $event->getSeatingCapacity() - $event->getSeatedCount() }} / {{ $event->getSeatingCapacity() }} @lang('events.seatsremaining')

+
+
+ @foreach ($event->seatingPlans as $seatingPlan) + @if ($seatingPlan->status != 'DRAFT') +
+ +
+
+
+ + + + @for ($row = 1; $row <= $seatingPlan->rows; $row++) + + + @for ($column = 1; $column <= $seatingPlan->columns; $column++) + + + @endfor + + @endfor + +
+

{{ Helpers::getLatinAlphabetUpperLetterByIndex($row) }}

+
+ @if ($event->getSeat($seatingPlan->id, $column, $row)) + @if($event->getSeat($seatingPlan->id, $column, $row)->status == 'ACTIVE') + @if ($seatingPlan->locked) + + @else + + @endif + @endif + @else + @if ($seatingPlan->locked) + + @else + @if (Auth::user() + && $event->getEventParticipant() + && ($event->getEventParticipant()->staff + || $event->getEventParticipant()->free + || $event->getEventParticipant()->ticket->seatable + ) + ) + + @else + + @endif + @endif + @endif +
+ @if ($seatingPlan->locked) +

@lang('events.seatingplanlocked')

+ @endif +
+
+ +
+
+ @endif + @endforeach +
+@endif + + + + + \ No newline at end of file From b1b8276a8bd4a1cde6291304449fc98528dfc8a7 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Sun, 5 Nov 2023 04:39:37 +0100 Subject: [PATCH 26/59] Added partials for information and -card --- src/resources/views/events/index.blade.php | 20 ++---- src/resources/views/events/show.blade.php | 63 +------------------ .../_events/information-card.blade.php | 49 +++++++++++++++ .../_partials/_events/information.blade.php | 11 ++++ 4 files changed, 69 insertions(+), 74 deletions(-) create mode 100644 src/resources/views/layouts/_partials/_events/information-card.blade.php create mode 100644 src/resources/views/layouts/_partials/_events/information.blade.php diff --git a/src/resources/views/events/index.blade.php b/src/resources/views/events/index.blade.php index 5534eb1b..24aa64a1 100644 --- a/src/resources/views/events/index.blade.php +++ b/src/resources/views/events/index.blade.php @@ -3,26 +3,18 @@ @section ('page_title', Settings::getOrgName() . ' - Events') @section ('content') - +

Events

- @foreach ($events as $event) -
- -
-
{!! $event->desc_short !!}
-

{!! $event->essential_info !!}

-

@lang('events.start'): {{ date('H:i d-m-Y', strtotime($event->start)) }}

-

@lang('events.end'): {{ date('H:i d-m-Y', strtotime($event->end)) }}

-

@lang('events.seatingcapacity'): {{ $event->getSeatingCapacity() }}

-
-
+ @foreach ($events as $event) +
+

{{ $event->display_name }}

+
+ @include ('layouts._partials._events.information-card') @endforeach
diff --git a/src/resources/views/events/show.blade.php b/src/resources/views/events/show.blade.php index c45c73cf..485bf69f 100644 --- a/src/resources/views/events/show.blade.php +++ b/src/resources/views/events/show.blade.php @@ -75,65 +75,9 @@
- -
- -
-
- -

@lang('events.eventinfo')

-
- -
-
- -
-
-
-
-

@lang('events.start')

-

{{ date('d.M Y', strtotime($event->start)) }} @lang('events.time_delimiter') {{ date('H:i', strtotime($event->start)) }} @lang('events.time_suffix')

-
-
-
-
-
-
- -

@lang('events.end')

-

{{ date('d.M Y', strtotime($event->end)) }} @lang('events.time_delimiter') {{ date('H:i', strtotime($event->end)) }} @lang('events.time_suffix')

-
-
-
-
-
-
- -

@lang('events.seatingcapacity')

-

{{ $event->capacity }} @lang('events.seating')

-
-
-
-
- -
-
-

{{ $event->desc_long }}

-
-
- - - -
-
- -
- - + + @include ('layouts._partials._events.information') +
@if (!$event->tickets->isEmpty()) @@ -213,7 +157,6 @@
@endif
-
@include ('layouts._partials._events.seating') diff --git a/src/resources/views/layouts/_partials/_events/information-card.blade.php b/src/resources/views/layouts/_partials/_events/information-card.blade.php new file mode 100644 index 00000000..c6fd7c61 --- /dev/null +++ b/src/resources/views/layouts/_partials/_events/information-card.blade.php @@ -0,0 +1,49 @@ +
+
+ +
+
+
+
+

@lang('events.start')

+

{{ date('d.M Y', strtotime($event->start)) }} @lang('events.time_delimiter') + {{ date('H:i', strtotime($event->start)) }} @lang('events.time_suffix')

+
+
+
+
+
+
+ +

@lang('events.end')

+

{{ date('d.M Y', strtotime($event->end)) }} @lang('events.time_delimiter') + {{ date('H:i', strtotime($event->end)) }} @lang('events.time_suffix')

+
+
+
+
+
+
+ +

@lang('events.seatingcapacity')

+

{{ $event->capacity }} @lang('events.seating')

+
+
+
+
+ +
+
+

{{ $event->desc_long }}

+
+
+ + + +
+
\ No newline at end of file diff --git a/src/resources/views/layouts/_partials/_events/information.blade.php b/src/resources/views/layouts/_partials/_events/information.blade.php new file mode 100644 index 00000000..9b3f8986 --- /dev/null +++ b/src/resources/views/layouts/_partials/_events/information.blade.php @@ -0,0 +1,11 @@ + +
+
+
+ +

@lang('events.eventinfo')

+
+ + @include ('layouts._partials._events.information-card') +
+
\ No newline at end of file From c56f8fa2997accc6477eb688645a0978d5091f5e Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Sun, 5 Nov 2023 05:24:02 +0100 Subject: [PATCH 27/59] Added the feature to change venue of a event +ui --- .../Admin/Events/EventsController.php | 5 +++++ .../views/admin/events/show.blade.php | 19 ++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/app/Http/Controllers/Admin/Events/EventsController.php b/src/app/Http/Controllers/Admin/Events/EventsController.php index e4ad5935..1036b325 100644 --- a/src/app/Http/Controllers/Admin/Events/EventsController.php +++ b/src/app/Http/Controllers/Admin/Events/EventsController.php @@ -12,6 +12,7 @@ use App\EventParticipant; use App\EventTicket; use App\EventAnnouncement; +use App\EventVenue; use App\Purchase; use App\Http\Requests; @@ -203,6 +204,10 @@ public function update(Event $event, Request $request) $event->capacity = $request->capacity; } + if (isset($request->venue)) { + $event->event_venue_id = @$request->venue; + } + if (!$event->save()) { Session::flash('alert-danger', 'Cannot update Event!'); return Redirect::to('admin/events/' . $event->slug); diff --git a/src/resources/views/admin/events/show.blade.php b/src/resources/views/admin/events/show.blade.php index 8a03286a..587b1b3b 100644 --- a/src/resources/views/admin/events/show.blade.php +++ b/src/resources/views/admin/events/show.blade.php @@ -102,17 +102,10 @@
-
- Venue -
- @if ($event->venue->display_name) {{ $event->venue->display_name }}
@endif - @if ($event->venue->address_1) {{ $event->venue->address_1 }}
@endif - @if ($event->venue->address_2) {{ $event->venue->address_2 }}
@endif - @if ($event->venue->address_street) {{ $event->venue->address_street }}
@endif - @if ($event->venue->address_city) {{ $event->venue->address_city }}
@endif - @if ($event->venue->address_postcode) {{ $event->venue->address_postcode }}
@endif - @if ($event->venue->address_country) {{ $event->venue->address_country }}
@endif -
+
+ {{-- Venue selection --}} + {{ Form::label('venue','Venue',array('id'=>'','class'=>'')) }} + {{ Form::select('venue', Helpers::getVenues(), $event->venue->id, array('id'=>'venue','class'=>'form-control')) }}
@@ -139,14 +132,14 @@
-
+
-
+
From 09232fbffaf67a9ef23fa6e821cb1a4611007618 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Sun, 5 Nov 2023 13:00:27 +0100 Subject: [PATCH 29/59] Staff and Freebie migrations new mgiration file date --- ...rnaments_staff.php => 2023_11_05_131811_tournaments_staff.php} | 0 ...ts_freebies.php => 2023_11_05_131817_tournaments_freebies.php} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/database/migrations/{2023_10_03_131811_tournaments_staff.php => 2023_11_05_131811_tournaments_staff.php} (100%) rename src/database/migrations/{2023_10_03_131817_tournaments_freebies.php => 2023_11_05_131817_tournaments_freebies.php} (100%) diff --git a/src/database/migrations/2023_10_03_131811_tournaments_staff.php b/src/database/migrations/2023_11_05_131811_tournaments_staff.php similarity index 100% rename from src/database/migrations/2023_10_03_131811_tournaments_staff.php rename to src/database/migrations/2023_11_05_131811_tournaments_staff.php diff --git a/src/database/migrations/2023_10_03_131817_tournaments_freebies.php b/src/database/migrations/2023_11_05_131817_tournaments_freebies.php similarity index 100% rename from src/database/migrations/2023_10_03_131817_tournaments_freebies.php rename to src/database/migrations/2023_11_05_131817_tournaments_freebies.php From 2bfad0ceab97ff7fcfb008052ed8bd9ff49d9dbf Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Sun, 5 Nov 2023 13:09:52 +0100 Subject: [PATCH 30/59] Removed old sponsor section (already a partial) --- src/resources/views/events/home.blade.php | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/resources/views/events/home.blade.php b/src/resources/views/events/home.blade.php index 829c080f..9c3b1426 100644 --- a/src/resources/views/events/home.blade.php +++ b/src/resources/views/events/home.blade.php @@ -43,27 +43,8 @@ @lang('events.plssignin') @endif - - + @include ('layouts._partials._sponsors.index') -
From ef9d191bbd8ebecc64433312a8b7d2ab9ad77160 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Sun, 5 Nov 2023 13:28:47 +0100 Subject: [PATCH 31/59] Added Additions to Changelog --- currentchangelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/currentchangelog b/currentchangelog index 1a18359a..294c02b7 100644 --- a/currentchangelog +++ b/currentchangelog @@ -1,3 +1,7 @@ +-Added Change for Events Venue after creating +-Added iCal for Events Information +-Added Tournament Participation Control for Staff and Freebie Event Participants +-Added Partials for Event Information, Event Information Card, Sponsors, Seating -Added Multilanguage support on a per site bases -Added Translation to german -Added Gameserver Management per game (includes a management/Rcon feature and a api for the CS:go tournament plugin Get5) From 8789820470f98206e50ff9342123cdee2dcdbe3c Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Mon, 6 Nov 2023 18:08:37 +0100 Subject: [PATCH 32/59] Bootstraping Localistation Feature --- .../Http/Controllers/AccountController.php | 4 ++ .../Http/Controllers/Auth/LoginController.php | 14 +++++ src/app/Http/Kernel.php | 1 + src/app/Http/Middleware/UserLocale.php | 54 +++++++++++++++++++ src/app/Libraries/Helpers.php | 5 ++ src/app/User.php | 3 +- src/config/app.php | 2 +- ...11_05_164111_add_locale_to_users_table.php | 28 ++++++++++ .../app/components/_user-override.scss | 4 +- .../app/modules/_user-variables.scss | 14 +---- src/resources/views/accounts/index.blade.php | 16 ++++++ 11 files changed, 127 insertions(+), 18 deletions(-) create mode 100644 src/app/Http/Middleware/UserLocale.php create mode 100644 src/database/migrations/2023_11_05_164111_add_locale_to_users_table.php mode change 100644 => 120000 src/resources/assets/sass/stylesheets/app/components/_user-override.scss mode change 100644 => 120000 src/resources/assets/sass/stylesheets/app/modules/_user-variables.scss diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index 37264c98..45b1dcec 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -300,6 +300,10 @@ public function update(Request $request) $user->firstname = @$request->firstname; $user->surname = @$request->surname; + + if (isset($request->locale)) { + $user->locale = @$request->locale; + } if (!$user->save()) { return Redirect::back()->withFail("Oops, Something went Wrong."); diff --git a/src/app/Http/Controllers/Auth/LoginController.php b/src/app/Http/Controllers/Auth/LoginController.php index 916618f8..f8a0c80a 100644 --- a/src/app/Http/Controllers/Auth/LoginController.php +++ b/src/app/Http/Controllers/Auth/LoginController.php @@ -2,6 +2,9 @@ namespace App\Http\Controllers\Auth; +use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\Cookie; + use Session; use Settings; @@ -71,8 +74,19 @@ public function login(Request $request) return Redirect::back()->withError('You have been banned.'); } } + + if ($this->attemptLogin($request)) { + // Check if the user's locale is set and exists in the list of allowed locales + \Log::info("Locale from User: " . $user->locale); + + if ($user->locale && in_array($user->locale, config('app.locales'))) { + App::setLocale($user->locale); // Set the application locale to user preference + session(['locale' => $user->locale]); // Optional: Store in session + // Set a cookie for locale that lasts a long time, for example a year + Cookie::queue('locale', $user->locale, 525600); + } if ((!isset($user->phonenumber) || $user->phonenumber == null) && Settings::isAuthRequirePhonenumberEnabled()) { return redirect('/account/email'); // redirect to site } diff --git a/src/app/Http/Kernel.php b/src/app/Http/Kernel.php index a360bb3f..95575b27 100644 --- a/src/app/Http/Kernel.php +++ b/src/app/Http/Kernel.php @@ -29,6 +29,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, + \App\Http\Middleware\UserLocale::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, diff --git a/src/app/Http/Middleware/UserLocale.php b/src/app/Http/Middleware/UserLocale.php new file mode 100644 index 00000000..4aebb23f --- /dev/null +++ b/src/app/Http/Middleware/UserLocale.php @@ -0,0 +1,54 @@ +locale; + \Log::info("Locale set from User: " . $userLocale); + // Override with the user's preference if it's set + if ($userLocale) { + $locale = $userLocale; + \Log::info("Language of the user: " . $locale); + } + } else { + \Log::info("No authenticated user."); + } + // Override with the user's preference if authenticated + if (Auth::check() && Auth::user()->language) { + $locale = Auth::user()->language; + \Log::info("Language of the user: " . $locale); + } + + $locale_dirs = array_filter(glob(app()->langPath() . '/*'), 'is_dir'); + if (in_array(app()->langPath() . '/' . $locale, $locale_dirs)) { + App::setLocale($locale); + } + + return $next($request); + } +} diff --git a/src/app/Libraries/Helpers.php b/src/app/Libraries/Helpers.php index 88f78dd8..c3c4b295 100644 --- a/src/app/Libraries/Helpers.php +++ b/src/app/Libraries/Helpers.php @@ -20,6 +20,9 @@ class Helpers { + public static function getSupportedLocales() { + return config('app.locales', []); + } // TODO - refactor - eg getGameSelectArray - specifially the selectArray part /** * Get Venues @@ -938,4 +941,6 @@ public static function getLatinAlphabetUpperLetterByIndex($index) { return range('A', 'Z')[$index - 1]; } + + } diff --git a/src/app/User.php b/src/app/User.php index cacc1585..383b8b47 100644 --- a/src/app/User.php +++ b/src/app/User.php @@ -38,7 +38,8 @@ class User extends Authenticatable implements MustVerifyEmail 'avatar', 'steamid', 'last_login', - 'email_verified_at' + 'email_verified_at', + 'locale' ]; /** diff --git a/src/config/app.php b/src/config/app.php index f8c90c0b..2c91986f 100644 --- a/src/config/app.php +++ b/src/config/app.php @@ -122,5 +122,5 @@ 'JsonLd' => Artesaos\SEOTools\Facades\JsonLd::class, 'Debugbar' => Barryvdh\Debugbar\Facade::class, ], - + 'locales' => ['en', 'es', 'fr', 'de'], ]; diff --git a/src/database/migrations/2023_11_05_164111_add_locale_to_users_table.php b/src/database/migrations/2023_11_05_164111_add_locale_to_users_table.php new file mode 100644 index 00000000..510b87f5 --- /dev/null +++ b/src/database/migrations/2023_11_05_164111_add_locale_to_users_table.php @@ -0,0 +1,28 @@ +string('locale')->default('en'); // Assuming 'en' is the default language + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('locale'); // This will remove the 'language' column + }); + } +}; diff --git a/src/resources/assets/sass/stylesheets/app/components/_user-override.scss b/src/resources/assets/sass/stylesheets/app/components/_user-override.scss deleted file mode 100644 index 31535938..00000000 --- a/src/resources/assets/sass/stylesheets/app/components/_user-override.scss +++ /dev/null @@ -1,3 +0,0 @@ -/** - * User Override - For use through the admin interface - */ diff --git a/src/resources/assets/sass/stylesheets/app/components/_user-override.scss b/src/resources/assets/sass/stylesheets/app/components/_user-override.scss new file mode 120000 index 00000000..ab4d97f9 --- /dev/null +++ b/src/resources/assets/sass/stylesheets/app/components/_user-override.scss @@ -0,0 +1 @@ +/web/html/storage/user/scss/_user-override.scss \ No newline at end of file diff --git a/src/resources/assets/sass/stylesheets/app/modules/_user-variables.scss b/src/resources/assets/sass/stylesheets/app/modules/_user-variables.scss deleted file mode 100644 index 3c296cc8..00000000 --- a/src/resources/assets/sass/stylesheets/app/modules/_user-variables.scss +++ /dev/null @@ -1,13 +0,0 @@ -// User Variable Overrides -$color_primary: orange; -$color_primary_text: white; -$color_secondary: #333; -$color_secondary_text: white; -$color_body_links: orange; -$color_body_background: #fff; -$color_body_text: #333; -$color_header_background: #333; -$color_header_text: #9d9d9d; -$color_header_links: #fff; -$color_header_links_hover: orange; -$color_header_line: orange; \ No newline at end of file diff --git a/src/resources/assets/sass/stylesheets/app/modules/_user-variables.scss b/src/resources/assets/sass/stylesheets/app/modules/_user-variables.scss new file mode 120000 index 00000000..97d423f7 --- /dev/null +++ b/src/resources/assets/sass/stylesheets/app/modules/_user-variables.scss @@ -0,0 +1 @@ +/web/html/storage/user/scss/_user-variables.scss \ No newline at end of file diff --git a/src/resources/views/accounts/index.blade.php b/src/resources/views/accounts/index.blade.php index 7e8f18cd..51706e1b 100644 --- a/src/resources/views/accounts/index.blade.php +++ b/src/resources/views/accounts/index.blade.php @@ -83,6 +83,22 @@ @enderror
+
+
+
+ {{ Form::label('locale',__('accounts.locale'),array('id'=>'','class'=>'')) }} + + + + {{ Form::label('venue','Venue',array('id'=>'','class'=>'')) }} + {{ Form::select('venue', Helpers::getVenues(), $event->venue->id, array('id'=>'venue','class'=>'form-control')) }} + +
+
+
@endif
From 430af20cf4b8bca2e72efce3e06ef4f7f08ba172 Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Wed, 8 Nov 2023 08:44:05 +0100 Subject: [PATCH 33/59] WIP from Chaos added update avatar func extra avatar section in account index page prepared for selection --- .../Http/Controllers/AccountController.php | 15 ++++++++ src/resources/views/accounts/index.blade.php | 38 +++++++++++++++---- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index 37264c98..0d299bcb 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -348,4 +348,19 @@ public function updateMail(Request $request) } return redirect('/'); } + + public function update_avatar(Request $request) { + $this->validate($request, [ + 'avatar' => 'required|image|mimes:jpg,png,jpeg,gif,svg|max:2048', + ]); + + $filename = Auth::id() . '_' . time() . '.' . $request->avatar->getClientOriginalExtension(); + $request->avatar->move(public_path('uploads/avatars'), $filename); + + $user = Auth::user(); + $user->avatar = $filename; + $user->save(); + + return Redirect::back()->withSuccess('Account successfully updated!'); + } } diff --git a/src/resources/views/accounts/index.blade.php b/src/resources/views/accounts/index.blade.php index 7e8f18cd..026e54dc 100644 --- a/src/resources/views/accounts/index.blade.php +++ b/src/resources/views/accounts/index.blade.php @@ -34,12 +34,7 @@
{{ Form::open(array('url'=>'/account/' )) }}
-
- @if ($user->avatar != NULL) - {{ $user->username }}'s Avatar - @endif -
-
+
@@ -90,7 +85,6 @@ {{ Form::close() }}
-
@@ -133,6 +127,36 @@ {{ Form::close() }}
+ + + +
+
+
+

Avatar

+
+
+

You can use your Steam Avatar or upload a custom one.

+ {{ Form::open(array('url'=>'/account/' )) }} +
+
+ @if ($user->avatar) + {{ $user->username }}'s Avatar + @else + + {{ $user->username }}'s Avatar + @endif +
+ {{ Form::label('images','Select Images',array('id'=>'','class'=>'')) }} + {{ Form::file('images[]',array('id'=>'images','class'=>'form-control', 'multiple'=>true)) }} +
+ + {{ Form::close() }} +
+
+
+
+
@if ($creditLogs)
From cd99a93c5996e1e3ce76add0b4e85902f015dd7e Mon Sep 17 00:00:00 2001 From: Mawiguk0 Date: Thu, 14 Dec 2023 15:57:56 +0100 Subject: [PATCH 34/59] WIP: Works without Steam Profile Avant --- .../Http/Controllers/AccountController.php | 12 +++--- src/app/Http/routes.php | 1 + src/resources/views/accounts/index.blade.php | 39 ++++++++++++------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index 0d299bcb..283c7974 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -13,6 +13,8 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; class AccountController extends Controller @@ -353,12 +355,12 @@ public function update_avatar(Request $request) { $this->validate($request, [ 'avatar' => 'required|image|mimes:jpg,png,jpeg,gif,svg|max:2048', ]); - - $filename = Auth::id() . '_' . time() . '.' . $request->avatar->getClientOriginalExtension(); - $request->avatar->move(public_path('uploads/avatars'), $filename); - + + $path = Storage::putFile( + 'public/images/avatars', $request->file('avatar') + ); $user = Auth::user(); - $user->avatar = $filename; + $user->avatar = '/storage/images/avatars/' . basename($path); $user->save(); return Redirect::back()->withSuccess('Account successfully updated!'); diff --git a/src/app/Http/routes.php b/src/app/Http/routes.php index 3cd3d4a6..89e166f7 100644 --- a/src/app/Http/routes.php +++ b/src/app/Http/routes.php @@ -128,6 +128,7 @@ Route::delete('/account/tokens/remove/{token}', 'AccountController@removeToken'); Route::post('/account', 'AccountController@update'); Route::post('/account/delete', 'Auth\SteamController@destroy'); + Route::post('/account/avatar', 'AccountController@update_avatar'); }); Route::group(['middleware' => ['auth', 'banned']], function () { diff --git a/src/resources/views/accounts/index.blade.php b/src/resources/views/accounts/index.blade.php index 026e54dc..1c22330b 100644 --- a/src/resources/views/accounts/index.blade.php +++ b/src/resources/views/accounts/index.blade.php @@ -128,35 +128,44 @@
- - -
-
-
-

Avatar

+ +
+
+

Avatar Settings

You can use your Steam Avatar or upload a custom one.

- {{ Form::open(array('url'=>'/account/' )) }} + {{ Form::open(array('url'=>'/account/avatar', 'files' => 'true')) }} +
+ + + + + +
+ @if ($user->avatar) - {{ $user->username }}'s Avatar + {{ $user->username }}'s Avatar @else {{ $user->username }}'s Avatar @endif -
- {{ Form::label('images','Select Images',array('id'=>'','class'=>'')) }} - {{ Form::file('images[]',array('id'=>'images','class'=>'form-control', 'multiple'=>true)) }} + +
+ {{ Form::label('custom_image', 'Select Images', array('id' => '', 'class' => '')) }} + {{ Form::file('avatar', array('id' => 'avatar', 'class' => 'form-control')) }}
+ - {{ Form::close() }} -
+
-
+
+ {{ Form::close() }}
-
+
+ @if ($creditLogs)
From 133545bb7490eb492d66008105cd818b3f052a4b Mon Sep 17 00:00:00 2001 From: Markus Kohn Date: Mon, 11 Nov 2024 14:24:19 +0100 Subject: [PATCH 35/59] Solving of Issue #922 --- src/app/Http/Controllers/Admin/GamesController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/Http/Controllers/Admin/GamesController.php b/src/app/Http/Controllers/Admin/GamesController.php index c49546a1..1f0feb6a 100644 --- a/src/app/Http/Controllers/Admin/GamesController.php +++ b/src/app/Http/Controllers/Admin/GamesController.php @@ -219,7 +219,10 @@ public function update(Game $game, Request $request) } if ($request->file('image_thumbnail')) { - Storage::delete($game->image_thumbnail_path); + // Check if the image exists in storage before attempting to delete + if ($game->image_thumbnail_path && Storage::exists($game->image_thumbnail_path)) { + Storage::delete($game->image_thumbnail_path); + } $imageName = 'thumbnail.' . $request->file('image_thumbnail')->getClientOriginalExtension(); Image::read($request->file('image_thumbnail')) ->resize(500, 500) From 37f3cba377b5f4d4fd0eeea23bdabe405e705a66 Mon Sep 17 00:00:00 2001 From: Markus Kohn Date: Mon, 11 Nov 2024 14:38:00 +0100 Subject: [PATCH 36/59] Fixing for behavior for banner image fixes #922 --- src/app/Http/Controllers/Admin/GamesController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/Http/Controllers/Admin/GamesController.php b/src/app/Http/Controllers/Admin/GamesController.php index 1f0feb6a..1a46858e 100644 --- a/src/app/Http/Controllers/Admin/GamesController.php +++ b/src/app/Http/Controllers/Admin/GamesController.php @@ -235,7 +235,10 @@ public function update(Game $game, Request $request) } if ($request->file('image_header')) { - Storage::delete($game->image_header_path); + // Check if the image exists in storage before attempting to delete + if ($game->image_header_path && Storage::exists($game->image_header_path)) { + Storage::delete($game->image_header_path); + } $imageName = 'header.' . $request->file('image_header')->getClientOriginalExtension(); Image::read($request->file('image_header')) ->resize(1600, 400) From bd78a959e22533dfa41882ee846844cf13d49905 Mon Sep 17 00:00:00 2001 From: Markus Kohn Date: Mon, 11 Nov 2024 14:43:13 +0100 Subject: [PATCH 37/59] Added the partial for sponsors also in the events/show view --- src/resources/views/events/show.blade.php | 16 +----------- .../_partials/_sponsors/index.blade.php | 26 +++++++++---------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/resources/views/events/show.blade.php b/src/resources/views/events/show.blade.php index 52e6cb2f..9f06ee66 100644 --- a/src/resources/views/events/show.blade.php +++ b/src/resources/views/events/show.blade.php @@ -197,21 +197,7 @@
- @if (!$event->sponsors->isEmpty()) -
- -

@lang('events.eventsponsoredby', ['event' => $event->display_name])

-
- @foreach ($event->sponsors as $sponsor) - - - - - {{ $sponsor->website}} - - - @endforeach - @endif + @include ('layouts._partials._sponsors.index') diff --git a/src/resources/views/layouts/_partials/_sponsors/index.blade.php b/src/resources/views/layouts/_partials/_sponsors/index.blade.php index bc3e8138..9d648403 100644 --- a/src/resources/views/layouts/_partials/_sponsors/index.blade.php +++ b/src/resources/views/layouts/_partials/_sponsors/index.blade.php @@ -1,21 +1,21 @@ @if (!$event->sponsors->isEmpty())
-

@lang('events.eventsponsoredby', ['event' => $event->display_name]) By Partial

+

@lang('events.eventsponsoredby', ['event' => $event->display_name])

-
+
@foreach ($event->sponsors as $sponsor) - From a7bada02c77d8681f88246e1786deb3aba21949d Mon Sep 17 00:00:00 2001 From: Markus Kohn Date: Mon, 11 Nov 2024 15:57:27 +0100 Subject: [PATCH 38/59] finalization of user-locales --- .../Http/Controllers/AccountController.php | 1 + src/app/Http/Middleware/UserLocale.php | 59 +++++++++---------- src/lang/de/accounts.php | 1 + src/lang/en/accounts.php | 1 + src/resources/views/accounts/index.blade.php | 31 +++++----- 5 files changed, 48 insertions(+), 45 deletions(-) diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index 28b3b839..c8a450da 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -300,6 +300,7 @@ public function update(Request $request) if (isset($request->locale)) { $user->locale = @$request->locale; + \Log::info("Submitted locale value: " . @$request->locale); } if (!$user->save()) { diff --git a/src/app/Http/Middleware/UserLocale.php b/src/app/Http/Middleware/UserLocale.php index 4aebb23f..c8670ac4 100644 --- a/src/app/Http/Middleware/UserLocale.php +++ b/src/app/Http/Middleware/UserLocale.php @@ -2,19 +2,13 @@ namespace App\Http\Middleware; -use Auth; use Closure; -use Session; -use App; -use Config; -use App\Setting; - - +use Illuminate\Support\Facades\Auth; class UserLocale { /** - * Handle an incoming request. + * Handle an incoming request and set user locale if specified. * * @param \Illuminate\Http\Request $request * @param \Closure $next @@ -22,33 +16,36 @@ class UserLocale */ public function handle($request, Closure $next) { - \Log::info("UserLocale middleware called"); - // Set the locale from the site settings as default - $locale = Setting::getSiteLocale(); - \Log::info("Locale set from Site: " . $locale); - // Check if the user is authenticated before attempting to access user-specific settings - if (Auth::check()) { - $userLocale = Auth::user()->locale; - \Log::info("Locale set from User: " . $userLocale); - // Override with the user's preference if it's set - if ($userLocale) { - $locale = $userLocale; - \Log::info("Language of the user: " . $locale); - } - } else { - \Log::info("No authenticated user."); - } - // Override with the user's preference if authenticated - if (Auth::check() && Auth::user()->language) { - $locale = Auth::user()->language; - \Log::info("Language of the user: " . $locale); + // Set default locale as fallback + $locale = config('app.locale'); + + // Check if user is authenticated + if (!Auth::check()) { + return $next($request); // Proceed with default locale if not authenticated } - $locale_dirs = array_filter(glob(app()->langPath() . '/*'), 'is_dir'); - if (in_array(app()->langPath() . '/' . $locale, $locale_dirs)) { - App::setLocale($locale); + // Retrieve user locale + $userLocale = Auth::user()->locale; + + // Verify if user locale is set and valid + if (empty($userLocale) || !$this->isValidLocale($userLocale)) { + return $next($request); // Proceed with default locale if user's locale is invalid or not set } + // Apply the valid user locale + app()->setLocale($userLocale); + return $next($request); } + + /** + * Validate if the given locale exists in the language directory. + * + * @param string $locale + * @return bool + */ + protected function isValidLocale($locale) + { + return is_dir(app()->langPath() . '/' . $locale); + } } diff --git a/src/lang/de/accounts.php b/src/lang/de/accounts.php index ae1011e4..4b2130b8 100644 --- a/src/lang/de/accounts.php +++ b/src/lang/de/accounts.php @@ -92,4 +92,5 @@ 'new_token_wizzard_del_failed' => 'Das Löschen des alten Tokens ist fehlgeschlagen. Bitte versuche es noch einmal.', 'new_token_wizzard_creation_failed' => 'Das Erstellen des Tokens ist fehlgeschlagen. Bitte versuche es noch einmal.', 'new_token_wizzard_clickoncallback' => 'Du kannst auf Zurück verbinden klicken oder den Token manuell kopieren.', + 'locale' => 'Sprache', ]; diff --git a/src/lang/en/accounts.php b/src/lang/en/accounts.php index a6ca2168..86ba52c6 100644 --- a/src/lang/en/accounts.php +++ b/src/lang/en/accounts.php @@ -92,4 +92,5 @@ 'new_token_wizzard_del_failed' => 'Deletion of the old token failed. Please try again.', 'new_token_wizzard_creation_failed' => 'Creation of the token failed. Please try again.', 'new_token_wizzard_clickoncallback' => 'You can now click on the connect back button or you can copy the token manually to your application.', + 'locale' => 'Language', ]; diff --git a/src/resources/views/accounts/index.blade.php b/src/resources/views/accounts/index.blade.php index c58c1a15..cbfd82d1 100644 --- a/src/resources/views/accounts/index.blade.php +++ b/src/resources/views/accounts/index.blade.php @@ -78,22 +78,25 @@ @enderror
-
-
-
- {{ Form::label('locale',__('accounts.locale'),array('id'=>'','class'=>'')) }} - - - - {{ Form::label('venue','Venue',array('id'=>'','class'=>'')) }} - {{ Form::select('venue', Helpers::getVenues(), $event->venue->id, array('id'=>'venue','class'=>'form-control')) }} - -
+
+
+ {{ Form::label('locale', __('accounts.locale'), ['class' => '']) }} + + + @error('locale') +
{{ $message }}
+ @enderror
+ + + @endif
From 5491bd6aea3840114e6640265ea6d66fa1dc3473 Mon Sep 17 00:00:00 2001 From: Markus Kohn Date: Mon, 11 Nov 2024 16:01:46 +0100 Subject: [PATCH 39/59] fix: the language that the user has saved should also be selected in the form --- src/resources/views/accounts/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/views/accounts/index.blade.php b/src/resources/views/accounts/index.blade.php index cbfd82d1..3d6fa3ea 100644 --- a/src/resources/views/accounts/index.blade.php +++ b/src/resources/views/accounts/index.blade.php @@ -83,7 +83,7 @@ {{ Form::label('locale', __('accounts.locale'), ['class' => '']) }} - + {{ Form::close() }} diff --git a/src/resources/views/admin/users/show.blade.php b/src/resources/views/admin/users/show.blade.php index fe56e971..7197abcf 100644 --- a/src/resources/views/admin/users/show.blade.php +++ b/src/resources/views/admin/users/show.blade.php @@ -100,7 +100,7 @@ $labels[] = 'Freebie'; } if ($participant->staff == 1) { - $labels[] = 'Admin'; + $labels[] = 'Staff'; } if (empty($labels)) { $labels[] = 'No Ticket!'; From 5a2723861a12ef29f7baa7bff4238ca230aa620d Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Mon, 11 Nov 2024 22:36:10 +0100 Subject: [PATCH 44/59] remove signout / signin buttons for revoked participants and remove signin when revoking --- src/app/EventParticipant.php | 2 +- .../Admin/Events/ParticipantsController.php | 1 + .../admin/events/participants/index.blade.php | 22 ++++++++++--------- .../admin/events/participants/show.blade.php | 2 ++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/app/EventParticipant.php b/src/app/EventParticipant.php index c96e0f83..006cedc6 100644 --- a/src/app/EventParticipant.php +++ b/src/app/EventParticipant.php @@ -255,7 +255,7 @@ function setRevoked() if (!$this->seat) { return $this->save(); } - if (!$this->seat->delete()) { + if (!$this->seat->delete() || !$this->setSignIn(false)) { $this->revoked = false; return false; } diff --git a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php index 5a3c2647..06096806 100644 --- a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php +++ b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php @@ -137,6 +137,7 @@ public function signout(Event $event, EventParticipant $participant) Session::flash('alert-success', 'Participant ' . $participant->name . ' signed out!'); return Redirect::to('admin/events/' . $event->slug . '/participants/'); } + function revoke(Event $event, EventParticipant $participant) { if (!$participant->setRevoked()) { diff --git a/src/resources/views/admin/events/participants/index.blade.php b/src/resources/views/admin/events/participants/index.blade.php index f1a32af6..62aff383 100644 --- a/src/resources/views/admin/events/participants/index.blade.php +++ b/src/resources/views/admin/events/participants/index.blade.php @@ -98,16 +98,18 @@ - @if(!$participant->signed_in) - {{ Form::open(array('url'=>'/admin/events/' . $event->slug . '/participants/' . $participant->id . '/signin')) }} - - - - {{ Form::close() }} - @else - - - + @if (!$participant->revoked) + @if(!$participant->signed_in) + {{ Form::open(array('url'=>'/admin/events/' . $event->slug . '/participants/' . $participant->id . '/signin')) }} + + + + {{ Form::close() }} + @else + + + + @endif @endif diff --git a/src/resources/views/admin/events/participants/show.blade.php b/src/resources/views/admin/events/participants/show.blade.php index e0f552fc..4a66cc22 100644 --- a/src/resources/views/admin/events/participants/show.blade.php +++ b/src/resources/views/admin/events/participants/show.blade.php @@ -143,11 +143,13 @@
@else
+ @if (!$participant->revoked) + @endif @endif From a4fce3c490a7c51b3adbe8bf3ec86aae02a05b93 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Mon, 11 Nov 2024 22:41:22 +0100 Subject: [PATCH 45/59] add checks to prevent sign in/out of revoked participants --- .../Admin/Events/ParticipantsController.php | 10 +++++++++- .../Adminapi/Events/ParticipantsController.php | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php index 06096806..19690131 100644 --- a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php +++ b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php @@ -68,6 +68,10 @@ public function signIn(Event $event, EventParticipant $participant) Session::flash('alert-danger', 'Cannot sign in Participant because the payment is not completed!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); } + if ($participant->revoked) { + Session::flash('alert-danger', 'Cannot sign in a revoked Participant!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); + } if (!$participant->setSignIn()) { Session::flash('alert-danger', 'Cannot sign in Participant!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); @@ -129,6 +133,10 @@ public function signoutall(Event $event) */ public function signout(Event $event, EventParticipant $participant) { + if ($participant->revoked) { + Session::flash('alert-danger', 'Cannot sign out a revoked Participant!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); + } if (!$participant->setSignIn(false)) { Session::flash('alert-danger', 'Cannot sign out Participant! '. $participant->name); return Redirect::to('admin/events/' . $event->slug . '/participants/'); @@ -137,7 +145,7 @@ public function signout(Event $event, EventParticipant $participant) Session::flash('alert-success', 'Participant ' . $participant->name . ' signed out!'); return Redirect::to('admin/events/' . $event->slug . '/participants/'); } - + function revoke(Event $event, EventParticipant $participant) { if (!$participant->setRevoked()) { diff --git a/src/app/Http/Controllers/Adminapi/Events/ParticipantsController.php b/src/app/Http/Controllers/Adminapi/Events/ParticipantsController.php index 418ee20a..a0197afe 100644 --- a/src/app/Http/Controllers/Adminapi/Events/ParticipantsController.php +++ b/src/app/Http/Controllers/Adminapi/Events/ParticipantsController.php @@ -81,6 +81,13 @@ public function getParticipant(EventParticipant $participant) */ public function signIn(EventParticipant $participant) { + if ($participant->revoked) { + return [ + 'successful' => false, + 'reason' => 'Cannot sign in revoked Participant', + 'participant' => $participant, + ]; + } if (!$participant->setSignIn()) { return [ 'successful' => false, From 88e6b174cc27fed9d11708faa2473e78a841cadc Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Mon, 11 Nov 2024 22:47:43 +0100 Subject: [PATCH 46/59] moved total free and staff tickets logic to controller --- .../Admin/Events/TicketsController.php | 19 ++++++++++++++++++- .../admin/events/tickets/index.blade.php | 15 --------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/app/Http/Controllers/Admin/Events/TicketsController.php b/src/app/Http/Controllers/Admin/Events/TicketsController.php index 401b510d..9d4570b4 100644 --- a/src/app/Http/Controllers/Admin/Events/TicketsController.php +++ b/src/app/Http/Controllers/Admin/Events/TicketsController.php @@ -27,9 +27,26 @@ class TicketsController extends Controller */ public function index(Event $event) { + $users = User::all(); + $systemtickets = $users->sortByDesc(function($user) use ($event) { + return [ + $user->getFreeTickets($event->id)->count(), + $user->getStaffTickets($event->id)->count() + ]; + })->values(); + $totalFreeTickets = $systemtickets->sum(function($user) use ($event) { + return $user->getFreeTickets($event->id)->count(); + }); + + $totalStaffTickets = $systemtickets->sum(function($user) use ($event) { + return $user->getStaffTickets($event->id)->count(); + }); + return view('admin.events.tickets.index') ->withEvent($event) - ->withUsers(User::all()); + ->withTotalFreeTickets($totalFreeTickets) + ->withTotalStaffTickets($totalStaffTickets) + ->withUsers($users); } /** diff --git a/src/resources/views/admin/events/tickets/index.blade.php b/src/resources/views/admin/events/tickets/index.blade.php index 34383047..78376ecb 100644 --- a/src/resources/views/admin/events/tickets/index.blade.php +++ b/src/resources/views/admin/events/tickets/index.blade.php @@ -153,21 +153,6 @@
- @php - $users = $users->sortByDesc(function($user) use ($event) { - return [ - $user->getFreeTickets($event->id)->count(), - $user->getStaffTickets($event->id)->count() - ]; - })->values(); - $totalFreeTickets = $users->sum(function($user) use ($event) { - return $user->getFreeTickets($event->id)->count(); - }); - - $totalStaffTickets = $users->sum(function($user) use ($event) { - return $user->getStaffTickets($event->id)->count(); - }); - @endphp From 93b94c94f236c756fe71dc327b968b556c04ddfe Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Mon, 11 Nov 2024 22:51:00 +0100 Subject: [PATCH 47/59] removed because of redundance (global .gitignore wildcard) --- src/.gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index ef328098..65fec7e6 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -14,5 +14,3 @@ public/css/app\.css public/css/admin\.css\.map public/css/app\.css\.map public/uploads/gallery/ -public/js/vendor.js -public/js/vendor.min.js From ee65a61f623c9d5b1aa992b6a278cd3f19e5f086 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Mon, 11 Nov 2024 22:52:18 +0100 Subject: [PATCH 48/59] removed because of redundance (global .gitignore wildcard) --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index dd620c64..80871f7d 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,4 @@ docs/build docker-compose.local.yml docker-compose-dev.local.yml -dbfile.sql -src/public/js/vendor.js -src/public/js/vendor.min.js +dbfile.sql \ No newline at end of file From c6b72a46cd6f091b3dd4ee535fc41f2dbdc559d7 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Mon, 11 Nov 2024 23:00:26 +0100 Subject: [PATCH 49/59] remove duplicated include and remove unnessecary file of the sponsors partial --- src/resources/views/events/show.blade.php | 3 --- src/resources/views/layouts/_partials/_sponsors/show.blade.php | 0 2 files changed, 3 deletions(-) delete mode 100644 src/resources/views/layouts/_partials/_sponsors/show.blade.php diff --git a/src/resources/views/events/show.blade.php b/src/resources/views/events/show.blade.php index 9f06ee66..b97624da 100644 --- a/src/resources/views/events/show.blade.php +++ b/src/resources/views/events/show.blade.php @@ -199,9 +199,6 @@ @include ('layouts._partials._sponsors.index') - - @if (!empty($event->information))
diff --git a/src/resources/views/layouts/_partials/_sponsors/show.blade.php b/src/resources/views/layouts/_partials/_sponsors/show.blade.php deleted file mode 100644 index e69de29b..00000000 From 7417115446bcde3886ba0b071b7eed1cecc28444 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Mon, 11 Nov 2024 23:12:00 +0100 Subject: [PATCH 50/59] remove comment and add check if participant belongs to selected event --- .../Admin/Events/ParticipantsController.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php index 19690131..71b5ab01 100644 --- a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php +++ b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php @@ -63,7 +63,11 @@ public function update(Event $event, EventParticipant $participant, Request $req */ public function signIn(Event $event, EventParticipant $participant) { - // Maybe Check for a participant that is not participating in this event? + if ($participant->event->slug != $event->slug) + { + Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } if ($participant->ticket && $participant->purchase->status != "Success") { Session::flash('alert-danger', 'Cannot sign in Participant because the payment is not completed!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); @@ -82,6 +86,11 @@ public function signIn(Event $event, EventParticipant $participant) public function transfer(Event $event, EventParticipant $participant, Request $request) { + if ($participant->event->slug != $event->slug) + { + Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } if ($participant->ticket && $participant->purchase->status != "Success") { Session::flash('alert-danger', 'Cannot sign in Participant because the payment is not completed!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); @@ -133,6 +142,11 @@ public function signoutall(Event $event) */ public function signout(Event $event, EventParticipant $participant) { + if ($participant->event->slug != $event->slug) + { + Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } if ($participant->revoked) { Session::flash('alert-danger', 'Cannot sign out a revoked Participant!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); @@ -148,6 +162,11 @@ public function signout(Event $event, EventParticipant $participant) function revoke(Event $event, EventParticipant $participant) { + if ($participant->event->slug != $event->slug) + { + Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } if (!$participant->setRevoked()) { Session::flash('alert-danger', 'Cannot revoke Participant!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); @@ -158,6 +177,11 @@ function revoke(Event $event, EventParticipant $participant) function delete(Event $event, EventParticipant $participant) { + if ($participant->event->slug != $event->slug) + { + Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } if (!$participant->delete()) { Session::flash('alert-danger', 'Cannot delete participant'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); From e4496145a04b687b963903883a6eea6538eff45a Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Mon, 11 Nov 2024 23:33:00 +0100 Subject: [PATCH 51/59] set default order of eventTimetableData via globalscope and remove manual fixes --- src/app/EventTimetableData.php | 12 ++++++++++++ .../Admin/Events/TimetablesController.php | 6 ------ src/app/Http/Controllers/Events/EventsController.php | 10 ---------- src/app/Http/Controllers/HomeController.php | 6 ------ 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/app/EventTimetableData.php b/src/app/EventTimetableData.php index 7b7aad2e..bfd76dd9 100644 --- a/src/app/EventTimetableData.php +++ b/src/app/EventTimetableData.php @@ -5,6 +5,8 @@ use App\EventTimetable; use App\Http\Requests; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Builder; + class EventTimetableData extends Model { @@ -22,4 +24,14 @@ public function timetable() { return $this->belongsTo('App\EventTimetable'); } + + + protected static function boot() + { + parent::boot(); + + static::addGlobalScope('start_time', function (Builder $builder) { + $builder->orderBy('start_time', 'asc'); + }); + } } diff --git a/src/app/Http/Controllers/Admin/Events/TimetablesController.php b/src/app/Http/Controllers/Admin/Events/TimetablesController.php index 1cfbb331..45766257 100644 --- a/src/app/Http/Controllers/Admin/Events/TimetablesController.php +++ b/src/app/Http/Controllers/Admin/Events/TimetablesController.php @@ -29,12 +29,6 @@ class TimetablesController extends Controller */ public function index(Event $event) { - foreach ($event->timetables as $timetable) { - $timetable->data = EventTimetableData::where('event_timetable_id', $timetable->id) - ->orderBy('start_time', 'asc') - ->get(); - } - return view('admin.events.timetables.index') ->withEvent($event); } diff --git a/src/app/Http/Controllers/Events/EventsController.php b/src/app/Http/Controllers/Events/EventsController.php index 2eabb611..08e44880 100644 --- a/src/app/Http/Controllers/Events/EventsController.php +++ b/src/app/Http/Controllers/Events/EventsController.php @@ -82,16 +82,6 @@ public function show(Event $event) OpenGraph::setDescription(Helpers::getSeoCustomDescription($event->desc_short)); OpenGraph::addProperty('type', 'article'); - $event->load( - 'timetables' - ); - - foreach ($event->timetables as $timetable) { - $timetable->data = EventTimetableData::where('event_timetable_id', $timetable->id) - ->orderBy('start_time', 'asc') - ->get(); - } - return view('events.show') ->withEvent($event); } diff --git a/src/app/Http/Controllers/HomeController.php b/src/app/Http/Controllers/HomeController.php index 0b4051bc..094ce645 100644 --- a/src/app/Http/Controllers/HomeController.php +++ b/src/app/Http/Controllers/HomeController.php @@ -288,14 +288,8 @@ public function event() // Loading can be done like this in one call of load function $event->load( 'eventParticipants.user', - 'timetables' ); - foreach ($event->timetables as $timetable) { - $timetable->data = EventTimetableData::where('event_timetable_id', $timetable->id) - ->orderBy('start_time', 'asc') - ->get(); - } // TODO - Refactor $user = Auth::user(); From d9a073a4a4f2837c6152df8445ac3a90d12fce26 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 13 Nov 2024 00:05:13 +0100 Subject: [PATCH 52/59] big refactor of the HomeController --- src/app/Event.php | 60 ++++++ src/app/EventParticipant.php | 24 ++- src/app/Http/Controllers/HomeController.php | 201 +++----------------- src/app/Libraries/Helpers.php | 134 +++++++------ src/app/NewsArticle.php | 17 ++ src/app/User.php | 110 ++++++++--- src/resources/views/home.blade.php | 2 +- 7 files changed, 271 insertions(+), 277 deletions(-) diff --git a/src/app/Event.php b/src/app/Event.php index 773ac2dc..d041b6fe 100644 --- a/src/app/Event.php +++ b/src/app/Event.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; +use Carbon\Carbon; use Cviebrock\EloquentSluggable\Sluggable; @@ -91,6 +92,36 @@ protected static function boot() } } + + /** + * Scope a query to get the next upcoming event(s). + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param int $limit + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeNextUpcoming(Builder $query, int $limit = 1): Builder + { + return $query->where('end', '>=', Carbon::now()) + ->orderByRaw('ABS(DATEDIFF(events.end, NOW()))') + ->limit($limit); + } + + /** + * Scope a query to get the current active event(s). + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Carbon\Carbon|null $now + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCurrent(Builder $query, Carbon $now = null): Builder + { + $now = $now ?? Carbon::now(); + return $query->where('start', '<', $now) + ->where('end', '>', $now) + ->orderBy('id', 'desc'); + } + /* * Relationships */ @@ -334,4 +365,33 @@ public function addTagById($tag) } return true; } + + /** + * Get if Event is currently running + * @return Boolean + */ + public function isRunningCurrently() + { + return $this->isRunningOn(Carbon::now()); + } + + /** + * Get if Event is running on a specific date + * @param Carbon $date + * @return Boolean + */ + public function isRunningOn(Carbon $date) + { + return $date->between(Carbon::create($this->start),Carbon::create($this->end)); + } + + /** + * Get if Event has already ended + * @return Boolean + */ + public function hasEnded() + { + return Carbon::create($this->end)->greaterThan(Carbon::now()); + } + } diff --git a/src/app/EventParticipant.php b/src/app/EventParticipant.php index 006cedc6..5803474e 100644 --- a/src/app/EventParticipant.php +++ b/src/app/EventParticipant.php @@ -139,18 +139,15 @@ public function getGiftedByUser() */ public function generateQRCode($forcenewname = false) { - if(Str::startsWith(config('app.url'), ['http://', 'https://'])) { + if (Str::startsWith(config('app.url'), ['http://', 'https://'])) { $ticketUrl = config('app.url') . '/tickets/retrieve/' . $this->id; } else { $ticketUrl = 'https://' . config('app.url') . '/tickets/retrieve/' . $this->id; } - if (isset($this->qrcode) && $this->qrcode != "" && !$forcenewname) - { + if (isset($this->qrcode) && $this->qrcode != "" && !$forcenewname) { $qrCodeFullPath = $this->qrcode; - } - else - { + } else { $qrCodePath = 'storage/images/events/' . $this->event->slug . '/qr/'; $qrCodeFileName = $this->event->slug . '-' . Str::random(32) . '.png'; if (!file_exists($qrCodePath)) { @@ -205,7 +202,8 @@ public static function getNewParticipants($type = 'all') return $particpants; } - public function getPdf(): string { + public function getPdf(): string + { $user = Auth::user(); $data = new \stdClass(); // TODO: Probably don't use str_replace @@ -261,4 +259,16 @@ function setRevoked() } return $this->save(); } + + /** + * Check if participant is active + * @return Boolean + */ + public function isActive() + { + + return ($this->signed_in || $this->event->online_event) && + ($this->free || $this->staff || $this->purchase->status == "Success") && + (!$this->revoked); + } } diff --git a/src/app/Http/Controllers/HomeController.php b/src/app/Http/Controllers/HomeController.php index 094ce645..3caf0058 100644 --- a/src/app/Http/Controllers/HomeController.php +++ b/src/app/Http/Controllers/HomeController.php @@ -45,192 +45,43 @@ class HomeController extends Controller */ public function index() { - // Check for Event $user = Auth::user(); - // Is this user a eventParticipants? - if (empty($user->eventParticipants)) { - return $this->net(); + // redirect to home page if no event participants are available + if (!$user || empty($user->eventParticipants)) { + return $this->home(); } - Debugbar::addMessage("User: " . json_encode($user)); - Debugbar::addMessage("Participants: " . json_encode($user->eventParticipants), 'Event'); - - // Getting the Current Time once - $currentDateTime = Carbon::now(); - // Loop trough the eventParticipants - // The first one, that is active (see def. below) returns the event page + // The first one, whos event is currently running and that is active redirects to the event page foreach ($user->eventParticipants as $participant) { - if ($this->isActiveParticipant($participant, $currentDateTime)) { - Debugbar::addMessage("Participant gets event", 'Event'); + if ($participant->event->isRunningCurrently() && $participant->isActive()) { return $this->event(); } } - return $this->net(); + // redirect to home page by default + return $this->home(); } - /** - * Determines if a participant is active based on several conditions: - * - A Event is currently running - * - the participant is signed In or Online Event - * - has purchased successful or is free or is staff - * - * @param $participant - * @param $currentDateTime - * @return bool - */ - protected function isActiveParticipant($participant, $currentDateTime): bool - { - try - { - // Check if current time is within the event's start and end time - $isWithinEventTime = $currentDateTime >= $participant->event->start && - $currentDateTime <= $participant->event->end; - // Conditions for active participants - $isActive = ($participant->signed_in || $participant->event->online_event) && - ($participant->free || $participant->staff || $participant->purchase->status == "Success"); - - return $isWithinEventTime && $isActive; - } catch (\Exception $e) { - // Log the error for diagnosis - Debugbar::addMessage('Error checking participant activity: ' . $e->getMessage(), 'Event'); - - return false; // Default value if an exception occurs - } - } /** - * Show New Page + * Show Home Page * @return View */ - public function net() + public function home() { - $topAttendees = $this->getTopAttendees(); - $topWinners = $this->getTopWinners(); - - $gameServerList = Helpers::getPublicGameServers(); - return view("home") - ->withNextEvent($this->getNextEvent()) - ->withTopAttendees(array_slice($topAttendees, 0, 5)) - ->withTopWinners(array_slice($topWinners, 0, 5)) - ->withGameServerList($gameServerList) - ->withNewsArticles($this->getLatestNewsArticles()) - ->withEvents($this->getAllEvents()) + ->withNextEvent(Event::nextUpcoming()->first()) + ->withTopAttendees(Helpers::getTopAttendees()) + ->withTopWinners(Helpers::getTopWinners()) + ->withGameServerList(Helpers::getPublicGameServers()) + ->withNewsArticles(NewsArticle::latestArticles()->get()) + ->withEvents(Event::all()) ->withSliderImages(SliderImage::getImages('frontpage')) ; } - - - /** - * Get top attendees by event count. - * - * @return array - */ - protected function getTopAttendees(): array - { - $attendees = []; - foreach (EventParticipant::groupBy('user_id', 'event_id')->get() as $attendee) { - if (!$attendee->event || $attendee->event->status != 'PUBLISHED' || $attendee->event->end >= Carbon::today()) { - continue; - } - - $userId = $attendee->user->id; - if (!$attendee->user->admin && isset($attendees[$userId])) { - $attendees[$userId]->event_count++; - } elseif (!$attendee->user->admin) { - $attendee->user->event_count = 1; - $attendees[$userId] = $attendee->user; - } - } - - usort($attendees, function ($a, $b) { - return $b['event_count'] <=> $a['event_count']; - }); - - return $attendees; - } - - /** - * Get top winners by win count. - * - * @return array - */ - protected function getTopWinners(): array - { - $winners = []; - - // Process winner teams - foreach (EventTournamentTeam::where('final_rank', 1)->get() as $team) { - foreach ($team->tournamentParticipants as $participant) { - $this->updateWinCount($winners, $participant->eventParticipant->user); - } - } - - // Process individual winners - foreach (EventTournamentParticipant::where('final_rank', 1)->get() as $winner) { - $this->updateWinCount($winners, $winner->eventParticipant->user); - } - - usort($winners, function ($a, $b) { - return $b['win_count'] <=> $a['win_count']; - }); - - return $winners; - } - - /** - * Update the win count for a given user. - * - * @param array $winners - * @param $user - */ - protected function updateWinCount(array &$winners, $user): void - { - $userId = $user->id; - if (isset($winners[$userId])) { - $winners[$userId]->win_count++; - } else { - $user->win_count = 1; - $winners[$userId] = $user; - } - } - - /** - * Get the next upcoming event. - * - * @return mixed - */ - protected function getNextEvent() - { - return Event::where('end', '>=', Carbon::now()) - ->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))')) - ->first(); - } - - /** - * Get the latest news articles. - * - * @return mixed - */ - protected function getLatestNewsArticles() - { - return NewsArticle::limit(2)->orderBy('created_at', 'desc')->get(); - } - - /** - * Get all events. - * - * @return mixed - */ - protected function getAllEvents() - { - return Event::all(); - } - /** * Show About us Page * @return View @@ -275,21 +126,18 @@ public function event() { $signedIn = true; $gameServerList = Helpers::getCasualGameServers(); - - // Using Carbon for date manipulations - $now = Carbon::now(); - $event = Event::where('start', '<', $now)->where('end', '>', $now)->orderBy('id', 'desc')->first(); - // Check if event is null and handle it + $event = Event::current()->first(); + // Check if event is null and handle it if (!$event) { return redirect()->route('home.index')->with('error', 'No active event found.'); } // Loading can be done like this in one call of load function $event->load( - 'eventParticipants.user', + 'eventParticipants.user', ); - + // TODO - Refactor $user = Auth::user(); @@ -312,7 +160,6 @@ public function event() $currentuser = Auth::id(); $openpublicmatches = MatchMaking::where(['ispublic' => 1, 'status' => 'OPEN'])->orderByDesc('created_at')->paginate(4, ['*'], 'openpubmatches'); - // $liveclosedpublicmatches = MatchMaking::where(['ispublic' => 1, 'status' => 'WAITFORPLAYERS'])->orWhere(['ispublic' => 1, 'status' => 'LIVE'])->orWhere(['ispublic' => 1, 'status' => 'COMPLETE'])->orderByDesc('created_at')->paginate(4, ['*'], 'closedpubmatches'); $liveclosedpublicmatches = MatchMaking::where(function ($query) { $query->where('ispublic', 1); $query->where('status', 'WAITFORPLAYERS'); @@ -323,15 +170,13 @@ public function event() $query->where('ispublic', 1); $query->where('status', 'COMPLETE'); })->orderByDesc('created_at')->paginate(4, ['*'], 'closedpubmatches');; - + $ownedmatches = MatchMaking::where(['owner_id' => $currentuser])->orderByDesc('created_at')->paginate(4, ['*'], 'owenedpage')->fragment('ownedmatches'); $memberedteams = Auth::user()->matchMakingTeams()->orderByDesc('created_at')->paginate(4, ['*'], 'memberedmatches')->fragment('memberedmatches'); $currentuseropenlivependingdraftmatches = array(); - - foreach (MatchMaking::where(['status' => 'OPEN'])->orWhere(['status' => 'LIVE'])->orWhere(['status' => 'DRAFT'])->orWhere(['status' => 'PENDING'])->get() as $match) - { - if ($match->getMatchTeamPlayer(Auth::id())) - { + + foreach (MatchMaking::where(['status' => 'OPEN'])->orWhere(['status' => 'LIVE'])->orWhere(['status' => 'DRAFT'])->orWhere(['status' => 'PENDING'])->get() as $match) { + if ($match->getMatchTeamPlayer(Auth::id())) { $currentuseropenlivependingdraftmatches[$match->id] = $match->id; } } diff --git a/src/app/Libraries/Helpers.php b/src/app/Libraries/Helpers.php index 6747649a..ad9a4c72 100644 --- a/src/app/Libraries/Helpers.php +++ b/src/app/Libraries/Helpers.php @@ -10,6 +10,7 @@ use DB; use App\GameServerCommandParameter; use App\EventTournament; +use App\EventParticipant; use App\User; use App\GameServer; use GuzzleHttp\Client; @@ -20,10 +21,11 @@ use Illuminate\Support\Collection; use Illuminate\Pagination\LengthAwarePaginator; use HaydenPierce\ClassFinder\ClassFinder; - + class Helpers { - public static function getSupportedLocales() { + public static function getSupportedLocales() + { return config('app.locales', []); } // TODO - refactor - eg getGameSelectArray - specifially the selectArray part @@ -149,91 +151,66 @@ public static function getEventTotal() return Settings::getEventCountOffset() + $events; } - // TODO - move to model /** - * Get Next Event Name - * @return String + * Get Next Event Name. + * + * @return string */ public static function getNextEventName() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - if ($event->status == 'DRAFT' || $event->status == 'PREVIEW') { - return $event->display_name . ' - ' . $event->status; - } - return $event->display_name; + if ($event = Event::nextUpcoming()->first()) { + return ($event->status == 'DRAFT' || $event->status == 'PREVIEW') + ? $event->display_name . ' - ' . $event->status + : $event->display_name; } return 'Coming soon...'; } /** - * Get Next Event Slug - * @return String + * Get Next Event Slug. + * + * @return string */ public static function getNextEventSlug() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - return $event->slug; - } - return '#'; + return ($event = Event::nextUpcoming()->first()) ? $event->slug : '#'; } - /** - * Get Next Event Description - * @return String + * Get Next Event Description. + * + * @return string */ public static function getNextEventDesc() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - return $event->desc_long; - } - return 'Coming soon...'; + return ($event = Event::nextUpcoming()->first()) ? $event->desc_long : 'Coming soon...'; } /** - * Get Next Event Start Date - * @return String + * Get Next Event Start Date. + * + * @return string */ public static function getNextEventStartDate() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - return date("d-m-Y H:i", strtotime($event->start)); - } - return 'Coming soon...'; + return ($event = Event::nextUpcoming()->first()) + ? date("d-m-Y H:i", strtotime($event->start)) + : 'Coming soon...'; } /** - * Get Next Event End Date - * @return String + * Get Next Event End Date. + * + * @return string */ public static function getNextEventEndDate() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - return date("d-m-Y H:i", strtotime($event->end)); - } - return 'Coming soon...'; + return ($event = Event::nextUpcoming()->first()) + ? date("d-m-Y H:i", strtotime($event->end)) + : 'Coming soon...'; } + /** * Get Total Event Participants Count * @return Integer @@ -963,26 +940,59 @@ public static function getPoweredByLine() } public static function getSeoKeywords() { - return explode(',',config('settings.seo_keywords'). ',Lan2Play Eventula Manager'); - } - + return explode(',', config('settings.seo_keywords') . ',Lan2Play Eventula Manager'); + } + public static function getSeoDescription() { - return config('settings.org_tagline'). Helpers::getPoweredByLine(); + return config('settings.org_tagline') . Helpers::getPoweredByLine(); } public static function getSeoCustomDescription($description) { - return $description. Helpers::getPoweredByLine(); + return $description . Helpers::getPoweredByLine(); } - public static function getExistingSeatingPlansSelect() { + public static function getExistingSeatingPlansSelect() + { $result = []; - foreach(EventSeatingPlan::all(['id', 'name', 'event_id']) as $plan) { + foreach (EventSeatingPlan::all(['id', 'name', 'event_id']) as $plan) { $event = Event::where('id', $plan->event_id)->first(); $result[$event->display_name] ??= []; $result[$event->display_name][$plan->id] = $plan->name; } return $result; } + + /** + * Get top attendees by event count. + * + * @param int $count + * @return Collection + */ + public static function getTopAttendees(int $count = 5): Collection + { + $users = User::where('admin', 0)->get(); + return $users->filter(function ($user) { + return $user->unique_attended_event_count > 0; + }) + ->sortByDesc('unique_attended_event_count') + ->take($count); + } + + /** + * Get top winners by win count. + * + * @param int $count + * @return Collection + */ + public static function getTopWinners(int $count = 5): Collection + { + $users = User::all(); + return $users->filter(function ($user) { + return $user->win_count > 0; + }) + ->sortByDesc('win_count') + ->take($count); + } } diff --git a/src/app/NewsArticle.php b/src/app/NewsArticle.php index b7333ee9..7a10491c 100644 --- a/src/app/NewsArticle.php +++ b/src/app/NewsArticle.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; use Cviebrock\EloquentSluggable\Sluggable; +use Illuminate\Database\Eloquent\Builder; class NewsArticle extends Model { @@ -28,6 +29,18 @@ class NewsArticle extends Model 'created_at', ); + /** + * Scope a query to get the latest news articles. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param int $limit + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeLatestArticles(Builder $query, int $limit = 2): Builder + { + return $query->orderBy('created_at', 'desc')->limit($limit); + } + /* * Relationships */ @@ -103,4 +116,8 @@ public function getTags($separator = ', ') { return implode($separator, $this->tags->pluck('tag')->toArray()); } + + + + } diff --git a/src/app/User.php b/src/app/User.php index ab9ffd8c..ae87470d 100644 --- a/src/app/User.php +++ b/src/app/User.php @@ -15,6 +15,8 @@ use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; +use Illuminate\Database\Eloquent\Casts\Attribute; +use Illuminate\Database\Eloquent\Builder; use Debugbar; use Laravel\Sanctum\HasApiTokens; @@ -52,6 +54,16 @@ class User extends Authenticatable implements MustVerifyEmail 'remember_token', ]; + /** + * The accessors to append to the model's array form. + * + * @var array + */ + protected $appends = [ + 'unique_attended_event_count', + 'win_count' + ]; + public static function boot() { parent::boot(); @@ -79,7 +91,6 @@ public function matchMakingTeamplayers() public function matchMakingTeams() { return $this->hasManyThrough('App\MatchMakingTeam', 'App\MatchMakingTeamPlayer', 'user_id', 'id', 'id', 'matchmaking_team_id'); - } public function purchases() { @@ -107,12 +118,9 @@ public function getAdmin() public function setActiveEventParticipant($event) { // TODO Enable signed in again depending on tournament setting - if ($event->online_event) - { + if ($event->online_event) { $clauses = ['user_id' => $this->id]; - } - else - { + } else { $clauses = ['user_id' => $this->id, 'signed_in' => true]; } @@ -120,28 +128,21 @@ public function setActiveEventParticipant($event) $freeparticipant = EventParticipant::where('free', true)->where($clauses)->orderBy('updated_at', 'DESC')->first(); - if (isset($payedparticipant) && isset($freeparticipant)) - { - if ($payedparticipant->updated_at->greaterThan($freeparticipant->updated_at)) - { + if (isset($payedparticipant) && isset($freeparticipant)) { + if ($payedparticipant->updated_at->greaterThan($freeparticipant->updated_at)) { $this->active_event_participant = $payedparticipant; - } - else - { + } else { $this->active_event_participant = $freeparticipant; } } - if (!isset($payedparticipant) && isset($freeparticipant)) - { + if (!isset($payedparticipant) && isset($freeparticipant)) { $this->active_event_participant = $freeparticipant; - } - if (isset($payedparticipant) && !isset($freeparticipant)) - { + } + if (isset($payedparticipant) && !isset($freeparticipant)) { $this->active_event_participant = $payedparticipant; } Debugbar::addMessage("active_event_participant: " . json_encode($this->active_event_participant), 'setActiveEventParticipant'); - } /** @@ -169,7 +170,8 @@ public function getStaffTickets($eventId) /** * Get all Tickets for current user */ - public function getAllTickets($eventId, $includeRevoked = false) { + public function getAllTickets($eventId, $includeRevoked = false) + { $clauses = ['user_id' => $this->id, 'event_id' => $eventId]; if (!$includeRevoked) { $clauses['revoked'] = 0; @@ -179,18 +181,19 @@ public function getAllTickets($eventId, $includeRevoked = false) { } /** - * User has at least one seatable ticket for event - */ - public function hasSeatableTicket($eventId) { + * User has at least one seatable ticket for event + */ + public function hasSeatableTicket($eventId) + { $eventParticipants = $this->getAllTickets($eventId); - foreach ($eventParticipants as $eventParticipant){ - + foreach ($eventParticipants as $eventParticipant) { + if (($eventParticipant->ticket && $eventParticipant->ticket->seatable) || - ($eventParticipant->free || $eventParticipant->staff)) { + ($eventParticipant->free || $eventParticipant->staff) + ) { return true; } - } return false; } @@ -212,10 +215,10 @@ public function getTickets($eventId, $obj = false) ) { $seat = 'Not Seated'; $seatingPlanName = ""; - if ($eventParticipant->seat) { + if ($eventParticipant->seat) { if ($eventParticipant->seat->seatingPlan) { $seatingPlanName = $eventParticipant->seat->seatingPlan->getName(); - } + } $seat = $eventParticipant->seat->getName(); } $return[$eventParticipant->id] = 'Participant ID: ' . $eventParticipant->id . $seat; @@ -335,4 +338,53 @@ public function getNextEvent() return $nextEvent; } + /** + * Get the user's unique attended event count. + */ + protected function uniqueAttendedEventCount(): Attribute + { + $attribute = Attribute::make( + get: fn() => $this->eventParticipants() + ->whereHas('event', function (Builder $query) { + $query->whereIn('status', ['PUBLISHED', 'REGISTEREDONLY']) + ->where('end', '<=', Carbon::today()); + }) + ->select(\DB::raw('COUNT(DISTINCT event_id) as unique_attended_event_count')) + ->value('unique_attended_event_count') ?? 0 + ); + + return $attribute; + } + + /** + * Get the user's win count. + */ + protected function winCount(): Attribute + { + return Attribute::make( + get: fn() => $this->calculateWinCount() + ); + } + + /** + * Calculate the user's win count. + * + * @return int + */ + protected function calculateWinCount(): int + { + $teamWins = EventTournamentTeam::where('final_rank', 1) + ->whereHas('tournamentParticipants.eventParticipant.user', function (Builder $query) { + $query->where('id', $this->id); + }) + ->count(); + + $individualWins = EventTournamentParticipant::where('final_rank', 1) + ->whereHas('eventParticipant.user', function (Builder $query) { + $query->where('id', $this->id); + }) + ->count(); + + return $teamWins + $individualWins; + } } diff --git a/src/resources/views/home.blade.php b/src/resources/views/home.blade.php index c3f30339..df3e1667 100644 --- a/src/resources/views/home.blade.php +++ b/src/resources/views/home.blade.php @@ -249,7 +249,7 @@ function updateStatus(id ,serverStatus){

{{ $attendee->username }}
- {{ $attendee->event_count }} @lang('home.eventsattended') + {{ $attendee->unique_attended_event_count }} @lang('home.eventsattended')

From debb3dde1213711fad17db2705441334874125d4 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 13 Nov 2024 00:41:28 +0100 Subject: [PATCH 53/59] remove html tags from ics DESCRIPTION --- src/app/Http/Controllers/Events/EventsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/Http/Controllers/Events/EventsController.php b/src/app/Http/Controllers/Events/EventsController.php index 08e44880..d36e331b 100644 --- a/src/app/Http/Controllers/Events/EventsController.php +++ b/src/app/Http/Controllers/Events/EventsController.php @@ -97,7 +97,7 @@ public function generateICS(Event $event) $eventEnd = Carbon::parse($event->end)->format('Ymd\THis\Z'); $orgName = Setting::getOrgName(); $eventName = $event->display_name; - $eventDescription = $event->desc_long; + $eventDescription = strip_tags((string) $event->desc_long); $venue = $event->venue; $addressParts = [ $venue->address_1, From 9bc351fbaba6bddc38c9edb9ba5ce8cd9a754018 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 13 Nov 2024 00:42:06 +0100 Subject: [PATCH 54/59] fix event card title and spacing in event index --- src/resources/views/events/index.blade.php | 30 +++++++++---------- .../_events/information-card.blade.php | 23 ++++++++++---- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/resources/views/events/index.blade.php b/src/resources/views/events/index.blade.php index 24aa64a1..e8715815 100644 --- a/src/resources/views/events/index.blade.php +++ b/src/resources/views/events/index.blade.php @@ -1,21 +1,19 @@ @extends ('layouts.default') -@section ('page_title', Settings::getOrgName() . ' - Events') +@section('page_title', Settings::getOrgName() . ' - Events') -@section ('content') - -
-
-

- Events -

-
- @foreach ($events as $event) -
-

{{ $event->display_name }}

-
- @include ('layouts._partials._events.information-card') - @endforeach -
+@section('content') +
+
+

+ Events +

+
+ @foreach ($events as $event) +
+ @include ('layouts._partials._events.information-card', ['enableCardTitle' => true]) +
+ @endforeach +
@endsection diff --git a/src/resources/views/layouts/_partials/_events/information-card.blade.php b/src/resources/views/layouts/_partials/_events/information-card.blade.php index c6fd7c61..33503f83 100644 --- a/src/resources/views/layouts/_partials/_events/information-card.blade.php +++ b/src/resources/views/layouts/_partials/_events/information-card.blade.php @@ -1,4 +1,13 @@
+ @if ($enableCardTitle ?? false) + +
+ +

{{ $event->display_name }}

+
+
+
+ @endif
@@ -24,9 +33,13 @@
- -

@lang('events.seatingcapacity')

-

{{ $event->capacity }} @lang('events.seating')

+ @if ($event->getSeatingCapacity() == 0) +

@lang('events.capacity')

+

{{ $event->capacity }}

+ @else +

@lang('events.seatingcapacity')

+

{{ $event->getSeatingCapacity() }}

+ @endif
@@ -34,7 +47,7 @@
-

{{ $event->desc_long }}

+

{!! $event->desc_long !!}

@@ -46,4 +59,4 @@ class="fas fa-calendar-alt mr-2"> Save to Calendar
- \ No newline at end of file + From f88265cb04a3f6c4f16ee147195d9e8298e68200 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 13 Nov 2024 00:48:01 +0100 Subject: [PATCH 55/59] localized 'Save to Calendar' --- src/lang/de/events.php | 3 ++- src/lang/en/events.php | 3 ++- .../views/layouts/_partials/_events/information-card.blade.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lang/de/events.php b/src/lang/de/events.php index 681473a8..e633cf39 100644 --- a/src/lang/de/events.php +++ b/src/lang/de/events.php @@ -124,5 +124,6 @@ /* General */ 'time_delimiter' => 'um', - 'time_suffix' => 'Uhr' + 'time_suffix' => 'Uhr', + 'savetocalendar' => 'In Kalender speichern' ]; diff --git a/src/lang/en/events.php b/src/lang/en/events.php index 5286068b..8d721081 100644 --- a/src/lang/en/events.php +++ b/src/lang/en/events.php @@ -124,5 +124,6 @@ /* General */ 'time_delimiter' => 'at', - 'time_suffix' => '' + 'time_suffix' => '', + 'savetocalendar' => 'Save to Calendar' ]; diff --git a/src/resources/views/layouts/_partials/_events/information-card.blade.php b/src/resources/views/layouts/_partials/_events/information-card.blade.php index 33503f83..58e3c235 100644 --- a/src/resources/views/layouts/_partials/_events/information-card.blade.php +++ b/src/resources/views/layouts/_partials/_events/information-card.blade.php @@ -55,7 +55,7 @@
Save to Calendar + class="fas fa-calendar-alt mr-2"> @lang('events.savetocalendar')
From fdb2e5b8edb15d0e77432b5f368ca7f3f531a8ef Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 13 Nov 2024 01:17:14 +0100 Subject: [PATCH 56/59] remove unnessecary if statement --- src/resources/views/events/show.blade.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/resources/views/events/show.blade.php b/src/resources/views/events/show.blade.php index b97624da..edf97373 100644 --- a/src/resources/views/events/show.blade.php +++ b/src/resources/views/events/show.blade.php @@ -183,14 +183,12 @@ @include ('layouts._partials.slick_loader') @foreach ($event->venue->images as $image) - @if ($image->filetype == 0) {{ $image->description ?? 'Image' }} - @endif @endforeach From b7917b5f900455664b912394d4c94419d06b1582 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 13 Nov 2024 04:19:12 +0100 Subject: [PATCH 57/59] combine userlocale and site locale logic, make userlocale disablable, add userlocale reset function --- .../Http/Controllers/AccountController.php | 3 +- .../Controllers/Admin/SettingsController.php | 52 +- .../Http/Controllers/Auth/AuthController.php | 1 + .../Http/Controllers/Auth/LoginController.php | 10 - src/app/Http/Kernel.php | 3 +- src/app/Http/Middleware/LanguageSwitcher.php | 26 +- src/app/Http/Middleware/UserLocale.php | 51 - src/app/Http/routes.php | 1258 ++++++++--------- src/app/Libraries/Helpers.php | 22 +- src/app/Libraries/Settings.php | 31 + src/app/Rules/ValidLocale.php | 23 + src/app/Setting.php | 45 + src/config/app.php | 1 - .../seeders/RequiredDatabaseSeeder.php | 8 + src/database/seeders/SettingsTableSeeder.php | 8 + src/resources/views/accounts/index.blade.php | 33 +- .../views/admin/settings/index.blade.php | 619 ++++---- .../views/admin/users/show.blade.php | 3 + 18 files changed, 1217 insertions(+), 980 deletions(-) delete mode 100644 src/app/Http/Middleware/UserLocale.php create mode 100644 src/app/Rules/ValidLocale.php diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index c8a450da..6a2c3fc0 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Storage; use Settings; +use App\Rules\ValidLocale; class AccountController extends Controller { @@ -269,6 +270,7 @@ public function update(Request $request) 'surname' => 'filled', 'password1' => 'same:password2', 'password2' => 'same:password1', + 'locale' => ['nullable', new ValidLocale] ]; $messages = [ 'firstname.filled' => 'Firstname Cannot be blank.', @@ -300,7 +302,6 @@ public function update(Request $request) if (isset($request->locale)) { $user->locale = @$request->locale; - \Log::info("Submitted locale value: " . @$request->locale); } if (!$user->save()) { diff --git a/src/app/Http/Controllers/Admin/SettingsController.php b/src/app/Http/Controllers/Admin/SettingsController.php index 8f28f017..a8fcff6c 100644 --- a/src/app/Http/Controllers/Admin/SettingsController.php +++ b/src/app/Http/Controllers/Admin/SettingsController.php @@ -24,6 +24,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; +use Illuminate\Support\Facades\Validator; + +use App\Rules\ValidLocale; use function PHPUnit\Framework\isEmpty; @@ -306,7 +309,9 @@ public function update(Request $request) 'event_count_offset' => 'numeric', 'org_logo' => 'image', 'org_favicon' => 'image', + 'site_locale' => ['nullable', new ValidLocale] ]; + $messages = [ 'terms_and_conditions.filled' => 'Terms And Conditions cannot be empty', 'org_name.filled' => 'Org Name cannot be empty', @@ -322,7 +327,7 @@ public function update(Request $request) 'participant_count_offset.numeric' => 'Participant Count Offset must be a number', 'event_count_offset.numeric' => 'Lan Count Offset must be a number', 'org_logo.image' => 'Org Logo must be a Image', - 'org_favicon' => 'Org Favicon must be a Image' + 'org_favicon' => 'Org Favicon must be a Image', ]; $this->validate($request, $rules, $messages); @@ -709,6 +714,51 @@ public function disableMatchMakingSystem() return Redirect::back(); } + /** + * Enable UserLocale + * @return Redirect + */ + public function enableUserLocale() + { + if (!Settings::enableUserLocale()) { + Session::flash('alert-danger', "Could not Enable UserLocale!"); + return Redirect::back(); + } + Session::flash('alert-success', "Successfully Enabled UserLocale!"); + return Redirect::back(); + } + + /** + * Disable UserLocale + * @return Redirect + */ + public function disableUserLocale() + { + if (!Settings::disableUserLocale()) { + Session::flash('alert-danger', "Could not Disable UserLocale!"); + return Redirect::back(); + } + Session::flash('alert-success', "Successfully Disabled UserLocale!"); + return Redirect::back(); + } + + + /** + * Resets UserLocale of all users to current Site Locale + * @return Redirect + */ + public function resetUserLocales() + { + $count = 0; + foreach (User::all() as $user) { + $user->locale = Settings::getSiteLocale(); + $user->save(); + $count++; + } + Session::flash('alert-success', 'Successfully resetted userlocale to ' . Settings::getSiteLocale() . ' on ' . $count . ' Users!'); + return Redirect::back(); + } + /** * Enable Login Method diff --git a/src/app/Http/Controllers/Auth/AuthController.php b/src/app/Http/Controllers/Auth/AuthController.php index 69fa7859..f61a1099 100644 --- a/src/app/Http/Controllers/Auth/AuthController.php +++ b/src/app/Http/Controllers/Auth/AuthController.php @@ -204,6 +204,7 @@ public function register($method, Request $request, User $user) $user->surname = $request->surname; $user->username = $request->username; $user->username_nice = strtolower(str_replace(' ', '-', $request->username)); + $user->locale = Settings::getSiteLocale(); if (!$user->save()) { Auth::logout(); diff --git a/src/app/Http/Controllers/Auth/LoginController.php b/src/app/Http/Controllers/Auth/LoginController.php index f8a0c80a..7e274785 100644 --- a/src/app/Http/Controllers/Auth/LoginController.php +++ b/src/app/Http/Controllers/Auth/LoginController.php @@ -77,16 +77,6 @@ public function login(Request $request) if ($this->attemptLogin($request)) { - - // Check if the user's locale is set and exists in the list of allowed locales - \Log::info("Locale from User: " . $user->locale); - - if ($user->locale && in_array($user->locale, config('app.locales'))) { - App::setLocale($user->locale); // Set the application locale to user preference - session(['locale' => $user->locale]); // Optional: Store in session - // Set a cookie for locale that lasts a long time, for example a year - Cookie::queue('locale', $user->locale, 525600); - } if ((!isset($user->phonenumber) || $user->phonenumber == null) && Settings::isAuthRequirePhonenumberEnabled()) { return redirect('/account/email'); // redirect to site } diff --git a/src/app/Http/Kernel.php b/src/app/Http/Kernel.php index 3ea0401b..f110f6e7 100644 --- a/src/app/Http/Kernel.php +++ b/src/app/Http/Kernel.php @@ -29,7 +29,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, - \App\Http\Middleware\UserLocale::class, + \App\Http\Middleware\LanguageSwitcher::class, \App\Http\Middleware\Legacywarning::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, @@ -70,7 +70,6 @@ class Kernel extends HttpKernel 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, - 'language' => \App\Http\Middleware\LanguageSwitcher::class, 'gameserver' => \App\Http\Middleware\Gameserver::class, ]; } diff --git a/src/app/Http/Middleware/LanguageSwitcher.php b/src/app/Http/Middleware/LanguageSwitcher.php index dee5cc85..0311339f 100644 --- a/src/app/Http/Middleware/LanguageSwitcher.php +++ b/src/app/Http/Middleware/LanguageSwitcher.php @@ -6,7 +6,9 @@ use Session; use App; use Config; -use App\Setting; +use Illuminate\Support\Facades\Auth; +use App\Libraries\Helpers; +use App\Libraries\Settings; class LanguageSwitcher { @@ -19,15 +21,25 @@ class LanguageSwitcher */ public function handle($request, Closure $next) { - if ($locale = Setting::getSiteLocale()) - { - $locale_dirs = array_filter(glob(app()->langPath().'/*'), 'is_dir'); - if(in_array(app()->langPath().'/'.$locale, $locale_dirs)) - { - App::setLocale($locale); + $setlocale = config('app.locale'); + if ($locale = Settings::getSiteLocale()) { + + if (!empty($locale) && Helpers::isValidLocale($locale)) { + $setlocale = $locale; } } + if (Auth::check() && Auth::user() && Settings::isUserLocaleEnabled()) { + if ($userLocale = Auth::user()->locale) { + if (!empty($userLocale) && Helpers::isValidLocale($userLocale)) { + $setlocale = $userLocale; + } + } + } + + app()->setLocale($setlocale); + app()->setFallbackLocale(config('app.fallback_locale')); + return $next($request); } } diff --git a/src/app/Http/Middleware/UserLocale.php b/src/app/Http/Middleware/UserLocale.php deleted file mode 100644 index c8670ac4..00000000 --- a/src/app/Http/Middleware/UserLocale.php +++ /dev/null @@ -1,51 +0,0 @@ -locale; - - // Verify if user locale is set and valid - if (empty($userLocale) || !$this->isValidLocale($userLocale)) { - return $next($request); // Proceed with default locale if user's locale is invalid or not set - } - - // Apply the valid user locale - app()->setLocale($userLocale); - - return $next($request); - } - - /** - * Validate if the given locale exists in the language directory. - * - * @param string $locale - * @return bool - */ - protected function isValidLocale($locale) - { - return is_dir(app()->langPath() . '/' . $locale); - } -} diff --git a/src/app/Http/routes.php b/src/app/Http/routes.php index d0e0f60c..675b42b7 100644 --- a/src/app/Http/routes.php +++ b/src/app/Http/routes.php @@ -24,714 +24,708 @@ Route::group(['middleware' => ['installed']], function () { + /** + * API + */ + Route::group(['middleware' => ['api', 'nodebugbar']], function () { + Route::get('/api/events/', 'Api\Events\EventsController@index'); + Route::get('/api/events/upcoming', 'Api\Events\EventsController@showUpcoming'); + Route::get('/api/events/{event}', 'Api\Events\EventsController@show'); + Route::get('/api/events/{event}/participants', 'Api\Events\ParticipantsController@index'); + Route::get('/api/events/{event}/timetables', 'Api\Events\TimetablesController@index'); + Route::get('/api/events/{event}/timetables/{timetable}', 'Api\Events\TimetablesController@show'); + Route::get('/api/events/{event}/tickets', 'Api\Events\TicketsController@index'); + Route::get('/api/events/{event}/tickets/{ticket}', 'Api\Events\TicketsController@show'); + + Route::group(['middleware' => ['auth:sanctum']], function () { + /** + * User API + */ + Route::get('/api/user/me', 'Userapi\MeController@getMe'); + Route::get('/api/user/event/participants', 'Userapi\Events\ParticipantsController@getParticipants'); + + /** + * Gameserver API + */ + Route::group(['middleware' => ['gameserver']], function () { + Route::post('/api/matchmaking/{match}/demo/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchDemo'); + Route::post('/api/matchmaking/{match}/freeserver/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFreeServer'); + Route::post('/api/matchmaking/{match}/finalize/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFinalize'); + Route::post('/api/matchmaking/{match}/finalize/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFinalizeMap'); + Route::post('/api/matchmaking/{match}/golive/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchGolive'); + Route::post('/api/matchmaking/{match}/updateround/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchUpdateround'); + Route::post('/api/matchmaking/{match}/updateplayer/{mapnumber}/{player}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchUpdateplayer'); + Route::get('/api/matchmaking/{match}/configure/{nummaps}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchConfig'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/demo/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchDemo'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/freeserver/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFreeServer'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/finalize/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFinalize'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/finalize/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFinalizeMap'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/golive/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchGolive'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/updateround/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchUpdateround'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/updateplayer/{mapnumber}/{player}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchUpdateplayer'); + Route::get('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/configure/{nummaps}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchConfig'); + }); - Route::group(['middleware' => 'language'], function () { - - - - - - /** - * API - */ - Route::group(['middleware' => ['api', 'nodebugbar']], function () { - Route::get('/api/events/', 'Api\Events\EventsController@index'); - Route::get('/api/events/upcoming', 'Api\Events\EventsController@showUpcoming'); - Route::get('/api/events/{event}', 'Api\Events\EventsController@show'); - Route::get('/api/events/{event}/participants', 'Api\Events\ParticipantsController@index'); - Route::get('/api/events/{event}/timetables', 'Api\Events\TimetablesController@index'); - Route::get('/api/events/{event}/timetables/{timetable}', 'Api\Events\TimetablesController@show'); - Route::get('/api/events/{event}/tickets', 'Api\Events\TicketsController@index'); - Route::get('/api/events/{event}/tickets/{ticket}', 'Api\Events\TicketsController@show'); - - Route::group(['middleware' => ['auth:sanctum']], function () { - /** - * User API - */ - Route::get('/api/user/me', 'Userapi\MeController@getMe'); - Route::get('/api/user/event/participants', 'Userapi\Events\ParticipantsController@getParticipants'); - - /** - * Gameserver API - */ - Route::group(['middleware' => ['gameserver']], function () { - Route::post('/api/matchmaking/{match}/demo/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchDemo'); - Route::post('/api/matchmaking/{match}/freeserver/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFreeServer'); - Route::post('/api/matchmaking/{match}/finalize/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFinalize'); - Route::post('/api/matchmaking/{match}/finalize/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFinalizeMap'); - Route::post('/api/matchmaking/{match}/golive/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchGolive'); - Route::post('/api/matchmaking/{match}/updateround/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchUpdateround'); - Route::post('/api/matchmaking/{match}/updateplayer/{mapnumber}/{player}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchUpdateplayer'); - Route::get('/api/matchmaking/{match}/configure/{nummaps}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchConfig'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/demo/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchDemo'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/freeserver/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFreeServer'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/finalize/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFinalize'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/finalize/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFinalizeMap'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/golive/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchGolive'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/updateround/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchUpdateround'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/updateplayer/{mapnumber}/{player}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchUpdateplayer'); - Route::get('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/configure/{nummaps}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchConfig'); - - }); - - /** - * Admin API - */ - Route::group(['middleware' => ['admin']], function () { - Route::get('/api/admin/event/participants/{participant}/signIn', 'Adminapi\Events\ParticipantsController@signIn'); - Route::get('/api/admin/event/participants/{participant}', 'Adminapi\Events\ParticipantsController@getParticipant'); - Route::get('/api/admin/event/participants/', 'Adminapi\Events\ParticipantsController@getParticipants'); - Route::get('/api/admin/purchases/{purchase}/setSuccess', 'Adminapi\PurchaseController@setSuccess'); - }); + /** + * Admin API + */ + Route::group(['middleware' => ['admin']], function () { + Route::get('/api/admin/event/participants/{participant}/signIn', 'Adminapi\Events\ParticipantsController@signIn'); + Route::get('/api/admin/event/participants/{participant}', 'Adminapi\Events\ParticipantsController@getParticipant'); + Route::get('/api/admin/event/participants/', 'Adminapi\Events\ParticipantsController@getParticipants'); + Route::get('/api/admin/purchases/{purchase}/setSuccess', 'Adminapi\PurchaseController@setSuccess'); }); }); + }); - /** - * Front End - */ - - - Route::group(['middleware' => ['web']], function () { - - /** - * Login & Register - */ - Route::get('/register/email/verify', 'Auth\VerificationController@show')->name('verification.notice'); - Route::get('/register/email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify'); - Route::get('/register/email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); + /** + * Front End + */ - Route::get('/register/{method}', 'Auth\AuthController@showRegister'); - Route::post('/register/{method}', 'Auth\AuthController@register'); - Route::get('/login', 'Auth\AuthController@prompt'); + Route::group(['middleware' => ['web']], function () { - Route::get('/login/forgot', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); - Route::post('/login/forgot', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); + /** + * Login & Register + */ + Route::get('/register/email/verify', 'Auth\VerificationController@show')->name('verification.notice'); + Route::get('/register/email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify'); + Route::get('/register/email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); - Route::post('/login/reset/password', 'Auth\ResetPasswordController@reset')->name('password.update'); - Route::get('/login/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); + Route::get('/register/{method}', 'Auth\AuthController@showRegister'); + Route::post('/register/{method}', 'Auth\AuthController@register'); - Route::get('/login/steam', 'Auth\SteamController@login'); + Route::get('/login', 'Auth\AuthController@prompt'); - Route::post('/login/standard', 'Auth\LoginController@login')->name('login.standard');; + Route::get('/login/forgot', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); + Route::post('/login/forgot', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/account', 'AccountController@index'); - Route::get('/account/sso/remove/{method}', 'AccountController@showRemoveSso'); - Route::post('/account/sso/remove/{method}', 'AccountController@removeSso'); - Route::get('/account/sso/add/{method}', 'AccountController@addSso'); - Route::get('/account/tokens/wizzard/start/{application?}/{callbackurl?}', 'AccountController@showTokenWizzardStart'); - Route::post('/account/tokens/wizzard/finish', 'AccountController@showTokenWizzardFinish'); - Route::post('/account/tokens/add', 'AccountController@addToken'); - Route::delete('/account/tokens/remove/{token}', 'AccountController@removeToken'); - Route::post('/account', 'AccountController@update'); - Route::post('/account/delete', 'Auth\SteamController@destroy'); - Route::post('/account/avatar', 'AccountController@update_avatar'); - }); + Route::post('/login/reset/password', 'Auth\ResetPasswordController@reset')->name('password.update'); + Route::get('/login/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); - Route::group(['middleware' => ['auth', 'banned']], function () { - Route::get('/account/email', 'AccountController@showMail'); - Route::post('/account/email', 'AccountController@updateMail'); - }); + Route::get('/login/steam', 'Auth\SteamController@login'); + Route::post('/login/standard', 'Auth\LoginController@login')->name('login.standard');; - Route::group(['middleware' => ['auth']], function () { - Route::get('/logout', 'Auth\AuthController@logout'); - }); + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/account', 'AccountController@index'); + Route::get('/account/sso/remove/{method}', 'AccountController@showRemoveSso'); + Route::post('/account/sso/remove/{method}', 'AccountController@removeSso'); + Route::get('/account/sso/add/{method}', 'AccountController@addSso'); + Route::get('/account/tokens/wizzard/start/{application?}/{callbackurl?}', 'AccountController@showTokenWizzardStart'); + Route::post('/account/tokens/wizzard/finish', 'AccountController@showTokenWizzardFinish'); + Route::post('/account/tokens/add', 'AccountController@addToken'); + Route::delete('/account/tokens/remove/{token}', 'AccountController@removeToken'); + Route::post('/account', 'AccountController@update'); + Route::post('/account/delete', 'Auth\SteamController@destroy'); + Route::post('/account/avatar', 'AccountController@update_avatar'); + }); - /** - * Index Page - */ - Route::get('/', 'HomeController@index'); + Route::group(['middleware' => ['auth', 'banned']], function () { + Route::get('/account/email', 'AccountController@showMail'); + Route::post('/account/email', 'AccountController@updateMail'); + }); - /** - * News Pages - */ - Route::get('/news', 'NewsController@index'); - Route::get('/news/{newsArticle}', 'NewsController@show'); - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::post('/news/{newsArticle}/comments', 'NewsController@storeComment'); - Route::post('/news/{newsArticle}/comments/{newsComment}', 'NewsController@editComment'); - Route::get('/news/{newsArticle}/comments/{newsComment}/report', 'NewsController@reportComment'); - Route::get('/news/{newsArticle}/comments/{newsComment}/delete', 'NewsController@destroyComment'); - }); - Route::get('/news/tags/{newsTag}', 'NewsController@showTag'); - /** - * Events - */ - Route::get('/events', 'Events\EventsController@index'); - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function() { - Route::get('/events/participants/{participant}/{fileType}', 'Events\ParticipantsController@exportParticipantAsFile'); - }); - Route::get('/events/{event}', 'Events\EventsController@show'); - Route::get('/events/{event}/big', 'HomeController@bigScreen'); - Route::get('/events/{event}/generate-ics', 'Events\EventsController@generateICS')->name('generate-event-ics'); + Route::group(['middleware' => ['auth']], function () { + Route::get('/logout', 'Auth\AuthController@logout'); + }); - /** - * Misc Pages - */ - Route::get('/about', 'HomeController@about'); - Route::get('/contact', 'HomeController@contact'); - Route::get('/terms', 'HomeController@terms'); - Route::get('/legalnotice', 'HomeController@legalNotice'); + /** + * Index Page + */ + Route::get('/', 'HomeController@index'); + /** + * News Pages + */ + Route::get('/news', 'NewsController@index'); + Route::get('/news/{newsArticle}', 'NewsController@show'); + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::post('/news/{newsArticle}/comments', 'NewsController@storeComment'); + Route::post('/news/{newsArticle}/comments/{newsComment}', 'NewsController@editComment'); + Route::get('/news/{newsArticle}/comments/{newsComment}/report', 'NewsController@reportComment'); + Route::get('/news/{newsArticle}/comments/{newsComment}/delete', 'NewsController@destroyComment'); + }); + Route::get('/news/tags/{newsTag}', 'NewsController@showTag'); - /** - * Tickets - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/tickets/retrieve/{participant}', 'Events\TicketsController@retrieve'); - Route::post('/tickets/purchase/{ticket}', 'Events\TicketsController@purchase'); - }); + /** + * Events + */ + Route::get('/events', 'Events\EventsController@index'); + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/events/participants/{participant}/{fileType}', 'Events\ParticipantsController@exportParticipantAsFile'); + }); + Route::get('/events/{event}', 'Events\EventsController@show'); + Route::get('/events/{event}/big', 'HomeController@bigScreen'); + Route::get('/events/{event}/generate-ics', 'Events\EventsController@generateICS')->name('generate-event-ics'); - /** - * Gifts - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/gift/accept', 'Events\ParticipantsController@acceptGift'); - Route::post('/gift/{participant}', 'Events\ParticipantsController@gift'); - Route::post('/gift/{participant}/revoke', 'Events\ParticipantsController@revokeGift'); - }); + /** + * Misc Pages + */ + Route::get('/about', 'HomeController@about'); + Route::get('/contact', 'HomeController@contact'); + Route::get('/terms', 'HomeController@terms'); + Route::get('/legalnotice', 'HomeController@legalNotice'); - /** - * Galleries - */ - Route::get('/gallery', 'GalleryController@index'); - Route::get('/gallery/{album}', 'GalleryController@show'); - /** - * Help - */ - Route::get('/help', 'HelpController@index'); + /** + * Tickets + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/tickets/retrieve/{participant}', 'Events\TicketsController@retrieve'); + Route::post('/tickets/purchase/{ticket}', 'Events\TicketsController@purchase'); + }); - /** - * Tournaments - */ - Route::get('/events/{event}/tournaments', 'Events\TournamentsController@index'); - Route::get('/events/{event}/tournaments/{tournament}', 'Events\TournamentsController@show'); - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::post('/events/{event}/tournaments/{tournament}/register', 'Events\TournamentsController@registerSingle'); - Route::post('/events/{event}/tournaments/{tournament}/register/team', 'Events\TournamentsController@registerTeam'); - Route::post('/events/{event}/tournaments/{tournament}/register/pug', 'Events\TournamentsController@registerPug'); - Route::post('/events/{event}/tournaments/{tournament}/register/remove', 'Events\TournamentsController@unregister'); - }); + /** + * Gifts + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/gift/accept', 'Events\ParticipantsController@acceptGift'); + Route::post('/gift/{participant}', 'Events\ParticipantsController@gift'); + Route::post('/gift/{participant}/revoke', 'Events\ParticipantsController@revokeGift'); + }); - /** - * GameServers - */ - Route::get('/games/{game}/gameservers/{gameServer}/status', 'GameServersController@status'); + /** + * Galleries + */ + Route::get('/gallery', 'GalleryController@index'); + Route::get('/gallery/{album}', 'GalleryController@show'); + /** + * Help + */ + Route::get('/help', 'HelpController@index'); - /** - * MatchMaking - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/matchmaking', 'MatchMakingController@index'); - Route::get('/matchmaking/invite', 'MatchMakingController@showInvite'); - Route::get('/matchmaking/{match}', 'MatchMakingController@show'); - Route::post('/matchmaking', 'MatchMakingController@store'); - Route::post('/matchmaking/{match}/team/{team}/teamplayer/add', 'MatchMakingController@addusertomatch'); - Route::delete('/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/delete', 'MatchMakingController@deleteuserfrommatch'); - Route::post('/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/change', 'MatchMakingController@changeuserteam'); - Route::post('/matchmaking/{match}/team/add', 'MatchMakingController@addteam'); - Route::post('/matchmaking/{match}/team/{team}/update', 'MatchMakingController@updateteam'); - Route::delete('/matchmaking/{match}/team/{team}/delete', 'MatchMakingController@deleteteam'); - Route::post('/matchmaking/{match}/update', 'MatchMakingController@update'); - Route::post('/matchmaking/{match}/start', 'MatchMakingController@start'); - Route::post('/matchmaking/{match}/open', 'MatchMakingController@open'); - Route::post('/matchmaking/{match}/scramble', 'MatchMakingController@scramble'); - Route::post('/matchmaking/{match}/finalize', 'MatchMakingController@finalize'); - Route::delete('/matchmaking/{match}', 'MatchMakingController@destroy'); - }); + /** + * Tournaments + */ + Route::get('/events/{event}/tournaments', 'Events\TournamentsController@index'); + Route::get('/events/{event}/tournaments/{tournament}', 'Events\TournamentsController@show'); + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::post('/events/{event}/tournaments/{tournament}/register', 'Events\TournamentsController@registerSingle'); + Route::post('/events/{event}/tournaments/{tournament}/register/team', 'Events\TournamentsController@registerTeam'); + Route::post('/events/{event}/tournaments/{tournament}/register/pug', 'Events\TournamentsController@registerPug'); + Route::post('/events/{event}/tournaments/{tournament}/register/remove', 'Events\TournamentsController@unregister'); + }); - /** - * Payments - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/payment/checkout', 'PaymentsController@showCheckout'); - Route::get('/payment/review/{paymentGateway}', 'PaymentsController@showReview'); - Route::get('/payment/details/{paymentGateway}', 'PaymentsController@showDetails'); - Route::post('/payment/delivery', 'PaymentsController@delivery'); - Route::get('/payment/delivery/{paymentGateway}', 'PaymentsController@showDelivery'); - Route::get('/payment/callback', 'PaymentsController@process'); - Route::post('/payment/post', 'PaymentsController@post'); - Route::get('/payment/failed', 'PaymentsController@showFailed'); - Route::get('/payment/cancelled', 'PaymentsController@showCancelled'); - Route::get('/payment/successful/{purchase}', 'PaymentsController@showSuccessful'); - Route::get('/payment/pending/{purchase}', 'PaymentsController@showPending'); - }); + /** + * GameServers + */ + Route::get('/games/{game}/gameservers/{gameServer}/status', 'GameServersController@status'); - /** - * Seating - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::post('/events/{event}/seating/{seatingPlan}', 'Events\SeatingController@store'); - Route::delete('/events/{event}/seating/{seatingPlan}', 'Events\SeatingController@destroy'); - }); - /** - * Search - */ - Route::get('/search/users/autocomplete', 'SearchController@usersAutocomplete')->name('autocomplete'); + /** + * MatchMaking + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/matchmaking', 'MatchMakingController@index'); + Route::get('/matchmaking/invite', 'MatchMakingController@showInvite'); + Route::get('/matchmaking/{match}', 'MatchMakingController@show'); + Route::post('/matchmaking', 'MatchMakingController@store'); + Route::post('/matchmaking/{match}/team/{team}/teamplayer/add', 'MatchMakingController@addusertomatch'); + Route::delete('/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/delete', 'MatchMakingController@deleteuserfrommatch'); + Route::post('/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/change', 'MatchMakingController@changeuserteam'); + Route::post('/matchmaking/{match}/team/add', 'MatchMakingController@addteam'); + Route::post('/matchmaking/{match}/team/{team}/update', 'MatchMakingController@updateteam'); + Route::delete('/matchmaking/{match}/team/{team}/delete', 'MatchMakingController@deleteteam'); + Route::post('/matchmaking/{match}/update', 'MatchMakingController@update'); + Route::post('/matchmaking/{match}/start', 'MatchMakingController@start'); + Route::post('/matchmaking/{match}/open', 'MatchMakingController@open'); + Route::post('/matchmaking/{match}/scramble', 'MatchMakingController@scramble'); + Route::post('/matchmaking/{match}/finalize', 'MatchMakingController@finalize'); + Route::delete('/matchmaking/{match}', 'MatchMakingController@destroy'); + }); - /** - * Polls - */ - Route::get('/polls', 'PollsController@index'); - Route::get('/polls/{poll}', 'PollsController@show'); - Route::group(['middleware' => ['auth', 'banned', 'verified']], function () { - Route::post('/polls/{poll}/options', 'PollsController@storeOption'); - Route::get('/polls/{poll}/options/{option}/vote', 'PollsController@vote'); - Route::get('/polls/{poll}/options/{option}/abstain', 'PollsController@abstain'); - }); + /** + * Payments + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/payment/checkout', 'PaymentsController@showCheckout'); + Route::get('/payment/review/{paymentGateway}', 'PaymentsController@showReview'); + Route::get('/payment/details/{paymentGateway}', 'PaymentsController@showDetails'); + Route::post('/payment/delivery', 'PaymentsController@delivery'); + Route::get('/payment/delivery/{paymentGateway}', 'PaymentsController@showDelivery'); + Route::get('/payment/callback', 'PaymentsController@process'); + Route::post('/payment/post', 'PaymentsController@post'); + Route::get('/payment/failed', 'PaymentsController@showFailed'); + Route::get('/payment/cancelled', 'PaymentsController@showCancelled'); + Route::get('/payment/successful/{purchase}', 'PaymentsController@showSuccessful'); + Route::get('/payment/pending/{purchase}', 'PaymentsController@showPending'); + }); - /** - * Shop - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/shop/orders', 'ShopController@showAllOrders'); - Route::get('/shop/orders/{order}', 'ShopController@showOrder'); - }); - Route::get('/shop', 'ShopController@index'); - Route::get('/shop/basket', 'ShopController@showBasket'); - Route::post('/shop/basket', 'ShopController@updateBasket'); - Route::get('/shop/{category}', 'ShopController@showCategory'); - Route::get('/shop/{category}/{item}', 'ShopController@showItem'); + /** + * Seating + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::post('/events/{event}/seating/{seatingPlan}', 'Events\SeatingController@store'); + Route::delete('/events/{event}/seating/{seatingPlan}', 'Events\SeatingController@destroy'); }); /** - * Admin + * Search */ - Route::group(['middleware' => ['web', 'admin']], function () { + Route::get('/search/users/autocomplete', 'SearchController@usersAutocomplete')->name('autocomplete'); - /** - * Index Page - */ - Route::get('/admin', 'Admin\AdminController@index'); + /** + * Polls + */ + Route::get('/polls', 'PollsController@index'); + Route::get('/polls/{poll}', 'PollsController@show'); + Route::group(['middleware' => ['auth', 'banned', 'verified']], function () { + Route::post('/polls/{poll}/options', 'PollsController@storeOption'); + Route::get('/polls/{poll}/options/{option}/vote', 'PollsController@vote'); + Route::get('/polls/{poll}/options/{option}/abstain', 'PollsController@abstain'); + }); - /** - * Events - */ - Route::get('/admin/events', 'Admin\Events\EventsController@index'); - Route::post('/admin/events', 'Admin\Events\EventsController@store'); - Route::get('/admin/events/{event}', 'Admin\Events\EventsController@show'); - Route::post('/admin/events/{event}', 'Admin\Events\EventsController@update'); - Route::delete('/admin/events/{event}', 'Admin\Events\EventsController@destroy'); - Route::post('/admin/events/{event}/information', 'Admin\Events\InformationController@store'); - Route::post('/admin/information/{information}', 'Admin\Events\InformationController@update'); - Route::delete('/admin/information/{information}', 'Admin\Events\InformationController@destroy'); - /** - * Seating - */ - Route::get('/admin/events/{event}/seating', 'Admin\Events\SeatingController@index'); - Route::post('/admin/events/{event}/seating', 'Admin\Events\SeatingController@store'); - Route::get('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@show'); - Route::post('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@update'); - Route::delete('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@destroy'); - Route::post('/admin/events/{event}/seating/{seatingPlan}/seat', 'Admin\Events\SeatingController@storeSeat'); - Route::delete('/admin/events/{event}/seating/{seatingPlan}/seat', 'Admin\Events\SeatingController@destroySeat'); + /** + * Shop + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/shop/orders', 'ShopController@showAllOrders'); + Route::get('/shop/orders/{order}', 'ShopController@showOrder'); + }); + Route::get('/shop', 'ShopController@index'); + Route::get('/shop/basket', 'ShopController@showBasket'); + Route::post('/shop/basket', 'ShopController@updateBasket'); + Route::get('/shop/{category}', 'ShopController@showCategory'); + Route::get('/shop/{category}/{item}', 'ShopController@showItem'); + }); - /** - * Timetables - */ - Route::get('/admin/events/{event}/timetables', 'Admin\Events\TimetablesController@index'); - Route::post('/admin/events/{event}/timetables', 'Admin\Events\TimetablesController@store'); - Route::get('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@show'); - Route::post('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@update'); - Route::delete('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@destroy'); - Route::post('/admin/events/{event}/timetables/{timetable}/data', 'Admin\Events\TimetableDataController@store'); - Route::post( - '/admin/events/{event}/timetables/{timetable}/data/{data}', - 'Admin\Events\TimetableDataController@update' - ); - Route::delete('/admin/events/{event}/timetables/{timetable}/data/{data}', 'Admin\Events\TimetableDataController@destroy'); + /** + * Admin + */ + Route::group(['middleware' => ['web', 'admin']], function () { + /** + * Index Page + */ + Route::get('/admin', 'Admin\AdminController@index'); - /** - * Tournaments - */ - Route::get('/admin/events/{event}/tournaments', 'Admin\Events\TournamentsController@index'); - Route::post('/admin/events/{event}/tournaments', 'Admin\Events\TournamentsController@store'); - Route::get('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@show'); - Route::post('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@update'); - Route::delete('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@destroy'); - Route::post('/admin/events/{event}/tournaments/{tournament}/start', 'Admin\Events\TournamentsController@start'); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/finalize', - 'Admin\Events\TournamentsController@finalize' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/enableliveediting', - 'Admin\Events\TournamentsController@enableliveediting' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/disableliveediting', - 'Admin\Events\TournamentsController@disableliveediting' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/addteam', - 'Admin\Events\TournamentsController@addTeam' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/match', - 'Admin\Events\TournamentsController@updateMatch' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}', - 'Admin\Events\TournamentsMatchServerController@store' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}/update', - 'Admin\Events\TournamentsMatchServerController@update' - ); - Route::delete( - '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}/delete', - 'Admin\Events\TournamentsMatchServerController@destroy' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/team', - 'Admin\Events\TournamentsController@updateParticipantTeam' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/remove', - 'Admin\Events\TournamentsController@unregisterParticipant' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/addpug', - 'Admin\Events\TournamentsController@addPug' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/addsingle', - 'Admin\Events\TournamentsController@addSingle' - ); + /** + * Events + */ + Route::get('/admin/events', 'Admin\Events\EventsController@index'); + Route::post('/admin/events', 'Admin\Events\EventsController@store'); + Route::get('/admin/events/{event}', 'Admin\Events\EventsController@show'); + Route::post('/admin/events/{event}', 'Admin\Events\EventsController@update'); + Route::delete('/admin/events/{event}', 'Admin\Events\EventsController@destroy'); + Route::post('/admin/events/{event}/information', 'Admin\Events\InformationController@store'); + Route::post('/admin/information/{information}', 'Admin\Events\InformationController@update'); + Route::delete('/admin/information/{information}', 'Admin\Events\InformationController@destroy'); + /** + * Seating + */ + Route::get('/admin/events/{event}/seating', 'Admin\Events\SeatingController@index'); + Route::post('/admin/events/{event}/seating', 'Admin\Events\SeatingController@store'); + Route::get('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@show'); + Route::post('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@update'); + Route::delete('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@destroy'); + Route::post('/admin/events/{event}/seating/{seatingPlan}/seat', 'Admin\Events\SeatingController@storeSeat'); + Route::delete('/admin/events/{event}/seating/{seatingPlan}/seat', 'Admin\Events\SeatingController@destroySeat'); + /** + * Timetables + */ + Route::get('/admin/events/{event}/timetables', 'Admin\Events\TimetablesController@index'); + Route::post('/admin/events/{event}/timetables', 'Admin\Events\TimetablesController@store'); + Route::get('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@show'); + Route::post('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@update'); + Route::delete('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@destroy'); + Route::post('/admin/events/{event}/timetables/{timetable}/data', 'Admin\Events\TimetableDataController@store'); + Route::post( + '/admin/events/{event}/timetables/{timetable}/data/{data}', + 'Admin\Events\TimetableDataController@update' + ); + Route::delete('/admin/events/{event}/timetables/{timetable}/data/{data}', 'Admin\Events\TimetableDataController@destroy'); - // TODO - REMOVE THIS AND ALL LIKE IT - /** - * Legacy - */ - Route::get('/admin/events/tournaments/fix', 'Admin\Events\TournamentsController@fixScores'); + /** + * Tournaments + */ + Route::get('/admin/events/{event}/tournaments', 'Admin\Events\TournamentsController@index'); + Route::post('/admin/events/{event}/tournaments', 'Admin\Events\TournamentsController@store'); + Route::get('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@show'); + Route::post('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@update'); + Route::delete('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@destroy'); + Route::post('/admin/events/{event}/tournaments/{tournament}/start', 'Admin\Events\TournamentsController@start'); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/finalize', + 'Admin\Events\TournamentsController@finalize' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/enableliveediting', + 'Admin\Events\TournamentsController@enableliveediting' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/disableliveediting', + 'Admin\Events\TournamentsController@disableliveediting' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/addteam', + 'Admin\Events\TournamentsController@addTeam' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/match', + 'Admin\Events\TournamentsController@updateMatch' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}', + 'Admin\Events\TournamentsMatchServerController@store' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}/update', + 'Admin\Events\TournamentsMatchServerController@update' + ); + Route::delete( + '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}/delete', + 'Admin\Events\TournamentsMatchServerController@destroy' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/team', + 'Admin\Events\TournamentsController@updateParticipantTeam' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/remove', + 'Admin\Events\TournamentsController@unregisterParticipant' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/addpug', + 'Admin\Events\TournamentsController@addPug' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/addsingle', + 'Admin\Events\TournamentsController@addSingle' + ); + + + // TODO - REMOVE THIS AND ALL LIKE IT + /** + * Legacy + */ + Route::get('/admin/events/tournaments/fix', 'Admin\Events\TournamentsController@fixScores'); - /** - * GameTemplates - */ - Route::get('/admin/games/gametemplates', 'Admin\GameTemplatesController@index'); - Route::post('/admin/games/gametemplates', 'Admin\GameTemplatesController@deploy'); - /** - * Games - */ - Route::get('/admin/games', 'Admin\GamesController@index'); - Route::post('/admin/games', 'Admin\GamesController@store'); - Route::get('/admin/games/{game}', 'Admin\GamesController@show'); - Route::post('/admin/games/{game}', 'Admin\GamesController@update'); - Route::delete('/admin/games/{game}', 'Admin\GamesController@destroy'); + /** + * GameTemplates + */ + Route::get('/admin/games/gametemplates', 'Admin\GameTemplatesController@index'); + Route::post('/admin/games/gametemplates', 'Admin\GameTemplatesController@deploy'); - /** - * GameServers - */ - Route::get('/admin/games/{game}/gameservers', 'Admin\GameServersController@index'); - Route::post('/admin/games/{game}/gameservers', 'Admin\GameServersController@store'); - Route::get('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@show'); - Route::post('/admin/games/{game}/gameservers/{gameServer}/updatetoken', 'Admin\GameServersController@updatetoken'); - Route::post('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@update'); - Route::delete('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@destroy'); + /** + * Games + */ + Route::get('/admin/games', 'Admin\GamesController@index'); + Route::post('/admin/games', 'Admin\GamesController@store'); + Route::get('/admin/games/{game}', 'Admin\GamesController@show'); + Route::post('/admin/games/{game}', 'Admin\GamesController@update'); + Route::delete('/admin/games/{game}', 'Admin\GamesController@destroy'); - /** - * GameServerCommands - */ - Route::get('/admin/games/{game}/gameservercommands', 'Admin\GameServerCommandsController@index'); - Route::post('/admin/games/{game}/gameservercommands', 'Admin\GameServerCommandsController@store'); - Route::get('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@show'); - Route::post('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@update'); - Route::delete('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@destroy'); - Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}', 'Admin\GameServerCommandsController@executeGameServerCommand'); - Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}/tournament/{tournament}', 'Admin\GameServerCommandsController@executeGameServerTournamentMatchCommand'); - Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}/matchmaking/{match}', 'Admin\GameServerCommandsController@executeGameServerMatchMakingCommand'); + /** + * GameServers + */ + Route::get('/admin/games/{game}/gameservers', 'Admin\GameServersController@index'); + Route::post('/admin/games/{game}/gameservers', 'Admin\GameServersController@store'); + Route::get('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@show'); + Route::post('/admin/games/{game}/gameservers/{gameServer}/updatetoken', 'Admin\GameServersController@updatetoken'); + Route::post('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@update'); + Route::delete('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@destroy'); - /** - * GameServerCommandParametrs - */ - Route::post('/admin/games/{game}/gameservercommandparameters', 'Admin\GameServerCommandParametersController@store'); - Route::post('/admin/games/{game}/gameservercommandparameters/{gameServerCommandParameter}', 'Admin\GameServerCommandParametersController@update'); - Route::delete('/admin/games/{game}/gameservercommandparameters/{gameServerCommandParameter}', 'Admin\GameServerCommandParametersController@destroy'); + /** + * GameServerCommands + */ + Route::get('/admin/games/{game}/gameservercommands', 'Admin\GameServerCommandsController@index'); + Route::post('/admin/games/{game}/gameservercommands', 'Admin\GameServerCommandsController@store'); + Route::get('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@show'); + Route::post('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@update'); + Route::delete('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@destroy'); + Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}', 'Admin\GameServerCommandsController@executeGameServerCommand'); + Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}/tournament/{tournament}', 'Admin\GameServerCommandsController@executeGameServerTournamentMatchCommand'); + Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}/matchmaking/{match}', 'Admin\GameServerCommandsController@executeGameServerMatchMakingCommand'); + /** + * GameServerCommandParametrs + */ + Route::post('/admin/games/{game}/gameservercommandparameters', 'Admin\GameServerCommandParametersController@store'); + Route::post('/admin/games/{game}/gameservercommandparameters/{gameServerCommandParameter}', 'Admin\GameServerCommandParametersController@update'); + Route::delete('/admin/games/{game}/gameservercommandparameters/{gameServerCommandParameter}', 'Admin\GameServerCommandParametersController@destroy'); - /** - * MatchReplays - */ - Route::delete('/admin/replays/{matchReplay}', 'Admin\MatchReplayController@destroy'); + /** + * MatchReplays + */ + Route::delete('/admin/replays/{matchReplay}', 'Admin\MatchReplayController@destroy'); - /** - * Participants - */ - Route::get('/admin/events/{event}/participants', 'Admin\Events\ParticipantsController@index'); - Route::get('/admin/events/{event}/participants/signoutall', 'Admin\Events\ParticipantsController@signoutall'); - Route::get('/admin/events/{event}/participants/{participant}/signout', 'Admin\Events\ParticipantsController@signout'); - Route::get('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@show'); - Route::post('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@update'); - Route::post( - '/admin/events/{event}/participants/{participant}/signin', - 'Admin\Events\ParticipantsController@signIn' - ); - Route::post( - '/admin/events/{event}/participants/{participant}/transfer', - 'Admin\Events\ParticipantsController@transfer' - ); - Route::post( - '/admin/events/{event}/participants/{participant}/revoke', - 'Admin\Events\ParticipantsController@revoke' - ); - if (config('admin.super_danger_zone')) { - Route::delete( - '/admin/events/{event}/participants/{participant}', - 'Admin\Events\ParticipantsController@delete' - ); - } - /** - * Announcements - */ - Route::post('/admin/events/{event}/announcements', 'Admin\Events\AnnouncementsController@store'); - Route::post( - '/admin/events/{event}/announcements/{announcement}', - 'Admin\Events\AnnouncementsController@update' - ); + /** + * Participants + */ + Route::get('/admin/events/{event}/participants', 'Admin\Events\ParticipantsController@index'); + Route::get('/admin/events/{event}/participants/signoutall', 'Admin\Events\ParticipantsController@signoutall'); + Route::get('/admin/events/{event}/participants/{participant}/signout', 'Admin\Events\ParticipantsController@signout'); + Route::get('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@show'); + Route::post('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@update'); + Route::post( + '/admin/events/{event}/participants/{participant}/signin', + 'Admin\Events\ParticipantsController@signIn' + ); + Route::post( + '/admin/events/{event}/participants/{participant}/transfer', + 'Admin\Events\ParticipantsController@transfer' + ); + Route::post( + '/admin/events/{event}/participants/{participant}/revoke', + 'Admin\Events\ParticipantsController@revoke' + ); + if (config('admin.super_danger_zone')) { Route::delete( - '/admin/events/{event}/announcements/{announcement}', - 'Admin\Events\AnnouncementsController@destroy' + '/admin/events/{event}/participants/{participant}', + 'Admin\Events\ParticipantsController@delete' ); + } - /** - * Mailing - */ - Route::get('/admin/mailing', 'Admin\MailingController@index'); - Route::get('/admin/mailing/{mailTemplate}', 'Admin\MailingController@show'); - Route::post('/admin/mailing', 'Admin\MailingController@store'); - Route::post('/admin/mailing/{mailTemplate}/send', 'Admin\MailingController@send'); - Route::post('/admin/mailing/{mailTemplate}', 'Admin\MailingController@update'); - Route::delete('/admin/mailing/{mailTemplate}', 'Admin\MailingController@destroy'); + /** + * Announcements + */ + Route::post('/admin/events/{event}/announcements', 'Admin\Events\AnnouncementsController@store'); + Route::post( + '/admin/events/{event}/announcements/{announcement}', + 'Admin\Events\AnnouncementsController@update' + ); + Route::delete( + '/admin/events/{event}/announcements/{announcement}', + 'Admin\Events\AnnouncementsController@destroy' + ); + /** + * Mailing + */ + Route::get('/admin/mailing', 'Admin\MailingController@index'); + Route::get('/admin/mailing/{mailTemplate}', 'Admin\MailingController@show'); + Route::post('/admin/mailing', 'Admin\MailingController@store'); + Route::post('/admin/mailing/{mailTemplate}/send', 'Admin\MailingController@send'); + Route::post('/admin/mailing/{mailTemplate}', 'Admin\MailingController@update'); + Route::delete('/admin/mailing/{mailTemplate}', 'Admin\MailingController@destroy'); - /** - * Tickets - */ - Route::get('/admin/events/{event}/tickets', 'Admin\Events\TicketsController@index'); - Route::post('/admin/events/{event}/tickets', 'Admin\Events\TicketsController@store'); - Route::get('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@show'); - Route::post('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@update'); - Route::delete('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@destroy'); - /** - * Gifts - */ - Route::post('/admin/events/{event}/freebies/staff', 'Admin\Events\EventsController@freeStaff'); - Route::post('/admin/events/{event}/freebies/gift', 'Admin\Events\EventsController@freeGift'); + /** + * Tickets + */ + Route::get('/admin/events/{event}/tickets', 'Admin\Events\TicketsController@index'); + Route::post('/admin/events/{event}/tickets', 'Admin\Events\TicketsController@store'); + Route::get('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@show'); + Route::post('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@update'); + Route::delete('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@destroy'); - /** - * Sponsors - */ - Route::post('/admin/events/{event}/sponsors', 'Admin\Events\SponsorsController@store'); - Route::post('/admin/events/{event}/sponsors/{sponsor}', 'Admin\Events\SponsorsController@update'); - Route::delete('/admin/events/{event}/sponsors/{sponsor}', 'Admin\Events\SponsorsController@destroy'); + /** + * Gifts + */ + Route::post('/admin/events/{event}/freebies/staff', 'Admin\Events\EventsController@freeStaff'); + Route::post('/admin/events/{event}/freebies/gift', 'Admin\Events\EventsController@freeGift'); - /** - * Venues - */ - Route::get('/admin/venues', 'Admin\Events\VenuesController@index'); - Route::post('/admin/venues', 'Admin\Events\VenuesController@store'); - Route::get('/admin/venues/{venue}', 'Admin\Events\VenuesController@show'); - Route::post('/admin/venues/{venue}', 'Admin\Events\VenuesController@update'); - Route::delete('/admin/venues/{venue}', 'Admin\Events\VenuesController@destroy'); - Route::post('/admin/venues/{venue}/{image}', 'Admin\Events\VenuesController@updateImage'); - Route::delete('/admin/venues/{venue}/{image}', 'Admin\Events\VenuesController@destroyImage'); + /** + * Sponsors + */ + Route::post('/admin/events/{event}/sponsors', 'Admin\Events\SponsorsController@store'); + Route::post('/admin/events/{event}/sponsors/{sponsor}', 'Admin\Events\SponsorsController@update'); + Route::delete('/admin/events/{event}/sponsors/{sponsor}', 'Admin\Events\SponsorsController@destroy'); - /** - * Galleries - */ - Route::get('/admin/gallery', 'Admin\GalleryController@index'); - Route::post('/admin/gallery', 'Admin\GalleryController@store'); - Route::get('/admin/gallery/{album}', 'Admin\GalleryController@show'); - Route::post('/admin/gallery/{album}', 'Admin\GalleryController@update'); - Route::delete('/admin/gallery/{album}', 'Admin\GalleryController@destroy'); - Route::post('/admin/gallery/{album}/upload', 'Admin\GalleryController@uploadFile'); - Route::post('/admin/gallery/{album}/{image}', 'Admin\GalleryController@updateFile'); - Route::delete('/admin/gallery/{album}/{image}', 'Admin\GalleryController@destroyFile'); + /** + * Venues + */ + Route::get('/admin/venues', 'Admin\Events\VenuesController@index'); + Route::post('/admin/venues', 'Admin\Events\VenuesController@store'); + Route::get('/admin/venues/{venue}', 'Admin\Events\VenuesController@show'); + Route::post('/admin/venues/{venue}', 'Admin\Events\VenuesController@update'); + Route::delete('/admin/venues/{venue}', 'Admin\Events\VenuesController@destroy'); + Route::post('/admin/venues/{venue}/{image}', 'Admin\Events\VenuesController@updateImage'); + Route::delete('/admin/venues/{venue}/{image}', 'Admin\Events\VenuesController@destroyImage'); - /** - * Help - */ - Route::get('/admin/help', 'Admin\HelpController@index'); - Route::post('/admin/help', 'Admin\HelpController@store'); - Route::get('/admin/help/{helpCategory}', 'Admin\HelpController@show'); - Route::post('/admin/help/{helpCategory}', 'Admin\HelpController@update'); - Route::delete('/admin/help/{helpCategory}', 'Admin\HelpController@destroy'); - Route::post('/admin/help/{helpCategory}/{entry}/upload', 'Admin\HelpController@uploadFiles'); - Route::post('/admin/help/{helpCategory}/{entry}/{attachment}', 'Admin\HelpController@updateFile'); - Route::delete('/admin/help/{helpCategory}/{entry}/{attachment}', 'Admin\HelpController@destroyFile'); - Route::post('/admin/help/{helpCategory}/add', 'Admin\HelpController@addHelpEntry'); - Route::post('/admin/help/{helpCategory}/{entry}', 'Admin\HelpController@updateHelpEntry'); - Route::delete('/admin/help/{helpCategory}/{entry}', 'Admin\HelpController@destroyHelpEntry'); + /** + * Galleries + */ + Route::get('/admin/gallery', 'Admin\GalleryController@index'); + Route::post('/admin/gallery', 'Admin\GalleryController@store'); + Route::get('/admin/gallery/{album}', 'Admin\GalleryController@show'); + Route::post('/admin/gallery/{album}', 'Admin\GalleryController@update'); + Route::delete('/admin/gallery/{album}', 'Admin\GalleryController@destroy'); + Route::post('/admin/gallery/{album}/upload', 'Admin\GalleryController@uploadFile'); + Route::post('/admin/gallery/{album}/{image}', 'Admin\GalleryController@updateFile'); + Route::delete('/admin/gallery/{album}/{image}', 'Admin\GalleryController@destroyFile'); - /** - * Users - */ - Route::get('/admin/users', 'Admin\UsersController@index'); - Route::get('/admin/users/{user}', 'Admin\UsersController@show'); - Route::delete('/admin/users/{user}', 'Admin\UsersController@remove'); - Route::post('/admin/users/{user}/admin', 'Admin\UsersController@grantAdmin'); - Route::delete('/admin/users/{user}/admin', 'Admin\UsersController@removeAdmin'); - Route::post('/admin/users/{user}/ban', 'Admin\UsersController@ban'); - Route::post('/admin/users/{user}/unban', 'Admin\UsersController@unban'); - Route::post('/admin/users/{user}/setemailverification', 'Admin\UsersController@setemailverification'); - Route::post('/admin/users/{user}/removemailverification', 'Admin\UsersController@removemailverification'); - Route::post('/admin/users/{user}/unauthorizeThirdparty/{method}', 'Admin\UsersController@unauthorizeThirdparty'); + /** + * Help + */ + Route::get('/admin/help', 'Admin\HelpController@index'); + Route::post('/admin/help', 'Admin\HelpController@store'); + Route::get('/admin/help/{helpCategory}', 'Admin\HelpController@show'); + Route::post('/admin/help/{helpCategory}', 'Admin\HelpController@update'); + Route::delete('/admin/help/{helpCategory}', 'Admin\HelpController@destroy'); + Route::post('/admin/help/{helpCategory}/{entry}/upload', 'Admin\HelpController@uploadFiles'); + Route::post('/admin/help/{helpCategory}/{entry}/{attachment}', 'Admin\HelpController@updateFile'); + Route::delete('/admin/help/{helpCategory}/{entry}/{attachment}', 'Admin\HelpController@destroyFile'); + Route::post('/admin/help/{helpCategory}/add', 'Admin\HelpController@addHelpEntry'); + Route::post('/admin/help/{helpCategory}/{entry}', 'Admin\HelpController@updateHelpEntry'); + Route::delete('/admin/help/{helpCategory}/{entry}', 'Admin\HelpController@destroyHelpEntry'); - /** - * MatchMaking - */ - Route::get('/admin/matchmaking', 'Admin\MatchMakingController@index'); - Route::post('/admin/matchmaking/{match}/serverstore', 'Admin\MatchMakingServerController@store'); - Route::post('/admin/matchmaking/{match}/serverupdate', 'Admin\MatchMakingServerController@update'); - Route::delete('/admin/matchmaking/{match}/serverdelete', 'Admin\MatchMakingServerController@destroy'); - Route::get('/admin/matchmaking/{match}', 'Admin\MatchMakingController@show'); - Route::post('/admin/matchmaking', 'Admin\MatchMakingController@store'); - Route::post('/admin/matchmaking/{match}/team/{team}/teamplayer/add', 'Admin\MatchMakingController@addusertomatch'); - Route::delete('/admin/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/delete', 'Admin\MatchMakingController@deleteuserfrommatch'); - Route::post('/admin/matchmaking/{match}/team/add', 'Admin\MatchMakingController@addteam'); - Route::post('/admin/matchmaking/{match}/team/{team}/update', 'Admin\MatchMakingController@updateteam'); - Route::delete('/admin/matchmaking/{match}/team/{team}/delete', 'Admin\MatchMakingController@deleteteam'); - Route::post('/admin/matchmaking/{match}/update', 'Admin\MatchMakingController@update'); - Route::post('/admin/matchmaking/{match}/start', 'Admin\MatchMakingController@start'); - Route::post('/admin/matchmaking/{match}/open', 'Admin\MatchMakingController@open'); - Route::post('/admin/matchmaking/{match}/finalize', 'Admin\MatchMakingController@finalize'); - Route::delete('/admin/matchmaking/{match}', 'Admin\MatchMakingController@destroy'); + /** + * Users + */ + Route::get('/admin/users', 'Admin\UsersController@index'); + Route::get('/admin/users/{user}', 'Admin\UsersController@show'); + Route::delete('/admin/users/{user}', 'Admin\UsersController@remove'); + Route::post('/admin/users/{user}/admin', 'Admin\UsersController@grantAdmin'); + Route::delete('/admin/users/{user}/admin', 'Admin\UsersController@removeAdmin'); + Route::post('/admin/users/{user}/ban', 'Admin\UsersController@ban'); + Route::post('/admin/users/{user}/unban', 'Admin\UsersController@unban'); + Route::post('/admin/users/{user}/setemailverification', 'Admin\UsersController@setemailverification'); + Route::post('/admin/users/{user}/removemailverification', 'Admin\UsersController@removemailverification'); + Route::post('/admin/users/{user}/unauthorizeThirdparty/{method}', 'Admin\UsersController@unauthorizeThirdparty'); - /** - * Settings - */ - Route::get('/admin/settings', 'Admin\SettingsController@index'); - Route::post('/admin/settings', 'Admin\SettingsController@update'); - Route::get('/admin/settings/org', 'Admin\SettingsController@showOrg'); - Route::get('/admin/settings/payments', 'Admin\SettingsController@showPayments'); - Route::get('/admin/settings/systems', 'Admin\SettingsController@showSystems'); - Route::post('/admin/settings/systems', 'Admin\SettingsController@updateSystems'); - Route::get('/admin/settings/auth', 'Admin\SettingsController@showAuth'); - Route::get('/admin/settings/api', 'Admin\SettingsController@showApi'); - Route::post('/admin/settings/api', 'Admin\SettingsController@updateApi'); - Route::get('/admin/settings/link/{social}', 'Admin\SettingsController@linkSocial'); - Route::delete('/admin/settings/unlink/{social}', 'Admin\SettingsController@unlinkSocial'); - Route::post('/admin/settings/payments/{gateway}/disable', 'Admin\SettingsController@disablePaymentGateway'); - Route::post('/admin/settings/payments/{gateway}/enable', 'Admin\SettingsController@enablePaymentGateway'); - Route::post('/admin/settings/login/{method}/disable', 'Admin\SettingsController@disableLoginMethod'); - Route::post('/admin/settings/login/{method}/enable', 'Admin\SettingsController@enableLoginMethod'); - Route::post('/admin/settings/auth/general', 'Admin\SettingsController@updateAuthGeneral'); - Route::post('/admin/settings/auth/steam', 'Admin\SettingsController@updateAuthSteam'); - Route::post('/admin/settings/credit/enable', 'Admin\SettingsController@enableCreditSystem'); - Route::post('/admin/settings/credit/disable', 'Admin\SettingsController@disableCreditSystem'); - Route::post('/admin/settings/shop/enable', 'Admin\SettingsController@enableShopSystem'); - Route::post('/admin/settings/shop/disable', 'Admin\SettingsController@disableShopSystem'); - Route::post('/admin/settings/gallery/enable', 'Admin\SettingsController@enableGallerySystem'); - Route::post('/admin/settings/gallery/disable', 'Admin\SettingsController@disableGallerySystem'); - Route::post('/admin/settings/help/enable', 'Admin\SettingsController@enableHelpSystem'); - Route::post('/admin/settings/help/disable', 'Admin\SettingsController@disableHelpSystem'); - Route::post('/admin/settings/matchmaking/enable', 'Admin\SettingsController@enableMatchMakingSystem'); - Route::post('/admin/settings/matchmaking/disable', 'Admin\SettingsController@disableMatchMakingSystem'); - Route::post('/admin/settings/generate/qr', 'Admin\SettingsController@regenerateQRCodes'); - Route::post('/admin/settings/generate/newqr', 'Admin\SettingsController@regenerateQRCodesWithNewNames'); + /** + * MatchMaking + */ + Route::get('/admin/matchmaking', 'Admin\MatchMakingController@index'); + Route::post('/admin/matchmaking/{match}/serverstore', 'Admin\MatchMakingServerController@store'); + Route::post('/admin/matchmaking/{match}/serverupdate', 'Admin\MatchMakingServerController@update'); + Route::delete('/admin/matchmaking/{match}/serverdelete', 'Admin\MatchMakingServerController@destroy'); + Route::get('/admin/matchmaking/{match}', 'Admin\MatchMakingController@show'); + Route::post('/admin/matchmaking', 'Admin\MatchMakingController@store'); + Route::post('/admin/matchmaking/{match}/team/{team}/teamplayer/add', 'Admin\MatchMakingController@addusertomatch'); + Route::delete('/admin/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/delete', 'Admin\MatchMakingController@deleteuserfrommatch'); + Route::post('/admin/matchmaking/{match}/team/add', 'Admin\MatchMakingController@addteam'); + Route::post('/admin/matchmaking/{match}/team/{team}/update', 'Admin\MatchMakingController@updateteam'); + Route::delete('/admin/matchmaking/{match}/team/{team}/delete', 'Admin\MatchMakingController@deleteteam'); + Route::post('/admin/matchmaking/{match}/update', 'Admin\MatchMakingController@update'); + Route::post('/admin/matchmaking/{match}/start', 'Admin\MatchMakingController@start'); + Route::post('/admin/matchmaking/{match}/open', 'Admin\MatchMakingController@open'); + Route::post('/admin/matchmaking/{match}/finalize', 'Admin\MatchMakingController@finalize'); + Route::delete('/admin/matchmaking/{match}', 'Admin\MatchMakingController@destroy'); - /** - * Appearance - */ - Route::get('/admin/settings/appearance', 'Admin\AppearanceController@index'); - Route::post('/admin/settings/appearance/slider/images/', 'Admin\AppearanceController@sliderUpload'); - Route::post('/admin/settings/appearance/slider/images/{image}', 'Admin\AppearanceController@sliderUpdate'); - Route::delete('/admin/settings/appearance/slider/images/{image}', 'Admin\AppearanceController@sliderDelete'); - Route::get('/admin/settings/appearance/css/recompile', 'Admin\AppearanceController@cssRecompile'); - Route::get('/admin/settings/appearance/css/updatedatabasefromfile', 'Admin\AppearanceController@cssUpdateDatabaseFromFile'); - Route::post('/admin/settings/appearance/css/override', 'Admin\AppearanceController@cssOverride'); - Route::post('/admin/settings/appearance/css/variables', 'Admin\AppearanceController@cssVariables'); + /** + * Settings + */ + Route::get('/admin/settings', 'Admin\SettingsController@index'); + Route::post('/admin/settings', 'Admin\SettingsController@update'); + Route::get('/admin/settings/org', 'Admin\SettingsController@showOrg'); + Route::get('/admin/settings/payments', 'Admin\SettingsController@showPayments'); + Route::get('/admin/settings/systems', 'Admin\SettingsController@showSystems'); + Route::post('/admin/settings/systems', 'Admin\SettingsController@updateSystems'); + Route::get('/admin/settings/auth', 'Admin\SettingsController@showAuth'); + Route::get('/admin/settings/api', 'Admin\SettingsController@showApi'); + Route::post('/admin/settings/api', 'Admin\SettingsController@updateApi'); + Route::get('/admin/settings/link/{social}', 'Admin\SettingsController@linkSocial'); + Route::delete('/admin/settings/unlink/{social}', 'Admin\SettingsController@unlinkSocial'); + Route::post('/admin/settings/payments/{gateway}/disable', 'Admin\SettingsController@disablePaymentGateway'); + Route::post('/admin/settings/payments/{gateway}/enable', 'Admin\SettingsController@enablePaymentGateway'); + Route::post('/admin/settings/login/{method}/disable', 'Admin\SettingsController@disableLoginMethod'); + Route::post('/admin/settings/login/{method}/enable', 'Admin\SettingsController@enableLoginMethod'); + Route::post('/admin/settings/auth/general', 'Admin\SettingsController@updateAuthGeneral'); + Route::post('/admin/settings/auth/steam', 'Admin\SettingsController@updateAuthSteam'); + Route::post('/admin/settings/credit/enable', 'Admin\SettingsController@enableCreditSystem'); + Route::post('/admin/settings/credit/disable', 'Admin\SettingsController@disableCreditSystem'); + Route::post('/admin/settings/shop/enable', 'Admin\SettingsController@enableShopSystem'); + Route::post('/admin/settings/shop/disable', 'Admin\SettingsController@disableShopSystem'); + Route::post('/admin/settings/gallery/enable', 'Admin\SettingsController@enableGallerySystem'); + Route::post('/admin/settings/gallery/disable', 'Admin\SettingsController@disableGallerySystem'); + Route::post('/admin/settings/help/enable', 'Admin\SettingsController@enableHelpSystem'); + Route::post('/admin/settings/help/disable', 'Admin\SettingsController@disableHelpSystem'); + Route::post('/admin/settings/matchmaking/enable', 'Admin\SettingsController@enableMatchMakingSystem'); + Route::post('/admin/settings/matchmaking/disable', 'Admin\SettingsController@disableMatchMakingSystem'); + Route::post('/admin/settings/userlocale/enable', 'Admin\SettingsController@enableUserLocale'); + Route::post('/admin/settings/userlocale/disable', 'Admin\SettingsController@disableUserLocale'); + Route::post('/admin/settings/userlocale/reset', 'Admin\SettingsController@resetUserLocales'); + Route::post('/admin/settings/generate/qr', 'Admin\SettingsController@regenerateQRCodes'); + Route::post('/admin/settings/generate/newqr', 'Admin\SettingsController@regenerateQRCodesWithNewNames'); - /** - * News - */ - Route::get('/admin/news', 'Admin\NewsController@index'); - Route::post('/admin/news', 'Admin\NewsController@store'); - Route::get('/admin/news/{newsArticle}', 'Admin\NewsController@show'); - Route::post('/admin/news/{newsArticle}', 'Admin\NewsController@update'); - Route::delete('/admin/news/{newsArticle}', 'Admin\NewsController@destroy'); - Route::get('/admin/news/{newsArticle}/comments/{newsComment}/delete', 'Admin\NewsController@destroyComment'); - Route::get('/admin/news/{newsArticle}/comments/{newsComment}/approve', 'Admin\NewsController@approveComment'); - Route::get('/admin/news/{newsArticle}/comments/{newsComment}/reject', 'Admin\NewsController@rejectComment'); - Route::get( - '/admin/news/{newsArticle}/comments/{newsComment}/reports/{newsCommentReport}/delete', - 'Admin\NewsController@destroyReport' - ); + /** + * Appearance + */ + Route::get('/admin/settings/appearance', 'Admin\AppearanceController@index'); + Route::post('/admin/settings/appearance/slider/images/', 'Admin\AppearanceController@sliderUpload'); + Route::post('/admin/settings/appearance/slider/images/{image}', 'Admin\AppearanceController@sliderUpdate'); + Route::delete('/admin/settings/appearance/slider/images/{image}', 'Admin\AppearanceController@sliderDelete'); + Route::get('/admin/settings/appearance/css/recompile', 'Admin\AppearanceController@cssRecompile'); + Route::get('/admin/settings/appearance/css/updatedatabasefromfile', 'Admin\AppearanceController@cssUpdateDatabaseFromFile'); + Route::post('/admin/settings/appearance/css/override', 'Admin\AppearanceController@cssOverride'); + Route::post('/admin/settings/appearance/css/variables', 'Admin\AppearanceController@cssVariables'); - /** - * Polls - */ - Route::get('/admin/polls', 'Admin\PollsController@index'); - Route::post('/admin/polls', 'Admin\PollsController@store'); - Route::get('/admin/polls/{poll}', 'Admin\PollsController@show'); - Route::post('/admin/polls/{poll}', 'Admin\PollsController@update'); - Route::post('/admin/polls/{poll}/end', 'Admin\PollsController@endPoll'); - Route::delete('/admin/polls/{poll}', 'Admin\PollsController@destroy'); - Route::post('/admin/polls/{poll}/options', 'Admin\PollsController@storeOption'); - Route::delete('/admin/polls/{poll}/options/{option}', 'Admin\PollsController@destroyOption'); + /** + * News + */ + Route::get('/admin/news', 'Admin\NewsController@index'); + Route::post('/admin/news', 'Admin\NewsController@store'); + Route::get('/admin/news/{newsArticle}', 'Admin\NewsController@show'); + Route::post('/admin/news/{newsArticle}', 'Admin\NewsController@update'); + Route::delete('/admin/news/{newsArticle}', 'Admin\NewsController@destroy'); + Route::get('/admin/news/{newsArticle}/comments/{newsComment}/delete', 'Admin\NewsController@destroyComment'); + Route::get('/admin/news/{newsArticle}/comments/{newsComment}/approve', 'Admin\NewsController@approveComment'); + Route::get('/admin/news/{newsArticle}/comments/{newsComment}/reject', 'Admin\NewsController@rejectComment'); + Route::get( + '/admin/news/{newsArticle}/comments/{newsComment}/reports/{newsCommentReport}/delete', + 'Admin\NewsController@destroyReport' + ); - /** - * Purchases - */ - Route::get('/admin/purchases', 'Admin\PurchasesController@index'); - Route::get('/admin/purchases/shop', 'Admin\PurchasesController@showShop'); - Route::get('/admin/purchases/event', 'Admin\PurchasesController@showEvent'); - Route::get('/admin/purchases/revoked', 'Admin\PurchasesController@showRevoked'); - Route::get('/admin/purchases/{purchase}/setSuccess', 'Admin\PurchasesController@setSuccess'); - Route::get('/admin/purchases/{purchase}', 'Admin\PurchasesController@show'); - if (config('admin.super_danger_zone')) { - Route::delete('/admin/purchases/{purchase}', 'Admin\PurchasesController@delete'); - } + /** + * Polls + */ + Route::get('/admin/polls', 'Admin\PollsController@index'); + Route::post('/admin/polls', 'Admin\PollsController@store'); + Route::get('/admin/polls/{poll}', 'Admin\PollsController@show'); + Route::post('/admin/polls/{poll}', 'Admin\PollsController@update'); + Route::post('/admin/polls/{poll}/end', 'Admin\PollsController@endPoll'); + Route::delete('/admin/polls/{poll}', 'Admin\PollsController@destroy'); + Route::post('/admin/polls/{poll}/options', 'Admin\PollsController@storeOption'); + Route::delete('/admin/polls/{poll}/options/{option}', 'Admin\PollsController@destroyOption'); - /** - * Credit System - */ - Route::get('/admin/credit', 'Admin\CreditController@index'); - Route::post('/admin/credit/edit', 'Admin\CreditController@edit'); - Route::post('/admin/credit/settings', 'Admin\CreditController@settings'); + /** + * Purchases + */ + Route::get('/admin/purchases', 'Admin\PurchasesController@index'); + Route::get('/admin/purchases/shop', 'Admin\PurchasesController@showShop'); + Route::get('/admin/purchases/event', 'Admin\PurchasesController@showEvent'); + Route::get('/admin/purchases/revoked', 'Admin\PurchasesController@showRevoked'); + Route::get('/admin/purchases/{purchase}/setSuccess', 'Admin\PurchasesController@setSuccess'); + Route::get('/admin/purchases/{purchase}', 'Admin\PurchasesController@show'); + if (config('admin.super_danger_zone')) { + Route::delete('/admin/purchases/{purchase}', 'Admin\PurchasesController@delete'); + } - /** - * Shop - */ - Route::get('/admin/shop', 'Admin\ShopController@index'); - Route::post('/admin/shop/item', 'Admin\ShopController@storeItem'); - Route::post('/admin/shop/category', 'Admin\ShopController@storeCategory'); - Route::get('/admin/shop/{category}', 'Admin\ShopController@showCategory'); - Route::post('/admin/shop/{category}', 'Admin\ShopController@updateCategory'); - Route::delete('/admin/shop/{category}', 'Admin\ShopController@deleteCategory'); - Route::get('/admin/shop/{category}/{item}', 'Admin\ShopController@showItem'); - Route::post('/admin/shop/{category}/{item}', 'Admin\ShopController@updateItem'); - Route::delete('/admin/shop/{category}/{item}', 'Admin\ShopController@deleteItem'); - Route::post('/admin/shop/{category}/{item}/images', 'Admin\ShopController@uploadItemImage'); - Route::post('/admin/shop/{category}/{item}/images/{image}', 'Admin\ShopController@updateItemImage'); - Route::delete('/admin/shop/{category}/{item}/images/{image}', 'Admin\ShopController@deleteItemImage'); + /** + * Credit System + */ + Route::get('/admin/credit', 'Admin\CreditController@index'); + Route::post('/admin/credit/edit', 'Admin\CreditController@edit'); + Route::post('/admin/credit/settings', 'Admin\CreditController@settings'); - /** - * Orders - */ - Route::get('/admin/orders', 'Admin\OrdersController@index'); - Route::get('/admin/orders/{order}', 'Admin\OrdersController@show'); - Route::post('/admin/orders/{order}/processing', 'Admin\OrdersController@setAsProcessing'); - Route::post('/admin/orders/{order}/shipped', 'Admin\OrdersController@setAsShipped'); - Route::post('/admin/orders/{order}/tracking', 'Admin\OrdersController@updateTrackingDetails'); - Route::post('/admin/orders/{order}/complete', 'Admin\OrdersController@setAsComplete'); - Route::post('/admin/orders/{order}/cancel', 'Admin\OrdersController@setAsCancelled'); - }); + /** + * Shop + */ + Route::get('/admin/shop', 'Admin\ShopController@index'); + Route::post('/admin/shop/item', 'Admin\ShopController@storeItem'); + Route::post('/admin/shop/category', 'Admin\ShopController@storeCategory'); + Route::get('/admin/shop/{category}', 'Admin\ShopController@showCategory'); + Route::post('/admin/shop/{category}', 'Admin\ShopController@updateCategory'); + Route::delete('/admin/shop/{category}', 'Admin\ShopController@deleteCategory'); + Route::get('/admin/shop/{category}/{item}', 'Admin\ShopController@showItem'); + Route::post('/admin/shop/{category}/{item}', 'Admin\ShopController@updateItem'); + Route::delete('/admin/shop/{category}/{item}', 'Admin\ShopController@deleteItem'); + Route::post('/admin/shop/{category}/{item}/images', 'Admin\ShopController@uploadItemImage'); + Route::post('/admin/shop/{category}/{item}/images/{image}', 'Admin\ShopController@updateItemImage'); + Route::delete('/admin/shop/{category}/{item}/images/{image}', 'Admin\ShopController@deleteItemImage'); + + /** + * Orders + */ + Route::get('/admin/orders', 'Admin\OrdersController@index'); + Route::get('/admin/orders/{order}', 'Admin\OrdersController@show'); + Route::post('/admin/orders/{order}/processing', 'Admin\OrdersController@setAsProcessing'); + Route::post('/admin/orders/{order}/shipped', 'Admin\OrdersController@setAsShipped'); + Route::post('/admin/orders/{order}/tracking', 'Admin\OrdersController@updateTrackingDetails'); + Route::post('/admin/orders/{order}/complete', 'Admin\OrdersController@setAsComplete'); + Route::post('/admin/orders/{order}/cancel', 'Admin\OrdersController@setAsCancelled'); }); }); diff --git a/src/app/Libraries/Helpers.php b/src/app/Libraries/Helpers.php index ad9a4c72..3893703c 100644 --- a/src/app/Libraries/Helpers.php +++ b/src/app/Libraries/Helpers.php @@ -24,10 +24,30 @@ class Helpers { + + + /** + * Gets an array of all supported languages from the language directory. + * + * @return array + */ public static function getSupportedLocales() { - return config('app.locales', []); + return array_map('basename', array_filter(glob(app()->langPath().'/*'), 'is_dir')); + } + + + /** + * Validate if the given locale exists in the supported languages. + * + * @param string $locale + * @return bool + */ + public static function isValidLocale($locale) + { + return in_array($locale, self::getSupportedLocales()); } + // TODO - refactor - eg getGameSelectArray - specifially the selectArray part /** * Get Venues diff --git a/src/app/Libraries/Settings.php b/src/app/Libraries/Settings.php index 9356f0a5..f5a269db 100644 --- a/src/app/Libraries/Settings.php +++ b/src/app/Libraries/Settings.php @@ -1043,4 +1043,35 @@ public static function disableAuthAllowEmailChange() { return \App\Setting::disableAuthAllowEmailChange(); } + + + + /** + * Is user_locale Enabled + * @return Boolean + */ + public static function isUserLocaleEnabled() + { + return \App\Setting::isUserLocaleEnabled(); + } + + /** + * Enable user_locale + * @return Boolean + */ + public static function enableUserLocale() + { + return \App\Setting::enableUserLocale(); + } + + /** + * Disable user_locale + * @return Boolean + */ + public static function disableUserLocale() + { + return \App\Setting::disableUserLocale(); + } + + } diff --git a/src/app/Rules/ValidLocale.php b/src/app/Rules/ValidLocale.php new file mode 100644 index 00000000..b6bd9823 --- /dev/null +++ b/src/app/Rules/ValidLocale.php @@ -0,0 +1,23 @@ +first()->value; } + + + /** + * Is user_locale Enabled + * @return Boolean + */ + public static function isUserLocaleEnabled() + { + return self::where('setting', 'user_locale_enabled')->first()->value; + } + + /** + * Enable user_locale + * @return Boolean + */ + public static function enableUserLocale() + { + if (!$UserLocaleEnabled = self::where('setting', 'user_locale_enabled')->first()) { + return false; + } + $UserLocaleEnabled->value = true; + if (!$UserLocaleEnabled->save()) { + return false; + } + return true; + } + + /** + * Disable user_locale + * @return Boolean + */ + public static function disableUserLocale() + { + if (!$UserLocaleEnabled = self::where('setting', 'user_locale_enabled')->first()) { + return false; + } + $UserLocaleEnabled->value = false; + if (!$UserLocaleEnabled->save()) { + return false; + } + return true; + } + + + } diff --git a/src/config/app.php b/src/config/app.php index 232a9972..00f6d8c6 100644 --- a/src/config/app.php +++ b/src/config/app.php @@ -121,5 +121,4 @@ 'JsonLd' => Artesaos\SEOTools\Facades\JsonLd::class, 'Debugbar' => Barryvdh\Debugbar\Facade::class, ], - 'locales' => ['en', 'es', 'fr', 'de'], ]; diff --git a/src/database/seeders/RequiredDatabaseSeeder.php b/src/database/seeders/RequiredDatabaseSeeder.php index 0f7ccc0a..7488e2aa 100644 --- a/src/database/seeders/RequiredDatabaseSeeder.php +++ b/src/database/seeders/RequiredDatabaseSeeder.php @@ -389,6 +389,14 @@ public function run() 'description' => 'Locale that is used for all the Site Default Texts' ] ); + Setting::firstOrCreate( + ['setting' => 'user_locale_enabled'], + [ + 'value' => true, + 'default' => true, + 'description' => 'Enable Users to set different locale in their profile settings' + ] + ); Setting::firstOrCreate( ['setting' => 'systems_matchmaking_publicuse'], [ diff --git a/src/database/seeders/SettingsTableSeeder.php b/src/database/seeders/SettingsTableSeeder.php index 03aa330d..3a8fe81c 100644 --- a/src/database/seeders/SettingsTableSeeder.php +++ b/src/database/seeders/SettingsTableSeeder.php @@ -378,6 +378,14 @@ public function run() 'description' => 'Locale that is used for all the Site Default Texts' ] ); + Setting::firstOrCreate( + ['setting' => 'user_locale_enabled'], + [ + 'value' => true, + 'default' => true, + 'description' => 'Enable Users to set different locale in their profile settings' + ] + ); Setting::firstOrCreate( ['setting' => 'systems_matchmaking_publicuse'], [ diff --git a/src/resources/views/accounts/index.blade.php b/src/resources/views/accounts/index.blade.php index 3d6fa3ea..78f797e8 100644 --- a/src/resources/views/accounts/index.blade.php +++ b/src/resources/views/accounts/index.blade.php @@ -78,23 +78,24 @@ @enderror -
-
- {{ Form::label('locale', __('accounts.locale'), ['class' => '']) }} - - - @error('locale') -
{{ $message }}
- @enderror + @if(Settings::isUserLocaleEnabled()) +
+
+ {{ Form::label('locale', __('accounts.locale'), ['class' => '']) }} + + + @error('locale') +
{{ $message }}
+ @enderror +
-
- + @endif @endif diff --git a/src/resources/views/admin/settings/index.blade.php b/src/resources/views/admin/settings/index.blade.php index e9f4f744..904dadf5 100644 --- a/src/resources/views/admin/settings/index.blade.php +++ b/src/resources/views/admin/settings/index.blade.php @@ -1,269 +1,372 @@ @extends ('layouts.admin-default') -@section ('page_title', 'Settings') +@section('page_title', 'Settings') -@section ('content') +@section('content') -
-
-

Settings

- -
-
+
+
+

Settings

+ +
+
-@include ('layouts._partials._admin._settings.dashMini') + @include ('layouts._partials._admin._settings.dashMini') -
-
- -
-
- Main -
-
-
- - - - - - - - - - @foreach ($settings as $key=>$setting) - @if ( - strpos($setting->setting, 'about') === false && - strpos($setting->setting, 'terms_and_conditions') === false && - strpos($setting->setting, 'org_') === false && - strpos($setting->setting, 'systems_') === false && - strpos($setting->setting, 'slider_') === false && - strpos($setting->setting, 'payment') === false && - strpos($setting->setting, 'credit') === false && - strpos($setting->setting, 'login') === false && - strpos($setting->setting, 'auth') === false && - strpos($setting->setting, 'shop') === false && - strpos($setting->setting, 'gallery') === false && - strpos($setting->setting, 'help') === false && - strpos($setting->setting, 'matchmaking_enabled') === false && - strpos($setting->setting, 'seo') === false && - strpos($setting->setting, 'privacy_policy') === false && - strpos($setting->setting, 'legal_notice') === false && - strpos($setting->setting, 'theme') === false && - $setting->setting != 'currency' && - $setting->setting != 'social_facebook_page_access_token' && - $setting->setting != 'installed' - ) - - {{ Form::open(array('url'=>'/admin/settings/', 'onsubmit' => 'return ConfirmSubmit()')) }} - - - - {{ Form::close() }} - {{ Form::open(array('url'=>'/admin/settings/', 'onsubmit' => 'return ConfirmDelete()')) }} - - {{ Form::close() }} - - @endif - @endforeach - -
SettingValue
- {{ ucwords(str_replace("_"," ",$setting->setting)) }}
- @if ($setting->description != null) - {{ $setting->description }} - @endif -
- {{ Form::text($setting->setting, $setting->value ,array('id'=>'setting' . $key,'class'=>'form-control')) }} - - - - @if (!$setting->default) - {{ Form::hidden('_method', 'DELETE') }} - - @endif -
-
-
-
-
- -
-
- Shop System -
-
-

The Shop can be used for buying merch, consumables etc.

- @if ($isShopEnabled) - {{ Form::open(array('url'=>'/admin/settings/shop/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/shop/enable')) }} - - {{ Form::close() }} - @endif -
-
- -
-
- Credit System -
-
-

The Credit System is used to award participants with credit they can use to buy things from the shop and events. It can be award for buying tickets, attending events, participanting/winning tournaments or manually assigned.

- @if ($isCreditEnabled) - {{ Form::open(array('url'=>'/admin/settings/credit/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/credit/enable')) }} - - {{ Form::close() }} - @endif -
-
+
+
- -
-
- Gallery System -
-
-

The Gallery can be used for uploading pictures.

- @if ($isGalleryEnabled) - {{ Form::open(array('url'=>'/admin/settings/gallery/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/gallery/enable')) }} - - {{ Form::close() }} - @endif -
-
+ +
+
+ Main +
+
+ + + + + + + + + + + @foreach ($settings as $key => $setting) + @if (strpos($setting->setting, 'about') === false && + strpos($setting->setting, 'terms_and_conditions') === false && + strpos($setting->setting, 'org_') === false && + strpos($setting->setting, 'systems_') === false && + strpos($setting->setting, 'slider_') === false && + strpos($setting->setting, 'payment') === false && + strpos($setting->setting, 'credit') === false && + strpos($setting->setting, 'login') === false && + strpos($setting->setting, 'auth') === false && + strpos($setting->setting, 'shop') === false && + strpos($setting->setting, 'gallery') === false && + strpos($setting->setting, 'help') === false && + strpos($setting->setting, 'matchmaking_enabled') === false && + strpos($setting->setting, 'seo') === false && + strpos($setting->setting, 'privacy_policy') === false && + strpos($setting->setting, 'legal_notice') === false && + strpos($setting->setting, 'theme') === false && + $setting->setting != 'currency' && + $setting->setting != 'social_facebook_page_access_token' && + $setting->setting != 'installed' && + $setting->setting != 'user_locale_enabled' && + $setting->setting != 'site_locale') + + {{ Form::open(['url' => '/admin/settings/', 'onsubmit' => 'return ConfirmSubmit()']) }} + + + + {{ Form::close() }} + {{ Form::open(['url' => '/admin/settings/', 'onsubmit' => 'return ConfirmDelete()']) }} + + {{ Form::close() }} + + @endif + @endforeach + +
SettingValue
+ {{ ucwords(str_replace('_', ' ', $setting->setting)) }}
+ @if ($setting->description != null) + {{ $setting->description }} + @endif +
+ {{ Form::text($setting->setting, $setting->value, ['id' => 'setting' . $key, 'class' => 'form-control']) }} + + + + @if (!$setting->default) + {{ Form::hidden('_method', 'DELETE') }} + + @endif +
+
+
- -
-
- Help System -
-
-

The Help System can be used to populate help articles.

- @if ($isHelpEnabled) - {{ Form::open(array('url'=>'/admin/settings/help/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/help/enable')) }} - - {{ Form::close() }} - @endif -
-
+ +
+
+ Locales +
+
+ + + + + + + + + + + {{ Form::open(['url' => '/admin/settings/', 'onsubmit' => 'return ConfirmSubmit()']) }} + + + + {{ Form::close() }} - -
-
- Social Media -
-
-

Link Social Media your social media accounts to publish posts and pictures from the Lan Manager

-
-
-

Facebook

- @if (!$facebookIsLinked) - - - - @else - {{ Form::open(array('url'=>'/admin/settings/unlink/facebook')) }} - {{ Form::hidden('_method', 'DELETE') }} - - {{ Form::close() }} - @endif -
-
-

Twitter Coming soon

- {{ Form::open(array('url'=>'/admin/settings/link/twitter')) }} - - {{ Form::close() }} -
-
-
-
- -
-
- Misc -
-
-
- {{ Form::open(array('url'=>'/admin/settings/generate/qr', 'onsubmit' => 'return ConfirmSubmit()')) }} - - {{ Form::close() }} -
-
- {{ Form::open(array('url'=>'/admin/settings/generate/newqr', 'onsubmit' => 'return ConfirmSubmit()')) }} - - {{ Form::close() }} -
- @foreach (config() as $config) - {{ dd($config) }} - @endforeach -
-
- -
- -
-
- SEO & Analytics -
-
- {{ Form::open(array('url'=>'/admin/settings/', 'onsubmit' => 'return ConfirmSubmit()')) }} -
-
- {{ Form::label('seo_keywords', "SEO Keywords" ,array('id'=>'','class'=>'')) }} - {{ Form::text("seo_keywords", implode(', ', explode(',', Settings::getSeoKeywords())) ,array('id'=>'setting_seo_keywords','class'=>'form-control')) }} - Separate each keyword with a Comma. -
-
- {{ Form::label('analytics_google_id', "Google Analyics ID" ,array('id'=>'','class'=>'')) }} - {{ Form::text("analytics_google_id", config('analytics.configurations.GoogleAnalytics.tracking_id') ,array('id'=>'setting_analytics_google_id','class'=>'form-control')) }} -
-
- {{ Form::label('analytics_facebook_pixel', "Facebook Pixel ID" ,array('id'=>'','class'=>'')) }} - {{ Form::text("analytics_facebook_pixel", config('facebook-pixel.facebook_pixel_id') ,array('id'=>'setting_analytics_facebook_pixel','class'=>'form-control')) }} -
-
- - {{ Form::close() }} -
-
-
- + -@endsection \ No newline at end of file + + + + + + + +
SettingValue
+ {{ ucwords(str_replace('_', ' ', $settings->firstWhere('setting', 'site_locale')->setting)) }}
+ @if ($settings->firstWhere('setting', 'site_locale')->description != null) + {{ $settings->firstWhere('setting', 'site_locale')->description }} + @endif +
- -
-
- Matchmaking System -
-
-

The Matchmaking feature can be used to make matches by admins or users without the need of an event tournament.

- @if ($isMatchMakingEnabled) - {{ Form::open(array('url'=>'/admin/settings/matchmaking/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/matchmaking/enable')) }} - - {{ Form::close() }} - @endif -
-
+ +
+ +
+ {{ ucwords(str_replace('_', ' ', $settings->firstWhere('setting', 'user_locale_enabled')->setting)) }}
+ @if ($settings->firstWhere('setting', 'user_locale_enabled')->description != null) + {{ $settings->firstWhere('setting', 'user_locale_enabled')->description }} + @endif +
+ @if (Settings::isUserLocaleEnabled()) + + @else + + @endif + + + @if (Settings::isUserLocaleEnabled()) + {{ Form::open(['url' => '/admin/settings/userlocale/disable', 'onsubmit' => 'return ConfirmSubmit()']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/userlocale/enable', 'onsubmit' => 'return ConfirmSubmit()']) }} + + {{ Form::close() }} + @endif + +
+
+
+ + + +
+
+ +
+
+ Shop System +
+
+

The Shop can be used for buying merch, consumables etc.

+ @if ($isShopEnabled) + {{ Form::open(['url' => '/admin/settings/shop/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/shop/enable']) }} + + {{ Form::close() }} + @endif +
+
+ +
+
+ Credit System +
+
+

The Credit System is used to award participants with credit they can use to buy things from the shop + and events. It can be award for buying tickets, attending events, participanting/winning tournaments + or manually assigned.

+ @if ($isCreditEnabled) + {{ Form::open(['url' => '/admin/settings/credit/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/credit/enable']) }} + + {{ Form::close() }} + @endif +
+
+ + +
+
+ Gallery System +
+
+

The Gallery can be used for uploading pictures.

+ @if ($isGalleryEnabled) + {{ Form::open(['url' => '/admin/settings/gallery/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/gallery/enable']) }} + + {{ Form::close() }} + @endif +
+
+ + +
+
+ Help System +
+
+

The Help System can be used to populate help articles.

+ @if ($isHelpEnabled) + {{ Form::open(['url' => '/admin/settings/help/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/help/enable']) }} + + {{ Form::close() }} + @endif +
+
+ + +
+
+ Matchmaking System +
+
+

The Matchmaking feature can be used to make matches by admins or users without the need of an event + tournament.

+ @if ($isMatchMakingEnabled) + {{ Form::open(['url' => '/admin/settings/matchmaking/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/matchmaking/enable']) }} + + {{ Form::close() }} + @endif +
+
+ + +
+
+ Social Media +
+
+

Link Social Media your social media accounts to publish posts and pictures from the Lan + Manager

+
+
+

Facebook

+ @if (!$facebookIsLinked) + + + + @else + {{ Form::open(['url' => '/admin/settings/unlink/facebook']) }} + {{ Form::hidden('_method', 'DELETE') }} + + {{ Form::close() }} + @endif +
+
+

Twitter Coming soon

+ {{ Form::open(['url' => '/admin/settings/link/twitter']) }} + + {{ Form::close() }} +
+
+
+
+ +
+
+ Misc +
+
+
+
+
+ {{ Form::open(['url' => '/admin/settings/generate/qr', 'onsubmit' => 'return ConfirmSubmit()']) }} + + {{ Form::close() }} +
+
+ {{ Form::open(['url' => '/admin/settings/generate/newqr', 'onsubmit' => 'return ConfirmSubmit()']) }} + + {{ Form::close() }} +
+
+
+
+ {{ Form::open(['url' => '/admin/settings/userlocale/reset', 'onsubmit' => 'return ConfirmSubmit()']) }} + + {{ Form::close() }} +
+
+
+ {{-- @foreach (config() as $config) + {{ dd($config) }} + @endforeach --}} + +
+
+
+
+ +
+
+ SEO & Analytics +
+
+ {{ Form::open(['url' => '/admin/settings/', 'onsubmit' => 'return ConfirmSubmit()']) }} +
+
+ {{ Form::label('seo_keywords', 'SEO Keywords', ['id' => '', 'class' => '']) }} + {{ Form::text('seo_keywords', implode(', ', explode(',', Settings::getSeoKeywords())), ['id' => 'setting_seo_keywords', 'class' => 'form-control']) }} + Separate each keyword with a Comma. +
+
+ {{ Form::label('analytics_google_id', 'Google Analyics ID', ['id' => '', 'class' => '']) }} + {{ Form::text('analytics_google_id', config('analytics.configurations.GoogleAnalytics.tracking_id'), ['id' => 'setting_analytics_google_id', 'class' => 'form-control']) }} +
+
+ {{ Form::label('analytics_facebook_pixel', 'Facebook Pixel ID', ['id' => '', 'class' => '']) }} + {{ Form::text('analytics_facebook_pixel', config('facebook-pixel.facebook_pixel_id'), ['id' => 'setting_analytics_facebook_pixel', 'class' => 'form-control']) }} +
+
+ + {{ Form::close() }} +
+
+
+
+ +@endsection diff --git a/src/resources/views/admin/users/show.blade.php b/src/resources/views/admin/users/show.blade.php index 7197abcf..30ee01cb 100644 --- a/src/resources/views/admin/users/show.blade.php +++ b/src/resources/views/admin/users/show.blade.php @@ -45,6 +45,9 @@ @if ($userShow->email != null)
  • Email: {{ $userShow->email }}
  • @endif +
  • + User Locale: {{ $userShow->locale }} @if (!Settings::isUserLocaleEnabled()) (User Locale is disabled systemwide) @endif +
  • From a016fa88d2501fd2bf52c4b57ee25e6167a16915 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 13 Nov 2024 19:47:07 +0100 Subject: [PATCH 58/59] add local avatar path to makefile --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 3c8cb7e1..68b173b0 100755 --- a/Makefile +++ b/Makefile @@ -221,6 +221,7 @@ folder-structure-prd: mkdir -p /src/storage/app/public/images/venues/ && \ mkdir -p /src/storage/app/public/images/main/ && \ mkdir -p /src/storage/app/public/images/shop/ && \ + mkdir -p /src/storage/app/public/images/avatars/ && \ mkdir -p /src/storage/app/public/attachments/help/" folder-structure-dev: @@ -232,6 +233,7 @@ folder-structure-dev: mkdir -p /src/storage/app/public/images/venues/ && \ mkdir -p /src/storage/app/public/images/main/ && \ mkdir -p /src/storage/app/public/images/shop/ && \ + mkdir -p /src/storage/app/public/images/avatars/ && \ mkdir -p /src/storage/app/public/attachments/help/" # Create SSL Keypair for Development @@ -426,6 +428,7 @@ purge-files: touch /src/public/css/images/.gitkeep; \ rm -rf /src/storage/app/public/images/gallery ; \ rm -rf /src/storage/app/public/images/events ; \ + rm -rf /src/storage/app/public/images/avatars ; \ rm -rf /src/storage/app/public/images/venues ; \ rm -rf /src/storage/app/public/images/main ; \ rm -rf /src/storage/user/scss/*.css ; \ From f48257da0a52c73a47607db9d6ae136fdf1499c4 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 13 Nov 2024 22:11:24 +0100 Subject: [PATCH 59/59] finalized local_avatar feature --- .../Http/Controllers/AccountController.php | 48 +- .../Controllers/Admin/UsersController.php | 31 +- .../Http/Controllers/Auth/AuthController.php | 7 +- .../Http/Controllers/Auth/SteamController.php | 10 +- src/app/Http/routes.php | 3 +- src/app/User.php | 21 +- ...25_rename_avatar_column_on_users_table.php | 31 + ...185059_add_local_avatar_to_users_table.php | 28 + ...500_add_selected_avatar_to_users_table.php | 29 + src/lang/de/accounts.php | 5 + src/lang/en/accounts.php | 6 + .../assets/images/default_avatar.png | Bin 0 -> 5429 bytes src/resources/views/accounts/index.blade.php | 1053 +++++++++-------- .../views/accounts/removesso.blade.php | 281 ++--- src/resources/views/auth/register.blade.php | 2 +- 15 files changed, 877 insertions(+), 678 deletions(-) create mode 100644 src/database/migrations/2024_11_13_184725_rename_avatar_column_on_users_table.php create mode 100644 src/database/migrations/2024_11_13_185059_add_local_avatar_to_users_table.php create mode 100644 src/database/migrations/2024_11_13_185500_add_selected_avatar_to_users_table.php create mode 100644 src/resources/assets/images/default_avatar.png diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index 6a2c3fc0..bba27d05 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -239,7 +239,13 @@ public function removeSso(Request $request, $method) case 'steam': $user->steamname = ""; $user->steamid = ""; - $user->avatar = ""; + $user->steam_avatar = ""; + + if ($user->selected_avatar == 'steam') + { + $user->selected_avatar = 'local'; + } + break; default: return Redirect::back()->withError('no valid sso method selected'); @@ -352,18 +358,46 @@ public function updateMail(Request $request) return redirect('/'); } - public function update_avatar(Request $request) { + public function update_local_avatar(Request $request) { $this->validate($request, [ 'avatar' => 'required|image|mimes:jpg,png,jpeg,gif,svg|max:2048', ]); - $path = Storage::putFile( + if(!$path = Storage::putFile( 'public/images/avatars', $request->file('avatar') - ); + )) + { + Session::flash('alert-danger', 'Oops,Something went wrong while uploading the File on the custom avatar upload.'); + return Redirect::back(); + } $user = Auth::user(); - $user->avatar = '/storage/images/avatars/' . basename($path); - $user->save(); + $user->local_avatar = '/storage/images/avatars/' . basename($path); + $user->selected_avatar = 'local'; + if (!$user->save()) { + Session::flash('alert-danger', 'Oops, Something went wrong while updating the user on the custom avatar upload.'); + return Redirect::back(); + } - return Redirect::back()->withSuccess('Account successfully updated!'); + Session::flash('alert-success', 'Custom avatar successfully updated!'); + return Redirect::back(); } + + public function update_selected_avatar(Request $request) { + + $this->validate($request, [ + 'selected_avatar' => 'required|in:steam,local', + ]); + + $user = Auth::user(); + $user->selected_avatar = $request->selected_avatar; + if (!$user->save()) { + Session::flash('alert-danger', 'Oops, Something went wrong while updating the user on the selected avatar change.'); + return Redirect::back(); + } + + Session::flash('alert-success', 'Selected avatar successfully updated!'); + return Redirect::back(); + } + + } diff --git a/src/app/Http/Controllers/Admin/UsersController.php b/src/app/Http/Controllers/Admin/UsersController.php index 0e8567a8..f4023ba9 100644 --- a/src/app/Http/Controllers/Admin/UsersController.php +++ b/src/app/Http/Controllers/Admin/UsersController.php @@ -27,20 +27,20 @@ class UsersController extends Controller */ public function index(Request $request) { - if ($request->searchquery != "") - { + if ($request->searchquery != "") { return view('admin.users.index') - ->withUser(Auth::user()) - ->withUsers(User::where('username', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('firstname', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('surname', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('username_nice', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('steamname', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('email', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('phonenumber', 'LIKE', '%'.$request->searchquery.'%') - ->paginate(20)->appends(['searchquery' => $request->searchquery]) - - ); + ->withUser(Auth::user()) + ->withUsers( + User::where('username', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('firstname', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('surname', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('username_nice', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('steamname', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('email', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('phonenumber', 'LIKE', '%' . $request->searchquery . '%') + ->paginate(20)->appends(['searchquery' => $request->searchquery]) + + ); } return view('admin.users.index') @@ -154,7 +154,10 @@ public function unauthorizeThirdparty(User $user, String $method) case 'steam': $user->steamname = null; $user->steamid = null; - $user->avatar = null; + $user->steam_avatar = null; + if ($user->selected_avatar == 'steam') { + $user->selected_avatar = 'local'; + } break; default: Session::flash('alert-danger', 'Cannot remove thirdparty authentication, no method selected!!'); diff --git a/src/app/Http/Controllers/Auth/AuthController.php b/src/app/Http/Controllers/Auth/AuthController.php index f61a1099..caae0fa6 100644 --- a/src/app/Http/Controllers/Auth/AuthController.php +++ b/src/app/Http/Controllers/Auth/AuthController.php @@ -103,7 +103,7 @@ public function showRegister($method) if ( is_null($user['steamid']) || - is_null($user['avatar']) || + is_null($user['steam_avatar']) || is_null($user['steamname']) ) { return redirect('/'); // redirect to site @@ -152,7 +152,8 @@ public function register($method, Request $request, User $user) $this->validate($request, $validationRules); - $user->avatar = $request->avatar; + $user->steam_avatar = $request->avatar; + $user->selected_avatar = 'steam'; $user->steamid = $request->steamid; $user->steamname = $request->steamname; @@ -197,6 +198,7 @@ public function register($method, Request $request, User $user) $this->validate($request, $rules, $messages); $user->email = $request->email; $user->password = Hash::make($request->password1); + $user->selected_avatar = 'local'; break; } @@ -206,6 +208,7 @@ public function register($method, Request $request, User $user) $user->username_nice = strtolower(str_replace(' ', '-', $request->username)); $user->locale = Settings::getSiteLocale(); + if (!$user->save()) { Auth::logout(); return Redirect('/')->withError('Something went wrong. Please Try again later'); diff --git a/src/app/Http/Controllers/Auth/SteamController.php b/src/app/Http/Controllers/Auth/SteamController.php index 7b5e9aa1..a4c4e042 100644 --- a/src/app/Http/Controllers/Auth/SteamController.php +++ b/src/app/Http/Controllers/Auth/SteamController.php @@ -53,8 +53,8 @@ public function login(Request $request) if ($info->personaname != $user->steamname) { $user->steamname = $info->personaname; } - if ($info->avatarfull != $user->avatar) { - $user->avatar = $info->avatarfull; + if ($info->avatarfull != $user->steam_avatar) { + $user->steam_avatar = $info->avatarfull; } $user->last_login = Carbon::now()->toDateTimeString(); $user->save(); @@ -78,7 +78,7 @@ public function login(Request $request) if (!Auth::user()) { $user = [ 'steamname' => $info->personaname, - 'avatar' => $info->avatarfull, + 'steam_avatar' => $info->avatarfull, 'steamid' => $info->steamID64, ]; Session::put('user', $user); @@ -121,7 +121,9 @@ private function addtoexistingaccount($info, User $user) } $user->steamname = $info->personaname; - $user->avatar = $info->avatarfull; + $user->steam_avatar = $info->avatarfull; + $user->selected_avatar = 'steam'; + $user->steamid = $info->steamID64; if ($user->save()) { Session::flash('alert-success', "Successfully added steam account!"); diff --git a/src/app/Http/routes.php b/src/app/Http/routes.php index 675b42b7..d9ce1567 100644 --- a/src/app/Http/routes.php +++ b/src/app/Http/routes.php @@ -120,7 +120,8 @@ Route::delete('/account/tokens/remove/{token}', 'AccountController@removeToken'); Route::post('/account', 'AccountController@update'); Route::post('/account/delete', 'Auth\SteamController@destroy'); - Route::post('/account/avatar', 'AccountController@update_avatar'); + Route::post('/account/avatar/selected', 'AccountController@update_selected_avatar'); + Route::post('/account/avatar', 'AccountController@update_local_avatar'); }); Route::group(['middleware' => ['auth', 'banned']], function () { diff --git a/src/app/User.php b/src/app/User.php index ae87470d..740cb0a2 100644 --- a/src/app/User.php +++ b/src/app/User.php @@ -37,7 +37,8 @@ class User extends Authenticatable implements MustVerifyEmail 'username_nice', 'steamname', 'username', - 'avatar', + 'steam_avatar', + 'local_avatar', 'steamid', 'last_login', 'email_verified_at', @@ -61,7 +62,8 @@ class User extends Authenticatable implements MustVerifyEmail */ protected $appends = [ 'unique_attended_event_count', - 'win_count' + 'win_count', + 'avatar' ]; public static function boot() @@ -366,6 +368,21 @@ protected function winCount(): Attribute ); } + /** + * Get the user's avatar. + */ + protected function avatar(): Attribute + { + $default_avatar = "storage/images/main/default_avatar.png"; + return Attribute::make( + get: fn () => match ($this->selected_avatar) { + 'steam' => !empty($this->steam_avatar) ? $this->steam_avatar : asset($default_avatar), + 'local' => !empty($this->local_avatar) ? asset($this->local_avatar) : asset($default_avatar), + default => asset($default_avatar), + } + ); + } + /** * Calculate the user's win count. * diff --git a/src/database/migrations/2024_11_13_184725_rename_avatar_column_on_users_table.php b/src/database/migrations/2024_11_13_184725_rename_avatar_column_on_users_table.php new file mode 100644 index 00000000..9d503c89 --- /dev/null +++ b/src/database/migrations/2024_11_13_184725_rename_avatar_column_on_users_table.php @@ -0,0 +1,31 @@ +renameColumn('avatar', 'steam_avatar'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->renameColumn('steam_avatar', 'avatar'); + }); + } +}; diff --git a/src/database/migrations/2024_11_13_185059_add_local_avatar_to_users_table.php b/src/database/migrations/2024_11_13_185059_add_local_avatar_to_users_table.php new file mode 100644 index 00000000..30d8c10d --- /dev/null +++ b/src/database/migrations/2024_11_13_185059_add_local_avatar_to_users_table.php @@ -0,0 +1,28 @@ +string('local_avatar')->after('password')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('local_avatar'); + }); + } +}; diff --git a/src/database/migrations/2024_11_13_185500_add_selected_avatar_to_users_table.php b/src/database/migrations/2024_11_13_185500_add_selected_avatar_to_users_table.php new file mode 100644 index 00000000..f2d3cf84 --- /dev/null +++ b/src/database/migrations/2024_11_13_185500_add_selected_avatar_to_users_table.php @@ -0,0 +1,29 @@ +enum('selected_avatar', array('local','steam'))->after('password')->default('steam'); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('selected_avatar'); + }); + } +}; diff --git a/src/lang/de/accounts.php b/src/lang/de/accounts.php index 4b2130b8..51569bf3 100644 --- a/src/lang/de/accounts.php +++ b/src/lang/de/accounts.php @@ -27,6 +27,7 @@ 'credit_item' => 'Artikel', 'credit_reason' => 'Grund', 'credit_timestamp' => 'Zeitpunkt', + 'credit' => 'Credit', 'tickets' => 'Tickets', 'no_tickets' => 'Du hast im Moment keine Tickets.', 'purchases' => 'Käufe', @@ -93,4 +94,8 @@ 'new_token_wizzard_creation_failed' => 'Das Erstellen des Tokens ist fehlgeschlagen. Bitte versuche es noch einmal.', 'new_token_wizzard_clickoncallback' => 'Du kannst auf Zurück verbinden klicken oder den Token manuell kopieren.', 'locale' => 'Sprache', + 'avatarsettings' => 'Avatar Einstellungen', + 'avatardescription' => 'Du kannst deinen Steam Avatar verwenden (wenn dein Steam Account gekoppelt ist) oder einen eigenen Avatar hochladen', + 'avatarsteam' => 'Benutze Steam Avatar', + 'avatarlocal' => 'Benutze Eigenen Avatar', ]; diff --git a/src/lang/en/accounts.php b/src/lang/en/accounts.php index 86ba52c6..304afb2e 100644 --- a/src/lang/en/accounts.php +++ b/src/lang/en/accounts.php @@ -27,6 +27,7 @@ 'credit_item' => 'Item', 'credit_reason' => 'Reason', 'credit_timestamp' => 'Timestamp', + 'credit' => 'Credit', 'tickets' => 'Tickets', 'no_tickets' => 'You currently have no tickets.', 'purchases' => 'Purchases', @@ -93,4 +94,9 @@ 'new_token_wizzard_creation_failed' => 'Creation of the token failed. Please try again.', 'new_token_wizzard_clickoncallback' => 'You can now click on the connect back button or you can copy the token manually to your application.', 'locale' => 'Language', + 'avatarsettings' => 'Avatar Settings', + 'avatardescription' => 'You can use your Steam Avatar or upload a custom one.', + 'avatarsteam' => 'Use Steam Avatar', + 'avatarlocal' => 'Upload a Custom Avatar', + ]; diff --git a/src/resources/assets/images/default_avatar.png b/src/resources/assets/images/default_avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..04193bc5775f4e89e5e7d0bb6bd292d42c40e1eb GIT binary patch literal 5429 zcmeHKeN+=y7N77fXK7=ryR6n@Ox6}ElgtbW$;8Bhfk==b0xIY^i<6lNjONQ^AVI~Y z6j3XsE!4F|dJe0!bPH8&Je!NdbG6l zKa%tE?%a3Z@4oxH_g$Dh*;y-MqUS{;2ohsSPt8FPi2_D*R0L?Y?lW0oI?v`?>=w(@ zNEAGPr6dfIfTVyQNlGS3r&n+6a4aNeB`H zb0Z7_gxo^!Y4}nQjuTo?k3pKFyx?WoW#)x{rA-*b0m zG-@;GhCc4t_F{*>;(Qx%_G=5$;5zVHUQW+H)^(p)S0xR{s{YWEKxfrm7+z5LpQzz~ zE6@Gz+uji};$mfYMMZk!#%k_yx3t%BIpT}*8&ONnJbjzIU1j;%FLn$Zzj1s17j@^g?%=V^ddO7rv%1zVK98oA>ICwl#xo<*V*|=t(Io_*{Q>b#wdf z#p%-DG}T7G-9Ecz%~RdWtG}sVcIU0Z{ioh|sWrr08-B4VrF7)_uZBA|wCXfpE#6t5 zd~5IDx7SF@JCa*J(_Q%+l=gp_SdZG5GOG6^wdv@<&?VC3x`A*phHAx?4WH!+ha z^d~Ca-XaxFlB5bFR0M&71?nqv@l*hH`4j@gC`KylqrIGm=iDxtfJxchCA?8ChjrQ5 z`J5iBbsXO13$g%wr~;Hng)1?Y)2W)g!^fwU0!Z*c_uS#jEAz0b9Mkz|XXcg;VonYz%ulN*~!i5{(Ay81nIX&VoAbW}>&)Fx)nsPQ_MGR;1 zL16nh?iA~>*hOQovRd`2Zn{J`o+Z^N7yRoPH_b76QB-R*No1l{gW3oig{m=@LCGYH zMM*o&=+rh+tya^Mpe!yQPq}DTfC6wO2RJyBh+~)4vNnm0jk8`rQJSDJ+YYCFX z2tuPFby%WCJz=z#_4=R^1x&GZiYr1|^biaXO9^!f0HPjZ(VM(1#k;+EZnwiIA8)$j z%T~Bf48>Ea6wder*l5=UnZ(XZ&WV3 zW%OzE(ZPvVNhT97g`T2EL-0|hEF+#1utt~YV#-y-LiY%k>zJOqM=98JcAJjHDO5wT z8dQxl6sjW$ElOh=JFCT6RtL>yiesPK&ig4Zn^FWk0#{I;;vXnkoS3Nisn-5tR>%Sn zhT<4XBn1h>H9^8u!GKjl&lro?p!z>f45GoLCIkCMbqnz2dg678b-{l@et22>@4hel;YBOL zwsJ)(a##2^z28y~npvLo0w01r@}V#!bK^29KpDwftZ9*7M$bcHA6@PH`4t2S>$9Y$ zpV$pLM zYwMnvU%7D8#l^OP%+T+~!L$w*+wf`FN2}{!y!gk0gZ^7jN);!LJ8QigBN{o##_rh_ zu@YOD%nZ}+*)sEeR1a8w0LTbu#blbnl18Jc=hE7tGdr%vEHZza6MxC-E!snF>#^4r znV=Nzk^b*j3X>Di - - @if(session()->has('message')) -
    - {{ session()->get('message') }} -
    - @endif -
    -

    - @lang('accounts.my_account') -

    -
    - @if (session('newtoken')) -
    - @lang('accounts.new_token') -
    -
    - {{ session('newtoken') }} -
    - @endif -
    - -
    -
    -
    -

    @lang('accounts.account_details')

    -
    -
    - {{ Form::open(array('url'=>'/account/' )) }} -
    -
    -
    -
    -
    - {{ Form::label('firstname',__('accounts.firstname'),array('id'=>'','class'=>'')) }} - -
    -
    -
    -
    - {{ Form::label('surname',__('accounts.surname'),array('id'=>'','class'=>'')) }} - -
    -
    -
    -
    - {{ Form::label('Username',__('accounts.username'),array('id'=>'','class'=>'')) }} - {{ Form::text('name', $user->username, array('id'=>'name', 'class'=>'form-control', 'disabled' => 'disabled')) }} -
    - @if ($user->steamid && $user->steamname) -
    - {{ Form::label('steamname',__('accounts.steamname'),array('id'=>'','class'=>'')) }} - {{ Form::text('steamname', $user->steamname, array('id'=>'steamname', 'class'=>'form-control', 'disabled'=>'true')) }} -
    - @endif - @if ($user->password) -
    - - - @error('password1') - - {{ $message }} - - @enderror -
    -
    - - - @error('password2') - - {{ $message }} - - @enderror -
    - @if(Settings::isUserLocaleEnabled()) -
    -
    - {{ Form::label('locale', __('accounts.locale'), ['class' => '']) }} - - - @error('locale') -
    {{ $message }}
    - @enderror -
    -
    - @endif - - - @endif - -
    -
    - {{ Form::close() }} -
    -
    - -
    -
    -

    @lang('accounts.contactdetails')

    -
    -
    - {{ Form::open(array('url'=>'/account/email' )) }} -
    -
    - -
    -
    -
    - {{ Form::label('email',__('accounts.email'),array('id'=>'','class'=>'')) }} - - @error('email') - - {{ $message }} - - @enderror -
    - - @if (Settings::isAuthRequirePhonenumberEnabled()) -
    - {{ Form::label('phonenumber',__('accounts.phonenumber'),array('id'=>'','class'=>'')) }} - - @error('phonenumber') - - {{ $message }} - - @enderror -
    - @endif - - @if (!$user->email || Settings::isAuthAllowEmailChangeEnabled() || Settings::isAuthRequirePhonenumberEnabled()) - - @endif -
    -
    - {{ Form::close() }} -
    -
    - - -
    -
    -

    Avatar Settings

    -
    -
    -

    You can use your Steam Avatar or upload a custom one.

    - {{ Form::open(array('url'=>'/account/avatar', 'files' => 'true')) }} -
    - - - - - -
    -
    -
    - - @if ($user->avatar) - {{ $user->username }}'s Avatar - @else - - {{ $user->username }}'s Avatar - @endif - -
    - {{ Form::label('custom_image', 'Select Images', array('id' => '', 'class' => '')) }} - {{ Form::file('avatar', array('id' => 'avatar', 'class' => 'form-control')) }} -
    - - - -
    -
    - {{ Form::close() }} -
    -
    - - - @if ($creditLogs) -
    -
    -

    Credit - {{ $user->credit_total }}

    -
    -
    - - - - - - - - - - - - @foreach ($creditLogs->reverse() as $creditLog) - - - - - - - - @endforeach - -
    @lang('accounts.credit_action')@lang('accounts.credit_amount')@lang('accounts.credit_item')@lang('accounts.credit_reason')@lang('accounts.credit_timestamp')
    {{ $creditLog->action }}{{ $creditLog->amount }} - @if (strtolower($creditLog->action) == 'buy') - @if (!$creditLog->purchase->participants->isEmpty()) - @foreach ($creditLog->purchase->participants as $participant) - {{ $participant->event->display_name }} - {{ $participant->ticket->name }} - @if (!$loop->last) -
    - @endif - @endforeach - @elseif ($creditLog->purchase->order != null) - @foreach ($creditLog->purchase->order->items as $item) - @if ($item->item) - {{ $item->item->name }} - @endif - - x {{ $item->quantity }} -
    - @if ($item->price != null) - {{ Settings::getCurrencySymbol() }}{{ $item->price * $item->quantity }} - @if ($item->price_credit != null && Settings::isCreditEnabled()) - / - @endif - @endif - @if ($item->price_credit != null && Settings::isCreditEnabled()) - {{ $item->price_credit * $item->quantity }} Credits - @endif - @if (!$loop->last) -
    - @endif - @endforeach - @endif - @endif -
    {{ $creditLog->reason }} - {{ $creditLog->updated_at }} -
    - {{ $creditLogs->links() }} -
    -
    - @endif -
    - - - -
    -
    -
    -

    @lang('accounts.tickets')

    -
    -
    - @if (count($eventParticipants)) - @foreach ($eventParticipants as $participant) - @include ('layouts._partials._tickets.index') - @endforeach - @else - @lang('accounts.no_tickets') - @endif -
    -
    -
    - - -
    -
    -
    -

    @lang('accounts.purchases')

    -
    -
    - @if (count($user->purchases)) - - - - - - - - - - - @foreach ($purchases as $purchase) - - - - - - - @endforeach - -
    - @lang('accounts.purchases_id') - - @lang('accounts.purchases_method') - - @lang('accounts.purchases_time') - - @lang('accounts.purchases_basket') -
    - {{ $purchase->id }} - - {{ $purchase->getPurchaseType() }} - - {{ date('d-m-y H:i', strtotime($purchase->created_at)) }} - - @if (!$purchase->participants->isEmpty()) - @foreach ($purchase->participants as $participant) - @if ($participant->free) - {{ $participant->event->display_name }} - Freebie - @elseif($participant->staff) - {{ $participant->event->display_name }} - Staff - @else - {{ $participant->event->display_name }} - {{ $participant->ticket->name }} - @endif - @if (!$loop->last) -
    - @endif - @endforeach - @elseif ($purchase->order != null) - @foreach ($purchase->order->items as $item) - @if ($item->item) - {{ $item->item->name }} - @endif - - x {{ $item->quantity }} -
    - @if ($item->price != null) - {{ Settings::getCurrencySymbol() }}{{ $item->price * $item->quantity }} - @if ($item->price_credit != null && Settings::isCreditEnabled()) - / - @endif - @endif - @if ($item->price_credit != null && Settings::isCreditEnabled()) - {{ $item->price_credit * $item->quantity }} Credits - @endif - @if (!$loop->last) -
    - @endif - @endforeach - @endif -
    - {{ $purchases->links() }} - @else - @lang('accounts.no_purchases') - @endif - @if (Settings::isShopEnabled()) - - - - @endif -
    -
    -
    - - -
    -
    -
    -

    @lang('accounts.tokens')

    -
    -
    - @if (count($user->tokens)) - - - - - - - - - - - - - - @foreach ($user->tokens as $token) - - - - - - - - @endforeach - -
    - @lang('accounts.token_id') - - @lang('accounts.token_name') - - @lang('accounts.token_lastuse_date') - - @lang('accounts.token_creation_date') - -
    - {{ $token->id }} - - {{ $token->name }} - - @if ($token->last_used_at) - {{ date('d-m-y H:i', strtotime($token->last_used_at)) }} - @else - @lang('accounts.token_never_used') - @endif - - {{ date('d-m-y H:i', strtotime($token->created_at)) }} - - {{ Form::open(array('url'=>'/account/tokens/remove/' . $token->id, 'onsubmit' => 'return ConfirmDeleteToken()')) }} - {{ Form::hidden('_method', 'DELETE') }} - - {{ Form::close() }} -
    - - - - - @else - @lang('accounts.no_tokens') - @endif - - {{-- {{ Form::open(array('url'=>'/account/tokens/add' )) }} +@section('page_title', __('accounts.accounts_title')) + +@section('content') + +
    + + @if (session()->has('message')) +
    + {{ session()->get('message') }} +
    + @endif +
    +

    + @lang('accounts.my_account') +

    +
    + @if (session('newtoken')) +
    + @lang('accounts.new_token') +
    +
    + {{ session('newtoken') }} +
    + @endif +
    + +
    +
    +
    +

    @lang('accounts.account_details')

    +
    +
    + {{ Form::open(['url' => '/account/']) }} +
    +
    +
    +
    +
    + {{ Form::label('firstname', __('accounts.firstname'), ['id' => '', 'class' => '']) }} + +
    +
    +
    +
    + {{ Form::label('surname', __('accounts.surname'), ['id' => '', 'class' => '']) }} + +
    +
    +
    +
    + {{ Form::label('Username', __('accounts.username'), ['id' => '', 'class' => '']) }} + {{ Form::text('name', $user->username, ['id' => 'name', 'class' => 'form-control', 'disabled' => 'disabled']) }} +
    + @if ($user->steamid && $user->steamname) +
    + {{ Form::label('steamname', __('accounts.steamname'), ['id' => '', 'class' => '']) }} + {{ Form::text('steamname', $user->steamname, ['id' => 'steamname', 'class' => 'form-control', 'disabled' => 'true']) }} +
    + @endif + @if ($user->password) +
    + + + @error('password1') + + {{ $message }} + + @enderror +
    +
    + + + @error('password2') + + {{ $message }} + + @enderror +
    + @if (Settings::isUserLocaleEnabled()) +
    +
    + {{ Form::label('locale', __('accounts.locale'), ['class' => '']) }} + + + @error('locale') +
    {{ $message }}
    + @enderror +
    +
    + @endif + + + @endif + +
    +
    + {{ Form::close() }} +
    +
    + +
    +
    +

    @lang('accounts.contactdetails')

    +
    +
    + {{ Form::open(['url' => '/account/email']) }} +
    +
    + +
    +
    +
    + {{ Form::label('email', __('accounts.email'), ['id' => '', 'class' => '']) }} + + @error('email') + + {{ $message }} + + @enderror +
    + + @if (Settings::isAuthRequirePhonenumberEnabled()) +
    + {{ Form::label('phonenumber', __('accounts.phonenumber'), ['id' => '', 'class' => '']) }} + + @error('phonenumber') + + {{ $message }} + + @enderror +
    + @endif + + @if (!$user->email || Settings::isAuthAllowEmailChangeEnabled() || Settings::isAuthRequirePhonenumberEnabled()) + + @endif +
    +
    + {{ Form::close() }} +
    +
    + + +
    +
    +

    @lang('accounts.avatarsettings')

    +
    +
    +

    @lang('accounts.avatardescription')

    +
    + {{ Form::open(['url' => '/account/avatar/selected']) }} + @if ($user->steamid && $user->steamname) + + + @endif + + + {{ Form::close() }} +
    +
    +
    + + {{ $user->username }}'s Avatar + {{ Form::open(['url' => '/account/avatar', 'files' => 'true']) }} + + +
    + {{ Form::label('custom_image', 'Select Images', ['id' => '', 'class' => '']) }} + {{ Form::file('avatar', ['id' => 'avatar', 'class' => 'form-control']) }} +
    + + + +
    +
    + {{ Form::close() }} +
    +
    + + + @if ($creditLogs) +
    +
    +

    @lang('accounts.credit') - {{ $user->credit_total }}

    +
    +
    + + + + + + + + + + + + @foreach ($creditLogs->reverse() as $creditLog) + + + + + + + + @endforeach + +
    @lang('accounts.credit_action')@lang('accounts.credit_amount')@lang('accounts.credit_item')@lang('accounts.credit_reason')@lang('accounts.credit_timestamp')
    {{ $creditLog->action }}{{ $creditLog->amount }} + @if (strtolower($creditLog->action) == 'buy') + @if (!$creditLog->purchase->participants->isEmpty()) + @foreach ($creditLog->purchase->participants as $participant) + {{ $participant->event->display_name }} - + {{ $participant->ticket->name }} + @if (!$loop->last) +
    + @endif + @endforeach + @elseif ($creditLog->purchase->order != null) + @foreach ($creditLog->purchase->order->items as $item) + @if ($item->item) + {{ $item->item->name }} + @endif + - x {{ $item->quantity }} +
    + @if ($item->price != null) + {{ Settings::getCurrencySymbol() }}{{ $item->price * $item->quantity }} + @if ($item->price_credit != null && Settings::isCreditEnabled()) + / + @endif + @endif + @if ($item->price_credit != null && Settings::isCreditEnabled()) + {{ $item->price_credit * $item->quantity }} Credits + @endif + @if (!$loop->last) +
    + @endif + @endforeach + @endif + @endif +
    {{ $creditLog->reason }} + {{ $creditLog->updated_at }} +
    + {{ $creditLogs->links() }} +
    +
    + @endif +
    + + + +
    +
    +
    +

    @lang('accounts.tickets')

    +
    +
    + @if (count($eventParticipants)) + @foreach ($eventParticipants as $participant) + @include ('layouts._partials._tickets.index') + @endforeach + @else + @lang('accounts.no_tickets') + @endif +
    +
    +
    + + +
    +
    +
    +

    @lang('accounts.purchases')

    +
    +
    + @if (count($user->purchases)) + + + + + + + + + + + @foreach ($purchases as $purchase) + + + + + + + @endforeach + +
    + @lang('accounts.purchases_id') + + @lang('accounts.purchases_method') + + @lang('accounts.purchases_time') + + @lang('accounts.purchases_basket') +
    + {{ $purchase->id }} + + {{ $purchase->getPurchaseType() }} + + {{ date('d-m-y H:i', strtotime($purchase->created_at)) }} + + @if (!$purchase->participants->isEmpty()) + @foreach ($purchase->participants as $participant) + @if ($participant->free) + {{ $participant->event->display_name }} - Freebie + @elseif($participant->staff) + {{ $participant->event->display_name }} - Staff + @else + {{ $participant->event->display_name }} - + {{ $participant->ticket->name }} + @endif + @if (!$loop->last) +
    + @endif + @endforeach + @elseif ($purchase->order != null) + @foreach ($purchase->order->items as $item) + @if ($item->item) + {{ $item->item->name }} + @endif + - x {{ $item->quantity }} +
    + @if ($item->price != null) + {{ Settings::getCurrencySymbol() }}{{ $item->price * $item->quantity }} + @if ($item->price_credit != null && Settings::isCreditEnabled()) + / + @endif + @endif + @if ($item->price_credit != null && Settings::isCreditEnabled()) + {{ $item->price_credit * $item->quantity }} Credits + @endif + @if (!$loop->last) +
    + @endif + @endforeach + @endif +
    + {{ $purchases->links() }} + @else + @lang('accounts.no_purchases') + @endif + @if (Settings::isShopEnabled()) + + + + @endif +
    +
    +
    + + +
    +
    +
    +

    @lang('accounts.tokens')

    +
    +
    + @if (count($user->tokens)) + + + + + + + + + + + + + + @foreach ($user->tokens as $token) + + + + + + + + @endforeach + +
    + @lang('accounts.token_id') + + @lang('accounts.token_name') + + @lang('accounts.token_lastuse_date') + + @lang('accounts.token_creation_date') + +
    + {{ $token->id }} + + {{ $token->name }} + + @if ($token->last_used_at) + {{ date('d-m-y H:i', strtotime($token->last_used_at)) }} + @else + @lang('accounts.token_never_used') + @endif + + {{ date('d-m-y H:i', strtotime($token->created_at)) }} + + {{ Form::open(['url' => '/account/tokens/remove/' . $token->id, 'onsubmit' => 'return ConfirmDeleteToken()']) }} + {{ Form::hidden('_method', 'DELETE') }} + + {{ Form::close() }} +
    + @else + @lang('accounts.no_tokens') + @endif + + {{-- {{ Form::open(array('url'=>'/account/tokens/add' )) }}
    @@ -447,87 +463,96 @@
    {{ Form::close() }} --}} -
    -
    -
    - - -
    -
    -
    -

    @lang('accounts.single_sign_on')

    -
    -
    - - @if (in_array("steam", Settings::getLoginMethods())) - - @if (!$user->steamid && !$user->steamname) - @lang('accounts.add_steam_account') - @else - @lang('accounts.remove_steam_account') - @endif - - @endif - - - - -
    -
    -
    - - -
    -
    -
    -

    @lang('accounts.danger_zone')

    -
    -
    - -
    -
    -
    -
    - @include ('layouts._partials._gifts.modal') -
    - - - - - - -@endsection \ No newline at end of file +
    +
    +
    + + +
    +
    +
    +

    @lang('accounts.single_sign_on')

    +
    +
    + + @if (in_array('steam', Settings::getLoginMethods())) + + @if (!$user->steamid && !$user->steamname) + @lang('accounts.add_steam_account') + @else + @lang('accounts.remove_steam_account') + @endif + + @endif + + + + +
    +
    +
    + + +
    +
    +
    +

    @lang('accounts.danger_zone')

    +
    +
    + +
    +
    +
    +
    + @include ('layouts._partials._gifts.modal') +
    + + + + + + +@endsection diff --git a/src/resources/views/accounts/removesso.blade.php b/src/resources/views/accounts/removesso.blade.php index 1e625b89..d7a66610 100644 --- a/src/resources/views/accounts/removesso.blade.php +++ b/src/resources/views/accounts/removesso.blade.php @@ -1,135 +1,150 @@ @extends ('layouts.default') -@section ('page_title', __('accounts.accounts_title')) - -@section ('content') - -
    - -
    - -
    - -
    -
    -

    @lang('accounts.removesso'): {{ $method }}

    -
    -
    - {{ Form::open(array('url'=>"/account/sso/remove/$method/" )) }} -
    -
    - @lang('accounts.removessowarning') -
    -
    -
    -
    - - - @if ($user->email && $user->email != "") - - @else - - @endif - - - - @if ($user->password && $user->password != "") - - @else - - @endif -
    @lang('accounts.email')@lang('accounts.setted')@lang('accounts.notsetted')
    @lang('accounts.password')@lang('accounts.setted')@lang('accounts.notsetted')
    -
    -
    -
    -
    - @if ($user->email && $user->email != "") - @if(Settings::isAuthAllowEmailChangeEnabled()) -

    @lang('accounts.ssochangeemailmessage')

    - @else -

    @lang('accounts.ssodontemailmessage')

    - @endif - @else -

    @lang('accounts.ssoemailmessage')

    - @endif - -
    -
    - - @if ($user->email) -
    - {{ Form::label('email',__('accounts.email'),array('id'=>'','class'=>'')) }} - @if(Settings::isAuthAllowEmailChangeEnabled()) - - @else - - - @endif - - @error('email') - - {{ $message }} - - @enderror -
    - @else -
    - {{ Form::label('email',__('accounts.email'),array('id'=>'','class'=>'')) }} - - @error('email') - - {{ $message }} - - @enderror -
    - - @endif -
    - -
    - @if ($user->password && $user->password != "") -

    @lang('accounts.ssochangpasswordmessage')

    - @else -

    @lang('accounts.ssopasswordmessage')

    - @endif - -
    -
    -
    - -
    - - - @error('password1') - - {{ $message }} - - @enderror -
    -
    - - - @error('password2') - - {{ $message }} - - @enderror -
    -
    -
    - - - - - - - -
    - {{ Form::close() }} -
    -
    -
    -
    - - -@endsection \ No newline at end of file +@section('page_title', __('accounts.accounts_title')) + +@section('content') + +
    + +
    + +
    + +
    +
    +

    @lang('accounts.removesso'): {{ $method }}

    +
    +
    + {{ Form::open(['url' => "/account/sso/remove/$method/"]) }} +
    +
    + @lang('accounts.removessowarning') +
    +
    +
    +
    + + + + @if ($user->email && $user->email != '') + + @else + + @endif + + + + + @if ($user->password && $user->password != '') + + @else + + @endif +
    @lang('accounts.email')@lang('accounts.setted')@lang('accounts.notsetted')
    @lang('accounts.password')@lang('accounts.setted')@lang('accounts.notsetted')
    +
    +
    +
    +
    + @if ($user->email && $user->email != '') + @if (Settings::isAuthAllowEmailChangeEnabled()) +

    @lang('accounts.ssochangeemailmessage')

    + @else +

    @lang('accounts.ssodontemailmessage')

    + @endif + @else +

    @lang('accounts.ssoemailmessage')

    + @endif + +
    +
    + + @if ($user->email) +
    + {{ Form::label('email', __('accounts.email'), ['id' => '', 'class' => '']) }} + @if (Settings::isAuthAllowEmailChangeEnabled()) + + @else + + + @endif + + @error('email') + + {{ $message }} + + @enderror +
    + @else +
    + {{ Form::label('email', __('accounts.email'), ['id' => '', 'class' => '']) }} + + @error('email') + + {{ $message }} + + @enderror +
    + + @endif +
    + +
    + @if ($user->password && $user->password != '') +

    @lang('accounts.ssochangpasswordmessage')

    + @else +

    @lang('accounts.ssopasswordmessage')

    + @endif + +
    +
    +
    + +
    + + + @error('password1') + + {{ $message }} + + @enderror +
    +
    + + + @error('password2') + + {{ $message }} + + @enderror +
    +
    +
    + + + + + + + +
    + {{ Form::close() }} +
    +
    +
    +
    +
    + + +@endsection diff --git a/src/resources/views/auth/register.blade.php b/src/resources/views/auth/register.blade.php index dcd33d7d..e1d6858c 100644 --- a/src/resources/views/auth/register.blade.php +++ b/src/resources/views/auth/register.blade.php @@ -12,7 +12,7 @@ {{ Form::open(array('url'=>'/register/' . $loginMethod )) }} {{ Form::hidden('method', $loginMethod, array('id'=>'method','class'=>'form-control')) }} @if ($loginMethod == "steam") - {{ Form::hidden('avatar', $avatar, array('id'=>'avatar','class'=>'form-control')) }} + {{ Form::hidden('avatar', $steam_avatar, array('id'=>'avatar','class'=>'form-control')) }} {{ Form::hidden('steamid', $steamid, array('id'=>'steamid','class'=>'form-control')) }} {{ Form::hidden('steamname', $steamname, array('id'=>'steamname','class'=>'form-control')) }} @endif