Rollen ausschließen: bei Inhalten (Zielgruppen) und für ganze Module
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m45s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m39s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m25s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m21s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m49s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m59s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m21s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m30s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m45s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m39s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m25s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m21s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m49s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m59s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m21s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m30s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
19193b850b
commit
1877a0922f
113 changed files with 699 additions and 428 deletions
|
|
@ -23,23 +23,28 @@ class AudienceSection
|
|||
->options($options)
|
||||
->afterStateHydrated(fn (Select $component, ?Model $record) => $component->state($record ? Audiences::get($type, $record->getKey())[$rule] : []))
|
||||
->saveRelationshipsUsing(function (Model $record, Select $component) use ($type) {
|
||||
// Alle drei Felder zusammen speichern (einmal pro Formular reicht, aber schadet nicht).
|
||||
// Alle Felder zusammen speichern (einmal pro Formular reicht, aber schadet nicht).
|
||||
$state = $component->getContainer()->getRawState();
|
||||
Audiences::sync($type, $record->getKey(), [
|
||||
'role' => $state['audience_role'] ?? [],
|
||||
'department' => $state['audience_department'] ?? [],
|
||||
'location' => $state['audience_location'] ?? [],
|
||||
'exclude_role' => $state['audience_exclude_role'] ?? [],
|
||||
]);
|
||||
})
|
||||
->dehydrated(false);
|
||||
|
||||
$roles = fn () => Role::query()->orderBy('name')->pluck('name', 'id')->mapWithKeys(fn ($name, $id) => [(string) $id => $name])->all();
|
||||
|
||||
return Section::make('Sichtbarkeit')
|
||||
->description($description)
|
||||
->collapsible()
|
||||
->schema([
|
||||
$field('role', 'Rollen', fn () => Role::query()->orderBy('name')->pluck('name', 'id')->mapWithKeys(fn ($name, $id) => [(string) $id => $name])->all()),
|
||||
$field('role', 'Rollen', $roles),
|
||||
$field('department', 'Abteilungen', fn () => self::distinct('department')),
|
||||
$field('location', 'Standorte', fn () => self::distinct('location')),
|
||||
$field('exclude_role', 'Ausgeschlossene Rollen', $roles)
|
||||
->helperText('Personen mit einer dieser Rollen sehen es nie – auch wenn eine Angabe oben passt. Beispiel: Klientinnen und Klienten von einer internen Seite ausschließen.'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue