You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.2KB

  1. <template>
  2. <e403 v-if="!isMaster" />
  3. <v-container
  4. v-else
  5. fluid
  6. tag="section"
  7. >
  8. <v-card
  9. flat
  10. >
  11. <v-btn
  12. absolute
  13. top
  14. right
  15. fab
  16. small
  17. @click="open(null)"
  18. >
  19. <v-icon>
  20. fa-plus
  21. </v-icon>
  22. </v-btn>
  23. <v-col>
  24. <v-text-field
  25. v-model="filter"
  26. label="Filter"
  27. />
  28. </v-col>
  29. <v-data-table
  30. :headers="headers"
  31. :items="OrganizerFind"
  32. sort-by="plz"
  33. :items-per-page="15"
  34. mobile-breakpoint="0"
  35. :search="filter"
  36. @click:row="open"
  37. />
  38. </v-card>
  39. <edit-organizer
  40. :id="dialog.id"
  41. v-model="dialog.open"
  42. />
  43. </v-container>
  44. </template>
  45. <script>
  46. import { useAuth } from '@/plugins/auth'
  47. import gql from 'graphql-tag'
  48. import { updateQuery, deleteQuery } from '@/plugins/graphql'
  49. export default {
  50. name: 'People',
  51. components: {
  52. EditOrganizer: () => import('./dialogs/EditOrganizer')
  53. },
  54. setup (props, context) {
  55. return {
  56. ...useAuth(context)
  57. }
  58. },
  59. data: () => ({
  60. OrganizerFind: [],
  61. headers: [
  62. {
  63. text: 'Name',
  64. value: 'name',
  65. sortable: true
  66. },
  67. {
  68. text: 'PLZ',
  69. value: 'plz',
  70. sortable: true
  71. },
  72. {
  73. text: 'Ort',
  74. value: 'ort',
  75. sortable: true
  76. }
  77. ],
  78. dialog: {
  79. open: false,
  80. id: null
  81. },
  82. filter: ''
  83. }),
  84. apollo: {
  85. OrganizerFind: {
  86. query: gql`query { OrganizerFind { _id name plz ort admins { _id givenName familyName } organizers { _id givenName familyName } } }`,
  87. subscribeToMore: {
  88. document: gql`subscription { OrganizerUpdated { _id name plz ort admins { _id givenName familyName } organizers { _id givenName familyName } } }`,
  89. updateQuery: updateQuery('OrganizerFind', 'OrganizerUpdated')
  90. }
  91. },
  92. $subscribe: {
  93. PersonDeleted: {
  94. query: gql`subscription { OrganizerDeleted }`,
  95. result (id) {
  96. deleteQuery('OrganizerFind', 'OrganizerDeleted', this.OrganizerFind, id)
  97. }
  98. }
  99. }
  100. },
  101. methods: {
  102. open (item) {
  103. this.dialog.open = true
  104. this.dialog.id = item?._id
  105. }
  106. }
  107. }
  108. </script>
  109. <style scoped>
  110. </style>