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>
56 lines
1.8 KiB
PHP
56 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Communication\Fields\Pages;
|
|
|
|
use App\Domain\Communication\FieldType;
|
|
use App\Domain\Communication\InquiryField;
|
|
use App\Domain\Communication\Keys;
|
|
use App\Filament\Resources\Communication\Fields\InquiryFieldResource;
|
|
use App\Filament\Support\ArchivesCommunicationRecords;
|
|
use Filament\Resources\Pages\EditRecord;
|
|
|
|
class EditInquiryField extends EditRecord
|
|
{
|
|
use ArchivesCommunicationRecords;
|
|
|
|
protected static string $resource = InquiryFieldResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return $this->archiveActions();
|
|
}
|
|
|
|
protected function archiveNote(): string
|
|
{
|
|
return 'Das Feld kann in keiner neuen Fassung einer Vorlage mehr verwendet werden. Veröffentlichte Fassungen und eingegangene Anfragen bleiben unverändert.';
|
|
}
|
|
|
|
protected function indexUrl(): string
|
|
{
|
|
return InquiryFieldResource::getUrl('index');
|
|
}
|
|
|
|
protected function mutateFormDataBeforeSave(array $data): array
|
|
{
|
|
/** @var InquiryField $record */
|
|
$record = $this->getRecord();
|
|
$type = $record->type;
|
|
|
|
$data['options'] = $type->hasOptions() ? Keys::withKeys((array) ($data['options'] ?? [])) : null;
|
|
|
|
$settings = array_filter((array) ($data['settings'] ?? []), fn (mixed $value): bool => $value !== null && $value !== '');
|
|
$data['settings'] = match ($type) {
|
|
FieldType::Text, FieldType::Textarea => array_intersect_key($settings, ['max_length' => true]),
|
|
FieldType::Number => array_intersect_key($settings, ['min' => true, 'max' => true]),
|
|
default => [],
|
|
};
|
|
|
|
return $data;
|
|
}
|
|
|
|
protected function getRedirectUrl(): ?string
|
|
{
|
|
return InquiryFieldResource::getUrl('index');
|
|
}
|
|
}
|