diff --git a/app/Http/Controllers/Tabulation/EntryFlagController.php b/app/Http/Controllers/Tabulation/EntryFlagController.php index 8154120..5a1a8c0 100644 --- a/app/Http/Controllers/Tabulation/EntryFlagController.php +++ b/app/Http/Controllers/Tabulation/EntryFlagController.php @@ -4,12 +4,8 @@ namespace App\Http\Controllers\Tabulation; use App\Exceptions\AuditionAdminException; use App\Http\Controllers\Controller; -use App\Models\BonusScore; use App\Models\Entry; -use App\Models\EntryTotalScore; -use App\Models\ScoreSheet; use Illuminate\Http\Request; -use Illuminate\Support\Facades\DB; use function to_route; @@ -82,27 +78,6 @@ class EntryFlagController extends Controller return to_route('entry-flags.noShowSelect')->with('error', $e->getMessage()); } - // if ($entry->audition->hasFlag('seats_published')) { - // return to_route('entry-flags.noShowSelect')->with('error', - // 'Cannot enter a no-show for an entry in an audition where seats are published'); - // } - // if ($entry->audition->hasFlag('advancement_published')) { - // return to_route('entry-flags.noShowSelect')->with('error', - // 'Cannot enter a no-show for an entry in an audition where advancement is published'); - // } - // DB::table('score_sheets')->where('entry_id', $entry->id)->delete(); - // - // ScoreSheet::where('entry_id', $entry->id)->delete(); - // BonusScore::where('entry_id', $entry->id)->delete(); - // EntryTotalScore::where('entry_id', $entry->id)->delete(); - // if (request()->input('noshow-type') == 'failprelim') { - // $msg = 'Failed prelim has been entered for '.$entry->audition->name.' #'.$entry->draw_number.' (ID: '.$entry->id.').'; - // $entry->addFlag('failed_prelim'); - // } else { - // $entry->addFlag('no_show'); - // $msg = 'No Show has been entered for '.$entry->audition->name.' #'.$entry->draw_number.' (ID: '.$entry->id.').'; - // } - return to_route('entry-flags.noShowSelect')->with('success', $msg); } diff --git a/app/Http/Controllers/Tabulation/SeatAuditionFormController.php b/app/Http/Controllers/Tabulation/SeatAuditionFormController.php index 5a0411f..c83b59d 100644 --- a/app/Http/Controllers/Tabulation/SeatAuditionFormController.php +++ b/app/Http/Controllers/Tabulation/SeatAuditionFormController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Tabulation; use App\Actions\Tabulation\GetAuditionSeats; use App\Actions\Tabulation\RankAuditionEntries; +use App\Exceptions\AuditionAdminException; use App\Http\Controllers\Controller; use App\Models\Audition; use App\Models\Doubler; @@ -75,6 +76,37 @@ class SeatAuditionFormController extends Controller $entry->student->full_name().' has declined '.$audition->name); } + public function acceptSeat(Audition $audition, Entry $entry) + { + $doublerData = Doubler::findDoubler($entry->student_id, $audition->event_id); + foreach ($doublerData->entries() as $doublerEntry) { + if (! $doublerEntry->totalScore && ! $doublerEntry->hasFlag('declined') && ! $doublerEntry->hasFlag('no_show') && ! $doublerEntry->hasFlag('failed_prelim')) { + return redirect()->route('seating.audition', ['audition' => $audition->id])->with('error', + 'Cannot accept seating for '.$entry->student->full_name().' because student has unscored entries'); + } + } + foreach ($doublerData->entries() as $doublerEntry) { + if ($doublerEntry->id !== $entry->id && ! $doublerEntry->hasFlag('no_show') && ! $doublerEntry->hasFlag('failed_prelim') && ! $doublerEntry->hasFlag('declined')) { + $doublerEntry->addFlag('declined'); + } + } + + 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); + } + protected function pickRightPanel(Audition $audition, array $seatable) { if ($audition->hasFlag('seats_published')) { diff --git a/resources/views/tabulation/auditionSeating-doubler-block.blade.php b/resources/views/tabulation/auditionSeating-doubler-block.blade.php index e3c5a85..99b5829 100644 --- a/resources/views/tabulation/auditionSeating-doubler-block.blade.php +++ b/resources/views/tabulation/auditionSeating-doubler-block.blade.php @@ -27,6 +27,10 @@ @endforeach
+ {{-- TODO: Don't show the option to accept if it cannot be done --}} + + Accept {{ $de->audition->name }} + Decline {{ $de->audition->name }} diff --git a/resources/views/tabulation/auditionSeating.blade.php b/resources/views/tabulation/auditionSeating.blade.php index dd5c094..8abe770 100644 --- a/resources/views/tabulation/auditionSeating.blade.php +++ b/resources/views/tabulation/auditionSeating.blade.php @@ -32,7 +32,9 @@ {{ $entry->id }} {{ $entry->draw_number }} -
{{ $entry->student->full_name() }}
+
+ {{ $entry->student->full_name() }} +
{{ $entry->student->school->name }}
@@ -44,7 +46,8 @@ DECLINED @else @if($request = $entry->student->doublerRequests()->where('event_id',$entry->audition->event_id)->first()) -
{{-- Begin block seating request --}} +
{{-- Begin block seating request --}}
Request
@@ -55,9 +58,9 @@
@endif - @foreach($entry->student->entriesForEvent($entry->audition->event_id) as $de) - @include('tabulation.auditionSeating-doubler-block') - @endforeach + @foreach($entry->student->entriesForEvent($entry->audition->event_id) as $de) + @include('tabulation.auditionSeating-doubler-block') + @endforeach @endif @endif @@ -78,6 +81,7 @@ Draw # ID Student + @@ -89,6 +93,11 @@ {{ $entry->student->full_name() }} {{ $entry->student->school->name }} + + + Record No Show + + @endforeach @@ -150,7 +159,18 @@
- Controls + {{-- TODO: Add in bulk delince doubler option --}} + @if($unscored_entries->count() > 0) + + Cannot seat the audition while entries are unscored. + + @endif +
+ @if($doublerData->contains('accepted_entry', null)) + + Cannot seat the audition while there are unresolved doublers. + + @endif
diff --git a/routes/tabulation.php b/routes/tabulation.php index 2633ad6..ca24ea2 100644 --- a/routes/tabulation.php +++ b/routes/tabulation.php @@ -44,6 +44,8 @@ Route::middleware(['auth', 'verified', CheckIfCanTab::class])->group(function () Route::get('/', SeatingStatusController::class)->name('seating.status'); Route::get('/{audition}', [SeatAuditionFormController::class, 'showForm'])->name('seating.audition'); Route::post('/{audition}/{entry}/decline', [SeatAuditionFormController::class, 'declineSeat'])->name('seating.audition.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::post('/{audition}/publish', [SeatingPublicationController::class, 'publishSeats'])->name('seating.audition.publish'); Route::post('/{audition}/unpublish',