diff --git a/app/Http/Controllers/Tabulation/SeatAuditionFormController.php b/app/Http/Controllers/Tabulation/SeatAuditionFormController.php deleted file mode 100644 index 8220438..0000000 --- a/app/Http/Controllers/Tabulation/SeatAuditionFormController.php +++ /dev/null @@ -1,307 +0,0 @@ -id)); - if ($audition->hasFlag('seats_published')) { - $publishedSeats = Seat::where('audition_id', $audition->id) - ->join('ensembles', 'seats.ensemble_id', '=', 'ensembles.id') - ->orderBy('ensembles.rank') - ->orderBy('seats.seat') - ->select('seats.*') - ->with(['ensemble', 'student.school']) - ->get(); - } else { - $publishedSeats = false; - } - - $ranker = app(RankAuditionEntries::class); - // Get scored entries in order - try { - $scored_entries = $ranker($audition, 'seating'); - } catch (AuditionAdminException $e) { - return redirect()->route('seating.audition', ['audition' => $audition->id]) - ->with('error', $e->getMessage()); - } - - $scored_entries->load(['student.doublers', 'student.school']); - // Get unscored entries sorted by draw number - $unscored_entries = $audition->entries() - ->whereDoesntHave('totalScore') - ->whereDoesntHave('flags', function ($query) { - $query->where('flag_name', 'no_show'); - }) - ->whereDoesntHave('flags', function ($query) { - $query->where('flag_name', 'failed_prelim'); - }) - ->with('student.school') - ->withCount('scoreSheets') - ->orderBy('draw_number') - ->get(); - - // Get no show entries sorted by draw number - $noshow_entries = $audition->entries() - ->whereDoesntHave('totalScore') - ->whereHas('flags', function ($query) { - $query->where('flag_name', 'no_show'); - }) - ->with('student.school') - ->orderBy('draw_number') - ->get(); - - // Get failed prelim entries sorted by draw number - $failed_prelim_entries = $audition->entries() - ->whereDoesntHave('totalScore') - ->whereHas('flags', function ($query) { - $query->where('flag_name', 'failed_prelim'); - }) - ->with('student.school') - ->orderBy('draw_number') - ->get(); - - // Get Doublers - $doublerData = Doubler::where('event_id', $audition->event_id) - ->whereIn('student_id', $scored_entries->pluck('student_id')) - ->get() - ->keyBy('student_id'); - - $auditionHasUnresolvedDoublers = false; - foreach ($doublerData as $doubler) { - if (! is_null($doubler->accepted_entry)) { - continue; - } - foreach ($doubler->entries() as $entry) { - if ($entry->audition_id === $audition->id && $entry->hasFlag('declined')) { - continue 2; - } - } - $auditionHasUnresolvedDoublers = true; - } - - $canSeat = ! $auditionHasUnresolvedDoublers && $unscored_entries->count() === 0; - - return view('tabulation.auditionSeating', - compact('audition', - 'scored_entries', - 'unscored_entries', - 'noshow_entries', - 'failed_prelim_entries', - 'doublerData', - 'auditionHasUnresolvedDoublers', - 'canSeat', - 'seatingProposal', - 'publishedSeats', - ) - ); - } - - public function declineSeat(Audition $audition, Entry $entry) - { - $decider = app(DoublerDecision::class); - try { - $decider->decline($entry); - } catch (AuditionAdminException $e) { - return redirect()->route('seating.audition', ['audition' => $audition->id]) - ->with('error', $e->getMessage()); - } - - return redirect()->route('seating.audition', ['audition' => $audition->id])->with('success', - $entry->student->full_name().' has declined '.$audition->name); - } - - public function massDecline(Audition $audition) - { - $decider = app(DoublerDecision::class); - $validData = request()->validate([ - 'decline-below' => ['required', 'integer', 'min:0'], - ]); - $ranker = app(RankAuditionEntries::class); - // Get scored entries in order - try { - $scored_entries = $ranker($audition, 'seating'); - } catch (AuditionAdminException $e) { - return redirect()->route('seating.audition', ['audition' => $audition->id]) - ->with('error', $e->getMessage()); - } - $scored_entries->load(['student.doublers', 'student.school']); - foreach ($scored_entries as $entry) { - Debugbar::info('Starting entry '.$entry->student->full_name()); - if ($entry->seatingRank < $validData['decline-below']) { - Debugbar::info('Skipping '.$entry->student->full_name().' because they are ranked above decline threshold'); - - continue; - } - if ($entry->hasFlag('declined')) { - Debugbar::info('Skipping '.$entry->student->full_name().' because they have already been declined'); - - continue; - } - if (! $entry->student->isDoublerInEvent($audition->event_id)) { - Debugbar::info('Skipping '.$entry->student->full_name().' because they are not a doubler'); - - continue; - } - if ($entry->student->doublers->where('event_id', $audition->event_id)->first()->accepted_entry) { - Debugbar::info('Skipping '.$entry->student->full_name().' because they have already accepted a seat'); - - continue; - } - try { - $decider->decline($entry); - } catch (AuditionAdminException $e) { - return redirect()->route('seating.audition', ['audition' => $audition->id]) - ->with('error', $e->getMessage()); - } - } - Cache::forget('rank_seating_'.$audition->id); - - return redirect()->route('seating.audition', ['audition' => $audition->id]); - - } - - public function acceptSeat(Audition $audition, Entry $entry) - { - $decider = app(DoublerDecision::class); - try { - $decider->accept($entry); - } catch (AuditionAdminException $e) { - return redirect()->route('seating.audition', ['audition' => $audition->id]) - ->with('error', $e->getMessage()); - } - - return redirect()->route('seating.audition', ['audition' => $audition->id])->with('success', - $entry->student->full_name().' has accepted '.$audition->name); - } - - public function noshow( - Audition $audition, - Entry $entry - ) { - $recorder = app('App\Actions\Tabulation\EnterNoShow'); - try { - $msg = $recorder($entry); - } catch (AuditionAdminException $e) { - return redirect()->back()->with('error', $e->getMessage()); - } - - return redirect()->route('seating.audition', [$audition])->with('success', $msg); - } - - public function draftSeats( - Audition $audition, - Request $request - ) { - $ranker = app(RankAuditionEntries::class); - $validated = $request->validate([ - 'ensemble' => ['required', 'array'], - 'ensemble.*' => ['required', 'integer', 'min:0'], - ]); - $proposedSeatingArray = []; - try { - $rankedEntries = $ranker($audition, 'seating'); - } catch (AuditionAdminException $e) { - return redirect()->route('seating.audition', ['audition' => $audition->id]) - ->with('error', $e->getMessage()); - } - $rankedEntries = $rankedEntries->reject(function ($entry) { - return $entry->hasFlag('declined'); - }); - - $rankedEntries->load(['student.school']); - $rankedEnsembles = Ensemble::orderBy('rank')->where('event_id', $audition->event_id)->get(); - $ensembleRankOn = 1; - foreach ($rankedEnsembles as $ensemble) { - if (! Arr::has($validated['ensemble'], $ensemble->id)) { - continue; - } - $proposedSeatingArray[$ensembleRankOn]['ensemble_id'] = $ensemble->id; - $proposedSeatingArray[$ensembleRankOn]['ensemble_name'] = $ensemble->name; - $proposedSeatingArray[$ensembleRankOn]['accept_count'] = $validated['ensemble'][$ensemble->id]; - for ($n = 1; $n <= $validated['ensemble'][$ensemble->id]; $n++) { - // Escape the loop if we're out of entries - if ($rankedEntries->isEmpty()) { - break; - } - - $thisEntry = $rankedEntries->shift(); - $proposedSeatingArray[$ensembleRankOn]['seats'][$n]['seat'] = $n; - $proposedSeatingArray[$ensembleRankOn]['seats'][$n]['entry_id'] = $thisEntry->id; - $proposedSeatingArray[$ensembleRankOn]['seats'][$n]['entry_name'] = $thisEntry->student->full_name(); - $proposedSeatingArray[$ensembleRankOn]['seats'][$n]['entry_school'] = $thisEntry->student->school->name; - } - - $ensembleRankOn++; - } - $sessionKeyName = 'proposedSeatingArray-'.$audition->id; - $request->session()->put($sessionKeyName, $proposedSeatingArray); - - return redirect()->route('seating.audition', ['audition' => $audition->id]); - } - - public function clearDraft( - Audition $audition - ) { - session()->forget('proposedSeatingArray-'.$audition->id); - - return redirect()->route('seating.audition', ['audition' => $audition->id]); - } - - public function publishSeats( - Audition $audition - ) { - $publisher = app('App\Actions\Tabulation\PublishSeats'); - $seatingProposal = (session('proposedSeatingArray-'.$audition->id)); - $proposal = []; - foreach ($seatingProposal as $ensemble) { - $ensembleId = $ensemble['ensemble_id']; - if (isset($ensemble['seats'])) { - foreach ($ensemble['seats'] as $seat) { - $proposal[] = [ - 'ensemble_id' => $ensembleId, - 'audition_id' => $audition->id, - 'seat' => $seat['seat'], - 'entry_id' => $seat['entry_id'], - ]; - } - } - } - try { - $publisher($audition, $proposal); - } catch (AuditionAdminException $e) { - return redirect()->route('seating.audition', [$audition])->with('error', $e->getMessage()); - } - session()->forget('proposedSeatingArray-'.$audition->id); - - return redirect()->route('seating.audition', [$audition]); - } - - public function unpublishSeats( - Audition $audition - ) { - $unpublisher = app('App\Actions\Tabulation\UnpublishSeats'); - $unpublisher($audition); - session()->forget('proposedSeatingArray-'.$audition->id); - - return redirect()->route('seating.audition', [$audition]); - } -} diff --git a/app/Http/Controllers/Tabulation/Seating/EnterDoublerDecisionsController.php b/app/Http/Controllers/Tabulation/Seating/EnterDoublerDecisionsController.php new file mode 100644 index 0000000..0149f03 --- /dev/null +++ b/app/Http/Controllers/Tabulation/Seating/EnterDoublerDecisionsController.php @@ -0,0 +1,109 @@ +back()->with('error', $e->getMessage()); + } + + return redirect()->route('seating.audition', [$audition])->with('success', $msg); + } + + public function declineSeat(Audition $audition, Entry $entry) + { + $decider = app(DoublerDecision::class); + try { + $decider->decline($entry); + } catch (AuditionAdminException $e) { + return redirect()->route('seating.audition', ['audition' => $audition->id]) + ->with('error', $e->getMessage()); + } + + return redirect()->route('seating.audition', ['audition' => $audition->id])->with('success', + $entry->student->full_name().' has declined '.$audition->name); + } + + public function massDecline(Audition $audition) + { + $decider = app(DoublerDecision::class); + $validData = request()->validate([ + 'decline-below' => ['required', 'integer', 'min:0'], + ]); + $ranker = app(RankAuditionEntries::class); + // Get scored entries in order + try { + $scored_entries = $ranker($audition, 'seating'); + } catch (AuditionAdminException $e) { + return redirect()->route('seating.audition', ['audition' => $audition->id]) + ->with('error', $e->getMessage()); + } + $scored_entries->load(['student.doublers', 'student.school']); + foreach ($scored_entries as $entry) { + Debugbar::info('Starting entry '.$entry->student->full_name()); + if ($entry->seatingRank < $validData['decline-below']) { + Debugbar::info('Skipping '.$entry->student->full_name().' because they are ranked above decline threshold'); + + continue; + } + if ($entry->hasFlag('declined')) { + Debugbar::info('Skipping '.$entry->student->full_name().' because they have already been declined'); + + continue; + } + if (! $entry->student->isDoublerInEvent($audition->event_id)) { + Debugbar::info('Skipping '.$entry->student->full_name().' because they are not a doubler'); + + continue; + } + if ($entry->student->doublers->where('event_id', $audition->event_id)->first()->accepted_entry) { + Debugbar::info('Skipping '.$entry->student->full_name().' because they have already accepted a seat'); + + continue; + } + try { + $decider->decline($entry); + } catch (AuditionAdminException $e) { + return redirect()->route('seating.audition', ['audition' => $audition->id]) + ->with('error', $e->getMessage()); + } + } + Cache::forget('rank_seating_'.$audition->id); + + return redirect()->route('seating.audition', ['audition' => $audition->id]); + + } + + public function acceptSeat(Audition $audition, Entry $entry) + { + $decider = app(DoublerDecision::class); + try { + $decider->accept($entry); + } catch (AuditionAdminException $e) { + return redirect()->route('seating.audition', ['audition' => $audition->id]) + ->with('error', $e->getMessage()); + } + + return redirect()->route('seating.audition', ['audition' => $audition->id])->with('success', + $entry->student->full_name().' has accepted '.$audition->name); + } +} diff --git a/app/Http/Controllers/Tabulation/Seating/MakeSeatingDecisionsController.php b/app/Http/Controllers/Tabulation/Seating/MakeSeatingDecisionsController.php new file mode 100644 index 0000000..540bff0 --- /dev/null +++ b/app/Http/Controllers/Tabulation/Seating/MakeSeatingDecisionsController.php @@ -0,0 +1,75 @@ +validate([ + 'ensemble' => ['required', 'array'], + 'ensemble.*' => ['required', 'integer', 'min:0'], + ]); + $proposedSeatingArray = []; + try { + $rankedEntries = $ranker($audition, 'seating'); + } catch (AuditionAdminException $e) { + return redirect()->route('seating.audition', ['audition' => $audition->id]) + ->with('error', $e->getMessage()); + } + $rankedEntries = $rankedEntries->reject(function ($entry) { + return $entry->hasFlag('declined'); + }); + + $rankedEntries->load(['student.school']); + $rankedEnsembles = Ensemble::orderBy('rank')->where('event_id', $audition->event_id)->get(); + $ensembleRankOn = 1; + foreach ($rankedEnsembles as $ensemble) { + if (! Arr::has($validated['ensemble'], $ensemble->id)) { + continue; + } + $proposedSeatingArray[$ensembleRankOn]['ensemble_id'] = $ensemble->id; + $proposedSeatingArray[$ensembleRankOn]['ensemble_name'] = $ensemble->name; + $proposedSeatingArray[$ensembleRankOn]['accept_count'] = $validated['ensemble'][$ensemble->id]; + for ($n = 1; $n <= $validated['ensemble'][$ensemble->id]; $n++) { + // Escape the loop if we're out of entries + if ($rankedEntries->isEmpty()) { + break; + } + + $thisEntry = $rankedEntries->shift(); + $proposedSeatingArray[$ensembleRankOn]['seats'][$n]['seat'] = $n; + $proposedSeatingArray[$ensembleRankOn]['seats'][$n]['entry_id'] = $thisEntry->id; + $proposedSeatingArray[$ensembleRankOn]['seats'][$n]['entry_name'] = $thisEntry->student->full_name(); + $proposedSeatingArray[$ensembleRankOn]['seats'][$n]['entry_school'] = $thisEntry->student->school->name; + } + + $ensembleRankOn++; + } + $sessionKeyName = 'proposedSeatingArray-'.$audition->id; + $request->session()->put($sessionKeyName, $proposedSeatingArray); + + return redirect()->route('seating.audition', ['audition' => $audition->id]); + } + + public function clearDraft( + Audition $audition + ) { + session()->forget('proposedSeatingArray-'.$audition->id); + + return redirect()->route('seating.audition', ['audition' => $audition->id]); + } +} diff --git a/app/Http/Controllers/Tabulation/Seating/PublishSeatingController.php b/app/Http/Controllers/Tabulation/Seating/PublishSeatingController.php new file mode 100644 index 0000000..d0fa947 --- /dev/null +++ b/app/Http/Controllers/Tabulation/Seating/PublishSeatingController.php @@ -0,0 +1,51 @@ +id)); + $proposal = []; + foreach ($seatingProposal as $ensemble) { + $ensembleId = $ensemble['ensemble_id']; + if (isset($ensemble['seats'])) { + foreach ($ensemble['seats'] as $seat) { + $proposal[] = [ + 'ensemble_id' => $ensembleId, + 'audition_id' => $audition->id, + 'seat' => $seat['seat'], + 'entry_id' => $seat['entry_id'], + ]; + } + } + } + try { + $publisher($audition, $proposal); + } catch (AuditionAdminException $e) { + return redirect()->route('seating.audition', [$audition])->with('error', $e->getMessage()); + } + session()->forget('proposedSeatingArray-'.$audition->id); + + return redirect()->route('seating.audition', [$audition]); + } + + public function unpublishSeats( + Audition $audition + ) { + $unpublisher = app('App\Actions\Tabulation\UnpublishSeats'); + $unpublisher($audition); + session()->forget('proposedSeatingArray-'.$audition->id); + + return redirect()->route('seating.audition', [$audition]); + } +} diff --git a/app/Http/Controllers/Tabulation/Seating/ShowAuditionSeatingPage.php b/app/Http/Controllers/Tabulation/Seating/ShowAuditionSeatingPage.php new file mode 100644 index 0000000..79d6b52 --- /dev/null +++ b/app/Http/Controllers/Tabulation/Seating/ShowAuditionSeatingPage.php @@ -0,0 +1,110 @@ +id)); + if ($audition->hasFlag('seats_published')) { + $publishedSeats = Seat::where('audition_id', $audition->id) + ->join('ensembles', 'seats.ensemble_id', '=', 'ensembles.id') + ->orderBy('ensembles.rank') + ->orderBy('seats.seat') + ->select('seats.*') + ->with(['ensemble', 'student.school']) + ->get(); + } else { + $publishedSeats = false; + } + + $ranker = app(RankAuditionEntries::class); + // Get scored entries in order + try { + $scored_entries = $ranker($audition, 'seating'); + } catch (AuditionAdminException $e) { + return redirect()->route('seating.audition', ['audition' => $audition->id]) + ->with('error', $e->getMessage()); + } + + $scored_entries->load(['student.doublers', 'student.school']); + // Get unscored entries sorted by draw number + $unscored_entries = $audition->entries() + ->whereDoesntHave('totalScore') + ->whereDoesntHave('flags', function ($query) { + $query->where('flag_name', 'no_show'); + }) + ->whereDoesntHave('flags', function ($query) { + $query->where('flag_name', 'failed_prelim'); + }) + ->with('student.school') + ->withCount('scoreSheets') + ->orderBy('draw_number') + ->get(); + + // Get no show entries sorted by draw number + $noshow_entries = $audition->entries() + ->whereDoesntHave('totalScore') + ->whereHas('flags', function ($query) { + $query->where('flag_name', 'no_show'); + }) + ->with('student.school') + ->orderBy('draw_number') + ->get(); + + // Get failed prelim entries sorted by draw number + $failed_prelim_entries = $audition->entries() + ->whereDoesntHave('totalScore') + ->whereHas('flags', function ($query) { + $query->where('flag_name', 'failed_prelim'); + }) + ->with('student.school') + ->orderBy('draw_number') + ->get(); + + // Get Doublers + $doublerData = Doubler::where('event_id', $audition->event_id) + ->whereIn('student_id', $scored_entries->pluck('student_id')) + ->get() + ->keyBy('student_id'); + + $auditionHasUnresolvedDoublers = false; + foreach ($doublerData as $doubler) { + if (! is_null($doubler->accepted_entry)) { + continue; + } + foreach ($doubler->entries() as $entry) { + if ($entry->audition_id === $audition->id && $entry->hasFlag('declined')) { + continue 2; + } + } + $auditionHasUnresolvedDoublers = true; + } + + $canSeat = ! $auditionHasUnresolvedDoublers && $unscored_entries->count() === 0; + + return view('tabulation.seating-page.auditionSeating', + compact('audition', + 'scored_entries', + 'unscored_entries', + 'noshow_entries', + 'failed_prelim_entries', + 'doublerData', + 'auditionHasUnresolvedDoublers', + 'canSeat', + 'seatingProposal', + 'publishedSeats', + ) + ); + } +} diff --git a/resources/views/tabulation/auditionSeating-doubler-block-OLD.blade.php b/resources/views/tabulation/auditionSeating-doubler-block-OLD.blade.php deleted file mode 100644 index 9f7635d..0000000 --- a/resources/views/tabulation/auditionSeating-doubler-block-OLD.blade.php +++ /dev/null @@ -1,55 +0,0 @@ -@php($doublerButtonClasses = 'hidden rounded-md bg-white px-2.5 py-1.5 text-xs text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:block') - - -{{--Complete Badge--}} -{{--

