Home.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!-- Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { useRouter } from 'vue-router'
  4. import useAuthenticationStore from '@shared/stores/authentication'
  5. import { useNotifications } from '@shared/components/CommonNotifications'
  6. import { MenuItem } from '@mobile/components/CommonSectionMenu'
  7. import CommonSectionMenu from '@mobile/components/CommonSectionMenu/CommonSectionMenu.vue'
  8. const menu: MenuItem[] = [
  9. { type: 'link', link: '/tickets', title: __('All Tickets') },
  10. { type: 'link', link: '/', title: __('Knowledge Base') },
  11. { type: 'link', link: '/', title: __('Chat'), information: '1' },
  12. ]
  13. const ticketOverview: MenuItem[] = [
  14. {
  15. type: 'link',
  16. link: '/tickets',
  17. title: __('My Assigned Tickets'),
  18. information: '2',
  19. },
  20. {
  21. type: 'link',
  22. link: '/tickets',
  23. title: __('Unassigned & Open Tickets'),
  24. information: '3',
  25. },
  26. {
  27. type: 'link',
  28. link: '/tickets',
  29. title: __('My Pending Reached Tickets'),
  30. information: '2',
  31. },
  32. {
  33. type: 'link',
  34. link: '/tickets',
  35. title: __('My Subscribed Tickets'),
  36. information: '1',
  37. },
  38. ]
  39. const { clearAllNotifications } = useNotifications()
  40. const authentication = useAuthenticationStore()
  41. const router = useRouter()
  42. const logoutMenu: MenuItem[] = [
  43. {
  44. type: 'link',
  45. onClick() {
  46. clearAllNotifications()
  47. authentication.logout().then(() => {
  48. router.push('/login')
  49. })
  50. },
  51. title: __('Logout'),
  52. },
  53. ]
  54. const testingMenu: MenuItem[] = [
  55. {
  56. type: 'link',
  57. link: '/playground',
  58. title: 'Playground',
  59. },
  60. ]
  61. </script>
  62. <template>
  63. <div class="pt-10">
  64. <div class="flex w-full items-center justify-center text-3xl font-bold">
  65. {{ i18n.t('Home') }}
  66. </div>
  67. <CommonSectionMenu :items="testingMenu" />
  68. <CommonSectionMenu :items="menu" action-title="Edit" />
  69. <CommonSectionMenu
  70. :items="ticketOverview"
  71. header-title="Ticket overviews"
  72. action-title="Edit"
  73. />
  74. <CommonSectionMenu :items="logoutMenu" />
  75. </div>
  76. </template>