useLifetimeCustomerTicketsCount.ts 566 B

12345678910111213141516171819
  1. // Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. import { storeToRefs } from 'pinia'
  3. import { computed } from 'vue'
  4. import { useSessionStore } from '#shared/stores/session.ts'
  5. export const useLifetimeCustomerTicketsCount = () => {
  6. const { user } = storeToRefs(useSessionStore())
  7. const totalCount = computed(
  8. () =>
  9. (user.value?.preferences?.tickets_closed ?? 0) +
  10. (user.value?.preferences?.tickets_open ?? 0),
  11. )
  12. const hasAnyTicket = computed(() => totalCount.value > 0)
  13. return { totalCount, hasAnyTicket }
  14. }