salix/modules/account/front/summary/index.js

41 lines
916 B
JavaScript

import ngModule from '../module';
import Summary from 'salix/components/summary';
class Controller extends Summary {
set user(value) {
this._user = value;
this.$.summary = null;
if (!value) return;
const filter = {
where: {id: value.id},
include: {
relation: 'role',
scope: {
fields: ['id', 'name']
}
}
};
this.$http.get(`VnUsers/preview`, {filter})
.then(res => {
const [summary] = res.data;
this.$.summary = summary;
});
}
get isHr() {
return this.aclService.hasAny(['hr']);
}
get user() {
return this._user;
}
}
ngModule.component('vnUserSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
user: '<'
}
});