From 64bc64b63042a11281dbec14af514d71af2933f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Czy=C5=BC?= Date: Mon, 11 Dec 2023 19:56:19 +0100 Subject: [PATCH] Added 'Merge into single PDF' checkbox to the download form --- .../bulk-editor/bulk-editor.component.html | 6 ++++ .../bulk-editor/bulk-editor.component.ts | 35 +++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html index 9e65b7a77..37e816507 100644 --- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html +++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html @@ -126,6 +126,12 @@ Use formatted filename +
+ + +
diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts index 890cd9565..208c5d40b 100644 --- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts +++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -65,6 +65,7 @@ export class BulkEditorComponent downloadFileTypeArchive: new FormControl(true), downloadFileTypeOriginals: new FormControl(false), downloadUseFormatting: new FormControl(false), + downloadAsSingleFile: new FormControl(false), }) constructor( @@ -136,7 +137,11 @@ export class BulkEditorComponent .get('downloadFileTypeArchive') .valueChanges.pipe(takeUntil(this.unsubscribeNotifier)) .subscribe((newValue) => { - if (!newValue) { + if (newValue && this.downloadForm.get('downloadAsSingleFile').value) { + this.downloadForm + .get('downloadFileTypeOriginals') + .patchValue(false, { emitEvent: false }) + } else if (!newValue) { this.downloadForm .get('downloadFileTypeOriginals') .patchValue(true, { emitEvent: false }) @@ -146,12 +151,38 @@ export class BulkEditorComponent .get('downloadFileTypeOriginals') .valueChanges.pipe(takeUntil(this.unsubscribeNotifier)) .subscribe((newValue) => { - if (!newValue) { + if (newValue && this.downloadForm.get('downloadAsSingleFile').value) { + this.downloadForm + .get('downloadFileTypeArchive') + .patchValue(false, { emitEvent: false }) + } else if (!newValue) { this.downloadForm .get('downloadFileTypeArchive') .patchValue(true, { emitEvent: false }) } }) + this.downloadForm + .get('downloadAsSingleFile') + .valueChanges.pipe(takeUntil(this.unsubscribeNotifier)) + .subscribe((newValue) => { + if (newValue) { + this.downloadForm + .get('downloadUseFormatting') + .patchValue(false, { emitEvent: false }) + this.downloadForm.get('downloadUseFormatting').disable() + + if ( + this.downloadForm.get('downloadFileTypeArchive').value && + this.downloadForm.get('downloadFileTypeOriginals').value + ) { + this.downloadForm + .get('downloadFileTypeArchive') + .patchValue(false, { emitEvent: false }) + } + } else { + this.downloadForm.get('downloadUseFormatting').enable() + } + }) } ngOnDestroy(): void {