fixed a problem where warehouseFk wasn't yet defined upon updateStock call
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
025766857f
commit
2a4ff5a97b
|
@ -1,5 +1,5 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getSummary', {
|
||||
Self.remoteMethodCtx('getSummary', {
|
||||
description: 'return the item information',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
|
@ -19,7 +19,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.getSummary = async id => {
|
||||
Self.getSummary = async(ctx, id) => {
|
||||
let promises = [];
|
||||
let summary = {};
|
||||
const models = Self.app.models;
|
||||
|
@ -102,7 +102,9 @@ module.exports = Self => {
|
|||
[summary.botanical] = res[2];
|
||||
summary.niches = res[3];
|
||||
|
||||
res = await models.Item.getVisibleAvailable(summary.item.id, summary.item.itemType().warehouseFk);
|
||||
const userConfig = await models.UserConfig.getUserConfig(ctx);
|
||||
|
||||
res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk);
|
||||
|
||||
summary.available = res.available;
|
||||
summary.visible = res.visible;
|
||||
|
|
|
@ -21,7 +21,16 @@ class Controller extends Descriptor {
|
|||
|
||||
set entity(value) {
|
||||
super.entity = value;
|
||||
this.updateStock();
|
||||
if (this.warehouseFk) this.updateStock();
|
||||
}
|
||||
|
||||
get warehouseFk() {
|
||||
return this._warehouseFk;
|
||||
}
|
||||
|
||||
set warehouseFk(value) {
|
||||
this._warehouseFk = value;
|
||||
if (value) this.updateStock();
|
||||
}
|
||||
|
||||
loadData() {
|
||||
|
|
|
@ -7,12 +7,6 @@
|
|||
data="sales"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
url="tickets"
|
||||
link="{id: $ctrl.$params.id}"
|
||||
data="tickets"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-vertical>
|
||||
<vn-card
|
||||
ng-if="!model.data || model.data.length == 0"
|
||||
|
@ -70,5 +64,5 @@
|
|||
</vn-vertical>
|
||||
<vn-item-descriptor-popover
|
||||
vn-id="item-descriptor"
|
||||
warehouse-fk="tickets[0].warehouseFk">
|
||||
warehouse-fk="$ctrl.ticket.warehouseFk">
|
||||
</vn-item-descriptor-popover>
|
|
@ -17,5 +17,8 @@ class Controller extends Section {
|
|||
|
||||
ngModule.vnComponent('vnTicketPicture', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
ticket: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
data="purchaseRequests"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
url="tickets"
|
||||
link="{id: $ctrl.$params.id}"
|
||||
data="tickets"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="purchaseRequests">
|
||||
|
@ -108,7 +102,7 @@
|
|||
</vn-data-viewer>
|
||||
<vn-item-descriptor-popover
|
||||
vn-id="item-descriptor"
|
||||
warehouse-fk="tickets[0].warehouseFk">
|
||||
warehouse-fk="$ctrl.ticket.warehouseFk">
|
||||
</vn-item-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="worker-descriptor">
|
||||
|
|
|
@ -70,5 +70,8 @@ class Controller extends Section {
|
|||
|
||||
ngModule.vnComponent('vnTicketRequestIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
ticket: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -37,17 +37,20 @@
|
|||
"abstract": true,
|
||||
"component": "vn-ticket",
|
||||
"description": "Tickets"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/index?q",
|
||||
"state": "ticket.index",
|
||||
"component": "vn-ticket-index",
|
||||
"description": "Tickets"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/:id?sendSMS&phone&message",
|
||||
"state": "ticket.card",
|
||||
"abstract": true,
|
||||
"component": "vn-ticket-card"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/summary",
|
||||
"state": "ticket.card.summary",
|
||||
"component": "vn-ticket-summary",
|
||||
|
@ -55,7 +58,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/basic-data",
|
||||
"state": "ticket.card.basicData",
|
||||
"component": "vn-ticket-basic-data",
|
||||
|
@ -63,7 +67,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/step-one",
|
||||
"state": "ticket.card.basicData.stepOne",
|
||||
"component": "vn-ticket-basic-data-step-one",
|
||||
|
@ -71,7 +76,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.data"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/step-two",
|
||||
"state": "ticket.card.basicData.stepTwo",
|
||||
"component": "vn-ticket-basic-data-step-two",
|
||||
|
@ -79,7 +85,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.data"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/sale",
|
||||
"state": "ticket.card.sale",
|
||||
"component": "vn-ticket-sale",
|
||||
|
@ -87,7 +94,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/observation",
|
||||
"state": "ticket.card.observation",
|
||||
"component": "vn-ticket-observation",
|
||||
|
@ -95,7 +103,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/volume",
|
||||
"state": "ticket.card.volume",
|
||||
"component": "vn-ticket-volume",
|
||||
|
@ -103,7 +112,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/expedition",
|
||||
"state": "ticket.card.expedition",
|
||||
"component": "vn-ticket-expedition",
|
||||
|
@ -111,7 +121,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/package",
|
||||
"state": "ticket.card.package",
|
||||
"component": "vn-ticket-package",
|
||||
|
@ -119,12 +130,14 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/tracking",
|
||||
"state": "ticket.card.tracking",
|
||||
"abstract": true,
|
||||
"component": "ui-view"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/index",
|
||||
"state": "ticket.card.tracking.index",
|
||||
"component": "vn-ticket-tracking-index",
|
||||
|
@ -132,7 +145,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/edit",
|
||||
"state": "ticket.card.tracking.edit",
|
||||
"component": "vn-ticket-tracking-edit",
|
||||
|
@ -141,7 +155,8 @@
|
|||
"ticket": "$ctrl.ticket"
|
||||
},
|
||||
"acl": ["production", "administrative", "salesPerson"]
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/sale-checked",
|
||||
"state": "ticket.card.saleChecked",
|
||||
"component": "vn-ticket-sale-checked",
|
||||
|
@ -149,7 +164,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/components",
|
||||
"state": "ticket.card.components",
|
||||
"component": "vn-ticket-components",
|
||||
|
@ -157,7 +173,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/sale-tracking",
|
||||
"state": "ticket.card.saleTracking",
|
||||
"component": "vn-ticket-sale-tracking",
|
||||
|
@ -165,7 +182,8 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/picture",
|
||||
"state": "ticket.card.picture",
|
||||
"component": "vn-ticket-picture",
|
||||
|
@ -173,43 +191,54 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/log",
|
||||
"state": "ticket.card.log",
|
||||
"component": "vn-ticket-log",
|
||||
"description": "Log"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/weekly",
|
||||
"state": "ticket.weekly",
|
||||
"abstract": true,
|
||||
"component": "ui-view",
|
||||
"description": "Weekly"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/index?q",
|
||||
"state": "ticket.weekly.index",
|
||||
"component": "vn-ticket-weekly-index",
|
||||
"description": "Weekly tickets"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/service",
|
||||
"state": "ticket.card.service",
|
||||
"component": "vn-ticket-service",
|
||||
"description": "Service"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/request",
|
||||
"state": "ticket.card.request",
|
||||
"abstract": true,
|
||||
"component": "ui-view"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url" : "/index",
|
||||
"state": "ticket.card.request.index",
|
||||
"component": "vn-ticket-request-index",
|
||||
"description": "Purchase request"
|
||||
}, {
|
||||
"description": "Purchase request",
|
||||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
},
|
||||
{
|
||||
"url" : "/create",
|
||||
"state": "ticket.card.request.create",
|
||||
"component": "vn-ticket-request-create",
|
||||
"description": "New purchase request"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"url": "/create?clientFk",
|
||||
"state": "ticket.create",
|
||||
"component": "vn-ticket-create",
|
||||
|
|
Loading…
Reference in New Issue