Complete

--}} - -{{--In Progres Badge--}} -{{--

In Progress

--}} diff --git a/resources/views/tabulation/auditionSeating-fill-seats-form.blade.php b/resources/views/tabulation/auditionSeating-fill-seats-form.blade.php deleted file mode 100644 index dd5794c..0000000 --- a/resources/views/tabulation/auditionSeating-fill-seats-form.blade.php +++ /dev/null @@ -1,26 +0,0 @@ - - @php - @endphp - Seating -
- - @csrf - @foreach($rightPanel['data'] as $ensembleLimit) - @php - $value = $requestedEnsembleAccepts[$ensembleLimit['ensemble']->id] ?? $ensembleLimit['limit']; -// $value = $ensembleLimit['limit']; - @endphp - - - @endforeach - - Seat - - -
-
diff --git a/resources/views/tabulation/auditionSeating-results-table.blade.php b/resources/views/tabulation/auditionSeating-results-table.blade.php deleted file mode 100644 index 0e3552d..0000000 --- a/resources/views/tabulation/auditionSeating-results-table.blade.php +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Rank - ID - Draw # - Student Name - Doubler - {{-- @foreach($judges as $judge)--}} - {{-- {{ $judge->short_name() }}--}} - {{-- @endforeach--}} - - Total Score - @if($audition->bonusScore()->count() > 0) -
-
- - Has Bonus -
- @endif -
- All Scores? - - - - - @foreach($entryData as $entry) - - {{ $entry['rank'] }} - {{ $entry['id'] }} - {{ $entry['drawNumber'] }} - - {{ $entry['studentName'] }} - {{ $entry['schoolName'] }} - - - @if($entry['doubleData']) - @if($entry['doublerRequest']) -

