diff --git a/app/Filament/User/Resources/ProductResource.php b/app/Filament/User/Resources/ProductResource.php index e8ebd86..48dd6ea 100644 --- a/app/Filament/User/Resources/ProductResource.php +++ b/app/Filament/User/Resources/ProductResource.php @@ -155,23 +155,18 @@ class ProductResource extends Resource { ->addActionLabel('Option hinzufügen') ->extraItemActions([ FormAction::make('shopify') - ->label(fn (array $arguments, Repeater $component): string => - ($component->getState()[$arguments['item']]['shopify_variant_id'] ?? null) - ? 'Shopify sync' : 'Zu Shopify' - ) - ->icon(fn (array $arguments, Repeater $component): string => - ($component->getState()[$arguments['item']]['shopify_variant_id'] ?? null) - ? 'heroicon-o-arrow-path' : 'heroicon-o-arrow-up-tray' - ) - ->color(fn (array $arguments, Repeater $component): string => - ($component->getState()[$arguments['item']]['shopify_variant_id'] ?? null) - ? 'info' : 'warning' - ) + ->label('Shopify') + ->icon('heroicon-o-arrow-path') + ->color('gray') ->requiresConfirmation() ->action(function (array $arguments, Repeater $component): void { $item = $component->getState()[$arguments['item']] ?? []; $sizeId = (int) ($item['product_size_id'] ?? 0); if (! $sizeId) { + \Filament\Notifications\Notification::make() + ->title('Zuerst speichern') + ->warning() + ->send(); return; } $page = $component->getContainer()->getLivewire(); @@ -180,10 +175,7 @@ class ProductResource extends Resource { } else { $page->publishVariantToShopify($sizeId); } - }) - ->visible(fn (array $arguments, Repeater $component): bool => - ! empty($component->getState()[$arguments['item']]['product_size_id'] ?? null) - ), + }), ]) ->afterStateHydrated(function ($state, $set, $record) { if ($record) {