diff --git a/client/client/src/credit-insurance/index/index.html b/client/client/src/credit-insurance/index/index.html index b285d3629..9a56ec1a8 100644 --- a/client/client/src/credit-insurance/index/index.html +++ b/client/client/src/credit-insurance/index/index.html @@ -34,7 +34,7 @@ - + diff --git a/client/client/src/credit-insurance/index/locale/es.yml b/client/client/src/credit-insurance/index/locale/es.yml index 731fe3c2a..1262a5dd4 100644 --- a/client/client/src/credit-insurance/index/locale/es.yml +++ b/client/client/src/credit-insurance/index/locale/es.yml @@ -2,5 +2,6 @@ Contract credit insurance: Contratos de seguro de crédito New contract: Nuevo contrato Close contract: Cerrar contrato Edit contract: Modificar contrato -List classifications: Ver clasificaciones -Are you sure you want to close this contract?: ¿Seguro que quieres cerrar este contrato? \ No newline at end of file +View credits: Ver créditos +Are you sure you want to close this contract?: ¿Seguro que quieres cerrar este contrato? +Grade: Grado \ No newline at end of file diff --git a/client/client/src/credit-insurance/insurance/create/index.html b/client/client/src/credit-insurance/insurance/create/index.html index 49aae53ae..77465eb91 100644 --- a/client/client/src/credit-insurance/insurance/create/index.html +++ b/client/client/src/credit-insurance/insurance/create/index.html @@ -8,7 +8,7 @@
- New classification + New credit + \ No newline at end of file diff --git a/client/client/src/credit-insurance/insurance/create/index.js b/client/client/src/credit-insurance/insurance/create/index.js index 43cb1ccce..51feab0f5 100644 --- a/client/client/src/credit-insurance/insurance/create/index.js +++ b/client/client/src/credit-insurance/insurance/create/index.js @@ -1,15 +1,14 @@ import ngModule from '../../../module'; class Controller { - constructor($state, $filter) { + constructor($filter) { this.insurance = { created: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm') }; - this.classificationId = $state.params.classificationId; } } -Controller.$inject = ['$state', '$filter']; +Controller.$inject = ['$filter']; ngModule.component('vnClientCreditInsuranceInsuranceCreate', { template: require('./index.html'), diff --git a/client/client/src/credit-insurance/insurance/create/locale/es.yml b/client/client/src/credit-insurance/insurance/create/locale/es.yml index be5810643..4c9b75dea 100644 --- a/client/client/src/credit-insurance/insurance/create/locale/es.yml +++ b/client/client/src/credit-insurance/insurance/create/locale/es.yml @@ -1 +1 @@ -New classification: Nueva clasificación \ No newline at end of file +New credit: Nuevo crédito \ No newline at end of file diff --git a/client/client/src/credit-insurance/insurance/index/index.html b/client/client/src/credit-insurance/insurance/index/index.html index 9380b4303..b5c42326a 100644 --- a/client/client/src/credit-insurance/insurance/index/index.html +++ b/client/client/src/credit-insurance/insurance/index/index.html @@ -1,31 +1,38 @@ - + Requested credits - - - - - - - - {{::insurance.credit}} - {{::insurance.grade}} - {{::insurance.created | date: 'dd/MM/yyyy'}} - - - No results - + + + + + + + + + + + + + + + + + + +
CreditGradeCreated
{{::insurance.credit | currency: '€': 2}}{{::insurance.grade}}{{::insurance.created | date: 'dd/MM/yyyy'}}
No results
+ + + -
+ fixed-bottom-right vn-tooltip="New credit" vn-bind="+" ng-if="!$ctrl.isClosed"> \ No newline at end of file diff --git a/client/client/src/locale/es.yml b/client/client/src/locale/es.yml index d6e498802..79af548b1 100644 --- a/client/client/src/locale/es.yml +++ b/client/client/src/locale/es.yml @@ -21,3 +21,4 @@ Credit contracts: Contratos de crédito Verified data: Datos comprobados Mandate: Mandato Amount: Importe +Back: Volver \ No newline at end of file diff --git a/client/core/src/components/card/card.html b/client/core/src/components/card/card.html index e608d6fa9..7c89b545c 100644 --- a/client/core/src/components/card/card.html +++ b/client/core/src/components/card/card.html @@ -1 +1 @@ -
+
diff --git a/client/core/src/components/card/card.js b/client/core/src/components/card/card.js index 12df8da7d..405a67694 100644 --- a/client/core/src/components/card/card.js +++ b/client/core/src/components/card/card.js @@ -7,8 +7,12 @@ export default function directive(vnTemplate) { restrict: 'E', transclude: true, template: require('./card.html'), - link: function(_, $element) { + link: function($scope, $element, $attrs, $ctrl, $transclude) { $element.addClass('demo-card-wide mdl-shadow--2dp bg-panel'); + + $transclude($scope, function(clone) { + angular.element($element[0].querySelector('div')).append(clone); + }); } }; } diff --git a/client/core/src/components/dialog/dialog.js b/client/core/src/components/dialog/dialog.js index 401a13e11..c2e208509 100644 --- a/client/core/src/components/dialog/dialog.js +++ b/client/core/src/components/dialog/dialog.js @@ -9,18 +9,18 @@ import './style.scss'; * @property {HTMLElement} buttons The dialog HTML buttons */ export default class Dialog extends Component { - constructor($element, $transclude) { - super($element); + constructor($element, $scope, $transclude) { + super($element, $scope); this.shown = false; this.$element.addClass('vn-dialog'); this.element.addEventListener('mousedown', e => this.onBackgroundMouseDown(e)); if ($transclude) { - $transclude(tClone => { + $transclude($scope.$parent, tClone => { this.body = tClone[0]; }, null, 'body'); - $transclude(tClone => { + $transclude($scope.$parent, tClone => { this.buttons = tClone[0]; }, null, 'buttons'); } @@ -104,7 +104,7 @@ export default class Dialog extends Component { clearTimeout(this.transitionTimeout); } } -Dialog.$inject = ['$element', '$transclude']; +Dialog.$inject = ['$element', '$scope', '$transclude']; ngModule.component('vnDialog', { template: require('./dialog.html'), diff --git a/client/ticket/src/data/step-one/index.js b/client/ticket/src/data/step-one/index.js index 612e8f38c..7e96eb40a 100644 --- a/client/ticket/src/data/step-one/index.js +++ b/client/ticket/src/data/step-one/index.js @@ -33,7 +33,8 @@ class Controller { let data = { landed: toJsonDate(this.ticket.landed), addressFk: this.ticket.addressFk, - agencyModeFk: this.ticket.agencyModeFk + agencyModeFk: this.ticket.agencyModeFk, + warehouseFk: this.ticket.warehouseFk }; return this.$http.post(query, data).then(res => { diff --git a/client/ticket/src/data/step-one/step-one.spec.js b/client/ticket/src/data/step-one/step-one.spec.js index 7054f78cb..625c90e90 100644 --- a/client/ticket/src/data/step-one/step-one.spec.js +++ b/client/ticket/src/data/step-one/step-one.spec.js @@ -26,6 +26,7 @@ describe('ticket', () => { addressFk: 121, agencyModeFk: 1, companyFk: 442, + warehouseFk: 1, shipped: new Date(), landed: new Date() }; @@ -46,6 +47,7 @@ describe('ticket', () => { addressFk: 121, agencyModeFk: 1, companyFk: 442, + warehouseFk: 1, shipped: new Date(), landed: landed }; diff --git a/client/ticket/src/data/step-three/index.html b/client/ticket/src/data/step-three/index.html index e3d762ded..bcd26b357 100644 --- a/client/ticket/src/data/step-three/index.html +++ b/client/ticket/src/data/step-three/index.html @@ -11,5 +11,12 @@ initial-data="$ctrl.ticket.option">
+ + + +
diff --git a/client/ticket/src/data/step-three/index.js b/client/ticket/src/data/step-three/index.js index f98aaa5bf..dcde1e838 100644 --- a/client/ticket/src/data/step-three/index.js +++ b/client/ticket/src/data/step-three/index.js @@ -15,6 +15,7 @@ class Controller { $onChanges() { this.ticket.option = 1; + this.ticket.hasToBeUnrouted = true; } onStepChange(state) { @@ -29,12 +30,14 @@ class Controller { let query = `/ticket/api/tickets/${this.ticket.id}/componentUpdate`; let data = { + clientFk: this.ticket.clientFk, agencyModeFk: this.ticket.agencyModeFk, addressFk: this.ticket.addressFk, warehouseFk: this.ticket.warehouseFk, shipped: this.ticket.shipped, landed: this.ticket.landed, isDeleted: this.ticket.isDeleted, + hasToBeUnrouted: this.ticket.hasToBeUnrouted, option: this.ticket.option }; diff --git a/client/ticket/src/data/step-three/locale/es.yml b/client/ticket/src/data/step-three/locale/es.yml index d2c21e5ef..f2b78c77f 100644 --- a/client/ticket/src/data/step-three/locale/es.yml +++ b/client/ticket/src/data/step-three/locale/es.yml @@ -1,3 +1,4 @@ Charge: Cargo Choose an option: Selecciona una opción -Charge difference to: Diferencia a cargo de \ No newline at end of file +Charge difference to: Diferencia a cargo de +Remove from route: Sacar de la ruta \ No newline at end of file diff --git a/services/client/common/methods/credit-insurance/filter.js b/services/client/common/methods/credit-insurance/filter.js deleted file mode 100644 index 033afae7a..000000000 --- a/services/client/common/methods/credit-insurance/filter.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = Self => { - Self.installMethod('filter', filterParams); - - function filterParams(params) { - return { - where: { - creditClassification: params.creditClassificationFk - }, - skip: (params.page - 1) * params.size, - limit: params.size, - order: params.order - }; - } -}; diff --git a/services/client/common/models/credit-insurance.js b/services/client/common/models/credit-insurance.js index 653c7e2fd..20a832ee2 100644 --- a/services/client/common/models/credit-insurance.js +++ b/services/client/common/models/credit-insurance.js @@ -1,6 +1,4 @@ module.exports = function(Self) { - require('../methods/credit-insurance/filter')(Self); - Self.validateCredit = function(credit) { return credit >= 0; }; @@ -20,6 +18,26 @@ module.exports = function(Self) { allowNull: true }); + async function validateNullGrade(err, done) { + let filter = { + fields: ['grade'], + where: { + creditClassification: this.creditClassification + }, + order: 'created DESC' + }; + let insurance = await Self.findOne(filter); + + if (insurance && (!insurance.grade && this.grade || insurance.grade && ! this.grade)) + err(); + + done(); + } + + Self.validateAsync('nullGrade', validateNullGrade, { + message: 'The grade must be similar to the last one' + }); + Self.messageSend = async function(data, accessToken) { let filter = { include: { diff --git a/services/db/install/changes/1.0.6/ticketComponentMakeUpdate.sql b/services/db/install/changes/1.0.6/ticketComponentMakeUpdate.sql new file mode 100644 index 000000000..272b4ab1b --- /dev/null +++ b/services/db/install/changes/1.0.6/ticketComponentMakeUpdate.sql @@ -0,0 +1,54 @@ +USE `vn`; +DROP procedure IF EXISTS `ticketComponentMakeUpdate`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentMakeUpdate`( + vTicketFk INT, + vClientFk INT, + vAgencyModeFk INT, + vAddressFk INT, + vWarehouseFk INT, + vShipped DATETIME, + vLanded DATE, + vIsDeleted BOOLEAN, + vHasToBeUnrouted BOOLEAN, + vOption INT) +BEGIN +/** + * Calcula los componentes de un ticket + * y los actualiza con los nuevos datos. + * + * @param vTicketFk Id del ticket + * @param vClientFk Id del cliente + * @param vAgencyModeFk Id del tipo de agencia + * @param vAddressFk Id del consignatario + * @param vWarehouseFk Id del almacén + * @param vShipped Fecha de salida + * @param vLanded Fecha de llegada + * @param vIsDeleted Marcado como eliminado + * @param vHasToBeUnrouted Marcado para sacar de ruta + * @param vOption Id de la acción ticketUpdateAction + */ + + CALL vn.ticketComponentPreview (vTicketFk, vLanded, vAddressFk, vAgencyModeFk, vWarehouseFk); + CALL vn.ticketComponentUpdate ( + vTicketFk, + vClientFk, + vAgencyModeFk, + vAddressFk, + vWarehouseFk, + vShipped, + vLanded, + vIsDeleted, + vHasToBeUnrouted, + vOption + ); + + DROP TEMPORARY TABLE + tmp.ticketComponent, + tmp.ticketComponentPrice; +END$$ + +DELIMITER ; + diff --git a/services/db/install/changes/1.0.6/ticketComponentPreview.sql b/services/db/install/changes/1.0.6/ticketComponentPreview.sql new file mode 100644 index 000000000..bcabd4552 --- /dev/null +++ b/services/db/install/changes/1.0.6/ticketComponentPreview.sql @@ -0,0 +1,74 @@ +USE `vn`; +DROP procedure IF EXISTS `ticketComponentPreview`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentPreview`( + vTicketFk INT, + vDate DATE, + vAddressFk INT, + vAgencyModeFk INT, + vWarehouseFk SMALLINT) +BEGIN +/** + * Devuelve un listado previo de + * componentes para un ticket + * + * @param vTicketFk Id del ticket + * @param vDate Fecha de envío + * @param vAddressFk Id del consignatario + * @param vAgencyModeFk Id del modo de agencia + * @param vWarehouseFk Id del almacén + */ + DECLARE vAgencyFk INT; + DECLARE vShipped DATE; + DECLARE vBuyOrderItem INT DEFAULT 100; + + SELECT agencyFk INTO vAgencyFk + FROM agencyMode + WHERE id = vAgencyModeFk; + + CALL agencyHourOffer(vDate, vAddressFk, vAgencyFk); + + SELECT shipped INTO vShipped + FROM tmp.agencyHourOffer + WHERE warehouseFk = vWarehouseFK; + + CALL buyUltimate(vWarehouseFK, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY ( + SELECT + vWarehouseFK AS warehouseFk, + NULL AS available, + s.itemFk, + bu.buyFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketFk + AND s.itemFk != vBuyOrderItem + GROUP BY bu.warehouseFk, bu.itemFk); + + CALL ticketComponentCalculate(vAddressFk, vAgencyModeFk); + + REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) + SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value + FROM saleComponent sc + JOIN sale s ON s.id = sc.saleFk + JOIN ticket t ON t.id = s.ticketFk + JOIN componentRate cr ON cr.id = sc.componentFk + WHERE s.ticketFk = vTicketFk AND NOT cr.isRenewable; + + SET @shipped = vShipped; + + DROP TEMPORARY TABLE + tmp.agencyHourOffer, + tmp.buyUltimate, + tmp.ticketLot; + + IF IFNULL(vShipped, CURDATE() - 1) < CURDATE() THEN + CALL util.throw('NO_AGENCY_AVAILABLE'); + END IF; +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/services/db/install/changes/1.0.6/ticketComponentPriceDifference.sql b/services/db/install/changes/1.0.6/ticketComponentPriceDifference.sql new file mode 100644 index 000000000..849efea3e --- /dev/null +++ b/services/db/install/changes/1.0.6/ticketComponentPriceDifference.sql @@ -0,0 +1,55 @@ +USE `vn`; +DROP procedure IF EXISTS `ticketComponentPriceDifference`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentPriceDifference`( + vTicketFk INT, + vDate DATE, + vAddressFk INT, + vAgencyModeFk INT, + vWarehouseFk INT) +BEGIN +/** + * Devuelve las diferencias de precio + * de los movimientos de un ticket. + * + * @param vTicketFk Id del ticket + * @param vDate Fecha de envío + * @param vAddressFk Id del consignatario + * @param vAgencyModeFk Id del modo de agencia + * @param vWarehouseFk Id del almacén + */ + CALL vn.ticketComponentPreview(vTicketFk, vDate, vAddressFk, vAgencyModeFk, vWarehouseFk); + + SELECT + s.itemFk, + i.name, + i.size, + i.category, + IFNULL(s.quantity, 0) AS quantity, + IFNULL(s.price, 0) AS price, + ROUND(SUM(tc.cost), 4) AS newPrice, + s.quantity * (s.price - ROUND(SUM(cost), 4)) difference, + s.id AS saleFk + FROM sale s + JOIN item i ON i.id = s.itemFk + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk + AND tc.warehouseFk = t.warehouseFk + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk = tc.componentFk + LEFT JOIN componentRate cr ON cr.id = tc.componentFk + WHERE + t.id = vTicketFk + AND IF(sc.componentFk IS NULL + AND cr.classRate IS NOT NULL, FALSE, TRUE) + GROUP BY s.id ORDER BY s.id; + + DROP TEMPORARY TABLE + tmp.ticketComponent, + tmp.ticketComponentPrice; +END$$ + +DELIMITER ; + diff --git a/services/db/install/changes/1.0.6/ticketComponentUpdate.sql b/services/db/install/changes/1.0.6/ticketComponentUpdate.sql new file mode 100644 index 000000000..3306be405 --- /dev/null +++ b/services/db/install/changes/1.0.6/ticketComponentUpdate.sql @@ -0,0 +1,74 @@ +USE `vn`; +DROP procedure IF EXISTS `ticketComponentUpdate`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentUpdate`( + vTicketFk INT, + vClientFk INT, + vAgencyModeFk INT, + vAddressFk INT, + vWarehouseFk INT, + vShipped DATETIME, + vLanded DATE, + vIsDeleted BOOLEAN, + vHasToBeUnrouted BOOLEAN, + vOption INT) +BEGIN +/** + * Actualiza un ticket y sus componentes + * con los nuevos datos. + * + * @param vTicketFk Id del ticket + * @param vClientFk Id del cliente + * @param vAgencyModeFk Id del tipo de agencia + * @param vAddressFk Id del consignatario + * @param vWarehouseFk Id del almacén + * @param vShipped Fecha de salida + * @param vLanded Fecha de llegada + * @param vIsDeleted Marcado como eliminado + * @param vHasToBeUnrouted Marcado para sacar de ruta + * @param vOption Id de la acción ticketUpdateAction + */ + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + UPDATE ticket t + SET + t.clientFk = vClientFk, + t.agencyModeFk = vAgencyModeFk, + t.addressFk = vAddressFk, + t.warehouseFk = vWarehouseFk, + t.landed = vLanded, + t.shipped = vShipped, + t.isDeleted = vIsDeleted + WHERE + t.id = vTicketFk; + + IF vHasToBeUnrouted THEN + UPDATE ticket t SET t.routeFk = NULL + WHERE t.id = vTicketFk; + END IF; + + IF vOption <> 8 THEN + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) + ENGINE = MEMORY + SELECT id AS saleFk, vWarehouseFk warehouseFk + FROM sale s WHERE s.ticketFk = vTicketFk; + + CALL ticketComponentUpdateSale (vOption); + + DROP TEMPORARY TABLE tmp.sale; + END IF; + COMMIT; +END$$ + +DELIMITER ; + diff --git a/services/loopback/common/locale/es.json b/services/loopback/common/locale/es.json index 8228e1b1e..bc335c45b 100644 --- a/services/loopback/common/locale/es.json +++ b/services/loopback/common/locale/es.json @@ -20,5 +20,7 @@ "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado", "can't be blank": "El campo no puede estar vacío", "Observation type cannot be blank": "El tipo de observación no puede estar en blanco", - "Observation type must be unique": "El tipo de observación no puede repetirse" + "Observation type must be unique": "El tipo de observación no puede repetirse", + "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", + "The grade must be similar to the last one": "El grado debe ser similar al último crédito" } \ No newline at end of file diff --git a/services/loopback/common/methods/sale/priceDifference.js b/services/loopback/common/methods/sale/priceDifference.js index 707bef883..ac6d9d639 100644 --- a/services/loopback/common/methods/sale/priceDifference.js +++ b/services/loopback/common/methods/sale/priceDifference.js @@ -57,8 +57,14 @@ module.exports = Self => { salesObj.totalNewPrice = 0.00; salesObj.totalDifference = 0.00; - let query = `CALL vn.ticketComponentPriceDifference(?, ?, ?, ?)`; - let [differences] = await Self.rawSql(query, [data.landed, data.addressFk, data.agencyModeFk, ticketFk]); + let query = `CALL vn.ticketComponentPriceDifference(?, ?, ?, ?, ?)`; + let [differences] = await Self.rawSql(query, [ + ticketFk, + data.landed, + data.addressFk, + data.agencyModeFk, + data.warehouseFk + ]); salesObj.items.forEach(sale => { differences.forEach(difference => { diff --git a/services/loopback/common/methods/sale/specs/priceDifference.spec.js b/services/loopback/common/methods/sale/specs/priceDifference.spec.js index 387a8da56..bf65a8de6 100644 --- a/services/loopback/common/methods/sale/specs/priceDifference.spec.js +++ b/services/loopback/common/methods/sale/specs/priceDifference.spec.js @@ -5,7 +5,8 @@ describe('sale priceDifference()', () => { let data = { landed: Date.now(), addressFk: 121, - agencyModeFk: 1 + agencyModeFk: 1, + warehouseFk: 1 }; app.models.Sale.priceDifference(1, data) .catch(response => { diff --git a/services/loopback/common/methods/ticket/componentUpdate.js b/services/loopback/common/methods/ticket/componentUpdate.js index 1bb2a96f4..712bd47ae 100644 --- a/services/loopback/common/methods/ticket/componentUpdate.js +++ b/services/loopback/common/methods/ticket/componentUpdate.js @@ -12,8 +12,14 @@ module.exports = Self => { arg: 'data', type: 'Object', required: true, - description: 'landed, addressFk, agencyModeFk', + description: 'landed, addressFk, agencyModeFk, warehouseFk', http: {source: 'body'} + }, { + arg: 'context', + type: 'object', + http: function(ctx) { + return ctx; + } }], returns: { type: ['Object'], @@ -25,16 +31,24 @@ module.exports = Self => { } }); - Self.componentUpdate = async(ticketFk, data) => { - let query = 'CALL vn.ticketComponentMakeUpdate(?, ?, ?, ?, ?, ?, ?, ?)'; + Self.componentUpdate = async(ticketFk, data, ctx) => { + let userId = ctx.req.accessToken.userId; + let hasDeliveryRole = await Self.app.models.Account.hasRole(userId, 'delivery'); + + if (!hasDeliveryRole) + data.hasToBeUnrouted = true; + + let query = 'CALL vn.ticketComponentMakeUpdate(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; let res = await Self.rawSql(query, [ ticketFk, + data.clientFk, data.agencyModeFk, data.addressFk, data.warehouseFk, data.shipped, data.landed, data.isDeleted, + data.hasToBeUnrouted, data.option ]); return res; diff --git a/services/loopback/common/methods/ticket/specs/componentUpdate.spec.js b/services/loopback/common/methods/ticket/specs/componentUpdate.spec.js index bcef7e79a..fa096763f 100644 --- a/services/loopback/common/methods/ticket/specs/componentUpdate.spec.js +++ b/services/loopback/common/methods/ticket/specs/componentUpdate.spec.js @@ -8,9 +8,11 @@ describe('ticket componentUpdate()', () => { warehouseFk: 1, shipped: Date.now(), landed: Date.now(), + hasToBeUnrouted: true, option: 1 }; - app.models.Ticket.componentUpdate(1, data) + let ctx = {req: {accessToken: {userId: 101}}}; + app.models.Ticket.componentUpdate(1, data, ctx) .catch(response => { expect(response).toEqual(new Error('ER_SIGNAL_EXCEPTION: NO_AGENCY_AVAILABLE')); done(); diff --git a/services/loopback/server/server.js b/services/loopback/server/server.js index 294500854..012dd21b7 100644 --- a/services/loopback/server/server.js +++ b/services/loopback/server/server.js @@ -75,7 +75,7 @@ function vnBoot(app, rootDir, rootModule) { let packageJson = require(`${rootDir}/../package.json`); let appName = packageJson.name; let baseUrl = app.get('url').replace(/\/$/, ''); - console.log(`Web server ${appName} listening at: %s`, baseUrl); + console.log(`Web server ${appName} listening at: %s`, `${baseUrl}/explorer`); } let args = port ? [port, onListen] : [onListen];