Advancement tabulation #3
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers\Tabulation;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Audition;
|
use App\Models\Audition;
|
||||||
|
use App\Models\Entry;
|
||||||
use App\Services\TabulationService;
|
use App\Services\TabulationService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
|
@ -33,4 +34,27 @@ class AdvancementController extends Controller
|
||||||
|
|
||||||
return view('tabulation.advancement.ranking', compact('audition', 'entries', 'scoringComplete'));
|
return view('tabulation.advancement.ranking', compact('audition', 'entries', 'scoringComplete'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAuditionPassers(Request $request, Audition $audition)
|
||||||
|
{
|
||||||
|
$passingEntries = $request->input('pass');
|
||||||
|
$passingEntries = array_keys($passingEntries);
|
||||||
|
$audition->addFlag('advancement_published');
|
||||||
|
$entries = Entry::whereIn('id', $passingEntries)->get();
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
$entry->addFlag('will_advance');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('advancement.ranking', ['audition' => $audition->id])->with('success', 'Passers have been set successfully');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearAuditionPassers(Request $request, Audition $audition)
|
||||||
|
{
|
||||||
|
$audition->removeFlag('advancement_published');
|
||||||
|
foreach ($audition->entries as $entry) {
|
||||||
|
$entry->removeFlag('will_advance');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('advancement.ranking', ['audition' => $audition->id])->with('success', 'Passers have been cleared successfully');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
<x-layout.app>
|
<x-layout.app>
|
||||||
<x-slot:page_title>{{ auditionSetting('advanceTo') }} Advancement - {{ $audition->name }}</x-slot:page_title>
|
<x-slot:page_title>{{ auditionSetting('advanceTo') }} Advancement - {{ $audition->name }}</x-slot:page_title>
|
||||||
<x-form.form method="POST" action="#">
|
<x-form.form method="POST" action="{{ route('advancement.setAuditionPassers',['audition' => $audition->id]) }}">
|
||||||
<div class="grid grid-cols-4" x-data="checkboxSelector()">
|
<div class="grid grid-cols-4" x-data="checkboxSelector()">
|
||||||
<div class="col-span-3">
|
<div class="col-span-3">
|
||||||
@include('tabulation.advancement.results-table')
|
@include('tabulation.advancement.results-table')
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-4">
|
<div class="ml-4">
|
||||||
@if($scoringComplete)
|
@if( $audition->hasFlag('advancement_published') )
|
||||||
|
@method('DELETE')
|
||||||
|
<x-form.button type="submit" class="mt-3">Clear Advancement</x-form.button>
|
||||||
|
@elseif($scoringComplete)
|
||||||
|
|
||||||
<x-card.card>
|
<x-card.card>
|
||||||
<x-card.heading>Pass Entries</x-card.heading>
|
<x-card.heading>Pass Entries</x-card.heading>
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,15 @@
|
||||||
<x-icons.checkmark color="green"/>
|
<x-icons.checkmark color="green"/>
|
||||||
@endif
|
@endif
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
@if($scoringComplete)
|
@if( $audition->hasFlag('advancement_published') )
|
||||||
<x-table.td>
|
<x-table.td>
|
||||||
<x-form.checkbox name="pass-{{$entry->id}}" x-ref="checkboxes" class="checkbox"></x-form.checkbox>
|
@if($entry->hasFlag('will_advance'))
|
||||||
|
<x-icons.checkmark color="green"/>
|
||||||
|
@endif
|
||||||
|
</x-table.td>
|
||||||
|
@elseif($scoringComplete)
|
||||||
|
<x-table.td>
|
||||||
|
<x-form.checkbox name="pass[{{$entry->id}}]" x-ref="checkboxes" class="checkbox"></x-form.checkbox>
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ Route::middleware(['auth', 'verified', CheckIfCanTab::class])->group(function ()
|
||||||
Route::prefix('advancement/')->controller(\App\Http\Controllers\Tabulation\AdvancementController::class)->group(function () {
|
Route::prefix('advancement/')->controller(\App\Http\Controllers\Tabulation\AdvancementController::class)->group(function () {
|
||||||
Route::get('/status', 'status')->name('advancement.status');
|
Route::get('/status', 'status')->name('advancement.status');
|
||||||
Route::get('/{audition}', 'ranking')->name('advancement.ranking');
|
Route::get('/{audition}', 'ranking')->name('advancement.ranking');
|
||||||
|
Route::post('/{audition}', 'setAuditionPassers')->name('advancement.setAuditionPassers');
|
||||||
|
Route::delete('/{audition}', 'clearAuditionPassers')->name('advancement.clearAuditionPassers');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Doubler decision routes
|
// Doubler decision routes
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue