Scobda nomination ensembles #106
|
|
@ -42,6 +42,27 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
|||
return $entry->data['rank'];
|
||||
});
|
||||
|
||||
$validData = request()->validate([
|
||||
'action' => ['required', 'in:seat,clear'],
|
||||
]);
|
||||
$action = $validData['action'];
|
||||
|
||||
if ($action == 'clear') {
|
||||
foreach ($nominations as $nomination) {
|
||||
$data = $nomination->data;
|
||||
unset($data['accepted']);
|
||||
$nomination->update(['data' => $data]);
|
||||
}
|
||||
|
||||
$data = $ensemble->data;
|
||||
$data['seated'] = false;
|
||||
$ensemble->data = $data;
|
||||
$ensemble->update();
|
||||
|
||||
return redirect()->route('nomination.admin.seating.show',
|
||||
['ensemble' => $ensemble])->with('Seating Cleared');
|
||||
}
|
||||
|
||||
$acceptedNominations = collect();
|
||||
$rankOn = 1;
|
||||
// Collect students to add to the ensemble
|
||||
|
|
@ -72,6 +93,11 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
|||
$nomination->update(['data' => $data]);
|
||||
}
|
||||
|
||||
$data = $ensemble->data;
|
||||
$data['seated'] = true;
|
||||
$ensemble->data = $data;
|
||||
$ensemble->update();
|
||||
|
||||
return redirect()->route('nomination.admin.seating.show', ['ensemble' => $ensemble])->with('Seating Complete');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,20 @@
|
|||
<x-card.card>
|
||||
<x-card.heading>
|
||||
{{ $ensemble->name }}
|
||||
<x-slot:right_side>
|
||||
<x-form.form method="POST"
|
||||
action="{{ route('nomination.admin.seating.seat',[$ensemble]) }}">
|
||||
<x-form.button>Reseat Ensemble</x-form.button>
|
||||
</x-form.form>
|
||||
<x-slot:right_side class="flex">
|
||||
@if($ensemble->data['seated'] ?? false)
|
||||
<x-form.form method="POST"
|
||||
action="{{ route('nomination.admin.seating.seat',[$ensemble]) }}">
|
||||
<input type="hidden" name="action" value="clear">
|
||||
<x-form.button>Clear Seats</x-form.button>
|
||||
</x-form.form>
|
||||
@else
|
||||
<x-form.form method="POST"
|
||||
action="{{ route('nomination.admin.seating.seat',[$ensemble]) }}">
|
||||
<input type="hidden" name="action" value="seat">
|
||||
<x-form.button>Seat Ensemble</x-form.button>
|
||||
</x-form.form>
|
||||
@endif
|
||||
</x-slot:right_side>
|
||||
</x-card.heading>
|
||||
<x-table.table>
|
||||
|
|
@ -42,7 +51,8 @@
|
|||
<tr>
|
||||
<x-table.td>{{ $seatOn }}</x-table.td>
|
||||
<x-table.td>{{ $nom->student->full_name() }}</x-table.td>
|
||||
<x-table.td>{{ $nom->student->school->name }} ({{ $nom->data['rank'] }})</x-table.td>
|
||||
<x-table.td>{{ $nom->student->school->name }} ({{ $nom->data['rank'] }})
|
||||
</x-table.td>
|
||||
</tr>
|
||||
@php($seatOn++)
|
||||
@endforeach
|
||||
|
|
|
|||
Loading…
Reference in New Issue