generated from theradcoza/Laravel-Docker-Dev-Template
feat: add Shift Planning module with full CRUD, attendance, and reporting
- Add shifts, shift_staff, and shift_attendance migrations - Add Shift, ShiftStaff, ShiftAttendance Eloquent models with auditing - Add ShiftService with business logic (create, start, complete, assign staff, mark attendance, reports, timesheets) - Add ShiftResource with list, create, edit, and attendance management pages - Add staff and attendance relation managers - Add standalone pages: ActiveShifts, StaffManagement, ShiftReports, Timesheets - Add dashboard widgets: ShiftOverview stats, TodaysShifts table - Add ShiftPolicy for role-based authorization - Add 10 shift permissions and manager role to RolePermissionSeeder - Update User model with shift relationships - Fix audits table migration with required columns for owen-it/laravel-auditing - Update DatabaseSeeder to create admin user and call RolePermissionSeeder - Switch docker-compose to MariaDB 10.11 for Docker Desktop compatibility
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ShiftResource\RelationManagers;
|
||||
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class AttendancesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'attendances';
|
||||
|
||||
protected static ?string $title = 'Attendance';
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->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')
|
||||
->label('Marked At')
|
||||
->dateTime()
|
||||
->placeholder('—'),
|
||||
])
|
||||
->actions([])
|
||||
->bulkActions([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user