Merge branch 'develop' of ssh://bitbucket.arbetsformedlingen.se:7999/tea/mina-sidor-fa-web into develop
This commit is contained in:
@@ -25,11 +25,12 @@ interface CheckboxModel {
|
|||||||
})
|
})
|
||||||
export class SlutredovisningFormStep0StillUnemployedComponent implements OnInit {
|
export class SlutredovisningFormStep0StillUnemployedComponent implements OnInit {
|
||||||
readonly formGroupKey: MainOccupation = MainOccupation.StillUnemployed;
|
readonly formGroupKey: MainOccupation = MainOccupation.StillUnemployed;
|
||||||
@Input() formGroupRef: FormGroup;
|
|
||||||
|
|
||||||
@Input() formData: SlutredovisningFormStep0StillUnemployedFormData;
|
|
||||||
StillUnemployedReason = StillUnemployedReason;
|
StillUnemployedReason = StillUnemployedReason;
|
||||||
|
|
||||||
|
@Input() formGroupRef: FormGroup;
|
||||||
|
@Input() formData: SlutredovisningFormStep0StillUnemployedFormData;
|
||||||
@Input() shouldValidate: boolean;
|
@Input() shouldValidate: boolean;
|
||||||
|
|
||||||
@Output() nextClick = new EventEmitter<SlutredovisningFormStep0StillUnemployedFormData>();
|
@Output() nextClick = new EventEmitter<SlutredovisningFormStep0StillUnemployedFormData>();
|
||||||
@Output() backClick = new EventEmitter<void>();
|
@Output() backClick = new EventEmitter<void>();
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { BehaviorSubject } from 'rxjs';
|
|||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { SlutredovisningFormData } from '../models/slutredovisning-form-data.model';
|
import { SlutredovisningFormData } from '../models/slutredovisning-form-data.model';
|
||||||
import { SlutredovisningFormService } from '../slutredovisning-form.service';
|
import { SlutredovisningFormService } from '../slutredovisning-form.service';
|
||||||
import { slutredovisningFormDataToSlutredovisningRequest } from '../utils/form-data-to-slutredovisning.util';
|
import { slutredovisningFormDataToSlutredovisningRequest } from '../utils/forms-to-slutredovisning-form-data';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'msfa-slutredovisning-form-step3',
|
selector: 'msfa-slutredovisning-form-step3',
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ChangeDetectionStrategy, Component, OnDestroy } from '@angular/core';
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||||
import { AbstractControl, FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { DeltagareAvrop } from '@msfa-models/avrop.model';
|
import { DeltagareAvrop } from '@msfa-models/avrop.model';
|
||||||
import { addDays } from 'date-fns';
|
import { addDays } from 'date-fns';
|
||||||
import { BehaviorSubject, combineLatest, Observable, Subscription } from 'rxjs';
|
import { combineLatest, Observable } from 'rxjs';
|
||||||
import { map, shareReplay, switchMap } from 'rxjs/operators';
|
import { map, shareReplay, switchMap } from 'rxjs/operators';
|
||||||
import { SlutredovisningFormData } from './models/slutredovisning-form-data.model';
|
import { SlutredovisningFormData } from './models/slutredovisning-form-data.model';
|
||||||
import { SlutredovisningStep0FormData } from './slutredovisning-form-step0/slutredovisning-form-step0.component';
|
import { SlutredovisningStep0FormData } from './slutredovisning-form-step0/slutredovisning-form-step0.component';
|
||||||
@@ -11,7 +11,7 @@ import { SlutredovisningStep1FormData } from './slutredovisning-form-step1/slutr
|
|||||||
import { SlutredovisningStep2FormData } from './slutredovisning-form-step2/slutredovisning-form-step2.component';
|
import { SlutredovisningStep2FormData } from './slutredovisning-form-step2/slutredovisning-form-step2.component';
|
||||||
import { SlutredovisningStep } from './slutredovisning-form.model';
|
import { SlutredovisningStep } from './slutredovisning-form.model';
|
||||||
import { SlutredovisningFormService } from './slutredovisning-form.service';
|
import { SlutredovisningFormService } from './slutredovisning-form.service';
|
||||||
import { formsToSlutredovisningFormData } from './utils/form-data-to-slutredovisning.util';
|
import { formsToSlutredovisningFormData } from './utils/forms-to-slutredovisning-form-data';
|
||||||
|
|
||||||
interface Params {
|
interface Params {
|
||||||
genomforandeReferens: string;
|
genomforandeReferens: string;
|
||||||
@@ -24,7 +24,7 @@ interface Params {
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
providers: [SlutredovisningFormService],
|
providers: [SlutredovisningFormService],
|
||||||
})
|
})
|
||||||
export class SlutredovisningFormComponent implements OnDestroy {
|
export class SlutredovisningFormComponent {
|
||||||
totalSteps = 4;
|
totalSteps = 4;
|
||||||
currentStep$ = this.slutredovisningFormService.currentStep$;
|
currentStep$ = this.slutredovisningFormService.currentStep$;
|
||||||
showAvropDetails$ = this.currentStep$.pipe(map(step => step === 'step0' || step === 'step3'));
|
showAvropDetails$ = this.currentStep$.pipe(map(step => step === 'step0' || step === 'step3'));
|
||||||
@@ -37,8 +37,6 @@ export class SlutredovisningFormComponent implements OnDestroy {
|
|||||||
step1FormData$: Observable<SlutredovisningStep1FormData> = this.slutredovisningFormService.step1FormData$;
|
step1FormData$: Observable<SlutredovisningStep1FormData> = this.slutredovisningFormService.step1FormData$;
|
||||||
step2FormData$: Observable<SlutredovisningStep2FormData> = this.slutredovisningFormService.step2FormData$;
|
step2FormData$: Observable<SlutredovisningStep2FormData> = this.slutredovisningFormService.step2FormData$;
|
||||||
|
|
||||||
shouldValidate$ = new BehaviorSubject<boolean>(false);
|
|
||||||
|
|
||||||
genomforandeReferens$: Observable<number> = this.activatedRoute.params.pipe(
|
genomforandeReferens$: Observable<number> = this.activatedRoute.params.pipe(
|
||||||
map((params: Params) => +params.genomforandeReferens)
|
map((params: Params) => +params.genomforandeReferens)
|
||||||
);
|
);
|
||||||
@@ -59,18 +57,8 @@ export class SlutredovisningFormComponent implements OnDestroy {
|
|||||||
shareReplay(1)
|
shareReplay(1)
|
||||||
);
|
);
|
||||||
|
|
||||||
private subscriptions: Subscription[] = [];
|
|
||||||
|
|
||||||
constructor(private slutredovisningFormService: SlutredovisningFormService, private activatedRoute: ActivatedRoute) {}
|
constructor(private slutredovisningFormService: SlutredovisningFormService, private activatedRoute: ActivatedRoute) {}
|
||||||
|
|
||||||
formControlIsInvalid(formControl: AbstractControl): boolean {
|
|
||||||
return formControl.invalid && (formControl.touched || this.shouldValidate$.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
openConfirmDialog(): void {
|
|
||||||
this.shouldValidate$.next(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private _isAfterEndDate(date: Date): boolean {
|
private _isAfterEndDate(date: Date): boolean {
|
||||||
return new Date() > date;
|
return new Date() > date;
|
||||||
}
|
}
|
||||||
@@ -100,10 +88,6 @@ export class SlutredovisningFormComponent implements OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.subscriptions.forEach(subscription => subscription.unsubscribe());
|
|
||||||
}
|
|
||||||
|
|
||||||
getStepIndex(step: SlutredovisningStep): number {
|
getStepIndex(step: SlutredovisningStep): number {
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case 'step0':
|
case 'step0':
|
||||||
|
|||||||
Reference in New Issue
Block a user