Request: {{$entry['doublerRequest']}} -

- @endif - @include('tabulation.auditionSeating-doubler-block-OLD') - {{-- DOUBLER
--}} - {{-- @foreach($entry['doubleData'] as $double)--}} - {{-- ID: {{ $double['entryId'] }} - {{ $double['name'] }} - {{ $double['rank'] }}
--}} - {{-- Unscored Entries: {{ $double['unscored_in_audition'] }}
--}} - {{-- @foreach($double['limits'] as $limit)--}} - {{-- {{$limit['ensemble']->name}}: {{ $limit['limit'] }}
--}} - {{-- @endforeach--}} - {{--
--}} - {{-- @endforeach--}} - @endif - {{-- @if($doublerService->studentIsDoubler($entry->student_id))--}} - {{-- @include('tabulation.auditionSeating-doubler-block')--}} - {{-- @endif--}} -
- - -
- {{ $entry['totalScore'] }} - @if($audition->bonusScore()->count() > 0 && $entry['hasBonusScores']) - - @endif -
-
- - @if($entry['fullyScored']) - - @endif - - - @endforeach -
-
- -
diff --git a/resources/views/tabulation/auditionSeating-right-complete-not-published.blade.php b/resources/views/tabulation/auditionSeating-right-complete-not-published.blade.php deleted file mode 100644 index 27797b3..0000000 --- a/resources/views/tabulation/auditionSeating-right-complete-not-published.blade.php +++ /dev/null @@ -1,2 +0,0 @@ -@include('tabulation.auditionSeating-fill-seats-form') -@include('tabulation.auditionSeating-show-proposed-seats') diff --git a/resources/views/tabulation/auditionSeating-show-proposed-seats.blade.php b/resources/views/tabulation/auditionSeating-show-proposed-seats.blade.php deleted file mode 100644 index dd00bfa..0000000 --- a/resources/views/tabulation/auditionSeating-show-proposed-seats.blade.php +++ /dev/null @@ -1,38 +0,0 @@ -@php - $seatingProposal = []; -@endphp - -@foreach($rightPanel['data'] as $ensembleLimit) - - {{ $ensembleLimit['ensemble']->name }} - DRAFT - - @php - $maxAccepted = $requestedEnsembleAccepts[$ensembleLimit['ensemble']->id] ?? $ensembleLimit['limit']; -// $maxAccepted = $ensembleLimit['limit']; - @endphp - @for($n=1; $n <= $maxAccepted; $n++) - @php - $entry = $seatableEntries->shift(); - if (is_null($entry)) continue; - $seatingProposal[] = [ - 'ensemble_id' => $ensembleLimit['ensemble']->id, - 'audition_id' => $audition->id, - 'seat' => $n, - 'entry_id' => $entry->id, - ]; - @endphp - - - {{ $n }} - {{ $entry->student->full_name() }} - - @endfor - - -@endforeach -
- @csrf -Seat and Publish -
-@php - session(['audition' . $audition->id . 'seatingProposal' => $seatingProposal]); -@endphp diff --git a/resources/views/tabulation/auditionSeating-show-published-seats.blade.php b/resources/views/tabulation/auditionSeating-show-published-seats.blade.php deleted file mode 100644 index ef920a1..0000000 --- a/resources/views/tabulation/auditionSeating-show-published-seats.blade.php +++ /dev/null @@ -1,46 +0,0 @@ - - - Seats are Published - - - - - Unpublish - - - - - - - @php - $previousEnsemble = null; - @endphp - @foreach($rightPanel['data'] as $seat) - @if($seat['ensemble'] !== $previousEnsemble) - {{$seat['ensemble']}} - @endif - - {{ $seat['seat'] }} - {{ $seat['student_name'] }} - - @php - - $previousEnsemble = $seat['ensemble']; - @endphp - @endforeach - -{{--@foreach($ensembleLimits as $ensembleLimit)--}} -{{-- @php--}} -{{-- $ensembleSeats = $seatingService->getSeatsForAudition($audition->id)[$ensembleLimit->ensemble->id] ?? array();--}} -{{-- @endphp--}} -{{-- --}} -{{-- {{ $ensembleLimit->ensemble->name }}--}} -{{-- @foreach($ensembleSeats as $seat)--}} -{{-- --}} -{{-- {{ $seat->seat }} - {{ $seat->student->full_name() }}--}} -{{-- --}} -{{-- @endforeach--}} - -{{-- --}} -{{--@endforeach--}} diff --git a/resources/views/tabulation/auditionSeating-unable-to-seat-card.blade.php b/resources/views/tabulation/auditionSeating-unable-to-seat-card.blade.php deleted file mode 100644 index cca0ef8..0000000 --- a/resources/views/tabulation/auditionSeating-unable-to-seat-card.blade.php +++ /dev/null @@ -1,20 +0,0 @@ - - Unable to seat this audition - @if(! $rightPanel['data']['allScored']) -

