Scobda nomination ensembles #106
|
|
@ -7,6 +7,7 @@ use App\Models\Audition;
|
||||||
use App\Models\AuditLogEntry;
|
use App\Models\AuditLogEntry;
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
|
use App\Models\NominationEnsemble;
|
||||||
use App\Models\School;
|
use App\Models\School;
|
||||||
use App\Models\Student;
|
use App\Models\Student;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
@ -14,6 +15,8 @@ use Illuminate\Support\Facades\Auth;
|
||||||
use function abort;
|
use function abort;
|
||||||
use function auth;
|
use function auth;
|
||||||
use function compact;
|
use function compact;
|
||||||
|
use function max;
|
||||||
|
use function min;
|
||||||
use function request;
|
use function request;
|
||||||
use function to_route;
|
use function to_route;
|
||||||
use function view;
|
use function view;
|
||||||
|
|
@ -54,8 +57,8 @@ class StudentController extends Controller
|
||||||
if (! Auth::user()->is_admin) {
|
if (! Auth::user()->is_admin) {
|
||||||
abort(403);
|
abort(403);
|
||||||
}
|
}
|
||||||
$minGrade = Audition::min('minimum_grade');
|
$minGrade = min(Audition::min('minimum_grade'), NominationEnsemble::min('minimum_grade'));
|
||||||
$maxGrade = Audition::max('maximum_grade');
|
$maxGrade = max(Audition::max('maximum_grade'), NominationEnsemble::max('maximum_grade'));
|
||||||
$schools = School::orderBy('name')->get();
|
$schools = School::orderBy('name')->get();
|
||||||
|
|
||||||
return view('admin.students.create', ['schools' => $schools, 'minGrade' => $minGrade, 'maxGrade' => $maxGrade]);
|
return view('admin.students.create', ['schools' => $schools, 'minGrade' => $minGrade, 'maxGrade' => $maxGrade]);
|
||||||
|
|
@ -105,8 +108,8 @@ class StudentController extends Controller
|
||||||
if (! Auth::user()->is_admin) {
|
if (! Auth::user()->is_admin) {
|
||||||
abort(403);
|
abort(403);
|
||||||
}
|
}
|
||||||
$minGrade = Audition::min('minimum_grade');
|
$minGrade = min(Audition::min('minimum_grade'), NominationEnsemble::min('minimum_grade'));
|
||||||
$maxGrade = Audition::max('maximum_grade');
|
$maxGrade = max(Audition::max('maximum_grade'), NominationEnsemble::max('maximum_grade'));
|
||||||
$schools = School::orderBy('name')->get();
|
$schools = School::orderBy('name')->get();
|
||||||
$student->loadCount('entries');
|
$student->loadCount('entries');
|
||||||
$entries = $student->entries;
|
$entries = $student->entries;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
@php use App\Models\Audition;use Illuminate\Support\Facades\Auth; @endphp
|
@php use App\Models\Audition;use App\Models\NominationEnsemble;use Illuminate\Support\Facades\Auth; @endphp
|
||||||
|
|
||||||
<x-layout.app>
|
<x-layout.app>
|
||||||
<x-slot:page_title>Students</x-slot:page_title>
|
<x-slot:page_title>Students</x-slot:page_title>
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
<x-form.select name="grade">
|
<x-form.select name="grade">
|
||||||
<x-slot:label>Grade</x-slot:label>
|
<x-slot:label>Grade</x-slot:label>
|
||||||
@php($n = Audition::min('minimum_grade'))
|
@php($n = min(Audition::min('minimum_grade'),NominationEnsemble::min('minimum_grade')))
|
||||||
@php($maxGrade = Audition::max('maximum_grade'))
|
@php($maxGrade = max(Audition::max('maximum_grade'), NominationEnsemble::max('maximum_grade')))
|
||||||
@while($n <= $maxGrade)
|
@while($n <= $maxGrade)
|
||||||
<option value="{{ $n }}">{{ $n }}</option>
|
<option value="{{ $n }}">{{ $n }}</option>
|
||||||
@php($n++);
|
@php($n++);
|
||||||
|
|
@ -65,7 +65,8 @@
|
||||||
<x-table.td class="hidden md:table-cell">{{ $student->entries_count }}</x-table.td>
|
<x-table.td class="hidden md:table-cell">{{ $student->entries_count }}</x-table.td>
|
||||||
<x-table.td for_button>
|
<x-table.td for_button>
|
||||||
@if( $student->entries_count === 0)
|
@if( $student->entries_count === 0)
|
||||||
<form method="POST" action="{{ route('students.destroy',$student) }}" class="inline">
|
<form method="POST" action="{{ route('students.destroy',$student) }}"
|
||||||
|
class="inline">
|
||||||
@csrf
|
@csrf
|
||||||
@method('DELETE')
|
@method('DELETE')
|
||||||
<x-table.button
|
<x-table.button
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue