50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Audition;
|
|
use App\Models\Entry;
|
|
use App\Models\SubscoreDefinition;
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use function compact;
|
|
use function redirect;
|
|
use function url;
|
|
|
|
class JudgingController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$rooms = Auth::user()->judgingAssignments;
|
|
return view('judging.index', compact('rooms'));
|
|
}
|
|
|
|
public function auditionEntryList(Audition $audition)
|
|
{
|
|
// TODO verify user is assigned to judge this audition
|
|
$entries = Entry::where('audition_id','=',$audition->id)->orderBy('draw_number')->get();
|
|
|
|
return view('judging.audition_entry_list', compact('audition','entries'));
|
|
}
|
|
|
|
public function entryScoreSheet(Entry $entry)
|
|
{
|
|
// TODO verify user is assigned to judge this audition
|
|
return view('judging.entry_score_sheet',compact('entry'));
|
|
}
|
|
|
|
public function saveScoreSheet(Request $request, Entry $entry)
|
|
{
|
|
// TODO verify user is assigned to judge this audition
|
|
$scoringGuide = $entry->audition->scoringGuide;
|
|
$scoreValidation = $scoringGuide->validateScores($request->input('score'));
|
|
if ($scoreValidation != 'success') {
|
|
return redirect(url()->previous())->with('error', $scoreValidation)->with('oldScores',$request->all());
|
|
}
|
|
dd($scoreValidation);
|
|
}
|
|
|
|
|
|
}
|