The audition cannot be seated while it has unscored entries.

-
- Unscored entries are No-Shows -
- @endif - - @if(! $rightPanel['data']['allScored'] && ! $rightPanel['data']['doublersResolved']) -
- @endif - @if(! $rightPanel['data']['doublersResolved']) -

The audition cannot be seated while it has unresolved doublers.

- - - Decline Doublers - - @endif -
diff --git a/resources/views/tabulation/auditionSeating.blade.php b/resources/views/tabulation/auditionSeating.blade.php deleted file mode 100644 index 647171b..0000000 --- a/resources/views/tabulation/auditionSeating.blade.php +++ /dev/null @@ -1,271 +0,0 @@ - - Audition Seating - {{ $audition->name }} -
- -
{{-- Entry Ranking Table --}} - {{-- Scored Entries --}} - Scored Entries - - - - Rank - ID - Draw # - Student - Doubler - Total Score - @if($audition->bonusScore()->count() > 0) -
-
- No Bonus Score -
- @endif -
- - - - @foreach($scored_entries as $entry) - - {{ $entry->seatingRank }} - {{ $entry->id }} - {{ $entry->draw_number }} - - -
{{ $entry->student->school->name }}
-
- - @php($doubler = $doublerData->get($entry->student_id)) - @if($doubler) - @if($doubler->accepted_entry == $entry->id) - ACCEPTED - @elseif($entry->hasFlag('declined')) - DECLINED - @else - @if($request = $entry->student->doublerRequests()->where('event_id',$entry->audition->event_id)->first()) -
{{-- Begin block seating request --}} -
- Request -
-
-

