Accept button working on doubler decisions
This commit is contained in:
parent
7cf6539d36
commit
4163863983
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue