78 lines
3.7 KiB
PHP
78 lines
3.7 KiB
PHP
@php use Illuminate\Support\Facades\Auth; @endphp
|
|
@push('scripts')
|
|
{{-- Code from https://codepen.io/ryangjchandler/pen/WNQQKeR--}}
|
|
<script src="{{ asset('js/sort_table_by_column.js') }}"></script>
|
|
@endpush
|
|
<x-layout.app>
|
|
<x-slot:page_title>Entries</x-slot:page_title>
|
|
|
|
<x-layout.page-section-container>
|
|
<x-layout.page-section>
|
|
<x-slot:section_name>Add Entry</x-slot:section_name>
|
|
<x-form.form method="POST" action="/entries">
|
|
|
|
<x-form.body-grid columns="7" class="max-w-full" x-data="studentAuditionFilter()">
|
|
|
|
<x-form.select name="student_id" colspan="3" x-model="selectedStudentId" @change="filterAuditions">
|
|
<x-slot:label>Student</x-slot:label>
|
|
<option value="" disabled selected>Select a student</option>
|
|
<template x-for="student in students" :key="student.id">
|
|
<option :value="student.id" x-text="student.name"></option>
|
|
</template>
|
|
</x-form.select>
|
|
|
|
<x-form.select name="audition_id" colspan="3">
|
|
<x-slot:label>Audition</x-slot:label>
|
|
<option value="" disabled selected>Select an audition</option>
|
|
<template x-for="audition in filteredAuditions" :key="audition.id">
|
|
<option :value="audition.id" x-text="audition.name"></option>
|
|
</template>
|
|
</x-form.select>
|
|
|
|
<x-form.button class="mt-8">Save</x-form.button>
|
|
</x-form.body-grid>
|
|
</x-form.form>
|
|
</x-layout.page-section>
|
|
|
|
|
|
<x-layout.page-section>
|
|
<x-slot:section_name>Entry Listing</x-slot:section_name>
|
|
<x-slot:section_description>You have {{ $entries->count() }} entries</x-slot:section_description>
|
|
<div class="px-4">
|
|
<x-table.table>
|
|
<thead>
|
|
<tr>
|
|
<x-table.th first>Name</x-table.th>
|
|
<x-table.th>Grade</x-table.th>
|
|
<x-table.th>Audition</x-table.th>
|
|
<x-table.th spacer_only>
|
|
<span class="sr-only">Edit</span>
|
|
</x-table.th>
|
|
</tr>
|
|
</thead>
|
|
<x-table.body>
|
|
@foreach($entries as $entry)
|
|
<tr>
|
|
<x-table.td first>{{ $entry->student->full_name(true) }}</x-table.td>
|
|
<x-table.td>{{ $entry->student->grade }}</x-table.td>
|
|
<x-table.td>{{ $entry->audition->name }}</x-table.td>
|
|
<x-table.td for_button>
|
|
<form method="POST" action="/entries/{{ $entry->id }}" class="inline">
|
|
@csrf
|
|
@method('DELETE')
|
|
<x-table.button
|
|
onclick="return confirm('Please confirm you would like to delete the {{ $entry->audition->name }} entry for {{ $entry->student->full_name() }}');"
|
|
>Delete</x-table.button>
|
|
</form>
|
|
|
|
</x-table.td>
|
|
</tr>
|
|
@endforeach
|
|
</x-table.body>
|
|
</x-table.table>
|
|
</div>
|
|
</x-layout.page-section>
|
|
</x-layout.page-section-container>
|
|
@include('students.student_audition_select_script')
|
|
</x-layout.app>
|