Quantity validation on ticket packaging

This commit is contained in:
Joan Sanchez 2018-03-21 14:54:12 +01:00
parent ff047559e3
commit 7aeed467e9
7 changed files with 10 additions and 16 deletions

View File

@ -60,14 +60,8 @@
}, },
{ {
"url" : "/package", "url" : "/package",
"abstract": true,
"state": "ticket.card.package", "state": "ticket.card.package",
"component": "ui-view" "component": "vn-ticket-package",
},
{
"url": "/list",
"state": "ticket.card.package.list",
"component": "vn-ticket-package-list",
"params": { "params": {
"ticket": "$ctrl.ticket" "ticket": "$ctrl.ticket"
}, },

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
@ -64,8 +64,8 @@ class Controller {
Controller.$inject = ['$http', '$scope']; Controller.$inject = ['$http', '$scope'];
ngModule.component('vnTicketPackageList', { ngModule.component('vnTicketPackage', {
template: require('./package-list.html'), template: require('./package.html'),
controller: Controller, controller: Controller,
bindings: { bindings: {
ticket: '<' ticket: '<'

View File

@ -1,7 +1,7 @@
import './package-list.js'; import './package.js';
describe('Ticket', () => { describe('Ticket', () => {
describe('Component vnTicketPackageList', () => { describe('Component vnTicketPackage', () => {
let $componentController; let $componentController;
let controller; let controller;
let $httpBackend; let $httpBackend;
@ -19,7 +19,7 @@ describe('Ticket', () => {
accept: function() {} accept: function() {}
} }
}; };
controller = $componentController('vnTicketPackageList', {$scope: $scope}); controller = $componentController('vnTicketPackage', {$scope: $scope});
})); }));
describe('removePackage()', () => { describe('removePackage()', () => {

View File

@ -6,6 +6,6 @@ import './card/ticket-card';
import './summary/ticket-summary'; import './summary/ticket-summary';
import './data/ticket-data'; import './data/ticket-data';
import './notes/ticket-observations'; import './notes/ticket-observations';
import './package/list/package-list'; import './package/package';
import './sale/sale'; import './sale/sale';
import './review/review'; import './review/review';

View File

@ -289,7 +289,7 @@ export default {
submitNotesButton: `${components.vnSubmit}` submitNotesButton: `${components.vnSubmit}`
}, },
ticketPackages: { ticketPackages: {
packagesButton: `${components.vnMenuItem}[ui-sref="ticket.card.package.list"]`, packagesButton: `${components.vnMenuItem}[ui-sref="ticket.card.package"]`,
firstPackageSelect: `${components.vnAutocomplete}[label="Package"] input` firstPackageSelect: `${components.vnAutocomplete}[label="Package"] input`
} }
}; };

View File

@ -8,7 +8,7 @@ module.exports = function(Self) {
}); });
function validateQuantity(quantity) { function validateQuantity(quantity) {
return quantity != 0; return !isNaN(quantity) && quantity != 0;
} }
Self.validatesPresenceOf('packagingFk', {message: 'Package cannot be blank'}); Self.validatesPresenceOf('packagingFk', {message: 'Package cannot be blank'});