AttributeBoolean.vue 661 B

1234567891011121314151617181920212223242526
  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. const props = defineProps<{
  6. attribute: ObjectAttributeBoolean
  7. value: boolean
  8. }>()
  9. const body = computed(() => {
  10. const { true: yes, false: no } = props.attribute.dataOption?.options || {}
  11. return props.value ? yes || __('yes') : no || __('no')
  12. })
  13. const translate = computed(() => {
  14. const { translate = true } = props.attribute.dataOption || {}
  15. return translate
  16. })
  17. </script>
  18. <template>
  19. {{ translate ? $t(body) : body }}
  20. </template>