Globale Live-Suche, Kontaktkarten-Personensuche, neue Beitragsansicht, Termine mit Seitenleiste, Demo-Inhalte, Plugin-Upload-Fix
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m24s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m46s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m31s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m18s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m24s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m46s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m31s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m18s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9b06e65802
commit
b276e1c6d0
211 changed files with 3580 additions and 1072 deletions
|
|
@ -3,7 +3,7 @@
|
|||
namespace Inhaus\Plugins\Qm;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\ProfileFields;
|
||||
use App\Support\ContactCards;
|
||||
use App\Support\Settings;
|
||||
use Inhaus\Plugins\Qm\Models\QmEntry;
|
||||
|
||||
|
|
@ -15,14 +15,7 @@ class Presenter
|
|||
public const CONTACT_FIELDS = 'qm.contact_fields';
|
||||
|
||||
/** Kernfelder des Profils, die bei Ansprechpartnern erscheinen können. */
|
||||
public const CORE_FIELDS = [
|
||||
'job_title' => 'Funktion',
|
||||
'department' => 'Abteilung',
|
||||
'location' => 'Standort',
|
||||
'phone' => 'Telefon',
|
||||
'mobile' => 'Mobil',
|
||||
'email' => 'E-Mail-Adresse',
|
||||
];
|
||||
public const CORE_FIELDS = ContactCards::CORE_FIELDS;
|
||||
|
||||
public const DEFAULT_CONTACT_FIELDS = ['job_title', 'phone', 'email'];
|
||||
|
||||
|
|
@ -33,7 +26,7 @@ class Presenter
|
|||
|
||||
public const OFFICERS = 'qm.home.officers';
|
||||
|
||||
public function __construct(private readonly QmTree $tree, private readonly Settings $settings, private readonly ProfileFields $profileFields) {}
|
||||
public function __construct(private readonly QmTree $tree, private readonly Settings $settings, private readonly ContactCards $cards) {}
|
||||
|
||||
/**
|
||||
* @param array<int, int> $counts Ordner => Anzahl Einträge
|
||||
|
|
@ -115,38 +108,8 @@ class Presenter
|
|||
public function contacts(iterable $people, ?User $viewer): array
|
||||
{
|
||||
$fields = (array) $this->settings->get(self::CONTACT_FIELDS, self::DEFAULT_CONTACT_FIELDS);
|
||||
$result = [];
|
||||
|
||||
foreach ($people as $person) {
|
||||
if (! $person->is_active) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$custom = collect($this->profileFields->visibleValues($person, $viewer))->keyBy('key');
|
||||
|
||||
foreach ($fields as $field) {
|
||||
if (isset(self::CORE_FIELDS[$field])) {
|
||||
$value = $person->{$field};
|
||||
|
||||
if (filled($value)) {
|
||||
$values[] = ['key' => $field, 'label' => self::CORE_FIELDS[$field], 'value' => $value, 'type' => in_array($field, ['phone', 'mobile'], true) ? 'phone' : ($field === 'email' ? 'email' : 'text')];
|
||||
}
|
||||
} elseif (str_starts_with($field, 'custom.') && ($item = $custom->get(substr($field, 7)))) {
|
||||
$values[] = ['key' => $field, 'label' => $item['label'], 'value' => $item['value'], 'type' => $item['type'] ?? 'text'];
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = [
|
||||
'id' => $person->id,
|
||||
'name' => $person->name,
|
||||
'initials' => $person->initials,
|
||||
'avatar_url' => $person->avatarUrl(160),
|
||||
'fields' => $values,
|
||||
];
|
||||
}
|
||||
|
||||
return $result;
|
||||
return array_map(fn (array $card) => array_diff_key($card, ['subtitle' => true]), $this->cards->cards($people, $viewer, $fields));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -197,7 +160,7 @@ class Presenter
|
|||
*/
|
||||
public function contactFieldOptions(): array
|
||||
{
|
||||
return self::CORE_FIELDS + collect($this->profileFields->options())->mapWithKeys(fn ($label, $key) => ['custom.'.$key => $label.' (Profilfeld)'])->all();
|
||||
return $this->cards->options();
|
||||
}
|
||||
|
||||
private function formUrl(int $id): ?string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue