@extends('layouts.app') @section('title', $group->name.' — Coaster World') @section('content')
← {{ __('ui.groups_back') }}
{{ $group->group_type === 'trip' ? __('ui.groups_type_trip') : __('ui.groups_type_permanent') }}

{{ $group->name }}

{{ $group->description ?: __('ui.groups_no_description') }}

{{ __('ui.groups_created_by', ['name' => '@'.($group->owner?->username ?: $group->owner?->name)]) }} {{ $group->visibility === 'friends' ? __('ui.groups_visibility_friends') : __('ui.groups_visibility_private') }}
{{ __('ui.rankings_nav') }} @if($canManage) {{ __('ui.groups_manage') }} @endif @if($group->owner_user_id !== auth()->id())
@csrf @method('DELETE')
@endif
@if(session('group_status'))
{{ session('group_status') }}
@endif @if(session('group_error'))
{{ session('group_error') }}
@endif
{{ __('ui.group_visits_kicker') }}

{{ __('ui.group_visits_title') }}

{{ __('ui.group_visits_intro') }}

@if($canManage) @endif
@if($canManage) @endif @if($errors->has('park_id') || $errors->has('starts_on') || $errors->has('ends_on') || $errors->has('title'))
{{ $errors->first() }}
@endif @if($groupVisits->isNotEmpty())
@foreach($groupVisits as $groupVisit) @php $visit = $groupVisit->visit; $park = $visit?->park; $parkTranslation = $park?->translations?->firstWhere('locale', app()->getLocale()) ?? $park?->translations?->firstWhere('locale', 'en'); $currentVisitMember = $visit?->members?->firstWhere('user_id', auth()->id()); $acceptedCount = $visit?->members?->where('invitation_status', 'accepted')->count() ?? 0; $invitedCount = $visit?->members?->where('invitation_status', 'invited')->count() ?? 0; $declinedCount = $visit?->members?->where('invitation_status', 'declined')->count() ?? 0; $isPast = $visit?->ends_on?->isPast() && ! $visit?->ends_on?->isToday(); @endphp
{{ $visit?->starts_on?->format('d') }} {{ mb_strtoupper($visit?->starts_on?->locale(app()->getLocale())->translatedFormat('M') ?? '') }} {{ $visit?->starts_on?->format('Y') }}
{{ $isPast ? __('ui.group_visit_past') : __('ui.group_visit_planned') }}

{{ $visit?->title ?: ($parkTranslation?->name ?: $park?->official_name) }}

{{ $parkTranslation?->name ?: $park?->official_name }} @if($visit?->ends_on && !$visit->ends_on->equalTo($visit->starts_on)) {{ __('ui.group_visit_date_range', ['start' => $visit->starts_on->format('d/m/Y'), 'end' => $visit->ends_on->format('d/m/Y')]) }} @else {{ $visit?->starts_on?->format('d/m/Y') }} @endif
{{ $acceptedCount }}{{ __('ui.group_visit_going') }}
{{ $invitedCount }}{{ __('ui.group_visit_waiting') }}
{{ $declinedCount }}{{ __('ui.group_visit_not_going') }}
@if(!$isPast && $visit?->status === 'planned') @if($currentVisitMember?->invitation_status === 'accepted') ✓ {{ __('ui.group_visit_you_are_going') }} @else
@csrf
@endif @if($currentVisitMember?->invitation_status !== 'declined')
@csrf
@else {{ __('ui.group_visit_you_declined') }} @endif @if($canManage)
@csrf @method('DELETE')
@endif @endif {{ __('ui.group_visit_view_details') }} {{ __('ui.group_visit_open_map') }}
@endforeach
@else
{{ __('ui.group_visits_empty') }}
@endif
{{ __('ui.group_polls_kicker') }}

{{ __('ui.group_polls_title') }}

{{ __('ui.group_polls_intro') }}

{{ trans_choice('ui.group_polls_count', $groupPolls->count(), ['count' => $groupPolls->count()]) }} @if($canManage) @endif
@if($canManage)
has('question') || $errors->has('options') || $errors->has('closes_at') || $errors->has('description'))) hidden @endif>
@csrf
{{ __('ui.group_polls_options') }}
@for($optionIndex = 0; $optionIndex < 8; $optionIndex++) @endfor

{{ __('ui.group_polls_create_help') }}

@endif @if($errors->has('question') || $errors->has('options') || $errors->has('closes_at'))
{{ $errors->first('question') ?: ($errors->first('options') ?: $errors->first('closes_at')) }}
@endif @if($groupPolls->isNotEmpty())
@foreach($groupPolls as $poll) @php $pollOpen = $poll->isOpen(); $myPollVoteIds = $poll->votes->where('user_id', auth()->id())->pluck('option_id')->map(fn ($id) => (int) $id); $pollVoterCount = $poll->votes->pluck('user_id')->unique()->count(); $pollVoteCount = $poll->votes->count(); $pollMaxVotes = $poll->options->map(fn ($option) => $option->votes->count())->max() ?? 0; @endphp
{{ $pollOpen ? __('ui.group_polls_open') : __('ui.group_polls_closed_state') }} {{ $poll->allow_multiple ? __('ui.group_polls_multiple_allowed') : __('ui.group_polls_single_choice') }}

{{ $poll->question }}

@if($poll->description)

{{ $poll->description }}

@endif
{{ trans_choice('ui.group_polls_voters_count', $pollVoterCount, ['count' => $pollVoterCount]) }} {{ trans_choice('ui.group_polls_votes_count', $pollVoteCount, ['count' => $pollVoteCount]) }} {{ $poll->closes_at ? __('ui.group_polls_closes_at', ['date' => $poll->closes_at->format('d/m/Y H:i')]) : __('ui.group_polls_no_deadline') }}
@if($canManage && $pollOpen)
@csrf
@endif
@csrf
@foreach($poll->options as $option) @php $optionVotes = $option->votes->count(); $optionPercent = $pollVoterCount > 0 ? min(100, (int) round(($optionVotes / $pollVoterCount) * 100)) : 0; $optionSelected = $myPollVoteIds->contains((int) $option->id); $optionLeading = !$pollOpen && $pollMaxVotes > 0 && $optionVotes === $pollMaxVotes; @endphp @endforeach
@if($pollOpen)
@if($myPollVoteIds->isNotEmpty()) ✓ {{ __('ui.group_polls_your_vote') }} @endif
@endif
@endforeach
@else
{{ __('ui.group_polls_empty_title') }} {{ __('ui.group_polls_empty') }}
@endif
{{ __('ui.groups_members_kicker') }}

{{ __('ui.groups_members_title') }}

@foreach($group->members->where('status', 'active') as $membership) @php $member = $membership->user; @endphp
{{ mb_strtoupper(mb_substr($member?->username ?: $member?->name ?: '?', 0, 1)) }}
{{ $member?->username ? '@'.$member->username : $member?->name }} {{ $membership->role === 'owner' ? __('ui.groups_role_owner') : __('ui.groups_role_member') }}
@if($member?->username && in_array($member->socialSettings?->activity_visibility ?? null, ['friends','public'], true)) {{ __('ui.friends_view_profile') }} @endif @if($canManage && $group->owner_user_id !== $member?->id)
@csrf @method('DELETE')
@endif
@endforeach
@endsection