From 920e2c59665d0477f0fce2542cf96aff0d0d74de Mon Sep 17 00:00:00 2001 From: Matt Young Date: Thu, 27 Jun 2024 11:16:58 -0500 Subject: [PATCH] Refactor room index for clarity --- .../admin/rooms/index-room-card.blade.php | 30 +++++++ .../rooms/index-sortablejs-script.blade.php | 35 ++++++++ resources/views/admin/rooms/index.blade.php | 83 ++----------------- 3 files changed, 72 insertions(+), 76 deletions(-) create mode 100644 resources/views/admin/rooms/index-room-card.blade.php create mode 100644 resources/views/admin/rooms/index-sortablejs-script.blade.php diff --git a/resources/views/admin/rooms/index-room-card.blade.php b/resources/views/admin/rooms/index-room-card.blade.php new file mode 100644 index 0000000..f25f818 --- /dev/null +++ b/resources/views/admin/rooms/index-room-card.blade.php @@ -0,0 +1,30 @@ + + + {{ $room->name }} + {{ $room->description }} + + @if($room->entries->count() === 0 and $room->id != '0') +
+ + + +
+ @else + {{ $room->entries->count() }} + @endif +
+
+ + + @foreach($room->auditions as $audition) + + {{ $audition->entries->count() }} + {{ $audition->name }} + + @endforeach + + +
diff --git a/resources/views/admin/rooms/index-sortablejs-script.blade.php b/resources/views/admin/rooms/index-sortablejs-script.blade.php new file mode 100644 index 0000000..4e019de --- /dev/null +++ b/resources/views/admin/rooms/index-sortablejs-script.blade.php @@ -0,0 +1,35 @@ + diff --git a/resources/views/admin/rooms/index.blade.php b/resources/views/admin/rooms/index.blade.php index ada35cb..ecc51c4 100644 --- a/resources/views/admin/rooms/index.blade.php +++ b/resources/views/admin/rooms/index.blade.php @@ -5,91 +5,22 @@
{{-- Container for room cards --}}
- @foreach($rooms as $room) {{-- Room 0 should be at the end for unassigned auditions--}} - @if($room->id == '0') - @push('noRoom') - @endif - - - {{ $room->name }} - {{ $room->description }} - - @if($room->entries->count() === 0 and $room->id != '0') -
- - - -
- @else - {{ $room->entries->count() }} - @endif -
-
- - - @foreach($room->auditions as $audition) - - {{ $audition->entries->count() }} - {{ $audition->name }} - - @endforeach - - - -
- @if($room->id == '0') - @endpush - @endif + @continue($room->id === 0) + @include('admin.rooms.index-room-card') @endforeach() - -
{{-- Unassigned Auditions --}} - @stack('noRoom') + @php + $room = $rooms->find(0); + @endphp + @include('admin.rooms.index-room-card')
- + @include('admin.rooms.index-sortablejs-script')