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

156 lines
7.5 KiB
PHP

@php use App\Models\Seat; @endphp
<x-layout.app>
<x-card.card class="mx-auto max-w-3xl">
<x-card.heading>
Edit Entry #{{ $entry->id }}
@if($entry->scoreSheets()->count() === 0)
<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>
@endif
</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
<div class="col-span-3 align-top">
<x-form.checkbox name="late_fee_waived"
label="Wave late fee if applicable"/>
</div>
</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-3xl mt-6">
<x-card.heading>
Scores
<x-slot:right_side>
<x-form.button href="{{route('scores.entryScoreSheet', ['entry_id'=>$entry->id])}}">Edit Scores
</x-form.button>
</x-slot:right_side>
</x-card.heading>
<x-card.list.body>
<div class="grid sm:grid-cols-3 space-3 m-3">
@foreach($scores as $score)
<div class="border p-3">
<div class="grid grid-cols-2 border-b">
<span class="font-semibold text-sm">{{ $score->judge->full_name() }}</span>
<span class="text-right mb-2">
@if(! $score->entry->audition->hasFlag('seats_published') && ! $score->entry->audition->hasFlag('advancement_published'))
<x-delete-resource-modal
size="15"
action="{{route('scores.destroy',$score->id)}}"
title="Delete score">
Confirm you would like to delete the {{ $score->entry->audition->name }} score for {{ $score->entry->student->full_name() }} by {{ $score->judge->full_name() }}.
</x-delete-resource-modal>
@endif
</span>
</div>
@foreach($score->subscores as $subscore)
<p class="grid grid-cols-2 border-b">
<span class="text-sm">{{$subscore['subscore_name'] }}</span>
<span class="text-right">{{$subscore['score']}}</span>
</p>
@endforeach
<p class="grid grid-cols-2 border-b">
<span
class="font-semibold text-sm">{{ auditionSetting('auditionAbbreviation') }} Total</span>
<span class="text-right font-semibold">{{ $score->seating_total }}</span>
</p>
@if( auditionSetting('advanceTo'))
<p class="grid grid-cols-2 border-b">
<span class="font-semibold text-sm">{{ auditionSetting('advanceTo') }} Total</span>
<span class="text-right font-semibold">{{ $score->advancement_total }}</span>
</p>
@endif
@if(! $score->testValidity())
<div class="bg-red-500 text-white p-2 rounded mt-2">
<p class="text-sm">This score is invalid</p>
</div>
@endif
</div>
@endforeach
</div>
</x-card.list.body>
</x-card.card>
<x-card.card class="mt-5">
<x-card.heading>Log Entries</x-card.heading>
<x-table.table>
<thead>
<tr>
<x-table.th>Timestamp</x-table.th>
<x-table.th>IP</x-table.th>
<x-table.th>User</x-table.th>
<x-table.th>Message</x-table.th>
</tr>
</thead>
<x-table.body>
@foreach($logEntries as $logEntry)
<tr>
<x-table.td>{{ $logEntry->created_at }}</x-table.td>
<x-table.td>{{ $logEntry->ip_address }}</x-table.td>
<x-table.td>{{ $logEntry->user }}</x-table.td>
<x-table.td>{!! $logEntry->message !!}</x-table.td>
</tr>
@endforeach
</x-table.body>
</x-table.table>
</x-card.card>
</x-layout.app>