diff --git a/app/Http/Controllers/Tabulation/EntryFlagController.php b/app/Http/Controllers/Tabulation/EntryFlagController.php index 0c3ef77..14189e2 100644 --- a/app/Http/Controllers/Tabulation/EntryFlagController.php +++ b/app/Http/Controllers/Tabulation/EntryFlagController.php @@ -21,21 +21,42 @@ class EntryFlagController extends Controller $validData = $request->validate([ 'entry_id' => 'required|exists:entries,id', ]); - $entry = Entry::with('flags')->find($validData['entry_id']); - + $entry = Entry::with('flags')->withCount('scoreSheets')->find($validData['entry_id']); if ($entry->hasFlag('no_show')) { $formId = 'no-show-cancellation-form'; $buttonName = 'Remove No Show'; - $submitRouteName = 'entry-flags.enterNoShow'; - $cardHeading = 'Undo No Show'; + $submitRouteName = 'entry-flags.undoNoShow'; + $cardHeading = 'Undo No-Show'; + $method = 'DELETE'; } else { $formId = 'no-show-confirmation-form'; $buttonName = 'Confirm No Show'; $submitRouteName = 'entry-flags.enterNoShow'; - $cardHeading = 'Confirm No Show'; + $cardHeading = 'Confirm No-Show'; + $method = 'POST'; + } + $scores = []; + if($entry->score_sheets_count > 0) { + $scores = $entry->scoreSheets; + $scores->load('judge'); } - return view('tabulation.no_show_confirm', - compact('entry', 'formId', 'buttonName', 'submitRouteName', 'cardHeading')); + compact('entry', + 'formId', + 'buttonName', + 'submitRouteName', + 'cardHeading', + 'method', + 'scores')); + } + + public function enterNoShow(Entry $entry) + { + // + } + + public function undoNoShow(Entry $entry) + { + // } } diff --git a/database/seeders/ScoreAllAuditions.php b/database/seeders/ScoreAllAuditions.php index 230199d..9a9f569 100644 --- a/database/seeders/ScoreAllAuditions.php +++ b/database/seeders/ScoreAllAuditions.php @@ -4,7 +4,6 @@ namespace Database\Seeders; use App\Models\ScoreSheet; use App\Models\User; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; class ScoreAllAuditions extends Seeder @@ -16,23 +15,23 @@ class ScoreAllAuditions extends Seeder { $judges = User::all(); foreach ($judges as $judge) { - foreach( $judge->rooms as $room) { - foreach ($room->auditions as $audition){ + foreach ($judge->rooms as $room) { + foreach ($room->auditions as $audition) { $scoringGuide = $audition->scoringGuide; $subscores = $scoringGuide->subscores; - foreach ($audition->entries as $entry){ + foreach ($audition->entries as $entry) { $scoreArray = []; foreach ($subscores as $subscore) { $scoreArray[$subscore->id] = [ - 'score' => mt_rand(0,100), + 'score' => mt_rand(0, 100), 'subscore_id' => $subscore->id, - 'subscore_name' => $subscore->name + 'subscore_name' => $subscore->name, ]; } ScoreSheet::create([ 'user_id' => $judge->id, 'entry_id' => $entry->id, - 'subscores' => $scoreArray + 'subscores' => $scoreArray, ]); } } diff --git a/resources/views/components/form/toggle-checkbox.blade.php b/resources/views/components/form/toggle-checkbox.blade.php index 3d6086a..1e88ebf 100644 --- a/resources/views/components/form/toggle-checkbox.blade.php +++ b/resources/views/components/form/toggle-checkbox.blade.php @@ -2,7 +2,7 @@