isAwaitingReview() ? '!' : null; } public static function getBadgeColor(Model $ownerRecord, string $pageClass): ?string { return 'warning'; } public function table(Table $table): Table { return $table ->defaultSort('id', 'desc') ->modifyQueryUsing(fn ($query) => $query->with('user')) ->columns([ TextColumn::make('event') ->label(__('panel.reviews.fields.event')) ->badge(), TextColumn::make('user_name') ->label(__('panel.reviews.fields.who')) ->state(fn (ReviewComment $record) => $record->author()), TextColumn::make('body') ->label(__('panel.reviews.fields.note')) ->wrap() ->placeholder('—'), TextColumn::make('created_at') ->label(__('panel.reviews.fields.when')) ->since() ->dateTimeTooltip() ->sortable(), ]) ->headerActions([ ReviewActions::request(), ReviewActions::returnForChanges(), // Plain comments, for the half of a review that is neither a // rejection nor an approval: a question, or an answer to one. Action::make('comment') ->label(__('panel.reviews.actions.comment')) ->icon('heroicon-o-chat-bubble-left-ellipsis') ->color('gray') ->visible(fn () => $this->getOwnerRecord()->exists) ->schema([ Textarea::make('body') ->label(__('panel.reviews.fields.note')) ->rows(3) ->required() ->maxLength(2000), ]) ->action(fn (array $data) => $this->getOwnerRecord()->comment($data['body'])), ]) ->emptyStateHeading(__('panel.reviews.empty.heading')) ->emptyStateDescription(__('panel.reviews.empty.description')) ->emptyStateIcon('heroicon-o-chat-bubble-left-right'); } }