Baue die Verwaltung Kommunikation, die öffentliche Anfrageschnittstelle und das CMS-Widget Anfrage
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>
This commit is contained in:
1 parent
2ee1fc9866
commit
c6a8167601
45 files changed
+5415
No files matched your search
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Communication\Groups;
|
||||
|
||||
use App\Domain\Communication\InquiryField;
|
||||
use App\Domain\Communication\InquiryFieldGroup;
|
||||
use App\Filament\Resources\Communication\CommunicationResource;
|
||||
use App\Filament\Resources\Communication\Groups\Pages\EditInquiryFieldGroup;
|
||||
use App\Filament\Resources\Communication\Groups\Pages\ListInquiryFieldGroups;
|
||||
use Filament\Forms\Components\Placeholder;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
/**
|
||||
* Feldgruppen: fachliche Zusammenstellung von Feldern in fester Reihenfolge, die mehrere Anfragevorlagen verwenden.
|
||||
*/
|
||||
class InquiryFieldGroupResource extends CommunicationResource
|
||||
{
|
||||
protected static ?string $model = InquiryFieldGroup::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'Feldgruppen';
|
||||
|
||||
protected static ?string $modelLabel = 'Feldgruppe';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Feldgruppen';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $slug = 'kommunikation/feldgruppen';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
TextInput::make('name')->label('Fachliche Bezeichnung')->required()->maxLength(120)
|
||||
->helperText('Nur für die Verwaltung, zum Beispiel „Kindergruppe“.'),
|
||||
TextInput::make('label')->label('Überschrift im Formular (optional)')->maxLength(200)
|
||||
->helperText('Leer: die fachliche Bezeichnung.'),
|
||||
Textarea::make('description')->label('Erläuterung im Formular (optional)')->rows(2)->maxLength(600),
|
||||
Repeater::make('items')
|
||||
->label('Felder der Gruppe')
|
||||
->schema([
|
||||
Select::make('field')->label('Feld')->required()->searchable()->distinct()
|
||||
->options(fn (): array => InquiryField::query()->offered()->orderBy('name')->get()->mapWithKeys(
|
||||
fn (InquiryField $field): array => [$field->key => $field->name.' ('.$field->type->label().')']
|
||||
)->all()),
|
||||
Toggle::make('required')->label('Pflichtfeld')->default(false)
|
||||
->helperText('Eine Vorlage kann ein Feld zusätzlich unter einer Bedingung zur Pflicht machen.'),
|
||||
])
|
||||
->minItems(1)
|
||||
->reorderableWithButtons()
|
||||
->addActionLabel('Feld hinzufügen')
|
||||
->itemLabel(fn (array $state): ?string => InquiryField::query()->where('key', $state['field'] ?? '')->value('name'))
|
||||
->helperText('Die Reihenfolge hier ist die Reihenfolge im Formular.'),
|
||||
Placeholder::make('key_info')->label('Interne Kennung')->content(fn (?InquiryFieldGroup $record): string => (string) $record?->key)
|
||||
->visible(fn (?InquiryFieldGroup $record): bool => $record !== null),
|
||||
Toggle::make('active')->label('Zur Verwendung anbieten'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table->columns([TextColumn::make('name')->label('Bezeichnung')]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListInquiryFieldGroups::route('/'),
|
||||
'edit' => EditInquiryFieldGroup::route('/{record}'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user