%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/loslex/test/resources/views/contests/partials/
Upload File :
Create Path :
Current File : //www/loslex/test/resources/views/contests/partials/registration-online.blade.php

<div class="space-y-6" x-data="{
    stages: {{ old('stages', $contest->stages ?? 4) }},
    squads: {{ old('squads', $contest->squads ?? 4) }},
    capacity: {{ old('capacity', $contest->capacity ?? 20) }},
    distribution: '{{ old('distribution', $contest->distribution ?? 'asc') }}',
    get sqdivisions() {
        let n = Math.floor(this.capacity / this.squads);
        const arr = [];
        for (let i = 0; i < this.squads; i++){ arr.push(n) };
        if (arr.reduce((a,b) => a+b, 0) === this.capacity) { return arr.toString(); };

        if (this.distribution == 'asc') { for(let i = 0; i < this.squads; i++) { arr[i]++; if(arr.reduce((a,b) => a+b, 0) === this.capacity) { return arr.toString(); }; }; }
        else { for(let i = this.squads - 1; i >= 0; i--) { arr[i]++; if(arr.reduce((a,b) => a+b, 0) === this.capacity) { return arr.toString(); }; }; }
    },
    get sqarr() { return `(${this.sqdivisions})`; },
    squadshootstyle: '{{ old('squadshootstyle', !is_null($contest) ? $contest->squad_shoot_style : 'together') }}',
    get showsqtogether() { return this.squadshootstyle == 'together';},
    get showsqmanual() { return this.squadshootstyle == 'manual';},
    tbl_pres_start: {{ json_encode(old('presentation_start', !is_null($contest) ? $contest->presentation_start : '')) }} ?? new Array(this.squads),
    tbl_pres_end: {{ json_encode(old('presentation_end', !is_null($contest) ? $contest->presentation_end : '')) }} ?? new Array(this.squads),
    tbl_cntst_start: {{ json_encode(old('contest_start', !is_null($contest) ? $contest->contest_start : '')) }} ?? new Array(this.squads),
    tbl_cntst_end: {{ json_encode(old('contest_end', !is_null($contest) ? $contest->contest_end : '')) }} ?? new Array(this.squads),
}">
    <div class="flex flex-row flex-wrap gap-x-4">
        <div>
            <x-input-label for="stages" :value="__('Number of stages')" />
            <x-text-input class="mt-1" id="stages" name="stages" type="number" x-model.number="stages" />
            <x-input-error class="mt-2" :messages="$errors->get('stages')" />
        </div>

        <div>
            <x-input-label for="squads" :value="__('Number of squads')" />
            <x-text-input class="mt-1" id="squads" name="squads" type="number" x-model.number="squads" />
            <x-input-error class="mt-2" :messages="$errors->get('squads')" />
        </div>

        <div>
            <x-input-label for="capacity" :value="__('Capacity')" />
            <x-text-input class="mt-1" id="capacity" name="capacity" type="number" x-model.number="capacity" />
            <x-input-error class="mt-2" :messages="$errors->get('capacity')" />
        </div>

        <div>
            <x-input-label for="distribution" :value="__('Squad size distribution')" />
            <x-select class="mt-1" id="distribution" name="distribution" x-model="distribution">
                <option value="asc">{{__('Auto, larger first')}}</option>
                <option value="desc">{{__('Auto, larger last')}}</option>
            </x-select>
            <x-input-error class="mt-2" :messages="$errors->get('distribution')" />
        </div>

        <div>
            <x-input-label :value="__('Squad sizes')" />
            <div class="mt-1" x-text="sqarr"></div>
        </div>
    </div>

    <div class="flex flex-row flex-wrap gap-x-4">
        <div>
            <x-text-input type="radio" x-model="squadshootstyle" id="squadstogether" name="squadshootstyle" value="together" />
            <x-input-label class="!inline ml-1" for="squadstogether" :value="__('Squads shooting at the same time')" />
        </div>
        <div>
            <x-text-input type="radio" x-model="squadshootstyle" id="squadscustom" name="squadshootstyle" value="manual" />
            <x-input-label class="!inline ml-1" for="squadscustom" :value="__('Custom shooting times')" />
        </div>
    </div>

    <div x-show="showsqtogether" class="flex flex-row flex-wrap gap-x-4">
        <div>
            <x-input-label for="presentation_start_0" :value="__('Presentation start')" />
            <x-text-input class="mt-1" id="presentation_start_0" name="presentation_start[0]" type="time" :value="is_array(old('presentation_start')) ? old('presentation_start')[0] : (is_array($contest?->presentation_start) ? $contest->presentation_start[0] : '')" />
            <x-input-error class="mt-2" :messages="$errors->get('presentation_start.0')" />
        </div>

        <div>
            <x-input-label for="presentation_end_0" :value="__('Presentation end')" />
            <x-text-input class="mt-1" id="presentation_end_0" name="presentation_end[0]" type="time" :value="is_array(old('presentation_end')) ? old('presentation_end')[0] : (is_array($contest?->presentation_end) ? $contest->presentation_end[0] : '')" />
            <x-input-error class="mt-2" :messages="$errors->get('presentation_end.0')" />
        </div>

        <div>
            <x-input-label for="contest_start_0" :value="__('Contest start')" />
            <x-text-input class="mt-1" id="contest_start_0" name="contest_start[0]" type="time" :value="is_array(old('contest_start')) ? old('contest_start')[0] : (is_array($contest?->contest_start) ? $contest->contest_start[0] : '')" />
            <x-input-error class="mt-2" :messages="$errors->get('contest_start.0')" />
        </div>

        <div>
            <x-input-label for="contest_end" :value="__('Contest end')" />
            <x-text-input class="mt-1" id="contest_end_0" name="contest_end[0]" type="time" :value="is_array(old('contest_end')) ? old('contest_end')[0] : (is_array($contest?->contest_end) ? $contest->contest_end[0] : '')" />
            <x-input-error class="mt-2" :messages="$errors->get('contest_end.0')" />
        </div>
    </div>

    <div x-show="showsqmanual">
        <template x-for="index in squads">
            <fieldset x-data="{id: index}" class="flex flex-row flex-wrap gap-x-4 border rounded-md px-4 pb-2">
                <legend class="mx-4 px-2" x-text="'Squad ' + index"></legend>
                <div>
                    <x-input-label ::for="`presentation_start_${id}`" :value="__('Presentation start')" />
                    <x-text-input class="mt-1" ::id="`presentation_start_${id}`" ::name="`presentation_start[${id}]`" type="time" x-model="tbl_pres_start[id]" />
                </div>

                <div>
                    <x-input-label ::for="`presentation_end_${id}`" :value="__('Presentation end')" />
                    <x-text-input class="mt-1" ::id="`presentation_end_${id}`" ::name="`presentation_end[${id}]`" type="time" x-model="tbl_pres_end[id]" />
                </div>

                <div>
                    <x-input-label ::for="`contest_start_${id}`" :value="__('Contest start')" />
                    <x-text-input class="mt-1" ::id="`contest_start_${id}`" ::name="`contest_start[${id}]`" type="time" x-model="tbl_cntst_start[id]" />
                </div>

                <div>
                    <x-input-label ::for="`contest_end_${id}`" :value="__('Contest end')" />
                    <x-text-input class="mt-1" ::id="`contest_end_${id}`" ::name="`contest_end[${id}]`" type="time" x-model="tbl_cntst_end[id]" />
                </div>
            </fieldset>
        </template>
        @error('manualtimetable')
            <ul class="text-sm text-red-600 space-y-1 mt-2">
                @foreach ($errors->get('manualtimetable')[0] as $message)
                    <li>{{ $message }}</li>
                @endforeach
            </ul>
        @enderror
    </div>
</div>

Zerion Mini Shell 1.0