37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Offers\Pages;
|
|
|
|
use App\Domain\Catalog\OfferService;
|
|
use App\Filament\Resources\Offers\OfferResource;
|
|
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 ListOffers extends ListRecords
|
|
{
|
|
use ReportsDomainRules;
|
|
|
|
protected static string $resource = OfferResource::class;
|
|
|
|
public function getSubheading(): string|Htmlable|null
|
|
{
|
|
return 'Ein Angebot verbindet Artikel oder eine Paketfassung mit einem Rechteprofil. Die aufgelösten Berechtigungen stehen auf der Angebotsseite.';
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Action::make('create')->label('Angebot anlegen')->schema([
|
|
TextInput::make('name')->label('Name')->required(),
|
|
])->action(function (array $data): void {
|
|
$this->report(function () use ($data): void {
|
|
app(OfferService::class)->create($data['name']);
|
|
}, 'Das Angebot ist angelegt.');
|
|
}),
|
|
];
|
|
}
|
|
}
|