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;
$scope.$watch('$ctrl.selection', newValue=>{
if (newValue) {
$scope.addressModel.where = {clientFk: newValue.id};
$scope.addressModel.refresh();
if (isDirty)
this.order.address_id = newValue.defaultAddressFk;
isDirty = true;
} else {
$scope.addressModel.clear();
if (isDirty)
this.order.address_id = null;
}
});
}
}
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: '<'
}
});