41 lines
1.4 KiB
PHP
41 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\LicenseArticles\Pages;
|
|
|
|
use App\Domain\Catalog\ArticleService;
|
|
use App\Filament\Resources\LicenseArticles\LicenseArticleResource;
|
|
use App\Filament\Support\ReportsDomainRules;
|
|
use Filament\Actions\Action;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
|
|
class ListLicenseArticles extends ListRecords
|
|
{
|
|
use ReportsDomainRules;
|
|
|
|
protected static string $resource = LicenseArticleResource::class;
|
|
|
|
public function getSubheading(): string|Htmlable|null
|
|
{
|
|
return 'Kleinste lizenzierbare Einheit. Der Stand hält fest, welche Inhalte dazugehören. Pakete und Angebote verweisen auf den Artikel, sie kopieren ihn nicht.';
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Action::make('create')
|
|
->label('Artikel anlegen')
|
|
->schema([
|
|
TextInput::make('code')->label('Kennung')->required(),
|
|
TextInput::make('product_line')->label('Produktlinie'),
|
|
])
|
|
->action(function (array $data): void {
|
|
$this->report(function () use ($data): void {
|
|
app(ArticleService::class)->create($data['code'], $data['product_line'] ?? null);
|
|
}, 'Der Lizenzartikel ist angelegt.');
|
|
}),
|
|
];
|
|
}
|
|
}
|