refactor(basicdata): order basicdata requires address and landed to show agencies
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-08-31 14:10:37 +02:00
parent 0de3755d09
commit 74a3b5cf89
2 changed files with 4 additions and 4 deletions

View File

@ -23,7 +23,6 @@
show-field="name" show-field="name"
value-field="id" value-field="id"
ng-model="$ctrl.order.clientFk" ng-model="$ctrl.order.clientFk"
on-change="$ctrl.getAvailableAgencies()"
selection="$ctrl.selection" selection="$ctrl.selection"
fields="['defaultAddressFk']"> fields="['defaultAddressFk']">
<tpl-item>{{::id}}: {{::name}}</tpl-item> <tpl-item>{{::id}}: {{::name}}</tpl-item>
@ -36,7 +35,8 @@
search-function="$search" search-function="$search"
show-field="nickname" show-field="nickname"
value-field="id" value-field="id"
ng-model="$ctrl.order.addressFk"> ng-model="$ctrl.order.addressFk"
on-change="$ctrl.getAvailableAgencies()">
<tpl-item>{{::nickname}}</tpl-item> <tpl-item>{{::nickname}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
@ -48,7 +48,7 @@
on-change="$ctrl.getAvailableAgencies()"> on-change="$ctrl.getAvailableAgencies()">
</vn-date-picker> </vn-date-picker>
<vn-autocomplete <vn-autocomplete
disabled="!$ctrl.order.clientFk || !$ctrl.order.landed" disabled="!$ctrl.order.addressFk || !$ctrl.order.landed"
data="$ctrl._availableAgencies" data="$ctrl._availableAgencies"
label="Agency" label="Agency"
show-field="agencyMode" show-field="agencyMode"

View File

@ -45,7 +45,7 @@ describe('Order', () => {
describe('getAvailableAgencies()', () => { describe('getAvailableAgencies()', () => {
it('should set agencyModeFk to null and get the available agencies if the order has landed and client', async() => { it('should set agencyModeFk to null and get the available agencies if the order has landed and client', async() => {
controller.order.agencyModeFk = 999; controller.order.agencyModeFk = 999;
controller.order.clientFk = 999; controller.order.addressFk = 999;
controller.order.landed = new Date(); controller.order.landed = new Date();
const expectedAgencies = [{id: 1}, {id: 2}]; const expectedAgencies = [{id: 1}, {id: 2}];