Rehash monitor page to deal with prelims
This commit is contained in:
parent
add9f9e25d
commit
982dfa46a0
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\Tabulation\CheckPrelimResult;
|
||||
use App\Models\Entry;
|
||||
use App\Models\PrelimDefinition;
|
||||
|
||||
use function compact;
|
||||
|
||||
class MonitorController extends Controller
|
||||
{
|
||||
|
|
@ -15,8 +19,26 @@ class MonitorController extends Controller
|
|||
$formRoute = 'monitor.enterFlag';
|
||||
$title = 'Flag Entry';
|
||||
|
||||
return view('tabulation.choose_entry', compact('method', 'formRoute', 'title'));
|
||||
//return view('tabulation.choose_entry', compact('method', 'formRoute', 'title'));
|
||||
$prelims = PrelimDefinition::with('audition')->get();
|
||||
$prelimDefinition = null;
|
||||
|
||||
return view('monitor.index', compact('prelims', 'prelimDefinition'));
|
||||
|
||||
}
|
||||
|
||||
public function prelimStatus(PrelimDefinition $prelimDefinition)
|
||||
{
|
||||
if (! auth()->user()->hasFlag('monitor')) {
|
||||
abort(403);
|
||||
}
|
||||
$prelims = PrelimDefinition::with('audition')->get();
|
||||
$entries = $prelimDefinition->audition->entries()->with('student.school')->with('PrelimScoreSheets')->get();
|
||||
|
||||
// foreach ($entries as $entry) {
|
||||
// app(CheckPrelimResult::class)->__invoke($entry);
|
||||
// }
|
||||
return view('monitor.index', compact('prelims', 'prelimDefinition', 'entries'));
|
||||
}
|
||||
|
||||
public function flagForm()
|
||||
|
|
|
|||
|
|
@ -141,6 +141,18 @@ class Entry extends Model
|
|||
return $this->hasMany(PrelimScoreSheet::class);
|
||||
}
|
||||
|
||||
public function prelimResult()
|
||||
{
|
||||
if ($this->hasFlag('passed_prelim')) {
|
||||
return 'passed';
|
||||
}
|
||||
if ($this->hasFlag('failed_prelim')) {
|
||||
return 'failed';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function bonusScores(): HasMany
|
||||
{
|
||||
return $this->hasMany(BonusScore::class);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
<x-layout.app>
|
||||
<x-slot:page_title>Monitor Dashboard</x-slot:page_title>
|
||||
<x-card.card class="max-w-xl mx-auto">
|
||||
<x-card.heading>
|
||||
Prelim Auditions
|
||||
<x-slot:right_side>
|
||||
<x-form.select name="prelim_id" onchange="if (this.value) window.location.href = this.value">
|
||||
<option value="" disabled selected hidden>Choose Prelim...</option>
|
||||
@foreach ($prelims as $prelim)
|
||||
<option
|
||||
value="{{ route('monitor.prelimStatus', $prelim) }}">{{$prelim->audition->name}}</option>
|
||||
@endforeach
|
||||
</x-form.select>
|
||||
</x-slot:right_side>
|
||||
</x-card.heading>
|
||||
@if($prelimDefinition)
|
||||
<x-table.table>
|
||||
<thead>
|
||||
<tr>
|
||||
<x-table.th>Entry</x-table.th>
|
||||
<x-table.th>Name</x-table.th>
|
||||
<x-table.th>School</x-table.th>
|
||||
<x-table.th>Status</x-table.th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($entries as $entry)
|
||||
<tr>
|
||||
<x-table.td>{{ $prelimDefinition->audition->name }} {{ $entry->draw_number }}</x-table.td>
|
||||
<x-table.td>{{ $entry->student->full_name() }}</x-table.td>
|
||||
<x-table.td>{{ $entry->student->school->name }}</x-table.td>
|
||||
@if($entry->hasFlag('failed_prelim'))
|
||||
<x-table.td>Failed</x-table.td>
|
||||
@elseif($entry->hasFlag('passed_prelim'))
|
||||
<x-table.td>Passed</x-table.td>
|
||||
@else
|
||||
<x-table.td>Pending</x-table.td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</x-table.table>
|
||||
@endif
|
||||
</x-card.card>
|
||||
</x-layout.app>
|
||||
|
|
@ -31,6 +31,7 @@ Route::prefix('filters')->middleware(['auth', 'verified'])->controller(FilterCon
|
|||
// Monitor Related Routes
|
||||
Route::prefix('monitor')->middleware(['auth', 'verified'])->controller(MonitorController::class)->group(function () {
|
||||
Route::get('/', 'index')->name('monitor.index');
|
||||
Route::get('/prelim/{prelimDefinition}', 'prelimStatus')->name('monitor.prelimStatus');
|
||||
Route::post('/enter_flag', 'flagForm')->name('monitor.enterFlag');
|
||||
Route::post('enter_flag/{entry}', 'storeFlag')->name('monitor.storeFlag');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue