2020-10-25 23:59:03 +01:00
|
|
|
<template>
|
|
|
|
<form-wrapper :title="$t('groups.forms.new_group')">
|
|
|
|
<form @submit.prevent="createGroup" @keydown="form.onKeydown($event)">
|
|
|
|
<form-field :form="form" fieldName="name" inputType="text" :label="$t('commons.name')" autofocus />
|
2022-09-17 19:31:11 +02:00
|
|
|
<form-buttons
|
|
|
|
:submitId="'btnCreateGroup'"
|
|
|
|
:isBusy="form.isBusy"
|
|
|
|
:caption="$t('commons.create')"
|
|
|
|
:showCancelButton="true"
|
|
|
|
cancelLandingView="groups" />
|
2020-10-25 23:59:03 +01:00
|
|
|
</form>
|
|
|
|
</form-wrapper>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import Form from './../../components/Form'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
form: new Form({
|
|
|
|
name: '',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
async createGroup() {
|
|
|
|
|
2021-11-07 21:57:22 +01:00
|
|
|
await this.form.post('/api/v1/groups')
|
2020-10-25 23:59:03 +01:00
|
|
|
|
|
|
|
if( this.form.errors.any() === false ) {
|
2022-09-19 12:19:34 +02:00
|
|
|
this.$notify({ type: 'is-success', text: this.$t('groups.group_successfully_created') })
|
2020-11-26 13:09:23 +01:00
|
|
|
this.$router.push({ name: 'groups' });
|
2020-10-25 23:59:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|