From 1bfe537186514ae34382360207168806363507aa Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 21 May 2021 15:31:05 +0200 Subject: [PATCH 1/4] claim, client, entry, item and order modules descriptor now takes warehouseFk from vnConfig --- modules/claim/front/action/index.html | 7 ++++--- modules/claim/front/detail/index.html | 3 ++- modules/claim/front/summary/index.html | 7 ++++--- modules/client/front/consumption/index.html | 3 ++- modules/entry/front/buy/index/index.html | 3 ++- modules/entry/front/latest-buys/index.html | 5 +++-- modules/entry/front/summary/index.html | 5 +++-- modules/item/front/card/index.html | 5 ++++- modules/item/front/descriptor/index.js | 5 +++-- modules/item/front/fixed-price/index.html | 3 ++- modules/item/front/index/index.html | 5 +++-- modules/item/front/request/index.html | 7 ++++--- modules/item/front/waste/detail/index.html | 5 +++-- modules/order/front/catalog-view/index.html | 5 +++-- modules/order/front/line/index.html | 5 +++-- modules/order/front/summary/index.html | 7 ++++--- modules/order/front/volume/index.html | 5 +++-- 17 files changed, 52 insertions(+), 33 deletions(-) diff --git a/modules/claim/front/action/index.html b/modules/claim/front/action/index.html index 5f187c05bf..eeac01d785 100644 --- a/modules/claim/front/action/index.html +++ b/modules/claim/front/action/index.html @@ -71,7 +71,7 @@ vn-repeat-last on-last="$ctrl.focusLastInput()"> {{::saleClaimed.sale.itemFk | zeroFill:6}} @@ -154,10 +154,11 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> + vn-id="ticket-descriptor"> + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> + vn-id="worker-descriptor"> + vn-id="ticket-descriptor"> \ No newline at end of file diff --git a/modules/client/front/consumption/index.html b/modules/client/front/consumption/index.html index b2128ee11d..1465659542 100644 --- a/modules/client/front/consumption/index.html +++ b/modules/client/front/consumption/index.html @@ -82,7 +82,8 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> diff --git a/modules/entry/front/buy/index/index.html b/modules/entry/front/buy/index/index.html index 22ae275402..9b9cd4634b 100644 --- a/modules/entry/front/buy/index/index.html +++ b/modules/entry/front/buy/index/index.html @@ -202,7 +202,8 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> + vn-id="entry-descriptor"> diff --git a/modules/entry/front/summary/index.html b/modules/entry/front/summary/index.html index 24cedcdb20..e4ad6ba311 100644 --- a/modules/entry/front/summary/index.html +++ b/modules/entry/front/summary/index.html @@ -160,9 +160,10 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> + vn-id="travel-descriptor"> diff --git a/modules/item/front/card/index.html b/modules/item/front/card/index.html index b7513a42a5..e92e1696d4 100644 --- a/modules/item/front/card/index.html +++ b/modules/item/front/card/index.html @@ -1,5 +1,8 @@ - + diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index bdf95fb619..a321d493bf 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -35,7 +35,7 @@ class Controller extends Descriptor { if (!this.item) return; const params = { - warehouseFk: this.item.itemType.warehouseFk, + warehouseFk: this.warehouseFk, dated: this.dated }; @@ -90,6 +90,7 @@ ngModule.vnComponent('vnItemDescriptor', { bindings: { item: '<', dated: '<', - cardReload: '&' + cardReload: '&', + warehouseFk: ' + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> \ No newline at end of file diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 590a6fdf37..bcebaee484 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -112,10 +112,11 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> + vn-id="worker-descriptor"> + vn-id="worker-descriptor"> + vn-id="ticket-descriptor"> + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> {{::waste.itemFk}} @@ -38,5 +38,6 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> \ No newline at end of file diff --git a/modules/order/front/catalog-view/index.html b/modules/order/front/catalog-view/index.html index f247c9b6b4..fca7288555 100644 --- a/modules/order/front/catalog-view/index.html +++ b/modules/order/front/catalog-view/index.html @@ -63,9 +63,10 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> \ No newline at end of file diff --git a/modules/order/front/line/index.html b/modules/order/front/line/index.html index 957b59cfe7..df81102d51 100644 --- a/modules/order/front/line/index.html +++ b/modules/order/front/line/index.html @@ -37,7 +37,7 @@ on-error-src/> - {{::row.itemFk | zeroFill:6}} @@ -83,7 +83,8 @@ fixed-bottom-right> + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> {{::row.itemFk | zeroFill:6}} @@ -119,8 +119,9 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> + vn-id="client-descriptor"> diff --git a/modules/order/front/volume/index.html b/modules/order/front/volume/index.html index 078ac92802..f7e03e8719 100644 --- a/modules/order/front/volume/index.html +++ b/modules/order/front/volume/index.html @@ -34,7 +34,7 @@ {{::row.itemFk}} @@ -58,6 +58,7 @@ + vn-id="item-descriptor" + warehouse-fk="$ctrl.vnConfig.warehouseFk"> -- 2.40.1 From 5c18c5c94ccefdd3c9867bc6c6613fd550feff89 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 21 May 2021 15:31:28 +0200 Subject: [PATCH 2/4] ticket module descriptor now takes warehouseFk from the ticket --- modules/ticket/front/component/index.html | 6 +++--- modules/ticket/front/expedition/index.html | 8 ++++---- modules/ticket/front/picture/index.html | 13 ++++++++++--- modules/ticket/front/request/index/index.html | 13 ++++++++++--- modules/ticket/front/sale-checked/index.html | 4 ++-- modules/ticket/front/sale-checked/index.js | 4 ++-- modules/ticket/front/sale-tracking/index.html | 4 ++-- modules/ticket/front/sale/index.html | 4 ++-- modules/ticket/front/summary/index.html | 8 ++++---- modules/ticket/front/volume/index.html | 4 ++-- 10 files changed, 41 insertions(+), 27 deletions(-) diff --git a/modules/ticket/front/component/index.html b/modules/ticket/front/component/index.html index ac109c3348..3843529c31 100644 --- a/modules/ticket/front/component/index.html +++ b/modules/ticket/front/component/index.html @@ -24,7 +24,7 @@ {{sale.itemFk | zeroFill:6}} @@ -103,11 +103,11 @@ + vn-id="zone-descriptor"> diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 26d9ef6403..e4d42d62ec 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -57,15 +57,15 @@ + vn-id="worker-descriptor"> diff --git a/modules/ticket/front/picture/index.html b/modules/ticket/front/picture/index.html index c95e604dd0..b4ea6ae0d0 100644 --- a/modules/ticket/front/picture/index.html +++ b/modules/ticket/front/picture/index.html @@ -7,6 +7,12 @@ data="sales" auto-load="true"> + +

- + {{::sale.item.name}}

@@ -63,5 +69,6 @@ - + vn-id="item-descriptor" + warehouse-fk="tickets[0].warehouseFk"> + \ No newline at end of file diff --git a/modules/ticket/front/request/index/index.html b/modules/ticket/front/request/index/index.html index dadc96325c..767f1dccf3 100644 --- a/modules/ticket/front/request/index/index.html +++ b/modules/ticket/front/request/index/index.html @@ -8,6 +8,12 @@ data="purchaseRequests" auto-load="true"> + + @@ -24,7 +30,7 @@ Atender Quantity Price - Sale id + Item id Ok @@ -101,10 +107,11 @@ + vn-id="item-descriptor" + warehouse-fk="tickets[0].warehouseFk"> + vn-id="worker-descriptor"> {{::sale.itemFk | zeroFill:6}} @@ -52,7 +52,7 @@ diff --git a/modules/ticket/front/sale-checked/index.js b/modules/ticket/front/sale-checked/index.js index cfc3985ba6..857ac49e32 100644 --- a/modules/ticket/front/sale-checked/index.js +++ b/modules/ticket/front/sale-checked/index.js @@ -17,7 +17,7 @@ class Controller extends Section { ] }; } - showDescriptor(event, sale) { + showItemDescriptor(event, sale) { this.quicklinks = { btnThree: { icon: 'icon-transaction', @@ -29,7 +29,7 @@ class Controller extends Section { tooltip: 'Item diary' } }; - this.$.descriptor.show(event.target, sale.itemFk); + this.$.itemDescriptor.show(event.target, sale.itemFk); } } diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 4e80b35653..54a0eca662 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -67,9 +67,9 @@ + vn-id="worker-descriptor"> \ No newline at end of file diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 5bba457caf..5156206bb5 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -100,7 +100,7 @@ + ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)"> {{sale.itemFk}} diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 6c25f2665c..170cbd0cf6 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -147,7 +147,7 @@ {{sale.itemFk | zeroFill:6}} @@ -259,7 +259,7 @@ {{request.sale.itemFk | zeroFill:6}} @@ -279,10 +279,10 @@ + vn-id="route-descriptor"> diff --git a/modules/ticket/front/volume/index.html b/modules/ticket/front/volume/index.html index eb2a07d261..8e2bc4bb6e 100644 --- a/modules/ticket/front/volume/index.html +++ b/modules/ticket/front/volume/index.html @@ -37,7 +37,7 @@ {{sale.itemFk | zeroFill:6}} @@ -63,7 +63,7 @@ -- 2.40.1 From 025766857ff27a05feccced16c8949c115ae2c83 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 21 May 2021 18:09:10 +0200 Subject: [PATCH 3/4] e2e path fixed for worker calendar --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 143196d181..b5bf46dd55 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -892,7 +892,7 @@ export default { penultimateMondayOfJanuary: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(22) > div', lastMondayOfMarch: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div', fistMondayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div', - secondFridayOfJun: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(12) > div', + secondFridayOfJun: 'vn-worker-calendar vn-calendar:nth-child(7) section:nth-child(12) > div', secondTuesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div', secondWednesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div', secondThursdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div', -- 2.40.1 From 2a4ff5a97bcd694264b59ef949cbd13bdae71c3b Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 24 May 2021 10:31:51 +0200 Subject: [PATCH 4/4] fixed a problem where warehouseFk wasn't yet defined upon updateStock call --- modules/item/back/methods/item/getSummary.js | 8 +- modules/item/front/descriptor/index.js | 11 ++- modules/ticket/front/picture/index.html | 8 +- modules/ticket/front/picture/index.js | 5 +- modules/ticket/front/request/index/index.html | 8 +- modules/ticket/front/request/index/index.js | 5 +- modules/ticket/front/routes.json | 83 +++++++++++++------ 7 files changed, 81 insertions(+), 47 deletions(-) diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index 6989845729..4ef9652cab 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -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; diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index a321d493bf..133b11b48c 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -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() { diff --git a/modules/ticket/front/picture/index.html b/modules/ticket/front/picture/index.html index b4ea6ae0d0..7522fa0286 100644 --- a/modules/ticket/front/picture/index.html +++ b/modules/ticket/front/picture/index.html @@ -7,12 +7,6 @@ data="sales" auto-load="true"> - - + warehouse-fk="$ctrl.ticket.warehouseFk"> \ No newline at end of file diff --git a/modules/ticket/front/picture/index.js b/modules/ticket/front/picture/index.js index 89cf9e078a..0c0017e667 100644 --- a/modules/ticket/front/picture/index.js +++ b/modules/ticket/front/picture/index.js @@ -17,5 +17,8 @@ class Controller extends Section { ngModule.vnComponent('vnTicketPicture', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + ticket: '<' + } }); diff --git a/modules/ticket/front/request/index/index.html b/modules/ticket/front/request/index/index.html index 767f1dccf3..39a290d8c3 100644 --- a/modules/ticket/front/request/index/index.html +++ b/modules/ticket/front/request/index/index.html @@ -8,12 +8,6 @@ data="purchaseRequests" auto-load="true"> - - @@ -108,7 +102,7 @@ + warehouse-fk="$ctrl.ticket.warehouseFk"> diff --git a/modules/ticket/front/request/index/index.js b/modules/ticket/front/request/index/index.js index b4b11292e5..9d5a22f53b 100644 --- a/modules/ticket/front/request/index/index.js +++ b/modules/ticket/front/request/index/index.js @@ -70,5 +70,8 @@ class Controller extends Section { ngModule.vnComponent('vnTicketRequestIndex', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + ticket: '<' + } }); diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index cb1701008b..64529325c3 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -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", -- 2.40.1