Accept button working on doubler decisions

This commit is contained in:
Matt Young 2024-06-21 16:21:39 -05:00
parent 7cf6539d36
commit 4163863983
2 changed files with 23 additions and 2 deletions

View File

@ -18,7 +18,25 @@ class DoublerDecisionController extends Controller
public function accept(Entry $entry)
{
//
$doublerInfo = $this->doublerService->getDoublerInfo($entry->student_id);
foreach ($doublerInfo as $info) {
if ($info['entryID'] != $entry->id) {
try {
EntryFlag::create([
'entry_id' => $info['entryID'],
'flag_name' => 'declined',
]);
} catch (\Exception $e) {
session()->flash('error', 'Entry ID'.$info['entryID'].' has already been declined.');
}
}
}
$this->doublerService->refreshDoublerCache();
$returnMessage = $entry->student->full_name().' accepted seating in '.$entry->audition->name;
return redirect()->back()->with('success', $returnMessage);
}
public function decline(Entry $entry)

View File

@ -31,7 +31,10 @@
<div class="flex items-center gap-x-4">
@if ($info['status'] === 'undecided')
<form method="POST" action="{{ route('doubler.accept',['entry'=>$info['entryID']]) }}">
@csrf
<button class="{{ $doublerButtonClasses }}">Accept</button>
</form>
<form method="POST" action="{{ route('doubler.decline',['entry'=>$info['entryID']]) }}">
@csrf
<button class="{{ $doublerButtonClasses }}">Decline</button>