diff --git a/app/Http/Controllers/Tabulation/DoublerDecisionController.php b/app/Http/Controllers/Tabulation/DoublerDecisionController.php new file mode 100644 index 0000000..99e0640 --- /dev/null +++ b/app/Http/Controllers/Tabulation/DoublerDecisionController.php @@ -0,0 +1,40 @@ +doublerService = $doublerService; + } + + public function accept(Entry $entry) + { + // + } + + public function decline(Entry $entry) + { + if ($entry->hasFlag('declined')) { + return redirect()->back()->with('caution', 'Entry is already declined'); + } + EntryFlag::create([ + 'entry_id' => $entry->id, + 'flag_name' => 'declined', + ]); + + $this->doublerService->refreshDoublerCache(); + + $returnMessage = $entry->student->full_name().' declined seating in '.$entry->audition->name; + + return redirect()->back()->with('success', $returnMessage); + } +} diff --git a/app/Models/EntryFlag.php b/app/Models/EntryFlag.php index cf44243..8bd484b 100644 --- a/app/Models/EntryFlag.php +++ b/app/Models/EntryFlag.php @@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; class EntryFlag extends Model { + protected $guarded = []; + // Possible flags include // - declined: used if a doubler declines a seat in this audition. Checked by DoublerService public function entry(): BelongsTo diff --git a/app/Services/DoublerService.php b/app/Services/DoublerService.php index 225c163..5fdfc05 100644 --- a/app/Services/DoublerService.php +++ b/app/Services/DoublerService.php @@ -48,10 +48,13 @@ class DoublerService /** * Returns an array of information about each entry for a specific doubler. Info for each entry includes + * entryID * auditionID * auditionName * rank => This student's rank in the given audition * unscored => How many entries remain to be scored in this audition + * limits => acceptance limits for this audition + * status => accepted, declined, or undecided * * @param int $studentId The ID of the doubler */ @@ -87,6 +90,7 @@ class DoublerService $status = 'undecided'; } $info[$entry->id] = [ + 'entryID' => $entry->id, 'auditionID' => $entry->audition_id, 'auditionName' => $this->auditionCacheService->getAudition($entry->audition_id)->name, 'rank' => $this->tabulationService->entryRank($entry), diff --git a/resources/views/components/doubler-block.blade.php b/resources/views/components/doubler-block.blade.php index db93986..6d0c532 100644 --- a/resources/views/components/doubler-block.blade.php +++ b/resources/views/components/doubler-block.blade.php @@ -1,6 +1,6 @@ @props(['doublerEntryInfo']) - -