diff --git a/app/Http/Controllers/Admin/EventController.php b/app/Http/Controllers/Admin/EventController.php new file mode 100644 index 0000000..f39f0ba --- /dev/null +++ b/app/Http/Controllers/Admin/EventController.php @@ -0,0 +1,16 @@ + function($query) { - $query->withCount('scoreSheets'); - },'room.judges'])->get(); - self::$completeAuditions = $auditions->filter(function ($audition) { - return $audition->scoringIsComplete(); - }); - return self::$completeAuditions; - - } public static function deadlineNotPast() { @@ -157,7 +145,7 @@ class Audition extends Model ); } - /* + /** * Ensures judges_count property is always available */ public function getJudgesCountAttribute() @@ -168,43 +156,4 @@ class Audition extends Model return $this->attributes['judges_count']; } - public function scoredEntries() - { - return $this->entries->filter(function($entry) { - return $entry->score_sheets_count >= $this->judges()->count(); - }); - } - - public function rankedEntries() - { - if (! $this->rankedEntries) { - $entries = $this->entries()->with(['audition.scoringGuide.subscores', 'scoreSheets.judge'])->get(); - $entries = $entries->all(); - usort($entries, function ($a, $b) { - $aScores = $a->finalScoresArray(); - $bScores = $b->finalScoresArray(); - - $length = min(count($aScores), count($bScores)); - for ($i = 0; $i < $length; $i++) { - if ($aScores[$i] !== $bScores[$i]) { - return $bScores[$i] - $aScores[$i]; - } - } - return 0; - }); - $collection = new \Illuminate\Database\Eloquent\Collection($entries); - $this->rankedEntries = $collection; - } - return $this->rankedEntries; - } - - public function scoringIsComplete() - { - if (self::$completeAuditions) { - // check and see if this audition is in the list of complete auditions - return self::$completeAuditions->contains('id', $this->id); - } - - return $this->scoredEntries()->count() == $this->entries->count(); - } } diff --git a/resources/views/admin/event/index.blade.php b/resources/views/admin/event/index.blade.php new file mode 100644 index 0000000..615e27c --- /dev/null +++ b/resources/views/admin/event/index.blade.php @@ -0,0 +1,39 @@ + + Events + + + Manage Events + + + About Events in AuditionAdmin +
    + {{-- move help text to a popout modal --}} +
  • Events generally refer to the performance for a group of auditions
  • +
  • Every audition is assigned to one event
  • +
  • An event cannot be deleted without first deleting all of its auditions
  • +
  • Students will not be allowed to be seated in multiple auditions for the same event
  • +
  • If no student will ever be able to accept more than one seat, all auditions should be in one event
  • +
  • If you have, for example, concert bands and jazz bands that perform at different times, and a student can make both, you should create the concert auditions in one event, and the jazz auditions in another event.
  • +
+
+
+ + + +
+ + @foreach($events as $event) + +
+ {{ $event->name }} , {{ $event->auditions()->count() }} Auditions +
+
+ @endforeach + + {{-- The final row will allow for the creation of an event --}} + + + +
+
+
diff --git a/resources/views/components/help-modal.blade.php b/resources/views/components/help-modal.blade.php new file mode 100644 index 0000000..8dbf181 --- /dev/null +++ b/resources/views/components/help-modal.blade.php @@ -0,0 +1,42 @@ +
+ + + + +
+ +
+ +
+
{{ $title ?? '' }}
+ + +
+ + +
{{ $slot }}
+
+
+
diff --git a/resources/views/components/layout/navbar/menus/admin.blade.php b/resources/views/components/layout/navbar/menus/admin.blade.php index 72ef8cd..21bc4b5 100644 --- a/resources/views/components/layout/navbar/menus/admin.blade.php +++ b/resources/views/components/layout/navbar/menus/admin.blade.php @@ -25,11 +25,6 @@ Schools Students Entries - Auditions - Scoring - Rooms - Judges - Run Draw diff --git a/resources/views/components/layout/navbar/menus/setup.blade.php b/resources/views/components/layout/navbar/menus/setup.blade.php new file mode 100644 index 0000000..c7be6aa --- /dev/null +++ b/resources/views/components/layout/navbar/menus/setup.blade.php @@ -0,0 +1,31 @@ +
+ {{-- + + +
+ +
+
diff --git a/resources/views/components/layout/navbar/navbar.blade.php b/resources/views/components/layout/navbar/navbar.blade.php index ba329e2..7c6b78e 100644 --- a/resources/views/components/layout/navbar/navbar.blade.php +++ b/resources/views/components/layout/navbar/navbar.blade.php @@ -29,6 +29,7 @@ @endif @if(Auth::user()->is_admin) @include('components.layout.navbar.menus.admin') + @include('components.layout.navbar.menus.setup') @endif @if(Auth::user()->canTab()) @include('components.layout.navbar.menus.tabulation') diff --git a/routes/web.php b/routes/web.php index cfc8ace..d4672f4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -58,6 +58,11 @@ Route::middleware(['auth','verified',CheckIfAdmin::class])->prefix('admin/')->gr Route::post('/auditions/roomUpdate',[\App\Http\Controllers\Admin\AuditionController::class,'roomUpdate']); // Endpoint for JS assigning auditions to rooms Route::post('/scoring/assign_guide_to_audition',[\App\Http\Controllers\Admin\AuditionController::class,'scoringGuideUpdate']); // Endpoint for JS assigning scoring guides to auditions + // Admin Event Routes + Route::prefix('events')->controller(\App\Http\Controllers\Admin\EventController::class)->group(function() { + Route::get('/','index'); + }); + // Admin Rooms Routes Route::prefix('rooms')->controller(\App\Http\Controllers\Admin\RoomController::class)->group(function() { Route::get('/','index'); @@ -137,6 +142,8 @@ Route::middleware(['auth','verified',CheckIfAdmin::class])->prefix('admin/')->gr }); }); + + // Dashboard Related Routes Route::middleware(['auth','verified'])->group(function () { Route::get('/dashboard', [DashboardController::class, 'dashboard'])->name('dashboard');