Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2162-print_pdf_puppeteer
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-07-06 13:06:46 +02:00
commit 11ae95daba
6 changed files with 35 additions and 21 deletions

View File

@ -7,7 +7,7 @@ describe('Component vnInputNumber', () => {
beforeEach(ngModule('vnCore')); beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject(($compile, $rootScope) => { beforeEach(angular.mock.inject(($compile, $rootScope) => {
$element = $compile(`<vn-input-number></vn-input-number>`)($rootScope); $element = $compile(`<vn-input-number ng-model="model" />`)($rootScope);
$ctrl = $element.controller('vnInputNumber'); $ctrl = $element.controller('vnInputNumber');
})); }));
@ -20,12 +20,10 @@ describe('Component vnInputNumber', () => {
$ctrl.field = -1; $ctrl.field = -1;
$ctrl.min = 0; $ctrl.min = 0;
// FIXME: Input validation doesn't work with Jest? expect($ctrl.shownError).toContain('Constraints not satisfied');
// expect($ctrl.shownError).toContain('Please select a value that is no less than 0');
expect($ctrl.shownError).toBeNull();
}); });
it(`should unset error property when value is upper than min`, () => { it(`should unset error property when value is greater than min`, () => {
$ctrl.field = 1; $ctrl.field = 1;
$ctrl.min = 0; $ctrl.min = 0;
@ -34,19 +32,16 @@ describe('Component vnInputNumber', () => {
}); });
describe('max() setter', () => { describe('max() setter', () => {
it(`should set error property when value is upper than max`, () => { it(`should set error property when value is greater than max`, () => {
$ctrl.field = 1; $ctrl.field = 1;
$ctrl.max = 0; $ctrl.max = 0;
// FIXME: Input validation doesn't work with Jest? expect($ctrl.shownError).toContain('Constraints not satisfied');
// expect($ctrl.shownError).toContain('Please select a value that is no more than 0');
expect($ctrl.shownError).toBeNull();
}); });
// FIXME: Input validation doesn't work with Jest?
it(`should unset error property when value is lower than max`, () => { it(`should unset error property when value is lower than max`, () => {
$ctrl.field = -1; $ctrl.field = -1;
$ctrl.min = 0; $ctrl.max = 0;
expect($ctrl.shownError).toBeNull(); expect($ctrl.shownError).toBeNull();
}); });
@ -54,14 +49,12 @@ describe('Component vnInputNumber', () => {
describe('step() setter', () => { describe('step() setter', () => {
it(`should increase value when add icon is clicked`, () => { it(`should increase value when add icon is clicked`, () => {
$ctrl.step = 1; $ctrl.input.step = 1;
$ctrl.field = 1; $ctrl.input.value = 0;
// FIXME: Doesn't work with Jest? $ctrl.stepUp();
// $ctrl.stepUp();
// $element[0].querySelector('vn-icon[icon=add]').click();
expect($ctrl.field).toBe(1); expect($ctrl.input.value).toBe('1');
}); });
}); });
}); });

View File

@ -94,7 +94,8 @@ ngModule.vnComponent('vnDescriptor', {
transclude: { transclude: {
btnOne: '?btnOne', btnOne: '?btnOne',
btnTwo: '?btnTwo', btnTwo: '?btnTwo',
btnThree: '?btnThree' btnThree: '?btnThree',
btnFour: '?btnFour'
} }
}); });

View File

@ -88,7 +88,7 @@ vn-descriptor-content {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 $spacing-md; padding: 0 $spacing-sm;
margin: 0 $spacing-sm; margin: 0 $spacing-sm;
& > vn-icon { & > vn-icon {

View File

@ -146,6 +146,20 @@
</vn-quick-link> </vn-quick-link>
</div> </div>
<div ng-transclude="btnTwo"> <div ng-transclude="btnTwo">
<vn-quick-link
tooltip="Client ticket list"
state="['ticket.index', {q: $ctrl.filter}]"
icon="icon-ticket">
</vn-quick-link>
</div>
<div ng-transclude="btnThree">
<vn-quick-link
tooltip="New order"
state="['order.create', {clientFk: $ctrl.ticket.clientFk}]"
icon="icon-basketadd">
</vn-quick-link>
</div>
<div ng-transclude="btnFour">
<vn-quick-link <vn-quick-link
ng-if="$ctrl.ticket.stowaway" ng-if="$ctrl.ticket.stowaway"
tooltip="Ship stowaways" tooltip="Ship stowaways"
@ -153,7 +167,7 @@
icon="icon-stowaway"> icon="icon-stowaway">
</vn-quick-link> </vn-quick-link>
</div> </div>
<div ng-transclude="btnThree"> <div ng-transclude="btnFour">
<vn-quick-link <vn-quick-link
ng-if="$ctrl.ticket.ship" ng-if="$ctrl.ticket.ship"
tooltip="Stowaway" tooltip="Stowaway"

View File

@ -38,6 +38,12 @@ class Controller extends Descriptor {
return this.ticket.stowaway || this.ticket.ship; return this.ticket.stowaway || this.ticket.ship;
} }
get filter() {
if (this.ticket)
return JSON.stringify({clientFk: this.ticket.clientFk});
return null;
}
isTicketEditable() { isTicketEditable() {
this.$http.get(`Tickets/${this.$state.params.id}/isEditable`).then(res => { this.$http.get(`Tickets/${this.$state.params.id}/isEditable`).then(res => {
this.isEditable = res.data; this.isEditable = res.data;

View File

@ -11,5 +11,5 @@ clientSignature: Firma del cliente
claim: Reclamación {0} claim: Reclamación {0}
sections: sections:
agency: agency:
description: 'Para agilizar tu recogida, por favor, pónte en contacto con la oficina description: 'Para agilizar su recogida, por favor, póngase en contacto con la oficina
de integrados. <br/> Tlf: 96 166 77 88 - Ana Gómez (Ext. 2113) <em>(agomezf@integra2.es)</em>' de integrados. <br/> Tlf: 96 166 77 88 - Ana Gómez (Ext. 2113) <em>(agomezf@integra2.es)</em>'