From fd569664355d590635e0602ee1bac72acc74dbfe Mon Sep 17 00:00:00 2001 From: xuwhite <73076134+xuwhite@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:11:36 +0100 Subject: [PATCH] add user angeltype info in shift entries (#1262) --- includes/controller/shift_entries_controller.php | 8 ++++++-- resources/lang/de_DE/default.po | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php index 66d97c63..760ff84f 100644 --- a/includes/controller/shift_entries_controller.php +++ b/includes/controller/shift_entries_controller.php @@ -113,10 +113,14 @@ function shift_entry_create_controller_admin(Shift $shift, ?AngelType $angeltype } /** @var User[]|Collection $users */ - $users = User::query()->orderBy('name')->get(); + $users = User::with('userAngelTypes')->orderBy('name')->get(); $users_select = []; foreach ($users as $user) { - $users_select[$user->id] = $user->displayName; + $name = $user->displayName; + if ($user->userAngelTypes->where('id', $angeltype->id)->isEmpty()) { + $name = __('%s (not "%s")', [$name, $angeltype->name]); + } + $users_select[$user->id] = $name; } $angeltypes_select = $angeltypes->pluck('name', 'id')->toArray(); diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index fef2d6b5..7101771b 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -185,6 +185,9 @@ msgstr "%s bearbeiten" msgid "Team %s" msgstr "Team %s" +msgid "%s (not \"%s\")" +msgstr "%s (kein \"%s\")" + msgid "view" msgstr "ansehen"