AttributeBoolean.vue 719 B

12345678910111213141516171819202122232425
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import type { ObjectAttributeBoolean } from './attributeBooleanTypes.ts'
  5. import type { ObjectAttributeProps } from '../../types.ts'
  6. const props =
  7. defineProps<ObjectAttributeProps<ObjectAttributeBoolean, boolean>>()
  8. const body = computed(() => {
  9. const { true: yes, false: no } = props.attribute.dataOption?.options || {}
  10. return props.value ? yes || __('yes') : no || __('no')
  11. })
  12. const translate = computed(() => {
  13. const { translate = true } = props.attribute.dataOption || {}
  14. return translate
  15. })
  16. </script>
  17. <template>
  18. {{ translate ? $t(body) : body }}
  19. </template>