fix(informativ-rapport): Added file-upload inside informativ-rapport to feature toggling
This commit is contained in:
+1
-1
@@ -61,7 +61,7 @@
|
||||
></ui-select>
|
||||
<ng-container *ngIf="formData$ | async as formData">
|
||||
<ui-file-upload
|
||||
*ngIf="formData.category === 'dokument'"
|
||||
*ngIf="fileUploadActive && formData.category === 'dokument'"
|
||||
ngDefaultControl
|
||||
[formControl]="fileFormControl"
|
||||
uiId="informativRapportFileUpload"
|
||||
|
||||
+15
-6
@@ -1,8 +1,10 @@
|
||||
import { SelectOption } from '@ui/select/select-option.model';
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Feature } from '@msfa-enums/feature.enum';
|
||||
import { InformativRapportCategory, InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum';
|
||||
import { environment } from '@msfa-environment';
|
||||
import {
|
||||
InformativRapportRequest,
|
||||
InformativRapportWithFileRequest,
|
||||
@@ -10,11 +12,11 @@ import {
|
||||
import { DeltagareAvrop } from '@msfa-models/avrop.model';
|
||||
import { CustomError } from '@msfa-models/error/custom-error';
|
||||
import { RequiredValidator } from '@msfa-utils/validators/required.validator';
|
||||
import { SelectOption } from '@ui/select/select-option.model';
|
||||
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
||||
import { map, shareReplay, switchMap, take } from 'rxjs/operators';
|
||||
import { InformativRapportFormData } from './informativ-rapport-form.model';
|
||||
import { InformativRapportFormService } from './informativ-rapport-form.service';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
@Component({
|
||||
selector: 'msfa-informativ-rapport-form',
|
||||
@@ -23,6 +25,7 @@ import { DomSanitizer } from '@angular/platform-browser';
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class InformativRapportFormComponent {
|
||||
private _activeFeatures = environment.activeFeatures;
|
||||
categoryDocumentSelected = false;
|
||||
shouldValidate$ = new BehaviorSubject<boolean>(false);
|
||||
confirmDialogOpen$ = new BehaviorSubject<boolean>(false);
|
||||
@@ -43,10 +46,12 @@ export class InformativRapportFormComponent {
|
||||
comment: new FormControl('', [RequiredValidator('Kompletterande information är obligatoriskt')]),
|
||||
file: new FormControl(null),
|
||||
});
|
||||
categorySelectItems: SelectOption[] = Object.entries(InformativRapportCategory).map(([value, name]) => ({
|
||||
name,
|
||||
value,
|
||||
}));
|
||||
categorySelectItems: SelectOption[] = Object.entries(InformativRapportCategory)
|
||||
.filter(([_, name]) => (name === InformativRapportCategory.dokument ? this.fileUploadActive : true))
|
||||
.map(([value, name]) => ({
|
||||
name,
|
||||
value,
|
||||
}));
|
||||
|
||||
formData$: Observable<InformativRapportFormData> = this.informativRapportFormGroup
|
||||
.valueChanges as Observable<InformativRapportFormData>;
|
||||
@@ -71,6 +76,10 @@ export class InformativRapportFormComponent {
|
||||
return this.informativRapportFormGroup.get('file') as FormControl;
|
||||
}
|
||||
|
||||
get fileUploadActive(): boolean {
|
||||
return this._activeFeatures.includes(Feature.REPORTING_INFORMATIV_RAPPORT_FILE);
|
||||
}
|
||||
|
||||
private _formDataToSubmitData(
|
||||
genomforandeReferens: number,
|
||||
formData: InformativRapportFormData
|
||||
|
||||
@@ -15,6 +15,7 @@ export enum Feature {
|
||||
REPORTING_SIGNAL,
|
||||
REPORTING_PERIODISK_REDOVISNING,
|
||||
REPORTING_INFORMATIV_RAPPORT,
|
||||
REPORTING_INFORMATIV_RAPPORT_FILE,
|
||||
REPORTING_SLUTREDOVISNING,
|
||||
EXPORTS,
|
||||
NEWS,
|
||||
|
||||
@@ -29,6 +29,7 @@ export const ACTIVE_FEATURES_TEST: Feature[] = [
|
||||
Feature.VERSION_INFO,
|
||||
Feature.REPORTING_PERIODISK_REDOVISNING,
|
||||
Feature.REPORTING_INFORMATIV_RAPPORT,
|
||||
Feature.REPORTING_INFORMATIV_RAPPORT_FILE,
|
||||
Feature.REPORTING_SLUTREDOVISNING,
|
||||
Feature.REPORTING_SIGNAL,
|
||||
Feature.EXPORTS,
|
||||
|
||||
Reference in New Issue
Block a user