diff --git a/packages/admin/src/Filament/Resources/ProductResource.php b/packages/admin/src/Filament/Resources/ProductResource.php index b6db375341..9c7369c9bf 100644 --- a/packages/admin/src/Filament/Resources/ProductResource.php +++ b/packages/admin/src/Filament/Resources/ProductResource.php @@ -248,7 +248,6 @@ protected static function getTableColumns(): array ->formatStateUsing(fn (Model $record): string => $record->translateAttribute('name')) ->limit(50) ->tooltip(function (Tables\Columns\TextColumn $column, Model $record): ?string { - $state = $column->getState(); if (strlen($record->translateAttribute('name')) <= $column->getCharacterLimit()) { return null; @@ -264,6 +263,22 @@ protected static function getTableColumns(): array ->searchable(), Tables\Columns\TextColumn::make('variants.sku') ->label(__('lunarpanel::product.table.sku.label')) + ->tooltip(function (Tables\Columns\TextColumn $column, Model $record): ?string { + + if ($record->variants->count() <= $column->getListLimit()) { + return null; + } + + if ($record->variants->count() > 30) { + $record->variants = $record->variants->slice(0, 30); + } + + return $record->variants + ->map(fn ($variant) => $variant->sku) + ->implode(', '); + }) + ->listWithLineBreaks() + ->limitList(1) ->toggleable(), Tables\Columns\TextColumn::make('variants_sum_stock') ->label(__('lunarpanel::product.table.stock.label'))