{{ $request->request }}

-
- -
- - @endif - @foreach($entry->student->entriesForEvent($entry->audition->event_id) as $de) - @include('tabulation.auditionSeating-doubler-block') - @endforeach - @endif - @endif - - -
- - @if($audition->bonusScore()->count() > 0) - @if($entry->totalScore->bonus_total) - {{ $entry->totalScore->seating_total_with_bonus }} - @else - {{ $entry->totalScore->seating_total_with_bonus }} - @endif - @else - {{ $entry->totalScore->seating_total }} - @endif - - - @endforeach - -
-
- - {{-- Unscored Entries --}} - Unscored Entries - - - - Draw # - ID - Student - Judges
Scored
- - - - - @foreach($unscored_entries as $entry) - - {{ $entry->draw_number }} - {{ $entry->id }} - - {{ $entry->student->full_name() }} - {{ $entry->student->school->name }} - - - {{ $entry->score_sheets_count }} - - - - Record No Show - - - - @endforeach - -
-
- - {{-- No Show Entries --}} - No Show Entries - - - - Draw # - ID - Student - - - - @foreach($noshow_entries as $entry) - - {{ $entry->draw_number }} - {{ $entry->id }} - - {{ $entry->student->full_name() }} - {{ $entry->student->school->name }} - - - @endforeach - - - - - {{-- Failed Prelim Entries --}} - Failed Prelim Entries - - - - Draw # - ID - Student - - - - @foreach($failed_prelim_entries as $entry) - - {{ $entry->draw_number }} - {{ $entry->id }} - - {{ $entry->student->full_name() }} - {{ $entry->student->school->name }} - - - @endforeach - - - - - -
- -
{{-- Right Column Wrapper --}} - @if($audition->hasFlag('seats_published')) - - Published Results - - @php($previousEnsemble = '') - @foreach($publishedSeats as $seat) - @if($previousEnsemble !== $seat->ensemble->name) - @php($previousEnsemble = $seat->ensemble->name) - {{ $seat->ensemble->name }} - @endif - -
-

