Show appropriate options on seating page for SCOBDA nomination ensembles
This commit is contained in:
parent
8e70f97fb0
commit
9a9d567c78
|
|
@ -42,6 +42,27 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
||||||
return $entry->data['rank'];
|
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();
|
$acceptedNominations = collect();
|
||||||
$rankOn = 1;
|
$rankOn = 1;
|
||||||
// Collect students to add to the ensemble
|
// Collect students to add to the ensemble
|
||||||
|
|
@ -72,6 +93,11 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
||||||
$nomination->update(['data' => $data]);
|
$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');
|
return redirect()->route('nomination.admin.seating.show', ['ensemble' => $ensemble])->with('Seating Complete');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,20 @@
|
||||||
<x-card.card>
|
<x-card.card>
|
||||||
<x-card.heading>
|
<x-card.heading>
|
||||||
{{ $ensemble->name }}
|
{{ $ensemble->name }}
|
||||||
<x-slot:right_side>
|
<x-slot:right_side class="flex">
|
||||||
|
@if($ensemble->data['seated'] ?? false)
|
||||||
<x-form.form method="POST"
|
<x-form.form method="POST"
|
||||||
action="{{ route('nomination.admin.seating.seat',[$ensemble]) }}">
|
action="{{ route('nomination.admin.seating.seat',[$ensemble]) }}">
|
||||||
<x-form.button>Reseat Ensemble</x-form.button>
|
<input type="hidden" name="action" value="clear">
|
||||||
|
<x-form.button>Clear Seats</x-form.button>
|
||||||
</x-form.form>
|
</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-slot:right_side>
|
||||||
</x-card.heading>
|
</x-card.heading>
|
||||||
<x-table.table>
|
<x-table.table>
|
||||||
|
|
@ -42,7 +51,8 @@
|
||||||
<tr>
|
<tr>
|
||||||
<x-table.td>{{ $seatOn }}</x-table.td>
|
<x-table.td>{{ $seatOn }}</x-table.td>
|
||||||
<x-table.td>{{ $nom->student->full_name() }}</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>
|
</tr>
|
||||||
@php($seatOn++)
|
@php($seatOn++)
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue