summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/GroupModuleGroupList.vue
blob: a9976f9a9eb6c15d1306dd26b7f3b1a823ac8be4 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<i18n>
{
  "en": {
  },
  "de": {
  }
}
</i18n>

<template>
  <div>
    <v-data-table
      class="group-table"
      :headers="headers"
      :items="groups"
      item-key="id"
      hide-actions
      select-all
      v-model="selected"
    >
      <template slot="items" slot-scope="props">
        <tr @click="loadGroup(props.item)">
          <td>
            <v-checkbox
              color="primary"
              v-model="props.selected"
              hide-details
              @click.native.stop
            ></v-checkbox>
          </td>
          <td>{{ props.item.id }}</td>
          <td>{{ props.item.name }}</td>
          <td>
            <v-layout>
              <v-btn icon @click.stop><v-icon color="primary">edit</v-icon></v-btn>
              <v-btn class="next-arrow" icon><v-icon>keyboard_arrow_right</v-icon></v-btn>
            </v-layout>
          </td>
        </tr>
      </template>
    </v-data-table>
  </div>
</template>

<script>
import GroupModuleGroupView from '@/components/GroupModuleGroupView'

export default {
  name: 'GroupModuleGroupList',
  components: {
    GroupModuleGroupView
  },
  props: ['tabIndex'],
  data () {
    return {
      headers: [
        { text: 'ID', value: 'id' },
        { text: 'Name', value: 'name', width: '10000px' },
        { sortable: false }
      ],
      selected: []
    }
  },
  computed: {
    groups () {
      return this.$store.state.groups.groupChain[this.tabIndex].subGroups
    }
  },
  methods: {
    loadGroup (group) {
      this.$store.dispatch('groups/loadGroupInChain', {
        tabIndex: this.tabIndex + 1, id: group.id, name: group.name, switchTab: true
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.next-arrow {
  margin-left: 20px;
  margin-right: -10px;
}
</style>