auditionadmin/resources/views/tabulation/entry_score_sheet.blade.php

52 lines
2.5 KiB
PHP

<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>