{{ $seat->seat }}. {{ $seat->student->full_name() }}

-

{{ $seat->student->school->name }}

-
-
- @endforeach -
-
- - - Unpublish Results - - @else - @if($canSeat) - @if($seatingProposal) - - - Seating Proposal - Results are not yet published - - @foreach($seatingProposal as $proposedEnsemble) -

{{ $proposedEnsemble['ensemble_name'] }}

- - @if(isset($proposedEnsemble['seats'])) - @foreach($proposedEnsemble['seats'] as $seat) - {{ $seat['seat'] }} - . {{ $seat['entry_name'] }} - @endforeach - @endif - - @endforeach - - Clear Draft - - {{-- TODO Hide the publish button if there are no seats --}} - - Publish - -
- @else - - - Seat Audition - Choose how many entries to seat in each ensemble - - - @foreach($audition->SeatingLimits()->where('maximum_accepted','>',0)->get() as $limit) - - {{$limit->ensemble->name}} - @for($n = 0; $n< $limit->maximum_accepted; $n++) - - @endfor - - - @endforeach - Draft Seats - - - @endif - @else -
- @if($unscored_entries->count() > 0) - - Cannot seat the audition while entries are unscored. - - @endif - - @if($auditionHasUnresolvedDoublers) - -

Cannot seat the audition while there are unresolved doublers.

