record->title ?? 'Shift'; return "Attendance — {$title} ({$this->record->shift_date->format('d M Y')})"; } public function table(Table $table): Table { return $table ->query( ShiftAttendance::query() ->where('shift_id', $this->record->id) ->with(['user', 'marker']) ) ->columns([ Tables\Columns\TextColumn::make('user.name') ->label('Staff Member') ->searchable(), Tables\Columns\BadgeColumn::make('status') ->colors([ 'gray' => 'not_marked', 'success' => 'present', 'danger' => 'absent', ]) ->formatStateUsing(fn (string $state) => match ($state) { 'not_marked' => 'Not Marked', 'present' => 'Present', 'absent' => 'Absent', default => $state, }), Tables\Columns\TextColumn::make('marker.name') ->label('Marked By') ->placeholder('—'), Tables\Columns\TextColumn::make('marked_at') ->dateTime() ->placeholder('—'), ]) ->actions([ Tables\Actions\Action::make('markPresent') ->label('Present') ->icon('heroicon-o-check') ->color('success') ->requiresConfirmation(false) ->action(function (ShiftAttendance $record) { app(ShiftService::class)->markAttendance( $this->record, $record->user_id, 'present' ); Notification::make() ->title("{$record->user->name} marked as present") ->success() ->send(); }), Tables\Actions\Action::make('markAbsent') ->label('Absent') ->icon('heroicon-o-x-mark') ->color('danger') ->requiresConfirmation() ->action(function (ShiftAttendance $record) { app(ShiftService::class)->markAttendance( $this->record, $record->user_id, 'absent' ); Notification::make() ->title("{$record->user->name} marked as absent") ->warning() ->send(); }), ]) ->bulkActions([]) ->emptyStateHeading('No staff assigned') ->emptyStateDescription('Assign staff to this shift before managing attendance.'); } }