Vue.component("message-recipient-group-selector", { props: ["v-groups"], data: function () { let groups = this.vGroups if (groups == null) { groups = [] } let groupIds = [] if (groups.length > 0) { groupIds = groups.map(function (v) { return v.id.toString() }).join(",") } return { groups: groups, groupIds: groupIds } }, methods: { addGroup: function () { let that = this teaweb.popup("/admins/recipients/groups/selectPopup?groupIds=" + this.groupIds, { callback: function (resp) { that.groups.push(resp.data.group) that.update() } }) }, removeGroup: function (index) { this.groups.$remove(index) this.update() }, update: function () { let groupIds = [] if (this.groups.length > 0) { this.groups.forEach(function (v) { groupIds.push(v.id) }) } this.groupIds = groupIds.join(",") } }, template: `
{{group.name}}  
` })