Skip to content

Commit

Permalink
Add Registration host info
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian committed Aug 31, 2024
1 parent a938b92 commit 1ce6510
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/app/person/person.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,29 @@ <h5 class="card-title">{{ 'person_data' | translate | titlecase }}</h5>
<p>{{ personAcr.person.first_name }} {{ personAcr.person.last_name }}</p>
</div>

<!--
<div class="form-group">
<label class="small text-muted font-weight-bold my-0 py-0">{{ 'date_of_birth' | translate }}</label>
<p>{{ (personAcr.summary.date_of_birth | date:'dd.MM.yyyy') || '-' }}</p>
</div>
-->

<ng-container *ngIf="personRegistration">
<ng-container *ngFor="let hostInfoItem of hostInfo.items">
<div class="form-group" *ngIf="hostInfoItem.custom_field.field_type === 'TEXT'">
<label class="small text-muted font-weight-bold my-0 py-0">{{ hostInfoItem.custom_field.name.text }}</label>
<ng-container *ngFor="let item of personRegistration.person_host_info?.items">
<p *ngIf="item.host_info_item_id == hostInfoItem.id">{{ item.custom_field_data?.string_value }}</p>
</ng-container>
</div>
<div class="form-group" *ngIf="hostInfoItem.custom_field.field_type === 'DATE_OF_BIRTH'">
<label class="small text-muted font-weight-bold my-0 py-0">{{ hostInfoItem.custom_field.name.text }}</label>
<ng-container *ngFor="let item of personRegistration.person_host_info?.items">
<p *ngIf="item.host_info_item_id == hostInfoItem.id">{{ item.custom_field_data?.date_value | date:'dd.MM.yyyy' }}</p>
</ng-container>
</div>
</ng-container>
</ng-container>

<div class="form-group">
<label class="small text-muted font-weight-bold my-0 py-0">{{ 'position' | translate }}</label>
Expand Down
13 changes: 13 additions & 0 deletions src/app/person/person.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { LogsService } from '../../services/logs/logs.service';
import { Log } from '../../types/log';
import { appConfig } from '../app.config';
import { PeopleService } from 'src/services/people/people.service';
import { RegistrationsService } from 'src/services/registrations/registrations.service';
import { PersonRegistration } from 'src/types/person-registration';
import { RegistrationPerson } from 'src/types/registration-person';

