Initial work on doubler column
This commit is contained in:
parent
7754b6df12
commit
b6d89f294d
|
|
@ -53,7 +53,23 @@ class SeatAuditionFormController extends Controller
|
|||
$doubler_data = [];
|
||||
foreach ($scored_entries as $e) {
|
||||
if ($e->student->isDoublerInEvent($audition->event_id)) {
|
||||
$doubler_data[$e->id] = $e->student->entriesForEvent($e->audition->event_id);
|
||||
// get the other entries for this student
|
||||
$doubler_data[$e->id]['entries'] = $e->student->entriesForEvent($e->audition->event_id);
|
||||
|
||||
// How many of this student's entries have been declined
|
||||
$declined_count = $doubler_data[$e->id]['entries']->filter(function ($entry) {
|
||||
return $entry->hasFlag('declined');
|
||||
})->count();
|
||||
|
||||
// set status
|
||||
// declined status is easy
|
||||
if ($e->hasFlag('declined')) {
|
||||
$doubler_data[$e->id]['status'] = 'declined';
|
||||
} elseif ($doubler_data[$e->id]['entries']->count() - $declined_count == 1) {
|
||||
$doubler_data[$e->id]['status'] = 'accepted';
|
||||
} else {
|
||||
$doubler_data[$e->id]['status'] = 'undecided';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
<x-table.td class="align-top">
|
||||
@if( isset($doubler_data[$entry->id]) )
|
||||
{{-- Check if this entry is a doubler --}}
|
||||
@foreach($doubler_data[$entry->id] as $de)
|
||||
@foreach($doubler_data[$entry->id]['entries'] as $de)
|
||||
{{-- If it is, render doubler blocks --}}
|
||||
<div class="border-2 border-gray-200 p-2 m-2">
|
||||
{{-- @var \App\Models\Entry $de --}}
|
||||
|
|
@ -60,6 +60,12 @@
|
|||
<br>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<span class="isolate flex w-full rounded-md shadow-xs">
|
||||
<button type="button" class="relative w-1/2 justify-center inline-flex items-center rounded-l-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-10">Accept</button>
|
||||
<button type="button" class="relative -ml-px w-1/2 justify-center inline-flex items-center rounded-r-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-10">Decline</button>
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
|
|
|||
Loading…
Reference in New Issue