mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
add disable submit button on formData new and update
This commit is contained in:
parent
ab2d7ad87d
commit
70b32b9363
@ -53,7 +53,7 @@
|
|||||||
type="submit"
|
type="submit"
|
||||||
@click.prevent="submit()"
|
@click.prevent="submit()"
|
||||||
icon="save"
|
icon="save"
|
||||||
:disabled="disabled"
|
:disabled="update ? submitDisableEdit : submitDisable"
|
||||||
primary
|
primary
|
||||||
>
|
>
|
||||||
{{ update ? $t('group.update') : $t('group.save') }}
|
{{ update ? $t('group.update') : $t('group.save') }}
|
||||||
@ -61,7 +61,7 @@
|
|||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-form>
|
</ds-form>
|
||||||
<ds-space centered v-show="!update">
|
<ds-space centered v-show="!update">
|
||||||
<nuxt-link to="/group/my-groups">zurück</nuxt-link>
|
<nuxt-link to="/my-groups">zurück</nuxt-link>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-container>
|
</ds-container>
|
||||||
</div>
|
</div>
|
||||||
@ -147,5 +147,52 @@ export default {
|
|||||||
alert('reset')
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -13,8 +13,13 @@
|
|||||||
</ds-space>
|
</ds-space>
|
||||||
</div>
|
</div>
|
||||||
<ds-space margin-top="small">
|
<ds-space margin-top="small">
|
||||||
<ds-chip :color="item.groupType === 'public' ? 'primary' : 'warning'">{{item.groupType}}</ds-chip>
|
<ds-chip v-if="item.groupType === 'public'" color="primary">{{item.groupType}}</ds-chip>
|
||||||
<ds-chip v-for="category in item.categories" :key="category.name"><ds-icon :name="category.icon"></ds-icon> {{category.name}}</ds-chip>
|
<ds-chip v-if="item.groupType === 'hidden'" color="warning">{{item.groupType}}</ds-chip>
|
||||||
|
<ds-chip v-if="item.groupType === 'closed'" color="danger">{{item.groupType}}</ds-chip>
|
||||||
|
<ds-chip v-for="category in item.categories" :key="category.name">
|
||||||
|
<ds-icon :name="category.icon"></ds-icon>
|
||||||
|
{{category.name}}
|
||||||
|
</ds-chip>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="group-teaser">
|
|
||||||
<ds-grid-item :row-span="2" column-span="fullWidth">
|
|
||||||
<ds-space centered>
|
|
||||||
<nuxt-link :to="{ name: 'group-create' }">
|
|
||||||
<base-button
|
|
||||||
v-tooltip="{
|
|
||||||
content: $t('group.newGroup'),
|
|
||||||
placement: 'left',
|
|
||||||
delay: { show: 500 },
|
|
||||||
}"
|
|
||||||
:path="{ name: 'group-create' }"
|
|
||||||
class="profile-post-add-button"
|
|
||||||
icon="plus"
|
|
||||||
circle
|
|
||||||
filled
|
|
||||||
/>
|
|
||||||
</nuxt-link>
|
|
||||||
</ds-space>
|
|
||||||
</ds-grid-item>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'GroupTeaser',
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@ -1,26 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div><ds-section>
|
||||||
<h2>Create Groupe</h2>
|
<h1 class="ds-heading ds-heading-h1">Create New Groupe</h1></ds-section>
|
||||||
|
<ds-space margin="large" >
|
||||||
<ds-flex :width="{ base: '100%' }" gutter="base">
|
<ds-flex :width="{ base: '100%' }" gutter="base">
|
||||||
<ds-flex-item :width="{ base: '100%', md: 5 }">
|
<ds-flex-item :width="{ base: '100%', md: 5 }">
|
||||||
<group-form @createGroup="createGroup" />
|
<group-form @createGroup="createGroup" />
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
<ds-flex-item :width="{ base: '100%', md: 1 }"> </ds-flex-item>
|
<ds-flex-item :width="{ base: '100%', md: 1 }"> </ds-flex-item>
|
||||||
</ds-flex>
|
</ds-flex>
|
||||||
<hr />
|
</ds-space>
|
||||||
<group-member />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import GroupForm from '~/components/Group/GroupForm'
|
import GroupForm from '~/components/Group/GroupForm'
|
||||||
import GroupMember from '~/components/Group/GroupMember'
|
|
||||||
import { createGroupMutation } from '~/graphql/groups.js'
|
import { createGroupMutation } from '~/graphql/groups.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
GroupForm,
|
GroupForm,
|
||||||
GroupMember,
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<ds-section>
|
||||||
<h1 class="ds-heading ds-heading-h1">{{group.name}}</h1>
|
<h1 class="ds-heading ds-heading-h1">{{group.name}}</h1>
|
||||||
<div class="">Group Setting</div>
|
<div class="">Group Setting</div></ds-section>
|
||||||
|
<ds-space margin="large" >
|
||||||
<ds-flex gutter="small">
|
<ds-flex gutter="small">
|
||||||
<ds-flex-item :width="{ base: '100%', md: '200px' }">
|
<ds-flex-item :width="{ base: '100%', md: '200px' }">
|
||||||
<ds-menu :routes="routes" :is-exact="() => true" />
|
<ds-menu :routes="routes" :is-exact="() => true" />
|
||||||
@ -14,6 +14,7 @@
|
|||||||
</transition>
|
</transition>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
</ds-flex>
|
</ds-flex>
|
||||||
|
</ds-space>
|
||||||
<ds-space centered>
|
<ds-space centered>
|
||||||
<nuxt-link to="/my-groups">zurück</nuxt-link>
|
<nuxt-link to="/my-groups">zurück</nuxt-link>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
|
|||||||
@ -1,21 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div><ds-section>
|
||||||
<h1 class="ds-heading ds-heading-h1">My Groups</h1>
|
<h1 class="ds-heading ds-heading-h1">My Groups</h1>
|
||||||
<group-teaser />
|
<nuxt-link :to="{ name: 'group-create' }">
|
||||||
|
<base-button
|
||||||
|
v-tooltip="{
|
||||||
|
content: $t('group.newGroup'),
|
||||||
|
placement: 'left',
|
||||||
|
delay: { show: 500 },
|
||||||
|
}"
|
||||||
|
:path="{ name: 'group-create' }"
|
||||||
|
class="profile-post-add-button"
|
||||||
|
icon="plus"
|
||||||
|
circle
|
||||||
|
filled
|
||||||
|
/>
|
||||||
|
</nuxt-link></ds-section>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<group-list :items="responseGroupListQuery" />
|
<group-list :items="responseGroupListQuery" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import GroupTeaser from '~/components/Group/GroupTeaser.vue'
|
|
||||||
import GroupList from '~/components/Group/GroupList.vue'
|
import GroupList from '~/components/Group/GroupList.vue'
|
||||||
import { groupQuery } from '~/graphql/groups.js'
|
import { groupQuery } from '~/graphql/groups.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MyGroups',
|
name: 'MyGroups',
|
||||||
components: {
|
components: {
|
||||||
GroupTeaser,
|
|
||||||
GroupList,
|
GroupList,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user