Fixed linting and test
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
import { Component, ChangeDetectionStrategy, Input, EventEmitter, Output } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'msfa-periodisk-redovisning-form',
|
selector: 'msfa-periodisk-redovisning-form',
|
||||||
templateUrl: './periodisk-redovisning-form.component.html',
|
templateUrl: './periodisk-redovisning-form.component.html',
|
||||||
styleUrls: ['./periodisk-redovisning-form.component.scss'],
|
styleUrls: ['./periodisk-redovisning-form.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class PeriodiskRedovisningFormComponent {
|
export class PeriodiskRedovisningFormComponent {
|
||||||
@Input() periodiskRedovisningFormGroup: FormGroup;
|
@Input() periodiskRedovisningFormGroup: FormGroup;
|
||||||
@Input() totalAmountOfSteps: number;
|
@Input() totalAmountOfSteps: number;
|
||||||
@Input() currentStep: number;
|
@Input() currentStep: number;
|
||||||
@Output() submitPRFormGroup = new EventEmitter<FormGroup>();
|
@Output() submitPRFormGroup = new EventEmitter<FormGroup>();
|
||||||
|
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,17 +61,17 @@ export class DeltagareSignalArbeteStudierComponent implements OnInit {
|
|||||||
private deltagareSignalArbeteStudierService: DeltagareSignalArbeteStudierService,
|
private deltagareSignalArbeteStudierService: DeltagareSignalArbeteStudierService,
|
||||||
private deltagareApiService: DeltagareApiService,
|
private deltagareApiService: DeltagareApiService,
|
||||||
private activatedRoute: ActivatedRoute
|
private activatedRoute: ActivatedRoute
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.avrop$ = this.activatedRoute.params.pipe(
|
this.avrop$ = this.activatedRoute.params.pipe(
|
||||||
switchMap(({ genomforandeReferens }) => this.deltagareApiService.fetchAvropInformation$(genomforandeReferens))
|
switchMap(({ genomforandeReferens }) => this.deltagareApiService.fetchAvropInformation$(genomforandeReferens))
|
||||||
)
|
);
|
||||||
|
|
||||||
this.signalArbeteStudierFormGroup = new FormGroup({
|
this.signalArbeteStudierFormGroup = new FormGroup({
|
||||||
ersattningsTyp: new FormControl(null, [RequiredValidator()]),
|
ersattningsTyp: new FormControl(null, [RequiredValidator()]),
|
||||||
date: new FormControl(new Date().toLocaleDateString(), [Validators.required]),
|
date: new FormControl(new Date().toLocaleDateString(), [RequiredValidator()]),
|
||||||
percent: new FormControl('', [Validators.min(1), Validators.max(99)])
|
percent: new FormControl('', [Validators.min(1), Validators.max(99)]),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,8 @@ export class DeltagareSignalArbeteStudierComponent implements OnInit {
|
|||||||
antalProcent: +this.percentFormControl.value,
|
antalProcent: +this.percentFormControl.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deltagareSignalArbeteStudierService.createSignalArbeteStudier$(postSignalArbeteStudier)
|
this.deltagareSignalArbeteStudierService
|
||||||
|
.createSignalArbeteStudier$(postSignalArbeteStudier)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this._submittedDate$.next(new Date());
|
this._submittedDate$.next(new Date());
|
||||||
this.signalArbeteStudierFormGroup.reset();
|
this.signalArbeteStudierFormGroup.reset();
|
||||||
@@ -93,8 +94,7 @@ export class DeltagareSignalArbeteStudierComponent implements OnInit {
|
|||||||
})
|
})
|
||||||
.catch((error: Error) => {
|
.catch((error: Error) => {
|
||||||
this._error$.next(new CustomError({ error, message: error.message, type: ErrorType.API }));
|
this._error$.next(new CustomError({ error, message: error.message, type: ErrorType.API }));
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,8 +118,10 @@ export class DeltagareSignalArbeteStudierComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get partTimeIsSelected(): boolean {
|
get partTimeIsSelected(): boolean {
|
||||||
return +this.ersattningsTypFormControl.value === ErsattningsGrundTypKod.ARBETE_DELTID ||
|
return (
|
||||||
+this.ersattningsTypFormControl.value === ErsattningsGrundTypKod.UTBILDNING_DELTID;
|
+this.ersattningsTypFormControl.value === ErsattningsGrundTypKod.ARBETE_DELTID ||
|
||||||
|
+this.ersattningsTypFormControl.value === ErsattningsGrundTypKod.UTBILDNING_DELTID
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setMinDate(startdatumAvrop: Date): Date {
|
setMinDate(startdatumAvrop: Date): Date {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { LayoutComponent } from '@msfa-shared/components/layout/layout.component';
|
import { LayoutComponent } from '@msfa-shared/components/layout/layout.component';
|
||||||
import { FranvaroReportComponent } from './franvaro-report.component';
|
import { FranvaroReportComponent } from './franvaro-report.component';
|
||||||
|
import { FranvaroReportService } from './franvaro-report.service';
|
||||||
|
|
||||||
describe('FranvaroReportComponent', () => {
|
describe('FranvaroReportComponent', () => {
|
||||||
let component: FranvaroReportComponent;
|
let component: FranvaroReportComponent;
|
||||||
@@ -14,6 +15,7 @@ describe('FranvaroReportComponent', () => {
|
|||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
declarations: [FranvaroReportComponent, LayoutComponent],
|
declarations: [FranvaroReportComponent, LayoutComponent],
|
||||||
imports: [RouterTestingModule, HttpClientTestingModule],
|
imports: [RouterTestingModule, HttpClientTestingModule],
|
||||||
|
providers: [FranvaroReportService],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/;
|
export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/;
|
||||||
export const ISO_DATE_NO_TIME = /^\d{4}[\-\/\s]?((((0[13578])|(1[02]))[\-\/\s]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\-\/\s]?(([0-2][0-9])|(30)))|(02[\-\/\s]?[0-2][0-9]))$/;
|
export const ISO_DATE_NO_TIME = /^\d{4}[-/\s]?((((0[13578])|(1[02]))[-/\s]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[-/\s]?(([0-2][0-9])|(30)))|(02[-/\s]?[0-2][0-9]))$/;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function mapDeltagareHandelseApiResponse(
|
|||||||
const { description, receivedDate, isAvbrott } = deltagareHandelseApiResponse;
|
const { description, receivedDate, isAvbrott } = deltagareHandelseApiResponse;
|
||||||
const effectDate = deltagareHandelseApiResponse.tidpunkt;
|
const effectDate = deltagareHandelseApiResponse.tidpunkt;
|
||||||
const effectDescription =
|
const effectDescription =
|
||||||
GENOMFORANDEHANDELSE_EFFECT_MAP[deltagareHandelseApiResponse.tidpunktDescription] ??
|
(GENOMFORANDEHANDELSE_EFFECT_MAP[deltagareHandelseApiResponse.tidpunktDescription] as string) ??
|
||||||
deltagareHandelseApiResponse.tidpunktDescription ??
|
deltagareHandelseApiResponse.tidpunktDescription ??
|
||||||
'';
|
'';
|
||||||
return { description, receivedDate, isAvbrott, effectDate, effectDescription };
|
return { description, receivedDate, isAvbrott, effectDate, effectDescription };
|
||||||
|
|||||||
Reference in New Issue
Block a user