Score entry form displaying. Next to work on processing it.

This commit is contained in:
Matt Young 2024-06-07 00:21:27 -05:00
parent 969efd5e54
commit 9e577824a3
7 changed files with 70 additions and 6 deletions

View File

@ -24,7 +24,7 @@ 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('users')->get(); $rooms = Room::with(['judges.school','auditions'])->get();
return view('admin.rooms.judge_assignments', compact('usersWithoutRooms','usersWithRooms','rooms')); return view('admin.rooms.judge_assignments', compact('usersWithoutRooms','usersWithRooms','rooms'));
} }

View File

@ -14,5 +14,17 @@ class TabulationController extends Controller
return view('tabulation.choose_entry'); return view('tabulation.choose_entry');
} }
public function entryScoreSheet(Request $request)
{
$entry = Entry::with(['student','audition.room.judges'])->find($request->input('entry_id'));
$judges = $entry->audition->room->judges;
$scoring_guide = $entry->audition->scoringGuide;
$subscores = $entry->audition->scoringGuide->subscores->sortBy('display_order');
if (!$entry) {
return redirect()->route('tabulation.chooseEntry')->with('error','Entry not found');
}
return view('tabulation.entry_score_sheet', compact('entry','judges','scoring_guide','subscores'));
}
} }

View File

@ -61,9 +61,9 @@
<dt> <dt>
<p> <p>
<span class="text-gray-700">{{ $judge->full_name() }}, </span> <span class="text-gray-700">{{ $judge->full_name() }}, </span>
<span class="text-gray-500 text-xs">Vinita</span> <span class="text-gray-500 text-xs">{{ $judge->school->name }}</span>
</p> </p>
<p class="text-gray-500 text-xs">Admin</p> <p class="text-gray-500 text-xs">{{ $judge->judging_preference }}</p>
</dt> </dt>
<dd class="text-gray-500 text-xs"> <dd class="text-gray-500 text-xs">
<form method="POST" action="/admin/rooms/{{ $room->id }}/judge" id="removeJudgeFromRoom{{ $room->id }}"> <form method="POST" action="/admin/rooms/{{ $room->id }}/judge" id="removeJudgeFromRoom{{ $room->id }}">

View File

@ -8,7 +8,7 @@
@endif @endif
</div> </div>
@if($right_side) @if($right_side)
<div> <div {{ $right_side->attributes->merge([]) }}>
{{ $right_side }} {{ $right_side }}
</div> </div>
@endif @endif

View File

@ -3,7 +3,7 @@
<x-card.card class="mx-auto max-w-sm"> <x-card.card class="mx-auto max-w-sm">
<x-card.heading>Choose Entry</x-card.heading> <x-card.heading>Choose Entry</x-card.heading>
<div class=""> <div class="">
<x-form.form method="GET" action="#" class="mb-4 mt-3"> <x-form.form method="GET" action="/tabulation/entries/" class="mb-4 mt-3">
<x-form.field name="entry_id" label_text="Entry ID"></x-form.field> <x-form.field name="entry_id" label_text="Entry ID"></x-form.field>
</x-form.form> </x-form.form>
<x-form.footer class="px-4 sm:px-8 pb-4"> <x-form.footer class="px-4 sm:px-8 pb-4">

View File

@ -0,0 +1,51 @@
<x-layout.app>
<x-slot:page_title>Entry Score Sheet</x-slot:page_title>
<x-card.card class="mx-auto max-w-7xl">
<x-card.heading>
{{ $entry->audition->name }} #{{ $entry->draw_number }}
<x-slot:subheading>ID #{{ $entry->id }}</x-slot:subheading>
<x-slot:right_side class="text-right">
<p>{{ $entry->student->full_name() }}</p>
<p>{{ $entry->student->school->name }}</p>
</x-slot:right_side>
</x-card.heading>
<x-form.form>
<x-table.table>
<thead>
<tr>
<x-table.th>Judges</x-table.th>
@foreach($subscores as $subscore)
<x-table.th>{{ $subscore->name }}</x-table.th>
@endforeach
<x-table.th>Total (unweighted)</x-table.th>
</tr>
</thead>
<x-table.body :sortable="false">
@foreach($judges as $judge)
<tr x-data="{ scores: [], total: 0, calculateTotal: function() { this.total = this.scores.reduce((a, b) => parseFloat(a) + parseFloat(b), 0); } }">
<x-table.td>{{ $judge->full_name() }}</x-table.td>
@foreach($subscores as $subscore)
<x-table.td>
<input type="number"
id="j{{ $judge->id }}ss{{ $subscore->id }}"
name="judge{{ $judge->id }}[subscore{{ $subscore->id }}]"
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6 judge{{$judge->id}}score"
x-model="scores[{{ $loop->index }}]"
x-on:input="calculateTotal" >
</x-table.td>
@endforeach
<x-table.td id="judge{{ $judge->id }}total" x-text="total">
</x-table.td>
</tr>
@endforeach
</x-table.body>
</x-table.table>
<x-form.footer class="mb-3">
<x-form.button>Save Scores</x-form.button>
</x-form.footer>
</x-form.form>
</x-card.card>
</x-layout.app>

View File

@ -22,8 +22,9 @@ Route::view('/','welcome')->middleware('guest');
Route::middleware(['auth','verified',CheckIfCanTab::class])->prefix('tabulation/')->group(function() { Route::middleware(['auth','verified',CheckIfCanTab::class])->prefix('tabulation/')->group(function() {
// Generic Tabulation Routes // Generic Tabulation Routes
Route::controller(\App\Http\Controllers\Tabulation\TabulationController::class)->group(function() { Route::controller(\App\Http\Controllers\Tabulation\TabulationController::class)->group(function() {
Route::get('/enter_scores','chooseEntry'); Route::get('/enter_scores','chooseEntry')->name('tabulation.chooseEntry');
Route::get('/record_noshow','chooseEntry'); Route::get('/record_noshow','chooseEntry');
Route::get('/entries','entryScoreSheet');
}); });
}); });