diff --git a/app/Filament/Supplier/Resources/ProductStocks/Pages/EditProductStock.php b/app/Filament/Supplier/Resources/ProductStocks/Pages/EditProductStock.php new file mode 100644 index 0000000..410388b --- /dev/null +++ b/app/Filament/Supplier/Resources/ProductStocks/Pages/EditProductStock.php @@ -0,0 +1,27 @@ +label('Vissza a listához') + ->url(fn () => ProductStockResource::getUrl('index')) + ->color('gray'), + ]; + } + + protected function getRedirectUrl(): string + { + return ProductStockResource::getUrl('index'); + } +} diff --git a/app/Filament/Supplier/Resources/ProductStocks/Pages/ListProductStocks.php b/app/Filament/Supplier/Resources/ProductStocks/Pages/ListProductStocks.php new file mode 100644 index 0000000..f5ee0ee --- /dev/null +++ b/app/Filament/Supplier/Resources/ProductStocks/Pages/ListProductStocks.php @@ -0,0 +1,11 @@ +where('supplier_id', auth()->user()->supplier_id); + } + + public static function form(Schema $schema): Schema + { + return ProductStockForm::configure($schema); + } + + public static function table(Table $table): Table + { + return ProductStocksTable::configure($table); + } + + public static function getPages(): array + { + return [ + 'index' => ListProductStocks::route('/'), + 'edit' => EditProductStock::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Supplier/Resources/ProductStocks/Schemas/ProductStockForm.php b/app/Filament/Supplier/Resources/ProductStocks/Schemas/ProductStockForm.php new file mode 100644 index 0000000..411c386 --- /dev/null +++ b/app/Filament/Supplier/Resources/ProductStocks/Schemas/ProductStockForm.php @@ -0,0 +1,23 @@ +components([ + Select::make('stock_status') + ->label('Készlet státusz') + ->options( + collect(StockStatusEnum::cases()) + ->mapWithKeys(fn (StockStatusEnum $case) => [$case->value => $case->label()]) + ) + ->required(), + ]); + } +} diff --git a/app/Filament/Supplier/Resources/ProductStocks/Tables/ProductStocksTable.php b/app/Filament/Supplier/Resources/ProductStocks/Tables/ProductStocksTable.php new file mode 100644 index 0000000..25dd3b5 --- /dev/null +++ b/app/Filament/Supplier/Resources/ProductStocks/Tables/ProductStocksTable.php @@ -0,0 +1,36 @@ +columns([ + TextColumn::make('name') + ->label('Termék neve') + ->searchable() + ->sortable(), + + TextColumn::make('sku') + ->label('Cikkszám') + ->searchable(), + + TextColumn::make('stock_status') + ->label('Készlet státusz') + ->badge() + ->formatStateUsing(fn (StockStatusEnum $state) => $state->label()) + ->color(fn (StockStatusEnum $state) => $state->color()), + ]) + ->recordAction('edit') + ->actions([ + EditAction::make()->label('Státusz módosítása'), + ]); + } +}