32 lines
891 B
JavaScript
32 lines
891 B
JavaScript
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
import './style.scss';
|
|
|
|
class Controller extends Section {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
let isDirty = false;
|
|
this.$.$watch('$ctrl.selection', newValue => {
|
|
if (newValue) {
|
|
this.$.addressModel.where = {clientFk: newValue.id};
|
|
this.$.addressModel.refresh();
|
|
if (isDirty)
|
|
this.order.addressFk = newValue.defaultAddressFk;
|
|
isDirty = true;
|
|
} else {
|
|
this.$.addressModel.clear();
|
|
if (isDirty)
|
|
this.order.addressFk = null;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
ngModule.component('vnOrderBasicData', {
|
|
controller: Controller,
|
|
template: require('./index.html'),
|
|
bindings: {
|
|
order: '<'
|
|
}
|
|
});
|