- - - Decline - -
- @endif -
- @endif - @endif -
- - -
- - -
diff --git a/resources/views/tabulation/auditionSeatingOLD.blade.php b/resources/views/tabulation/auditionSeatingOLD.blade.php deleted file mode 100644 index 065ae86..0000000 --- a/resources/views/tabulation/auditionSeatingOLD.blade.php +++ /dev/null @@ -1,30 +0,0 @@ -@inject('doublerService','App\Services\DoublerService') -@php - $blockSeating = [] -@endphp - - Audition Seating - {{ $audition->name }} -
-
-
- @include('tabulation.auditionSeating-results-table') -
-
- @include($rightPanel['view']) -
-{{--
--}} -{{-- @if($audition->hasFlag('seats_published'))--}} -{{-- @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--}} - - -{{--
--}} -
- - -
diff --git a/resources/views/tabulation/seating-page/auditionSeating.blade.php b/resources/views/tabulation/seating-page/auditionSeating.blade.php new file mode 100644 index 0000000..b58af50 --- /dev/null +++ b/resources/views/tabulation/seating-page/auditionSeating.blade.php @@ -0,0 +1,35 @@ + + Audition Seating - {{ $audition->name }} +
+ +
{{-- Entry Ranking Table --}} + @include('tabulation.seating-page.scored-entries-table') + + @include('tabulation.seating-page.unscored-entries-table') + + @include('tabulation.seating-page.no-show-entries-table') + + @include('tabulation.seating-page.failed-prelim-entries') +
+ +
{{-- Right Column Wrapper --}} + @if($audition->hasFlag('seats_published')) + @include('tabulation.seating-page.right-column.published-results') + @else + @if($canSeat) + @if($seatingProposal) + @include('tabulation.seating-page.right-column.unpublished-results-proposal') + @else + @include('tabulation.seating-page.right-column.form-to-propose-seats') + @endif + @else + @include('tabulation.seating-page.right-column.not-ready-to-seat') + @endif + @endif +
+ + +
+ + +
diff --git a/resources/views/tabulation/auditionSeating-doubler-block.blade.php b/resources/views/tabulation/seating-page/doubler-block.blade.php similarity index 100% rename from resources/views/tabulation/auditionSeating-doubler-block.blade.php rename to resources/views/tabulation/seating-page/doubler-block.blade.php diff --git a/resources/views/tabulation/seating-page/failed-prelim-entries.blade.php b/resources/views/tabulation/seating-page/failed-prelim-entries.blade.php new file mode 100644 index 0000000..6f76da6 --- /dev/null +++ b/resources/views/tabulation/seating-page/failed-prelim-entries.blade.php @@ -0,0 +1,24 @@ + {{-- Failed Prelim Entries --}} + Failed Prelim Entries + + + + Draw # + ID + Student + + + + @foreach($failed_prelim_entries as $entry) + + {{ $entry->draw_number }} + {{ $entry->id }} + + {{ $entry->student->full_name() }} + {{ $entry->student->school->name }} + + + @endforeach + + + diff --git a/resources/views/tabulation/seating-page/no-show-entries-table.blade.php b/resources/views/tabulation/seating-page/no-show-entries-table.blade.php new file mode 100644 index 0000000..3791cd0 --- /dev/null +++ b/resources/views/tabulation/seating-page/no-show-entries-table.blade.php @@ -0,0 +1,24 @@ + {{-- No Show Entries --}} + No Show Entries + + + + Draw # + ID + Student + + + + @foreach($noshow_entries as $entry) + + {{ $entry->draw_number }} + {{ $entry->id }} + + {{ $entry->student->full_name() }} + {{ $entry->student->school->name }} + + + @endforeach + + + diff --git a/resources/views/tabulation/seating-page/right-column/form-to-propose-seats.blade.php b/resources/views/tabulation/seating-page/right-column/form-to-propose-seats.blade.php new file mode 100644 index 0000000..7789279 --- /dev/null +++ b/resources/views/tabulation/seating-page/right-column/form-to-propose-seats.blade.php @@ -0,0 +1,18 @@ + + + Seat Audition + Choose how many entries to seat in each ensemble + + + @foreach($audition->SeatingLimits()->where('maximum_accepted','>',0)->get() as $limit) + + {{$limit->ensemble->name}} + @for($n = 0; $n< $limit->maximum_accepted; $n++) + + @endfor + + + @endforeach + Draft Seats + + diff --git a/resources/views/tabulation/seating-page/right-column/not-ready-to-seat.blade.php b/resources/views/tabulation/seating-page/right-column/not-ready-to-seat.blade.php new file mode 100644 index 0000000..28dd3d3 --- /dev/null +++ b/resources/views/tabulation/seating-page/right-column/not-ready-to-seat.blade.php @@ -0,0 +1,20 @@ +
+ @if($unscored_entries->count() > 0) + + Cannot seat the audition while entries are unscored. + + @endif + + @if($auditionHasUnresolvedDoublers) + +

Cannot seat the audition while there are unresolved + doublers.

+ + + Decline + +
+ @endif +
diff --git a/resources/views/tabulation/seating-page/right-column/published-results.blade.php b/resources/views/tabulation/seating-page/right-column/published-results.blade.php new file mode 100644 index 0000000..d0cf512 --- /dev/null +++ b/resources/views/tabulation/seating-page/right-column/published-results.blade.php @@ -0,0 +1,22 @@ + + Published Results + + @php($previousEnsemble = '') + @foreach($publishedSeats as $seat) + @if($previousEnsemble !== $seat->ensemble->name) + @php($previousEnsemble = $seat->ensemble->name) + {{ $seat->ensemble->name }} + @endif + +
+

{{ $seat->seat }}. {{ $seat->student->full_name() }}

+

{{ $seat->student->school->name }}

+
+
+ @endforeach +
+
+ + + Unpublish Results + diff --git a/resources/views/tabulation/seating-page/right-column/unpublished-results-proposal.blade.php b/resources/views/tabulation/seating-page/right-column/unpublished-results-proposal.blade.php new file mode 100644 index 0000000..06580c4 --- /dev/null +++ b/resources/views/tabulation/seating-page/right-column/unpublished-results-proposal.blade.php @@ -0,0 +1,25 @@ + + + Seating Proposal + Results are not yet published + + @foreach($seatingProposal as $proposedEnsemble) +

{{ $proposedEnsemble['ensemble_name'] }}

+ + @if(isset($proposedEnsemble['seats'])) + @foreach($proposedEnsemble['seats'] as $seat) + {{ $seat['seat'] }} + . {{ $seat['entry_name'] }} + @endforeach + @endif + + @endforeach + + Clear Draft + + {{-- TODO Hide the publish button if there are no seats --}} + + Publish + +
diff --git a/resources/views/tabulation/seating-page/scored-entries-table.blade.php b/resources/views/tabulation/seating-page/scored-entries-table.blade.php new file mode 100644 index 0000000..9f1d45c --- /dev/null +++ b/resources/views/tabulation/seating-page/scored-entries-table.blade.php @@ -0,0 +1,78 @@ + {{-- Scored Entries --}} + Scored Entries + + + + Rank + ID + Draw # + Student + Doubler + Total Score + @if($audition->bonusScore()->count() > 0) +
+
+ No Bonus Score +
+ @endif +
+ + + + @foreach($scored_entries as $entry) + + {{ $entry->seatingRank }} + {{ $entry->id }} + {{ $entry->draw_number }} + +
+ {{ $entry->student->full_name() }} +
+
{{ $entry->student->school->name }}
+
+ + @php($doubler = $doublerData->get($entry->student_id)) + @if($doubler) + @if($doubler->accepted_entry == $entry->id) + ACCEPTED + @elseif($entry->hasFlag('declined')) + DECLINED + @else + @if($request = $entry->student->doublerRequests()->where('event_id',$entry->audition->event_id)->first()) +
{{-- Begin block seating request --}} +
+ Request +
+
+

