QM-Startseite: Einführungstext, Hauptansprechpartner, QM-Beauftragte
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m42s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m47s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m6s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m7s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 4m3s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 3m56s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 3m26s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 3m34s
CI / Build-Artefakte aktuell (pull_request) Successful in 54s

- Pflege unter QM-Einstellungen → „Startseite des Qualitätsmanagements“
- QM-Beauftragte mit Zuständigkeit und optionalem Ordner-Link,
  Kontaktangaben wie bei den Ansprechpartnern

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 16:17:17 +00:00
parent b3a057e27c
commit 5a360d3cc7
95 changed files with 550 additions and 373 deletions

View file

@ -3,10 +3,13 @@
namespace Inhaus\Plugins\Qm\Filament\Pages;
use App\Models\Role;
use App\Models\User;
use App\Support\Audit;
use App\Support\Settings;
use BackedEnum;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
@ -20,6 +23,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\HtmlString;
use Inhaus\Plugins\Qm\Presenter;
use Inhaus\Plugins\Qm\QmAccess;
use Inhaus\Plugins\Qm\QmTree;
use Inhaus\Plugins\Qm\Text\Ocr;
use UnitEnum;
@ -50,6 +54,9 @@ class QmSettings extends Page
public function mount(Settings $settings): void
{
$this->form->fill([
'home_intro' => (string) $settings->get(Presenter::HOME_INTRO, ''),
'home_contacts' => array_map('strval', (array) $settings->get(Presenter::HOME_CONTACTS, [])),
'officers' => array_values(array_map(fn ($row) => ['user_id' => (string) ($row['user_id'] ?? ''), 'area' => $row['area'] ?? null, 'folder_id' => isset($row['folder_id']) ? (string) $row['folder_id'] : null], (array) $settings->get(Presenter::OFFICERS, []))),
'contact_fields' => (array) $settings->get(Presenter::CONTACT_FIELDS, Presenter::DEFAULT_CONTACT_FIELDS),
'excluded_roles' => array_map('strval', (array) $settings->get(QmAccess::EXCLUDED_ROLES, [])),
'ocr_enabled' => (bool) $settings->get(Ocr::SETTING_ENABLED, false),
@ -59,9 +66,33 @@ class QmSettings extends Page
public function form(Schema $schema): Schema
{
$people = fn () => User::query()->where('is_active', true)->orderBy('last_name')->orderBy('first_name')->get()
->mapWithKeys(fn (User $u) => [(string) $u->id => $u->name.($u->job_title ? ' – '.$u->job_title : '')])->all();
return $schema->statePath('data')->components([
Section::make('Startseite des Qualitätsmanagements')
->description('Einführungstext, Hauptansprechpartner und die Liste der QM-Beauftragten auf /qm.')
->schema([
RichEditor::make('home_intro')->label('Einführungstext')
->toolbarButtons(['bold', 'italic', 'link', 'bulletList', 'orderedList', 'h3', 'blockquote', 'undo', 'redo']),
Select::make('home_contacts')->label('Hauptansprechpartner')->multiple()->searchable()->native(false)
->options($people)
->helperText('Erscheinen neben dem Einführungstext – z. B. die QM-Leitung.'),
Repeater::make('officers')->label('QM-Beauftragte')
->addActionLabel('QM-Beauftragte*n hinzufügen')
->reorderableWithDragAndDrop()
->defaultItems(0)
->columns(3)
->schema([
Select::make('user_id')->label('Person')->required()->searchable()->native(false)->options($people),
TextInput::make('area')->label('Zuständigkeit')->maxLength(120)->placeholder('z. B. Pflege, Standort Nord'),
Select::make('folder_id')->label('Ordner (optional)')->searchable()->native(false)
->options(fn () => collect(app(QmTree::class)->options())->mapWithKeys(fn ($name, $id) => [(string) $id => $name])->all()),
]),
]),
Section::make('Ansprechpartner')
->description('Welche Angaben aus dem Profil bei Ansprechpartnern in den QM-Ordnern erscheinen. Name und Foto werden immer gezeigt.')
->description('Welche Angaben aus dem Profil bei Ansprechpartnern und QM-Beauftragten erscheinen. Name und Foto werden immer gezeigt.')
->schema([
CheckboxList::make('contact_fields')->hiddenLabel()->columns(3)
->options(fn () => app(Presenter::class)->contactFieldOptions()),
@ -95,6 +126,13 @@ class QmSettings extends Page
$options = app(Presenter::class)->contactFieldOptions();
$settings->setMany([
Presenter::HOME_INTRO => (string) ($data['home_intro'] ?? ''),
Presenter::HOME_CONTACTS => array_values(array_map('intval', (array) ($data['home_contacts'] ?? []))),
Presenter::OFFICERS => array_values(array_map(fn ($row) => [
'user_id' => (int) $row['user_id'],
'area' => filled($row['area'] ?? null) ? trim($row['area']) : null,
'folder_id' => filled($row['folder_id'] ?? null) ? (int) $row['folder_id'] : null,
], array_filter((array) ($data['officers'] ?? []), fn ($row) => filled($row['user_id'] ?? null)))),
Presenter::CONTACT_FIELDS => array_values(array_intersect((array) $data['contact_fields'], array_keys($options))),
QmAccess::EXCLUDED_ROLES => array_values(array_map('intval', (array) $data['excluded_roles'])),
Ocr::SETTING_ENABLED => (bool) $data['ocr_enabled'],