salix/modules/supplier/front/descriptor/index.js

34 lines
713 B
JavaScript

import ngModule from '../module';
import Descriptor from 'salix/components/descriptor';
class Controller extends Descriptor {
get supplier() {
return this.entity;
}
set supplier(value) {
this.entity = value;
}
loadData() {
const filter = {
fields: [
'id',
'name',
'nickname',
'nif'
]
};
return this.getData(`Suppliers/${this.id}`, {filter})
.then(res => this.entity = res.data);
}
}
ngModule.vnComponent('vnSupplierDescriptor', {
template: require('./index.html'),
controller: Controller,
bindings: {
supplier: '<'
}
});