diff --git a/app/Http/Controllers/MonitorController.php b/app/Http/Controllers/MonitorController.php
index 6a61518..93414eb 100644
--- a/app/Http/Controllers/MonitorController.php
+++ b/app/Http/Controllers/MonitorController.php
@@ -2,9 +2,8 @@
namespace App\Http\Controllers;
-use App\Actions\Tabulation\CheckPrelimResult;
+use App\Models\Audition;
use App\Models\Entry;
-use App\Models\PrelimDefinition;
use function compact;
@@ -15,115 +14,44 @@ class MonitorController extends Controller
if (! auth()->user()->hasFlag('monitor')) {
abort(403);
}
- $method = 'POST';
- $formRoute = 'monitor.enterFlag';
- $title = 'Flag Entry';
- //return view('tabulation.choose_entry', compact('method', 'formRoute', 'title'));
- $prelims = PrelimDefinition::with('audition')->get();
- $prelimDefinition = null;
+ $auditions = Audition::orderBy('score_order')->with('flags')->get();
+ $audition = null;
- return view('monitor.index', compact('prelims', 'prelimDefinition'));
+ return view('monitor.index', compact('audition', 'auditions'));
}
- public function prelimStatus(PrelimDefinition $prelimDefinition)
+ public function auditionStatus(Audition $audition)
{
if (! auth()->user()->hasFlag('monitor')) {
abort(403);
}
- $prelims = PrelimDefinition::with('audition')->get();
- $entries = $prelimDefinition->audition->entries()->with('student.school')->with('PrelimScoreSheets')->get();
- // foreach ($entries as $entry) {
- // app(CheckPrelimResult::class)->__invoke($entry);
- // }
- return view('monitor.index', compact('prelims', 'prelimDefinition', 'entries'));
+ if ($audition->hasFlag('seats_published') || $audition->hasFlag('advancement_published')) {
+ return redirect()->route('monitor.index')->with('error', 'Results for that audition are published');
+ }
+
+ $auditions = Audition::orderBy('score_order')->with('flags')->get();
+ $entries = $audition->entries()->with('flags')->with('student.school')->withCount([
+ 'prelimScoreSheets', 'scoreSheets',
+ ])->orderBy('draw_number')->get();
+
+ return view('monitor.index', compact('audition', 'auditions', 'entries'));
}
public function toggleNoShow(Entry $entry)
{
+ if ($entry->audition->hasFlag('seats_published') || $entry->audition->hasFlag('advancement_published')) {
+ return redirect()->route('monitor.index')->with('error', 'Results for that audition are published');
+ }
+
if ($entry->hasFlag('no_show')) {
$entry->removeFlag('no_show');
- return;
+ return redirect()->back()->with('success', 'No Show Flag Cleared');
}
$entry->addFlag('no_show');
return redirect()->back()->with('success', 'No Show Entered');
}
-
- public function flagForm()
- {
- if (! auth()->user()->hasFlag('monitor')) {
- abort(403);
- }
-
- $validData = request()->validate([
- 'entry_id' => ['required', 'integer', 'exists:entries,id'],
- ]);
-
- $entry = Entry::find($validData['entry_id']);
-
- // If the entries audition is published, bounce out
- if ($entry->audition->hasFlag('seats_published') || $entry->audition->hasFlag('advancement_published')) {
- return redirect()->route('monitor.index')->with('error', 'Cannot set flags while results are published');
- }
-
- // If entry has scores, bounce on out
- if ($entry->scoreSheets()->count() > 0) {
- return redirect()->route('monitor.index')->with('error', 'That entry has existing scores');
- }
-
- return view('monitor_entry_flag_form', compact('entry'));
- }
-
- public function storeFlag(Entry $entry)
- {
- if (! auth()->user()->hasFlag('monitor')) {
- abort(403);
- }
-
- // If the entries audition is published, bounce out
- if ($entry->audition->hasFlag('seats_published') || $entry->audition->hasFlag('advancement_published')) {
- return redirect()->route('monitor.index')->with('error', 'Cannot set flags while results are published');
- }
-
- // If entry has scores, bounce on out
- if ($entry->scoreSheets()->count() > 0) {
- return redirect()->route('monitor.index')->with('error', 'That entry has existing scores');
- }
-
- $action = request()->input('action');
- $result = match ($action) {
- 'failed-prelim' => $this->setFlag($entry, 'failed_prelim'),
- 'no-show' => $this->setFlag($entry, 'no_show'),
- 'clear' => $this->setFlag($entry, 'clear'),
- default => redirect()->route('monitor.index')->with('error', 'Invalid action requested'),
- };
-
- return redirect()->route('monitor.index')->with('success', 'Flag set for entry #'.$entry->id);
- }
-
- private function setFlag(Entry $entry, string $flag)
- {
- if ($flag === 'no_show') {
- $entry->removeFlag('failed_prelim');
- $entry->addFlag('no_show');
-
- return true;
- }
- if ($flag === 'failed_prelim') {
- $entry->addFlag('failed_prelim');
- $entry->addFlag('no_show');
-
- return true;
- }
- if ($flag === 'clear') {
- $entry->removeFlag('failed_prelim');
- $entry->removeFlag('no_show');
-
- return true;
- }
-
- }
}
diff --git a/resources/views/monitor/index.blade.php b/resources/views/monitor/index.blade.php
index d60273e..fcc9247 100644
--- a/resources/views/monitor/index.blade.php
+++ b/resources/views/monitor/index.blade.php
@@ -1,72 +1,76 @@
Monitor Dashboard
-
- {{-- PRELIM AUDITION STATUS CARD --}}
-
+
- Prelim Auditions
+ Audition Status
-
-
- @foreach ($prelims as $prelim)
-
+
+
+ @foreach ($auditions as $menuAudition)
+ @continue($menuAudition->hasFlag('seats_published') || $menuAudition->hasFlag('advance_published'))
+
@endforeach
- @if($prelimDefinition)
+ @if($audition)
Entry
-
+ @if($audition->prelimDefinition)
+ Prelim
Scores
+ @endif
+ Finals
Scores
+
-
- @foreach($entries as $entry)
-
-
- {{ $prelimDefinition->audition->name }} {{ $entry->draw_number }}
- @if($entry->hasFlag('no_show'))
- No-Show
- @elseif($entry->hasFlag('failed_prelim'))
- Failed
-
- @elseif($entry->hasFlag('passed_prelim'))
- Passed
-
- @else
-
- Pending
-
+
+ @foreach($entries as $entry)
+
+
+ {{ $audition->name }} {{ $entry->draw_number }}
+ @if($audition->prelimDefinition && ! $entry->hasFlag('no_show'))
+ @if($entry->hasFlag('failed_prelim'))
+ Failed
+ @elseif($entry->hasFlag('passed_prelim'))
+ Passed
+ @else
+ Pending
+ @endif
+ @elseif($entry->hasFlag('no_show'))
+ No-Show
+ @endif
+
+ @if($audition->prelimDefinition)
+
+ {{ $entry->prelim_score_sheets_count }}
+
@endif
-
-
- @if($entry->prelimScoreSheets()->count() < 1 && ! $entry->hasFlag('no_show'))
-
-
- Mark No-Show
-
- Mark {{ $prelimDefinition->audition->name }} {{ $entry->draw_number }} as a no-show
- Confirm that you would like to mark this entry as a no-show
- {{ $prelimDefinition->audition->name }} {{ $entry->draw_number }}
- Entry ID: {{ $entry->id }}
- Name: {{ $entry->student->full_name() }}
- School: {{ $entry->student->school->name }}
-
-
- Confirm No-Show
{{ $prelimDefinition->audition->name }} {{ $entry->draw_number }}
-
-
- @endif
-
-
- @endforeach
-
+
+ {{ $entry->score_sheets_count }}
+
+
+
+ @if($entry->prelim_score_sheets_count < 1 && $entry->score_sheets_count < 1 && ! $entry->hasFlag('no_show') && ! $audition->hasFlag('seats_published'))
+ @include('monitor.noshow_modal')
+ @endif
+
+ @if($entry->hasFlag('no_show') && ! $audition->hasFlag('seats_published'))
+ @include('monitor.remove_nowshow_modal')
+ @endif
+
+
+ @endforeach
+
@endif
- {{-- FINAL AUDITION STATUS CARD --}}
+
diff --git a/resources/views/monitor/noshow_modal.blade.php b/resources/views/monitor/noshow_modal.blade.php
new file mode 100644
index 0000000..bf0dd97
--- /dev/null
+++ b/resources/views/monitor/noshow_modal.blade.php
@@ -0,0 +1,19 @@
+
+
+ Mark No-Show
+
+ Mark {{ $audition->name }} {{ $entry->draw_number }}
+ as a no-show
+
+ Confirm that you would like to mark this entry as a no-show
+ {{ $audition->name }} {{ $entry->draw_number }}
+ Entry ID: {{ $entry->id }}
+ Name: {{ $entry->student->full_name() }}
+ School: {{ $entry->student->school->name }}
+
+
+ Confirm
+ No-Show
{{ $audition->name }} {{ $entry->draw_number }}
+
+
+
diff --git a/resources/views/monitor/remove_nowshow_modal.blade.php b/resources/views/monitor/remove_nowshow_modal.blade.php
new file mode 100644
index 0000000..9071722
--- /dev/null
+++ b/resources/views/monitor/remove_nowshow_modal.blade.php
@@ -0,0 +1,18 @@
+
+
+ Undo No-Show
+
+ Remove No-Show Flag for {{ $audition->name }} {{ $entry->draw_number }}
+
+ Confirm that you would like to remove the no-show flag for this entry
+ {{ $audition->name }} {{ $entry->draw_number }}
+ Entry ID: {{ $entry->id }}
+ Name: {{ $entry->student->full_name() }}
+ School: {{ $entry->student->school->name }}
+
+
+ Remove
+ No-Show Flag
{{ $audition->name }} {{ $entry->draw_number }}
+
+
+
diff --git a/routes/web.php b/routes/web.php
index a9662ad..6b98d95 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -31,11 +31,8 @@ Route::prefix('filters')->middleware(['auth', 'verified'])->controller(FilterCon
// Monitor Related Routes
Route::prefix('monitor')->middleware(['auth', 'verified'])->controller(MonitorController::class)->group(function () {
Route::get('/', 'index')->name('monitor.index');
- Route::get('/prelim/{prelimDefinition}', 'prelimStatus')->name('monitor.prelimStatus');
+ Route::get('/audition/{audition}', 'auditionStatus')->name('monitor.auditionStatus');
Route::post('/toggleNoShow/{entry}', 'toggleNoShow')->name('monitor.toggleNoShow');
-
- Route::post('/enter_flag', 'flagForm')->name('monitor.enterFlag');
- Route::post('enter_flag/{entry}', 'storeFlag')->name('monitor.storeFlag');
});
//Route::get('/my_school', [SchoolController::class, 'my_school'])->middleware('auth','verified');