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.

104 lines
2.0KB

  1. <template>
  2. <base-material-dialog
  3. :value="value"
  4. icon="mdi-home"
  5. title="Event bearbeiten"
  6. :sub-title="id ? id : 'NEU'"
  7. color="rgb(255, 4, 29)"
  8. :actions="[doc && orga ? 'del' : '', !id || orga ? 'save' : '', 'cancel']"
  9. @del="del"
  10. @save="save"
  11. @close="close"
  12. @esc="close"
  13. >
  14. <v-row v-if="id && (!data || !data._organizer)">
  15. Warte auf Daten...
  16. </v-row>
  17. <v-row v-else-if="id && !isOrga(data._organizer)">
  18. Kein Zugriff!
  19. </v-row>
  20. <v-row v-else>
  21. <v-col
  22. cols="12"
  23. >
  24. <date-selector
  25. v-model="data.date"
  26. label="Datum"
  27. />
  28. </v-col>
  29. <v-col
  30. cols="12"
  31. >
  32. <v-text-field
  33. v-model="data.name"
  34. label="Name"
  35. />
  36. </v-col>
  37. </v-row>
  38. </base-material-dialog>
  39. </template>
  40. <script>
  41. import { useAuth } from '@/plugins/auth'
  42. import { useEditDialog } from '@/plugins/editdialog'
  43. export default {
  44. name: 'EditEvent',
  45. props: {
  46. value: {
  47. type: Boolean,
  48. required: true
  49. },
  50. id: {
  51. type: String,
  52. default: null
  53. },
  54. organizer: {
  55. type: String,
  56. required: true
  57. }
  58. },
  59. setup (props, context) {
  60. return {
  61. ...useAuth(context),
  62. ...useEditDialog(props, context, 'Event(id: $id) { _id name date _organizer }', ['name', 'date'])
  63. }
  64. },
  65. computed: {
  66. orga () {
  67. return this.isOrga(this.data?._organizer)
  68. }
  69. },
  70. methods: {
  71. update () {
  72. return {
  73. mutation: `mutation($id: UUID!, $name: String, $date: Date) {
  74. EventUpdate(id: $id, name: $name, date: $date) {
  75. _id name date
  76. }
  77. }`
  78. }
  79. },
  80. create () {
  81. return {
  82. mutation: `mutation($name: String!, $date: Date!, $organizer: UUID!) {
  83. EventCreate(name: $name, date: $date, organizer: $organizer) {
  84. _id name date _organizer
  85. }
  86. }`,
  87. variables: {
  88. organizer: this.organizer
  89. }
  90. }
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="sass">
  96. $dialog-elevation: 0
  97. </style>