Work on assigning bonus judges

#20 Implement bonus scores
Add controls on judge assignment page to access a screen for bonus score judges.
This commit is contained in:
Matt Young 2024-07-15 14:29:39 -05:00
parent 7e0b8f51d9
commit bfb4b54e18
4 changed files with 23 additions and 3 deletions

View File

@ -79,4 +79,9 @@ class BonusScoreDefinitionController extends Controller
return redirect()->route('admin.bonus-scores.index')->with('success', 'Audition unassigned from bonus score'); return redirect()->route('admin.bonus-scores.index')->with('success', 'Audition unassigned from bonus score');
} }
public function judges()
{
echo 'boo';
}
} }

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Admin; namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\BonusScoreDefinition;
use App\Models\Room; use App\Models\Room;
use App\Models\User; use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -17,7 +18,7 @@ class RoomController extends Controller
if (! Auth::user()->is_admin) { if (! Auth::user()->is_admin) {
abort(403); abort(403);
} }
$rooms = Room::with('auditions.entries','entries')->orderBy('name')->get(); $rooms = Room::with('auditions.entries', 'entries')->orderBy('name')->get();
return view('admin.rooms.index', ['rooms' => $rooms]); return view('admin.rooms.index', ['rooms' => $rooms]);
} }
@ -27,8 +28,9 @@ class RoomController extends Controller
$usersWithoutRooms = User::doesntHave('rooms')->orderBy('last_name')->orderBy('first_name')->get(); $usersWithoutRooms = User::doesntHave('rooms')->orderBy('last_name')->orderBy('first_name')->get();
$usersWithRooms = User::has('rooms')->orderBy('last_name')->orderBy('first_name')->get(); $usersWithRooms = User::has('rooms')->orderBy('last_name')->orderBy('first_name')->get();
$rooms = Room::with(['judges.school', 'auditions'])->get(); $rooms = Room::with(['judges.school', 'auditions'])->get();
$bonusScoresExist = BonusScoreDefinition::count() > 0;
return view('admin.rooms.judge_assignments', compact('usersWithoutRooms', 'usersWithRooms', 'rooms')); return view('admin.rooms.judge_assignments', compact('usersWithoutRooms', 'usersWithRooms', 'rooms', 'bonusScoresExist'));
} }
public function updateJudgeAssignment(Request $request, Room $room) public function updateJudgeAssignment(Request $request, Room $room)

View File

@ -1,5 +1,17 @@
<x-layout.app> <x-layout.app>
<ul class="grid md:grid-cols-4 gap-5"> @if($bonusScoresExist)
<div class="bg-white pt-3 pb-1 px-3 rounded-md">
<div class="mb-3">
<nav class="flex space-x-4" aria-label="Tabs">
<!-- Current: "bg-indigo-100 text-indigo-700", Default: "text-gray-500 hover:text-gray-700" -->
<a href="{{route('admin.rooms.judgingAssignment')}}" class="rounded-md px-3 py-2 text-sm font-medium bg-indigo-100 text-indigo-700">Room Judges</a>
<a href="{{route('admin.bonus-scores.judges')}}" class="rounded-md px-3 py-2 text-sm font-medium text-gray-500 hover:text-gray-700">Bonus Judges</a>
</nav>
</div>
</div>
@endif
<ul class="grid md:grid-cols-4 gap-5 mt-5">
@foreach($rooms as $room) @foreach($rooms as $room)
@if($room->id == 0) @if($room->id == 0)

View File

@ -38,6 +38,7 @@ Route::middleware(['auth', 'verified', CheckIfAdmin::class])->prefix('admin/')->
Route::post('/assign_auditions', 'assignAuditions')->name('admin.bonus-scores.addAuditions'); Route::post('/assign_auditions', 'assignAuditions')->name('admin.bonus-scores.addAuditions');
Route::delete('/{audition}/unassign_audition', 'unassignAudition')->name('admin.bonus-scores.unassignAudition'); Route::delete('/{audition}/unassign_audition', 'unassignAudition')->name('admin.bonus-scores.unassignAudition');
Route::delete('/{bonusScore}', 'destroy')->name('admin.bonus-scores.destroy'); Route::delete('/{bonusScore}', 'destroy')->name('admin.bonus-scores.destroy');
Route::get('/judges', 'judges')->name('admin.bonus-scores.judges');
}); });