2020-03-09 08:00:03 +00:00
|
|
|
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() {
|
2023-07-12 13:07:06 +00:00
|
|
|
this.addData = {account: this.$params.id};
|
2020-03-09 08:00:03 +00:00
|
|
|
this.$.dialog.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
onAddSave() {
|
2023-07-12 13:07:06 +00:00
|
|
|
return this.$http.post(`MailAliasAccounts`, this.addData)
|
2020-03-09 08:00:03 +00:00
|
|
|
.then(() => this.refresh())
|
|
|
|
.then(() => this.vnApp.showSuccess(
|
|
|
|
this.$t('Subscribed to alias!'))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
onRemove(row) {
|
2023-07-12 13:07:06 +00:00
|
|
|
return this.$http.delete(`MailAliasAccounts/${row.id}`)
|
|
|
|
.then(() => {
|
|
|
|
this.$.data.splice(this.$.data.indexOf(row), 1);
|
|
|
|
this.vnApp.showSuccess(this.$t('Unsubscribed from alias!'));
|
|
|
|
});
|
2020-03-09 08:00:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.component('vnUserAliases', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
require: {
|
|
|
|
card: '^vnUserCard'
|
|
|
|
}
|
|
|
|
});
|