@Component({
selector: 'app-person',
Expand All @@ -44,6 +47,8 @@ export class PersonComponent extends WsComponent implements OnInit {

// override person acr
personAcr: PersonAccreditation;
personRegistration: RegistrationPerson;
hostInfo: any;
savingPersonAcr = false;
firstNameChange: Subject<string> = new Subject<string>();
lastNameChange: Subject<string> = new Subject<string>();
Expand All @@ -62,6 +67,7 @@ export class PersonComponent extends WsComponent implements OnInit {
private personAccreditationService: PersonAccreditationService,
private delegateTypeService: DelegateTypeService,
private zoneService: ZoneService,
private registrationsService: RegistrationsService,
private logsService: LogsService,
private peopleService: PeopleService,
private location: Location,
Expand Down Expand Up @@ -100,6 +106,10 @@ export class PersonComponent extends WsComponent implements OnInit {
})
);

this.registrationsService.getHostInfo(this.selectedEvent.id).subscribe(hostInfo => {
this.hostInfo = hostInfo;
});

if (UserRoleUtil.userHasRoles(currentUser, appConfig.worldskillsLogsAppId, 'Admin', 'ViewLogs')) {
// fetch logs
const params = {
Expand Down Expand Up @@ -157,6 +167,9 @@ export class PersonComponent extends WsComponent implements OnInit {
private loadPersonAccreditation(personAcrId: number) {
return this.personAccreditationService.getPersonAccreditation(this.selectedEvent.id, personAcrId).subscribe(person => {
this.personAcr = person;
this.registrationsService.getRegisteredGroupPerson(this.selectedEvent.id, this.personAcr.registration.group_id, this.personAcr.registration.id).subscribe(registeredPerson => {
this.personRegistration = registeredPerson;
});
});
}

Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.local-staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const environment = {
worldskillsApiOrg: 'https://api.worldskills.show/org',
worldskillsApiPeople: 'https://api.worldskills.show/people',
worldskillsApiLogs: 'https://api.worldskills.show/logs',
worldskillsApiRegistrations: 'https://api.worldskills.show/registrations',
worldskillsPeople: 'https://people.worldskills.org',
worldskillsAccreditation: 'https://accreditation.worldskills.org',
worldskillsClientId: '842ea70be298',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const environment = {
worldskillsApiOrg: 'https://api.worldskills.org/org',
worldskillsApiPeople: 'https://api.worldskills.org/people',
worldskillsApiLogs: 'https://api.worldskills.org/logs',
worldskillsApiRegistrations: 'https://api.worldskills.org/registrations',
worldskillsAccreditation: 'https://accreditation.worldskills.org',
worldskillsPeople: 'https://people.worldskills.org',
worldskillsClientId: 'a95703d1aa96',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const environment = {
worldskillsApiOrg: 'https://api.worldskills.show/org',
worldskillsApiPeople: 'https://api.worldskills.show/people',
worldskillsApiLogs: 'https://api.worldskills.show/logs',
worldskillsApiRegistrations: 'https://api.worldskills.show/registrations',
worldskillsAccreditation: 'https://accreditation.worldskills.show',
worldskillsPeople: 'https://people.worldskills.show',
worldskillsClientId: 'a95703d1aa96',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const environment = {
worldskillsApiOrg: 'http://localhost:8080/org',
worldskillsApiPeople: 'http://localhost:8080/people',
worldskillsApiLogs: 'http://localhost:8080/logs',
worldskillsApiRegistrations: 'http://localhost:8080/registrations',
worldskillsAccreditation: 'http://localhost:4200/',
worldskillsPeople: 'https://people.worldskills.org',
worldskillsClientId: 'a95703d1aa96',
Expand Down
16 changes: 16 additions & 0 deletions src/services/registrations/registrations.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';

import { RegistrationsService } from './registrations.service';

describe('RegistrationsService', () => {
let service: RegistrationsService;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(RegistrationsService);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
25 changes: 25 additions & 0 deletions src/services/registrations/registrations.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from '../../environments/environment';
import { Observable } from 'rxjs';
import { RegistrationPerson } from '../../types/registration-person';
import { RegistrationHostInfo } from 'src/types/registration-host-info';

@Injectable({
providedIn: 'root'
})
export class RegistrationsService {

constructor(private http: HttpClient) { }

getHostInfo(eventId: number): Observable<RegistrationHostInfo> {
let url = `${environment.worldskillsApiRegistrations}/manage/events/${eventId}/host_info`;
return this.http.get<RegistrationHostInfo>(url);
}

getRegisteredGroupPerson(eventId: number, groupId: number, registrationId: number): Observable<RegistrationPerson> {
let url = `${environment.worldskillsApiRegistrations}/register/events/${eventId}/groups/${groupId}/internal/registered_people/${registrationId}`;
return this.http.get<RegistrationPerson>(url);
}

}
2 changes: 2 additions & 0 deletions src/types/person-accreditation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {Image} from "./image";
import {PackageOptionZone} from "./package-option-zone";
import {Zone} from "./zone";
import {PersonAccreditationSummary} from "./person-accreditation-summary";
import { PersonRegistration } from "./person-registration";

export interface PersonAccreditation {
id: number;
Expand All @@ -21,6 +22,7 @@ export interface PersonAccreditation {
lines: string;
printed: Date;
image: Image;
registration: PersonRegistration;
package_option_zones: PackageOptionZone[];
zones_add: Zone[];
zones_remove: Zone[];
Expand Down
5 changes: 5 additions & 0 deletions src/types/person-registration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

export interface PersonRegistration {
id: number;
group_id: number;
}
5 changes: 5 additions & 0 deletions src/types/registration-host-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

export interface RegistrationHostInfo {
id: number;
items: any[];
}
7 changes: 7 additions & 0 deletions src/types/registration-person.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Person } from "@worldskills/worldskills-angular-lib";

export interface RegistrationPerson {
id: number;
person: Person;
person_host_info: any;
}

0 comments on commit 1ce6510

Please sign in to comment.