order.json regularizados campos addressFk, agencyModeFk

This commit is contained in:
Javi Gallego 2019-02-15 13:26:49 +01:00
parent 7f7f47d861
commit 32cc39ad00
7 changed files with 35 additions and 22 deletions

View File

@ -15,7 +15,7 @@ describe('order addToOrder()', () => {
orderFk: 20,
items: [{
itemFk: 1,
quantity: 1,
quantity: 10,
warehouseFk: 1
}]
};

View File

@ -37,9 +37,9 @@ module.exports = Self => {
let validUpdateParams = [
'clientFk',
'address_id',
'addressFk',
'landed',
'agency_id',
'agencyModeFk',
'note',
];

View File

@ -26,6 +26,20 @@
"columnName": "customer_id"
}
},
"addressFk": {
"type": "Number",
"required": true,
"mysql": {
"columnName": "address_id"
}
},
"agencyModeFk": {
"type": "Number",
"required": true,
"mysql": {
"columnName": "agency_id"
}
},
"companyFk": {
"type": "Number",
"required": true,
@ -75,7 +89,6 @@
},
"address": {
"type": "belongsTo",
"required": true,
"model": "Address",
"foreignKey": "address_id"
},

View File

@ -34,7 +34,7 @@
search-function="{or: [{id: $search}, {nickname: {like: '%'+$search+'%'}}]}"
show-field="nickname"
value-field="id"
field="$ctrl.order.address_id">
field="$ctrl.order.addressFk">
<tpl-item>{{::nickname}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
@ -52,7 +52,7 @@
search-function="{or: [{id: $search}, {name: {like: '%'+$search+'%'}}]}"
show-field="name"
value-field="id"
field="$ctrl.order.agency_id">
field="$ctrl.order.agencyModeFk">
<tpl-item>{{::id}}: {{::name}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>

View File

@ -9,12 +9,12 @@ class Controller {
$scope.addressModel.where = {clientFk: newValue.id};
$scope.addressModel.refresh();
if (isDirty)
this.order.address_id = newValue.defaultAddressFk;
this.order.addressFk = newValue.defaultAddressFk;
isDirty = true;
} else {
$scope.addressModel.clear();
if (isDirty)
this.order.address_id = null;
this.order.addressFk = null;
}
});
}

View File

@ -16,7 +16,7 @@ describe('Order', () => {
.respond([{id: 2, nickname: 'address 2'}]);
$httpBackend.whenGET(/^\/api\/Clients/)
.respond([{id: 1, defaultAddressFk: 1}]);
$scope.order = {clientFk: 1, address_id: 1};
$scope.order = {clientFk: 1, addressFk: 1};
let $element = $compile('<vn-order-basic-data order="order"></vn-order-basic-data>')($scope);
$httpBackend.flush();
@ -28,7 +28,7 @@ describe('Order', () => {
controller.selection = {id: 2, defaultAddressFk: 2};
$scope.$digest();
expect(controller.order.address_id).toEqual(2);
expect(controller.order.addressFk).toEqual(2);
});
});
});

24
package-lock.json generated
View File

@ -3762,7 +3762,7 @@
"dot-prop": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz",
"integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==",
"integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=",
"dev": true,
"requires": {
"is-obj": "^1.0.0"
@ -3935,7 +3935,7 @@
},
"jsonfile": {
"version": "2.4.0",
"resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"dev": true,
"requires": {
@ -7160,7 +7160,7 @@
"is-absolute": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
"integrity": "sha1-OV4a6EsR8mrReV5zwXN45IowFXY=",
"integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==",
"dev": true,
"requires": {
"is-relative": "^1.0.0",
@ -7423,7 +7423,7 @@
"is-relative": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
"integrity": "sha1-obtpNc6MXboei5dUubLcwCDiJg0=",
"integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==",
"dev": true,
"requires": {
"is-unc-path": "^1.0.0"
@ -7457,7 +7457,7 @@
"is-unc-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz",
"integrity": "sha1-1zHoiY7QkKEsNSrS6u1Qla0yLJ0=",
"integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==",
"dev": true,
"requires": {
"unc-path-regex": "^0.1.2"
@ -7863,7 +7863,7 @@
"karma-chrome-launcher": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz",
"integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==",
"integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=",
"dev": true,
"requires": {
"fs-access": "^1.0.0",
@ -9671,7 +9671,7 @@
"dependencies": {
"commander": {
"version": "1.0.4",
"resolved": "http://registry.npmjs.org/commander/-/commander-1.0.4.tgz",
"resolved": "https://registry.npmjs.org/commander/-/commander-1.0.4.tgz",
"integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=",
"dev": true,
"requires": {
@ -11638,7 +11638,7 @@
},
"readable-stream": {
"version": "1.1.14",
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"dev": true,
"requires": {
@ -11650,7 +11650,7 @@
},
"string_decoder": {
"version": "0.10.31",
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
},
@ -12901,7 +12901,7 @@
},
"string-width": {
"version": "1.0.2",
"resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true,
"requires": {
@ -14368,7 +14368,7 @@
"touch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
"integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=",
"dev": true,
"requires": {
"nopt": "~1.0.10"
@ -15966,7 +15966,7 @@
"write-file-atomic": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz",
"integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==",
"integrity": "sha1-H/YVdcLipOjlENb6TiQ8zhg5mas=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.11",