salix/modules/client/front/phones/index.js

45 lines
930 B
JavaScript
Raw Normal View History

2019-12-17 08:11:28 +00:00
import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
get client() {
return this._client;
}
set client(value) {
this._client = value;
if (value)
this.setLink(value);
}
setLink(value) {
this.$.$applyAsync(()=> {
this.$.model.link = {userFk: value.id};
this.$.model.refresh();
});
}
onSubmit() {
this.$.watcher.check();
return this.$.model.save().then(() => {
this.$.watcher.updateOriginalData();
this.$.watcher.notifySaved();
this.card.reload();
});
}
add() {
this.$.model.insert();
}
}
ngModule.component('vnClientPhones', {
template: require('./index.html'),
controller: Controller,
require: {card: '^vnClientCard'},
bindings: {
client: '<'
}
});