52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
|
|
export default class Controller extends Section {
|
|
$onInit() {
|
|
this.refresh();
|
|
}
|
|
|
|
refresh() {
|
|
let filter = {
|
|
where: {account: this.$params.id},
|
|
include: {
|
|
relation: 'alias',
|
|
scope: {
|
|
fields: ['id', 'alias', 'description']
|
|
}
|
|
}
|
|
};
|
|
return this.$http.get(`MailAliasAccounts`, {filter})
|
|
.then(res => this.$.data = res.data);
|
|
}
|
|
|
|
onAddClick() {
|
|
this.$.dialog.show();
|
|
}
|
|
|
|
onAddSave() {
|
|
return this.$http.post(`MailAliasAccounts/${this.$params.id}/addAlias`, this.addData)
|
|
.then(() => this.refresh())
|
|
.then(() => this.vnApp.showSuccess(
|
|
this.$t('Subscribed to alias!'))
|
|
);
|
|
}
|
|
|
|
onRemove(row) {
|
|
const params = {
|
|
mailAlias: row.mailAlias
|
|
};
|
|
return this.$http.post(`MailAliasAccounts/${this.$params.id}/removeAlias`, params)
|
|
.then(() => this.refresh())
|
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
|
}
|
|
}
|
|
|
|
ngModule.component('vnUserAliases', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
require: {
|
|
card: '^vnUserCard'
|
|
}
|
|
});
|