%PDF- %PDF-
Direktori : /mnt/tnb2/git/loslex/resources/views/contests/ |
Current File : //mnt/tnb2/git/loslex/resources/views/contests/registration.blade.php |
@push('scripts') <script> function highlightDivisionRegistrations(id, highlight) { shooters = document.getElementsByClassName(`div${id}`); for (i = 0; i < shooters.length; i++) { if (highlight) { shooters[i].className += " bg-red-300"; } else { shooters[i].className = shooters[i].className.replace(" bg-red-300", ""); } } } </script> @endpush <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 <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 }}" /> <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 number')" /> <x-text-input id="licenceid" type="text" class="mt-1 block w-full" name="licence_number" :value="old('licence_number', $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')) ? 'true' : (isset($registration) && $registration->lexmember || !empty($user->lex_hash) ? 'true' : 'false') }} }"> <div class="flex items-center"> <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="block mr-2" for="lexhash" :value="__('LEX membership control code')" /> <x-text-input class="grow w-full" id="lexhash" type="text" name="lex_hash" :value="old('lex_hash', $registration->user->lex_hash ?? auth()->user()->lex_hash)" /> <x-input-error class="mt-2" :messages="$errors->get('lex_hash')" /> </div> </div> <div class="grow items-center"> <x-input-label for="contest_division_id" :value="__('Division')" /> <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> <fieldset class="text-sm text-gray-700 font-medium border py-2 px-4"> <legend class="px-2">{{ __('Additional options') }}</legend> <div> <input type="checkbox" id="notcomp" name="notcomp" {{ !empty(old('notcomp')) || (isset($registration) && $registration->notcomp) ? 'checked' : '' }} /> <x-input-label class="inline ml-2" for="notcomp" :value="__('Not competing')" /> </div> <div> <input type="checkbox" id="rookie" name="rookie" {{ !empty(old('rookie')) || (isset($registration) && $registration->rookie) ? 'checked' : '' }} /> <x-input-label class="inline ml-2" for="rookie" :value="__('I\'m beginner')" /> </div> <div> <input type="checkbox" id="builder" name="builder" {{ !empty(old('builder')) || (isset($registration) && $registration->builder) ? 'checked' : '' }} /> <x-input-label class="inline ml-2" for="builder" :value="__('I\'ll help to build the contest')" /> </div> <div> <input type="checkbox" id="referee" name="referee" {{ !empty(old('referee')) || (isset($registration) && $registration->referee) ? 'checked' : '' }} /> <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 : '')" /> </div> </div> <div> @if ($contest->registrations->isNotEmpty()) <div class="text-sm p-2"> @foreach ($contest->divisionCounts as $div => $count) <div onmouseover="highlightDivisionRegistrations('{{$div}}', true)" onmouseout="highlightDivisionRegistrations('{{$div}}', false)" class="inline p-1 border div{{$div}}">{{$div}}: {{$count}}</div> @endforeach </div> @endif <div class="border p-2"> <div class="flex flex-row flex-wrap gap-2 justify-around"> @for ($i = 1; $i <= $contest->squads; $i++) <div class="border text-center p-2 grow basis-0"> <x-input-label class="cursor-pointer font-bold" for="squad-{{$i}}" value="Squad {{$i}}" /> <input id="squad-{{$i}}" type="radio" name="squad" {{ (old('squad') == $i) ? 'checked' : (empty(old('squad')) && isset($registration) && $registration->squad == $i ? 'checked' : '') }} value="{{$i}}" /> <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) as $reg) <div class="p-1 border select-none div{{$reg->division->bgdivision}} {{isset($registration) && $reg->id == $registration->id ? 'border-orange-300 bg-orange-100' : ''}}" title="{{ $reg->division->division }}"> @if ($reg->user->id == auth()->user()->id) <a class="hover:font-bold hover:text-red-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> @endforeach </div> </div> @endfor </div> <div class="mt-2 flex flex-row flex-wrap justify-around"> <div class="border text-center p-2 grow"> <x-input-label class="cursor-pointer font-bold" for="squad-r" value="Squad R" /> <input id="squad-r" type="radio" name="squad" {{ (old('squad') == '0') ? 'checked' : (empty(old('squad')) && isset($registration) && $registration->squad == '0' ? 'checked' : '') }} 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) as $reg) <div class="p-1 border select-none div{{$reg->division->bgdivision}} {{isset($registration) && $reg->id == $registration->id ? 'border-orange-300 bg-orange-100' : ''}}" title="{{ $reg->division->division }}"> @if ($reg->user->id == auth()->user()->id) <a class="hover:font-bold hover:text-red-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> @endforeach </div> </div> </div> <x-input-error class="mt-2" :messages="$errors->get('squad')" /> </div> </div> <div class="mt-4 flex items-center gap-4 justify-center"> <x-primary-button class="mr-4">{{ __('Register') }}</x-primary-button> </div> </form> </div>