summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/GroupModuleGroupView.vue
blob: 24cbdd1379e1bf6834c63e3eff6daecc0db05303 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<i18n>
{
  "en": {
  },
  "de": {
  }
}
</i18n>

<template>
  <div>
    <v-subheader>Groups</v-subheader>
    <v-card>
      <group-module-group-list :groups="subGroups" @open-group="$emit('open-group', $event)" @edit-group="$emit('edit-group', $event)" />
    </v-card>
    <v-subheader>Clients</v-subheader>
    <v-card>
      <group-module-client-list :clients="clients" @edit-client="$emit('edit-client', $event)" />
    </v-card>
  </div>
</template>

<script>
import GroupModuleGroupList from '@/components/GroupModuleGroupList'
import GroupModuleClientList from '@/components/GroupModuleClientList'

export default {
  name: 'GroupModuleGroupView',
  props: ['id'],
  components: {
    GroupModuleGroupList,
    GroupModuleClientList
  },
  data () {
    return {
      subGroups: [],
      clients: []
    }
  },
  watch: {
    id () { this.loadData() }
  },
  methods: {
    loadData () {
      var id = this.id ? this.id : ''
      this.$http('/api/groups?action=getSubGroups&id=' + id).then(response => {
        this.subGroups = response.data
      })
      this.$http('/api/groups?action=getClients&id=' + id).then(response => {
        this.clients = response.data
      })
    }
  },
  created () {
    this.loadData()
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>