Update seating controller for SCOBDA nomination ensembles to correctly redirect.
This commit is contained in:
parent
2e4e38bb15
commit
66016fb2ec
|
|
@ -6,7 +6,7 @@ use App\Http\Controllers\Controller;
|
|||
use App\Models\NominationEnsemble;
|
||||
use App\Models\NominationEnsembleEntry;
|
||||
|
||||
use function dd;
|
||||
use function redirect;
|
||||
|
||||
class ScobdaNominationSeatingController extends Controller implements NominationSeatingController
|
||||
{
|
||||
|
|
@ -29,14 +29,15 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
|||
return $item->data['instrument'];
|
||||
});
|
||||
|
||||
return view('nomination_ensembles.scobda.admin.seating.index', compact('ensembles', 'ensemble', 'acceptedNominations'));
|
||||
return view('nomination_ensembles.scobda.admin.seating.index',
|
||||
compact('ensembles', 'ensemble', 'acceptedNominations'));
|
||||
|
||||
}
|
||||
|
||||
public function seat(NominationEnsemble $ensemble)
|
||||
{
|
||||
$nominations = NominationEnsembleEntry::where('nomination_ensemble_id',
|
||||
$ensemble->id)->orderByRaw('CAST(data->"$.rank" AS UNSIGNED)')->get();
|
||||
$ensemble->id)->orderByRaw('CAST(data->"$.rank" AS UNSIGNED)')->inRandomOrder()->get();
|
||||
$rankGroupedNominations = $nominations->groupBy(function ($entry) {
|
||||
return $entry->data['rank'];
|
||||
});
|
||||
|
|
@ -71,6 +72,6 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
|||
$nomination->update(['data' => $data]);
|
||||
}
|
||||
|
||||
dd($acceptedNominations);
|
||||
return redirect()->route('nomination.admin.seating.show', ['ensemble' => $ensemble])->with('Seating Complete');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<x-slot:right_side>
|
||||
<x-form.form method="POST"
|
||||
action="{{ route('nomination.admin.seating.seat',[$ensemble]) }}">
|
||||
<x-form.button>Seat Ensemble</x-form.button>
|
||||
<x-form.button>Reseat Ensemble</x-form.button>
|
||||
</x-form.form>
|
||||
</x-slot:right_side>
|
||||
</x-card.heading>
|
||||
|
|
@ -33,14 +33,16 @@
|
|||
@foreach($ensemble->data['instruments'] as $instrument)
|
||||
@php($seatOn = 1)
|
||||
@continue(! $acceptedNominations->has($instrument))
|
||||
<tr>
|
||||
<x-table.th colspan="3" class="border-t-2 border-b-2">{{ $instrument }}</x-table.th>
|
||||
<tr class="border-t-2 border b-2">
|
||||
<x-table.th>{{ $instrument }}</x-table.th>
|
||||
<x-table.th>Student Name</x-table.th>
|
||||
<x-table.th>School (Nom Rank)</x-table.th>
|
||||
</tr>
|
||||
@foreach($acceptedNominations[$instrument] as $nom)
|
||||
<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 }}</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