added warn box for all needed dialogs
This commit is contained in:
parent
a3aac21906
commit
6c047bcdda
@ -35,11 +35,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<button (click)="save()" [disabled]="form.invalid || !changed" color="primary" mat-flat-button>
|
||||
<button (click)="save()" [disabled]="disabled" color="primary" mat-flat-button>
|
||||
{{ 'add-edit-dossier-attribute.save' | translate }}
|
||||
</button>
|
||||
</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,8 +1,8 @@
|
||||
import { Component, HostListener, Inject, OnDestroy } from '@angular/core';
|
||||
import { Component, HostListener, Inject, Injector, OnDestroy } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { DossierAttributeConfigTypes, FileAttributeConfigTypes, IDossierAttributeConfig } from '@red/domain';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { AutoUnsubscribe, IqserEventTarget, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { BaseDialogComponent, IqserEventTarget, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { DossierAttributesService } from '@shared/services/controller-wrappers/dossier-attributes.service';
|
||||
import { dossierAttributeTypesTranslations } from '../../translations/dossier-attribute-types-translations';
|
||||
@ -12,9 +12,8 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
templateUrl: './add-edit-dossier-attribute-dialog.component.html',
|
||||
styleUrls: ['./add-edit-dossier-attribute-dialog.component.scss'],
|
||||
})
|
||||
export class AddEditDossierAttributeDialogComponent extends AutoUnsubscribe implements OnDestroy {
|
||||
export class AddEditDossierAttributeDialogComponent extends BaseDialogComponent implements OnDestroy {
|
||||
dossierAttribute: IDossierAttributeConfig = this.data.dossierAttribute;
|
||||
readonly form: FormGroup = this._getForm(this.dossierAttribute);
|
||||
readonly translations = dossierAttributeTypesTranslations;
|
||||
readonly typeOptions = Object.keys(DossierAttributeConfigTypes);
|
||||
|
||||
@ -23,11 +22,14 @@ export class AddEditDossierAttributeDialogComponent extends AutoUnsubscribe impl
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _dossierAttributesService: DossierAttributesService,
|
||||
private readonly _toaster: Toaster,
|
||||
readonly dialogRef: MatDialogRef<AddEditDossierAttributeDialogComponent>,
|
||||
protected readonly _injector: Injector,
|
||||
protected readonly _dialogRef: MatDialogRef<AddEditDossierAttributeDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA)
|
||||
readonly data: { readonly dossierAttribute: IDossierAttributeConfig },
|
||||
) {
|
||||
super();
|
||||
super(_injector, _dialogRef);
|
||||
this.form = this._getForm(this.dossierAttribute);
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
}
|
||||
|
||||
get changed(): boolean {
|
||||
@ -55,7 +57,7 @@ export class AddEditDossierAttributeDialogComponent extends AutoUnsubscribe impl
|
||||
|
||||
this._dossierAttributesService.createOrUpdate(attribute).subscribe(
|
||||
() => {
|
||||
this.dialogRef.close(true);
|
||||
this._dialogRef.close(true);
|
||||
},
|
||||
(error: HttpErrorResponse) => {
|
||||
this._loadingService.stop();
|
||||
|
||||
@ -34,6 +34,7 @@ export class AdminDialogService extends DialogService<DialogType> {
|
||||
protected readonly _config: DialogConfig<DialogType> = {
|
||||
confirm: {
|
||||
component: ConfirmationDialogComponent,
|
||||
dialogConfig: { disableClose: false },
|
||||
},
|
||||
addEditDictionary: {
|
||||
component: AddEditDictionaryDialogComponent,
|
||||
@ -49,18 +50,19 @@ export class AdminDialogService extends DialogService<DialogType> {
|
||||
},
|
||||
deleteFileAttribute: {
|
||||
component: ConfirmDeleteFileAttributeDialogComponent,
|
||||
dialogConfig: { disableClose: false },
|
||||
},
|
||||
importFileAttributes: {
|
||||
component: FileAttributesCsvImportDialogComponent,
|
||||
dialogConfig: largeDialogConfig,
|
||||
dialogConfig: { ...largeDialogConfig, ...{ disableClose: false } },
|
||||
},
|
||||
deleteUsers: {
|
||||
component: ConfirmDeleteUsersDialogComponent,
|
||||
dialogConfig: { autoFocus: true },
|
||||
dialogConfig: { autoFocus: true, disableClose: false },
|
||||
},
|
||||
addEditUser: {
|
||||
component: AddEditUserDialogComponent,
|
||||
dialogConfig: { autoFocus: true },
|
||||
dialogConfig: { autoFocus: true, disableClose: false },
|
||||
},
|
||||
smtpAuthConfig: {
|
||||
component: SmtpAuthDialogComponent,
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
) | translate: { hint: data.hint }
|
||||
}}
|
||||
</div>
|
||||
<form (submit)="confirm()" [formGroup]="redactionForm">
|
||||
<form (submit)="save()" [formGroup]="form">
|
||||
<div class="dialog-content">
|
||||
{{
|
||||
(data.removeFromDictionary
|
||||
@ -46,12 +46,12 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button [disabled]="!redactionForm.valid" color="primary" mat-flat-button type="submit">
|
||||
<button [disabled]="disabled" color="primary" mat-flat-button type="submit">
|
||||
{{ 'remove-annotations-dialog.confirm' | translate }}
|
||||
</button>
|
||||
<div class="all-caps-label cancel" mat-dialog-close translate="remove-annotations-dialog.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,10 +1,10 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { Component, Inject, Injector } from '@angular/core';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { humanize } from '@iqser/common-ui';
|
||||
import { FormBuilder, Validators } from '@angular/forms';
|
||||
import { BaseDialogComponent, humanize } from '@iqser/common-ui';
|
||||
import { Dossier } from '@red/domain';
|
||||
|
||||
export interface RemoveAnnotationsDialogInput {
|
||||
@ -18,23 +18,24 @@ export interface RemoveAnnotationsDialogInput {
|
||||
templateUrl: './remove-annotations-dialog.component.html',
|
||||
styleUrls: ['./remove-annotations-dialog.component.scss'],
|
||||
})
|
||||
export class RemoveAnnotationsDialogComponent {
|
||||
redactionForm: FormGroup;
|
||||
|
||||
export class RemoveAnnotationsDialogComponent extends BaseDialogComponent {
|
||||
constructor(
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
readonly permissionsService: PermissionsService,
|
||||
public dialogRef: MatDialogRef<RemoveAnnotationsDialogComponent>,
|
||||
protected readonly _injector: Injector,
|
||||
protected readonly _dialogRef: MatDialogRef<RemoveAnnotationsDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: RemoveAnnotationsDialogInput,
|
||||
) {
|
||||
this.redactionForm = this._formBuilder.group({
|
||||
super(_injector, _dialogRef);
|
||||
this.form = this._formBuilder.group({
|
||||
comment: this.permissionsService.isApprover(this.data.dossier) ? [null] : [null, Validators.required],
|
||||
});
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
}
|
||||
|
||||
confirm() {
|
||||
this.dialogRef.close({ comment: this.redactionForm.getRawValue().comment });
|
||||
save() {
|
||||
this._dialogRef.close({ comment: this.form.getRawValue().comment });
|
||||
}
|
||||
|
||||
printable(annotation: AnnotationWrapper) {
|
||||
|
||||
@ -30,6 +30,7 @@ export class DossiersDialogService extends DialogService<DialogType> {
|
||||
protected readonly _config: DialogConfig<DialogType> = {
|
||||
confirm: {
|
||||
component: ConfirmationDialogComponent,
|
||||
dialogConfig: { disableClose: false },
|
||||
},
|
||||
documentInfo: {
|
||||
component: DocumentInfoDialogComponent,
|
||||
@ -45,6 +46,7 @@ export class DossiersDialogService extends DialogService<DialogType> {
|
||||
},
|
||||
assignFile: {
|
||||
component: AssignReviewerApproverDialogComponent,
|
||||
dialogConfig: { disableClose: false },
|
||||
},
|
||||
recategorizeImage: {
|
||||
component: RecategorizeImageDialogComponent,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user