Scobda nomination ensembles #106
|
|
@ -51,6 +51,7 @@ class StudentController extends Controller
|
||||||
new UniqueFullNameAtSchool(request('first_name'), request('last_name'), Auth::user()->school_id),
|
new UniqueFullNameAtSchool(request('first_name'), request('last_name'), Auth::user()->school_id),
|
||||||
],
|
],
|
||||||
'grade' => ['required', 'integer'],
|
'grade' => ['required', 'integer'],
|
||||||
|
'shirt_size' => ['nullable'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$student = Student::create([
|
$student = Student::create([
|
||||||
|
|
@ -59,6 +60,9 @@ class StudentController extends Controller
|
||||||
'grade' => request('grade'),
|
'grade' => request('grade'),
|
||||||
'school_id' => Auth::user()->school_id,
|
'school_id' => Auth::user()->school_id,
|
||||||
]);
|
]);
|
||||||
|
if (request('shirt_size') !== 'none') {
|
||||||
|
$student->update(['optional_data->shirt_size' => $request['shirt_size']]);
|
||||||
|
}
|
||||||
$message = 'Created student #'.$student->id.' - '.$student->full_name().'<br>Grade: '.$student->grade.'<br>School: '.$student->school->name;
|
$message = 'Created student #'.$student->id.' - '.$student->full_name().'<br>Grade: '.$student->grade.'<br>School: '.$student->school->name;
|
||||||
AuditLogEntry::create([
|
AuditLogEntry::create([
|
||||||
'user' => auth()->user()->email,
|
'user' => auth()->user()->email,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,13 @@ class Student extends Model
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'optional_data' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function school(): BelongsTo
|
public function school(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(School::class);
|
return $this->belongsTo(School::class);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
<x-form.body-grid columns="8" class="max-w-full">
|
<x-form.body-grid columns="8" class="max-w-full">
|
||||||
<x-form.field name="first_name" label_text="First Name" colspan="3" autofocus />
|
<x-form.field name="first_name" label_text="First Name" colspan="3" autofocus />
|
||||||
<x-form.field name="last_name" label_text="Last Name" colspan="3"/>
|
<x-form.field name="last_name" label_text="Last Name" colspan="3"/>
|
||||||
{{-- <x-form.field name="grade" label_text="Grade" colspan="1" />--}}
|
|
||||||
|
|
||||||
<x-form.select name="grade">
|
<x-form.select name="grade">
|
||||||
<x-slot:label>Grade</x-slot:label>
|
<x-slot:label>Grade</x-slot:label>
|
||||||
|
|
@ -21,6 +20,25 @@
|
||||||
@php($n++);
|
@php($n++);
|
||||||
@endwhile
|
@endwhile
|
||||||
</x-form.select>
|
</x-form.select>
|
||||||
|
|
||||||
|
@if(auditionSetting('student_data_collect_shirt_size'))
|
||||||
|
<x-form.select name="shirt_size" colspan="2">
|
||||||
|
<x-slot:label>Shirt Size</x-slot:label>
|
||||||
|
<option value="none"> </option>
|
||||||
|
<option value="YS">Youth S</option>
|
||||||
|
<option value="YM">Youth M</option>
|
||||||
|
<option value="YL">Youth L</option>
|
||||||
|
<option value="YXL">Youth XL</option>
|
||||||
|
<option value="S">S</option>
|
||||||
|
<option value="M">M</option>
|
||||||
|
<option value="L">L</option>
|
||||||
|
<option value="XL">XL</option>
|
||||||
|
<option value="2XL">2XL</option>
|
||||||
|
<option value="3XL">3XL</option>
|
||||||
|
</x-form.select>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
<x-form.button class="mt-6">Save</x-form.button>
|
<x-form.button class="mt-6">Save</x-form.button>
|
||||||
</x-form.body-grid>
|
</x-form.body-grid>
|
||||||
</x-form.form>
|
</x-form.form>
|
||||||
|
|
@ -35,6 +53,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<x-table.th first>Name</x-table.th>
|
<x-table.th first>Name</x-table.th>
|
||||||
<x-table.th>Grade</x-table.th>
|
<x-table.th>Grade</x-table.th>
|
||||||
|
@if(auditionSetting('student_data_collect_shirt_size'))
|
||||||
|
<x-table.th>Shirt</x-table.th>
|
||||||
|
@endif
|
||||||
<x-table.th class="hidden md:table-cell">Entries</x-table.th>
|
<x-table.th class="hidden md:table-cell">Entries</x-table.th>
|
||||||
<x-table.th spacer_only>
|
<x-table.th spacer_only>
|
||||||
<span class="sr-only">Edit</span>
|
<span class="sr-only">Edit</span>
|
||||||
|
|
@ -46,6 +67,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<x-table.td first>{{ $student->full_name(true) }}</x-table.td>
|
<x-table.td first>{{ $student->full_name(true) }}</x-table.td>
|
||||||
<x-table.td>{{ $student->grade }}</x-table.td>
|
<x-table.td>{{ $student->grade }}</x-table.td>
|
||||||
|
@if(auditionSetting('student_data_collect_shirt_size'))
|
||||||
|
<x-table.th>sss</x-table.th>
|
||||||
|
@endif
|
||||||
<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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue