feat: allow organizer overbooking with confirmation dialog
Remove capacity and status validation from organizer assign flow so organizers can intentionally overbook shifts. Log overbooked assignments for audit trail. Volunteer claims still enforce hard limits. Frontend shows a warning banner when a shift is full and requires confirmation before overbooking. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -70,10 +70,26 @@ final class ShiftAssignmentService
|
||||
public function assign(Shift $shift, Person $person, User $assignedBy): ShiftAssignment
|
||||
{
|
||||
return DB::transaction(function () use ($shift, $person, $assignedBy): ShiftAssignment {
|
||||
$this->validateShiftIsOpen($shift);
|
||||
$this->validateAssignCapacity($shift);
|
||||
$this->validateNoConflict($shift, $person);
|
||||
|
||||
// Log overbooking for audit trail (organizers may intentionally overbook)
|
||||
$filledSlots = $shift->shiftAssignments()
|
||||
->where('status', ShiftAssignmentStatus::APPROVED)
|
||||
->count();
|
||||
|
||||
if ($filledSlots >= $shift->slots_total) {
|
||||
activity('shift_assignment')
|
||||
->causedBy($assignedBy)
|
||||
->performedOn($shift)
|
||||
->withProperties([
|
||||
'filled_slots' => $filledSlots,
|
||||
'slots_total' => $shift->slots_total,
|
||||
'person_id' => $person->id,
|
||||
'person_name' => $person->name,
|
||||
])
|
||||
->log('shift.overbooked_assignment');
|
||||
}
|
||||
|
||||
$assignment = $shift->shiftAssignments()->create([
|
||||
'person_id' => $person->id,
|
||||
'time_slot_id' => $shift->time_slot_id,
|
||||
|
||||
Reference in New Issue
Block a user