diff --git a/webapp/components/Group/GroupForm.vue b/webapp/components/Group/GroupForm.vue index d0f853163..1cb7ca34c 100644 --- a/webapp/components/Group/GroupForm.vue +++ b/webapp/components/Group/GroupForm.vue @@ -53,7 +53,7 @@ type="submit" @click.prevent="submit()" icon="save" - :disabled="disabled" + :disabled="update ? submitDisableEdit : submitDisable" primary > {{ update ? $t('group.update') : $t('group.save') }} @@ -61,7 +61,7 @@ - zurück + zurück @@ -147,5 +147,52 @@ export default { alert('reset') }, }, + computed: { + submitDisable() { + if ( + this.formData.name !== '' + && this.formData.groupType !== '' + && this.formData.about !== '' + && this.formData.description !== '' + && this.formData.actionRadius !== '' + && this.formData.categoryIds.length > 0 + ) { + return false + } + return true + }, + submitDisableEdit() { + + if ( + this.formData.name !== this.group.name + || this.formData.groupType !== this.group.groupType + || this.formData.about !== this.group.about + || this.formData.description !== this.group.description + || this.formData.actionRadius !== this.group.actionRadius + || this.formData.categoryIds.length === 0 + || !this.sameCategories + ) { + return false + } + return true + }, + sameCategories(){ + let formDataCategories = this.formData.categoryIds.map((categoryIds) => categoryIds) + let groupDataCategories = this.group.categories.map((category) => category.id) + let result + let each = true + + if (formDataCategories.length !== groupDataCategories.length) return false + + if (JSON.stringify(formDataCategories) !== JSON.stringify(groupDataCategories)) { + formDataCategories.forEach(element => { + result = groupDataCategories.filter(groupCategorieId => groupCategorieId === element) + if (result.length === 0) each = false + }) + return each + } + return true + } + } } diff --git a/webapp/components/Group/GroupList.vue b/webapp/components/Group/GroupList.vue index cdb537a3a..cb7f33901 100644 --- a/webapp/components/Group/GroupList.vue +++ b/webapp/components/Group/GroupList.vue @@ -13,8 +13,13 @@ - {{item.groupType}} - {{category.name}} + {{item.groupType}} + {{item.groupType}} + {{item.groupType}} + + + {{category.name}} + diff --git a/webapp/components/Group/GroupTeaser.vue b/webapp/components/Group/GroupTeaser.vue deleted file mode 100644 index 33a50dca7..000000000 --- a/webapp/components/Group/GroupTeaser.vue +++ /dev/null @@ -1,27 +0,0 @@ - - diff --git a/webapp/pages/group/create.vue b/webapp/pages/group/create.vue index 1c95fffbc..a5f178e92 100644 --- a/webapp/pages/group/create.vue +++ b/webapp/pages/group/create.vue @@ -1,26 +1,25 @@