added templates list in dialog

This commit is contained in:
Edi Cziszter 2022-01-31 13:59:19 +02:00
parent a9994cec8a
commit 1dd11dbe97
5 changed files with 22 additions and 6 deletions

View File

@ -18,6 +18,10 @@
{{ checkbox.label }}
</mat-checkbox>
</ng-container>
<ul class="templates-container flex">
<li *ngFor="let template of data.templates" class="small-label">{{ template.fileName }}</li>
</ul>
</div>
<div class="dialog-actions">

View File

@ -15,3 +15,13 @@ mat-checkbox {
margin-bottom: 6px;
}
}
.templates-container {
padding: 0 45px;
margin-top: 0;
flex-direction: column;
li {
margin: 5px 0;
}
}

View File

@ -1,5 +1,5 @@
import { Component, Inject } from '@angular/core';
import { DossierAttributeConfig, FileAttributeConfig } from '@red/domain';
import { DossierAttributeConfig, FileAttributeConfig, IReportTemplate } from '@red/domain';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { TranslateService } from '@ngx-translate/core';
@ -13,7 +13,7 @@ interface CheckBox {
interface DialogData {
attribute: FileAttributeConfig | DossierAttributeConfig;
count: number;
templates: IReportTemplate[];
}
@Component({
@ -35,10 +35,12 @@ export class ConfirmDeleteAttributeDialogComponent {
get checkBoxConfig(): CheckBox[] {
const checkBoxes = isFileAttributeConfig(this.data.attribute) ? this._fileAttributeCheckboxes : this._dossierAttributeCheckboxes;
if (this.data.count !== 0) {
if (this.data.templates.length !== 0) {
checkBoxes.push({
value: false,
label: this._translateService.instant('confirm-delete-file-attribute.impacted-report', { count: this.data.count }),
label: this._translateService.instant('confirm-delete-file-attribute.impacted-report', {
count: this.data.templates.length,
}),
});
}

View File

@ -61,7 +61,7 @@ export class DossierAttributesListingScreenComponent extends ListingComponent<Do
this._reportTemplateService.getTemplatesByPlaceholder(dossierTemplateId, dossierAttribute.placeholder),
);
this._dialogService.openDialog('deleteAttribute', $event, { attribute: dossierAttribute, count: resp.length }, async () => {
this._dialogService.openDialog('deleteAttribute', $event, { attribute: dossierAttribute, templates: resp }, async () => {
this._loadingService.start();
const ids = dossierAttribute ? [dossierAttribute.id] : this.listingService.selected.map(item => item.id);
await firstValueFrom(this._dossierAttributesService.delete(ids));

View File

@ -96,7 +96,7 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
this._reportTemplateService.getTemplatesByPlaceholder(dossierTemplateId, fileAttribute.placeholder),
);
this._dialogService.openDialog('deleteAttribute', $event, { attribute: fileAttribute, count: resp.length }, async () => {
this._dialogService.openDialog('deleteAttribute', $event, { attribute: fileAttribute, templates: resp }, async () => {
this._loadingService.start();
if (fileAttribute) {
await firstValueFrom(this._fileAttributesService.deleteFileAttributes([fileAttribute.id], dossierTemplateId));