New CustomerInventory,
New Mitgliederverwaltung für Vereine New Bank Auto Complete
This commit is contained in:
48
frontend/components/columnRenderings/memberrelation.vue
Normal file
48
frontend/components/columnRenderings/memberrelation.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
row: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: {}
|
||||
}
|
||||
})
|
||||
|
||||
const relations = ref([])
|
||||
|
||||
const normalizeId = (value) => {
|
||||
if (value === null || value === undefined || value === "") return null
|
||||
const parsed = Number(value)
|
||||
return Number.isNaN(parsed) ? String(value) : parsed
|
||||
}
|
||||
|
||||
const relationLabel = computed(() => {
|
||||
const id = normalizeId(props.row?.infoData?.memberrelation)
|
||||
if (!id) return ""
|
||||
return relations.value.find((i) => normalizeId(i.id) === id)?.type || ""
|
||||
})
|
||||
|
||||
const relationId = computed(() => {
|
||||
return normalizeId(props.row?.infoData?.memberrelation)
|
||||
})
|
||||
|
||||
const loadRelations = async () => {
|
||||
try {
|
||||
relations.value = await useEntities("memberrelations").select()
|
||||
} catch (e) {
|
||||
relations.value = []
|
||||
}
|
||||
}
|
||||
|
||||
loadRelations()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink
|
||||
v-if="relationId && relationLabel"
|
||||
:to="`/standardEntity/memberrelations/show/${relationId}`"
|
||||
class="text-primary"
|
||||
>
|
||||
{{ relationLabel }}
|
||||
</NuxtLink>
|
||||
<span v-else>{{ relationLabel }}</span>
|
||||
</template>
|
||||
Reference in New Issue
Block a user