RED-5330: fix report template no autoselect
This commit is contained in:
parent
a74829fc4f
commit
0328c9d020
@ -8,9 +8,10 @@
|
||||
|
||||
<div class="dialog-content">
|
||||
<redaction-select
|
||||
*ngIf="availableReportTypes | async as reportTypes"
|
||||
[label]="'report-type.label' | translate: { length: reportTypesLength }"
|
||||
[optionTemplate]="reportTemplateOptionTemplate"
|
||||
[options]="availableReportTypes"
|
||||
[options]="reportTypes"
|
||||
[valueMapper]="reportTemplateValueMapper"
|
||||
class="mb-16"
|
||||
formControlName="reportTemplateIds"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { Dossier, DownloadFileType, IReportTemplate } from '@red/domain';
|
||||
import { downloadTypesForDownloadTranslations } from '@translations/download-types-translations';
|
||||
import { ReportTemplateService } from '@services/report-template.service';
|
||||
@ -23,16 +23,14 @@ export interface DownloadDialogResult {
|
||||
templateUrl: './download-dialog.component.html',
|
||||
styleUrls: ['./download-dialog.component.scss'],
|
||||
})
|
||||
export class DownloadDialogComponent implements OnInit {
|
||||
export class DownloadDialogComponent {
|
||||
readonly downloadTypes: { key: DownloadFileType; label: string }[] = ['ORIGINAL', 'PREVIEW', 'DELTA_PREVIEW', 'REDACTED'].map(
|
||||
(type: DownloadFileType) => ({
|
||||
key: type,
|
||||
label: downloadTypesForDownloadTranslations[type],
|
||||
}),
|
||||
);
|
||||
|
||||
availableReportTypes: IReportTemplate[] = [];
|
||||
|
||||
readonly availableReportTypes = this._availableReportTypes;
|
||||
readonly form = this._getForm();
|
||||
|
||||
constructor(
|
||||
@ -51,10 +49,10 @@ export class DownloadDialogComponent implements OnInit {
|
||||
return this.form.controls.downloadFileTypes?.value?.length || 0;
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
private get _availableReportTypes() {
|
||||
const dossierTemplateId = this.data.dossier.dossierTemplateId;
|
||||
|
||||
this.availableReportTypes = (await this._reportTemplateController.getAvailableReportTemplates(dossierTemplateId)) || [];
|
||||
const result = this._reportTemplateController.getAvailableReportTemplates(dossierTemplateId);
|
||||
return result.then(values => values ?? []);
|
||||
}
|
||||
|
||||
reportTemplateValueMapper = (reportTemplate: IReportTemplate) => reportTemplate.templateId;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user