63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Tabulation;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Entry;
|
|
use Illuminate\Http\Request;
|
|
|
|
class EntryFlagController extends Controller
|
|
{
|
|
public function noShowSelect()
|
|
{
|
|
$method = 'GET';
|
|
$formRoute = 'entry-flags.confirmNoShow';
|
|
|
|
return view('tabulation.choose_entry', compact('method', 'formRoute'));
|
|
}
|
|
|
|
public function noShowConfirm(Request $request)
|
|
{
|
|
$validData = $request->validate([
|
|
'entry_id' => 'required|exists:entries,id',
|
|
]);
|
|
$entry = Entry::with('flags')->withCount('scoreSheets')->find($validData['entry_id']);
|
|
if ($entry->hasFlag('no_show')) {
|
|
$formId = 'no-show-cancellation-form';
|
|
$buttonName = 'Remove No Show';
|
|
$submitRouteName = 'entry-flags.undoNoShow';
|
|
$cardHeading = 'Undo No-Show';
|
|
$method = 'DELETE';
|
|
} else {
|
|
$formId = 'no-show-confirmation-form';
|
|
$buttonName = 'Confirm No Show';
|
|
$submitRouteName = 'entry-flags.enterNoShow';
|
|
$cardHeading = 'Confirm No-Show';
|
|
$method = 'POST';
|
|
}
|
|
$scores = [];
|
|
if($entry->score_sheets_count > 0) {
|
|
$scores = $entry->scoreSheets;
|
|
$scores->load('judge');
|
|
}
|
|
return view('tabulation.no_show_confirm',
|
|
compact('entry',
|
|
'formId',
|
|
'buttonName',
|
|
'submitRouteName',
|
|
'cardHeading',
|
|
'method',
|
|
'scores'));
|
|
}
|
|
|
|
public function enterNoShow(Entry $entry)
|
|
{
|
|
//
|
|
}
|
|
|
|
public function undoNoShow(Entry $entry)
|
|
{
|
|
//
|
|
}
|
|
}
|