salix/modules/order/front/basic-data/index.js

32 lines
828 B
JavaScript
Raw Normal View History

2018-11-30 10:45:17 +00:00
import ngModule from '../module';
import './style.scss';
2019-02-06 13:56:36 +00:00
class Controller {
constructor($scope) {
let isDirty = false;
2019-11-12 13:18:46 +00:00
$scope.$watch('$ctrl.selection', newValue => {
2019-02-06 13:56:36 +00:00
if (newValue) {
$scope.addressModel.where = {clientFk: newValue.id};
$scope.addressModel.refresh();
if (isDirty)
this.order.addressFk = newValue.defaultAddressFk;
2019-02-06 13:56:36 +00:00
isDirty = true;
} else {
$scope.addressModel.clear();
if (isDirty)
this.order.addressFk = null;
2019-02-06 13:56:36 +00:00
}
});
}
}
Controller.$inject = ['$scope'];
2018-11-30 10:45:17 +00:00
ngModule.component('vnOrderBasicData', {
2019-02-06 13:56:36 +00:00
controller: Controller,
2018-11-30 10:45:17 +00:00
template: require('./index.html'),
bindings: {
order: '<'
}
});