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