From 578685e05e54017b2a74091960f65ecf533e5dba Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 18 Feb 2022 13:56:18 +0100 Subject: [PATCH] feat(client): add back route 'updatePortfolio' --- .../back/methods/client/updatePortfolio.js | 20 +++++++++++++++++++ modules/client/back/models/client.js | 1 + modules/client/front/basic-data/index.html | 3 ++- modules/client/front/basic-data/index.js | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 modules/client/back/methods/client/updatePortfolio.js diff --git a/modules/client/back/methods/client/updatePortfolio.js b/modules/client/back/methods/client/updatePortfolio.js new file mode 100644 index 000000000..8224a8aa4 --- /dev/null +++ b/modules/client/back/methods/client/updatePortfolio.js @@ -0,0 +1,20 @@ +module.exports = function(Self) { + Self.remoteMethodCtx('updatePortfolio', { + description: 'Update salesPeson potfolio weight', + accessType: 'READ', + accepts: [], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/updatePortfolio`, + verb: 'GET' + } + }); + + Self.updatePortfolio = async() => { + query = `CALL bs.vendedores_updatePortfolio()`; + return await Self.rawSql(query); + }; +}; diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index e842c3ea1..9ec45f58d 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -29,6 +29,7 @@ module.exports = Self => { require('../methods/client/updateAddress')(Self); require('../methods/client/consumption')(Self); require('../methods/client/createReceipt')(Self); + require('../methods/client/updatePortfolio')(Self); // Validations diff --git a/modules/client/front/basic-data/index.html b/modules/client/front/basic-data/index.html index a76b448f2..72d09ab49 100644 --- a/modules/client/front/basic-data/index.html +++ b/modules/client/front/basic-data/index.html @@ -68,7 +68,8 @@ value-field="id" where="{role: 'salesPerson'}" label="Salesperson" - vn-acl="salesAssistant"> + vn-acl="salesAssistant" + on-change="$ctrl.updatePortfolio()">