Öffne Katalog, Bibliothek und Testkauf für den MVP.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
463851d402
commit
fd6860efda
51 files changed
+2331
-31
No files matched your search
@@ -2,14 +2,53 @@
|
||||
|
||||
namespace App\Filament\Resources\Users\Pages;
|
||||
|
||||
use App\Domain\Catalog\Offer;
|
||||
use App\Domain\Entitlement\GrantIssuer;
|
||||
use App\Domain\Identity\StaffRole;
|
||||
use App\Filament\Resources\Users\UserResource;
|
||||
use App\Filament\Support\CatalogOptions;
|
||||
use App\Filament\Support\ReportsDomainRules;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EditUser extends EditRecord
|
||||
{
|
||||
use ReportsDomainRules;
|
||||
|
||||
protected static string $resource = UserResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('grant')
|
||||
->label('Berechtigung vergeben')
|
||||
->visible(function (): bool {
|
||||
$actor = Filament::auth()->user();
|
||||
|
||||
return $actor instanceof User && $actor->hasStaffRole(StaffRole::Kundenbetreuung);
|
||||
})
|
||||
->schema([
|
||||
Select::make('offer_id')->label('Angebot')->options(fn (): array => CatalogOptions::offers())->required(),
|
||||
Textarea::make('reason')->label('Begründung')->required(),
|
||||
])
|
||||
->action(function (array $data): void {
|
||||
$this->report(function () use ($data): void {
|
||||
app(GrantIssuer::class)->grantManually(
|
||||
$this->record,
|
||||
Offer::query()->findOrFail($data['offer_id']),
|
||||
Filament::auth()->user(),
|
||||
$data['reason'],
|
||||
);
|
||||
}, 'Die Berechtigung ist vergeben.');
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
* @return array<string, mixed>
|
||||
|
||||
Reference in new issue
Block a user