RED-7138 fix download options

This commit is contained in:
Dan Percic 2023-07-18 15:30:27 +03:00
parent 6d0d270feb
commit 1d914e495a
8 changed files with 43 additions and 14 deletions

View File

@ -56,6 +56,7 @@ import { AuditInfoDialogComponent } from './dialogs/audit-info-dialog/audit-info
import { DossierTemplateActionsComponent } from './shared/components/dossier-template-actions/dossier-template-actions.component';
import { IqserUsersModule } from '@iqser/common-ui/lib/users';
import { TenantPipe } from '@iqser/common-ui/lib/tenants';
import { SelectComponent } from '@shared/components/select/select.component';
const dialogs = [
AddEditCloneDossierTemplateDialogComponent,
@ -123,6 +124,7 @@ const components = [
IqserAllowDirective,
IqserDenyDirective,
TenantPipe,
SelectComponent,
],
})
export class AdminModule {}

View File

@ -28,6 +28,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { DossiersListingActionsComponent } from './components/dossiers-listing-actions/dossiers-listing-actions.component';
import { IqserUsersModule } from '@iqser/common-ui/lib/users';
import { SideNavComponent, SmallChipComponent, StatusBarComponent } from '@iqser/common-ui/lib/shared';
import { SelectComponent } from '@shared/components/select/select.component';
const components = [
FileActionsComponent,
@ -65,6 +66,7 @@ const dialogs = [EditDossierDialogComponent, AssignReviewerApproverDialogCompone
DynamicInputComponent,
IqserAllowDirective,
IqserDenyDirective,
SelectComponent,
],
})
export class SharedDossiersModule {}

View File

