RED-2514, base dialog updates
This commit is contained in:
parent
e8305fd0e5
commit
271e22efc1
@ -3,7 +3,7 @@
|
|||||||
{{ dialogHeader }}
|
{{ dialogHeader }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form (submit)="save()" [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<div class="iqser-input-group mb-14">
|
<div class="iqser-input-group mb-14">
|
||||||
<label translate="add-edit-dictionary.form.technical-name"></label>
|
<label translate="add-edit-dictionary.form.technical-name"></label>
|
||||||
@ -95,7 +95,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-actions">
|
<div class="dialog-actions">
|
||||||
<button [disabled]="form.invalid || !changed" color="primary" mat-flat-button type="submit">
|
<button [disabled]="!valid || !changed" color="primary" mat-flat-button>
|
||||||
{{ 'add-edit-dictionary.save' | translate }}
|
{{ 'add-edit-dictionary.save' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -29,6 +29,7 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
|||||||
name: this._data.dictionary?.label,
|
name: this._data.dictionary?.label,
|
||||||
});
|
});
|
||||||
readonly hasColor$: Observable<boolean>;
|
readonly hasColor$: Observable<boolean>;
|
||||||
|
readonly disabled = false;
|
||||||
private readonly _dossierTemplateId = this._data.dossierTemplateId;
|
private readonly _dossierTemplateId = this._data.dossierTemplateId;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -47,20 +48,8 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
|||||||
this.technicalName$ = this.form.get('label').valueChanges.pipe(map(value => this._toTechnicalName(value)));
|
this.technicalName$ = this.form.get('label').valueChanges.pipe(map(value => this._toTechnicalName(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForm(dictionary: Dictionary): FormGroup {
|
get valid(): boolean {
|
||||||
return this._formBuilder.group({
|
return this.form.valid;
|
||||||
label: [dictionary?.label, [Validators.required, Validators.minLength(3)]],
|
|
||||||
description: [dictionary?.description],
|
|
||||||
rank: [dictionary?.rank, Validators.required],
|
|
||||||
hexColor: [dictionary?.hexColor, [Validators.required, Validators.minLength(7)]],
|
|
||||||
hint: [!!dictionary?.hint],
|
|
||||||
addToDictionaryAction: [!!dictionary?.addToDictionaryAction],
|
|
||||||
caseSensitive: [this.getDictCaseSensitive(dictionary)],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getDictCaseSensitive(dictionary: Dictionary): boolean {
|
|
||||||
return dictionary ? !dictionary.caseInsensitive : false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get changed(): boolean {
|
get changed(): boolean {
|
||||||
@ -92,6 +81,10 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
|||||||
return this.form.get('hexColor').valueChanges.pipe(map((value: string) => !value || value?.length === 0));
|
return this.form.get('hexColor').valueChanges.pipe(map((value: string) => !value || value?.length === 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDictCaseSensitive(dictionary: Dictionary): boolean {
|
||||||
|
return dictionary ? !dictionary.caseInsensitive : false;
|
||||||
|
}
|
||||||
|
|
||||||
async save(): Promise<void> {
|
async save(): Promise<void> {
|
||||||
const dictionary = this._formToObject();
|
const dictionary = this._formToObject();
|
||||||
let observable: Observable<unknown>;
|
let observable: Observable<unknown>;
|
||||||
@ -119,6 +112,18 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getForm(dictionary: Dictionary): FormGroup {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
label: [dictionary?.label, [Validators.required, Validators.minLength(3)]],
|
||||||
|
description: [dictionary?.description],
|
||||||
|
rank: [dictionary?.rank, Validators.required],
|
||||||
|
hexColor: [dictionary?.hexColor, [Validators.required, Validators.minLength(7)]],
|
||||||
|
hint: [!!dictionary?.hint],
|
||||||
|
addToDictionaryAction: [!!dictionary?.addToDictionaryAction],
|
||||||
|
caseSensitive: [this.getDictCaseSensitive(dictionary)],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private _toTechnicalName(value: string) {
|
private _toTechnicalName(value: string) {
|
||||||
const existingTechnicalNames = Object.keys(this._appStateService.dictionaryData[this._dossierTemplateId]);
|
const existingTechnicalNames = Object.keys(this._appStateService.dictionaryData[this._dossierTemplateId]);
|
||||||
const baseTechnicalName = toKebabCase(value.trim());
|
const baseTechnicalName = toKebabCase(value.trim());
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
class="dialog-header heading-l"
|
class="dialog-header heading-l"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
<form (submit)="saveDossierAttribute()" [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<div class="iqser-input-group required w-300">
|
<div class="iqser-input-group required w-300">
|
||||||
<label translate="add-edit-dossier-attribute.form.label"></label>
|
<label translate="add-edit-dossier-attribute.form.label"></label>
|
||||||
@ -35,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-actions">
|
<div class="dialog-actions">
|
||||||
<button [disabled]="form.invalid || !changed" color="primary" mat-flat-button type="submit">
|
<button [disabled]="form.invalid || !changed" color="primary" mat-flat-button>
|
||||||
{{ 'add-edit-dossier-attribute.save' | translate }}
|
{{ 'add-edit-dossier-attribute.save' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
class="dialog-header heading-l"
|
class="dialog-header heading-l"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
<form (submit)="save()" [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<div class="iqser-input-group required w-300">
|
<div class="iqser-input-group required w-300">
|
||||||
<label translate="add-edit-dossier-template.form.name"></label>
|
<label translate="add-edit-dossier-template.form.name"></label>
|
||||||
@ -87,7 +87,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-actions">
|
<div class="dialog-actions">
|
||||||
<button [disabled]="form.invalid || !changed" color="primary" mat-flat-button type="submit">
|
<button [disabled]="!valid || !changed" color="primary" mat-flat-button>
|
||||||
{{ 'add-edit-dossier-template.save' | translate }}
|
{{ 'add-edit-dossier-template.save' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -25,7 +25,7 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
|
|||||||
key: type,
|
key: type,
|
||||||
label: downloadTypesTranslations[type],
|
label: downloadTypesTranslations[type],
|
||||||
}));
|
}));
|
||||||
|
readonly disabled = false;
|
||||||
private _previousValidFrom: Moment;
|
private _previousValidFrom: Moment;
|
||||||
private _previousValidTo: Moment;
|
private _previousValidTo: Moment;
|
||||||
|
|
||||||
@ -49,20 +49,8 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
get valid(): boolean {
|
||||||
return this._formBuilder.group({
|
return this.form.valid;
|
||||||
name: [this.dossierTemplate?.name, Validators.required],
|
|
||||||
description: [this.dossierTemplate?.description],
|
|
||||||
validFrom: [
|
|
||||||
this.dossierTemplate?.validFrom ? moment(this.dossierTemplate?.validFrom) : null,
|
|
||||||
this._requiredIfValidator(() => this.hasValidFrom),
|
|
||||||
],
|
|
||||||
validTo: [
|
|
||||||
this.dossierTemplate?.validTo ? moment(this.dossierTemplate?.validTo) : null,
|
|
||||||
this._requiredIfValidator(() => this.hasValidTo),
|
|
||||||
],
|
|
||||||
downloadFileTypes: [this.dossierTemplate?.downloadFileTypes || ['PREVIEW', 'REDACTED']],
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get changed(): boolean {
|
get changed(): boolean {
|
||||||
@ -119,6 +107,22 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getForm(): FormGroup {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
name: [this.dossierTemplate?.name, Validators.required],
|
||||||
|
description: [this.dossierTemplate?.description],
|
||||||
|
validFrom: [
|
||||||
|
this.dossierTemplate?.validFrom ? moment(this.dossierTemplate?.validFrom) : null,
|
||||||
|
this._requiredIfValidator(() => this.hasValidFrom),
|
||||||
|
],
|
||||||
|
validTo: [
|
||||||
|
this.dossierTemplate?.validTo ? moment(this.dossierTemplate?.validTo) : null,
|
||||||
|
this._requiredIfValidator(() => this.hasValidTo),
|
||||||
|
],
|
||||||
|
downloadFileTypes: [this.dossierTemplate?.downloadFileTypes || ['PREVIEW', 'REDACTED']],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private _applyValidityIntervalConstraints(value): boolean {
|
private _applyValidityIntervalConstraints(value): boolean {
|
||||||
if (applyIntervalConstraints(value, this._previousValidFrom, this._previousValidTo, this.form, 'validFrom', 'validTo')) {
|
if (applyIntervalConstraints(value, this._previousValidFrom, this._previousValidTo, this.form, 'validFrom', 'validTo')) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
class="dialog-header heading-l"
|
class="dialog-header heading-l"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
<form (submit)="save()" [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<div class="iqser-input-group required w-300">
|
<div class="iqser-input-group required w-300">
|
||||||
<label translate="add-edit-file-attribute.form.name"></label>
|
<label translate="add-edit-file-attribute.form.name"></label>
|
||||||
@ -53,20 +53,38 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="red-input-group mt-0">
|
<div class="red-input-group mt-0">
|
||||||
<mat-checkbox color="primary" formControlName="filterable" name="filterable">
|
<mat-checkbox
|
||||||
|
[matTooltipDisabled]="canSetFilterable"
|
||||||
|
[matTooltip]="
|
||||||
|
'add-edit-file-attribute.form.filterable-disabled' | translate: { maxNumber: DISPLAYED_FILTERABLE_LIMIT }
|
||||||
|
"
|
||||||
|
color="primary"
|
||||||
|
formControlName="filterable"
|
||||||
|
matTooltipPosition="above"
|
||||||
|
name="filterable"
|
||||||
|
>
|
||||||
{{ 'add-edit-file-attribute.form.filterable' | translate }}
|
{{ 'add-edit-file-attribute.form.filterable' | translate }}
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="red-input-group mt-0">
|
<div class="red-input-group mt-0">
|
||||||
<mat-checkbox color="primary" formControlName="displayedInFileList" name="displayedInFileList">
|
<mat-checkbox
|
||||||
|
[matTooltipDisabled]="canSetDisplayed"
|
||||||
|
[matTooltip]="
|
||||||
|
'add-edit-file-attribute.form.displayed-disabled' | translate: { maxNumber: DISPLAYED_FILTERABLE_LIMIT }
|
||||||
|
"
|
||||||
|
color="primary"
|
||||||
|
formControlName="displayedInFileList"
|
||||||
|
matTooltipPosition="above"
|
||||||
|
name="displayedInFileList"
|
||||||
|
>
|
||||||
{{ 'add-edit-file-attribute.form.displayedInFileList' | translate }}
|
{{ 'add-edit-file-attribute.form.displayedInFileList' | translate }}
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-actions">
|
<div class="dialog-actions">
|
||||||
<button [disabled]="form.invalid || !changed" color="primary" mat-flat-button type="submit">
|
<button [disabled]="!valid || !changed" color="primary" mat-flat-button>
|
||||||
{{ 'add-edit-file-attribute.save' | translate }}
|
{{ 'add-edit-file-attribute.save' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,29 +1,48 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { FileAttributeConfigTypes, IFileAttributeConfig } from '@red/domain';
|
import { FileAttributeConfigTypes, IFileAttributeConfig } from '@red/domain';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { fileAttributeTypesTranslations } from '../../translations/file-attribute-types-translations';
|
import { fileAttributeTypesTranslations } from '../../translations/file-attribute-types-translations';
|
||||||
|
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
||||||
import { BaseDialogComponent } from '@iqser/common-ui';
|
import { BaseDialogComponent } from '@iqser/common-ui';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-add-edit-file-attribute-dialog',
|
selector: 'redaction-add-edit-file-attribute-dialog',
|
||||||
templateUrl: './add-edit-file-attribute-dialog.component.html',
|
templateUrl: './add-edit-file-attribute-dialog.component.html',
|
||||||
styleUrls: ['./add-edit-file-attribute-dialog.component.scss'],
|
styleUrls: ['./add-edit-file-attribute-dialog.component.scss'],
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class AddEditFileAttributeDialogComponent extends BaseDialogComponent {
|
export class AddEditFileAttributeDialogComponent extends BaseDialogComponent {
|
||||||
|
readonly disabled = false;
|
||||||
|
DISPLAYED_FILTERABLE_LIMIT = 3;
|
||||||
|
translations = fileAttributeTypesTranslations;
|
||||||
fileAttribute: IFileAttributeConfig = this.data.fileAttribute;
|
fileAttribute: IFileAttributeConfig = this.data.fileAttribute;
|
||||||
dossierTemplateId: string = this.data.dossierTemplateId;
|
dossierTemplateId: string = this.data.dossierTemplateId;
|
||||||
readonly form: FormGroup = this._getForm(this.fileAttribute);
|
readonly form!: FormGroup;
|
||||||
readonly typeOptions = Object.keys(FileAttributeConfigTypes);
|
readonly typeOptions = Object.keys(FileAttributeConfigTypes);
|
||||||
translations = fileAttributeTypesTranslations;
|
readonly canSetDisplayed!: boolean;
|
||||||
|
readonly canSetFilterable!: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
|
private readonly _fileAttributesService: FileAttributesService,
|
||||||
public dialogRef: MatDialogRef<AddEditFileAttributeDialogComponent>,
|
public dialogRef: MatDialogRef<AddEditFileAttributeDialogComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA)
|
@Inject(MAT_DIALOG_DATA)
|
||||||
public data: { fileAttribute: IFileAttributeConfig; dossierTemplateId: string },
|
public data: {
|
||||||
|
fileAttribute: IFileAttributeConfig;
|
||||||
|
dossierTemplateId: string;
|
||||||
|
numberOfDisplayedAttrs: number;
|
||||||
|
numberOfFilterableAttrs: number;
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
this.canSetDisplayed = data.numberOfDisplayedAttrs < this.DISPLAYED_FILTERABLE_LIMIT || data.fileAttribute?.displayedInFileList;
|
||||||
|
this.canSetFilterable = data.numberOfFilterableAttrs < this.DISPLAYED_FILTERABLE_LIMIT || data.fileAttribute?.filterable;
|
||||||
|
this.form = this._getForm(this.fileAttribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return this.form.valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
get changed(): boolean {
|
get changed(): boolean {
|
||||||
@ -60,8 +79,8 @@ export class AddEditFileAttributeDialogComponent extends BaseDialogComponent {
|
|||||||
type: [fileAttribute?.type || FileAttributeConfigTypes.TEXT, Validators.required],
|
type: [fileAttribute?.type || FileAttributeConfigTypes.TEXT, Validators.required],
|
||||||
readonly: [fileAttribute ? !fileAttribute.editable : false],
|
readonly: [fileAttribute ? !fileAttribute.editable : false],
|
||||||
primaryAttribute: [fileAttribute?.primaryAttribute],
|
primaryAttribute: [fileAttribute?.primaryAttribute],
|
||||||
filterable: [fileAttribute?.filterable],
|
filterable: { value: fileAttribute?.filterable, disabled: !this.canSetFilterable },
|
||||||
displayedInFileList: [fileAttribute?.displayedInFileList],
|
displayedInFileList: { value: fileAttribute?.displayedInFileList, disabled: !this.canSetDisplayed },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<section class="dialog">
|
<section class="dialog">
|
||||||
<div [translate]="translations[data.colorKey]" class="dialog-header heading-l"></div>
|
<div [translate]="translations[data.colorKey]" class="dialog-header heading-l"></div>
|
||||||
|
|
||||||
<form (submit)="save()" [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<div class="iqser-input-group required">
|
<div class="iqser-input-group required">
|
||||||
<label translate="edit-color-dialog.form.color"></label>
|
<label translate="edit-color-dialog.form.color"></label>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-actions">
|
<div class="dialog-actions">
|
||||||
<button [disabled]="form.invalid || !changed" color="primary" mat-flat-button type="submit">
|
<button [disabled]="!valid || !changed" color="primary" mat-flat-button>
|
||||||
{{ 'edit-color-dialog.save' | translate }}
|
{{ 'edit-color-dialog.save' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ interface IEditColorData {
|
|||||||
export class EditColorDialogComponent extends BaseDialogComponent {
|
export class EditColorDialogComponent extends BaseDialogComponent {
|
||||||
readonly form: FormGroup;
|
readonly form: FormGroup;
|
||||||
translations = defaultColorsTranslations;
|
translations = defaultColorsTranslations;
|
||||||
|
readonly disabled = false;
|
||||||
private readonly _initialColor: string;
|
private readonly _initialColor: string;
|
||||||
private readonly _dossierTemplateId: string;
|
private readonly _dossierTemplateId: string;
|
||||||
|
|
||||||
@ -44,10 +45,8 @@ export class EditColorDialogComponent extends BaseDialogComponent {
|
|||||||
return this.form.get('color').value !== this._initialColor;
|
return this.form.get('color').value !== this._initialColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
get valid(): boolean {
|
||||||
return this._formBuilder.group({
|
return this.form.valid;
|
||||||
color: [this.data.colors[this.data.colorKey], [Validators.required, Validators.minLength(7)]],
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
@ -65,4 +64,10 @@ export class EditColorDialogComponent extends BaseDialogComponent {
|
|||||||
this._toaster.error(_('edit-color-dialog.error'));
|
this._toaster.error(_('edit-color-dialog.error'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getForm(): FormGroup {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
color: [this.data.colors[this.data.colorKey], [Validators.required, Validators.minLength(7)]],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,19 +63,28 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
|||||||
super(_injector);
|
super(_injector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get _numberOfDisplayedAttrs(): number {
|
||||||
|
return this.entitiesService.all.filter(attr => attr.displayedInFileList).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private get _numberOfFilterableAttrs(): number {
|
||||||
|
return this.entitiesService.all.filter(attr => attr.filterable).length;
|
||||||
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
openAddEditAttributeDialog($event: MouseEvent, fileAttribute?: IFileAttributeConfig) {
|
openAddEditAttributeDialog($event: MouseEvent, fileAttribute?: IFileAttributeConfig) {
|
||||||
this._dialogService.openDialog(
|
const data = {
|
||||||
'addEditFileAttribute',
|
fileAttribute,
|
||||||
$event,
|
dossierTemplateId: this._dossierTemplatesService.activeDossierTemplateId,
|
||||||
{ fileAttribute, dossierTemplateId: this._dossierTemplatesService.activeDossierTemplateId },
|
numberOfDisplayedAttrs: this._numberOfDisplayedAttrs,
|
||||||
(newValue: IFileAttributeConfig) => {
|
numberOfFilterableAttrs: this._numberOfFilterableAttrs,
|
||||||
this._loadingService.loadWhile(this._createNewFileAttributeAndRefreshView(newValue));
|
};
|
||||||
},
|
this._dialogService.openDialog('addEditFileAttribute', $event, data, (newValue: IFileAttributeConfig) => {
|
||||||
);
|
this._loadingService.loadWhile(this._createNewFileAttributeAndRefreshView(newValue));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openConfirmDeleteAttributeDialog($event: MouseEvent, fileAttribute?: IFileAttributeConfig) {
|
openConfirmDeleteAttributeDialog($event: MouseEvent, fileAttribute?: IFileAttributeConfig) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|||||||
import { Justification } from '@red/domain';
|
import { Justification } from '@red/domain';
|
||||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { BaseDialogComponent, LoadingService } from '@iqser/common-ui';
|
import { LoadingService } from '@iqser/common-ui';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-add-edit-justification-dialog',
|
selector: 'redaction-add-edit-justification-dialog',
|
||||||
@ -12,7 +12,7 @@ import { BaseDialogComponent, LoadingService } from '@iqser/common-ui';
|
|||||||
styleUrls: ['./add-edit-justification-dialog.component.scss'],
|
styleUrls: ['./add-edit-justification-dialog.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class AddEditJustificationDialogComponent extends BaseDialogComponent {
|
export class AddEditJustificationDialogComponent {
|
||||||
readonly form: FormGroup = this._getForm();
|
readonly form: FormGroup = this._getForm();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -22,17 +22,7 @@ export class AddEditJustificationDialogComponent extends BaseDialogComponent {
|
|||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
public dialogRef: MatDialogRef<AddEditJustificationDialogComponent>,
|
public dialogRef: MatDialogRef<AddEditJustificationDialogComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public justification: Justification,
|
@Inject(MAT_DIALOG_DATA) public justification: Justification,
|
||||||
) {
|
) {}
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
|
||||||
return this._formBuilder.group({
|
|
||||||
name: [{ value: this.justification?.name, disabled: !!this.justification }, Validators.required],
|
|
||||||
reason: [this.justification?.reason, Validators.required],
|
|
||||||
description: [this.justification?.description, Validators.required],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
get changed(): boolean {
|
get changed(): boolean {
|
||||||
return (
|
return (
|
||||||
@ -50,4 +40,12 @@ export class AddEditJustificationDialogComponent extends BaseDialogComponent {
|
|||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
this.dialogRef.close(true);
|
this.dialogRef.close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getForm(): FormGroup {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
name: [{ value: this.justification?.name, disabled: !!this.justification }, Validators.required],
|
||||||
|
reason: [this.justification?.reason, Validators.required],
|
||||||
|
description: [this.justification?.description, Validators.required],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<form (submit)="save()" *ngIf="form" [formGroup]="form">
|
<form *ngIf="form" [formGroup]="form">
|
||||||
<div>
|
<div>
|
||||||
<div *ngIf="customAttributes.length" class="heading">
|
<div *ngIf="customAttributes.length" class="heading">
|
||||||
{{ 'edit-dossier-dialog.attributes.custom-attributes' | translate }}
|
{{ 'edit-dossier-dialog.attributes.custom-attributes' | translate }}
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<iqser-icon-button
|
<iqser-icon-button
|
||||||
(action)="fileInputClick(attr)"
|
(action)="fileInputClick(attr)"
|
||||||
*ngIf="!currentAttrValue(attr)"
|
*ngIf="!currentAttrValue(attr)"
|
||||||
[disabled]="!canEdit"
|
[disabled]="disabled"
|
||||||
[label]="'edit-dossier-dialog.attributes.upload-image' | translate"
|
[label]="'edit-dossier-dialog.attributes.upload-image' | translate"
|
||||||
[type]="iconButtonTypes.dark"
|
[type]="iconButtonTypes.dark"
|
||||||
class="upload-button"
|
class="upload-button"
|
||||||
@ -75,7 +75,7 @@
|
|||||||
type="file"
|
type="file"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="currentAttrValue(attr) && canEdit">
|
<div *ngIf="currentAttrValue(attr) && !disabled">
|
||||||
<iqser-circle-button
|
<iqser-circle-button
|
||||||
(action)="deleteAttr(attr)"
|
(action)="deleteAttr(attr)"
|
||||||
[tooltip]="'edit-dossier-dialog.attributes.delete-image' | translate"
|
[tooltip]="'edit-dossier-dialog.attributes.delete-image' | translate"
|
||||||
|
|||||||
@ -48,12 +48,12 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get disabled() {
|
get disabled(): boolean {
|
||||||
return !this._permissionsService.isOwner(this.dossier);
|
return !this._permissionsService.isOwner(this.dossier);
|
||||||
}
|
}
|
||||||
|
|
||||||
get canEdit(): boolean {
|
get valid(): boolean {
|
||||||
return this._permissionsService.isOwner(this.dossier);
|
return this.form.valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@ -134,7 +134,7 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
|||||||
private _getForm(): FormGroup {
|
private _getForm(): FormGroup {
|
||||||
const controlsConfig = {};
|
const controlsConfig = {};
|
||||||
for (const attribute of this.attributes) {
|
for (const attribute of this.attributes) {
|
||||||
controlsConfig[attribute.id] = [{ value: attribute.value, disabled: !this.canEdit }];
|
controlsConfig[attribute.id] = [{ value: attribute.value, disabled: this.disabled }];
|
||||||
}
|
}
|
||||||
return this._formBuilder.group(controlsConfig);
|
return this._formBuilder.group(controlsConfig);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,7 @@ interface FileListItem extends IFile, IListable {
|
|||||||
export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileListItem> implements EditDossierSectionInterface, OnInit {
|
export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileListItem> implements EditDossierSectionInterface, OnInit {
|
||||||
@Input() dossier: Dossier;
|
@Input() dossier: Dossier;
|
||||||
readonly changed = false;
|
readonly changed = false;
|
||||||
|
readonly valid = false;
|
||||||
readonly canRestoreSelected$ = this._canRestoreSelected$;
|
readonly canRestoreSelected$ = this._canRestoreSelected$;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
readonly tableColumnConfigs: TableColumnConfig<FileListItem>[] = [
|
readonly tableColumnConfigs: TableColumnConfig<FileListItem>[] = [
|
||||||
|
|||||||
@ -29,14 +29,18 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa
|
|||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
get changed() {
|
get changed(): boolean {
|
||||||
return this._dictionaryManager.editor.hasChanges;
|
return this._dictionaryManager.editor.hasChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
get disabled() {
|
get disabled(): boolean {
|
||||||
return !this.canEdit;
|
return !this.canEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return this._dictionaryManager.editor.hasChanges;
|
||||||
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
this.canEdit = this._permissionsService.isDossierMember(this.dossier);
|
this.canEdit = this._permissionsService.isDossierMember(this.dossier);
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<form [formGroup]="dossierForm" *ngIf="dossierForm">
|
<form *ngIf="form" [formGroup]="form">
|
||||||
<redaction-select
|
<redaction-select
|
||||||
[label]="'report-type.label' | translate: { length: reportTypesLength }"
|
[label]="'report-type.label' | translate: { length: reportTypesLength }"
|
||||||
|
[optionTemplate]="reportTemplateOptionTemplate"
|
||||||
[options]="availableReportTypes"
|
[options]="availableReportTypes"
|
||||||
[valueMapper]="reportTemplateValueMapper"
|
[valueMapper]="reportTemplateValueMapper"
|
||||||
[optionTemplate]="reportTemplateOptionTemplate"
|
|
||||||
class="mr-16"
|
class="mr-16"
|
||||||
formControlName="reportTemplateIds"
|
formControlName="reportTemplateIds"
|
||||||
></redaction-select>
|
></redaction-select>
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { ReportTemplateService } from '@services/report-template.service';
|
|||||||
styleUrls: ['./edit-dossier-download-package.component.scss'],
|
styleUrls: ['./edit-dossier-download-package.component.scss'],
|
||||||
})
|
})
|
||||||
export class EditDossierDownloadPackageComponent implements OnInit, EditDossierSectionInterface {
|
export class EditDossierDownloadPackageComponent implements OnInit, EditDossierSectionInterface {
|
||||||
dossierForm: FormGroup;
|
form: FormGroup;
|
||||||
downloadTypes: { key: DownloadFileType; label: string }[] = ['ORIGINAL', 'PREVIEW', 'REDACTED'].map((type: DownloadFileType) => ({
|
downloadTypes: { key: DownloadFileType; label: string }[] = ['ORIGINAL', 'PREVIEW', 'REDACTED'].map((type: DownloadFileType) => ({
|
||||||
key: type,
|
key: type,
|
||||||
label: downloadTypesTranslations[type],
|
label: downloadTypesTranslations[type],
|
||||||
@ -28,22 +28,22 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
get reportTypesLength() {
|
get reportTypesLength() {
|
||||||
return this.dossierForm.controls['reportTemplateIds']?.value?.length || 0;
|
return this.form.controls['reportTemplateIds']?.value?.length || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
get downloadFileTypesLength() {
|
get downloadFileTypesLength() {
|
||||||
return this.dossierForm.controls['downloadFileTypes']?.value?.length || 0;
|
return this.form.controls['downloadFileTypes']?.value?.length || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
get changed() {
|
get changed() {
|
||||||
if (this.dossierForm) {
|
if (this.form) {
|
||||||
for (const key of Object.keys(this.dossierForm.getRawValue())) {
|
for (const key of Object.keys(this.form.getRawValue())) {
|
||||||
if (this.dossier[key].length !== this.dossierForm.get(key).value.length) {
|
if (this.dossier[key].length !== this.form.get(key).value.length) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const originalItems = [...this.dossier[key]].sort();
|
const originalItems = [...this.dossier[key]].sort();
|
||||||
const newItems = [...this.dossierForm.get(key).value].sort();
|
const newItems = [...this.form.get(key).value].sort();
|
||||||
|
|
||||||
for (let idx = 0; idx < originalItems.length; ++idx) {
|
for (let idx = 0; idx < originalItems.length; ++idx) {
|
||||||
if (originalItems[idx] !== newItems[idx]) {
|
if (originalItems[idx] !== newItems[idx]) {
|
||||||
@ -57,7 +57,11 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
|
|||||||
}
|
}
|
||||||
|
|
||||||
get disabled() {
|
get disabled() {
|
||||||
return this.dossierForm?.invalid || !this.dossierForm?.value?.downloadFileTypes?.length;
|
return !this.form?.value?.downloadFileTypes?.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return this.form.valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
reportTemplateValueMapper = (reportTemplate: IReportTemplate) => reportTemplate.templateId;
|
reportTemplateValueMapper = (reportTemplate: IReportTemplate) => reportTemplate.templateId;
|
||||||
@ -66,14 +70,14 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
|
|||||||
this.availableReportTypes =
|
this.availableReportTypes =
|
||||||
(await this._reportTemplateController.getAvailableReportTemplates(this.dossier.dossierTemplateId).toPromise()) || [];
|
(await this._reportTemplateController.getAvailableReportTemplates(this.dossier.dossierTemplateId).toPromise()) || [];
|
||||||
|
|
||||||
this.dossierForm = this._getForm();
|
this.form = this._getForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
async save(): EditDossierSaveResult {
|
async save(): EditDossierSaveResult {
|
||||||
const dossier = {
|
const dossier = {
|
||||||
...this.dossier,
|
...this.dossier,
|
||||||
downloadFileTypes: this.dossierForm.get('downloadFileTypes').value,
|
downloadFileTypes: this.form.get('downloadFileTypes').value,
|
||||||
reportTemplateIds: this.dossierForm.get('reportTemplateIds').value,
|
reportTemplateIds: this.form.get('reportTemplateIds').value,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await this._dossiersService.createOrUpdate(dossier).toPromise();
|
await this._dossiersService.createOrUpdate(dossier).toPromise();
|
||||||
@ -84,7 +88,7 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
|
|||||||
}
|
}
|
||||||
|
|
||||||
revert() {
|
revert() {
|
||||||
this.dossierForm.reset({
|
this.form.reset({
|
||||||
downloadFileTypes: this.dossier.downloadFileTypes,
|
downloadFileTypes: this.dossier.downloadFileTypes,
|
||||||
reportTemplateIds: this.dossier.reportTemplateIds,
|
reportTemplateIds: this.dossier.reportTemplateIds,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -49,17 +49,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="showActionButtons" class="dialog-actions">
|
<div *ngIf="showActionButtons" class="dialog-actions">
|
||||||
<button
|
<button (click)="save()" [disabled]="disabled || !valid || !changed" color="primary" mat-flat-button>
|
||||||
(click)="save()"
|
|
||||||
[disabled]="activeComponent?.disabled || !activeComponent?.changed"
|
|
||||||
color="primary"
|
|
||||||
mat-flat-button
|
|
||||||
>
|
|
||||||
{{ 'edit-dossier-dialog.actions.save' | translate }}
|
{{ 'edit-dossier-dialog.actions.save' | translate }}
|
||||||
</button>
|
</button>
|
||||||
<iqser-icon-button
|
<iqser-icon-button
|
||||||
(action)="save(true)"
|
(action)="save(true)"
|
||||||
[disabled]="activeComponent?.disabled || !activeComponent?.changed"
|
[disabled]="disabled || !valid || !changed"
|
||||||
[label]="'edit-dossier-dialog.actions.save-and-close' | translate"
|
[label]="'edit-dossier-dialog.actions.save-and-close' | translate"
|
||||||
[type]="iconButtonTypes.dark"
|
[type]="iconButtonTypes.dark"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { Dossier } from '@red/domain';
|
|||||||
import { EditDossierGeneralInfoComponent } from './general-info/edit-dossier-general-info.component';
|
import { EditDossierGeneralInfoComponent } from './general-info/edit-dossier-general-info.component';
|
||||||
import { EditDossierDownloadPackageComponent } from './download-package/edit-dossier-download-package.component';
|
import { EditDossierDownloadPackageComponent } from './download-package/edit-dossier-download-package.component';
|
||||||
import { EditDossierSectionInterface } from './edit-dossier-section.interface';
|
import { EditDossierSectionInterface } from './edit-dossier-section.interface';
|
||||||
import { IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
import { BaseDialogComponent, IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||||
import { EditDossierDictionaryComponent } from './dictionary/edit-dossier-dictionary.component';
|
import { EditDossierDictionaryComponent } from './dictionary/edit-dossier-dictionary.component';
|
||||||
import { EditDossierAttributesComponent } from './attributes/edit-dossier-attributes.component';
|
import { EditDossierAttributesComponent } from './attributes/edit-dossier-attributes.component';
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ type Section = 'dossierInfo' | 'downloadPackage' | 'dossierDictionary' | 'member
|
|||||||
templateUrl: './edit-dossier-dialog.component.html',
|
templateUrl: './edit-dossier-dialog.component.html',
|
||||||
styleUrls: ['./edit-dossier-dialog.component.scss'],
|
styleUrls: ['./edit-dossier-dialog.component.scss'],
|
||||||
})
|
})
|
||||||
export class EditDossierDialogComponent {
|
export class EditDossierDialogComponent extends BaseDialogComponent {
|
||||||
readonly navItems: { key: Section; title?: string; sideNavTitle?: string }[];
|
readonly navItems: { key: Section; title?: string; sideNavTitle?: string }[];
|
||||||
readonly iconButtonTypes = IconButtonTypes;
|
readonly iconButtonTypes = IconButtonTypes;
|
||||||
activeNav: Section;
|
activeNav: Section;
|
||||||
@ -47,6 +47,7 @@ export class EditDossierDialogComponent {
|
|||||||
section?: Section;
|
section?: Section;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
|
super();
|
||||||
this.navItems = [
|
this.navItems = [
|
||||||
{
|
{
|
||||||
key: 'dossierInfo',
|
key: 'dossierInfo',
|
||||||
@ -111,6 +112,18 @@ export class EditDossierDialogComponent {
|
|||||||
return !['deletedDocuments'].includes(this.activeNav);
|
return !['deletedDocuments'].includes(this.activeNav);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get changed(): boolean {
|
||||||
|
return this.activeComponent?.changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return this.activeComponent?.valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
get disabled(): boolean {
|
||||||
|
return this.activeComponent?.disabled;
|
||||||
|
}
|
||||||
|
|
||||||
afterSave() {
|
afterSave() {
|
||||||
this._toaster.success(_('edit-dossier-dialog.change-successful'), { params: { dossierName: this._dossierName } });
|
this._toaster.success(_('edit-dossier-dialog.change-successful'), { params: { dossierName: this._dossierName } });
|
||||||
}
|
}
|
||||||
@ -134,7 +147,7 @@ export class EditDossierDialogComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeTab(key: Section) {
|
changeTab(key: Section) {
|
||||||
if (this.activeComponent.changed) {
|
if (this.changed) {
|
||||||
this._toaster.error(_('edit-dossier-dialog.unsaved-changes'));
|
this._toaster.error(_('edit-dossier-dialog.unsaved-changes'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ export type EditDossierSaveResult = Promise<{ success: boolean }>;
|
|||||||
|
|
||||||
export interface EditDossierSectionInterface {
|
export interface EditDossierSectionInterface {
|
||||||
changed: boolean;
|
changed: boolean;
|
||||||
|
valid: boolean;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
save: (...args: any) => EditDossierSaveResult;
|
save: (...args: any) => EditDossierSaveResult;
|
||||||
revert: Function;
|
revert: Function;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<form (submit)="save()" [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<div class="iqser-input-group w-300">
|
<div class="iqser-input-group w-300">
|
||||||
<mat-form-field floatLabel="always">
|
<mat-form-field floatLabel="always">
|
||||||
<mat-label>{{ 'assign-dossier-owner.dialog.single-user' | translate }}</mat-label>
|
<mat-label>{{ 'assign-dossier-owner.dialog.single-user' | translate }}</mat-label>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<form (submit)="save()" [formGroup]="dossierForm">
|
<form [formGroup]="form">
|
||||||
<div class="iqser-input-group required w-300">
|
<div class="iqser-input-group required w-300">
|
||||||
<label translate="edit-dossier-dialog.general-info.form.name.label"></label>
|
<label translate="edit-dossier-dialog.general-info.form.name.label"></label>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
|
|||||||
|
|
||||||
@Input() dossier: Dossier;
|
@Input() dossier: Dossier;
|
||||||
|
|
||||||
dossierForm: FormGroup;
|
form: FormGroup;
|
||||||
hasDueDate: boolean;
|
hasDueDate: boolean;
|
||||||
dossierTemplates: IDossierTemplate[];
|
dossierTemplates: IDossierTemplate[];
|
||||||
|
|
||||||
@ -40,16 +40,16 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
|
|||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
get changed() {
|
get changed(): boolean {
|
||||||
for (const key of Object.keys(this.dossierForm.getRawValue())) {
|
for (const key of Object.keys(this.form.getRawValue())) {
|
||||||
if (key === 'dueDate') {
|
if (key === 'dueDate') {
|
||||||
if (this.hasDueDate !== !!this.dossier.dueDate) {
|
if (this.hasDueDate !== !!this.dossier.dueDate) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this.hasDueDate && !moment(this.dossier.dueDate).isSame(moment(this.dossierForm.get(key).value))) {
|
if (this.hasDueDate && !moment(this.dossier.dueDate).isSame(moment(this.form.get(key).value))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (this.dossier[key] !== this.dossierForm.get(key).value) {
|
} else if (this.dossier[key] !== this.form.get(key).value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,22 +57,22 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get disabled() {
|
get valid(): boolean {
|
||||||
if (this.hasDueDate && this.dossierForm.get('dueDate').value === null) {
|
return this.form.valid;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return this.dossierForm.invalid;
|
get disabled(): boolean {
|
||||||
|
return this.hasDueDate && this.form.get('dueDate').value === null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this._filterInvalidDossierTemplates();
|
this._filterInvalidDossierTemplates();
|
||||||
this.dossierForm = this._getForm();
|
this.form = this._getForm();
|
||||||
this.hasDueDate = !!this.dossier.dueDate;
|
this.hasDueDate = !!this.dossier.dueDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
revert() {
|
revert() {
|
||||||
this.dossierForm.reset({
|
this.form.reset({
|
||||||
dossierName: this.dossier.dossierName,
|
dossierName: this.dossier.dossierName,
|
||||||
dossierTemplateId: this.dossier.dossierTemplateId,
|
dossierTemplateId: this.dossier.dossierTemplateId,
|
||||||
description: this.dossier.description,
|
description: this.dossier.description,
|
||||||
@ -85,12 +85,12 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
|
|||||||
async save(): EditDossierSaveResult {
|
async save(): EditDossierSaveResult {
|
||||||
const dossier = {
|
const dossier = {
|
||||||
...this.dossier,
|
...this.dossier,
|
||||||
dossierName: this.dossierForm.get('dossierName').value,
|
dossierName: this.form.get('dossierName').value,
|
||||||
description: this.dossierForm.get('description').value,
|
description: this.form.get('description').value,
|
||||||
watermarkEnabled: this.dossierForm.get('watermarkEnabled').value,
|
watermarkEnabled: this.form.get('watermarkEnabled').value,
|
||||||
watermarkPreviewEnabled: this.dossierForm.get('watermarkPreviewEnabled').value,
|
watermarkPreviewEnabled: this.form.get('watermarkPreviewEnabled').value,
|
||||||
dueDate: this.hasDueDate ? this.dossierForm.get('dueDate').value : undefined,
|
dueDate: this.hasDueDate ? this.form.get('dueDate').value : undefined,
|
||||||
dossierTemplateId: this.dossierForm.get('dossierTemplateId').value,
|
dossierTemplateId: this.form.get('dossierTemplateId').value,
|
||||||
} as IDossierRequest;
|
} as IDossierRequest;
|
||||||
try {
|
try {
|
||||||
await this._dossiersService.createOrUpdate(dossier).toPromise();
|
await this._dossiersService.createOrUpdate(dossier).toPromise();
|
||||||
|
|||||||
@ -88,8 +88,10 @@
|
|||||||
"form": {
|
"form": {
|
||||||
"column-header": "CSV Column Header",
|
"column-header": "CSV Column Header",
|
||||||
"column-header-placeholder": "Enter CSV Column Header",
|
"column-header-placeholder": "Enter CSV Column Header",
|
||||||
|
"displayed-disabled": "The maximum number of displayed attributes ({maxNumber}) has been reached.",
|
||||||
"displayedInFileList": "Displayed In File List",
|
"displayedInFileList": "Displayed In File List",
|
||||||
"filterable": "Filterable",
|
"filterable": "Filterable",
|
||||||
|
"filterable-disabled": "The maximum number of filterable attributes ({maxNumber}) has been reached.",
|
||||||
"name": "Attribute Name",
|
"name": "Attribute Name",
|
||||||
"name-placeholder": "Enter Name",
|
"name-placeholder": "Enter Name",
|
||||||
"primary": "Set as Primary",
|
"primary": "Set as Primary",
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 1f5df2f7308d757d39df78b5b06a63c69e1865f4
|
Subproject commit af9adfd5799e20d8f674a5523ebfeda87897ef97
|
||||||
Loading…
x
Reference in New Issue
Block a user