zammad/app/frontend/shared/components/ObjectAttributes/ObjectAttributes.vue
Martin Gruner 31c2c31ed3 Feature: Mobile - Updating ticket attributes.
Co-authored-by: Vladimir Sheremet <vs@zammad.com>
Co-authored-by: Martin Gruner <mg@zammad.com>
2022-11-30 10:00:58 +01:00

50 lines
1.6 KiB
Vue

<!-- Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ -->
<script setup lang="ts">
import type { ObjectManagerFrontendAttribute } from '@shared/graphql/types'
import type { ObjectLike } from '@shared/types/utils'
import { objectAttributesConfig } from './config'
import { useDisplayObjectAttributes } from './useDisplayObjectAttributes'
export interface Props {
object: ObjectLike
attributes: ObjectManagerFrontendAttribute[]
skipAttributes?: string[]
accessors?: Record<string, string>
}
const props = defineProps<Props>()
const { fields } = useDisplayObjectAttributes(props)
</script>
<template>
<Component :is="objectAttributesConfig.outer" v-if="fields.length">
<template v-for="field of fields" :key="field.attribute.name">
<Component
:is="objectAttributesConfig.wrapper"
:label="field.attribute.display"
>
<!-- TODO link template might have #{}, but we don't have access to those, it should come from backend -->
<CommonLink
v-if="field.attribute.dataOption?.linktemplate"
:link="field.attribute.dataOption?.linktemplate"
:class="objectAttributesConfig.classes.link"
>
<Component
:is="field.component"
:attribute="field.attribute"
:value="field.value"
/>
</CommonLink>
<Component
:is="field.component"
v-else
:attribute="field.attribute"
:value="field.value"
/>
</Component>
</template>
<slot name="after-fields" />
</Component>
</template>