Vue.component("countries-selector", { props: ["v-countries"], data: function () { let countries = this.vCountries if (countries == null) { countries = [] } let countryIds = countries.$map(function (k, v) { return v.id }) return { countries: countries, countryIds: countryIds } }, methods: { add: function () { let countryStringIds = this.countryIds.map(function (v) { return v.toString() }) let that = this teaweb.popup("/ui/selectCountriesPopup?countryIds=" + countryStringIds.join(","), { width: "48em", height: "23em", callback: function (resp) { that.countries = resp.data.countries that.change() } }) }, remove: function (index) { this.countries.$remove(index) this.change() }, change: function () { this.countryIds = this.countries.$map(function (k, v) { return v.id }) } }, template: `
` })