|
|
|
@@ -1,8 +1,10 @@
|
|
|
|
import { SelectOption } from '@ui/select/select-option.model';
|
|
|
|
|
|
|
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
|
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
|
|
import { FormControl, FormGroup } from '@angular/forms';
|
|
|
|
import { FormControl, FormGroup } from '@angular/forms';
|
|
|
|
|
|
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
|
|
|
import { Feature } from '@msfa-enums/feature.enum';
|
|
|
|
import { InformativRapportCategory, InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum';
|
|
|
|
import { InformativRapportCategory, InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum';
|
|
|
|
|
|
|
|
import { environment } from '@msfa-environment';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
InformativRapportRequest,
|
|
|
|
InformativRapportRequest,
|
|
|
|
InformativRapportWithFileRequest,
|
|
|
|
InformativRapportWithFileRequest,
|
|
|
|
@@ -10,11 +12,11 @@ import {
|
|
|
|
import { DeltagareAvrop } from '@msfa-models/avrop.model';
|
|
|
|
import { DeltagareAvrop } from '@msfa-models/avrop.model';
|
|
|
|
import { CustomError } from '@msfa-models/error/custom-error';
|
|
|
|
import { CustomError } from '@msfa-models/error/custom-error';
|
|
|
|
import { RequiredValidator } from '@msfa-utils/validators/required.validator';
|
|
|
|
import { RequiredValidator } from '@msfa-utils/validators/required.validator';
|
|
|
|
|
|
|
|
import { SelectOption } from '@ui/select/select-option.model';
|
|
|
|
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
|
|
|
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
|
|
|
import { map, shareReplay, switchMap, take } from 'rxjs/operators';
|
|
|
|
import { map, shareReplay, switchMap, take } from 'rxjs/operators';
|
|
|
|
import { InformativRapportFormData } from './informativ-rapport-form.model';
|
|
|
|
import { InformativRapportFormData } from './informativ-rapport-form.model';
|
|
|
|
import { InformativRapportFormService } from './informativ-rapport-form.service';
|
|
|
|
import { InformativRapportFormService } from './informativ-rapport-form.service';
|
|
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
selector: 'msfa-informativ-rapport-form',
|
|
|
|
selector: 'msfa-informativ-rapport-form',
|
|
|
|
@@ -23,6 +25,7 @@ import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
export class InformativRapportFormComponent {
|
|
|
|
export class InformativRapportFormComponent {
|
|
|
|
|
|
|
|
private _activeFeatures = environment.activeFeatures;
|
|
|
|
categoryDocumentSelected = false;
|
|
|
|
categoryDocumentSelected = false;
|
|
|
|
shouldValidate$ = new BehaviorSubject<boolean>(false);
|
|
|
|
shouldValidate$ = new BehaviorSubject<boolean>(false);
|
|
|
|
confirmDialogOpen$ = new BehaviorSubject<boolean>(false);
|
|
|
|
confirmDialogOpen$ = new BehaviorSubject<boolean>(false);
|
|
|
|
@@ -43,7 +46,9 @@ export class InformativRapportFormComponent {
|
|
|
|
comment: new FormControl('', [RequiredValidator('Kompletterande information är obligatoriskt')]),
|
|
|
|
comment: new FormControl('', [RequiredValidator('Kompletterande information är obligatoriskt')]),
|
|
|
|
file: new FormControl(null),
|
|
|
|
file: new FormControl(null),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
categorySelectItems: SelectOption[] = Object.entries(InformativRapportCategory).map(([value, name]) => ({
|
|
|
|
categorySelectItems: SelectOption[] = Object.entries(InformativRapportCategory)
|
|
|
|
|
|
|
|
.filter(([_, name]) => (name === InformativRapportCategory.dokument ? this.fileUploadActive : true))
|
|
|
|
|
|
|
|
.map(([value, name]) => ({
|
|
|
|
name,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
value,
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
@@ -71,6 +76,10 @@ export class InformativRapportFormComponent {
|
|
|
|
return this.informativRapportFormGroup.get('file') as FormControl;
|
|
|
|
return this.informativRapportFormGroup.get('file') as FormControl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get fileUploadActive(): boolean {
|
|
|
|
|
|
|
|
return this._activeFeatures.includes(Feature.REPORTING_INFORMATIV_RAPPORT_FILE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private _formDataToSubmitData(
|
|
|
|
private _formDataToSubmitData(
|
|
|
|
genomforandeReferens: number,
|
|
|
|
genomforandeReferens: number,
|
|
|
|
formData: InformativRapportFormData
|
|
|
|
formData: InformativRapportFormData
|
|
|
|
|