2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
|
|
|
<section>
|
|
|
|
<h1>
|
|
|
|
<translate>Create a new group</translate>
|
|
|
|
</h1>
|
|
|
|
<div class="columns">
|
|
|
|
<form class="column" @submit="createGroup">
|
|
|
|
<b-field :label="$gettext('Group name')">
|
|
|
|
<b-input aria-required="true" required v-model="group.preferred_username"/>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-field :label="$gettext('Group full name')">
|
|
|
|
<b-input aria-required="true" required v-model="group.name"/>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-field :label="$gettext('Description')">
|
|
|
|
<b-input aria-required="true" required v-model="group.summary" type="textarea"/>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<button class="button is-primary">
|
|
|
|
<translate>Create my group</translate>
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-03-22 10:57:14 +01:00
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2019-02-25 17:20:06 +01:00
|
|
|
@Component({})
|
2019-01-21 15:08:22 +01:00
|
|
|
export default class CreateGroup extends Vue {
|
|
|
|
e1 = 0;
|
|
|
|
// FIXME: correctly type group
|
|
|
|
group: {
|
|
|
|
preferred_username: string;
|
|
|
|
name: string;
|
|
|
|
summary: string;
|
|
|
|
address?: any;
|
|
|
|
} = {
|
2019-02-22 14:55:47 +01:00
|
|
|
preferred_username: '',
|
|
|
|
name: '',
|
|
|
|
summary: '',
|
2019-01-21 15:08:22 +01:00
|
|
|
// category: null,
|
|
|
|
};
|
|
|
|
categories = [];
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.fetchCategories();
|
|
|
|
}
|
|
|
|
|
|
|
|
createGroup() {
|
|
|
|
// this.group.organizer = "/accounts/" + this.$store.state.user.id;
|
|
|
|
// FIXME: remove eventFetch
|
|
|
|
// eventFetch('/groups', this.$store, { method: 'POST', body: JSON.stringify({ group: this.group }) })
|
|
|
|
// .then(response => response.json())
|
|
|
|
// .then((data) => {
|
|
|
|
// this.loading = false;
|
|
|
|
// this.$router.push({ path: 'Group', params: { id: data.id } });
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchCategories() {
|
|
|
|
// FIXME: remove eventFetch
|
|
|
|
// eventFetch('/categories', this.$store)
|
|
|
|
// .then(response => response.json())
|
|
|
|
// .then((data) => {
|
|
|
|
// this.loading = false;
|
|
|
|
// this.categories = data.data;
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
|
|
|
|
getAddressData(addressData) {
|
|
|
|
this.group.address = {
|
|
|
|
geo: {
|
|
|
|
latitude: addressData.latitude,
|
2019-03-22 10:57:14 +01:00
|
|
|
longitude: addressData.longitude,
|
2019-01-21 15:08:22 +01:00
|
|
|
},
|
2019-03-22 15:51:23 +01:00
|
|
|
country: addressData.country,
|
|
|
|
locality: addressData.city,
|
|
|
|
region: addressData.administrative_area_level_1,
|
2019-08-22 15:57:44 +02:00
|
|
|
postalCode: addressData.postalCode,
|
2019-03-22 15:51:23 +01:00
|
|
|
street: `${addressData.street_number} ${addressData.route}`,
|
2019-01-21 15:08:22 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.markdown-render h1 {
|
|
|
|
font-size: 2em;
|
|
|
|
}
|
|
|
|
</style>
|