From 92cf04e802cce05c1ed799cabfabf73b1c370c0c Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Wed, 15 Dec 2021 10:45:43 +0100 Subject: [PATCH] fix(informativ-rapport): Added file-upload inside informativ-rapport to feature toggling --- .../informativ-rapport-form.component.html | 2 +- .../informativ-rapport-form.component.ts | 21 +++++++++++++------ .../src/app/shared/enums/feature.enum.ts | 1 + .../src/environments/active-features.ts | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.html b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.html index fc8228e..259b2ba 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.html +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.html @@ -61,7 +61,7 @@ > (false); confirmDialogOpen$ = new BehaviorSubject(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 = this.informativRapportFormGroup .valueChanges as Observable; @@ -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 diff --git a/apps/mina-sidor-fa/src/app/shared/enums/feature.enum.ts b/apps/mina-sidor-fa/src/app/shared/enums/feature.enum.ts index 7806706..2962d0b 100644 --- a/apps/mina-sidor-fa/src/app/shared/enums/feature.enum.ts +++ b/apps/mina-sidor-fa/src/app/shared/enums/feature.enum.ts @@ -15,6 +15,7 @@ export enum Feature { REPORTING_SIGNAL, REPORTING_PERIODISK_REDOVISNING, REPORTING_INFORMATIV_RAPPORT, + REPORTING_INFORMATIV_RAPPORT_FILE, REPORTING_SLUTREDOVISNING, EXPORTS, NEWS, diff --git a/apps/mina-sidor-fa/src/environments/active-features.ts b/apps/mina-sidor-fa/src/environments/active-features.ts index 0dd5b11..8a8f5b6 100644 --- a/apps/mina-sidor-fa/src/environments/active-features.ts +++ b/apps/mina-sidor-fa/src/environments/active-features.ts @@ -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,