diff --git a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-card/employee-card.component.html b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-card/employee-card.component.html index c1e3b60..f520b2d 100644 --- a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-card/employee-card.component.html +++ b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-card/employee-card.component.html @@ -2,7 +2,7 @@
- Redigera + Redigera

{{ employee.fullName }}

Här kan du se och ändra personalkontots behörigheter. Ändra behörighet genom att klicka på redigera.

diff --git a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.html b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.html index a458164..7888ff0 100644 --- a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.html +++ b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.html @@ -16,15 +16,16 @@ [afInvalid]="emailFormControl.invalid && emailFormControl.touched" > -
+
Tjänster

Välj de tjänster du vill ge personalen tillgång till.

-
- +
+
-
+
Utförande verksamheter och adresser

Välj de utförandeverksamheter och utförande adresser du vill ge personalen behörighet till. @@ -75,7 +76,7 @@

-
+
Behörigheter

Här tilldelar du specifika behörigheter i systemet. Välj nedan vilka arbetsuppgifter som användaren ska kunna @@ -83,22 +84,22 @@ användaren hör till. Användaren kan därför endast utföra uppgifter och se information inom den/ de utförande adresser som tilldelats användaren. Läs mer om behörigheter här

-
    -
  • +
      +
    @@ -114,9 +115,9 @@ ; + tjanster: FormTagData[], + roles: Array; } @Component({ @@ -27,149 +30,185 @@ export interface EditEmployeeFormData { }) export class EditEmployeeFormComponent implements OnInit, OnChanges { @Input() currentEmail: string | null = null; - @Input() selectableAuthorizations: Array | null = null; - @Input() currentEmployeeAuthorizations: Array | null = null; + @Input() availableRoles: Array | null = null; + @Input() currentEmployeeRoles: Array | null = null; + + @Input() availableTjanster: Array | null = null; + @Input() currentEmployeeTjanster: Array | null = null; + selectedTjanster: Array | null = null; + @Output() formSubmitted = new EventEmitter(); - @Input() selectableServices: Array | null = null; - @Input() currentEmployeeServices: Array | null = null; readonly ButtonVariation = ButtonVariation; readonly ButtonType = ButtonType; readonly ButtonSize = ButtonSize; readonly emailFormControlName = 'email'; + readonly tjansterFormControlName = 'tjanster'; editEmployeeFormGroup: FormGroup | null = null; - authorizationsFormGroup: FormGroup | null = null; + rolesFormGroup: FormGroup | null = null; - displayAuthorizationDialog = false; + displayRolesDialog = false; constructor() {} ngOnInit(): void { - console.log(':::::::', this.selectableServices); - console.log('!!!!!!!', this.currentEmployeeServices); this.initializeEditEmployeeFormGroup(); + + if(this.currentEmployeeTjanster) { + this.selectedTjanster = this.currentEmployeeTjanster + .map(tjanst => ({tjanstekod: tjanst.code, name: tjanst.name} as FormTagData)); + } } ngOnChanges(changes: SimpleChanges): void { - if (changes.selectableAuthorizations) { + if (changes.availableRoles || changes.availableTjanster) { this.initializeEditEmployeeFormGroup(); } - if (changes.currentEmployeeAuthorizations) { - this.updateAuthorizationFormGroup(); + if (changes.currentEmployeeRoles) { + this.updateRolesFormGroup(); } if (changes.currentEmail) { this.editEmployeeFormGroup.patchValue(Object.fromEntries([[this.emailFormControlName, this.currentEmail]])); } + + if(changes.currentEmployeeTjanster) { + this.editEmployeeFormGroup.patchValue(Object.fromEntries([[this.tjansterFormControlName, '']])); + } } get emailFormControl(): AbstractControl | null { return this.editEmployeeFormGroup?.get(this.emailFormControlName); } + get tjansterFormControl(): AbstractControl | null { + return this.editEmployeeFormGroup?.get(this.tjansterFormControlName); + } + onFormSubmitted(): void { if (!this.editEmployeeFormGroup) { return; } - this.editEmployeeFormGroup.markAllAsTouched(); - - if (this.editEmployeeFormGroup.invalid) { + if (this.editEmployeeFormGroup.invalid || this.editEmployeeFormGroup.pristine) { return; } this.formSubmitted.emit({ email: this.emailFormControl?.value, - authorizations: this.getAuthorizationsFromFormGroup(this.authorizationsFormGroup, this.selectableAuthorizations), + tjanster: this.selectedTjanster, + roles: this.getRolesFromFormGroup(this.rolesFormGroup, this.availableRoles), }); } - getFormControlName(authorization: Authorization): string { - return authorization?.id?.replace(/[^a-zA-Z0-9]/g, ''); + getFormControlName(role: Role): string { + return RoleEnum[role?.type]; } - openAuthorizationDialog(): void { - this.displayAuthorizationDialog = true; + openRolesDialog(): void { + this.displayRolesDialog = true; } - closeAuthorizationDialog(): void { - this.displayAuthorizationDialog = false; + closeRolesDialog(): void { + this.displayRolesDialog = false; } private initializeEditEmployeeFormGroup(): void { - this.authorizationsFormGroup = this.getAuthorizationFormGroup( - this.selectableAuthorizations, - this.currentEmployeeAuthorizations + this.rolesFormGroup = this.getRolesFormGroup( + this.availableRoles, + this.currentEmployeeRoles ); this.editEmployeeFormGroup = new FormGroup({ email: new FormControl(this.currentEmail, [Validators.required, Validators.email]), - authorizations: this.authorizationsFormGroup, + tjanster: new FormControl('', []), + roles: this.rolesFormGroup, }); } - private updateAuthorizationFormGroup(): void { - if (!this.authorizationsFormGroup || !this.selectableAuthorizations) { + private updateRolesFormGroup(): void { + if (!this.rolesFormGroup || !this.availableRoles) { return; } - this.authorizationsFormGroup.patchValue( + this.rolesFormGroup.patchValue( Object.fromEntries( - this.selectableAuthorizations.map(authorization => [ - this.getFormControlName(authorization), - this.isSelectedAuthorization(authorization, this.currentEmployeeAuthorizations), + this.availableRoles.map(role => [ + this.getFormControlName(role), + this.isSelectedRole(role, this.currentEmployeeRoles), ]) ) ); } - private getAuthorizationsFromFormGroup( + private getRolesFromFormGroup( formGroup: FormGroup | null, - authorizations: Array | null - ): Array { - if (!formGroup || !authorizations) { + roles: Array | null + ): Array { + if (!formGroup || !roles) { return; } - return authorizations.filter( - authorization => formGroup.get(this.getFormControlName(authorization))?.value === true + return roles.filter( + role => formGroup.get(this.getFormControlName(role))?.value === true ); } - private getAuthorizationFormGroup( - authorizations: Array | null, - selectedAuthorizations: Array | null + private getRolesFormGroup( + roles: Array | null, + selectedRoles: Array | null ): FormGroup { - if (!authorizations) { + if (!roles) { return new FormGroup({}); } return new FormGroup( Object.fromEntries( - authorizations.map(authorization => [ - this.getFormControlName(authorization), - new FormControl(this.isSelectedAuthorization(authorization, selectedAuthorizations), []), + roles.map(role => [ + this.getFormControlName(role), + new FormControl(this.isSelectedRole(role, selectedRoles), []), ]) ) ); } - private isSelectedAuthorization( - authorization: Authorization, - selectedAuthorizations: Array | null + private isSelectedRole( + role: Role, + selectedRoles: Array | null ): boolean { - if (!selectedAuthorizations || !authorization) { + if (!selectedRoles || !role) { return false; } - return selectedAuthorizations.some(selectedAuthorization => selectedAuthorization.id === authorization.id); + return selectedRoles.some(selectedRole => selectedRole === role.type); } - // Services helper methods - unselectEmployeeService() { - console.log('Unselect the service from list and tag will get removed'); + // Tjanster helper methods + toggleTjanst(): void { + const tjanstExistsInList: boolean = this.selectedTjanster + .some(tag => tag.tjanstekod === this.tjansterFormControl.value); + + const selectedTjanst: FormTagData[] = this.availableTjanster + .filter(tjanst => tjanst.value === this.tjansterFormControl.value) + .map(tjanst => ({tjanstekod: tjanst.value, name: tjanst.name})); + if(this.tjansterFormControl.value && !tjanstExistsInList) { + this.selectedTjanster.push(...selectedTjanst); + } + } + + + unselectTjanstTag(tjanst: FormTagData): void { + const tagExistsInList = this.selectedTjanster.some(tag => tag.tjanstekod === tjanst.tjanstekod); + if(tjanst.tjanstekod && tagExistsInList) { + this.selectedTjanster.splice(this.selectedTjanster.indexOf(tjanst), 1); + } + this.tjansterFormControl.setValue(''); +} + + selectAllUtforandeVerksamheter(checked: boolean):void { + console.log('selectAllUtforandeVerksamheter', checked); } } diff --git a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/employee-form.component.html b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/employee-form.component.html index 344eced..bcaeebc 100644 --- a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/employee-form.component.html +++ b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/employee-form.component.html @@ -1,7 +1,7 @@
    - {{ error.message }} - + -->

    {{ employee.fullName }}

    @@ -40,14 +40,14 @@
    -
    diff --git a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/employee-form.component.ts b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/employee-form.component.ts index 8293c90..ad7ee4d 100644 --- a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/employee-form.component.ts +++ b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/employee-form.component.ts @@ -1,17 +1,14 @@ -import { FormSelectBaseItem } from '@af/digi-ng/_form/form-select-base'; -import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Authorization } from '@msfa-models/authorization.model'; +/* eslint-disable @typescript-eslint/no-unsafe-call */ +import { FormSelectItem } from '@af/digi-ng/_form/form-select'; +import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { UnsubscribeDirective } from '@msfa-directives/unsubscribe.directive'; import { Employee } from '@msfa-models/employee.model'; -import { Service } from '@msfa-models/service.model'; -import { AuthorizationService } from '@msfa-services/api/authorizations.service'; +import { mapRoleResponseToRoleObject, Role } from '@msfa-models/role.model'; +import { Tjanst } from '@msfa-models/tjanst.model'; import { EmployeeService } from '@msfa-services/api/employee.service'; -import { ServiceService } from '@msfa-services/api/service.service'; -import { EmailValidator } from '@msfa-utils/validators/email.validator'; -import { RequiredValidator } from '@msfa-validators/required.validator'; +import { TjanstService } from '@msfa-services/api/tjanst.service'; import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; import { EditEmployeeFormData } from './edit-employee-form/edit-employee-form.component'; @Component({ @@ -20,127 +17,52 @@ import { EditEmployeeFormData } from './edit-employee-form/edit-employee-form.co styleUrls: ['./employee-form.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class EmployeeFormComponent { - employee$: Observable = this.employeeService.employee$; - services$: Observable = this.serviceService.services$; - authorizations$: Observable = this.authorizationService.authorizations$; - employeeCurrentServices: Service[] | null | undefined; +export class EmployeeFormComponent extends UnsubscribeDirective implements OnInit { + subscriptionsList = []; + employee$ = this.employeeService.employee$; + employee: Employee; - servicesSelectItems$: Observable = this.services$.pipe( - map(services => services.map(({ name, id }) => ({ name, value: id }))) - ); - toggleDialog = false; - modalAuthInfo: { name: string } = { name: 'Test Behörighetsnamn' }; + tjanster$: Observable = this.tjanstService.tjanster$; + availableTjanster: FormSelectItem[] | null = null; - formGroup: FormGroup = this.formBuilder.group({ - email: this.formBuilder.control('', [RequiredValidator('E-postadress'), EmailValidator('E-postadress')]), - services: this.formBuilder.control([], [RequiredValidator('en tjänst')]), - authorizations: new FormGroup({}), - }); - todaysDate = new Date(); - submitted = false; + selectableRoles: Role[] | null = this.employeeService.getAllRoles(); + currentEmployeeRoles: Role[] | undefined | null = null; constructor( - private formBuilder: FormBuilder, private employeeService: EmployeeService, - private serviceService: ServiceService, - private authorizationService: AuthorizationService, - private router: Router, + private tjanstService: TjanstService, private activatedRoute: ActivatedRoute ) { - this.employeeService.setCurrentEmployeeId(this.activatedRoute.snapshot.params.employeeId); + super(); + super.unsubscribeOnDestroy(...this.subscriptionsList); + } + + ngOnInit(): void { + this.employeeService.setCurrentEmployeeId(this.activatedRoute.snapshot.params['employeeId']); + const employeeDataSub = this.employee$.subscribe(employee => { + this.employee = employee; + console.log('Detailed Employee Data:::', employee); + this.currentEmployeeRoles = employee?.roles + .map(role => mapRoleResponseToRoleObject(role)); + }); + + const tjanstRelatedDataSub = this.tjanster$.subscribe(tjanster => { + const tjanstOptions: FormSelectItem[] = []; + tjanster?.forEach(tjanst => { + console.log('each tjanst', tjanst); + tjanstOptions.push({name: tjanst?.name, value: tjanst?.code}); + }); + this.availableTjanster = tjanstOptions; + console.log('availableTjanster', this.availableTjanster); + }); + + this.subscriptionsList.push( + employeeDataSub, + tjanstRelatedDataSub + ); } updateEmployee(editEmployeeFormData: EditEmployeeFormData): void { console.log(editEmployeeFormData); } - - get servicesControl(): AbstractControl { - return this.formGroup.get('services'); - } - - get formErrors(): { id: string; message: string }[] { - const controlsWithErrors = Object.keys(this.formGroup.controls).filter( - key => !!this.formGroup.controls[key].errors - ); - - return controlsWithErrors.map(key => ({ - id: key, - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - message: this.formGroup.controls[key].errors.message, - })); - } - - private _markFormAsDirty(): void { - Object.keys(this.formGroup.controls).forEach(control => { - this.formGroup.get(control).markAsDirty(); - this.formGroup.get(control).markAsTouched(); - }); - } - - toggleService(service: Service, id: string): void { - /* //const currentServices = this.servicesControl.value as { id: unknown }[]; - const selectedServiceObject = this.employeeCurrentServices.find(obj => obj.id === id); - const serviceObjectExists = selectedServiceObject - ? this.employeeCurrentServices.some(obj => obj.id === selectedServiceObject.id) - : false; - - if (!serviceObjectExists && selectedServiceObject !== undefined) { - this.employeeCurrentServices.push(selectedServiceObject); - } */ - } - - unselectService(id: string, service: Service) { - /* const selectedServiceObject = this.employeeCurrentServices.find(obj => obj.id === id); - const serviceObjectExists = this.employeeCurrentServices?.some(x => (x.id = id)); - console.log('employeeCurrentServices', this.employeeCurrentServices); - if (serviceObjectExists && selectedServiceObject !== undefined) { - this.employeeCurrentServices.splice(this.employeeCurrentServices.indexOf(selectedServiceObject), 1); - } */ - } - - openDialog(val: boolean, authName?: string): void { - if (authName) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - this.modalAuthInfo.name = authName; - } - this.toggleDialog = val; - } - - setFocusOnInvalidInput(event: CustomEvent): void { - console.log(event.target); - } - - resetForm(event: Event): void { - event.preventDefault(); - this.formGroup.reset({ - firstName: '', - lastName: '', - ssn: '', - services: [], - authorizations: [], - }); - // Object.keys(this.formGroup.controls).forEach(controlKey => this.formGroup.controls[controlKey].markAsPristine()); - } - - submitForm(): void { - this.submitted = true; - if (this.formGroup.valid) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - const submittableValues = { - ...this.formGroup.value, - }; - const post = this.employeeService.postNewEmployee(submittableValues).subscribe({ - next: id => { - void this.router.navigate(['/administration', 'personal', id]); - }, - complete: () => { - post.unsubscribe(); - }, - }); - } else { - console.error('Form is invalid, do something...'); - this._markFormAsDirty(); - } - } } diff --git a/apps/mina-sidor-fa/src/app/shared/enums/service.enum.ts b/apps/mina-sidor-fa/src/app/shared/enums/service.enum.ts index c5b619a..716cb1b 100644 --- a/apps/mina-sidor-fa/src/app/shared/enums/service.enum.ts +++ b/apps/mina-sidor-fa/src/app/shared/enums/service.enum.ts @@ -1,5 +1,5 @@ -export enum Service { - KVL = 'KVL', - KROM = 'KROM', - STOM = 'STOM', -} +export enum ServiceEnum { + KVL, + KROM, + STOM +} \ No newline at end of file diff --git a/apps/mina-sidor-fa/src/app/shared/models/form-tag.model.ts b/apps/mina-sidor-fa/src/app/shared/models/form-tag.model.ts new file mode 100644 index 0000000..5cf6773 --- /dev/null +++ b/apps/mina-sidor-fa/src/app/shared/models/form-tag.model.ts @@ -0,0 +1,12 @@ +import { Tjanst } from "./tjanst.model"; + +export interface FormTagData { + tjanstekod: string, + name: string; +} + + +export function mapTjanstToFormTag(tjanstData: Tjanst): FormTagData { + const { name, code } = tjanstData; + return { tjanstekod: code, name} +} \ No newline at end of file diff --git a/apps/mina-sidor-fa/src/app/shared/models/participant.model.ts b/apps/mina-sidor-fa/src/app/shared/models/participant.model.ts index 47756d1..c5d5eec 100644 --- a/apps/mina-sidor-fa/src/app/shared/models/participant.model.ts +++ b/apps/mina-sidor-fa/src/app/shared/models/participant.model.ts @@ -1,5 +1,5 @@ import { ParticipantStatus } from '@msfa-enums/participant-status.enum'; -import { Service } from '@msfa-enums/service.enum'; +import { ServiceEnum } from '@msfa-enums/service.enum'; import { PaginationMeta } from './pagination-meta.model'; export interface Participant { @@ -10,7 +10,7 @@ export interface Participant { ssn: string; status: ParticipantStatus; nextStep: string; - service: Service; + service: ServiceEnum; errandNumber: number; startDate: Date; endDate: Date; @@ -33,7 +33,7 @@ export interface ParticipantApiResponseData { ssn: string; status: ParticipantStatus; nextStep: string; - service: Service; + service: ServiceEnum; errandNumber: number; startDate: Date; endDate: Date; diff --git a/apps/mina-sidor-fa/src/app/shared/models/role.model.ts b/apps/mina-sidor-fa/src/app/shared/models/role.model.ts index 949ab65..93ede18 100644 --- a/apps/mina-sidor-fa/src/app/shared/models/role.model.ts +++ b/apps/mina-sidor-fa/src/app/shared/models/role.model.ts @@ -4,3 +4,35 @@ export interface Role { name: string; type: RoleEnum; } + +export function mapRoleResponseToRoleObject(type: string): Role { + switch(type) { + case 'OrganizationUser': + return { + name: 'Basanvändare', + type: RoleEnum[type] + }; + case 'ReportAndPlanning': + return { + name: 'Rapportering, planering och information om deltagare', + type: RoleEnum[type] + }; + case 'ReceiveDeltagare': + return { + name: 'Ta emot deltagare', + type: RoleEnum[RoleEnum[type]] + }; + case 'AuthAdmin': + return { + name: 'Administrera behörigheter', + type: RoleEnum[RoleEnum[type]] + }; + case 'ContactPerson': + return { + name: 'Kontaktperson', + type: RoleEnum[type] + }; + default: + return; + } +} \ No newline at end of file diff --git a/apps/mina-sidor-fa/src/app/shared/models/service.model.ts b/apps/mina-sidor-fa/src/app/shared/models/service.model.ts index 0cc55f6..8523c54 100644 --- a/apps/mina-sidor-fa/src/app/shared/models/service.model.ts +++ b/apps/mina-sidor-fa/src/app/shared/models/service.model.ts @@ -1,8 +1,11 @@ -import { Service as ServiceEnum } from '@msfa-enums/service.enum'; +import { ServiceEnum } from '@msfa-enums/service.enum'; export interface Service { id: string; - name: ServiceEnum; + name: string; + tjanstekod: string; + tjanstId: number; + type: ServiceEnum; } export interface ServiceApiResponse { @@ -11,13 +14,32 @@ export interface ServiceApiResponse { export interface ServiceApiResponseData { id: string; - name: ServiceEnum; + name: string; + tjanstekod: string; + tjanstId: number; + type: ServiceEnum; } export function mapServiceApiResponseToService(data: ServiceApiResponseData): Service { - const { id, name } = data; + const { id, name, tjanstekod, tjanstId } = data; return { id, name, + tjanstekod, + tjanstId, + type: getServiceEnumType(name), }; } + +export function getServiceEnumType(name: string):ServiceEnum { + switch (name) { + case 'Kundval Rusta och matcha': + return ServiceEnum.KROM; + case 'Karriärvägledning': + return ServiceEnum.KVL; + case 'Stöd och Matchning': + return ServiceEnum.STOM; + default: + break; + } +} diff --git a/apps/mina-sidor-fa/src/app/shared/services/api/employee.service.ts b/apps/mina-sidor-fa/src/app/shared/services/api/employee.service.ts index 679a18d..cf36ae8 100644 --- a/apps/mina-sidor-fa/src/app/shared/services/api/employee.service.ts +++ b/apps/mina-sidor-fa/src/app/shared/services/api/employee.service.ts @@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { UnsubscribeDirective } from '@msfa-directives/unsubscribe.directive'; import { ErrorType } from '@msfa-enums/error-type.enum'; +import { RoleEnum } from '@msfa-enums/role.enum'; import { SortOrder } from '@msfa-enums/sort-order.enum'; import { environment } from '@msfa-environment'; import { DeleteEmployeeMockApiResponse } from '@msfa-models/api/delete-employee.response.model'; @@ -20,6 +21,7 @@ import { mapResponseToEmployeeCompact, } from '@msfa-models/employee.model'; import { errorToCustomError } from '@msfa-models/error/custom-error'; +import { mapRoleResponseToRoleObject, Role } from '@msfa-models/role.model'; import { Sort } from '@msfa-models/sort.model'; import { ErrorService } from '@msfa-services/error.service'; import { BehaviorSubject, combineLatest, Observable, of, throwError } from 'rxjs'; @@ -41,7 +43,6 @@ export class EmployeeService extends UnsubscribeDirective { private _employee$ = new BehaviorSubject(null); public employee$: Observable = this._employee$.asObservable(); - constructor( private httpClient: HttpClient, private errorService: ErrorService, @@ -187,4 +188,17 @@ export class EmployeeService extends UnsubscribeDirective { catchError(error => throwError({ message: error as string, type: ErrorType.API })) ); } + + public updateEmployeeData(employeeData: Employee): Observable { + return /* this.httpClient.put<{ id: string }>(`${this._apiBaseUrl}/${employeeData.id}`, + mapEmployeeToRequestData(employeeData), API_HEADERS).pipe( + map(({ id }) => id), + catchError(error => throwError({ message: error as string, type: ErrorType.API })) + ); */ + } + + public getAllRoles(): Role[] { + const allAuths: string[] = Object.keys(RoleEnum).filter((item) => {return isNaN(Number(item))}); + return allAuths.map(key => mapRoleResponseToRoleObject(key)); + } } diff --git a/apps/mina-sidor-fa/src/app/shared/utils/map-paths-to-breadcrumbs.util.ts b/apps/mina-sidor-fa/src/app/shared/utils/map-paths-to-breadcrumbs.util.ts index 07fc65c..b6bc69f 100644 --- a/apps/mina-sidor-fa/src/app/shared/utils/map-paths-to-breadcrumbs.util.ts +++ b/apps/mina-sidor-fa/src/app/shared/utils/map-paths-to-breadcrumbs.util.ts @@ -17,8 +17,7 @@ export function mapPathsToBreadcrumbs( breadcrumbs[breadcrumbs.length - 1].text = 'Personal information'; } else if (isParticipantCardRoute(paths)) { breadcrumbs[breadcrumbs.length - 1].text = 'Deltagarinformation'; - } - + } return breadcrumbs; } 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 d21ae02..556aa75 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 @@ -15,4 +15,4 @@ export function RequiredValidator(label = 'Fältet'): ValidatorFn { return null; }; -} +} \ No newline at end of file diff --git a/mock-api/mina-sidor-fa/scripts/tjanster.js b/mock-api/mina-sidor-fa/scripts/tjanster.js index 4b158ca..0ff26a4 100644 --- a/mock-api/mina-sidor-fa/scripts/tjanster.js +++ b/mock-api/mina-sidor-fa/scripts/tjanster.js @@ -5,8 +5,12 @@ faker.locale = 'sv'; function generateTjanster() { const tjanster = [ { - id: 'A012', - label: 'Kundval Rusta och matcha', + id: 'KROM', + name: 'Kundval Rusta och Matcha', + tjanstekod: 'KROM', + tjanstId: 33, + count: 8, // Behövs för avrop-tjanst + label: 'Kundval Rusta och Matcha', // Behövs för avrop-tjanst }, // { // id: 'KVL',