Separate unit placements from shift duty assignments.
Deploy Ladill Care / deploy (push) Successful in 30s

Roster no longer writes temporary staff assignments; unit assignment UI drops shift fields and labels clarify the two workflows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-20 11:49:18 +00:00
co-authored by Cursor
parent 5125a6fe27
commit b7aca6ee2b
15 changed files with 68 additions and 101 deletions
+15
View File
@@ -7,6 +7,7 @@ use Carbon\CarbonInterface;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class StaffAssignment extends Model
@@ -58,6 +59,20 @@ class StaffAssignment extends Model
return $this->belongsTo(CareUnit::class, 'care_unit_id');
}
/**
* Legacy link from when duty roster auto-created unit placements.
* Shift assignments live on RosterEntry; new roster rows do not set this.
*/
public function rosterEntries(): HasMany
{
return $this->hasMany(RosterEntry::class, 'staff_assignment_id');
}
public function scopeUnitPlacements(Builder $query): Builder
{
return $query->whereDoesntHave('rosterEntries');
}
public function scopeEffectiveOn(Builder $query, CarbonInterface|string|null $date = null): Builder
{
$day = $date