2020-10-25 23:59:03 +01:00
|
|
|
<template>
|
|
|
|
<form-wrapper :title="$t('groups.forms.rename_group')">
|
|
|
|
<form @submit.prevent="updateGroup" @keydown="form.onKeydown($event)">
|
|
|
|
<form-field :form="form" fieldName="name" inputType="text" :label="$t('groups.forms.new_name')" autofocus />
|
|
|
|
<div class="field is-grouped">
|
|
|
|
<div class="control">
|
|
|
|
<v-button :isLoading="form.isBusy">{{ $t('commons.save') }}</v-button>
|
|
|
|
</div>
|
|
|
|
<div class="control">
|
|
|
|
<button type="button" class="button is-text" @click="cancelCreation">{{ $t('commons.cancel') }}</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</form-wrapper>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import Form from './../../components/Form'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
form: new Form({
|
2020-11-26 13:25:46 +01:00
|
|
|
name: this.name,
|
2020-10-25 23:59:03 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-11-26 13:25:46 +01:00
|
|
|
props: ['id', 'name'],
|
2020-10-25 23:59:03 +01:00
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
async updateGroup() {
|
|
|
|
|
2020-11-26 13:25:46 +01:00
|
|
|
await this.form.put('/api/groups/' + this.id)
|
2020-10-25 23:59:03 +01:00
|
|
|
|
|
|
|
if( this.form.errors.any() === false ) {
|
2020-11-26 13:25:46 +01:00
|
|
|
this.$router.push({ name: 'groups' })
|
2020-10-25 23:59:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
cancelCreation: function() {
|
|
|
|
|
2020-11-26 13:25:46 +01:00
|
|
|
this.$router.push({ name: 'groups' });
|
2020-10-25 23:59:03 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|