Add ceckboxes to advancement page and form to autmoatcially check X boxes
This commit is contained in:
parent
8125ef6a32
commit
f5db2eae78
|
|
@ -25,11 +25,12 @@ class AdvancementController extends Controller
|
||||||
|
|
||||||
public function ranking(Request $request, Audition $audition)
|
public function ranking(Request $request, Audition $audition)
|
||||||
{
|
{
|
||||||
$entries = $this->tabulationService->auditionEntries($audition->id);
|
$entries = $this->tabulationService->auditionEntries($audition->id, 'advancement');
|
||||||
$entries = $entries->filter(function ($entry) {
|
|
||||||
return $entry->for_advancement;
|
$scoringComplete = $entries->every(function ($entry) {
|
||||||
|
return $entry->scoring_complete;
|
||||||
});
|
});
|
||||||
|
|
||||||
return view('tabulation.advancement.ranking', compact('audition', 'entries'));
|
return view('tabulation.advancement.ranking', compact('audition', 'entries','scoringComplete'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class TabulationService
|
||||||
$audition = $this->auditionCacheService->getAudition($auditionId);
|
$audition = $this->auditionCacheService->getAudition($auditionId);
|
||||||
$entries = $this->entryCacheService->getEntriesForAudition($auditionId, $mode);
|
$entries = $this->entryCacheService->getEntriesForAudition($auditionId, $mode);
|
||||||
$this->scoreService->calculateScoresForAudition($auditionId);
|
$this->scoreService->calculateScoresForAudition($auditionId);
|
||||||
|
// TODO will need to pass a mode to the above function to only use subscores for hte appropriate mode
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
$entry->final_score_array = $this->scoreService->entryTotalScores($entry);
|
$entry->final_score_array = $this->scoreService->entryTotalScores($entry);
|
||||||
$entry->scoring_complete = ($this->scoreService->entryScoreSheetCounts()[$entry->id] == $audition->judges_count);
|
$entry->scoring_complete = ($this->scoreService->entryScoreSheetCounts()[$entry->id] == $audition->judges_count);
|
||||||
|
|
@ -69,18 +69,20 @@ class TabulationService
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO verify this actually sorts by subscores correctly
|
//TODO verify this actually sorts by subscores correctly
|
||||||
|
|
||||||
|
// Assign a rank to each entry. In the case of a declined seat by a doubler, indicate as so and do not increment rank
|
||||||
$n = 1;
|
$n = 1;
|
||||||
/** @var Entry $entry */
|
/** @var Entry $entry */
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
if (! $entry->hasFlag('declined')) {
|
if (! $entry->hasFlag('declined') or $mode != 'seating') {
|
||||||
$entry->rank = $n;
|
$entry->rank = $n;
|
||||||
$n++;
|
$n++;
|
||||||
} else {
|
} else {
|
||||||
$entry->rank = $n.' - declined';
|
$entry->rank = $n.' - declined';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache[$auditionId] = $entries->keyBy('id');
|
$cache[$auditionId] = $entries->keyBy('id');
|
||||||
|
|
||||||
return $entries->keyBy('id');
|
return $entries->keyBy('id');
|
||||||
|
|
@ -167,7 +169,6 @@ class TabulationService
|
||||||
$audition->scored_entries_count = $scored_entries_count;
|
$audition->scored_entries_count = $scored_entries_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $auditions;
|
return $auditions;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
@props(['name','label','description' => '', 'checked' => false])
|
@props(['name','label' => false,'description' => '', 'checked' => false])
|
||||||
<div class="relative flex items-start">
|
<div class="relative flex items-start">
|
||||||
<div class="flex h-6 items-center">
|
<div class="flex h-6 items-center">
|
||||||
<input id="{{ $name }}"
|
<input id="{{ $name }}"
|
||||||
|
|
@ -6,11 +6,13 @@
|
||||||
name="{{ $name }}"
|
name="{{ $name }}"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@if($checked) checked @endif
|
@if($checked) checked @endif
|
||||||
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600">
|
{{ $attributes->merge(['class' => "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600"]) }}>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-3 text-sm leading-6">
|
<div class="ml-3 text-sm leading-6">
|
||||||
<label for="{{ $name }}" class="font-medium text-gray-900">{{ $label }}</label>
|
@if($label)
|
||||||
<p id="comments-description" class="text-gray-500">{{ $description }}</p>
|
<label for="{{ $name }}" class="font-medium text-gray-900">{{ $label }}</label>
|
||||||
|
<p id="comments-description" class="text-gray-500">{{ $description }}</p>
|
||||||
|
@endif
|
||||||
@error($name)
|
@error($name)
|
||||||
<p class="text-xs text-red-500 font-semibold mt-1 ml-3">{{ $message }}</p>
|
<p class="text-xs text-red-500 font-semibold mt-1 ml-3">{{ $message }}</p>
|
||||||
@enderror
|
@enderror
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,42 @@
|
||||||
<x-layout.app>
|
<x-layout.app>
|
||||||
<x-slot:page_title>{{ auditionSetting('advanceTo') }} Advancement - {{ $audition->name }}</x-slot:page_title>
|
<x-slot:page_title>{{ auditionSetting('advanceTo') }} Advancement - {{ $audition->name }}</x-slot:page_title>
|
||||||
<div class="grid grid-cols-4"></div>
|
<div class="grid grid-cols-4" x-data="checkboxSelector()">
|
||||||
<div class="grid grid-cols-4">
|
|
||||||
<div class="col-span-3">
|
<div class="col-span-3">
|
||||||
@include('tabulation.advancement.results-table')
|
@include('tabulation.advancement.results-table')
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-4">
|
<div class="ml-4">
|
||||||
{{-- @if($audition->hasFlag('seats_published'))--}}
|
@if($scoringComplete)
|
||||||
{{-- @include('tabulation.auditionSeating-show-published-seats')--}}
|
|
||||||
{{-- @elseif(! $auditionComplete)--}}
|
|
||||||
{{-- @include('tabulation.auditionSeating-unable-to-seat-card')--}}
|
|
||||||
{{-- @else--}}
|
|
||||||
{{-- @include('tabulation.auditionSeating-fill-seats-form')--}}
|
|
||||||
{{-- @include('tabulation.auditionSeating-show-proposed-seats')--}}
|
|
||||||
{{-- @endif--}}
|
|
||||||
|
|
||||||
|
<x-card.card>
|
||||||
|
<x-card.heading>Pass Entries</x-card.heading>
|
||||||
|
<div class="mx-6 mt-3">
|
||||||
|
<x-form.field name="markrows"
|
||||||
|
type="number"
|
||||||
|
label_text="Mark entries ranked 1 through"
|
||||||
|
x-model="numberOfCheckboxes"/>
|
||||||
|
|
||||||
|
<div class="flex justify-between mb-3">
|
||||||
|
<div></div>
|
||||||
|
<x-form.button type="button" class="mt-2" @click="checkCheckboxes">Mark</x-form.button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</x-card.card>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function checkboxSelector() {
|
||||||
|
return {
|
||||||
|
numberOfCheckboxes: 0,
|
||||||
|
checkCheckboxes() {
|
||||||
|
const checkboxes = document.querySelectorAll('.checkbox');
|
||||||
|
checkboxes.forEach((checkbox, index) => {
|
||||||
|
checkbox.checked = index < this.numberOfCheckboxes;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<x-table.th>Student Name</x-table.th>
|
<x-table.th>Student Name</x-table.th>
|
||||||
<x-table.th>Total Score</x-table.th>
|
<x-table.th>Total Score</x-table.th>
|
||||||
<x-table.th>All Scores?</x-table.th>
|
<x-table.th>All Scores?</x-table.th>
|
||||||
|
@if($scoringComplete)
|
||||||
|
<x-table.th>Pass?</x-table.th>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|
@ -15,6 +18,24 @@
|
||||||
@foreach($entries as $entry)
|
@foreach($entries as $entry)
|
||||||
<tr>
|
<tr>
|
||||||
<x-table.td>{{ $entry->rank }}</x-table.td>
|
<x-table.td>{{ $entry->rank }}</x-table.td>
|
||||||
|
<x-table.td>{{ $entry->id }}</x-table.td>
|
||||||
|
<x-table.td>{{ $entry->draw_number }}</x-table.td>
|
||||||
|
<x-table.td class="flex flex-col">
|
||||||
|
<span>{{ $entry->student->full_name() }}</span>
|
||||||
|
<span class="text-xs text-gray-400">{{ $entry->student->school->name }}</span>
|
||||||
|
</x-table.td>
|
||||||
|
<x-table.td>{{ number_format($entry->final_score_array[0] ?? 0,4) }}</x-table.td>
|
||||||
|
<x-table.td>
|
||||||
|
@if($entry->scoring_complete)
|
||||||
|
<x-icons.checkmark color="green"/>
|
||||||
|
@endif
|
||||||
|
</x-table.td>
|
||||||
|
@if($scoringComplete)
|
||||||
|
<x-table.td>
|
||||||
|
<x-form.checkbox name="pass-{{$entry->id}}" x-ref="checkboxes" class="checkbox"></x-form.checkbox>
|
||||||
|
</x-table.td>
|
||||||
|
@endif
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</x-table.body>
|
</x-table.body>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue