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",
"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"
},

View File

@ -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: '<'

View File

@ -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()', () => {

View File

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

View File

@ -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`
}
};

View File

@ -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'});