Zone.getLeaves refactor & fixes
gitea/salix/master This commit looks good Details

This commit is contained in:
Juan Ferrer 2019-09-19 17:30:16 +02:00
parent e0ffef70b1
commit 05fec10cf2
4 changed files with 4 additions and 6 deletions

View File

@ -29,7 +29,7 @@ module.exports = Self => {
Self.getLeaves = async(zoneFk, parentFk = null, search) => { Self.getLeaves = async(zoneFk, parentFk = null, search) => {
let [res] = await Self.rawSql( let [res] = await Self.rawSql(
`CALL zoneGeo_getLeaves(?, ?, ?)`, `CALL zone_getLeaves(?, ?, ?)`,
[zoneFk, parentFk, search] [zoneFk, parentFk, search]
); );
@ -51,6 +51,6 @@ module.exports = Self => {
let leaves = map.get(parentFk); let leaves = map.get(parentFk);
setLeaves(leaves); setLeaves(leaves);
return leaves; return leaves || [];
}; };
}; };

View File

@ -1,3 +0,0 @@
module.exports = Self => {
require('../methods/zone-geo/getLeaves')(Self);
};

View File

@ -1,6 +1,7 @@
module.exports = Self => { module.exports = Self => {
require('../methods/zone/clone')(Self); require('../methods/zone/clone')(Self);
require('../methods/zone/editPrices')(Self); require('../methods/zone/editPrices')(Self);
require('../methods/zone/getLeaves')(Self);
Self.validatesPresenceOf('warehouseFk', { Self.validatesPresenceOf('warehouseFk', {
message: `Warehouse cannot be blank` message: `Warehouse cannot be blank`

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="/agency/api/ZoneGeos/getLeaves" url="/agency/api/Zones/getLeaves"
filter="::$ctrl.filter" filter="::$ctrl.filter"
params="{zoneFk: $ctrl.$stateParams.id}" params="{zoneFk: $ctrl.$stateParams.id}"
auto-load="false"> auto-load="false">