Add participant and workshop page
parent
d29fd0e64c
commit
4cbda4be4d
@ -1 +1,11 @@
|
||||
<p>participant works!</p>
|
||||
<app-data-page
|
||||
[dataService]="dataService"
|
||||
[propertiesInfo]="propertiesInfo"
|
||||
[headlineDataPath]="headlineDataPath"
|
||||
[headlineIconName]="headlineIconName"
|
||||
[pageDataGQLType]="pageDataGQLType"
|
||||
[pageDataGQLUpdateInputType]="pageDataGQLUpdateInputType"
|
||||
(lockEvent)="lock($event)"
|
||||
(saveEvent)="save($event)"
|
||||
(cancelEvent)="cancel($event)"
|
||||
></app-data-page>
|
@ -1,15 +1,138 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ParticipantsService } from 'src/app/services/participants.service';
|
||||
import { WorkshopsService } from 'src/app/services/workshop.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-participant',
|
||||
templateUrl: './participant.component.html',
|
||||
styleUrls: ['./participant.component.scss']
|
||||
styleUrls: ['./participant.component.scss'],
|
||||
})
|
||||
export class ParticipantComponent implements OnInit {
|
||||
propertiesInfo = [
|
||||
{
|
||||
type: 'Group',
|
||||
title: 'Allgemein',
|
||||
properties: [
|
||||
{ dataPath: 'dateRange', translation: 'Zeitraum' },
|
||||
{ dataPath: 'usernamefLotte', translation: 'User fLotte' },
|
||||
{ dataPath: 'usernameSlack', translation: 'User Slack' },
|
||||
{ dataPath: 'memberADFC', translation: 'Mitglied ADFC' },
|
||||
{
|
||||
dataPath: 'locationZIPs',
|
||||
translation: 'Einsatz in PLZ',
|
||||
},
|
||||
{
|
||||
dataPath: 'memberCoreTeam',
|
||||
translation: 'Teil des Kernteams',
|
||||
},
|
||||
{
|
||||
dataPath: 'distributedActiveBikeParte',
|
||||
translation: 'Verteiler aktive Radpat*innen',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'Group',
|
||||
title: 'Kontaktinformation',
|
||||
properties: [
|
||||
{
|
||||
dataPath: 'contactInformation.person.firstName',
|
||||
translation: 'Vorname',
|
||||
},
|
||||
{
|
||||
dataPath: 'contactInformation.person.name',
|
||||
translation: 'Nachname',
|
||||
},
|
||||
{
|
||||
dataPath: 'contactInformation.phone',
|
||||
translation: 'Telefonnummer',
|
||||
},
|
||||
{
|
||||
dataPath: 'contactInformation.phone2',
|
||||
translation: 'Telefonnummer 2',
|
||||
},
|
||||
{ dataPath: 'contactInformation.email', translation: 'Email' },
|
||||
{ dataPath: 'contactInformation.email2', translation: 'Email 2' },
|
||||
{ dataPath: 'contactInformation.note', translation: 'Anmerkung' },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'ReferenceTable',
|
||||
title: 'Workshops',
|
||||
dataPath: 'workshops',
|
||||
dataService: null,
|
||||
columnInfo: [
|
||||
{ dataPath: 'title', translation: 'Workshopname' },
|
||||
{ dataPath: 'description', translation: 'Details' },
|
||||
],
|
||||
nameToShowInSelection: (workshop) => {
|
||||
return workshop.title + ' ' + workshop.description;
|
||||
},
|
||||
linkToTable: (element) => {
|
||||
return '/table/workshops';
|
||||
},
|
||||
propertyNameOfUpdateInput: 'workshopIds',
|
||||
},
|
||||
|
||||
constructor() { }
|
||||
{
|
||||
type: 'ReferenceTable',
|
||||
title: 'Engagements',
|
||||
dataPath: 'engagement',
|
||||
dataService: null,
|
||||
columnInfo: [
|
||||
{
|
||||
dataPath: 'engagementType.name',
|
||||
translation: 'Engagementtyp',
|
||||
},
|
||||
{
|
||||
dataPath: 'engagementType.description',
|
||||
translation: 'Engagementtyp Erklärung',
|
||||
},
|
||||
{ dataPath: 'dateRange', translation: 'Zeitraum' },
|
||||
{
|
||||
dataPath: 'cargoBike.name',
|
||||
translation: 'Lastenrad',
|
||||
link: (element) => {
|
||||
return '/bike/' + element['cargoBike.id'];
|
||||
},
|
||||
},
|
||||
],
|
||||
editableReferences: false,
|
||||
linkToTable: (element) => {
|
||||
return '/table/engagements';
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
headlineDataPath = 'contactInformation.person.name';
|
||||
headlineIconName = 'directions_run';
|
||||
pageDataGQLType: string = 'Participant';
|
||||
pageDataGQLUpdateInputType: string = 'ParticipantUpdateInput';
|
||||
|
||||
dataService: any;
|
||||
|
||||
constructor(private participantsService: ParticipantsService, private workshopsService: WorkshopsService) {
|
||||
this.workshopsService.loadTableData();
|
||||
this.workshopsService.tableData.subscribe((data) => {
|
||||
this.propertiesInfo.find(
|
||||
(prop) => prop.dataPath === 'workshops'
|
||||
).dataService = this.workshopsService;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.dataService = this.participantsService;
|
||||
}
|
||||
|
||||
lock(row: any) {
|
||||
this.participantsService.lockParticipant({ id: row.id });
|
||||
}
|
||||
|
||||
save(row: any) {
|
||||
this.participantsService.updateParticipant({ participant: row });
|
||||
}
|
||||
|
||||
cancel(row: any) {
|
||||
this.participantsService.unlockParticipant({ id: row.id });
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,11 @@
|
||||
<p>workshop works!</p>
|
||||
<app-data-page
|
||||
[dataService]="dataService"
|
||||
[propertiesInfo]="propertiesInfo"
|
||||
[headlineDataPath]="headlineDataPath"
|
||||
[headlineIconName]="headlineIconName"
|
||||
[pageDataGQLType]="pageDataGQLType"
|
||||
[pageDataGQLUpdateInputType]="pageDataGQLUpdateInputType"
|
||||
(lockEvent)="lock($event)"
|
||||
(saveEvent)="save($event)"
|
||||
(cancelEvent)="cancel($event)"
|
||||
></app-data-page>
|
@ -1,15 +1,209 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { WorkshopsService } from 'src/app/services/workshop.service';
|
||||
import { WorkshopTypesService } from 'src/app/services/workshopTypes.service';
|
||||
import { ParticipantsService } from 'src/app/services/participants.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-workshop',
|
||||
templateUrl: './workshop.component.html',
|
||||
styleUrls: ['./workshop.component.scss']
|
||||
styleUrls: ['./workshop.component.scss'],
|
||||
})
|
||||
export class WorkshopComponent implements OnInit {
|
||||
propertiesInfo = [
|
||||
{
|
||||
type: 'Group',
|
||||
title: 'Allgemein',
|
||||
properties: [
|
||||
{ dataPath: 'title', translation: 'Workshopname' },
|
||||
{ dataPath: 'description', translation: 'Details' },
|
||||
{
|
||||
dataPath: 'date',
|
||||
translation: 'Datum',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'Group',
|
||||
title: 'Workshoptyp',
|
||||
possibleObjects: [],
|
||||
nameToShowInSelection: (workshopType) => {
|
||||
return workshopType.name;
|
||||
},
|
||||
propertyPrefixToOverwrite: 'workshopType',
|
||||
currentlySelectedObjectId: (provider) => {
|
||||
return provider['workshopType.id'];
|
||||
},
|
||||
propertyNameOfReferenceId: 'workshopTypeId',
|
||||
properties: [
|
||||
{
|
||||
dataPath: 'workshopType.name',
|
||||
translation: 'Workshoptyp',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'Group',
|
||||
title: 'Trainer 1',
|
||||
possibleObjects: [],
|
||||
nameToShowInSelection: (participant) => {
|
||||
return (
|
||||
(participant.contactInformation.person.firstName || '') +
|
||||
' ' +
|
||||
(participant.contactInformation.person.name || '') +
|
||||
' ' +
|
||||
(participant.contactInformation.email || '') +
|
||||
' ' +
|
||||
(participant.contactInformation.phone || '') +
|
||||
' ' +
|
||||
(participant.contactInformation.note || '')
|
||||
);
|
||||
},
|
||||
propertyPrefixToOverwrite: 'trainer1',
|
||||
currentlySelectedObjectId: (provider) => {
|
||||
return provider['trainer1.id'];
|
||||
},
|
||||
propertyNameOfReferenceId: 'trainer1Id',
|
||||
properties: [
|
||||
{
|
||||
dataPath: 'trainer1.contactInformation.person.firstName',
|
||||
translation: 'Vorname',
|
||||
},
|
||||
{
|
||||
dataPath: 'trainer1.contactInformation.person.name',
|
||||
translation: 'Nachname',
|
||||
},
|
||||
{
|
||||
dataPath: 'trainer1.contactInformation.phone',
|
||||
translation: 'Telefonnummer',
|
||||
},
|
||||
{
|
||||
dataPath: 'trainer1.contactInformation.phone2',
|
||||
translation: 'Telefonnummer 2',
|
||||
},
|
||||
{ dataPath: 'trainer1.contactInformation.email', translation: 'Email' },
|
||||
{
|
||||
dataPath: 'trainer1.contactInformation.email2',
|
||||
translation: 'Email 2',
|
||||
},
|
||||
{
|
||||
dataPath: 'trainer1.contactInformation.note',
|
||||
translation: 'Anmerkung',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'Group',
|
||||
title: 'Trainer 2',
|
||||
possibleObjects: [],
|
||||
nameToShowInSelection: (participant) => {
|
||||
return (
|
||||
(participant.contactInformation.person.firstName || '') +
|
||||
' ' +
|
||||
(participant.contactInformation.person.name || '') +
|
||||
' ' +
|
||||
(participant.contactInformation.email || '') +
|
||||
' ' +
|
||||
(participant.contactInformation.phone || '') +
|
||||
' ' +
|
||||
(participant.contactInformation.note || '')
|
||||
);
|
||||
},
|
||||
propertyPrefixToOverwrite: 'trainer2',
|
||||
currentlySelectedObjectId: (provider) => {
|
||||
return provider['trainer2.id'];
|
||||
},
|
||||
propertyNameOfReferenceId: 'trainer2Id',
|
||||
properties: [
|
||||
{
|
||||
dataPath: 'trainer2.contactInformation.person.firstName',
|
||||
translation: 'Vorname',
|
||||
},
|
||||
{
|
||||
dataPath: 'trainer2.contactInformation.person.name',
|
||||
translation: 'Nachname',
|
||||
},
|
||||
{
|
||||
dataPath: 'trainer2.contactInformation.phone',
|
||||
translation: 'Telefonnummer',
|
||||
},
|
||||
{
|
||||
dataPath: 'trainer2.contactInformation.phone2',
|
||||
translation: 'Telefonnummer 2',
|
||||
},
|
||||
{ dataPath: 'trainer2.contactInformation.email', translation: 'Email' },
|
||||
{
|
||||
dataPath: 'trainer2.contactInformation.email2',
|
||||
translation: 'Email 2',
|
||||
},
|
||||
{
|
||||
dataPath: 'trainer2.contactInformation.note',
|
||||
translation: 'Anmerkung',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'ReferenceTable',
|
||||
title: 'Teilnehmer (Aktive)',
|
||||
dataPath: 'participants',
|
||||
dataService: null,
|
||||
columnInfo: [
|
||||
{ dataPath: 'contactInformation.person.firstName', translation: 'Vorname' },
|
||||
{ dataPath: 'contactInformation.person.name', translation: 'Nachname',
|
||||
link: (row) => '/person/' + row['contactInformation.person.id'], },
|
||||
{ dataPath: 'contactInformation.email', translation: 'Email' },
|
||||
{ dataPath: 'contactInformation.phone', translation: 'Telefonnummer' },
|
||||
],
|
||||
editableReferences: false,
|
||||
linkToTable: () => '/table/participants',
|
||||
},
|
||||
];
|
||||
|
||||
constructor() { }
|
||||
headlineDataPath = 'title';
|
||||
headlineIconName = 'school';
|
||||
pageDataGQLType: string = 'Workshop';
|
||||
pageDataGQLUpdateInputType: string = 'WorkshopUpdateInput';
|
||||
|
||||
dataService: any;
|
||||
|
||||
constructor(
|
||||
private workshopsService: WorkshopsService,
|
||||
private participantsService: ParticipantsService,
|
||||
private workshopTypesService: WorkshopTypesService
|
||||
) {
|
||||
this.participantsService.loadTableData();
|
||||
this.participantsService.tableData.subscribe((data) => {
|
||||
this.propertiesInfo.find(
|
||||
(prop) => prop.propertyPrefixToOverwrite === 'trainer1'
|
||||
).possibleObjects = data;
|
||||
|
||||
this.propertiesInfo.find(
|
||||
(prop) => prop.propertyPrefixToOverwrite === 'trainer2'
|
||||
).possibleObjects = data;
|
||||
|
||||
//add posible tabledata??
|
||||
});
|
||||
|
||||
this.workshopTypesService.loadTableData();
|
||||
this.workshopTypesService.tableData.subscribe((data) => {
|
||||
this.propertiesInfo.find(
|
||||
(prop) => prop.propertyPrefixToOverwrite === 'workshopType'
|
||||
).possibleObjects = data;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.dataService = this.workshopsService;
|
||||
}
|
||||
|
||||
lock(row: any) {
|
||||
this.workshopsService.lockWorkshop({ id: row.id });
|
||||
}
|
||||
|
||||
save(row: any) {
|
||||
this.workshopsService.updateWorkshop({ workshop: row });
|
||||
}
|
||||
|
||||
cancel(row: any) {
|
||||
this.workshopsService.unlockWorkshop({ id: row.id });
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue