diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.html b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.html new file mode 100644 index 0000000..fa851e2 --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.html @@ -0,0 +1,19 @@ +
+
Namn
+
{{avrop.fullName}}
+
Personnummer
+
+ +
+
Tjänst
+
{{avrop.tjanst}}
+
Startdatum
+
+ +
+
Slutdatum
+
+ +
+ +
diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.scss b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.spec.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.spec.ts new file mode 100644 index 0000000..f5619ff --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ReportDescriptionListComponent } from './report-description-list.component'; +import { ReportDescriptionListModule } from './report-description-list.module'; + +describe('ReportDescriptionListComponent', () => { + let component: ReportDescriptionListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ReportDescriptionListModule], + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ReportDescriptionListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.ts new file mode 100644 index 0000000..a081993 --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.component.ts @@ -0,0 +1,12 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Avrop } from '@msfa-models/avrop.model'; + +@Component({ + selector: 'msfa-report-description-list', + templateUrl: './report-description-list.component.html', + styleUrls: ['./report-description-list.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class ReportDescriptionListComponent { + @Input() avrop: Avrop; +} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.module.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.module.ts new file mode 100644 index 0000000..6aa08ad --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-description-list/report-description-list.module.ts @@ -0,0 +1,12 @@ +import { CommonModule } from '@angular/common'; +import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; +import { HideTextModule } from '@msfa-shared/components/hide-text/hide-text.module'; +import { ReportDescriptionListComponent } from './report-description-list.component'; + +@NgModule({ + schemas: [CUSTOM_ELEMENTS_SCHEMA], + declarations: [ReportDescriptionListComponent], + imports: [CommonModule, HideTextModule], + exports: [ReportDescriptionListComponent], +}) +export class ReportDescriptionListModule {} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.html b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.html index f5ee58d..3d09270 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.html +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.html @@ -2,50 +2,7 @@

{{ reportTitle }}

{{description}}

-
-

{{reportSubTitle}}

-
-
Namn
-
{{avrop.fullName}}
-
Personnummer
-
- -
-
Tjänst
-
{{avrop.tjanst}}
- -
Startdatum
-
- -
-
Slutdatum
-
- -
-
- -
Avser period
-
- - - - -
-
-
-
- -
- -
- +
diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.scss b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.scss index 50fcefa..e69de29 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.scss +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.scss @@ -1,16 +0,0 @@ -@import 'variables/z-index'; -@import 'apps/mina-sidor-fa/src/styles/variables/gutters'; - -.report-layout { - &__notification-alert { - margin-bottom: $digi--layout--gutter--xl; - } - - &__progress-bar { - margin: $digi--layout--gutter--xl 0; - } - - &__progress-bar { - z-index: $msfa__z-index-default; - } -} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.spec.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.spec.ts index 897ed41..e4b5244 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.spec.ts +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.spec.ts @@ -1,8 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReportLayoutComponent } from './report-layout.component'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ReportLayoutModule } from './report-layout.module'; -import { RouterTestingModule } from '@angular/router/testing'; describe('ReportLayoutComponent', () => { let component: ReportLayoutComponent; @@ -10,7 +8,7 @@ describe('ReportLayoutComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ReportLayoutModule, RouterTestingModule, HttpClientTestingModule], + imports: [ReportLayoutModule], }).compileComponents(); }); diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.ts index bd7fd92..e56c875 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.ts +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.component.ts @@ -13,11 +13,5 @@ export class ReportLayoutComponent { @Input() description: string; @Input() startDate: string; @Input() endDate: string; - @Input() service: string; - @Input() isPeriodDate = false; @Input() avrop: Avrop; - @Input() totalAmountOfSteps: number; - @Input() currentStep: number; - @Input() showSuccessNotification = false; - @Input() showDangerNotification = false; } diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.module.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.module.ts index 6623ece..bd22681 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.module.ts +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/components/report-layout/report-layout.module.ts @@ -1,15 +1,13 @@ -import { DigiNgProgressProgressbarModule } from '@af/digi-ng/_progress/progressbar'; import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; -import { HideTextModule } from '@msfa-shared/components/hide-text/hide-text.module'; import { LayoutModule } from '@msfa-shared/components/layout/layout.module'; +import { ReportDescriptionListModule } from '../report-description-list/report-description-list.module'; import { ReportLayoutComponent } from './report-layout.component'; @NgModule({ schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [ReportLayoutComponent], - imports: [CommonModule, RouterModule, LayoutModule, DigiNgProgressProgressbarModule, HideTextModule], + imports: [CommonModule, LayoutModule, ReportDescriptionListModule], exports: [ReportLayoutComponent], }) export class ReportLayoutModule {} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/deltagare-details.module.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/deltagare-details.module.ts index eaecb2c..ce5d69d 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/deltagare-details.module.ts +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/deltagare-details.module.ts @@ -90,6 +90,16 @@ activeFeatures.forEach(feature => { loadChildren: () => import('./pages/report-forms/signal-form/signal-form.module').then(m => m.SignalFormModule), }); break; + case Feature.REPORTING_INFORMATIV_RAPPORT: + routes.push({ + path: 'informativ-rapport', + data: { title: 'Skapa Informativ rapport' }, + loadChildren: () => + import('./pages/report-forms/informativ-rapport-form/informativ-rapport-form.module').then( + m => m.InformativRapportFormModule + ), + }); + break; default: break; } diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/deltagare-card/components/deltagare-tab-reports/deltagare-tab-reports.component.html b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/deltagare-card/components/deltagare-tab-reports/deltagare-tab-reports.component.html index b516de9..03f4f26 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/deltagare-card/components/deltagare-tab-reports/deltagare-tab-reports.component.html +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/deltagare-card/components/deltagare-tab-reports/deltagare-tab-reports.component.html @@ -38,6 +38,13 @@ afText="Signal om arbete eller studier" > +
  • + +
  • diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/deltagare-card/components/deltagare-tab-reports/deltagare-tab-reports.component.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/deltagare-card/components/deltagare-tab-reports/deltagare-tab-reports.component.ts index aa7589d..f9fece8 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/deltagare-card/components/deltagare-tab-reports/deltagare-tab-reports.component.ts +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/deltagare-card/components/deltagare-tab-reports/deltagare-tab-reports.component.ts @@ -21,6 +21,9 @@ export class DeltagareTabReportsComponent { get periodiskRedovisningButtonVisible(): boolean { return this._activeFeatures.includes(Feature.REPORTING_PERIODISK_REDOVISNING); } + get informativRapportButtonVisible(): boolean { + return this._activeFeatures.includes(Feature.REPORTING_INFORMATIV_RAPPORT); + } emitNewPage(page: number): void { this.reportsPaginated.emit(page); diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/avvikelse-report-form/avvikelse-report-form.component.html b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/avvikelse-report-form/avvikelse-report-form.component.html index b074dbd..978fc0b 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/avvikelse-report-form/avvikelse-report-form.component.html +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/avvikelse-report-form/avvikelse-report-form.component.html @@ -96,27 +96,7 @@ id="confirmAvvikelserapport" > -
    -
    Namn
    -
    {{avrop.fullName}}
    -
    Personnummer
    -
    - -
    -
    Tjänst
    -
    {{avrop.tjanst}}
    -
    Startdatum
    -
    - -
    -
    Slutdatum
    -
    - -
    +
    Orsak till avvikelse:
    {{(chosenReason$ | async)?.name }}
    @@ -127,7 +107,7 @@
    Dag för avvikelse:
    {{avvikelseSubmitData.avvikelseAlternativ.rapporteringsdatum }}
    -
    + -
    -
    Namn
    -
    {{avrop.fullName}}
    -
    Personnummer
    -
    - -
    -
    Tjänst
    -
    {{avrop.tjanst}}
    -
    Startdatum
    -
    - -
    -
    Slutdatum
    -
    - -
    -
    Orsak till frånvaro
    -
    {{getReasonNameFromValue(reasons, reasonFormControl.value)}}
    - - -
    Annan känd orsak
    -
    {{getReasonNameFromValue(otherKnownReasons, otherKnownReasonFormControl.value)}}
    + + +
    Orsak till frånvaro
    +
    {{getReasonNameFromValue(reasons, reasonFormControl.value)}}
    + + +
    Annan känd orsak
    +
    {{getReasonNameFromValue(otherKnownReasons, otherKnownReasonFormControl.value)}}
    +
    + +
    Beskrivning för frånvaro
    +
    {{knownReasonCommentFormControl.value}}
    +
    - -
    Beskrivning för frånvaro
    -
    {{knownReasonCommentFormControl.value}}
    +
    Dag för frånvaro
    +
    + +
    +
    Heldag eller del av dag
    +
    {{dayOrPartOfDayFromValue}}
    + +
    Tid för frånvaro
    +
    {{startTimeFormControl.value}} - {{endTimeFormControl.value}}
    +
    Tid för förväntad närvaro
    +
    {{expectedPresenceStartTimeFormControl.value}} - {{expectedPresenceEndTimeFormControl.value}}
    -
    Dag för frånvaro
    -
    - -
    -
    Heldag eller del av dag
    -
    {{dayOrPartOfDayFromValue}}
    - -
    Tid för frånvaro
    -
    {{startTimeFormControl.value}} - {{endTimeFormControl.value}}
    -
    -
    Tid för förväntad närvaro
    -
    {{expectedPresenceStartTimeFormControl.value}} - {{expectedPresenceEndTimeFormControl.value}}
    -
    + -
    -
    Namn
    -
    {{avrop.fullName}}
    -
    Personnummer
    -
    - -
    -
    Tjänst
    -
    {{avrop.tjanst}}
    -
    Startdatum
    -
    - -
    -
    Slutdatum
    -
    - -
    +
    Deltar arbetssökande på distans?
    {{gpFormGroup.value.distance ? 'Ja' : 'Nej'}}
    Aktiviteter
    @@ -138,7 +118,7 @@ -
    + + +
    +
    + +

    Informativ rapport för deltagare {{avrop.fullName}} är nu inskickad till Arbetsförmedlingen.

    +
    +
    Datum
    +
    + {{lastSubmittedInformativRapport | date:'longDate'}} kl {{lastSubmittedInformativRapport | + date:'shortTime'}} +
    +
    +
    + Tillbaka till deltagaren +
    + + +
    +
    +
    + + + + Info + om kategorierna + +
    + +
    +
    + +
    + +
    +
    + Förhandsgranska + + Avbryt +  och gå tillbaka till deltagaren + +
    +
    + + + + + +
    Vad gäller ärendet
    +
    {{getInformativRapportCategory(submitData.category)}}
    +
    Kompletterande information
    +
    {{submitData.comment}}
    +
    +
    + +

    Kunde inte spara Informativ rapport. Ladda om sidan och försök igen.

    +

    {{error.message}}

    +
    +
    + + +

    Behov av annan insats

    +

    + Informera om att deltagaren kan behöva en arbetsmarknadspolitisk insats, exempelvis utbildning, + yrkessvenska, karriärvägledning, studiemotiverande folkhögskoleutbildning, praktik med mera. +

    +

    Behov av hjälpmedel

    +

    + Informera om att deltagare med funktionsnedsättning har behov av hjälpmedel under tjänsten, som vi som + leverantör inte kan tillhandahålla. +

    +

    Behov av teckenspråkstolk

    +

    Informera om att deltagare har behov av teckenspråkstolk.

    +

    Behov av dialog med Arbetsförmedlingen

    +

    + Informera om att det behövs dialog gällande deltagarens ärende, exempelvis inför eventuellt + stöd/anpassning eller hälsa. +

    +
    +
    +
    +
    +
    + + + + + + + + + diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.scss b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.scss new file mode 100644 index 0000000..3c61000 --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.scss @@ -0,0 +1,64 @@ +@import 'variables/gutters'; +@import 'variables/z-index'; + +.informativ-rapport-form { + max-width: var(--digi--typography--text--max-width); + + &__confirmation, + &__warning, + &__form { + display: flex; + flex-direction: column; + gap: $digi--layout--gutter--l; + } + + &__label-wrapper { + display: flex; + gap: var(--digi--layout--gutter); + padding-bottom: var(--digi--layout--gutter--s); + + label { + font-weight: var(--digi--typography--font-weight--semibold); + cursor: pointer; + } + } + + &__category-information-button { + ::ng-deep .digi-button { + padding: 0; + + &__icon { + margin-right: var(--digi--layout--gutter--xs); + } + } + } + &__category-information-icon { + width: 1.25em; + } + + &__category-select { + ::ng-deep .digi-ng-form-select__label { + display: none; + } + } + + &__footer { + display: flex; + flex-direction: column; + gap: var(--digi--layout--gutter); + } + + &__cta-wrapper { + display: flex; + gap: var(--digi--layout--gutter); + } + + &__validation-message { + margin-top: var(--digi--layout--gutter--s); + } + + &__percent-range { + max-width: 20rem; + display: block; + } +} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.spec.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.spec.ts new file mode 100644 index 0000000..c4fbf12 --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.spec.ts @@ -0,0 +1,33 @@ +import { DigiNgFormRadiobuttonGroupModule } from '@af/digi-ng/_form/form-radiobutton-group'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { RouterTestingModule } from '@angular/router/testing'; +import { LayoutComponent } from '@msfa-shared/components/layout/layout.component'; +import { InformativRapportFormComponent } from './informativ-rapport-form.component'; +import { InformativRapportFormService } from './informativ-rapport-form.service'; + +describe('InformativRapportFormComponent', () => { + let component: InformativRapportFormComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + schemas: [CUSTOM_ELEMENTS_SCHEMA], + declarations: [InformativRapportFormComponent, LayoutComponent], + imports: [RouterTestingModule, HttpClientTestingModule, ReactiveFormsModule, DigiNgFormRadiobuttonGroupModule], + providers: [InformativRapportFormService], + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(InformativRapportFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.ts new file mode 100644 index 0000000..e88acd0 --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.component.ts @@ -0,0 +1,130 @@ +import { FormSelectItem } from '@af/digi-ng/_form/form-select'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { FormControl, FormGroup } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; +import { InformativRapportCategory, InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum'; +import { InformativRapportRequest } from '@msfa-models/api/informativ-rapport.request.model'; +import { Avrop } from '@msfa-models/avrop.model'; +import { CustomError } from '@msfa-models/error/custom-error'; +import { RequiredValidator } from '@msfa-utils/validators/required.validator'; +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'; + +@Component({ + selector: 'msfa-informativ-rapport-form', + templateUrl: './informativ-rapport-form.component.html', + styleUrls: ['./informativ-rapport-form.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class InformativRapportFormComponent { + shouldValidate$ = new BehaviorSubject(false); + confirmDialogOpen$ = new BehaviorSubject(false); + categoryInformationDialogOpen$ = new BehaviorSubject(false); + submitLoading$ = new BehaviorSubject(false); + lastSubmittedInformativRapport$ = new BehaviorSubject(null); + submitError$ = new BehaviorSubject(null); + genomforandeReferens$: Observable = this.activatedRoute.params.pipe( + map(params => +params.genomforandeReferens) + ); + avrop$: Observable = this.genomforandeReferens$.pipe( + switchMap(genomforandeReferens => this.informativRapportFormService.fetchAvropInformation$(genomforandeReferens)), + shareReplay(1) + ); + + informativRapportFormGroup = new FormGroup({ + category: new FormControl(null, [RequiredValidator('Ett ärende måste väljas')]), + comment: new FormControl('', [RequiredValidator('Kompletterande information är obligatoriskt')]), + }); + categorySelectItems: FormSelectItem[] = Object.entries(InformativRapportCategory).map(([value, name]) => ({ + name, + value, + })); + + formData$: Observable = this.informativRapportFormGroup + .valueChanges as Observable; + + submitData$ = combineLatest([this.genomforandeReferens$, this.formData$]).pipe( + map(([genomforandeReferens, formData]) => this._formDataToSubmitData(genomforandeReferens, formData)), + shareReplay(1) + ); + constructor( + private informativRapportFormService: InformativRapportFormService, + private activatedRoute: ActivatedRoute + ) {} + + get categoryFormControl(): FormControl { + return this.informativRapportFormGroup.get('category') as FormControl; + } + get commentFormControl(): FormControl { + return this.informativRapportFormGroup.get('comment') as FormControl; + } + + private _formDataToSubmitData( + genomforandeReferens: number, + formData: InformativRapportFormData + ): InformativRapportRequest { + const { category, comment } = formData; + return { + genomforandeReferens, + category, + comment, + }; + } + + private _markFormAsTouchedAndDirty(): void { + this.informativRapportFormGroup.markAllAsTouched(); + this.commentFormControl.markAsDirty(); + this.categoryFormControl.markAsDirty(); + } + + getInformativRapportCategory(category: InformativRapportCategoryKey): InformativRapportCategory { + return InformativRapportCategory[category] as InformativRapportCategory; + } + + formControlIsInvalid(formControlName: string): boolean { + return this.informativRapportFormGroup.get(formControlName).errors && this.shouldValidate$.getValue(); + } + + openCategoryInformationDialog(): void { + this.categoryInformationDialogOpen$.next(true); + } + + closeCategoryInformationDialog(): void { + this.categoryInformationDialogOpen$.next(false); + } + + openConfirmDialog(): void { + this.shouldValidate$.next(true); + this._markFormAsTouchedAndDirty(); + if (this.informativRapportFormGroup.invalid) { + return; + } + + this.confirmDialogOpen$.next(true); + } + + cancelConfirmDialog(): void { + this.confirmDialogOpen$.next(false); + this.submitError$.next(null); + } + + submitAndCloseConfirmDialog(): void { + this.submitLoading$.next(true); + this.submitData$.pipe(take(1)).subscribe(submitData => + this.informativRapportFormService.postInformativRapport$(submitData).subscribe({ + next: () => { + this.submitLoading$.next(false); + this.lastSubmittedInformativRapport$.next(new Date()); + this.confirmDialogOpen$.next(false); + }, + error: (customError: CustomError) => { + this.submitError$.next({ ...customError, message: customError.error.message }); + this.submitLoading$.next(false); + throw { ...customError, avoidToast: true }; + }, + }) + ); + } +} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.model.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.model.ts new file mode 100644 index 0000000..18d5e3b --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.model.ts @@ -0,0 +1,6 @@ +import { InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum'; + +export interface InformativRapportFormData { + category: InformativRapportCategoryKey; + comment: string; +} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.module.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.module.ts new file mode 100644 index 0000000..550140d --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.module.ts @@ -0,0 +1,37 @@ +import { DigiNgDialogModule } from '@af/digi-ng/_dialog/dialog'; +import { DigiNgFormSelectModule } from '@af/digi-ng/_form/form-select'; +import { DigiNgFormTextareaModule } from '@af/digi-ng/_form/form-textarea'; +import { DigiNgSkeletonBaseModule } from '@af/digi-ng/_skeleton/skeleton-base'; +import { CommonModule } from '@angular/common'; +import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; +import { ReactiveFormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; +import { BackLinkModule } from '@msfa-shared/components/back-link/back-link.module'; +import { ConfirmDialogModule } from '@msfa-shared/components/confirm-dialog/confirm-dialog.module'; +import { LayoutModule } from '@msfa-shared/components/layout/layout.module'; +import { ReportDescriptionListModule } from '../../../components/report-description-list/report-description-list.module'; +import { ReportLayoutModule } from '../../../components/report-layout/report-layout.module'; +import { InformativRapportFormComponent } from './informativ-rapport-form.component'; +import { InformativRapportFormService } from './informativ-rapport-form.service'; + +@NgModule({ + schemas: [CUSTOM_ELEMENTS_SCHEMA], + declarations: [InformativRapportFormComponent], + imports: [ + CommonModule, + RouterModule.forChild([{ path: '', component: InformativRapportFormComponent }]), + LayoutModule, + ReactiveFormsModule, + ReportLayoutModule, + ConfirmDialogModule, + ReportDescriptionListModule, + BackLinkModule, + DigiNgSkeletonBaseModule, + DigiNgDialogModule, + DigiNgFormSelectModule, + DigiNgFormTextareaModule, + ], + providers: [InformativRapportFormService], + exports: [InformativRapportFormComponent], +}) +export class InformativRapportFormModule {} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.service.ts b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.service.ts new file mode 100644 index 0000000..18a9b1b --- /dev/null +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/informativ-rapport-form/informativ-rapport-form.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { InformativRapportRequest } from '@msfa-models/api/informativ-rapport.request.model'; +import { Avrop } from '@msfa-models/avrop.model'; +import { DeltagareApiService } from '@msfa-services/api/deltagare.api.service'; +import { InformativRapportApiService } from '@msfa-services/api/informativ-rapport.api.service'; +import { Observable } from 'rxjs'; + +@Injectable() +export class InformativRapportFormService { + constructor( + private informativRapportApiService: InformativRapportApiService, + private deltagareApiService: DeltagareApiService + ) {} + + public postInformativRapport$(requestData: InformativRapportRequest): Observable { + return this.informativRapportApiService.postInformativRapport$(requestData); + } + + public fetchAvropInformation$(genomforandeReferens: number): Observable { + return this.deltagareApiService.fetchAvropInformation$(genomforandeReferens); + } +} diff --git a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/periodisk-redovisning-form/periodisk-redovisning-form.component.html b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/periodisk-redovisning-form/periodisk-redovisning-form.component.html index c66cb9f..bf114cd 100644 --- a/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/periodisk-redovisning-form/periodisk-redovisning-form.component.html +++ b/apps/mina-sidor-fa/src/app/pages/deltagare/pages/deltagare-details/pages/report-forms/periodisk-redovisning-form/periodisk-redovisning-form.component.html @@ -36,6 +36,7 @@ [afSelectItems]="periodsToFormselectItems(periods)" [afDisableValidStyle]="true" [afRequired]="true" + [afAnnounceIfOptional]="true" [formControl]="periodFormControl" [afInvalid]="formControlIsInvalid(periodFormControl)" (afOnChange)="openChangePeriodDialogIfValuesExist()" @@ -182,27 +183,7 @@ id="confirm-periodisk-redovisning-form" > -
    -
    Namn
    -
    {{avrop.fullName}}
    -
    Personnummer
    -
    - -
    -
    Tjänst
    -
    {{avrop.tjanst}}
    -
    Startdatum
    -
    - -
    -
    Slutdatum
    -
    - -
    +
    Har ni under perioden tillhandahållit språkstöd till deltagaren:
    {{submitData.hasOfferedLanguageSupport ? 'Ja' : 'Nej' }}
    @@ -228,7 +209,7 @@
    -
    + -
    +
    Typ av sysselsättning
    {{typeFormControl.value}}
    Omfattning
    @@ -134,7 +134,7 @@
    Startdatum
    -
    + diff --git a/apps/mina-sidor-fa/src/app/shared/constants/navigation.ts b/apps/mina-sidor-fa/src/app/shared/constants/navigation.ts index df7f277..1b3efbf 100644 --- a/apps/mina-sidor-fa/src/app/shared/constants/navigation.ts +++ b/apps/mina-sidor-fa/src/app/shared/constants/navigation.ts @@ -4,6 +4,7 @@ export const DELTAGARE_REPORTING_ROUTES = { franvarorapport: 'Avvikelserapport (frånvaro)', avvikelserapport: 'Avvikelserapport (avvikelse)', signal: 'Signal om arbete eller studier', + 'informativ-rapport': 'Informativ rapport', }; export const NAVIGATION = { 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 0cf775f..95a9312 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 @@ -14,4 +14,5 @@ export enum Feature { REPORTING, REPORTING_SIGNAL, REPORTING_PERIODISK_REDOVISNING, + REPORTING_INFORMATIV_RAPPORT, } diff --git a/apps/mina-sidor-fa/src/app/shared/enums/informativ-rapport-category.enum.ts b/apps/mina-sidor-fa/src/app/shared/enums/informativ-rapport-category.enum.ts new file mode 100644 index 0000000..cf2dd38 --- /dev/null +++ b/apps/mina-sidor-fa/src/app/shared/enums/informativ-rapport-category.enum.ts @@ -0,0 +1,8 @@ +export enum InformativRapportCategory { + annan_insats = 'Behov av annan insats', + hjalpmedel = 'Behov av hjälpmedel', + teckensprakstolk = 'Behov av teckenspråkstolk', + dialog = 'Behov av dialog med Arbetsförmedlingen', +} + +export type InformativRapportCategoryKey = keyof InformativRapportCategory; diff --git a/apps/mina-sidor-fa/src/app/shared/models/api/informativ-rapport.request.model.ts b/apps/mina-sidor-fa/src/app/shared/models/api/informativ-rapport.request.model.ts new file mode 100644 index 0000000..bcbd643 --- /dev/null +++ b/apps/mina-sidor-fa/src/app/shared/models/api/informativ-rapport.request.model.ts @@ -0,0 +1,6 @@ +import { InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum'; +export interface InformativRapportRequest { + genomforandeReferens: number; + category: InformativRapportCategoryKey; + comment: string; +} diff --git a/apps/mina-sidor-fa/src/app/shared/models/api/informativ-rapport.response.model.ts b/apps/mina-sidor-fa/src/app/shared/models/api/informativ-rapport.response.model.ts new file mode 100644 index 0000000..40abf2c --- /dev/null +++ b/apps/mina-sidor-fa/src/app/shared/models/api/informativ-rapport.response.model.ts @@ -0,0 +1,6 @@ +import { InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum'; + +export interface InformativRapportResponse { + category: InformativRapportCategoryKey; + comment: string; +} diff --git a/apps/mina-sidor-fa/src/app/shared/models/informativ-rapport.model.ts b/apps/mina-sidor-fa/src/app/shared/models/informativ-rapport.model.ts new file mode 100644 index 0000000..bc1269e --- /dev/null +++ b/apps/mina-sidor-fa/src/app/shared/models/informativ-rapport.model.ts @@ -0,0 +1,16 @@ +import { InformativRapportCategory } from '@msfa-enums/informativ-rapport-category.enum'; +import { InformativRapportResponse } from './api/informativ-rapport.response.model'; + +export interface InformativRapport { + category: InformativRapportCategory; + comment: string; +} + +export function mapResponseToInformativRapport(data: InformativRapportResponse): InformativRapport { + const { category, comment } = data; + + return { + category: InformativRapportCategory[category] as InformativRapportCategory, + comment: comment, + }; +} diff --git a/apps/mina-sidor-fa/src/app/shared/services/api/informativ-rapport.api.service.ts b/apps/mina-sidor-fa/src/app/shared/services/api/informativ-rapport.api.service.ts new file mode 100644 index 0000000..95b8dda --- /dev/null +++ b/apps/mina-sidor-fa/src/app/shared/services/api/informativ-rapport.api.service.ts @@ -0,0 +1,29 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { ErrorType } from '@msfa-enums/error-type.enum'; +import { environment } from '@msfa-environment'; +import { InformativRapportRequest } from '@msfa-models/api/informativ-rapport.request.model'; +import { CustomError } from '@msfa-models/error/custom-error'; +import { Observable } from 'rxjs'; +import { catchError } from 'rxjs/operators'; + +@Injectable({ + providedIn: 'root', +}) +export class InformativRapportApiService { + private _apiBaseUrl = `${environment.api.url}/rapporter/informativ-rapport`; + + public postInformativRapport$(requestData: InformativRapportRequest): Observable { + return this.httpClient.post(this._apiBaseUrl, requestData).pipe( + catchError((error: Error) => { + throw new CustomError({ + error, + message: `Kunde inte spara Informativ rapport.\n\n${error.message}`, + type: ErrorType.API, + }); + }) + ); + } + + constructor(private httpClient: HttpClient) {} +} diff --git a/apps/mina-sidor-fa/src/app/shared/utils/validators/required.validator.ts b/apps/mina-sidor-fa/src/app/shared/utils/validators/required.validator.ts index 5983d82..90f2a8f 100644 --- a/apps/mina-sidor-fa/src/app/shared/utils/validators/required.validator.ts +++ b/apps/mina-sidor-fa/src/app/shared/utils/validators/required.validator.ts @@ -7,6 +7,7 @@ export function RequiredValidator(message = 'Fältet är obligatoriskt'): Valida if ( control.value === null || control.value === undefined || + control.value === '' || (Array.isArray(control.value) && !control.value.length) ) { return { required: message }; diff --git a/apps/mina-sidor-fa/src/environments/active-features.ts b/apps/mina-sidor-fa/src/environments/active-features.ts index 597bee8..bf664f0 100644 --- a/apps/mina-sidor-fa/src/environments/active-features.ts +++ b/apps/mina-sidor-fa/src/environments/active-features.ts @@ -24,4 +24,5 @@ export const ACTIVE_FEATURES_TEST: Feature[] = [ Feature.RELEASES, Feature.VERSION_INFO, Feature.REPORTING_PERIODISK_REDOVISNING, + Feature.REPORTING_INFORMATIV_RAPPORT, ];