schema([ Select::make('student_id') ->label('Siswa') ->options(function () { $task = $this->getOwnerRecord(); if (!$task || !$task->classroom) { return []; } $students = $task->classroom->students; $studentIdsWithGrades = $task->nilai->pluck('student_id')->toArray(); $availableStudents = $students->whereNotIn('id', $studentIdsWithGrades); return $availableStudents->pluck('name', 'id'); }) ->placeholder('Pilih siswa') ->required(), FileUpload::make('file') ->label('File Tugas') ->placeholder('Unggah file tugas'), TextInput::make('grade') ->label('Nilai') ->required() ->numeric() ->placeholder('Masukkan nilai siswa'), ]); } public function table(Table $table): Table { return $table ->recordTitleAttribute('task_id') ->columns([ Tables\Columns\TextColumn::make('student.name') ->label('Siswa') ->sortable() ->searchable(), Tables\Columns\TextColumn::make('task.name') ->label('Tugas') ->sortable() ->searchable(), Tables\Columns\TextColumn::make('grade') ->label('Nilai') ->badge() ->colors(['success']) ->sortable() ->searchable(), ]) ->filters([ // ]) ->headerActions([ Tables\Actions\CreateAction::make(), Tables\Actions\Action::make('Print PDF') ->label('Cetak PDF') ->icon('heroicon-o-printer') ->color('success') ->url(fn () => route('student-grade.download', ['task' => $this->getOwnerRecord()->id])) ->openUrlInNewTab() ->requiresConfirmation(), ]) ->actions([ Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } }