From aa3c1721602052cba160b038a562ac46615b54cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 8 Oct 2024 14:46:44 +0200 Subject: [PATCH 1/2] [feat] show names by display mode setting --- src/components/overview/slots/JobSlot.vue | 26 ++++++++++++++++++++++- src/pages/EventRequests.vue | 3 --- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/components/overview/slots/JobSlot.vue b/src/components/overview/slots/JobSlot.vue index 8063ec0..5853a80 100644 --- a/src/components/overview/slots/JobSlot.vue +++ b/src/components/overview/slots/JobSlot.vue @@ -101,6 +101,7 @@ import { PERMISSIONS } from '../../../permissions'; import TransferInviteDialog from './TransferInviteDialog.vue'; import ServiceUserChip from './ServiceUserChip.vue'; import { UserAvatar } from '@flaschengeist/api/components'; +import { DisplayNameMode } from '@flaschengeist/users'; export default defineComponent({ name: 'JobSlot', @@ -123,11 +124,34 @@ export default defineComponent({ const quasar = useQuasar(); // Make sure users are loaded if we can assign them - onBeforeMount(() => void userStore.getUsers()); + onBeforeMount(() => { + void userStore.getUsers(); + void userStore.getDisplayNameModeSetting(true); + }); /* Stuff used for general display */ // Get displayname of user function userDisplay(id: string) { + switch (userStore.userSettings.display_name) { + case DisplayNameMode.FIRSTNAME: + return userStore.findUser(id)?.firstname || id; + case DisplayNameMode.LASTNAME: + return userStore.findUser(id)?.lastname || id; + case DisplayNameMode.DISPLAYNAME: + return userStore.findUser(id)?.display_name || id; + case DisplayNameMode.FIRSTNAME_LASTNAME: + return ( + `${userStore.findUser(id)?.firstname} ${( + userStore.findUser(id)?.lastname + )}` || id + ); + case DisplayNameMode.LASTNAME_FIRSTNAME: + return ( + `${userStore.findUser(id)?.lastname}, ${( + userStore.findUser(id)?.firstname + )}` || id + ); + } return userStore.findUser(id)?.display_name || id; } diff --git a/src/pages/EventRequests.vue b/src/pages/EventRequests.vue index 3ab5e2e..20cfa7d 100644 --- a/src/pages/EventRequests.vue +++ b/src/pages/EventRequests.vue @@ -159,7 +159,6 @@ export default defineComponent({ }; onBeforeMount(async () => { - if (route.query.sent === 'true') { showSent.value = true; } @@ -178,8 +177,6 @@ export default defineComponent({ await router.replace({ query: { sent: showSent.value ? 'true' : 'false' } }); }); - - function getType(row: RowData) { var idx = row.transferee === undefined ? 0 : 1; if (row.inviter.userid === mainStore.currentUser.userid) idx += 2; -- 2.40.1 From 6737bd5b456d1db51dc8b3b52e694561ba4ec8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 8 Oct 2024 14:53:22 +0200 Subject: [PATCH 2/2] update to version 1.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3c32e7d..569af91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0", + "version": "1.1.0", "name": "@flaschengeist/schedule", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/Flaschengeist", -- 2.40.1