HOTFIX: 3009 - Unlock report button
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-07-02 14:35:24 +02:00
parent 4849355c9b
commit 35e3c8ce65
3 changed files with 20 additions and 1 deletions

View File

@ -22,7 +22,7 @@
<vn-card>
<section class="vn-pa-md">
<vn-tool-bar class="vn-mb-md">
<vn-button disabled="!model.userParams.landedFrom || !model.userParams.landedTo"
<vn-button disabled="!$ctrl.hasDateRange"
icon="picture_as_pdf"
ng-click="$ctrl.showReport()"
vn-tooltip="Open as PDF">

View File

@ -32,6 +32,14 @@ class Controller extends Section {
};
}
get hasDateRange() {
const userParams = this.$.model.userParams;
const hasLanded = userParams.landedFrom || userParams.landedTo;
const hasShipped = userParams.shippedFrom || userParams.shippedTo;
return hasLanded || hasShipped;
}
findDraggable($event) {
const target = $event.target;
const draggable = target.closest(this.draggableElement);

View File

@ -14,6 +14,17 @@ describe('Travel Component vnTravelExtraCommunity', () => {
controller.$.model.refresh = jest.fn();
}));
describe('hasDateRange()', () => {
it('should return truthy when shippedFrom or landedTo are set as userParams', () => {
const now = new Date();
controller.$.model.userParams = {shippedFrom: now, landedTo: now};
const result = controller.hasDateRange;
expect(result).toBeTruthy();
});
});
describe('findDraggable()', () => {
it('should find the draggable element', () => {
const draggable = document.createElement('a');