schema([ Card::make() ->schema([ Select::make('user_id') ->label('Guru') ->relationship('user', 'name') ->required() ->default(Auth::id()) ->disabled() ->preload(), Select::make('student_id') ->label('Siswa') ->relationship('student', 'name') ->required() ->preload(), TextInput::make('incident') ->label('Kejadian') ->placeholder('Deskripsikan kejadian yang terjadi') ->required() ->maxLength(255), TextInput::make('behavior') ->label('Perilaku') ->placeholder('Deskripsikan perilaku siswa terkait kejadian') ->required() ->maxLength(255), TextInput::make('suggestion') ->label('Saran') ->placeholder('Berikan saran atau tindakan yang perlu diambil') ->required() ->maxLength(255), ]) ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('student.name') ->label('Siswa') ->sortable() ->badge() ->colors(['primary']) ->searchable(), TextColumn::make('user.name') ->label('Mengetahui') ->sortable() ->badge() ->colors(['success']) ->searchable(), TextColumn::make('incident') ->label('Kejadian & Perilaku') ->getStateUsing(function ($record) { return "Kejadian : {$record->incident}\nPerilaku : {$record->behavior}"; }) ->formatStateUsing(fn(string $state) => nl2br(e($state))) ->html() ->sortable() ->searchable(['incident', 'behavior']), TextColumn::make('suggestion') ->label('Saran') ->sortable() ->searchable(), ]) ->filters([ SelectFilter::make('student_id') ->label('Siswa') ->relationship('student', 'name') ->multiple() ->preload(), ]) ->actions([ Tables\Actions\ViewAction::make(), Tables\Actions\Action::make('download_pdf') ->label('Cetak') ->icon('heroicon-o-printer') ->url(fn ($record) => route('student-growth.download', ['student' => $record->student_id])) ->color('warning') ->requiresConfirmation(), Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListStudentGrowths::route('/'), 'create' => Pages\CreateStudentGrowth::route('/create'), 'edit' => Pages\EditStudentGrowth::route('/{record}/edit'), ]; } }