diff --git a/app/Http/Controllers/ResultsPage.php b/app/Http/Controllers/ResultsPage.php index e4bf827..e7be902 100644 --- a/app/Http/Controllers/ResultsPage.php +++ b/app/Http/Controllers/ResultsPage.php @@ -3,14 +3,17 @@ namespace App\Http\Controllers; use App\Services\AuditionCacheService; +use App\Services\SeatingService; use Illuminate\Http\Request; class ResultsPage extends Controller { protected $auditionCacheService; - public function __construct(AuditionCacheService $auditionCacheService) + protected $seatingService; + public function __construct(AuditionCacheService $auditionCacheService, SeatingService $seatingService) { $this->auditionCacheService = $auditionCacheService; + $this->seatingService = $seatingService; } /** @@ -20,6 +23,10 @@ class ResultsPage extends Controller { $publishedAuditions = $this->auditionCacheService->getPublishedAuditions(); + foreach ($publishedAuditions as $audition) { + $audition->seats = $this->seatingService->getSeatsForAudition($audition->id); + } + return view('results.index', compact('publishedAuditions')); } } diff --git a/app/Models/Audition.php b/app/Models/Audition.php index d02e0bf..d4ba075 100644 --- a/app/Models/Audition.php +++ b/app/Models/Audition.php @@ -24,6 +24,7 @@ class Audition extends Model protected $scored_entries_count; //Set by TabulationService + public static function deadlineNotPast() { return Audition::where('entry_deadline', '>=', now())->get(); diff --git a/app/Services/SeatingService.php b/app/Services/SeatingService.php index 7f3c0ed..edba7ad 100644 --- a/app/Services/SeatingService.php +++ b/app/Services/SeatingService.php @@ -58,7 +58,11 @@ class SeatingService $cacheKey = 'audition'.$auditionId.'seats'; return Cache::remember($cacheKey, now()->addHour(), function () use ($auditionId) { - return Seat::with('entry.student')->where('audition_id', $auditionId)->orderBy('seat')->get()->groupBy('ensemble_id'); + return Seat::with('entry.student') + ->where('audition_id', $auditionId) + ->orderBy('seat') + ->get() + ->groupBy('ensemble_id'); }); } diff --git a/resources/views/components/results/layout.blade.php b/resources/views/components/results/layout.blade.php new file mode 100644 index 0000000..e6cd72e --- /dev/null +++ b/resources/views/components/results/layout.blade.php @@ -0,0 +1,44 @@ +@php use App\Settings; @endphp + + + + + + + AuditionAdmin Results + @vite(['resources/css/app.css', 'resources/js/app.js']) + + + + + +
+ {{-- Desktop/Tablet Header --}} + + {{-- mobile header --}} +

+ {{ Settings::get('auditionAbbreviation') }} + + Audition Results +

+
+ +
+
+ +
+ + {{ $slot }} + +
+ + diff --git a/resources/views/components/results/table-audition-section.blade.php b/resources/views/components/results/table-audition-section.blade.php new file mode 100644 index 0000000..493d16f --- /dev/null +++ b/resources/views/components/results/table-audition-section.blade.php @@ -0,0 +1,11 @@ +@props(['auditionName']) +
class(['relative']) }}> + +
+

{{ $auditionName }}

+
+ + +
diff --git a/resources/views/components/results/table-seat-row.blade.php b/resources/views/components/results/table-seat-row.blade.php new file mode 100644 index 0000000..dbc5504 --- /dev/null +++ b/resources/views/components/results/table-seat-row.blade.php @@ -0,0 +1,10 @@ +@props(['seat','student_name','school']) +
  • class(['flex gap-x-4 px-3 py-5 justify-between']) }}> +
    + {{ $seat }} +
    +
    +

    {{ $student_name }}

    +

    {{ $school }}

    +
    +
  • diff --git a/resources/views/results/index.blade.php b/resources/views/results/index.blade.php index b833c48..c8725a8 100644 --- a/resources/views/results/index.blade.php +++ b/resources/views/results/index.blade.php @@ -1,38 +1,22 @@ -@php use App\Settings; @endphp - - - - - - - AuditionAdmin Results - @vite(['resources/css/app.css', 'resources/js/app.js']) + + @php + dump($publishedAuditions); + @endphp + -
    - {{-- Desktop/Tablet Header --}} - - {{-- mobile header --}} -

    - {{ Settings::get('auditionAbbreviation') }}Audition Results -

    -
    - -
    -
    - -
    - @include('results.results-table') -
    - - +
    diff --git a/resources/views/results/results-table.blade.php b/resources/views/results/results-table.blade.php deleted file mode 100644 index 8d1b7f1..0000000 --- a/resources/views/results/results-table.blade.php +++ /dev/null @@ -1,261 +0,0 @@ -