This commit is contained in:
ogerly 2023-04-24 14:20:36 +02:00
parent 1ba79343fe
commit e172fe917a
2 changed files with 50 additions and 53 deletions

View File

@ -45,11 +45,6 @@
formmat="DD-MM-YYYY HH:mm" formmat="DD-MM-YYYY HH:mm"
style="z-index: 20" style="z-index: 20"
></date-picker> ></date-picker>
<!-- <ds-input
model="formData.eventStart"
v-model="formData.eventStart"
style="position: absolute; min-width: 300px; margin-top: -38px; z-index: 0"
/> -->
</div> </div>
<div class="chipbox" style="margin-top: 10px"> <div class="chipbox" style="margin-top: 10px">
<ds-chip size="base" :color="errors && errors.eventStart && 'danger'"> <ds-chip size="base" :color="errors && errors.eventStart && 'danger'">
@ -71,7 +66,12 @@
</ds-grid> </ds-grid>
<ds-grid> <ds-grid>
<ds-grid-item style="grid-row-end: span 3"> <ds-grid-item style="grid-row-end: span 3">
<ds-input model="eventLocationName" name="location" placeholder="Location" size="large" /> <ds-input
model="eventLocationName"
name="location"
placeholder="Location"
size="large"
/>
<div class="chipbox"> <div class="chipbox">
<ds-chip size="base" :color="errors && errors.eventLocationName && 'danger'"> <ds-chip size="base" :color="errors && errors.eventLocationName && 'danger'">
{{ formData.eventLocationName.length }}/{{ formSchema.eventLocationName.max }} {{ formData.eventLocationName.length }}/{{ formSchema.eventLocationName.max }}
@ -233,7 +233,7 @@ export default {
categoryIds: categories ? categories.map((category) => category.id) : [], categoryIds: categories ? categories.map((category) => category.id) : [],
eventStart: eventStart || null, eventStart: eventStart || null,
eventEnd: eventEnd || null, eventEnd: eventEnd || null,
eventLocation: eventLocation || { lng: 51.0, lat: 17.0}, eventLocation: eventLocation || { lng: 51.0, lat: 17.0 },
eventLocationName: eventLocationName || '', eventLocationName: eventLocationName || '',
eventVenue: eventVenue || '', eventVenue: eventVenue || '',
eventIsOnline: eventIsOnline || true, eventIsOnline: eventIsOnline || true,
@ -252,9 +252,9 @@ export default {
return [] return []
}, },
}, },
eventStart: { required: this.creatEvent ? true : false }, eventStart: { required: !!this.creatEvent },
eventVenue: { required: this.creatEvent ? true : false, min: 3, max: 100 }, eventVenue: { required: !!this.creatEvent, min: 3, max: 100 },
eventLocationName: { required: this.creatEvent ? true : false, min: 3, max: 100 }, eventLocationName: { required: !!this.creatEvent, min: 3, max: 100 },
}, },
loading: false, loading: false,
users: [], users: [],
@ -270,14 +270,14 @@ export default {
currentUser: 'auth/user', currentUser: 'auth/user',
}), }),
eventInput() { eventInput() {
if ( this.creatEvent ) { if (this.creatEvent) {
return { return {
eventStart: this.formData.eventStart, eventStart: this.formData.eventStart,
// TODO: eventEnd: this.formData.eventEnd, // TODO: eventEnd: this.formData.eventEnd,
// TODO: eventLocationName: this.formData.eventLocationName, // TODO: eventLocationName: this.formData.eventLocationName,
eventVenue: this.formData.eventVenue, eventVenue: this.formData.eventVenue,
// TODO: eventIsOnline: this.formData.eventIsOnline, // TODO: eventIsOnline: this.formData.eventIsOnline,
eventLocation: JSON.stringify(this.formData.eventLocation) eventLocation: JSON.stringify(this.formData.eventLocation),
} }
} }
return undefined return undefined
@ -314,7 +314,6 @@ export default {
} }
} }
this.loading = true this.loading = true
alert(JSON.stringify(this.eventInput))
this.$apollo this.$apollo
.mutate({ .mutate({
@ -331,7 +330,6 @@ export default {
}, },
}) })
.then(({ data }) => { .then(({ data }) => {
console.log(data)
this.loading = false this.loading = false
this.$toast.success(this.$t('contribution.success')) this.$toast.success(this.$t('contribution.success'))
const result = data[this.contribution.id ? 'UpdatePost' : 'CreatePost'] const result = data[this.contribution.id ? 'UpdatePost' : 'CreatePost']
@ -342,7 +340,6 @@ export default {
}) })
}) })
.catch((err) => { .catch((err) => {
console.error(data)
this.$toast.error(err.message) this.$toast.error(err.message)
this.loading = false this.loading = false
}) })

View File

@ -4,46 +4,46 @@ export default () => {
return { return {
CreatePost: gql` CreatePost: gql`
mutation ( mutation (
$id: ID $id: ID
$title: String! $title: String!
$slug: String $slug: String
$content: String! $content: String!
$categoryIds: [ID] $categoryIds: [ID]
$groupId: ID $groupId: ID
$postType: PostType $postType: PostType
$eventInput: _EventInput $eventInput: _EventInput
) {
CreatePost(
id: $id
title: $title
slug: $slug
content: $content
categoryIds: $categoryIds
groupId: $groupId
postType: $postType
eventInput: $eventInput
) { ) {
id CreatePost(
slug id: $id
title title: $title
content slug: $slug
disabled content: $content
deleted categoryIds: $categoryIds
postType groupId: $groupId
author { postType: $postType
name eventInput: $eventInput
} ) {
categories {
id id
} slug
eventStart title
eventVenue content
eventLocation { disabled
lng deleted
lat postType
author {
name
}
categories {
id
}
eventStart
eventVenue
eventLocation {
lng
lat
}
} }
} }
}
`, `,
UpdatePost: gql` UpdatePost: gql`
mutation ( mutation (