%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/loslex/production/resources/views/contests/
Upload File :
Create Path :
Current File : /www/loslex/production/resources/views/contests/show.blade.php

<x-app-layout>
    <x-slot name="pagetitle">{{ $contest->contestname }}</x-slot>

    <x-slot name="header">
        <h2 class="text-gray-800 dark:text-gray-200 leading-tight">{{ $contest->contestname }}</h2>
    </x-slot>

    <div class="w-full lg:w-3/4 m-auto">
        <div class="justify-center items-baseline text-xl font-bold flex">
            {{$contest->contestname}}
            @can('update', $contest)
                <x-dropdown width="fit" align="right">
                    <x-slot name="trigger">
                        <button class="ml-2 test-xs fa-solid fa-gear"></button>
                    </x-slot>
                    <x-slot name="content">
                        <x-dropdown-link
                            :href="route('contest.edit', $contest->id)">{{ __('Edit contest') }}</x-dropdown-link>
                        <x-dropdown-link
                            :href="route('contest.maintain', $contest->id)">{{ __('Contest maintenance') }}</x-dropdown-link>
                        <x-dropdown-divider/>
                        @foreach (\App\Enums\ContestPublicationStatusEnum::cases() as $case)
                            @if ($contest->published != $case)
                                <x-dropdown-link
                                    :href="route('contest.publish', ['contest' => $contest->id, 'status' => $case->value])">{{ __('Set contest status to :status', ['status' => __('contest.' . $case->name)]) }}</x-dropdown-link>
                            @endif
                        @endforeach
                    </x-slot>
                </x-dropdown>
            @endcan
        </div>

        <div class="grid grid-cols-auto lg:grid-cols-fitfirst gap-x-2 lg:gap-x-4 gap-y-2">
            <div class="text-right font-bold align-top">{{__('Range')}}:</div>
            <div><a href="{{ route('range.show', $contest->range->id) }}">{{$contest->range->name}}</a></div>

            <div class="text-right font-bold align-top">{{__('Organizer')}}:</div>
            <div>
                {{$contest->organizer_group->name}}
                @auth
                    <span class="text-sm">(<a href="mailto:{{$contest->organizerEmail ?? $contest->director?->email}}"
                                              target="_blank">{{$contest->organizerEmail ?? $contest->director?->email}}</a>)</span>
                @endauth
            </div>

            <div class="text-right font-bold align-top">{{__('Contest visibility')}}:</div>
            <div>{{ __('contest.' . $contest->published->name) }}</div>

            <div class="text-right font-bold align-top">{{__('Contest category')}}:</div>
            <div>
                {{ __('contest.' . $contest->contest_level?->name)}}@if($contest->contest_category), {{ __('contest.' . $contest->contest_category?->name) }} @endif
            </div>

            <div class="text-right font-bold align-top">{{__('Contest date')}}:</div>
            <div>{{$contest->date->isoFormat('LL')}}</div>

            @if ($contest->director)
                <div class="text-right font-bold align-top">{{__('Contest director')}}:</div>
                <div>{{$contest->director?->displayname}}</div>
            @endif

            @if ($contest->rangemaster || $contest->rangemaster_id == 0)
                <div class="text-right font-bold align-top">{{__('Range master')}}:</div>
                <div>{{ $contest->rangemaster_id != 0 ? $contest->rangemaster->displayname : __('Will be appointed') }}</div>
            @endif

            <div class="text-right font-bold align-top">{{__('Entry fees')}}:</div>
            <div>
                <div>{{ __('LEX members') }}: {{ $contest->feelex }}&nbsp;Kč</div>
                <div>{{ __('Other contestants') }}: {{ $contest->feeothers }}&nbsp;Kč</div>
            </div>

            @if (!$contest->isAfterContest)
                @if ($contest->accountnumber)
                    <div class="text-right font-bold align-top">{{__('Bank payment information')}}:</div>
                    <div>
                        <div>
                            <span class="font-semibold">{{ __('Account number') }}</span>: {{ $contest->accountnumber }}
                            <x-button-clipboard>{{ $contest->accountnumber }}</x-button-clipboard>
                        </div>
                        @if ($contest->accvarsym)
                            <div>
                                <span class="font-semibold">{{ __('Variable symbol') }}</span>: {{ $contest->accvarsym }}
                                <x-button-clipboard>{{ $contest->accvarsym }}</x-button-clipboard>
                            </div>
                        @endif
                        @if ($contest->accnote)
                            <div>
                                <span class="font-semibold">{{ __('Payment note') }}</span>: {{ $contest->paymentnote }}
                                <x-button-clipboard>{{ $contest->paymentnote }}</x-button-clipboard>
                            </div>
                        @endif
                    </div>
                @endif

                @if ($contest->acccondition)
                    <div class="text-right font-bold align-top">{{__('Payment conditions')}}:</div>
                    <div>{{ $contest->acccondition }}</div>
                @endif
            @endif

            <div class="text-right font-bold align-top">{{__('Number of stages')}}:</div>
            <div>{{$contest->stages}}</div>

            <div class="text-right font-bold align-top">{{__('Presentation')}}:</div>
            <div>
                @if ($contest->squadshootstyle == 'together')
                    {{ $contest->presentation_start[0] }} - {{ $contest->presentation_end[0] }}<br/>
                @else
                    @for ($i = 1; $i <= $contest->squads; $i++)
                        Squad {{$i}}: {{ $contest->presentation_start[$i] }} - {{ $contest->presentation_end[$i] }}<br/>
                    @endfor
                @endif
            </div>

            <div class="text-right font-bold align-top">{{__('Contest duration')}}:</div>
            <div>
                @if ($contest->squadshootstyle == 'together')
                    {{ $contest->contest_start[0] }} - {{ $contest->contest_end[0] }}<br/>
                @else
                    @for ($i = 1; $i <= $contest->squads; $i++)
                        Squad {{$i}}: {{ $contest->contest_start[$i] }} - {{ $contest->contest_end[$i] }}<br/>
                    @endfor
                @endif
            </div>

            @if (($contest->isRegActive || $contest->isAfterReg) && !$contest->results_published)
                <div class="text-right font-bold align-top">{{__('Registered shooters')}}:</div>
                <div class="{{ $contest->registrations->where('squad', '>', 0)->count() <= round(0.8 * $contest->capacity)
                               ? 'text-green-500'
                               : ($contest->registrations->where('squad', '>', 0)->count() < $contest->capacity ? 'text-amber-500' : 'text-red-600') }}">
                    {{ $contest->registrations->where('squad', '>', 0)->count() }} / {{ $contest->capacity }} <span
                        class="text-xs">{{__('(plus referees: :cnt)', ['cnt' => $contest->registrations->where('squad', 0)->count()])}}</span>
                </div>
            @else
                <div class="text-right font-bold align-top">{{__('Capacity')}}:</div>
                <div>{{ $contest->capacity }} <span class="text-xs">{{__('(plus referees)')}}</span></div>
            @endif

            <div class="text-right font-bold align-top">{{__('Registration')}}:</div>
            <div>
                @switch ($contest->registration_type)
                    @case (\App\Enums\ContestRegistrationEnum::ONLINE)
                        @if ($contest->isBeforeReg)
                            {{__('Registration will start on :date', ['date' => $contest->registration_start?->isoFormat('LL HH:mm')])}}
                        @elseif ($contest->isAfterReg)
                            {{__('Registration finished.')}}
                        @else
                            {{__('Registration will end on :date', ['date' => $contest->registration_end?->isoFormat('LL HH:mm')])}}
                            <br/>
                            (
                            <x-countdown class="!inline text-xs" :expires="$contest->registration_end"/>)
                        @endif
                        @guest
                            @if (!$contest->isAfterReg)
                                <div class="text-sm">
                                    {!! __('To register for the contest you need to :loginlinkopen log in :loginlinkclose or :registerlinkopen create new account :registerlinkclose', [
                                        'loginlinkopen' => '<span x-data="" x-on:click.prevent="$dispatch(\'open-modal\', \'login-form\')" class="font-bold cursor-pointer underline underline-offset-4">',
                                        'loginlinkclose' => '</span>',
                                        'registerlinkopen' => '<a class="font-bold" href="' . route('register') . '">',
                                        'registerlinkclose' => '</a>'
                                    ]) !!}
                                </div>
                            @endif
                        @endguest
                        @break

                    @case (\App\Enums\ContestRegistrationEnum::OFFSITE)
                        {!! __('External at <a target="_blank" href=":url">:url</a>', ['url' => $contest->offsiteregurl]) !!}
                        @break

                    @case (\App\Enums\ContestRegistrationEnum::BEFORECONTEST)
                        {{ __('contest.BEFORECONTEST') }}
                        @break

                    @case (\App\Enums\ContestRegistrationEnum::OTHER)
                        {{ __('contest.OTHER') }}
                        @break
                @endswitch
            </div>

            <div class="text-right font-bold align-top">{{__('Calibration weapon')}}:</div>
            <div>{{ $contest->calibrationwpn }}</div>

            @if ($contest->caliberlimit)
                <div class="text-right font-bold align-top">{{__('Caliber or power limitation')}}:</div>
                <div>{{ $contest->caliberlimit }}</div>
            @endif

            @if (!$contest->isAfterContest)
                <div class="text-right font-bold align-top">{{__('Protest deposit')}}</div>
                <div class="inline-flex items-center">{{ $contest->protestdeposit }}&nbsp;Kč</div>
            @endif

            <div class="text-right font-bold align-top">{{__('Secret stages')}}:</div>
            <div class="inline-flex items-center">{{ __('contest.' . \App\Enums\ContestOptionsEnum::from($contest->secretstages)->name) }}</div>

            <div class="text-right font-bold align-top">{{__('Flashlight needed')}}:</div>
            <div class="inline-flex items-center">{{ __('contest.' . \App\Enums\ContestOptionsEnum::from($contest->flashlight)->name) }}</div>

            @if (!$contest->isAfterContest)
                <div class="text-right font-bold align-top">{{__('Canteen available')}}:</div>
                <div class="inline-flex items-center">{{ __('contest.' . \App\Enums\ContestOptionsEnum::from($contest->canteen)->name) }}</div>

                <div class="text-right font-bold align-top">{{__('Toilet available')}}:</div>
                <div class="inline-flex items-center">{{ __('contest.' . \App\Enums\ContestOptionsEnum::from($contest->toilet)->name) }}</div>
            @endif

            <div class="font-bold col-span-2 lg:col-span-1 lg:text-right">{{__('Instructions')}}:</div>
            <div class="col-span-2 lg:col-span-1" x-data="{open : false}">
                @if (substr_count($contest->instructions, "\n") <= 4 && Str::wordCount($contest->instructions) < 100)
                    <div class="text-sm overflow-x-auto">{!! nl2br($contest->instructions) !!}</div>
                @else
                    <div class="text-sm overflow-x-auto pt-1" :class="open ? 'line-clamp-none' : 'line-clamp-5'">
                        <div class="text-center lg:text-left italic cursor-pointer mb-2 font-semibold" x-show="!open"
                             x-on:click="open = !open"><span
                                class="italic fa-solid fa-angles-down mr-1"></span>{{__('Click to expand...')}}
                        </div>
                        {!! nl2br($contest->instructions) !!}
                        <div class="text-center lg:text-left italic cursor-pointer mt-2 font-semibold" x-show="open"
                             x-on:click="open = !open"><span
                                class="italic fa-solid fa-angles-up mr-1"></span>{{__('Click to shrink...')}}</div>
                    </div>
                @endif
            </div>

            @if (!empty($contest->legend))
                <div class="font-bold col-span-2 lg:col-span-1 lg:text-right">{{__('Legend or stages description')}}:
                </div>
                <div class="col-span-2 lg:col-span-1" x-data="{open : false}">
                    @if (substr_count($contest->legend, "\n") <= 4 && Str::wordCount($contest->legend) < 100)
                        <div class="text-sm overflow-x-auto">{!! nl2br($contest->legend) !!}</div>
                    @else
                        <div class="text-sm overflow-x-auto pt-1" :class="open ? 'line-clamp-none' : 'line-clamp-5'">
                            <div class="text-center lg:text-left italic cursor-pointer mb-2 font-semibold"
                                 x-show="!open" x-on:click="open = !open"><span
                                    class="italic fa-solid fa-angles-down mr-1"></span>{{__('Click to expand...')}}
                            </div>
                            {!! nl2br($contest->legend) !!}
                            <div class="text-center lg:text-left italic cursor-pointer mt-2 font-semibold" x-show="open"
                                 x-on:click="open = !open"><span
                                    class="italic fa-solid fa-angles-up mr-1"></span>{{__('Click to shrink...')}}
                            </div>
                        </div>
                    @endif
                </div>
            @endif

            @if (!empty($contest->restrictionstext))
                <div
                    class="font-bold col-span-2 lg:col-span-1 lg:text-right">{{__('Other requirements or restrictions')}}
                    :
                </div>
                <div class="col-span-2 lg:col-span-1">
                    <div class="pt-1 text-sm overflow-x-auto">{!! nl2br($contest->restrictionstext) !!}</div>
                </div>
            @endif

            @if ($contest->partnersArr)
                <div class="font-bold col-span-2 lg:col-span-1 lg:text-right">{{__('Partners or sponsors')}}:</div>
                <div class="col-span-2 lg:col-span-1">
                    <div class="pt-1">
                        @foreach ($contest->partnersArr as $partner)
                            @if (array_key_exists('url', $partner))
                                <div class="text-sm"><a target="_blank" class="font-bold underline"
                                                        href="{{ $partner['url']}}">{{ $partner['name']}}</a></div>
                            @else
                                <div class="text-sm">{{ $partner['name']}}</div>
                            @endif
                        @endforeach
                    </div>
                </div>
            @endif
        </div>

        @if (!$contest->isAfterContest && $contest->registrations->where('user_id', Auth::user()?->id)->isNotEmpty())
            <div class="text-lg text-center font-bold border-t pt-2 mt-6 mb-2">{{__('Your registrations')}}</div>
            <ul class="list-none text-center">
                @foreach ($contest->registrations->where('user_id', Auth::user()?->id) as $regs)
                    <li>
                        <a href="{{ route('registration.show', $regs->id)}}">
                            {{__('Squad')}}: {{ $regs->squad == 0 ? 'R' : $regs->squad }};
                            @if($regs->division)
                                {{__('Division')}}: {{ __('contest.' . $regs->division->division) }}@if ($regs->notcomp)
                                    ; {{__('Not competing')}}
                                @endif;
                            @endif
                            @if($regs->paid)
                                {{__('Paid')}}
                            @else
                                {{__('Not paid')}}
                            @endif
                        </a>
                    </li>
                @endforeach
            </ul>
        @endif
    </div>

    <div class="w-full lg:w-3/4 mt-6 m-auto">
        @isset($results)
            @php
                $template = 'contests.results.overview';
                switch ($contest->contest_level_id)
                {
                    case \App\Enums\ContestLevelEnum::SZSCLASSIFICATION->value:
                        $template = 'contests.results.szclassification';
                        break;
                }
            @endphp
            @if($contest->results_published)
                <div class="border-t">@include($template, $results)</div>
            @else
                @can('update', $contest)
                    <div class="border-t">@include($template, $results)</div>
                @endcan
            @endif
        @else
            @if ($contest->isRegActive)
                @auth
                    <div class="border-t">@include('contests.registration')</div>
                @else
                    <div class="border-t">@include('contests.regoverview')</div>
                @endauth
            @elseif ($contest->isAfterReg && !$contest->isAfterContest)
                <div class="border-t">@include('contests.regoverview')</div>
            @endif
        @endisset
    </div>
</x-app-layout>

Zerion Mini Shell 1.0