summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/GroupModuleGroupView.vue
diff options
context:
space:
mode:
authorUdo Walter2018-08-01 23:41:24 +0200
committerUdo Walter2018-08-01 23:41:24 +0200
commitbf83c4680d2b63aad7852da5a34d50529fc148db (patch)
tree325d42f8cbb138aa8fa5ca97b62582416e1e4bd5 /webapp/src/components/GroupModuleGroupView.vue
parent[groups] add edit functionality to group infos (diff)
downloadbas-bf83c4680d2b63aad7852da5a34d50529fc148db.tar.gz
bas-bf83c4680d2b63aad7852da5a34d50529fc148db.tar.xz
bas-bf83c4680d2b63aad7852da5a34d50529fc148db.zip
[groups] add client edit functionality
Diffstat (limited to 'webapp/src/components/GroupModuleGroupView.vue')
-rw-r--r--webapp/src/components/GroupModuleGroupView.vue144
1 files changed, 74 insertions, 70 deletions
diff --git a/webapp/src/components/GroupModuleGroupView.vue b/webapp/src/components/GroupModuleGroupView.vue
index 740266e..1706ba4 100644
--- a/webapp/src/components/GroupModuleGroupView.vue
+++ b/webapp/src/components/GroupModuleGroupView.vue
@@ -9,72 +9,70 @@
<template>
<div>
- <template v-if="tabIndex > 0">
- <v-subheader>Info</v-subheader>
- <v-card>
- <v-card-text>
- <v-layout wrap>
- <v-flex sm6 xs12 order-xs2 order-sm1>
- <v-text-field v-if="editMode" hide-details class="info-input" label="Name" color="primary" v-model="info.name"></v-text-field>
- <div v-else class="info-input">
- <div class="body-2">Name</div>
- {{ group.name || '-' }}
- </div>
- </v-flex>
- <v-flex sm6 xs12 order-xs1 order-sm2 class="text-xs-right">
- <div class="info-input">
- <v-btn v-if="!editMode" color="primary" flat @click="editInfo">
- <v-icon left>create</v-icon>Edit
+ <v-subheader>Info</v-subheader>
+ <v-card>
+ <v-card-text>
+ <v-layout wrap>
+ <v-flex sm6 xs12 order-xs2 order-sm1>
+ <v-text-field v-if="editMode" hide-details class="info-input" label="Name" color="primary" v-model="info.name"></v-text-field>
+ <div v-else class="info-input">
+ <div class="body-2">Name</div>
+ {{ group.name || '-' }}
+ </div>
+ </v-flex>
+ <v-flex sm6 xs12 order-xs1 order-sm2 class="text-xs-right">
+ <div class="info-input">
+ <v-btn v-if="!editMode" color="primary" flat @click="editInfo">
+ <v-icon left>create</v-icon>Edit
+ </v-btn>
+ <div v-else>
+ <v-btn color="primary" flat @click="editMode = false">Cancel</v-btn>
+ <v-btn color="primary" @click="saveInfo">
+ <v-icon left>save</v-icon>Save
</v-btn>
- <div v-else>
- <v-btn color="primary" flat @click="editMode = false">Cancel</v-btn>
- <v-btn color="primary" @click="saveInfo">
- <v-icon left>save</v-icon>Save
- </v-btn>
- </div>
- </div>
- </v-flex>
- </v-layout>
- <v-layout wrap>
- <v-flex sm6 xs12>
- <v-textarea v-if="editMode" rows="1" auto-grow hide-details class="info-input" label="Description" color="primary" v-model="info.description"></v-textarea>
- <div v-else class="info-input">
- <div class="body-2">Description</div>
- <pre>{{ group.description || '-' }}</pre>
- </div>
- </v-flex>
- <v-flex sm6 xs12>
- <v-autocomplete
- v-if="editMode"
- class="info-input"
- :items="$store.state.groups.groupList"
- v-model="info.parentIds"
- hide-details
- offset-y
- label="Parents"
- color="primary"
- multiple
- >
- <template slot="selection" slot-scope="data">
- <v-chip small :selected="data.selected" @input="removeParent(data.item.id)" close>
- {{ data.item.text }}
- </v-chip>
- </template>
- </v-autocomplete>
- <div v-else class="info-input">
- <div class="body-2">Parents</div>
- <template v-if="group.parents.length > 0">
- <v-chip v-for="parent in group.parents" :key="parent.id" small>
- {{ parent.name || parent.id }}
- </v-chip>
- </template>
- <span v-else>-</span>
</div>
- </v-flex>
- </v-layout>
- </v-card-text>
- </v-card>
- </template>
+ </div>
+ </v-flex>
+ </v-layout>
+ <v-layout wrap>
+ <v-flex sm6 xs12>
+ <v-textarea v-if="editMode" rows="1" auto-grow hide-details class="info-input" label="Description" color="primary" v-model="info.description"></v-textarea>
+ <div v-else class="info-input">
+ <div class="body-2">Description</div>
+ <pre>{{ group.description || '-' }}</pre>
+ </div>
+ </v-flex>
+ <v-flex sm6 xs12>
+ <v-autocomplete
+ v-if="editMode"
+ class="info-input"
+ :items="$store.state.groups.groupList"
+ v-model="parentIds"
+ hide-details
+ offset-y
+ label="Parents"
+ color="primary"
+ multiple
+ >
+ <template slot="selection" slot-scope="data">
+ <v-chip small :selected="data.selected" @input="removeParent(data.item.value)" close>
+ {{ data.item.text }}
+ </v-chip>
+ </template>
+ </v-autocomplete>
+ <div v-else class="info-input">
+ <div class="body-2">Parents</div>
+ <template v-if="group.parents.length > 0">
+ <v-chip v-for="parent in group.parents" :key="parent.id" small>
+ {{ parent.name || parent.id }}
+ </v-chip>
+ </template>
+ <span v-else>-</span>
+ </div>
+ </v-flex>
+ </v-layout>
+ </v-card-text>
+ </v-card>
<v-subheader>{{ tabIndex === 0 ? 'Groups' : 'Subgoups' }}</v-subheader>
<group-module-group-list :tabIndex="tabIndex" :groups="group.subgroups" />
<v-subheader>Clients</v-subheader>
@@ -98,23 +96,29 @@ export default {
editMode: false,
info: {
name: '',
- description: '',
- parentIds: []
- }
+ description: ''
+ },
+ parentIds: []
}
},
methods: {
removeParent (id) {
- this.info.parentIds.splice(this.info.parentIds.indexOf(id), 1)
+ console.log(this.parentIds.indexOf(id))
+ this.parentIds.splice(this.parentIds.indexOf(id), 1)
},
editInfo () {
this.editMode = true
this.info.name = this.group.name
this.info.description = this.group.description
- this.info.parentIds = this.group.parents.map(x => x.id)
+ this.parentIds = this.group.parents.map(x => x.id)
},
saveInfo () {
- this.$store.dispatch('groups/saveGroupInfo', { id: this.group.id, info: this.info, tabIndex: this.tabIndex })
+ this.$store.dispatch('groups/saveGroup', {
+ id: this.group.id,
+ info: this.info,
+ parentIds: this.parentIds,
+ tabIndex: this.tabIndex
+ })
this.editMode = false
}
}