%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/registration.blade.php

<div>
    <div class="text-lg text-center font-bold">{{__('Registration')}}</div>

    <form id="regform" method="POST" action="{{ request()->routeIs('registration.edit') ? route('registration.update', $registration->id) : route('registration.store').'#regform' }}" class="space-y-6">
        @csrf
        @if(request()->routeIs('registration.edit')) @method('patch') @endif
        @if(request()->has('maintain'))
            <input type="hidden" name="maintain" />
        @endif

        <input type="hidden" name="user_id" value="{{ old('user_id', $registration->user->id ?? auth()->user()->id) }}" />
        <input type="hidden" name="contest_id" value="{{ $contest->id }}" />
        <input type="hidden" name="contest_level_id" value="{{ $contest->contest_level_id }}" />

        <div class="flex flex-row flex-wrap gap-x-4 gap-y-4">
            <div class="grow">
                <x-input-label for="username" :value="__('Name')" />
                <x-text-input id="username" type="text" class="mt-1 block w-full" :value="$registration->user->displayname ?? auth()->user()->displayname" disabled />
            </div>

            <div class="grow lg:grow-0">
                <x-input-label for="licenceid" :value="__('Licence/EFP number')" />
                <x-text-input id="licenceid" type="text" class="mt-1 block w-full" name="licence_number" :value="old('licence_number', $registration->licence_number ?? isset($registration) ? $registration->user->licence_number : auth()->user()->licence_number)" autocomplete="on" />
                <x-input-error class="mt-2" :messages="$errors->get('licence_number')" />
            </div>
        </div>

        <div class="flex flex-row flex-wrap gap-x-4 gap-y-4"
             x-data="{ lxmbr: {{
                !empty(old('lexmember'))
                || (isset($registration) && $registration->lexmember || !empty($registration->user->lex_hash))
                || (request()->routeIs('contest.show') && !empty(auth()->user()->lex_hash))
                ? 'true' : 'false' }},
            }">
            <div class="flex items-center">
                <x-text-input type="checkbox" class="inline" id="lexmember" name="lexmember" x-model="lxmbr" />
                <x-input-label class="ml-2" for="lexmember" :value="__('Member of LEX')" />
            </div>
            <div x-show="lxmbr" class="grow items-center">
                <x-input-label class="inline" for="lexhash" :value="__('LEX membership control code')" />
                <div class="text-sm italic">{{__('tooltips.lexmembershiphash')}}</div>
                <x-text-input class="grow w-full" id="lexhash" type="text" name="lex_hash" :value="old('lex_hash', $registration->user->lex_hash ?? (!isset($registration) ? auth()->user()->lex_hash : ''))" />
                <x-input-error class="mt-2" :messages="$errors->get('lex_hash')" />
            </div>
        </div>

        @if ($contest->contest_category != null)
            <div class="grow items-center">
                <x-input-label class="inline" for="contest_division_id" :value="__('Division')" />
                <div class="text-sm italic">{{__('tooltips.OptDivisions')}}</div>
                <x-select class="" id="contest_division_id" name="contest_division_id">
                    <option value="" selected disabled>{{ __('Select division') }}</option>
                    @foreach ($contest->contest_category->divisions as $division)
                        <option @selected(old('contest_division_id') == $division->id || (empty(old('contest_division_id')) && isset($registration) && $registration->contest_division_id == $division->id)) value="{{ $division->id }}">{{ __('contest.' . $division->division) }}</option>
                    @endforeach
                </x-select>
                <x-input-error class="mt-2" :messages="$errors->get('contest_division_id')" />
            </div>
        @endif

        <fieldset class="text-sm text-gray-700 dark:text-gray-300 font-medium border rounded-md py-2 px-4">
            <legend class="px-2">{{ __('Registration options') }}</legend>

            <div>
                @if ($forcenotcompete) <input type="hidden" name="notcomp" id="notcomp" value="1" /> @endif
                <x-text-input type="checkbox" class="rounded" id="notcomp" name="notcomp" :disabled="$forcenotcompete" :checked="!empty(old('notcomp')) || (isset($registration) && $registration->notcomp) || $forcenotcompete" :readonly="$forcenotcompete" />
                <x-input-label class="inline ml-2" for="notcomp" :value="__('Not competing')" />
                @if ($forcenotcompete) <div class="inline text-xs">{{__('(You cannot have multiple registrations as a competitor)')}}</div> @endif
            </div>

            <div>
                <x-text-input input type="checkbox" class="rounded" id="rookie" name="rookie" :checked="!empty(old('rookie')) || (isset($registration) && $registration->rookie)" />
                <x-input-label class="inline ml-2" for="rookie" :value="__('I\'m beginner')" />
            </div>

            <div>
                <x-text-input type="checkbox" class="rounded" id="builder" name="builder" :checked="!empty(old('builder')) || (isset($registration) && $registration->builder)" />
                <x-input-label class="inline ml-2" for="builder" :value="__('I\'ll help to build the contest')" />
            </div>

            <div>
                <x-text-input type="checkbox" class="rounded" id="referee" name="referee" :checked="!empty(old('referee')) || (isset($registration) && $registration->referee)" />
                <x-input-label class="inline ml-2" for="referee" :value="__('Referee or helper at stage')" />
                <x-input-error class="mt-2" :messages="$errors->get('referee')" />
            </div>
        </fieldset>

        <div class="flex flex-row">
            <div class="grow">
                <x-input-label for="note" :value="__('Note')" />
                <x-text-input  class="mt-1 block w-full" type="text" id="note" name="note" :value="old('note', isset($registration) ? $registration->note : '')" />
                <x-input-error class="mt-2" :messages="$errors->get('note')" />
            </div>
        </div>

        <div x-data="{ @foreach ($contest->divisionCounts as $div => $count)highlight{{$div}}: false, @endforeach }">
            @if ($contest->registrations->isNotEmpty() && $contest->contest_category)
                <div class="text-sm p-2 flex flex-row flex-wrap gap-1">
                    @foreach ($contest->divisionCounts as $div => $count)
                        <div @click="highlight{{$div}} = !highlight{{$div}}"
                             class="whitespace-nowrap cursor-pointer inline p-1 border rounded select-none" :class="highlight{{$div}} ? 'division-active' : ''">{{$div}}: {{$count}}</div>
                    @endforeach
                </div>
            @endif
            <div class="border rounded p-2">
                <div class="flex flex-row flex-wrap gap-2 justify-around">
                    @for ($i = 1; $i <= $contest->squads; $i++)
                    <div class="border rounded text-center p-2 grow basis-1/5">
                        <x-input-label class="cursor-pointer font-bold" for="squad-{{$i}}" value="Squad {{$i}}" />
                        @if ($contest->registrations->where('squad', $i)->count() < $contest->squadSize[$i] || (isset($registration) && $registration->squad == $i))
                            <x-text-input id="squad-{{$i}}" type="radio" name="squad" :checked="(old('squad') == $i) || (empty(old('squad')) && isset($registration) && $registration->squad == $i)" value="{{$i}}" />
                        @else
                            <div class="text-sm italic">{{ __('Full capacity') }}</div>
                        @endif
                        <div class="mt-1 text-xs">{{$contest->registrations->where('squad', $i)->count()}} / {{ $contest->squadSize[$i] }}</div>
                        <div class="w-full mt-2 text-sm gap-2 flex flex-row flex-wrap justify-center">
                            @foreach ($contest->registrations->where('squad', $i)->sortBy('user.lastname') as $reg)
                                <div @class(['whitespace-nowrap p-1 border rounded select-none', 'registration-own' => isset($registration) && $reg->id == $registration->id ])
                                     :class="highlight{{$reg->division?->bgdivision}} ? 'division-active' : ''" title="{{ $reg->division?->division }}">
                                    @if ($reg->user->id == auth()->user()->id && !request()->routeIs('registration.edit'))
                                        <a class="font-bold text-sky-600" href="{{ route('registration.show', $reg->id) }}">{{$reg->user->displayname}}@if($reg->notcomp) {{__('(NC)')}}@endif</a>
                                    @else
                                        {{$reg->user->displayname}}@if($reg->notcomp) {{__('(NC)')}}@endif
                                    @endif
                                    <div class="text-xxs italic">{{ $reg->user->username}}</div>
                                </div>
                            @endforeach
                        </div>
                    </div>
                    @endfor
                </div>
                <div class="mt-2 flex flex-row flex-wrap justify-around">
                    <div class="border rounded text-center p-2 grow">
                        <x-input-label class="cursor-pointer font-bold" for="squad-r" value="Squad R" />
                        <x-text-input id="squad-r" type="radio" name="squad" :checked="(old('squad') == '0') || (empty(old('squad')) && isset($registration) && $registration->squad == '0')" value="0" />
                        <div class="w-full mt-2 text-sm gap-2 flex flex-row flex-wrap justify-center">
                            @foreach ($contest->registrations->where('squad', 0)->sortBy('user.lastname') as $reg)
                                <div @class(['whitespace-nowrap p-1 border rounded select-none', 'registration-own' => isset($registration) && $reg->id == $registration->id ])
                                    :class="highlight{{$reg->division?->bgdivision}} ? 'division-active' : ''" title="{{ $reg->division?->division }}">
                                    @if ($reg->user->id == auth()->user()->id && !request()->routeIs('registration.edit'))
                                        <a class="font-bold text-sky-600" href="{{ route('registration.show', $reg->id) }}">{{$reg->user->displayname}}@if($reg->notcomp) {{__('(NC)')}}@endif</a>
                                    @else
                                        {{$reg->user->displayname}}@if($reg->notcomp) {{__('(NC)')}}@endif
                                    @endif
                                    <div class="text-xxs italic">{{ $reg->user->username}}</div>
                                </div>
                            @endforeach
                        </div>
                    </div>
                </div>
                <x-input-error class="mt-2" :messages="$errors->get('squad')" />
            </div>
        </div>

        <div class="flex flex-col items-center justify-center">
            <div class="text-sm text-center">{{ __('contest.disclaimer') }}</div>

            @if (request()->routeIs('registration.edit'))
                <input type="hidden" name="gdpr" value="1" />
            @else
                <div class="mt-2">
                    <x-text-input class="rounded" type="checkbox" id="gdpr" name="gdpr" :checked="!empty(old('gdpr'))" />
                    <x-input-label class="ml-1 inline" for="gdpr">
                        {!! __('I agree with processing of personal data as defined in <a class=":class" href=":url" target="_blank">GDPR rules</a>', ['url' => route('gdpr'), 'class' => 'font-bold underline' ]) !!}
                    </x-input-label>
                    <x-input-error class="mt-2" :messages="$errors->get('gdpr')" />
                </div>
            @endif

            <x-primary-button class="mt-2 mr-4">
                @if (request()->routeIs('registration.edit')) {{  __('Save') }}
                @else {{ __('Register') }}
                @endif
            </x-primary-button>
        </div>
    </form>
</div>

Zerion Mini Shell 1.0