customer.ts 982 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import {
  3. TicketSidebarScreenType,
  4. type TicketSidebarContext,
  5. } from '#desktop/pages/ticket/types/sidebar.ts'
  6. import TicketSidebarCustomer from '../TicketSidebarCustomer/TicketSidebarCustomer.vue'
  7. import type { TicketSidebarPlugin } from './types.ts'
  8. export default <TicketSidebarPlugin>{
  9. title: __('Customer'),
  10. component: TicketSidebarCustomer,
  11. permissions: ['ticket.agent'],
  12. screens: [
  13. TicketSidebarScreenType.TicketDetailView,
  14. TicketSidebarScreenType.TicketCreate,
  15. ],
  16. icon: 'person',
  17. order: 1000,
  18. available: (context: TicketSidebarContext) => {
  19. // Consider the sidebar available only if a customer ID has been set to an integer ID.
  20. // In case of a string value, it's probably an unknown email address and therefore no customer to show.
  21. return !!(
  22. context.formValues.customer_id &&
  23. typeof context.formValues.customer_id === 'number'
  24. )
  25. },
  26. }