auditionadmin/resources/views/admin/entries/edit.blade.php

92 lines
4.5 KiB
PHP

@php use App\Models\Seat; @endphp
<x-layout.app>
<x-card.card class="mx-auto max-w-2xl">
<x-card.heading>
Edit Entry #{{ $entry->id }}
<x-slot:right_side>
<x-delete-resource-modal action="{{route('admin.entries.destroy',$entry->id)}}" title="Delete entry #{{ $entry->id }}">
Confirm you would like to delete entry #{{$entry->id}} by {{$entry->student->full_name()}} on {{$entry->audition->name}}.
</x-delete-resource-modal>
</x-slot:right_side>
</x-card.heading>
<x-form.form id='entryEditForm' method="PATCH" action="/admin/entries/{{ $entry->id }}">
<x-form.body-grid columns="6">
@if(! Seat::where('entry_id', $entry->id)->exists())
<x-form.select name="student_id" colspan="4" disabled>
<x-slot:label>Student</x-slot:label>
@php($student = $students->find($entry->student_id))
<option value="{{ $student->id }}" {{ ($student->id == $entry->student_id ? 'selected':'') }}>
{{ $student->full_name(true) }} - {{ $student->school->name }} (Grade {{ $student->grade }})
</option>
</x-form.select>
@else
<p class="col-span-3 mt-4 ">{{ $entry->student->full_name() }} - {{ $entry->student->school->name }}</p>
@endif
@if(! Seat::where('entry_id', $entry->id)->exists())
<x-form.select name="audition_id" colspan="2">
<x-slot:label>Audition</x-slot:label>
@foreach ($auditions as $audition)
@continue($entry->student->grade < $audition->minimum_grade || $entry->student->grade > $audition->maximum_grade)
<option value="{{ $audition->id }}" {{ ($audition->id == $entry->audition_id ? 'selected':'') }}>
{{ $audition->name }}
</option>
@endforeach
</x-form.select>
@else
<p class="col-span-3 mt-4 ">{{ $entry->audition->name }}</p>
@endif
@if(auditionSetting('advanceTo'))
<div class="col-span-6 align-top">
<x-form.checkbox name="for_seating"
label="Enter for {{ auditionSetting('auditionAbbreviation') }}"
:checked="$entry->for_seating" />
</div>
<div class="col-span-6 align-top">
<x-form.checkbox name="for_advancement"
label="Enter for {{ auditionSetting('advanceTo') }}"
:checked="$entry->for_advancement" />
</div>
@else
<input type="hidden" name="for_seating" value="on">
@endif
</x-form.body-grid>
<x-form.footer class="!py-5">
<x-form.button>Edit Entry</x-form.button>
</x-form.footer>
</x-form.form>
</x-card.card>
<x-card.card class="mx-auto max-w-2xl mt-6">
<x-card.heading>Scores</x-card.heading>
<x-card.list.body>
<div class="grid sm:grid-cols-3 space-3 m-3">
@foreach($scores as $score)
@php($score->isValid())
<div class="border p-3">
<p class="font-semibold border-b">{{ $score->judge->full_name() }}</p>
@foreach($score->subscores as $subscore)
<p class="grid grid-cols-2 border-b">
<span>{{$subscore['subscore_name'] }}</span>
<span class="text-right">{{$subscore['score']}}</span>
</p>
@endforeach
@if(! $score->isValid())
<form method="POST" action="{{ route('scores.destroy',['score'=>$score->id]) }}">
@csrf
@method('DELETE')
<button type="submit" class="text-red-500 font-semibold pt-5">Invalid Score - Delete</button>
@endif
</div>
@endforeach
</div>
</x-card.list.body>
</x-card.card>
</x-layout.app>