Compare commits

..

No commits in common. "develop" and "main" have entirely different histories.

2 changed files with 23 additions and 6 deletions

View File

@ -101,7 +101,7 @@ import { PERMISSIONS } from '../../../permissions';
import TransferInviteDialog from './TransferInviteDialog.vue'; import TransferInviteDialog from './TransferInviteDialog.vue';
import ServiceUserChip from './ServiceUserChip.vue'; import ServiceUserChip from './ServiceUserChip.vue';
import { UserAvatar } from '@flaschengeist/api/components'; import { UserAvatar } from '@flaschengeist/api/components';
import { showName } from '@flaschengeist/users'; import { DisplayNameMode } from '@flaschengeist/users';
export default defineComponent({ export default defineComponent({
name: 'JobSlot', name: 'JobSlot',
@ -132,9 +132,27 @@ export default defineComponent({
/* Stuff used for general display */ /* Stuff used for general display */
// Get displayname of user // Get displayname of user
function userDisplay(id: string) { function userDisplay(id: string) {
const user = userStore.findUser(id); switch (userStore.userSettings.display_name) {
case DisplayNameMode.FIRSTNAME:
return user ? showName(user) : id; 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 (
`${<string>userStore.findUser(id)?.firstname} ${<string>(
userStore.findUser(id)?.lastname
)}` || id
);
case DisplayNameMode.LASTNAME_FIRSTNAME:
return (
`${<string>userStore.findUser(id)?.lastname}, ${<string>(
userStore.findUser(id)?.firstname
)}` || id
);
}
return userStore.findUser(id)?.display_name || id;
} }
// The name of the current job // The name of the current job

View File

@ -21,7 +21,6 @@ import { useUserStore } from '@flaschengeist/api';
import { PropType, computed, defineComponent, onBeforeMount, ref, watch } from 'vue'; import { PropType, computed, defineComponent, onBeforeMount, ref, watch } from 'vue';
import { UserAvatar } from '@flaschengeist/api/components'; import { UserAvatar } from '@flaschengeist/api/components';
import { showName } from '@flaschengeist/users';
export default defineComponent({ export default defineComponent({
name: 'ServiceUserChip', name: 'ServiceUserChip',
@ -51,7 +50,7 @@ export default defineComponent({
async () => (user.value = await userStore.getUser(props.modelValue.userid)) async () => (user.value = await userStore.getUser(props.modelValue.userid))
); );
const displayName = computed(() => (user.value ? showName(user.value) : '...')); const displayName = computed(() => user.value?.display_name || '...');
const serviceValue = computed(() => const serviceValue = computed(() =>
props.modelValue.value.toFixed(Number.isInteger(props.modelValue.value) ? 0 : 1) props.modelValue.value.toFixed(Number.isInteger(props.modelValue.value) ? 0 : 1)
); );