feat(avvikelserapport): implementerat report layout för avvikelserapport. TV-667
Squashed commit of the following: commit 4ef5359297295bce54df281081c3f44f690cadab Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Thu Sep 23 09:11:15 2021 +0200 TV-667 changed names, cleanup commit 4e2354ee25a11543b22ac74783989110cbc3c788 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Thu Sep 23 08:50:52 2021 +0200 TV-667 removed unused enum commit fb393aa61617892f9ebe8af67963aa9ed21d391e Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Thu Sep 23 08:20:09 2021 +0200 TV-667 removed test api url commit aadf97ef0d05915a72bdc1c95df10f8d8d932e2c Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Thu Sep 23 08:09:13 2021 +0200 TV-667 show dynamic name for notification alert commit e5453f0f5ee3fb9706817cd208f797688fb453f7 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Thu Sep 23 00:25:10 2021 +0200 TV-667 restructoring report layout commit f68e5bf2675dee5e8ae7c0d06f24389d8efddf25 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 22 17:40:49 2021 +0200 TV-667 updated path for report layout module commit d2273a38304a457b3015dd086e93fc7d8d0d07ea Merge: c9da568 3f7663a Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 22 17:38:14 2021 +0200 Merge branch 'feature/TV-633' into feature/TV-667 commit c9da568ecc950718f7d1f9d28e80ae18ebbf0994 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 22 17:30:43 2021 +0200 TV-667 implementerat report layout i avvikelserapporten commit 3f7663a48b2f556c36752ab443754070136f2d6e Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 22 16:46:44 2021 +0200 TV-633 confirm dialog for reports commit 32c1d194e9266100e70f5440b6bc62e40ed05d9d Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Tue Sep 21 18:02:01 2021 +0200 TV-633 delete previous version commit b8fde47a4cc3c8e7e372eaa600f8ddd92a39b7a0 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Tue Sep 21 17:57:22 2021 +0200 TV-633 generic confirm dialog component commit f0d34d639c8c91833cdfb82a42775ec0744573dc Merge: df270085846c2cAuthor: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Tue Sep 21 17:22:48 2021 +0200 Merge branch 'develop' into feature/TV-633 commit df270080a361a052a186bbfc1f7e9a36804d4e9d Merge: 7ff69bf fc6551a Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Tue Sep 21 15:06:08 2021 +0200 Merge remote-tracking branch 'origin/feature/TV-634-reports-layout' into feature/TV-633 commit fc6551a1101f448544bccb62c6272d105dd1e0a4 Merge: e3f72042dd9d3dAuthor: Aden Hassan <aden.hassan@arbetsformedlingen.se> Date: Tue Sep 21 13:32:01 2021 +0200 Merge branch 'develop' into feature/TV-634-reports-layout commit e3f72043c68c326b7f1adc8bd85f993a4b2aafff Author: Aden Hassan <aden.hassan@arbetsformedlingen.se> Date: Tue Sep 21 12:46:00 2021 +0200 minor adjustments according to feedback commit 7ff69bf5534ad4d96c838ac4969dddd222ccbd5c Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Tue Sep 21 10:13:17 2021 +0200 TV-633 Confirm Report Modal created commit 6ef20a3b5074bcf06a84a7de4fded08cbe1e0026 Author: Aden Hassan <aden.hassan@arbetsformedlingen.se> Date: Mon Sep 20 21:55:38 2021 +0200 added minor changes to default steps (TV-634) commit 4835e8f48da04432505cc5225cc57a1763fcdd60 Author: Aden Hassan <aden.hassan@arbetsformedlingen.se> Date: Mon Sep 20 21:47:23 2021 +0200 added output-event to send event from skicka in button (TV-634) commit f01a87dfe099514529ed641c85007986f98b9ea8 Merge: 1a4bdfce120e50Author: Aden Hassan <aden.hassan@arbetsformedlingen.se> Date: Mon Sep 20 19:49:26 2021 +0200 Merge branch 'develop' into feature/TV-634-reports-layout commit 1a4bdfc1684a36a168371d74d90ea2d41060af0e Author: Aden Hassan <aden.hassan@arbetsformedlingen.se> Date: Mon Sep 20 19:48:21 2021 +0200 created basic layout modul for all reports (TV-634 and TV-624)
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
<section class="deltagare-confirm">
|
||||||
|
<h3 class="deltagare-confirm__header">Vad är det du vill rapportera?</h3>
|
||||||
|
<p>{{ formGroup?.get('alternative').value === 'franvaro' ? 'Frånvaro' : 'Avvikelse'}}</p>
|
||||||
|
|
||||||
|
<ng-container *ngIf="formGroup?.get('alternative').value === 'franvaro'">
|
||||||
|
<h3 class="deltagare-confirm__header">Frånvaroorsak</h3>
|
||||||
|
<ng-container *ngFor="let orsak of orsakskoderfranvaro">
|
||||||
|
<p *ngIf="orsak.value == formGroup?.get('orsakerFormGroup').get('orsaker').value">{{orsak.name}}</p>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container *ngIf="formGroup?.get('orsakerFormGroup').get('andraKandaOrsaker').value">
|
||||||
|
<h3 class="deltagare-confirm__header">Annan känd orsak</h3>
|
||||||
|
<ng-container *ngFor="let annanKandOrsak of andraKandaOrsaker">
|
||||||
|
<p *ngIf="annanKandOrsak.value == formGroup?.get('orsakerFormGroup').get('andraKandaOrsaker').value">
|
||||||
|
{{annanKandOrsak.name}}
|
||||||
|
</p>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container *ngIf="formGroup?.get('orsakerFormGroup').get('andraKandaOrsaker').value == 5">
|
||||||
|
<h3 class="deltagare-confirm__header">Beskrivning</h3>
|
||||||
|
<p>{{formGroup?.get('description').value}}</p>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<h3 class="deltagare-confirm__header">Datum</h3>
|
||||||
|
<p>{{formGroup?.get('date').value}}</p>
|
||||||
|
<h3 class="deltagare-confirm__header">Hel- eller del av dag</h3>
|
||||||
|
<p>{{formGroup.get('dayOrPartOfDay').value === 'HELDAG' ? 'Heldag' : 'Del av dag'}}</p>
|
||||||
|
|
||||||
|
<ng-container *ngIf="formGroup.get('dayOrPartOfDay').value === 'DEL_AV_DAG'">
|
||||||
|
<h3 class="deltagare-confirm-header">Startid</h3>
|
||||||
|
<p>{{formGroup?.get('timepickerFormGroup').get('startTime').value}}</p>
|
||||||
|
|
||||||
|
<h3 class="deltagare-confirm-header">Sluttid</h3>
|
||||||
|
<p>{{formGroup?.get('timepickerFormGroup').get('endTime').value}}</p>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container *ngIf="formGroup?.get('alternative').value === 'avvikelse'">
|
||||||
|
<h3 class="deltagare-confirm-header">Avvikelseoorsak</h3>
|
||||||
|
<ng-container *ngFor="let orsak of avvikelseOrsaker">
|
||||||
|
<p *ngIf="orsak.value == formGroup?.get('orsakerFormGroup').get('orsaker').value">{{orsak.name}}</p>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<h3 class="deltagare-confirm-header">Fråga 1</h3>
|
||||||
|
<p>{{formGroup?.get('fragorFormGroup').get('fraga1').value}}</p>
|
||||||
|
|
||||||
|
<ng-container *ngIf="formGroup?.get('fragorFormGroup').get('fraga2').value">
|
||||||
|
<h3 class="deltagare-confirm-header">Fråga 2</h3>
|
||||||
|
<p>{{formGroup?.get('fragorFormGroup').get('fraga2').value}}</p>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<h3 class="deltagare-confirm-header">Datum</h3>
|
||||||
|
<p>{{formGroup?.get('date').value}}</p>
|
||||||
|
</ng-container>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
@import 'variables/gutters';
|
||||||
|
|
||||||
|
.deltagare-confirm {
|
||||||
|
margin-bottom: $digi--layout--gutter--xl;
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
font-size: var(--digi--typography--font-size--l);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DeltagareConfirmFormComponent } from './deltagare-confirm-form.component';
|
||||||
|
|
||||||
|
describe('DeltagareConfirmFormComponent', () => {
|
||||||
|
let component: DeltagareConfirmFormComponent;
|
||||||
|
let fixture: ComponentFixture<DeltagareConfirmFormComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ DeltagareConfirmFormComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(DeltagareConfirmFormComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||||
|
import { FormGroup } from '@angular/forms';
|
||||||
|
import { OrsaksKoderAvvikelse } from '@msfa-models/orsaks-koder-avvikelse.model';
|
||||||
|
import { KandaAvvikelseKoder, OrsaksKoderFranvaro } from '@msfa-models/orsaks-koder-franvaro.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'msfa-deltagare-confirm-form',
|
||||||
|
templateUrl: './deltagare-confirm-form.component.html',
|
||||||
|
styleUrls: ['./deltagare-confirm-form.component.scss'],
|
||||||
|
changeDetection: ChangeDetectionStrategy.Default
|
||||||
|
})
|
||||||
|
export class DeltagareConfirmFormComponent {
|
||||||
|
@Input() formGroup: FormGroup | null = null;
|
||||||
|
@Input() orsakskoderfranvaro: OrsaksKoderFranvaro[];
|
||||||
|
@Input() andraKandaOrsaker: KandaAvvikelseKoder[];
|
||||||
|
@Input() avvikelseOrsaker: OrsaksKoderAvvikelse[];
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { DeltagareConfirmFormComponent } from './deltagare-confirm-form.component';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
|
declarations: [DeltagareConfirmFormComponent],
|
||||||
|
imports: [
|
||||||
|
CommonModule
|
||||||
|
],
|
||||||
|
exports: [DeltagareConfirmFormComponent]
|
||||||
|
})
|
||||||
|
export class DeltagareConfirmFormModule { }
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngFor="let fraga of fragor2 | filterFragor: selectedOrsaksKod">
|
<ng-container *ngFor="let fraga of fragor2 | filterFragor: selectedOrsaksKod">
|
||||||
<div *ngIf="fragor1.length > 0" class="fragor-form__content">
|
<div *ngIf="fragor1?.length > 0" class="fragor-form__content">
|
||||||
<digi-ng-form-textarea
|
<digi-ng-form-textarea
|
||||||
[formControlName]="'fraga2'"
|
[formControlName]="'fraga2'"
|
||||||
[afLabel]="fraga.name"
|
[afLabel]="fraga.name"
|
||||||
|
|||||||
@@ -1,113 +1,138 @@
|
|||||||
<msfa-layout>
|
<msfa-layout>
|
||||||
<section class="deltagare-avvikelse">
|
<msfa-report-layout
|
||||||
<digi-typography>
|
reportTitle="Avvikelserapport"
|
||||||
<h1>Rapport</h1>
|
description="Här rapporterar du deltagarens frånvaro och eventuella misskötsel i tjänsten. Rapportering via avvikelserapport ska också ske om tjänsten inte fungerar för deltagaren."
|
||||||
<p>
|
reportSubTitle="Skapa rapport"
|
||||||
Här rapporterar du deltagarens frånvaro och eventuella misskötsel i tjänsten. Rapportering via avvikelserapport
|
[totalAmountOfSteps]="totalAmountOfSteps"
|
||||||
ska också ske om tjänsten inte fungerar för deltagaren.
|
[currentStep]="currentStep"
|
||||||
</p>
|
[form]="avvikelseFormGroup"
|
||||||
<h2>Skapa rapport</h2>
|
[reportName]="(alternativeFormControl.value === 'franvaro') ? 'frånvarorapport' : 'avvikelsereapport'"
|
||||||
<div *ngIf="contactInformation$ | async as contactInformation" class="deltagare-avvikelse__deltagare">
|
[showSuccessNotification]="showSuccessNotification$ | async"
|
||||||
<p><span>Deltagare:</span> {{contactInformation.fornamn + ' ' + contactInformation.efternamn}}</p>
|
[showDangerNotification]="showDangerNotification$ | async"
|
||||||
<p><span>Personnummer:</span> {{contactInformation.personnummer}}</p>
|
>
|
||||||
</div>
|
<ng-container *ngIf="currentStep === 1">
|
||||||
<div>
|
<h3 class="deltagare-avvikelse__alternative-heading">Vad är det du vill rapportera?</h3>
|
||||||
<h3 class="deltagare-avvikelse__alternative-heading">Vad är det du vill rapportera?</h3>
|
<form [formGroup]="avvikelseFormGroup">
|
||||||
<form [formGroup]="avvikelseFormGroup" (ngSubmit)="onFormSubmitted()">
|
<div class="deltagare-avvikelse__alternative">
|
||||||
<div class="deltagare-avvikelse__alternative">
|
<digi-ng-form-radiobutton-group
|
||||||
<digi-ng-form-radiobutton-group
|
[afRadiobuttons]="avvikelseAlternatives"
|
||||||
[afRadiobuttons]="avvikelseAlternatives"
|
[formControlName]="alternativeFormControlName"
|
||||||
[formControlName]="alternativeFormControlName"
|
(change)="setAlternative()"
|
||||||
(change)="setAlternative()"
|
></digi-ng-form-radiobutton-group>
|
||||||
></digi-ng-form-radiobutton-group>
|
<digi-form-validation-message
|
||||||
|
af-variation="error"
|
||||||
|
*ngIf="alternativeFormControl.invalid && avvikelseFormGroup.touched"
|
||||||
|
>
|
||||||
|
Alternativ är obligatoriskt
|
||||||
|
</digi-form-validation-message>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<msfa-deltagare-orsaks-form
|
||||||
|
[franvaroOrsaker]="franvaroOrsaker$ | async"
|
||||||
|
[avvikelseOrsaker]="avvikelseOrsaker$ | async "
|
||||||
|
[andraKandaOrsaker]="andraKandaOrsaker$ | async"
|
||||||
|
[orsakerFormGroup]="avvikelseFormGroup.get('orsakerFormGroup')"
|
||||||
|
[avvikelseFormGroup]="avvikelseFormGroup"
|
||||||
|
[selectedAlternative]="alternativeFormControl.value"
|
||||||
|
(change)="setOrsakerChanged()"
|
||||||
|
></msfa-deltagare-orsaks-form>
|
||||||
|
|
||||||
|
<ng-container *ngIf="showDescription">
|
||||||
|
<div class="deltagare-avvikelse__description">
|
||||||
|
<digi-ng-form-textarea
|
||||||
|
[formControlName]="descriptionFormControlName"
|
||||||
|
afLabel="Beskriv frånvaro"
|
||||||
|
[afSize]="sizeTextArea"
|
||||||
|
[afDisableValidStyle]="true"
|
||||||
|
[afMaxLength]="2000"
|
||||||
|
[afRequired]="true"
|
||||||
|
[afInvalid]="avvikelseFormGroup?.errors?.descriptionIsRequired && descriptionFormControl.touched"
|
||||||
|
></digi-ng-form-textarea>
|
||||||
<digi-form-validation-message
|
<digi-form-validation-message
|
||||||
af-variation="error"
|
af-variation="error"
|
||||||
*ngIf="alternativeFormControl.invalid && avvikelseFormGroup.touched"
|
*ngIf="avvikelseFormGroup?.errors?.descriptionIsRequired && descriptionFormControl.touched"
|
||||||
>
|
>
|
||||||
Alternativ är obligatoriskt
|
Beskrivning är obligatoriskt
|
||||||
</digi-form-validation-message>
|
</digi-form-validation-message>
|
||||||
</div>
|
</div>
|
||||||
<msfa-deltagare-orsaks-form
|
</ng-container>
|
||||||
[franvaroOrsaker]="franvaroOrsaker$ | async"
|
|
||||||
[avvikelseOrsaker]="avvikelseOrsaker$ | async "
|
<ng-container *ngIf="showFragor">
|
||||||
[andraKandaOrsaker]="andraKandaOrsaker$ | async"
|
<msfa-deltagare-fragor-form
|
||||||
[orsakerFormGroup]="avvikelseFormGroup.get('orsakerFormGroup')"
|
[fragor1]="fragor1$ | async"
|
||||||
|
[fragor2]="fragor2$ | async"
|
||||||
|
[fragorFormGroup]="avvikelseFormGroup.get('fragorFormGroup')"
|
||||||
[avvikelseFormGroup]="avvikelseFormGroup"
|
[avvikelseFormGroup]="avvikelseFormGroup"
|
||||||
[selectedAlternative]="alternativeFormControl.value"
|
[selectedOrsaksKod]="selectedOrsaksKod"
|
||||||
(change)="setOrsakerChanged()"
|
></msfa-deltagare-fragor-form>
|
||||||
></msfa-deltagare-orsaks-form>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container *ngIf="showDescription">
|
<div *ngIf="showDatePicker" class="deltagare-avvikelse__datepicker">
|
||||||
<div class="deltagare-avvikelse__description">
|
<digi-ng-form-datepicker
|
||||||
<digi-ng-form-textarea
|
[formControlName]="dateFormControlName"
|
||||||
[formControlName]="descriptionFormControlName"
|
[afLabel]="'Välj dag för ' + (alternativeFormControl.value === 'franvaro' ? 'frånvaro' : 'avvikelse')"
|
||||||
afLabel="Beskriv frånvaro"
|
[afDisableValidStyle]="true"
|
||||||
[afSize]="sizeTextArea"
|
[afInvalid]="avvikelseFormGroup.errors?.dateIsRequired"
|
||||||
[afDisableValidStyle]="true"
|
></digi-ng-form-datepicker>
|
||||||
[afMaxLength]="2000"
|
<digi-form-validation-message af-variation="error" *ngIf="avvikelseFormGroup.errors?.dateIsRequired">
|
||||||
[afRequired]="true"
|
{{avvikelseFormGroup.errors?.dateIsRequired}}
|
||||||
[afInvalid]="avvikelseFormGroup?.errors?.descriptionIsRequired && descriptionFormControl.touched"
|
</digi-form-validation-message>
|
||||||
></digi-ng-form-textarea>
|
</div>
|
||||||
<digi-form-validation-message
|
|
||||||
af-variation="error"
|
|
||||||
*ngIf="avvikelseFormGroup?.errors?.descriptionIsRequired && descriptionFormControl.touched"
|
|
||||||
>
|
|
||||||
Beskrivning är obligatoriskt
|
|
||||||
</digi-form-validation-message>
|
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container *ngIf="showFragor">
|
<div *ngIf="showDayOrPartOfDayPicker" class="deltagare-avvikelse__dayOrPartOfDay">
|
||||||
<msfa-deltagare-fragor-form
|
<digi-ng-form-radiobutton-group
|
||||||
[fragor1]="fragor1$ | async"
|
[afRadiobuttons]="dayOrPartOfDay"
|
||||||
[fragor2]="fragor2$ | async"
|
[formControlName]="dayOrPartOfDayFormControlName"
|
||||||
[fragorFormGroup]="avvikelseFormGroup.get('fragorFormGroup')"
|
[afRequired]="avvikelseFormGroup.errors?.dayOrPartOfDayIsRequired"
|
||||||
[avvikelseFormGroup]="avvikelseFormGroup"
|
></digi-ng-form-radiobutton-group>
|
||||||
[selectedOrsaksKod]="selectedOrsaksKod"
|
</div>
|
||||||
></msfa-deltagare-fragor-form>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<div *ngIf="showDatePicker" class="deltagare-avvikelse__datepicker">
|
<ng-container *ngIf="showTimePicker">
|
||||||
<digi-ng-form-datepicker
|
<msfa-deltagare-time-picker
|
||||||
[formControlName]="dateFormControlName"
|
[timepickerFormGroup]="avvikelseFormGroup.get('timepickerFormGroup')"
|
||||||
[afLabel]="'Välj dag för ' + (alternativeFormControl.value === 'franvaro' ? 'frånvaro' : 'avvikelse')"
|
[avvikelseFormGroup]="avvikelseFormGroup"
|
||||||
[afDisableValidStyle]="true"
|
></msfa-deltagare-time-picker>
|
||||||
[afInvalid]="avvikelseFormGroup.errors?.dateIsRequired"
|
</ng-container>
|
||||||
></digi-ng-form-datepicker>
|
</form>
|
||||||
<digi-form-validation-message af-variation="error" *ngIf="avvikelseFormGroup.errors?.dateIsRequired">
|
</ng-container>
|
||||||
{{avvikelseFormGroup.errors?.dateIsRequired}}
|
|
||||||
</digi-form-validation-message>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="showDayOrPartOfDayPicker" class="deltagare-avvikelse__dayOrPartOfDay">
|
<msfa-deltagare-confirm-form
|
||||||
<digi-ng-form-radiobutton-group
|
*ngIf="currentStep === totalAmountOfSteps"
|
||||||
[afRadiobuttons]="dayOrPartOfDay"
|
[formGroup]="avvikelseFormGroup"
|
||||||
[formControlName]="dayOrPartOfDayFormControlName"
|
[orsakskoderfranvaro]="franvaroOrsaker$ | async"
|
||||||
[afRequired]="avvikelseFormGroup.errors?.dayOrPartOfDayIsRequired"
|
[andraKandaOrsaker]="andraKandaOrsaker$ | async"
|
||||||
></digi-ng-form-radiobutton-group>
|
[avvikelseOrsaker]="avvikelseOrsaker$ | async"
|
||||||
</div>
|
></msfa-deltagare-confirm-form>
|
||||||
<ng-container *ngIf="showTimePicker">
|
|
||||||
<msfa-deltagare-time-picker
|
|
||||||
[timepickerFormGroup]="avvikelseFormGroup.get('timepickerFormGroup')"
|
|
||||||
[avvikelseFormGroup]="avvikelseFormGroup"
|
|
||||||
></msfa-deltagare-time-picker>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
|
<div class="deltagare-avvikelse__step-buttons-wrapper">
|
||||||
|
<ng-container *ngIf="(showSuccessNotification$ | async) !== true">
|
||||||
|
<ng-container *ngIf="currentStep > 1">
|
||||||
<digi-button
|
<digi-button
|
||||||
[attr.af-aria-label]="'Tillbaka till deltagaren'"
|
class="deltagare-avvikelse__step-buttons-wrapper--space-right"
|
||||||
class="deltagare-avvikelse__go-back"
|
|
||||||
af-size="m"
|
|
||||||
af-variation="secondary"
|
af-variation="secondary"
|
||||||
(afOnClick)="goBack()"
|
af-size="m"
|
||||||
>
|
(afOnClick)="previousStep()"
|
||||||
Tillbaka</digi-button
|
|
||||||
>
|
>
|
||||||
|
Tillbaka
|
||||||
|
</digi-button>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="currentStep === totalAmountOfSteps">
|
||||||
|
<digi-button af-size="m" (afOnClick)="openConfirmDialog = true;"> Skicka in </digi-button>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="currentStep === (totalAmountOfSteps -1)">
|
||||||
|
<digi-button af-size="m" (afOnClick)="nextStep"> Förhandsgranska </digi-button>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="showSuccessNotification$ | async">
|
||||||
|
<digi-button af-size="m" (afOnClick)="backToDeltagare()"> Tillbaka till deltagaren </digi-button>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
|
</msfa-report-layout>
|
||||||
|
|
||||||
<digi-button [attr.af-aria-label]="'Skapa en avvikelserapport'" [attr.af-type]="'submit'" af-size="m"
|
<msfa-confirm-dialog
|
||||||
>Nästa</digi-button
|
[openConfirmDialog]="openConfirmDialog"
|
||||||
>
|
[itemToConfirm]="alternativeFormControl.value === 'avvikelse' ? 'avvikelse' : 'frånvaro' + 'rapport'"
|
||||||
</form>
|
(confirmDialogChanged)="setConfirmDialogChanged($event)"
|
||||||
</div>
|
>
|
||||||
</digi-typography>
|
</msfa-confirm-dialog>
|
||||||
</section>
|
|
||||||
</msfa-layout>
|
</msfa-layout>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
font-size: var(--digi--typography--font-size--h3);
|
font-size: var(--digi--typography--font-size--h3);
|
||||||
}
|
}
|
||||||
|
|
||||||
&__go-back {
|
&__step-buttons-wrapper--space-right {
|
||||||
margin-right: $digi--layout--gutter;
|
margin-right: var(--digi--layout--gutter--s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
|||||||
import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
|
import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { Alternative } from '@msfa-enums/alternative.enum';
|
import { Alternative } from '@msfa-enums/alternative.enum';
|
||||||
|
import { ConfirmDialog } from '@msfa-enums/confirm-dialog.enum';
|
||||||
import { DayOrPartOfDay } from '@msfa-enums/day-or-part-of-day.enum';
|
import { DayOrPartOfDay } from '@msfa-enums/day-or-part-of-day.enum';
|
||||||
import { FranvaroOrsaksKodEnum } from '@msfa-enums/franvaro-orsak-kod.enum';
|
import { FranvaroOrsaksKodEnum } from '@msfa-enums/franvaro-orsak-kod.enum';
|
||||||
import { KandaOrsakerEnum } from '@msfa-enums/kanda-orsaker-kod.enum';
|
import { KandaOrsakerEnum } from '@msfa-enums/kanda-orsaker-kod.enum';
|
||||||
@@ -15,17 +16,17 @@ import { FranvaroAlternativ } from '@msfa-models/franvaro-alternativ.model';
|
|||||||
import { OrsaksKoderAvvikelse } from '@msfa-models/orsaks-koder-avvikelse.model';
|
import { OrsaksKoderAvvikelse } from '@msfa-models/orsaks-koder-avvikelse.model';
|
||||||
import { KandaAvvikelseKoder, OrsaksKoderFranvaro } from '@msfa-models/orsaks-koder-franvaro.model';
|
import { KandaAvvikelseKoder, OrsaksKoderFranvaro } from '@msfa-models/orsaks-koder-franvaro.model';
|
||||||
import {
|
import {
|
||||||
OrsakerIsRequiredCheck,
|
|
||||||
AnnanKandOrsakeIsRequiredCheck,
|
AnnanKandOrsakeIsRequiredCheck,
|
||||||
DescriptionIsRequiredCheck,
|
|
||||||
DateIsRequiredCheck,
|
DateIsRequiredCheck,
|
||||||
DayOrPartOfDayIsRequiredCheck,
|
DayOrPartOfDayIsRequiredCheck,
|
||||||
StartTimeIsRequiredCheck,
|
DescriptionIsRequiredCheck,
|
||||||
EndTimeIsRequiredCheck,
|
EndTimeIsRequiredCheck,
|
||||||
MotiveringIsRequiredCheck
|
MotiveringIsRequiredCheck,
|
||||||
|
OrsakerIsRequiredCheck,
|
||||||
|
StartTimeIsRequiredCheck
|
||||||
} from '@msfa-utils/validators/avvikelse-form-validator';
|
} from '@msfa-utils/validators/avvikelse-form-validator';
|
||||||
import { RequiredValidator } from '@msfa-utils/validators/required.validator';
|
import { RequiredValidator } from '@msfa-utils/validators/required.validator';
|
||||||
import { Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { first, map, switchMap } from 'rxjs/operators';
|
import { first, map, switchMap } from 'rxjs/operators';
|
||||||
import { DeltagareAvvikelseService } from '../../services/deltagare-avvikelse.service';
|
import { DeltagareAvvikelseService } from '../../services/deltagare-avvikelse.service';
|
||||||
import { avvikelseAlternatives, dayOrPartOfDay } from './report-alternatives';
|
import { avvikelseAlternatives, dayOrPartOfDay } from './report-alternatives';
|
||||||
@@ -48,6 +49,9 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
|||||||
readonly startTimeFormControlName = 'startTime';
|
readonly startTimeFormControlName = 'startTime';
|
||||||
readonly endTimeFormControlName = 'endTime';
|
readonly endTimeFormControlName = 'endTime';
|
||||||
|
|
||||||
|
private _showSuccessNotification$ = new BehaviorSubject<boolean>(false);
|
||||||
|
private _showDangerNotification$ = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
contactInformation$: Observable<ContactInformationCompact> = this.activatedRoute.params
|
contactInformation$: Observable<ContactInformationCompact> = this.activatedRoute.params
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap(({ deltagareId }) => this.deltagareAvvikelseService.getContactInformationCompact$(deltagareId))
|
switchMap(({ deltagareId }) => this.deltagareAvvikelseService.getContactInformationCompact$(deltagareId))
|
||||||
@@ -64,12 +68,16 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
|||||||
dayOrPartOfDay: RadiobuttonModel[] = dayOrPartOfDay;
|
dayOrPartOfDay: RadiobuttonModel[] = dayOrPartOfDay;
|
||||||
selectedOrsaksKod: string;
|
selectedOrsaksKod: string;
|
||||||
avvikelseFormGroup: FormGroup | null = null;
|
avvikelseFormGroup: FormGroup | null = null;
|
||||||
|
totalAmountOfSteps = 2;
|
||||||
|
currentStep = 1;
|
||||||
|
openConfirmDialog = false;
|
||||||
|
showSuccessNotification$ = this._showSuccessNotification$.asObservable();
|
||||||
|
showDangerNotification$ = this._showDangerNotification$.asObservable();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private deltagareAvvikelseService: DeltagareAvvikelseService,
|
private deltagareAvvikelseService: DeltagareAvvikelseService,
|
||||||
private activatedRoute: ActivatedRoute,
|
private router: Router,
|
||||||
private router: Router) {
|
private activatedRoute: ActivatedRoute) { }
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.contactInformation$
|
this.contactInformation$
|
||||||
@@ -152,34 +160,32 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
|||||||
return this.avvikelseFormGroup.get('timepickerFormGroup').get(this.endTimeFormControlName);
|
return this.avvikelseFormGroup.get('timepickerFormGroup').get(this.endTimeFormControlName);
|
||||||
}
|
}
|
||||||
|
|
||||||
onFormSubmitted(): void {
|
setConfirmDialogChanged(confirm: ConfirmDialog): void {
|
||||||
if (this.avvikelseFormGroup.invalid) {
|
this.openConfirmDialog = false;
|
||||||
this.alternativeFormControl.markAsTouched();
|
if (confirm === ConfirmDialog.ACCEPTED) {
|
||||||
return;
|
const postAvvikelse: Avvikelse = {
|
||||||
|
datum_for_rapportering: this.todayDate,
|
||||||
|
arbetssokande: {
|
||||||
|
personnummer: this.contactInformation.personnummer.toString(),
|
||||||
|
fornamn: this.contactInformation.fornamn.toString(),
|
||||||
|
efternamn: this.contactInformation.efternamn.toString()
|
||||||
|
},
|
||||||
|
sokandeId: +this.activatedRoute.snapshot.params['deltagareId']
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.alternativeFormControl.value as string === Alternative.AVVIKELSE) {
|
||||||
|
postAvvikelse['avvikelsealternativ'] = this.avvikelse;
|
||||||
|
} else if (this.alternativeFormControl.value as string == Alternative.FRANVARO) {
|
||||||
|
postAvvikelse['franvaro'] = this.franvaro;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.deltagareAvvikelseService.createAvvikelse$(postAvvikelse, this.alternativeFormControl.value as string)
|
||||||
|
.subscribe({
|
||||||
|
error: () => this._showDangerNotification$.next(true),
|
||||||
|
next: () => this._showSuccessNotification$.next(true),
|
||||||
|
complete: () => this.avvikelseFormGroup.reset()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.avvikelseFormGroup.markAllAsTouched();
|
|
||||||
|
|
||||||
const postAvvikelse: Avvikelse = {
|
|
||||||
datum_for_rapportering: this.todayDate,
|
|
||||||
arbetssokande: {
|
|
||||||
personnummer: this.contactInformation.personnummer.toString(),
|
|
||||||
fornamn: this.contactInformation.fornamn.toString(),
|
|
||||||
efternamn: this.contactInformation.efternamn.toString()
|
|
||||||
},
|
|
||||||
sokandeId: +this.activatedRoute.snapshot.params['deltagareId']
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.alternativeFormControl.value as string === Alternative.AVVIKELSE) {
|
|
||||||
postAvvikelse['avvikelsealternativ'] = this.avvikelse;
|
|
||||||
} else if (this.alternativeFormControl.value as string == Alternative.FRANVARO) {
|
|
||||||
postAvvikelse['franvaro'] = this.franvaro;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.deltagareAvvikelseService.createAvvikelse$(postAvvikelse, this.alternativeFormControl.value as string)
|
|
||||||
.subscribe({
|
|
||||||
next: () => this.avvikelseFormGroup.reset()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get franvaro(): FranvaroAlternativ {
|
get franvaro(): FranvaroAlternativ {
|
||||||
@@ -218,7 +224,6 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setAlternative(): void {
|
setAlternative(): void {
|
||||||
if (this.alternativeFormControl.value as string == Alternative.FRANVARO) {
|
if (this.alternativeFormControl.value as string == Alternative.FRANVARO) {
|
||||||
this.franvaroOrsaker$ = this.deltagareAvvikelseService.getOrsaksKoderFranvaro$();
|
this.franvaroOrsaker$ = this.deltagareAvvikelseService.getOrsaksKoderFranvaro$();
|
||||||
@@ -293,6 +298,25 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
|||||||
this.dayOrPartOfDayFormControl.value as string === DayOrPartOfDay.DEL_AV_DAG
|
this.dayOrPartOfDayFormControl.value as string === DayOrPartOfDay.DEL_AV_DAG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get nextStep(): number {
|
||||||
|
this.avvikelseFormGroup.markAllAsTouched();
|
||||||
|
if (this.avvikelseFormGroup.valid && this.currentStep < this.totalAmountOfSteps) {
|
||||||
|
return this.currentStep++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
previousStep(): void {
|
||||||
|
if (this.currentStep > 1) {
|
||||||
|
this.currentStep--;
|
||||||
|
this._showSuccessNotification$.next(false);
|
||||||
|
this._showDangerNotification$.next(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
backToDeltagare(): void {
|
||||||
|
void this.router.navigate(['./deltagare', this.activatedRoute.snapshot.params['deltagareId']]);
|
||||||
|
}
|
||||||
|
|
||||||
private clearControlOnAlternativeChange(): void {
|
private clearControlOnAlternativeChange(): void {
|
||||||
this.descriptionFormControl.setValue('');
|
this.descriptionFormControl.setValue('');
|
||||||
this.fraga1FormControl.setValue('');
|
this.fraga1FormControl.setValue('');
|
||||||
@@ -301,8 +325,4 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
|||||||
this.avvikelseFormGroup?.get('timepickerFormGroup').reset();
|
this.avvikelseFormGroup?.get('timepickerFormGroup').reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
goBack(): void {
|
|
||||||
void this.router.navigate(['./deltagare', this.activatedRoute.snapshot.params['deltagareId']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import { DigiNgFormDatepickerModule } from '@af/digi-ng/_form/form-datepicker';
|
import { DigiNgFormDatepickerModule } from '@af/digi-ng/_form/form-datepicker';
|
||||||
import { DigiNgFormRadiobuttonGroupModule } from '@af/digi-ng/_form/form-radiobutton-group';
|
import { DigiNgFormRadiobuttonGroupModule } from '@af/digi-ng/_form/form-radiobutton-group';
|
||||||
import { DigiNgFormTextareaModule } from '@af/digi-ng/_form/form-textarea';
|
import { DigiNgFormTextareaModule } from '@af/digi-ng/_form/form-textarea';
|
||||||
|
import { DigiNgProgressProgressbarModule } from '@af/digi-ng/_progress/progressbar';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||||
import { ReactiveFormsModule } from '@angular/forms';
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { LayoutModule } from '@msfa-shared/components/layout/layout.module';
|
import { LayoutModule } from '@msfa-shared/components/layout/layout.module';
|
||||||
|
import { ConfirmDialogModule } from '../../../../shared/confirm-dialog/confirm-dialog.module';
|
||||||
|
import { ReportLayoutModule } from '../../../../shared/report-layout/report-layout.module';
|
||||||
|
import { DeltagareConfirmFormModule } from './components/deltagare-confirm-form/deltagare-confirm-form.module';
|
||||||
import { DeltagareFragorFormModule } from './components/deltagare-fragor-form/deltagare-fragor-form.module';
|
import { DeltagareFragorFormModule } from './components/deltagare-fragor-form/deltagare-fragor-form.module';
|
||||||
import { DeltagareOrsaksFormModule } from './components/deltagare-orsaks-form/deltagare-orsaks-form.module';
|
import { DeltagareOrsaksFormModule } from './components/deltagare-orsaks-form/deltagare-orsaks-form.module';
|
||||||
import { DeltagareTimePickerModule } from './components/deltagare-time-picker/deltagare-time-picker.module';
|
import { DeltagareTimePickerModule } from './components/deltagare-time-picker/deltagare-time-picker.module';
|
||||||
@@ -23,9 +27,13 @@ import { DeltagareAvvikelseComponent } from './deltagare-avvikelse.component';
|
|||||||
DigiNgFormRadiobuttonGroupModule,
|
DigiNgFormRadiobuttonGroupModule,
|
||||||
DigiNgFormDatepickerModule,
|
DigiNgFormDatepickerModule,
|
||||||
DigiNgFormTextareaModule,
|
DigiNgFormTextareaModule,
|
||||||
|
DigiNgProgressProgressbarModule,
|
||||||
DeltagareOrsaksFormModule,
|
DeltagareOrsaksFormModule,
|
||||||
DeltagareFragorFormModule,
|
DeltagareFragorFormModule,
|
||||||
DeltagareTimePickerModule
|
DeltagareTimePickerModule,
|
||||||
|
DeltagareConfirmFormModule,
|
||||||
|
ReportLayoutModule,
|
||||||
|
ConfirmDialogModule
|
||||||
],
|
],
|
||||||
exports: [DeltagareAvvikelseComponent]
|
exports: [DeltagareAvvikelseComponent]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<digi-ng-dialog
|
||||||
|
*ngIf="openConfirmDialog"
|
||||||
|
[afActive]="openConfirmDialog"
|
||||||
|
(afOnPrimaryClick)="sendRequest()"
|
||||||
|
(afOnSecondaryClick)="closeConfirmDialog()"
|
||||||
|
(afOnInactive)="closeConfirmDialog()"
|
||||||
|
afHeading="Bekräfta"
|
||||||
|
afHeadingLevel="h2"
|
||||||
|
[afAriaLabel]="'Bekräfta skicka in ' + itemToConfirm"
|
||||||
|
afPrimaryButtonText="Skicka"
|
||||||
|
afSecondaryButtonText="Avbryt"
|
||||||
|
>
|
||||||
|
<p>Är du säker på att du vill skicka in en {{itemToConfirm}}?</p>
|
||||||
|
</digi-ng-dialog>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { DigiNgDialogModule } from '@af/digi-ng/_dialog/dialog';
|
||||||
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { ConfirmDialogComponent } from './confirm-dialog.component';
|
||||||
|
|
||||||
|
|
||||||
|
describe('DeltagareCreateAvvikelseComponent', () => {
|
||||||
|
let component: ConfirmDialogComponent;
|
||||||
|
let fixture: ComponentFixture<ConfirmDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
|
declarations: [ConfirmDialogComponent],
|
||||||
|
imports: [DigiNgDialogModule]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ConfirmDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
|
import { ConfirmDialog } from '@msfa-enums/confirm-dialog.enum';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'msfa-confirm-dialog',
|
||||||
|
templateUrl: './confirm-dialog.component.html',
|
||||||
|
styleUrls: ['./confirm-dialog.component.scss'],
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
|
})
|
||||||
|
export class ConfirmDialogComponent {
|
||||||
|
@Input() openConfirmDialog: boolean;
|
||||||
|
@Input() itemToConfirm: string;
|
||||||
|
@Output() confirmDialogChanged = new EventEmitter<ConfirmDialog>();
|
||||||
|
|
||||||
|
sendRequest(): void {
|
||||||
|
this.openConfirmDialog = false;
|
||||||
|
this.confirmDialogChanged.emit(ConfirmDialog.ACCEPTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeConfirmDialog(): void {
|
||||||
|
this.openConfirmDialog = false;
|
||||||
|
this.confirmDialogChanged.emit(ConfirmDialog.DISMISSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { DigiNgDialogModule } from '@af/digi-ng/_dialog/dialog';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||||
|
import { ConfirmDialogComponent } from './confirm-dialog.component';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
|
declarations: [ConfirmDialogComponent],
|
||||||
|
imports: [CommonModule, DigiNgDialogModule],
|
||||||
|
exports: [ConfirmDialogComponent]
|
||||||
|
})
|
||||||
|
export class ConfirmDialogModule { }
|
||||||
@@ -1,58 +1,82 @@
|
|||||||
<section class="report-layout" *ngIf="contactInformation$ | async as contactInformation">
|
<section class="report-layout" *ngIf="contactInformation$ | async as contactInformation">
|
||||||
<digi-typography>
|
<digi-typography>
|
||||||
<h1>{{ reportTitle }}</h1>
|
<h1>{{ reportTitle }}</h1>
|
||||||
<p class="report-layout__description">{{description}}</p>
|
<p class="report-layout__description">{{description}}</p>
|
||||||
<div class="report-layout__deltagare-info">
|
<div class="report-layout__deltagare-info">
|
||||||
<h2>{{reportSubTitle}}</h2>
|
<h2>{{reportSubTitle}}</h2>
|
||||||
<div class="report-layout__name">{{contactInformation.fornamn + ' ' + contactInformation.efternamn}}</div>
|
<div class="report-layout__name">{{contactInformation.fornamn + ' ' + contactInformation.efternamn}}</div>
|
||||||
<div class="report-layout__personnummer">
|
<div class="report-layout__personnummer">
|
||||||
<span>Personnummer:</span>
|
<span>Personnummer:</span>
|
||||||
<msfa-hide-text
|
<msfa-hide-text
|
||||||
symbols="********-****"
|
symbols="********-****"
|
||||||
[changingText]="contactInformation.personnummer"
|
[changingText]="contactInformation.personnummer"
|
||||||
ariaLabelType="Personnumer"
|
ariaLabelType="Personnumer"
|
||||||
></msfa-hide-text>
|
></msfa-hide-text>
|
||||||
</div>
|
</div>
|
||||||
<span *ngIf="service">Tjänst: KROM</span>
|
<span *ngIf="service">Tjänst: KROM</span>
|
||||||
<ng-container *ngIf="startDate && endDate && !isPeriodDate">
|
<ng-container *ngIf="startDate && endDate && !isPeriodDate">
|
||||||
<span>Startdatum: {{startDate}}</span>
|
<span>Startdatum: {{startDate}}</span>
|
||||||
<span>Slutdatum: {{endDate}}</span>
|
<span>Slutdatum: {{endDate}}</span>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<span *ngIf="startDate && endDate && isPeriodDate">Avser period: {{startDate}} - {{endDate}}</span>
|
<span *ngIf="startDate && endDate && isPeriodDate">Avser period: {{startDate}} - {{endDate}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<digi-ng-progress-progressbar
|
<div class="report-layout__notification-alert">
|
||||||
[afSteps]="totalAmountOfSteps"
|
<digi-notification-alert
|
||||||
[afActiveStep]="currentStep"
|
*ngIf="showSuccessNotification"
|
||||||
></digi-ng-progress-progressbar>
|
af-variation="success"
|
||||||
|
af-heading="Allt gick bra"
|
||||||
|
af-heading-level="h3"
|
||||||
|
>
|
||||||
|
<p>Din {{reportName}} är nu inskickad till Arbetsförmedlingen.</p>
|
||||||
|
</digi-notification-alert>
|
||||||
|
|
||||||
<div class="report-layout__main-content">
|
<digi-notification-alert
|
||||||
<ng-content></ng-content>
|
*ngIf="showDangerNotification"
|
||||||
</div>
|
af-variation="danger"
|
||||||
|
af-heading="Någonting gick fel"
|
||||||
|
af-heading-level="h3"
|
||||||
|
>
|
||||||
|
<p>Vi kunde inte skicka in din {{reportName}}.</p>
|
||||||
|
</digi-notification-alert>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="report-layout__step-buttons-wrapper">
|
<digi-ng-progress-progressbar
|
||||||
<ng-container *ngIf="currentStep > 1">
|
[afSteps]="totalAmountOfSteps"
|
||||||
<digi-button class="report-layout__step-buttons-wrapper--space-right"
|
[afActiveStep]="currentStep"
|
||||||
af-variation="secondary" af-size="m" (afOnClick)="previousStep()">
|
></digi-ng-progress-progressbar>
|
||||||
Tillbaka
|
|
||||||
</digi-button>
|
<div class="report-layout__main-content">
|
||||||
</ng-container>
|
<ng-content></ng-content>
|
||||||
<ng-container *ngIf="currentStep < (totalAmountOfSteps -1)">
|
</div>
|
||||||
<digi-button class="report-layout__step-buttons-wrapper"
|
|
||||||
af-size="m" (afOnClick)="nextStep()">
|
<!-- <div class="report-layout__step-buttons-wrapper">
|
||||||
Nästa
|
<ng-container *ngIf="!showSuccessNotification">
|
||||||
</digi-button>
|
<ng-container *ngIf="currentStep > 1">
|
||||||
</ng-container>
|
<digi-button
|
||||||
<ng-container *ngIf="currentStep === (totalAmountOfSteps -1)">
|
class="report-layout__step-buttons-wrapper--space-right"
|
||||||
<digi-button af-size="m" (afOnClick)="nextStep()">
|
af-variation="secondary"
|
||||||
Förhandsgranska
|
af-size="m"
|
||||||
</digi-button>
|
(afOnClick)="previousStep()"
|
||||||
</ng-container>
|
>
|
||||||
<ng-container *ngIf="currentStep === totalAmountOfSteps">
|
Tillbaka
|
||||||
<digi-button af-size="m" (afOnClick)="sendRequest()">
|
</digi-button>
|
||||||
Skicka in
|
</ng-container>
|
||||||
</digi-button>
|
<ng-container *ngIf="currentStep < (totalAmountOfSteps -1)">
|
||||||
</ng-container>
|
<digi-button class="report-layout__step-buttons-wrapper" af-size="m" (afOnClick)="nextStep()">
|
||||||
</div>
|
Nästa
|
||||||
</digi-typography>
|
</digi-button>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="currentStep === (totalAmountOfSteps -1)">
|
||||||
|
<digi-button af-size="m" (afOnClick)="nextStep()"> Förhandsgranska </digi-button>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="currentStep === totalAmountOfSteps">
|
||||||
|
<digi-button af-size="m" (afOnClick)="sendRequest()"> Skicka in </digi-button>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="showSuccessNotification">
|
||||||
|
<digi-button af-size="m" (afOnClick)="backToDeltagare()"> Tillbaka till deltagaren </digi-button>
|
||||||
|
</ng-container>
|
||||||
|
</div> -->
|
||||||
|
</digi-typography>
|
||||||
</section>
|
</section>
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
@import 'variables/gutters';
|
@import 'variables/gutters';
|
||||||
.report-layout {
|
.report-layout {
|
||||||
&__description {
|
|
||||||
}
|
|
||||||
|
|
||||||
&____name {
|
&____name {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
font-size: var(--digi--typography--font-size--s);
|
font-size: var(--digi--typography--font-size--s);
|
||||||
@@ -25,6 +22,10 @@
|
|||||||
margin-left: var(--digi--layout--gutter--s);
|
margin-left: var(--digi--layout--gutter--s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__notification-alert {
|
||||||
|
margin-bottom: $digi--layout--gutter--xl;
|
||||||
|
}
|
||||||
|
|
||||||
&__main-content {
|
&__main-content {
|
||||||
margin: $digi--layout--gutter--xl 0;
|
margin: $digi--layout--gutter--xl 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Component, ChangeDetectionStrategy, Input, EventEmitter, Output } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { FormGroup } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { ContactInformationCompact } from '@msfa-models/api/contact-information.response.model';
|
import { ContactInformationCompact } from '@msfa-models/api/contact-information.response.model';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { switchMap } from 'rxjs/operators';
|
import { switchMap } from 'rxjs/operators';
|
||||||
@@ -22,36 +23,50 @@ export class ReportLayoutComponent {
|
|||||||
@Input() isPeriodDate = false;
|
@Input() isPeriodDate = false;
|
||||||
@Input() totalAmountOfSteps = 3;
|
@Input() totalAmountOfSteps = 3;
|
||||||
@Input() currentStep = 1;
|
@Input() currentStep = 1;
|
||||||
|
@Input() form: FormGroup | null = null;
|
||||||
|
@Input() reportName: string;
|
||||||
|
@Input() showSuccessNotification = false;
|
||||||
|
@Input() showDangerNotification = false;
|
||||||
@Output() currentStepEvent = new EventEmitter<number>();
|
@Output() currentStepEvent = new EventEmitter<number>();
|
||||||
@Output() sendRequestEvent = new EventEmitter<boolean>();
|
@Output() sendRequestEvent = new EventEmitter<boolean>();
|
||||||
|
|
||||||
contactInformation$: Observable<ContactInformationCompact> = this.activatedRoute.params
|
contactInformation$: Observable<ContactInformationCompact> = this.activatedRoute.params
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap(({ deltagareId }) => this.deltagareAvvikelseService.getContactInformationCompact$(deltagareId))
|
switchMap(({ deltagareId }) => this.deltagareAvvikelseService.getContactInformationCompact$(deltagareId))
|
||||||
);
|
);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private deltagareAvvikelseService: DeltagareAvvikelseService,
|
private deltagareAvvikelseService: DeltagareAvvikelseService,
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
|
private router: Router
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
nextStep():void {
|
nextStep(): void {
|
||||||
if(this.currentStep < this.totalAmountOfSteps) {
|
console.log(this.form);
|
||||||
|
|
||||||
|
if (this.form.valid && this.currentStep < this.totalAmountOfSteps) {
|
||||||
this.currentStep++;
|
this.currentStep++;
|
||||||
this.currentStepEvent.emit(this.currentStep);
|
this.currentStepEvent.emit(this.currentStep);
|
||||||
}
|
}
|
||||||
|
this.form.markAllAsTouched();
|
||||||
}
|
}
|
||||||
|
|
||||||
previousStep():void {
|
previousStep(): void {
|
||||||
if(this.currentStep > 1) {
|
if (this.currentStep > 1) {
|
||||||
this.currentStep--;
|
this.currentStep--;
|
||||||
this.currentStepEvent.emit(this.currentStep);
|
this.currentStepEvent.emit(this.currentStep);
|
||||||
|
this.showSuccessNotification = false;
|
||||||
|
this.showDangerNotification = false;
|
||||||
}
|
}
|
||||||
this.currentStep !== this.totalAmountOfSteps ? this.sendRequestEvent.emit(false): null;
|
this.currentStep !== this.totalAmountOfSteps ? this.sendRequestEvent.emit(false) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendRequest():void {
|
sendRequest(): void {
|
||||||
this.sendRequestEvent.emit(true);
|
this.sendRequestEvent.emit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backToDeltagare(): void {
|
||||||
|
void this.router.navigate(['./deltagare', this.activatedRoute.snapshot.params['deltagareId']]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export enum ConfirmDialog {
|
||||||
|
ACCEPTED = 'ACCEPTED',
|
||||||
|
DISMISSED = 'DISMISSED'
|
||||||
|
}
|
||||||
@@ -3,6 +3,6 @@ export enum FranvaroOrsaksKodEnum {
|
|||||||
Arbete = 16,
|
Arbete = 16,
|
||||||
OkandOrsak = 17,
|
OkandOrsak = 17,
|
||||||
AnnanKandOrsak = 18,
|
AnnanKandOrsak = 18,
|
||||||
VAB = 26,
|
VAB = 23,
|
||||||
Utbildning = 27,
|
Utbildning = 24,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
export enum ReportType {
|
|
||||||
AVVIKELSERAPPORT = 'Avvikelserapport',
|
|
||||||
OKAND = 'Okänd',
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
import { AvvikelseOrsaksKodEnum } from '@msfa-enums/avvikelse-orsak-kod.enum';
|
import { FranvaroOrsaksKodEnum } from '@msfa-enums/franvaro-orsak-kod.enum';
|
||||||
import { KandaOrsakerEnum } from '@msfa-enums/kanda-orsaker-kod.enum';
|
|
||||||
import { KandaAvvikelseKoderResponse } from './api/kanda-avvikelse-koder.response.model';
|
import { KandaAvvikelseKoderResponse } from './api/kanda-avvikelse-koder.response.model';
|
||||||
import { OrsaksKoderFranvaroResponse } from './api/orsaks-koder-franvaro.response.model';
|
import { OrsaksKoderFranvaroResponse } from './api/orsaks-koder-franvaro.response.model';
|
||||||
|
|
||||||
export interface OrsaksKoderFranvaro {
|
export interface OrsaksKoderFranvaro {
|
||||||
name: string;
|
name: string;
|
||||||
value: AvvikelseOrsaksKodEnum | KandaOrsakerEnum;
|
value: FranvaroOrsaksKodEnum;
|
||||||
state: number;
|
state: number;
|
||||||
index?: number;
|
index?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user