From 08ee83851d70eb3b6f7d8e4aa50a7aff9c9e7973 Mon Sep 17 00:00:00 2001 From: Matt Young Date: Wed, 19 Jun 2024 22:24:02 -0500 Subject: [PATCH] Progress on seating form --- app/Models/Ensemble.php | 15 +++++++++++++++ .../ensembles/seatingLimits-limitForm.blade.php | 16 ++++++++++++++++ .../admin/ensembles/seatingLimits.blade.php | 4 ++++ .../components/form/field-horizontal.blade.php | 14 ++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 resources/views/admin/ensembles/seatingLimits-limitForm.blade.php create mode 100644 resources/views/components/form/field-horizontal.blade.php diff --git a/app/Models/Ensemble.php b/app/Models/Ensemble.php index 8760051..3526177 100644 --- a/app/Models/Ensemble.php +++ b/app/Models/Ensemble.php @@ -2,9 +2,11 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasManyThrough; class Ensemble extends Model { @@ -15,4 +17,17 @@ class Ensemble extends Model { return $this->belongsTo(Event::class); } + + public function auditions(): HasManyThrough + { + return $this->hasManyThrough( + Audition::class, + Event::class, + 'id', + 'event_id', + 'event_id', + 'id' + )->orderBy('score_order'); + } + } diff --git a/resources/views/admin/ensembles/seatingLimits-limitForm.blade.php b/resources/views/admin/ensembles/seatingLimits-limitForm.blade.php new file mode 100644 index 0000000..cd9c45c --- /dev/null +++ b/resources/views/admin/ensembles/seatingLimits-limitForm.blade.php @@ -0,0 +1,16 @@ + + + {{ $ensemble->name }} + +
+ @foreach($ensemble->auditions as $audition) + + @endforeach + +
+ + +
+ + +
diff --git a/resources/views/admin/ensembles/seatingLimits.blade.php b/resources/views/admin/ensembles/seatingLimits.blade.php index f236c81..e3f2413 100644 --- a/resources/views/admin/ensembles/seatingLimits.blade.php +++ b/resources/views/admin/ensembles/seatingLimits.blade.php @@ -15,4 +15,8 @@ +{{-- NEXT STEP - deising a component that will be a form to set audition limits for $ensemble, if it is set.--}} + @if($ensemble->exists) + @include('admin.ensembles.seatingLimits-limitForm') + @endif diff --git a/resources/views/components/form/field-horizontal.blade.php b/resources/views/components/form/field-horizontal.blade.php new file mode 100644 index 0000000..a28abe5 --- /dev/null +++ b/resources/views/components/form/field-horizontal.blade.php @@ -0,0 +1,14 @@ +@props(['name','label','type' => 'text']) +
+
+
+ +
+ +
+
+
+