Anliegen, Feldkatalog, Feldgruppen, Anfragevorlagen mit Fassungen, Anfrage-Einstiege, Posteingang mit Status und Notizen, Einstellungen mit Empfängern. Das Widget speichert nur die Kennung eines veröffentlichten Einstiegs; Formular, Bedingungen und Annahme kommen zur Laufzeit vom Server (Kompaktformular und mehrstufiger Dialog aus derselben Beschreibung). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
53 lines
2.2 KiB
PHP
53 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Communication\Issues\Pages;
|
|
|
|
use App\Domain\Communication\InquiryIssue;
|
|
use App\Filament\Resources\Communication\Issues\InquiryIssueResource;
|
|
use Filament\Actions\Action;
|
|
use Filament\Notifications\Notification;
|
|
use Filament\Resources\Pages\EditRecord;
|
|
|
|
class EditInquiryIssue extends EditRecord
|
|
{
|
|
protected static string $resource = InquiryIssueResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Action::make('archive')
|
|
->label('Archivieren')
|
|
->color('gray')
|
|
->visible(fn (): bool => $this->getRecord()->archived_at === null)
|
|
->requiresConfirmation()
|
|
->modalDescription('Das Anliegen wird in neuen Fassungen von Vorlagen nicht mehr angeboten. Bereits eingegangene Anfragen und veröffentlichte Fassungen bleiben unverändert.')
|
|
->action(function (): void {
|
|
/** @var InquiryIssue $issue */
|
|
$issue = $this->getRecord();
|
|
$issue->forceFill(['archived_at' => now(), 'active' => false])->save();
|
|
|
|
foreach ($issue->children as $child) {
|
|
$child->forceFill(['archived_at' => $child->archived_at ?? now(), 'active' => false])->save();
|
|
}
|
|
|
|
Notification::make()->title('Archiviert.')->success()->send();
|
|
$this->redirect(InquiryIssueResource::getUrl('index'));
|
|
}),
|
|
Action::make('restore')
|
|
->label('Wiederherstellen')
|
|
->color('gray')
|
|
->visible(fn (): bool => $this->getRecord()->archived_at !== null)
|
|
->action(function (): void {
|
|
$this->getRecord()->forceFill(['archived_at' => null])->save();
|
|
Notification::make()->title('Wiederhergestellt. Das Anliegen ist weiterhin deaktiviert, bis es eingeschaltet wird.')->success()->send();
|
|
$this->redirect(InquiryIssueResource::getUrl('edit', ['record' => $this->getRecord()]));
|
|
}),
|
|
];
|
|
}
|
|
|
|
protected function getRedirectUrl(): ?string
|
|
{
|
|
return InquiryIssueResource::getUrl('index');
|
|
}
|
|
}
|