extended base dialog for 'change legal basis dialog' component
This commit is contained in:
parent
2683fff727
commit
f39c18a028
@ -95,7 +95,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button (click)="save()" [disabled]="!valid || !changed" color="primary" mat-flat-button>
|
||||
<button (click)="save()" [disabled]="disabled" color="primary" mat-flat-button>
|
||||
{{ 'add-edit-dictionary.save' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -28,7 +28,6 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
||||
name: this._data.dictionary?.label,
|
||||
});
|
||||
readonly hasColor$: Observable<boolean>;
|
||||
readonly disabled = false;
|
||||
private readonly _dossierTemplateId = this._data.dossierTemplateId;
|
||||
|
||||
constructor(
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button (click)="save()" [disabled]="!valid || !changed" color="primary" mat-flat-button>
|
||||
<button (click)="save()" [disabled]="disabled" color="primary" mat-flat-button>
|
||||
{{ 'add-edit-dossier-template.save' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -24,7 +24,6 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
|
||||
key: type,
|
||||
label: downloadTypesTranslations[type],
|
||||
}));
|
||||
readonly disabled = false;
|
||||
private _previousValidFrom: Moment;
|
||||
private _previousValidTo: Moment;
|
||||
private _lastValidFrom: Moment;
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<button (click)="save()" [disabled]="!valid || !changed" color="primary" mat-flat-button>
|
||||
<button (click)="save()" [disabled]="disabled" color="primary" mat-flat-button>
|
||||
{{ 'add-edit-file-attribute.save' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -13,7 +13,6 @@ import { BaseDialogComponent } from '../../../../../../../../libs/common-ui/src'
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AddEditFileAttributeDialogComponent extends BaseDialogComponent {
|
||||
readonly disabled = false;
|
||||
DISPLAYED_FILTERABLE_LIMIT = 3;
|
||||
translations = fileAttributeTypesTranslations;
|
||||
fileAttribute: IFileAttributeConfig = this.data.fileAttribute;
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button (click)="save()" [disabled]="!valid || !changed" color="primary" mat-flat-button>
|
||||
<button (click)="save()" [disabled]="disabled" color="primary" mat-flat-button>
|
||||
{{ 'edit-color-dialog.save' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -20,7 +20,6 @@ interface IEditColorData {
|
||||
})
|
||||
export class EditColorDialogComponent extends BaseDialogComponent {
|
||||
translations = defaultColorsTranslations;
|
||||
readonly disabled = false;
|
||||
private readonly _dossierTemplateId: string;
|
||||
|
||||
constructor(
|
||||
|
||||
@ -38,12 +38,12 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button [disabled]="!form.valid || !changed" color="primary" mat-flat-button type="submit">
|
||||
<button [disabled]="disabled" color="primary" mat-flat-button type="submit">
|
||||
{{ 'change-legal-basis-dialog.actions.save' | translate }}
|
||||
</button>
|
||||
<div class="all-caps-label cancel" mat-dialog-close translate="change-legal-basis-dialog.actions.cancel"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<iqser-circle-button class="dialog-close" icon="iqser:close" mat-dialog-close></iqser-circle-button>
|
||||
<iqser-circle-button class="dialog-close" icon="iqser:close" (action)="close()"></iqser-circle-button>
|
||||
</section>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject, Injector, OnInit } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
@ -6,6 +6,7 @@ import { PermissionsService } from '@services/permissions.service';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
import { Dossier } from '@red/domain';
|
||||
import { BaseDialogComponent } from '@iqser/common-ui';
|
||||
|
||||
export interface LegalBasisOption {
|
||||
label?: string;
|
||||
@ -16,8 +17,7 @@ export interface LegalBasisOption {
|
||||
@Component({
|
||||
templateUrl: './change-legal-basis-dialog.component.html',
|
||||
})
|
||||
export class ChangeLegalBasisDialogComponent implements OnInit {
|
||||
form: FormGroup = this._getForm();
|
||||
export class ChangeLegalBasisDialogComponent extends BaseDialogComponent implements OnInit {
|
||||
isDocumentAdmin: boolean;
|
||||
legalOptions: LegalBasisOption[] = [];
|
||||
|
||||
@ -26,16 +26,12 @@ export class ChangeLegalBasisDialogComponent implements OnInit {
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
readonly dialogRef: MatDialogRef<ChangeLegalBasisDialogComponent>,
|
||||
protected readonly _injector: Injector,
|
||||
protected readonly _dialogRef: MatDialogRef<ChangeLegalBasisDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) private readonly _data: { annotations: AnnotationWrapper[]; dossier: Dossier },
|
||||
) {}
|
||||
|
||||
get changed(): boolean {
|
||||
return (
|
||||
this.form.get('reason').value.legalBasis !== this._data.annotations[0].legalBasis ||
|
||||
this.form.get('section').value !== this._data.annotations[0].section ||
|
||||
this.form.get('classification').value !== this._data.annotations[0].value
|
||||
);
|
||||
) {
|
||||
super(_injector, _dialogRef);
|
||||
this.form = this._getForm();
|
||||
}
|
||||
|
||||
get allRectangles(): boolean {
|
||||
@ -43,6 +39,7 @@ export class ChangeLegalBasisDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
super.ngOnInit();
|
||||
const data = await this._justificationsService.getForDossierTemplate(this._data.dossier.dossierTemplateId).toPromise();
|
||||
|
||||
this.legalOptions = data
|
||||
@ -56,6 +53,7 @@ export class ChangeLegalBasisDialogComponent implements OnInit {
|
||||
this.form.patchValue({
|
||||
reason: this.legalOptions.find(option => option.legalBasis === this._data.annotations[0].legalBasis),
|
||||
});
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
}
|
||||
|
||||
private _getForm(): FormGroup {
|
||||
@ -69,7 +67,7 @@ export class ChangeLegalBasisDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
save() {
|
||||
this.dialogRef.close({
|
||||
this._dialogRef.close({
|
||||
legalBasis: this.form.get('reason').value.legalBasis,
|
||||
section: this.form.get('section').value,
|
||||
comment: this.form.get('comment').value,
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit f7004520a71b36a00109115a5f4e860f918dcca9
|
||||
Subproject commit 763ac410bd4a99f7d06a6264f77daae56e1c3d4c
|
||||
Loading…
x
Reference in New Issue
Block a user