@ -39,7 +39,7 @@ export class FileDownloadBtnComponent implements OnChanges {
}
async downloadFiles() {
const ref = this._dialog.open(DownloadDialogComponent, {
const ref = this._dialog.openDefault(DownloadDialogComponent, {
data: { dossier: this.dossier, files: this.files },
});
const result = await ref.result();

View File

@ -79,7 +79,7 @@ export class ExpandableFileActionsComponent implements OnChanges {
}
async #downloadFiles(files: File[], dossier: Dossier) {
const ref = this._dialog.open(DownloadDialogComponent, {
const ref = this._dialog.openDefault(DownloadDialogComponent, {
data: { dossier, files },
});
const result = await ref.result();

View File

@ -1,11 +1,16 @@
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, HostBinding, Input, TemplateRef, ViewChild } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { MatChipListbox, MatChipSelectionChange } from '@angular/material/chips';
import { MatChipListbox, MatChipSelectionChange, MatChipsModule } from '@angular/material/chips';
import { StopPropagationDirective } from '@iqser/common-ui';
import { NgForOf, NgTemplateOutlet } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { MatIconModule } from '@angular/material/icon';
@Component({
selector: 'redaction-select',
templateUrl: './select.component.html',
styleUrls: ['./select.component.scss'],
standalone: true,
providers: [
{
provide: NG_VALUE_ACCESSOR,
@ -13,16 +18,17 @@ import { MatChipListbox, MatChipSelectionChange } from '@angular/material/chips'
multi: true,
},
],
imports: [StopPropagationDirective, NgTemplateOutlet, TranslateModule, NgForOf, MatChipsModule, MatIconModule],
})
export class SelectComponent implements AfterViewInit, ControlValueAccessor {
private _value: any[] = [];
private _onChange: (value: any[]) => void;
@Input() optionTemplate?: TemplateRef<{ option: any }>;
@Input() label: string;
@Input() options: any[];
@Input() disabled = false;
@Input() multiple = true;
@ViewChild(MatChipListbox) chipList: MatChipListbox;
private _value: any[] = [];
private _onChange: (value: any[]) => void;
constructor(private readonly _changeDetector: ChangeDetectorRef, private readonly _elementRef: ElementRef) {}

View File

@ -2,12 +2,17 @@ import { Component, inject } from '@angular/core';
import { Dossier, DownloadFileType, DownloadFileTypes, File, IReportTemplate, WorkflowFileStatuses } from '@red/domain';
import { downloadTypesForDownloadTranslations } from '@translations/download-types-translations';
import { ReportTemplateService } from '@services/report-template.service';
import { AbstractControl, FormBuilder } from '@angular/forms';
import { AbstractControl, FormBuilder, ReactiveFormsModule } from '@angular/forms';
import { DefaultColorsService } from '@services/entity-services/default-colors.service';
import { IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui';
import { CircleButtonComponent, IconButtonComponent, IconButtonTypes, IqserDenyDirective, IqserDialogComponent } from '@iqser/common-ui';
import { Roles } from '@users/roles';
import { List } from '@iqser/common-ui/lib/utils';
import { NGXLogger } from 'ngx-logger';
import { AsyncPipe, NgIf } from '@angular/common';
import { SelectComponent } from '@shared/components/select/select.component';
import { TranslateModule } from '@ngx-translate/core';
import { ColorPickerModule } from 'ngx-color-picker';
import { MatIconModule } from '@angular/material/icon';
export interface DownloadDialogData {
readonly dossier: Dossier;
@ -23,14 +28,27 @@ export interface DownloadDialogResult {
@Component({
templateUrl: './download-dialog.component.html',
styleUrls: ['./download-dialog.component.scss'],
standalone: true,
imports: [
NgIf,
ReactiveFormsModule,
SelectComponent,
TranslateModule,
IqserDenyDirective,
ColorPickerModule,
MatIconModule,
IconButtonComponent,
CircleButtonComponent,
AsyncPipe,
],
})
export class DownloadDialogComponent extends IqserDialogComponent<DownloadDialogComponent, DownloadDialogData, DownloadDialogResult> {
readonly #logger = inject(NGXLogger);
readonly iconButtonTypes = IconButtonTypes;
readonly downloadTypes: { key: DownloadFileType; label: string }[] = this.#formDownloadTypes;
readonly hasApprovedFiles: boolean;
readonly downloadTypes: { key: DownloadFileType; label: string }[];
readonly availableReportTypes = this.#availableReportTypes;
readonly form = this.#getForm();
readonly hasApprovedFiles = this.data.files.some(file => file.workflowStatus === WorkflowFileStatuses.APPROVED);
initialFormValue = this.form.getRawValue();
readonly roles = Roles;
@ -41,6 +59,8 @@ export class DownloadDialogComponent extends IqserDialogComponent<DownloadDialog
private readonly _formBuilder: FormBuilder,
) {
super();
this.hasApprovedFiles = this.data.files.some(file => file.workflowStatus === WorkflowFileStatuses.APPROVED);
this.downloadTypes = this.#formDownloadTypes;
}
get reportTypesLength() {

View File

@ -17,7 +17,6 @@ import {
IqserHelpModeModule,
StopPropagationDirective,
} from '@iqser/common-ui';
import { SelectComponent } from './components/select/select.component';
import { NavigateLastDossiersScreenDirective } from './directives/navigate-last-dossiers-screen.directive';
import { DictionaryManagerComponent } from './components/dictionary-manager/dictionary-manager.component';
import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor';
@ -43,17 +42,16 @@ import { AddEditEntityComponent } from './components/add-edit-entity/add-edit-en
import { ColorPickerModule } from 'ngx-color-picker';
import { WatermarkSelectorComponent } from './components/dossier-watermark-selector/watermark-selector.component';
import { OcrProgressBarComponent } from './components/ocr-progress-bar/ocr-progress-bar.component';
import { DownloadDialogComponent } from './dialogs/download-dialog/download-dialog.component';
import { CustomDateAdapter } from '@shared/CustomDateAdapter';
import { IqserUsersModule } from '@iqser/common-ui/lib/users';
import { SmallChipComponent } from '@iqser/common-ui/lib/shared';
import { SelectComponent } from '@shared/components/select/select.component';
const buttons = [FileDownloadBtnComponent];
const components = [
PaginationComponent,
AnnotationIconComponent,
SelectComponent,
DictionaryManagerComponent,
AssignUserDropdownComponent,
TypeFilterComponent,
@ -82,7 +80,7 @@ const modules = [MatConfigModule, ScrollingModule, IconsModule, FormsModule, Rea
const deleteThisWhenAllComponentsAreStandalone = [DonutChartComponent];
@NgModule({
declarations: [...components, ...utils, EditorComponent, DownloadDialogComponent],
declarations: [...components, ...utils, EditorComponent],
imports: [
CommonModule,
...modules,
@ -99,6 +97,7 @@ const deleteThisWhenAllComponentsAreStandalone = [DonutChartComponent];
HasScrollbarDirective,
IqserAllowDirective,
IqserDenyDirective,
SelectComponent,
],
exports: [...modules, ...components, ...utils, ...deleteThisWhenAllComponentsAreStandalone],
providers: [

@ -1 +1 @@
Subproject commit ae52093b5d6a7f116f0c75bfae2674912dc7ff40
Subproject commit 699e74a867e53485844e8e5bcfc91ed1d2ff2d4f