auditionadmin/resources/views/doubler_request/index.blade.php

45 lines
2.1 KiB
PHP

<x-layout.app>
<x-slot:page_title>Doubler Requests</x-slot:page_title>
<x-form.form method="POST" action="{{route('doubler_request.make_request')}}">
@foreach($events as $event)
<x-card.card class="mb-5">
<x-card.heading>{{ $event->name }}</x-card.heading>
<x-table.table>
<thead>
<tr>
<x-table.th>Student Name</x-table.th>
<x-table.th>Entries</x-table.th>
<x-table.th>Request</x-table.th>
</tr>
</thead>
<x-table.body>
@foreach($students as $student)
@continue(! array_key_exists($student->id, $doublers[$event->id]))
@php
$existingRequest = $existingRequests
->where('student_id',$student->id)
->where('event_id',$event->id);
$value = $existingRequest?->first()?->request ?? '';
@endphp
<tr>
<x-table.td>{{ $student->full_name() }}</x-table.td>
<x-table.td>
@foreach($doublers[$event->id][$student->id]['entries'] as $entry)
<p>{{$entry->audition->name}}</p>
@endforeach
</x-table.td>
<x-table.td>
<x-form.field
value="{{$value}}"
name="doubler_requests[{{$event->id}}][{{$student->id}}]"/>
</x-table.td>
</tr>
@endforeach
</x-table.body>
</x-table.table>
</x-card.card>
@endforeach
<x-form.button type="submit">Save Doubler Requests</x-form.button>
</x-form.form>
</x-layout.app>