diff --git a/client/ticket/routes.json b/client/ticket/routes.json index 8f88cea35..5328c8fc9 100644 --- a/client/ticket/routes.json +++ b/client/ticket/routes.json @@ -84,14 +84,8 @@ }, { "url" : "/package", - "abstract": true, "state": "ticket.card.package", - "component": "ui-view" - }, - { - "url": "/list", - "state": "ticket.card.package.list", - "component": "vn-ticket-package-list", + "component": "vn-ticket-package", "params": { "ticket": "$ctrl.ticket" }, diff --git a/client/ticket/src/package/list/package-list.html b/client/ticket/src/package/package.html similarity index 100% rename from client/ticket/src/package/list/package-list.html rename to client/ticket/src/package/package.html diff --git a/client/ticket/src/package/list/package-list.js b/client/ticket/src/package/package.js similarity index 93% rename from client/ticket/src/package/list/package-list.js rename to client/ticket/src/package/package.js index 0bf6903a2..6cb749517 100644 --- a/client/ticket/src/package/list/package-list.js +++ b/client/ticket/src/package/package.js @@ -1,4 +1,4 @@ -import ngModule from '../../module'; +import ngModule from '../module'; class Controller { @@ -64,8 +64,8 @@ class Controller { Controller.$inject = ['$http', '$scope']; -ngModule.component('vnTicketPackageList', { - template: require('./package-list.html'), +ngModule.component('vnTicketPackage', { + template: require('./package.html'), controller: Controller, bindings: { ticket: '<' diff --git a/client/ticket/src/package/list/package-list.spec.js b/client/ticket/src/package/package.spec.js similarity index 91% rename from client/ticket/src/package/list/package-list.spec.js rename to client/ticket/src/package/package.spec.js index f6c38cc49..b9b7c310a 100644 --- a/client/ticket/src/package/list/package-list.spec.js +++ b/client/ticket/src/package/package.spec.js @@ -1,7 +1,7 @@ -import './package-list.js'; +import './package.js'; describe('Ticket', () => { - describe('Component vnTicketPackageList', () => { + describe('Component vnTicketPackage', () => { let $componentController; let controller; let $httpBackend; @@ -19,7 +19,7 @@ describe('Ticket', () => { accept: function() {} } }; - controller = $componentController('vnTicketPackageList', {$scope: $scope}); + controller = $componentController('vnTicketPackage', {$scope: $scope}); })); describe('removePackage()', () => { diff --git a/client/ticket/src/ticket.js b/client/ticket/src/ticket.js index 5b70eaa06..78593d6f6 100644 --- a/client/ticket/src/ticket.js +++ b/client/ticket/src/ticket.js @@ -8,6 +8,6 @@ import './data/ticket-data'; import './note/ticket-observation'; import './expedition/ticket-expedition'; import './volume/ticket-volume'; -import './package/list/package-list'; +import './package/package'; import './sale/sale'; import './tracking/tracking'; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 9acf8b1fe..ad7aa9b8b 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -289,7 +289,7 @@ export default { submitNotesButton: `${components.vnSubmit}` }, ticketPackages: { - packagesButton: `${components.vnMenuItem}[ui-sref="ticket.card.package.list"]`, + packagesButton: `${components.vnMenuItem}[ui-sref="ticket.card.package"]`, firstPackageSelect: `${components.vnAutocomplete}[label="Package"] input` } }; diff --git a/services/ticket/common/models/ticketPackaging.js b/services/ticket/common/models/ticketPackaging.js index 55e13b494..610dca7ad 100644 --- a/services/ticket/common/models/ticketPackaging.js +++ b/services/ticket/common/models/ticketPackaging.js @@ -8,7 +8,7 @@ module.exports = function(Self) { }); function validateQuantity(quantity) { - return quantity != 0; + return !isNaN(quantity) && quantity != 0; } Self.validatesPresenceOf('packagingFk', {message: 'Package cannot be blank'});