{{ $request->request }}

+
+ +
+ + @endif + @foreach($entry->student->entriesForEvent($entry->audition->event_id) as $de) + @include('tabulation.seating-page.doubler-block') + @endforeach + @endif + @endif + + +
+ + @if($audition->bonusScore()->count() > 0) + @if($entry->totalScore->bonus_total) + {{ $entry->totalScore->seating_total_with_bonus }} + @else + {{ $entry->totalScore->seating_total_with_bonus }} + @endif + @else + {{ $entry->totalScore->seating_total }} + @endif + + + @endforeach + +
+
diff --git a/resources/views/tabulation/seating-page/unscored-entries-table.blade.php b/resources/views/tabulation/seating-page/unscored-entries-table.blade.php new file mode 100644 index 0000000..f1f6402 --- /dev/null +++ b/resources/views/tabulation/seating-page/unscored-entries-table.blade.php @@ -0,0 +1,35 @@ + {{-- Unscored Entries --}} + Unscored Entries + + + + Draw # + ID + Student + Judges
Scored
+ + + + + @foreach($unscored_entries as $entry) + + {{ $entry->draw_number }} + {{ $entry->id }} + + {{ $entry->student->full_name() }} + {{ $entry->student->school->name }} + + + {{ $entry->score_sheets_count }} + + + + Record No Show + + + + @endforeach + +
+
diff --git a/routes/tabulation.php b/routes/tabulation.php index b566875..d2e5ab1 100644 --- a/routes/tabulation.php +++ b/routes/tabulation.php @@ -6,7 +6,10 @@ use App\Http\Controllers\Tabulation\BonusScoreController; use App\Http\Controllers\Tabulation\DoublerDecisionController; use App\Http\Controllers\Tabulation\EntryFlagController; use App\Http\Controllers\Tabulation\ScoreController; -use App\Http\Controllers\Tabulation\SeatAuditionFormController; +use App\Http\Controllers\Tabulation\Seating\EnterDoublerDecisionsController; +use App\Http\Controllers\Tabulation\Seating\MakeSeatingDecisionsController; +use App\Http\Controllers\Tabulation\Seating\PublishSeatingController; +use App\Http\Controllers\Tabulation\Seating\ShowAuditionSeatingPage; use App\Http\Controllers\Tabulation\SeatingStatusController; use App\Http\Middleware\CheckIfCanTab; use Illuminate\Support\Facades\Route; @@ -41,17 +44,17 @@ Route::middleware(['auth', 'verified', CheckIfCanTab::class])->group(function () // Seating Routes Route::prefix('seating/')->group(function () { Route::get('/', SeatingStatusController::class)->name('seating.status'); - Route::get('/{audition}', [SeatAuditionFormController::class, 'showForm'])->name('seating.audition'); - Route::post('/{audition}/draftSeats', [SeatAuditionFormController::class, 'draftSeats'])->name('seating.audition.draftSeats'); - Route::post('/{audition}/clearDraft', [SeatAuditionFormController::class, 'clearDraft'])->name('seating.audition.clearDraft'); - Route::post('/{audition}/{entry}/decline', [SeatAuditionFormController::class, 'declineSeat'])->name('seating.audition.decline'); - Route::post('/{audition}/mass_decline', [SeatAuditionFormController::class, 'massDecline'])->name('seating.audition.mass_decline'); - Route::post('/{audition}/{entry}/accept', [SeatAuditionFormController::class, 'acceptSeat'])->name('seating.audition.accept'); - Route::post('/{audition}/{entry}/noshow', [SeatAuditionFormController::class, 'noshow'])->name('seating.audition.noshow'); + Route::get('/{audition}', ShowAuditionSeatingPage::class)->name('seating.audition'); + Route::post('/{audition}/draftSeats', [MakeSeatingDecisionsController::class, 'draftSeats'])->name('seating.audition.draftSeats'); + Route::post('/{audition}/clearDraft', [MakeSeatingDecisionsController::class, 'clearDraft'])->name('seating.audition.clearDraft'); + Route::post('/{audition}/{entry}/decline', [EnterDoublerDecisionsController::class, 'declineSeat'])->name('seating.audition.decline'); + Route::post('/{audition}/mass_decline', [EnterDoublerDecisionsController::class, 'massDecline'])->name('seating.audition.mass_decline'); + Route::post('/{audition}/{entry}/accept', [EnterDoublerDecisionsController::class, 'acceptSeat'])->name('seating.audition.accept'); + Route::post('/{audition}/{entry}/noshow', [EnterDoublerDecisionsController::class, 'noshow'])->name('seating.audition.noshow'); Route::post('/{audition}/publish', - [SeatAuditionFormController::class, 'publishSeats'])->name('seating.audition.publishSeats'); + [PublishSeatingController::class, 'publishSeats'])->name('seating.audition.publishSeats'); Route::post('/{audition}/unpublish', - [SeatAuditionFormController::class, 'unpublishSeats'])->name('seating.audition.unpublishSeats'); + [PublishSeatingController::class, 'unpublishSeats'])->name('seating.audition.unpublishSeats'); }); // Advancement Routes