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;
|
|
|
|
$scope.$watch('$ctrl.selection', newValue=>{
|
|
|
|
if (newValue) {
|
|
|
|
$scope.addressModel.where = {clientFk: newValue.id};
|
|
|
|
$scope.addressModel.refresh();
|
|
|
|
if (isDirty)
|
2019-02-15 12:26:49 +00:00
|
|
|
this.order.addressFk = newValue.defaultAddressFk;
|
2019-02-06 13:56:36 +00:00
|
|
|
isDirty = true;
|
|
|
|
} else {
|
|
|
|
$scope.addressModel.clear();
|
|
|
|
if (isDirty)
|
2019-02-15 12:26:49 +00:00
|
|
|
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: '<'
|
|
|
|
}
|
|
|
|
});
|