diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index b4c7ed2..1312681 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -13,6 +13,12 @@ import { ParticipantsComponent } from './pages/tables/participants/participants. import { TimeFramesComponent } from './pages/tables/time-frames/time-frames.component'; import {AuthGuard} from './helper/auth.guard'; import { ProfileComponent } from './pages/profile/profile.component'; +import { PersonsComponent } from './pages/tables/persons/persons.component'; +import { ContactInformationComponent } from './pages/tables/contact-information/contact-information.component'; +import { OrganisationsComponent } from './pages/tables/organisations/organisations.component'; +import { ProviderComponent } from './pages/tables/provider/provider.component'; +import { PersonComponent } from './pages/dataPages/person/person.component'; +import { OrganisationComponent } from './pages/dataPages/organisation/organisation.component'; const routes: Routes = [ { path: 'login', component: LoginComponent }, @@ -26,7 +32,13 @@ const routes: Routes = [ { path: 'table/engagementTypes', component: EngagementTypesComponent, canActivate: [AuthGuard] }, { path: 'table/equipment', component: EquipmentComponent, canActivate: [AuthGuard] }, { path: 'table/timeFrames', component: TimeFramesComponent, canActivate: [AuthGuard] }, + { path: 'table/persons', component: PersonsComponent, canActivate: [AuthGuard] }, + { path: 'table/contactInformation', component: ContactInformationComponent, canActivate: [AuthGuard] }, + { path: 'table/organisations', component: OrganisationsComponent, canActivate: [AuthGuard] }, + { path: 'table/providers', component: ProviderComponent, canActivate: [AuthGuard] }, { path: 'lendingStation/:id', component: LendingStationComponent, canActivate: [AuthGuard] }, + { path: 'person/:id', component: PersonComponent, canActivate: [AuthGuard] }, + { path: 'organisation/:id', component: OrganisationComponent, canActivate: [AuthGuard] }, { path: '', redirectTo: 'tableOverview', pathMatch: 'full' }, { path: 'table', redirectTo: 'tableOverview', pathMatch: 'full' }, { path: '**', redirectTo: 'tableOverview' }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index aefdad4..b99f872 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -67,6 +67,12 @@ import { AutocompleteSelectComponent } from './components/autocomplete-select/au import { LendingStationComponent } from './pages/dataPages/lending-station/lending-station.component'; import { ProfileComponent } from './pages/profile/profile.component'; import { ErrorSnackbarComponent, SnackbarDialog } from './helper/snackbar-ref.component'; +import { PersonsComponent } from './pages/tables/persons/persons.component'; +import { ContactInformationComponent } from './pages/tables/contact-information/contact-information.component'; +import { OrganisationsComponent } from './pages/tables/organisations/organisations.component'; +import { ProviderComponent } from './pages/tables/provider/provider.component'; +import { OrganisationComponent } from './pages/dataPages/organisation/organisation.component'; +import { PersonComponent } from './pages/dataPages/person/person.component'; @@ -98,7 +104,13 @@ import { ErrorSnackbarComponent, SnackbarDialog } from './helper/snackbar-ref.co LendingStationComponent, ProfileComponent, ErrorSnackbarComponent, - SnackbarDialog + SnackbarDialog, + PersonsComponent, + ContactInformationComponent, + OrganisationsComponent, + ProviderComponent, + OrganisationComponent, + PersonComponent ], imports: [ BrowserModule, diff --git a/src/app/components/data-page/data-page.component.html b/src/app/components/data-page/data-page.component.html index 4131b74..b2e8db9 100644 --- a/src/app/components/data-page/data-page.component.html +++ b/src/app/components/data-page/data-page.component.html @@ -28,7 +28,7 @@ { if (selectedObject) { - this.data[object.propertyNameOfReferenceId] = selectedObject.id + this.data[object.propertyNameOfReferenceId] = selectedObject.id; const newObjectFlattened = flatten(selectedObject); - for(const newProperty in newObjectFlattened) { - this.data[object.propertyPrefixToOverwrite + '.' + newProperty ] = newObjectFlattened[newProperty]; + for (const newProperty in newObjectFlattened) { + this.data[object.propertyPrefixToOverwrite + '.' + newProperty] = + newObjectFlattened[newProperty]; } } }); diff --git a/src/app/components/table/table.component.html b/src/app/components/table/table.component.html index fd5c353..d0a7fae 100644 --- a/src/app/components/table/table.component.html +++ b/src/app/components/table/table.component.html @@ -136,8 +136,8 @@ (column.acceptedForUpdating && element.isLockedByMe) " [required]=" - (element.newObject && column.required) || - (element.isLockedByMe && column.required) + (element.newObject && column.requiredForCreation) || + (element.isLockedByMe && column.requiredForUpdating) " (validityChange)=" validityChange(element, column.dataPath, $event) @@ -164,8 +164,8 @@ (column.acceptedForUpdating && element.isLockedByMe) " [required]=" - (element.newObject && column.required) || - (element.isLockedByMe && column.required) + (element.newObject && column.requiredForCreation) || + (element.isLockedByMe && column.requiredForUpdating) " (validityChange)=" validityChange(element, column.dataPath, $event) @@ -181,8 +181,8 @@ (column.acceptedForUpdating && element.isLockedByMe) " [required]=" - (element.newObject && column.required) || - (element.isLockedByMe && column.required) + (element.newObject && column.requiredForCreation) || + (element.isLockedByMe && column.requiredForUpdating) " (validityChange)=" validityChange(element, column.dataPath, $event) diff --git a/src/app/components/table/table.component.ts b/src/app/components/table/table.component.ts index 9a651f5..12a0ddf 100644 --- a/src/app/components/table/table.component.ts +++ b/src/app/components/table/table.component.ts @@ -32,16 +32,18 @@ export class TableComponent implements AfterViewInit { @Input() headline: string = null; @Input() - headlineIconName: string = "help_outline"; - + headlineIconName: string = 'help_outline'; + /** this array defines the columns and translations of the table and the order they are displayed */ @Input() columnInfo: { dataPath: string; translation: string; acceptedForCreation?: boolean; + requiredForCreation?: boolean; sticky?: boolean; acceptedForUpdating?: boolean; + requiredForUpdating?: boolean; required?: boolean; type?: string; link?: (row: any) => string; @@ -204,6 +206,11 @@ export class TableComponent implements AfterViewInit { column.acceptedForUpdating != null ? column.acceptedForUpdating : typeInformation.isPartOfType; + + column.requiredForUpdating = + column.requiredForUpdating != null + ? column.requiredForUpdating + : column.required || typeInformation.isRequired; } for (const column of this.columnInfo) { const typeInformation = this.schemaService.getTypeInformation( @@ -214,6 +221,11 @@ export class TableComponent implements AfterViewInit { column.acceptedForCreation != null ? column.acceptedForCreation : typeInformation.isPartOfType; + + column.requiredForCreation = + column.requiredForCreation != null + ? column.requiredForCreation + : column.required || typeInformation.isRequired; } } @@ -347,8 +359,13 @@ export class TableComponent implements AfterViewInit { dialogRef.afterClosed().subscribe((selectedObject) => { if (selectedObject) { row[column.propertyNameOfReferenceId] = selectedObject.id; - row[column.dataPath] = column.valueToOverwriteDataPath(selectedObject); + //row[column.dataPath] = column.valueToOverwriteDataPath(selectedObject); } + const newObjectFlattened = flatten(selectedObject); + for (const newProperty in newObjectFlattened) { + row[column.propertyPrefixToOverwrite + '.' + newProperty] = + newObjectFlattened[newProperty]; + } }); } diff --git a/src/app/graphqlOperations/fragments/organisation.graphql b/src/app/graphqlOperations/fragments/organisation.graphql index f18a749..506aabd 100644 --- a/src/app/graphqlOperations/fragments/organisation.graphql +++ b/src/app/graphqlOperations/fragments/organisation.graphql @@ -6,3 +6,27 @@ fragment OrganisationFieldsGeneral on Organisation { } associationNo } + +fragment OrganisationFieldsForTable on Organisation { + ...OrganisationFieldsGeneral + registeredAt + contactInformation { + ...ContactInformationFieldsGeneral + } + isLocked + isLockedByMe + lockedBy + lockedUntil +} + +fragment OrganisationFieldsForPage on Organisation { + ...OrganisationFieldsForTable + lendingStations { + id + name + } + provider { + ...ProviderFieldsGeneral + } +} + diff --git a/src/app/graphqlOperations/fragments/person.graphql b/src/app/graphqlOperations/fragments/person.graphql index 3160129..dca84e4 100644 --- a/src/app/graphqlOperations/fragments/person.graphql +++ b/src/app/graphqlOperations/fragments/person.graphql @@ -3,3 +3,20 @@ fragment PersonFieldsGeneral on Person { name firstName } + +fragment PersonFieldsForTable on Person { + id + name + firstName + isLocked + isLockedByMe + isLockedByMe + lockedUntil +} + +fragment PersonFieldsForPage on Person { + ...PersonFieldsForTable + contactInformation { + ...ContactInformationFieldsGeneral + } +} diff --git a/src/app/graphqlOperations/fragments/provider.graphql b/src/app/graphqlOperations/fragments/provider.graphql index c1ff0de..31da906 100644 --- a/src/app/graphqlOperations/fragments/provider.graphql +++ b/src/app/graphqlOperations/fragments/provider.graphql @@ -2,14 +2,29 @@ fragment ProviderFieldsGeneral on Provider { id formName privatePerson { + ...ContactInformationFieldsGeneral + } + organisation { id - person { - id - name - firstName - contactInformation { - email - } + name + contactInformation { + ...ContactInformationFieldsGeneral } } } + +fragment ProviderFieldsForTable on Provider { + ...ProviderFieldsGeneral + isLocked + isLockedByMe + lockedBy + lockedUntil +} + +fragment ProviderFieldsForPage on Provider { + ...ProviderFieldsForTable + cargoBikes { + id + name + } +} \ No newline at end of file diff --git a/src/app/graphqlOperations/organisation.graphql b/src/app/graphqlOperations/organisation.graphql new file mode 100644 index 0000000..5db6ec9 --- /dev/null +++ b/src/app/graphqlOperations/organisation.graphql @@ -0,0 +1,45 @@ +query GetOrganisations { + organisations { + ...OrganisationFieldsForTable + } +} + +query GetOrganisationById($id: ID!) { + organisationById(id: $id) { + ...OrganisationFieldsForPage + } +} + +query ReloadOrganisationById($id: ID!) { + organisationById(id: $id) { + ...OrganisationFieldsForTable + } +} + +mutation CreateOrganisation($organisation: OrganisationCreateInput!) { + createOrganisation(organisation: $organisation) { + ...OrganisationFieldsForTable + } +} + +mutation UpdateOrganisation($organisation: OrganisationUpdateInput!) { + updateOrganisation(organisation: $organisation) { + ...OrganisationFieldsForPage + } +} + +mutation LockOrganisation($id: ID!) { + lockOrganisation(id: $id) { + ...OrganisationFieldsForPage + } +} + +mutation UnlockOrganisation($id: ID!) { + unlockOrganisation(id: $id) { + ...OrganisationFieldsForPage + } +} + +mutation DeleteOrganisation($id: ID!) { + deleteOrganisation(id: $id) +} diff --git a/src/app/graphqlOperations/person.graphql b/src/app/graphqlOperations/person.graphql new file mode 100644 index 0000000..b62a4cb --- /dev/null +++ b/src/app/graphqlOperations/person.graphql @@ -0,0 +1,45 @@ +query GetPersons { + persons { + ...PersonFieldsForTable + } +} + +query GetPersonById($id: ID!) { + personById(id: $id) { + ...PersonFieldsForPage + } +} + +query ReloadPersonById($id: ID!) { + personById(id: $id) { + ...PersonFieldsForTable + } +} + +mutation CreatePerson($person: PersonCreateInput!) { + createPerson(person: $person) { + ...PersonFieldsForTable + } +} + +mutation UpdatePerson($person: PersonUpdateInput!) { + updatePerson(person: $person) { + ...PersonFieldsForPage + } +} + +mutation LockPerson($id: ID!) { + lockPerson(id: $id) { + ...PersonFieldsForPage + } +} + +mutation UnlockPerson($id: ID!) { + unlockPerson(id: $id) { + ...PersonFieldsForPage + } +} + +mutation DeletePerson($id: ID!) { + deletePerson(id: $id) +} diff --git a/src/app/pages/dataPages/organisation/organisation.component.html b/src/app/pages/dataPages/organisation/organisation.component.html new file mode 100644 index 0000000..9c05c6b --- /dev/null +++ b/src/app/pages/dataPages/organisation/organisation.component.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/src/app/pages/dataPages/organisation/organisation.component.scss b/src/app/pages/dataPages/organisation/organisation.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/dataPages/organisation/organisation.component.ts b/src/app/pages/dataPages/organisation/organisation.component.ts new file mode 100644 index 0000000..110305a --- /dev/null +++ b/src/app/pages/dataPages/organisation/organisation.component.ts @@ -0,0 +1,135 @@ +import { Component, OnInit } from '@angular/core'; +import { ContactInformationService } from 'src/app/services/contactInformation.service'; +import { OrganisationsService } from 'src/app/services/organisation.service'; + +@Component({ + selector: 'app-organisation', + templateUrl: './organisation.component.html', + styleUrls: ['./organisation.component.scss'], +}) +export class OrganisationComponent implements OnInit { + propertiesInfo = [ + { + type: 'Group', + title: 'Allgemein', + properties: [ + { dataPath: 'name', translation: 'Name' }, + { dataPath: 'address.number', translation: 'Hausnummer' }, + { dataPath: 'address.street', translation: 'Straße' }, + { dataPath: 'address.zip', translation: 'Postleitzahl' }, + + { dataPath: 'associationNo', translation: 'Vereinsnummer' }, + { dataPath: 'registeredAt', translation: 'Eingetragen seit' }, + ], + }, + { + type: 'Group', + title: 'Kontaktinformationen', + possibleObjects: [], + nameToShowInSelection: (contact) => { + return ( + contact.person.firstName + + ' ' + + contact.person.name + + ' ' + + contact.email + + ' ' + + contact.phone + + ' ' + + contact.note + ); + }, + propertyPrefixToOverwrite: 'contactInformation', + currentlySelectedObjectId: (station) => { + return station['contactInformation.id']; + }, + propertyNameOfReferenceId: 'contactInformationId', + properties: [ + { + dataPath: 'contactInformation.person.firstName', + translation: 'Vorname Ansprechpartner', + }, + { + dataPath: 'contactInformation.person.name', + translation: 'Nachname Ansprechpartner', + }, + { + 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: 'Bereitgestellte Lastenräder', + dataPath: 'provider.cargoBikes', + dataService: null, + columnInfo: [ + { + dataPath: 'name', + translation: 'Lastenrad', + link: (row) => '/bike/' + row['cargoBike.id'], + }, + ], + editableReferences: false, + linkToTable: () => '/table/provider', + }, + /*{ + type: 'ReferenceTable', + title: 'Fahrräder', + dataPath: 'contactInformation', + dataService: null, + columnInfo: [ + { dataPath: 'email', translation: 'Email' }, + { dataPath: 'email2', translation: 'Email 2' }, + { dataPath: 'phone', translation: 'Telefonnummer' }, + { dataPath: 'phone2', translation: 'Telefonnummer 2' }, + { dataPath: 'note', translation: 'Anmerkung' }, + ], + editableReferences: false, + linkToTable: () => '/table/contactInformation', + },*/ + ]; + + headlineDataPath = 'name'; + headlineIconName = 'organisation'; + pageDataGQLType: string = 'Organisation'; + pageDataGQLUpdateInputType: string = 'OrganisationUpdateInput'; + + dataService: any; + + constructor( + private organisationsService: OrganisationsService, + private contactInformationService: ContactInformationService + ) { + this.contactInformationService.loadTableData(); + this.contactInformationService.tableData.subscribe((data) => { + this.propertiesInfo.find( + (prop) => prop.propertyPrefixToOverwrite === 'contactInformation' + ).possibleObjects = data; + }); + } + + ngOnInit(): void { + this.dataService = this.organisationsService; + } + + lock(row: any) { + this.organisationsService.lockOrganisation({ id: row.id }); + } + + save(row: any) { + this.organisationsService.updateOrganisation({ organisation: row }); + } + + cancel(row: any) { + this.organisationsService.unlockOrganisation({ id: row.id }); + } +} diff --git a/src/app/pages/dataPages/person/person.component.html b/src/app/pages/dataPages/person/person.component.html new file mode 100644 index 0000000..9c05c6b --- /dev/null +++ b/src/app/pages/dataPages/person/person.component.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/src/app/pages/dataPages/person/person.component.scss b/src/app/pages/dataPages/person/person.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/dataPages/person/person.component.spec.ts b/src/app/pages/dataPages/person/person.component.spec.ts new file mode 100644 index 0000000..88c546e --- /dev/null +++ b/src/app/pages/dataPages/person/person.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PersonComponent } from './person.component'; + +describe('PersonComponent', () => { + let component: PersonComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PersonComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PersonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/dataPages/person/person.component.ts b/src/app/pages/dataPages/person/person.component.ts new file mode 100644 index 0000000..fdf521d --- /dev/null +++ b/src/app/pages/dataPages/person/person.component.ts @@ -0,0 +1,62 @@ +import { Component, OnInit } from '@angular/core'; +import { PersonsService } from 'src/app/services/person.service'; + +@Component({ + selector: 'app-person', + templateUrl: './person.component.html', + styleUrls: ['./person.component.scss'] +}) +export class PersonComponent implements OnInit { + propertiesInfo = [ + { + type: 'Group', + title: 'Allgemein', + properties: [ + { dataPath: 'firstName', translation: 'Vorname' }, + { dataPath: 'name', translation: 'Nachname' }, + ], + }, + { + type: 'ReferenceTable', + title: 'KontaktInformationen', + dataPath: 'contactInformation', + dataService: null, + columnInfo: [ + { dataPath: 'email', translation: 'Email' }, + { dataPath: 'email2', translation: 'Email 2' }, + { dataPath: 'phone', translation: 'Telefonnummer' }, + { dataPath: 'phone2', translation: 'Telefonnummer 2' }, + { dataPath: 'note', translation: 'Anmerkung' }, + ], + editableReferences: false, + linkToTable: () => '/table/contactInformation', + }, + ]; + + headlineDataPath = 'name'; + headlineIconName = 'person'; + pageDataGQLType: string = 'Person'; + pageDataGQLUpdateInputType: string = 'PersonUpdateInput'; + + dataService: any; + + constructor( + private personsService: PersonsService, + ) {} + + ngOnInit(): void { + this.dataService = this.personsService; + } + + lock(row: any) { + this.personsService.lockPerson({ id: row.id }); + } + + save(row: any) { + this.personsService.updatePerson({ person: row }); + } + + cancel(row: any) { + this.personsService.unlockPerson({ id: row.id }); + } +} diff --git a/src/app/pages/dataPages/provider/provider.component.html b/src/app/pages/dataPages/provider/provider.component.html new file mode 100644 index 0000000..019430e --- /dev/null +++ b/src/app/pages/dataPages/provider/provider.component.html @@ -0,0 +1 @@ +

provider works!

diff --git a/src/app/pages/dataPages/provider/provider.component.scss b/src/app/pages/dataPages/provider/provider.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/dataPages/provider/provider.component.spec.ts b/src/app/pages/dataPages/provider/provider.component.spec.ts new file mode 100644 index 0000000..22d4d9b --- /dev/null +++ b/src/app/pages/dataPages/provider/provider.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProviderComponent } from './provider.component'; + +describe('ProviderComponent', () => { + let component: ProviderComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ProviderComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProviderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/dataPages/provider/provider.component.ts b/src/app/pages/dataPages/provider/provider.component.ts new file mode 100644 index 0000000..357945e --- /dev/null +++ b/src/app/pages/dataPages/provider/provider.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-provider', + templateUrl: './provider.component.html', + styleUrls: ['./provider.component.scss'] +}) +export class ProviderComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/pages/table-overview/table-overview.component.html b/src/app/pages/table-overview/table-overview.component.html index f400e59..e47b38d 100644 --- a/src/app/pages/table-overview/table-overview.component.html +++ b/src/app/pages/table-overview/table-overview.component.html @@ -5,15 +5,15 @@ Lastenräder Beteiligte Standorte - Tabelle 4 + Personen
Equipmenttypen Equipment Zeitscheiben - Tabelle 9 - Tabelle 10 + Unternehmen + Kontaktinformation Tabelle 11 Tabelle 12 Tabelle 13 diff --git a/src/app/pages/tables/contact-information/contact-information.component.html b/src/app/pages/tables/contact-information/contact-information.component.html new file mode 100644 index 0000000..8c18b6a --- /dev/null +++ b/src/app/pages/tables/contact-information/contact-information.component.html @@ -0,0 +1,14 @@ + diff --git a/src/app/pages/tables/contact-information/contact-information.component.scss b/src/app/pages/tables/contact-information/contact-information.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/tables/contact-information/contact-information.component.ts b/src/app/pages/tables/contact-information/contact-information.component.ts new file mode 100644 index 0000000..7a62474 --- /dev/null +++ b/src/app/pages/tables/contact-information/contact-information.component.ts @@ -0,0 +1,90 @@ +import { Component, OnInit } from '@angular/core'; +import { ContactInformationService } from 'src/app/services/contactInformation.service'; +import { PersonsService } from 'src/app/services/person.service'; + +@Component({ + selector: 'app-contact-information', + templateUrl: './contact-information.component.html', + styleUrls: ['./contact-information.component.scss'], +}) +export class ContactInformationComponent implements OnInit { + columnInfo = [ + { + dataPath: 'person.firstName', + translation: 'Vorname', + sticky: true, + link: (row: any) => { + return '/person/' + row['person.id']; + }, + }, + { + dataPath: 'person.name', + translation: 'Nachname', + sticky: true, + link: (row: any) => { + return '/person/' + row['person.id']; + }, + possibleObjects: [], + nameToShowInSelection: (person) => person.firstName + ' ' + person.name, + propertyPrefixToOverwrite: 'person', + currentlySelectedObjectId: (timeFrame) => { + return timeFrame['cargoBike.id']; + }, + propertyNameOfReferenceId: 'personId', + }, + { dataPath: 'email', translation: 'Email' }, + { dataPath: 'email2', translation: 'Email 2' }, + { dataPath: 'phone', translation: 'Telefonnummer' }, + { dataPath: 'phone2', translation: 'Telefonnummer 2' }, + { dataPath: 'note', translation: 'Anmerkung' }, + ]; + dataService: any; + + tableDataGQLType: string = 'ContactInformation'; + tableDataGQLCreateInputType: string = 'ContactInformationCreateInput'; + tableDataGQLUpdateInputType: string = 'ContactInformationUpdateInput'; + + headline = 'Kontaktinformationen'; + headlineIconName = 'contact_page'; + + loadingRowIds: string[] = []; + constructor( + private contactInformationService: ContactInformationService, + private personsService: PersonsService + ) { + this.personsService.loadTableData(); + this.personsService.tableData.subscribe((data) => { + this.columnInfo.find( + (column) => column.dataPath === 'person.name' + ).possibleObjects = data; + }); + } + + ngOnInit() { + this.dataService = this.contactInformationService; + } + + create(object: { currentId: string; row: any }) { + this.contactInformationService.createContactInformation(object.currentId, { + contactInformation: object.row, + }); + } + + lock(row: any) { + this.contactInformationService.lockContactInformation({ id: row.id }); + } + + save(row: any) { + this.contactInformationService.updateContactInformation({ + contactInformation: row, + }); + } + + cancel(row: any) { + this.contactInformationService.unlockContactInformation({ id: row.id }); + } + + delete(row: any) { + this.contactInformationService.deleteContactInformation({ id: row.id }); + } +} diff --git a/src/app/pages/tables/organisations/organisations.component.html b/src/app/pages/tables/organisations/organisations.component.html new file mode 100644 index 0000000..8c18b6a --- /dev/null +++ b/src/app/pages/tables/organisations/organisations.component.html @@ -0,0 +1,14 @@ + diff --git a/src/app/pages/tables/organisations/organisations.component.scss b/src/app/pages/tables/organisations/organisations.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/tables/organisations/organisations.component.ts b/src/app/pages/tables/organisations/organisations.component.ts new file mode 100644 index 0000000..c38e4de --- /dev/null +++ b/src/app/pages/tables/organisations/organisations.component.ts @@ -0,0 +1,83 @@ +import { Component, OnInit } from '@angular/core'; +import { OrganisationsService } from 'src/app/services/organisation.service'; + +@Component({ + selector: 'app-organisations', + templateUrl: './organisations.component.html', + styleUrls: ['./organisations.component.scss'], +}) +export class OrganisationsComponent implements OnInit { + columnInfo = [ + { + dataPath: 'name', + translation: 'Name', + sticky: true, + link: (row: any) => { + return '/organisation/' + row.id; + }, + }, + { dataPath: 'address.number', translation: 'Hausnummer' }, + { dataPath: 'address.street', translation: 'Straße' }, + { dataPath: 'address.zip', translation: 'Postleitzahl' }, + + { dataPath: 'associationNo', translation: 'Vereinsnummer' }, + { dataPath: 'registeredAt', translation: 'Eingetragen seit' }, + + { + dataPath: 'contactInformation.person.firstName', + translation: 'Vorname Ansprechpartner', + }, + { + dataPath: 'contactInformation.person.name', + translation: 'Nachname Ansprechpartner', + }, + { + dataPath: 'contactInformation.phone', + translation: 'Telefonnummer', + }, + { + dataPath: 'contactInformation.phone2', + translation: 'Telefonnummer 2', + }, + { dataPath: 'contactInformation.email', translation: 'Email' }, + { dataPath: 'contactInformation.email2', translation: 'Email 2' }, + ]; + + dataService: any; + + tableDataGQLType: string = 'Organisation'; + tableDataGQLCreateInputType: string = 'OrganisationCreateInput'; + tableDataGQLUpdateInputType: string = 'OrganisationUpdateInput'; + + headline = 'Unternehmen'; + headlineIconName = 'business'; + + loadingRowIds: string[] = []; + constructor(private organisationsService: OrganisationsService) {} + + ngOnInit() { + this.dataService = this.organisationsService; + } + + create(object: { currentId: string; row: any }) { + this.organisationsService.createOrganisation(object.currentId, { + organisation: object.row, + }); + } + + lock(row: any) { + this.organisationsService.lockOrganisation({ id: row.id }); + } + + save(row: any) { + this.organisationsService.updateOrganisation({ organisation: row }); + } + + cancel(row: any) { + this.organisationsService.unlockOrganisation({ id: row.id }); + } + + delete(row: any) { + this.organisationsService.deleteOrganisation({ id: row.id }); + } +} diff --git a/src/app/pages/tables/persons/persons.component.html b/src/app/pages/tables/persons/persons.component.html new file mode 100644 index 0000000..8c18b6a --- /dev/null +++ b/src/app/pages/tables/persons/persons.component.html @@ -0,0 +1,14 @@ + diff --git a/src/app/pages/tables/persons/persons.component.scss b/src/app/pages/tables/persons/persons.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/tables/persons/persons.component.ts b/src/app/pages/tables/persons/persons.component.ts new file mode 100644 index 0000000..41c8b12 --- /dev/null +++ b/src/app/pages/tables/persons/persons.component.ts @@ -0,0 +1,65 @@ +import { Component, OnInit } from '@angular/core'; +import { PersonsService } from 'src/app/services/person.service'; + +@Component({ + selector: 'app-persons', + templateUrl: './persons.component.html', + styleUrls: ['./persons.component.scss'], +}) +export class PersonsComponent implements OnInit { + columnInfo = [ + { + dataPath: 'firstName', + translation: 'Vorname', + sticky: true, + link: (row: any) => { + return '/person/' + row.id; + }, + }, + { + dataPath: 'name', + translation: 'Nachname', + link: (row: any) => { + return '/person/' + row.id; + }, + }, + ]; + + dataService: any; + + tableDataGQLType: string = 'Person'; + tableDataGQLCreateInputType: string = 'PersonCreateInput'; + tableDataGQLUpdateInputType: string = 'PersonUpdateInput'; + + headline = 'Personen'; + headlineIconName = 'person'; + + loadingRowIds: string[] = []; + constructor(private personsService: PersonsService) {} + + ngOnInit() { + this.dataService = this.personsService; + } + + create(object: { currentId: string; row: any }) { + this.personsService.createPerson(object.currentId, { + person: object.row, + }); + } + + lock(row: any) { + this.personsService.lockPerson({ id: row.id }); + } + + save(row: any) { + this.personsService.updatePerson({ person: row }); + } + + cancel(row: any) { + this.personsService.unlockPerson({ id: row.id }); + } + + delete(row: any) { + this.personsService.deletePerson({ id: row.id }); + } +} diff --git a/src/app/pages/tables/provider/provider.component.html b/src/app/pages/tables/provider/provider.component.html new file mode 100644 index 0000000..019430e --- /dev/null +++ b/src/app/pages/tables/provider/provider.component.html @@ -0,0 +1 @@ +

provider works!

diff --git a/src/app/pages/tables/provider/provider.component.scss b/src/app/pages/tables/provider/provider.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/tables/provider/provider.component.spec.ts b/src/app/pages/tables/provider/provider.component.spec.ts new file mode 100644 index 0000000..22d4d9b --- /dev/null +++ b/src/app/pages/tables/provider/provider.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProviderComponent } from './provider.component'; + +describe('ProviderComponent', () => { + let component: ProviderComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ProviderComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProviderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/tables/provider/provider.component.ts b/src/app/pages/tables/provider/provider.component.ts new file mode 100644 index 0000000..357945e --- /dev/null +++ b/src/app/pages/tables/provider/provider.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-provider', + templateUrl: './provider.component.html', + styleUrls: ['./provider.component.scss'] +}) +export class ProviderComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/pages/tables/time-frames/time-frames.component.ts b/src/app/pages/tables/time-frames/time-frames.component.ts index d8c22f6..534b255 100644 --- a/src/app/pages/tables/time-frames/time-frames.component.ts +++ b/src/app/pages/tables/time-frames/time-frames.component.ts @@ -26,7 +26,7 @@ export class TimeFramesComponent implements OnInit { }, possibleObjects: [], nameToShowInSelection: (bike) => bike.name, - valueToOverwriteDataPath: (bike) => bike.name, + propertyPrefixToOverwrite: 'cargoBike', currentlySelectedObjectId: (timeFrame) => { return timeFrame['cargoBike.id']; }, @@ -40,7 +40,7 @@ export class TimeFramesComponent implements OnInit { }, possibleObjects: [], nameToShowInSelection: (station) => station.name, - valueToOverwriteDataPath: (station) => station.name, + propertyPrefixToOverwrite: 'lendingStation', currentlySelectedObjectId: (timeFrame) => { return timeFrame['lendingStation.id']; }, diff --git a/src/app/services/organisation.service.ts b/src/app/services/organisation.service.ts new file mode 100644 index 0000000..ba15fe9 --- /dev/null +++ b/src/app/services/organisation.service.ts @@ -0,0 +1,160 @@ +import { Injectable } from '@angular/core'; +import { BehaviorSubject, Subject } from 'rxjs'; +import { + GetOrganisationsGQL, + ReloadOrganisationByIdGQL, + ReloadOrganisationByIdQueryVariables, + UpdateOrganisationGQL, + UpdateOrganisationMutationVariables, + LockOrganisationGQL, + LockOrganisationMutationVariables, + UnlockOrganisationGQL, + UnlockOrganisationMutationVariables, + CreateOrganisationGQL, + CreateOrganisationMutationVariables, + DeleteOrganisationGQL, + DeleteOrganisationMutationVariables, + GetOrganisationByIdGQL, + GetOrganisationByIdQueryVariables, +} from '../../generated/graphql'; + +@Injectable({ + providedIn: 'root', +}) +export class OrganisationsService { + /** Organisations Array */ + tableData: BehaviorSubject = new BehaviorSubject(null); + loadingRowIds: BehaviorSubject = new BehaviorSubject([]); + successfullyCreatedRowWithId: Subject = new Subject(); + pageData: BehaviorSubject = new BehaviorSubject(null); + isLoadingPageData: BehaviorSubject = new BehaviorSubject(false); + + constructor( + private getOrganisationsGQL: GetOrganisationsGQL, + private getOrganisationByIdGQL: GetOrganisationByIdGQL, + private reloadOrganisationByIdGQL: ReloadOrganisationByIdGQL, + private updateOrganisationGQL: UpdateOrganisationGQL, + private lockOrganisationGQL: LockOrganisationGQL, + private unlockOrganisationGQL: UnlockOrganisationGQL, + private createOrganisationGQL: CreateOrganisationGQL, + private deleteOrganisationGQL: DeleteOrganisationGQL + ) {} + + addLoadingRowId(id: string) { + this.loadingRowIds.next([...this.loadingRowIds.value, id]); + } + + removeLoadingRowId(id: string) { + this.loadingRowIds.value.forEach((item, index) => { + if (item === id) { + this.loadingRowIds.value.splice(index, 1); + } + }); + this.loadingRowIds.next(this.loadingRowIds.value); + } + + loadTableData() { + this.tableData.next(null); + this.getOrganisationsGQL.fetch().subscribe((result) => { + this.tableData.next(result.data?.organisations); + }); + } + + loadPageData(variables: GetOrganisationByIdQueryVariables) { + this.pageData.next(null); + this.isLoadingPageData.next(true); + this.getOrganisationByIdGQL + .fetch(variables) + .subscribe((result) => { + this.pageData.next(result.data.organisationById); + }) + .add(() => { + this.isLoadingPageData.next(false); + }); + } + + reloadOrganisation(variables: ReloadOrganisationByIdQueryVariables) { + this.addLoadingRowId(variables.id); + this.reloadOrganisationByIdGQL + .fetch(variables) + .subscribe((result) => { + this.updateDataRowFromResponse(result.data.organisationById); + }) + .add(() => { + this.removeLoadingRowId(variables.id); + }); + } + + createOrganisation(currentId: string, variables: CreateOrganisationMutationVariables) { + this.createOrganisationGQL.mutate(variables).subscribe((result) => { + const newOrganisation = result.data.createOrganisation; + this.tableData.next([newOrganisation, ...this.tableData.value]); + this.successfullyCreatedRowWithId.next(currentId); + }); + } + + updateOrganisation(variables: UpdateOrganisationMutationVariables) { + this.addLoadingRowId(variables.organisation.id); + this.updateOrganisationGQL + .mutate(variables) + .subscribe((result) => { + this.updateDataRowFromResponse(result.data.updateOrganisation); + }) + .add(() => { + this.removeLoadingRowId(variables.organisation.id); + }); + } + + lockOrganisation(variables: LockOrganisationMutationVariables) { + this.addLoadingRowId(variables.id); + this.lockOrganisationGQL + .mutate(variables) + .subscribe((result) => { + this.updateDataRowFromResponse(result.data.lockOrganisation); + }) + .add(() => { + this.removeLoadingRowId(variables.id); + }); + } + + unlockOrganisation(variables: UnlockOrganisationMutationVariables) { + this.addLoadingRowId(variables.id); + this.unlockOrganisationGQL + .mutate(variables) + .subscribe((result) => { + this.updateDataRowFromResponse(result.data.unlockOrganisation); + }) + .add(() => { + this.removeLoadingRowId(variables.id); + }); + } + + deleteOrganisation(variables: DeleteOrganisationMutationVariables) { + this.addLoadingRowId(variables.id); + this.deleteOrganisationGQL + .mutate(variables) + .subscribe((result) => { + if (result.data) { + this.tableData.next( + [...this.tableData.value].filter((organisation) => organisation.id !== variables.id) + ); + } + }) + .add(() => { + this.removeLoadingRowId(variables.id); + }); + } + + private updateDataRowFromResponse(rowFromResponse: any) { + if (this.tableData.value) { + const newTableData = this.tableData.value.map((row) => + rowFromResponse.id === row.id ? rowFromResponse : row + ); + this.tableData.next(newTableData); + } + if (rowFromResponse.id === this.pageData?.value?.id) { + this.pageData.next(rowFromResponse); + } + } +} + diff --git a/src/app/services/person.service.ts b/src/app/services/person.service.ts new file mode 100644 index 0000000..8b46516 --- /dev/null +++ b/src/app/services/person.service.ts @@ -0,0 +1,160 @@ +import { Injectable } from '@angular/core'; +import { BehaviorSubject, Subject } from 'rxjs'; +import { + GetPersonsGQL, + ReloadPersonByIdGQL, + ReloadPersonByIdQueryVariables, + UpdatePersonGQL, + UpdatePersonMutationVariables, + LockPersonGQL, + LockPersonMutationVariables, + UnlockPersonGQL, + UnlockPersonMutationVariables, + CreatePersonGQL, + CreatePersonMutationVariables, + DeletePersonGQL, + DeletePersonMutationVariables, + GetPersonByIdGQL, + GetPersonByIdQueryVariables, +} from '../../generated/graphql'; + +@Injectable({ + providedIn: 'root', +}) +export class PersonsService { + /** Persons Array */ + tableData: BehaviorSubject = new BehaviorSubject(null); + loadingRowIds: BehaviorSubject = new BehaviorSubject([]); + successfullyCreatedRowWithId: Subject = new Subject(); + pageData: BehaviorSubject = new BehaviorSubject(null); + isLoadingPageData: BehaviorSubject = new BehaviorSubject(false); + + constructor( + private getPersonsGQL: GetPersonsGQL, + private getPersonByIdGQL: GetPersonByIdGQL, + private reloadPersonByIdGQL: ReloadPersonByIdGQL, + private updatePersonGQL: UpdatePersonGQL, + private lockPersonGQL: LockPersonGQL, + private unlockPersonGQL: UnlockPersonGQL, + private createPersonGQL: CreatePersonGQL, + private deletePersonGQL: DeletePersonGQL + ) {} + + addLoadingRowId(id: string) { + this.loadingRowIds.next([...this.loadingRowIds.value, id]); + } + + removeLoadingRowId(id: string) { + this.loadingRowIds.value.forEach((item, index) => { + if (item === id) { + this.loadingRowIds.value.splice(index, 1); + } + }); + this.loadingRowIds.next(this.loadingRowIds.value); + } + + loadTableData() { + this.tableData.next(null); + this.getPersonsGQL.fetch().subscribe((result) => { + this.tableData.next(result.data?.persons); + }); + } + + loadPageData(variables: GetPersonByIdQueryVariables) { + this.pageData.next(null); + this.isLoadingPageData.next(true); + this.getPersonByIdGQL + .fetch(variables) + .subscribe((result) => { + this.pageData.next(result.data.personById); + }) + .add(() => { + this.isLoadingPageData.next(false); + }); + } + + reloadPerson(variables: ReloadPersonByIdQueryVariables) { + this.addLoadingRowId(variables.id); + this.reloadPersonByIdGQL + .fetch(variables) + .subscribe((result) => { + this.updateDataRowFromResponse(result.data.personById); + }) + .add(() => { + this.removeLoadingRowId(variables.id); + }); + } + + createPerson(currentId: string, variables: CreatePersonMutationVariables) { + this.createPersonGQL.mutate(variables).subscribe((result) => { + const newPerson = result.data.createPerson; + this.tableData.next([newPerson, ...this.tableData.value]); + this.successfullyCreatedRowWithId.next(currentId); + }); + } + + updatePerson(variables: UpdatePersonMutationVariables) { + this.addLoadingRowId(variables.person.id); + this.updatePersonGQL + .mutate(variables) + .subscribe((result) => { + this.updateDataRowFromResponse(result.data.updatePerson); + }) + .add(() => { + this.removeLoadingRowId(variables.person.id); + }); + } + + lockPerson(variables: LockPersonMutationVariables) { + this.addLoadingRowId(variables.id); + this.lockPersonGQL + .mutate(variables) + .subscribe((result) => { + this.updateDataRowFromResponse(result.data.lockPerson); + }) + .add(() => { + this.removeLoadingRowId(variables.id); + }); + } + + unlockPerson(variables: UnlockPersonMutationVariables) { + this.addLoadingRowId(variables.id); + this.unlockPersonGQL + .mutate(variables) + .subscribe((result) => { + this.updateDataRowFromResponse(result.data.unlockPerson); + }) + .add(() => { + this.removeLoadingRowId(variables.id); + }); + } + + deletePerson(variables: DeletePersonMutationVariables) { + this.addLoadingRowId(variables.id); + this.deletePersonGQL + .mutate(variables) + .subscribe((result) => { + if (result.data) { + this.tableData.next( + [...this.tableData.value].filter((person) => person.id !== variables.id) + ); + } + }) + .add(() => { + this.removeLoadingRowId(variables.id); + }); + } + + private updateDataRowFromResponse(rowFromResponse: any) { + if (this.tableData.value) { + const newTableData = this.tableData.value.map((row) => + rowFromResponse.id === row.id ? rowFromResponse : row + ); + this.tableData.next(newTableData); + } + if (rowFromResponse.id === this.pageData?.value?.id) { + this.pageData.next(rowFromResponse); + } + } +} + diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index 0ca3b9e..a569b84 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -2112,6 +2112,22 @@ export type OrganisationFieldsGeneralFragment = { __typename?: 'Organisation', i & AddressFieldsFragment )> }; +export type OrganisationFieldsForTableFragment = ( + { __typename?: 'Organisation', registeredAt?: Maybe, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, contactInformation?: Maybe<( + { __typename?: 'ContactInformation' } + & ContactInformationFieldsGeneralFragment + )> } + & OrganisationFieldsGeneralFragment +); + +export type OrganisationFieldsForPageFragment = ( + { __typename?: 'Organisation', lendingStations?: Maybe>, provider?: Maybe<( + { __typename?: 'Provider' } + & ProviderFieldsGeneralFragment + )> } + & OrganisationFieldsForTableFragment +); + export type ParticipantFieldsForBikePageFragment = { __typename?: 'Participant', id: string, usernamefLotte?: Maybe, usernameSlack?: Maybe, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, dateRange: { __typename?: 'DateRange', from: any, to?: Maybe }, contactInformation: ( { __typename?: 'ContactInformation' } & ContactInformationFieldsGeneralFragment @@ -2119,7 +2135,33 @@ export type ParticipantFieldsForBikePageFragment = { __typename?: 'Participant', export type PersonFieldsGeneralFragment = { __typename?: 'Person', id: string, name: string, firstName: string }; -export type ProviderFieldsGeneralFragment = { __typename?: 'Provider', id: string, formName?: Maybe, privatePerson?: Maybe<{ __typename?: 'ContactInformation', id: string, person: { __typename?: 'Person', id: string, name: string, firstName: string, contactInformation?: Maybe }>> } }> }; +export type PersonFieldsForTableFragment = { __typename?: 'Person', id: string, name: string, firstName: string, isLocked: boolean, isLockedByMe: boolean, lockedUntil?: Maybe }; + +export type PersonFieldsForPageFragment = ( + { __typename?: 'Person', contactInformation?: Maybe> } + & PersonFieldsForTableFragment +); + +export type ProviderFieldsGeneralFragment = { __typename?: 'Provider', id: string, formName?: Maybe, privatePerson?: Maybe<( + { __typename?: 'ContactInformation' } + & ContactInformationFieldsGeneralFragment + )>, organisation?: Maybe<{ __typename?: 'Organisation', id: string, name: string, contactInformation?: Maybe<( + { __typename?: 'ContactInformation' } + & ContactInformationFieldsGeneralFragment + )> }> }; + +export type ProviderFieldsForTableFragment = ( + { __typename?: 'Provider', isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe } + & ProviderFieldsGeneralFragment +); + +export type ProviderFieldsForPageFragment = ( + { __typename?: 'Provider', cargoBikes?: Maybe> } + & ProviderFieldsForTableFragment +); export type TimeFrameFieldsForBikePageFragment = { __typename?: 'TimeFrame', id: string, note?: Maybe, dateRange: { __typename?: 'DateRange', from: any, to?: Maybe }, lendingStation: ( { __typename?: 'LendingStation' } @@ -2205,6 +2247,156 @@ export type DeleteLendingStationMutationVariables = Exact<{ export type DeleteLendingStationMutation = { __typename?: 'Mutation', deleteLendingStation: boolean }; +export type GetOrganisationsQueryVariables = Exact<{ [key: string]: never; }>; + + +export type GetOrganisationsQuery = { __typename?: 'Query', organisations: Array<( + { __typename?: 'Organisation' } + & OrganisationFieldsForTableFragment + )> }; + +export type GetOrganisationByIdQueryVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type GetOrganisationByIdQuery = { __typename?: 'Query', organisationById?: Maybe<( + { __typename?: 'Organisation' } + & OrganisationFieldsForPageFragment + )> }; + +export type ReloadOrganisationByIdQueryVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type ReloadOrganisationByIdQuery = { __typename?: 'Query', organisationById?: Maybe<( + { __typename?: 'Organisation' } + & OrganisationFieldsForTableFragment + )> }; + +export type CreateOrganisationMutationVariables = Exact<{ + organisation: OrganisationCreateInput; +}>; + + +export type CreateOrganisationMutation = { __typename?: 'Mutation', createOrganisation: ( + { __typename?: 'Organisation' } + & OrganisationFieldsForTableFragment + ) }; + +export type UpdateOrganisationMutationVariables = Exact<{ + organisation: OrganisationUpdateInput; +}>; + + +export type UpdateOrganisationMutation = { __typename?: 'Mutation', updateOrganisation: ( + { __typename?: 'Organisation' } + & OrganisationFieldsForPageFragment + ) }; + +export type LockOrganisationMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type LockOrganisationMutation = { __typename?: 'Mutation', lockOrganisation: ( + { __typename?: 'Organisation' } + & OrganisationFieldsForPageFragment + ) }; + +export type UnlockOrganisationMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type UnlockOrganisationMutation = { __typename?: 'Mutation', unlockOrganisation: ( + { __typename?: 'Organisation' } + & OrganisationFieldsForPageFragment + ) }; + +export type DeleteOrganisationMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type DeleteOrganisationMutation = { __typename?: 'Mutation', deleteOrganisation: boolean }; + +export type GetPersonsQueryVariables = Exact<{ [key: string]: never; }>; + + +export type GetPersonsQuery = { __typename?: 'Query', persons?: Maybe> }; + +export type GetPersonByIdQueryVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type GetPersonByIdQuery = { __typename?: 'Query', personById?: Maybe<( + { __typename?: 'Person' } + & PersonFieldsForPageFragment + )> }; + +export type ReloadPersonByIdQueryVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type ReloadPersonByIdQuery = { __typename?: 'Query', personById?: Maybe<( + { __typename?: 'Person' } + & PersonFieldsForTableFragment + )> }; + +export type CreatePersonMutationVariables = Exact<{ + person: PersonCreateInput; +}>; + + +export type CreatePersonMutation = { __typename?: 'Mutation', createPerson: ( + { __typename?: 'Person' } + & PersonFieldsForTableFragment + ) }; + +export type UpdatePersonMutationVariables = Exact<{ + person: PersonUpdateInput; +}>; + + +export type UpdatePersonMutation = { __typename?: 'Mutation', updatePerson: ( + { __typename?: 'Person' } + & PersonFieldsForPageFragment + ) }; + +export type LockPersonMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type LockPersonMutation = { __typename?: 'Mutation', lockPerson: ( + { __typename?: 'Person' } + & PersonFieldsForPageFragment + ) }; + +export type UnlockPersonMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type UnlockPersonMutation = { __typename?: 'Mutation', unlockPerson: ( + { __typename?: 'Person' } + & PersonFieldsForPageFragment + ) }; + +export type DeletePersonMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type DeletePersonMutation = { __typename?: 'Mutation', deletePerson: boolean }; + export type GetTimeFramesQueryVariables = Exact<{ [key: string]: never; }>; @@ -2260,23 +2452,42 @@ export type DeleteTimeFrameMutationVariables = Exact<{ export type DeleteTimeFrameMutation = { __typename?: 'Mutation', deleteTimeFrame: boolean }; +export const PersonFieldsGeneralFragmentDoc = gql` + fragment PersonFieldsGeneral on Person { + id + name + firstName +} + `; +export const ContactInformationFieldsGeneralFragmentDoc = gql` + fragment ContactInformationFieldsGeneral on ContactInformation { + id + person { + ...PersonFieldsGeneral + } + phone + phone2 + email + email2 + note +} + ${PersonFieldsGeneralFragmentDoc}`; export const ProviderFieldsGeneralFragmentDoc = gql` fragment ProviderFieldsGeneral on Provider { id formName privatePerson { + ...ContactInformationFieldsGeneral + } + organisation { id - person { - id - name - firstName - contactInformation { - email - } + name + contactInformation { + ...ContactInformationFieldsGeneral } } } - `; + ${ContactInformationFieldsGeneralFragmentDoc}`; export const AddressFieldsFragmentDoc = gql` fragment AddressFields on Address { street @@ -2431,26 +2642,6 @@ export const BikeEventTypeFieldsFragmentDoc = gql` lockedUntil } `; -export const PersonFieldsGeneralFragmentDoc = gql` - fragment PersonFieldsGeneral on Person { - id - name - firstName -} - `; -export const ContactInformationFieldsGeneralFragmentDoc = gql` - fragment ContactInformationFieldsGeneral on ContactInformation { - id - person { - ...PersonFieldsGeneral - } - phone - phone2 - email - email2 - note -} - ${PersonFieldsGeneralFragmentDoc}`; export const ParticipantFieldsForBikePageFragmentDoc = gql` fragment ParticipantFieldsForBikePage on Participant { id @@ -2665,6 +2856,71 @@ export const LendingStationFieldsForPageFragmentDoc = gql` } ${LendingStationFieldsForTableFragmentDoc} ${TimeFrameFieldsForLendingStationFragmentDoc}`; +export const OrganisationFieldsForTableFragmentDoc = gql` + fragment OrganisationFieldsForTable on Organisation { + ...OrganisationFieldsGeneral + registeredAt + contactInformation { + ...ContactInformationFieldsGeneral + } + isLocked + isLockedByMe + lockedBy + lockedUntil +} + ${OrganisationFieldsGeneralFragmentDoc} +${ContactInformationFieldsGeneralFragmentDoc}`; +export const OrganisationFieldsForPageFragmentDoc = gql` + fragment OrganisationFieldsForPage on Organisation { + ...OrganisationFieldsForTable + lendingStations { + id + name + } + provider { + ...ProviderFieldsGeneral + } +} + ${OrganisationFieldsForTableFragmentDoc} +${ProviderFieldsGeneralFragmentDoc}`; +export const PersonFieldsForTableFragmentDoc = gql` + fragment PersonFieldsForTable on Person { + id + name + firstName + isLocked + isLockedByMe + isLockedByMe + lockedUntil +} + `; +export const PersonFieldsForPageFragmentDoc = gql` + fragment PersonFieldsForPage on Person { + ...PersonFieldsForTable + contactInformation { + ...ContactInformationFieldsGeneral + } +} + ${PersonFieldsForTableFragmentDoc} +${ContactInformationFieldsGeneralFragmentDoc}`; +export const ProviderFieldsForTableFragmentDoc = gql` + fragment ProviderFieldsForTable on Provider { + ...ProviderFieldsGeneral + isLocked + isLockedByMe + lockedBy + lockedUntil +} + ${ProviderFieldsGeneralFragmentDoc}`; +export const ProviderFieldsForPageFragmentDoc = gql` + fragment ProviderFieldsForPage on Provider { + ...ProviderFieldsForTable + cargoBikes { + id + name + } +} + ${ProviderFieldsForTableFragmentDoc}`; export const TimeFrameFieldsFragmentDoc = gql` fragment TimeFrameFields on TimeFrame { id @@ -3285,6 +3541,290 @@ export const DeleteLendingStationDocument = gql` export class DeleteLendingStationGQL extends Apollo.Mutation { document = DeleteLendingStationDocument; + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const GetOrganisationsDocument = gql` + query GetOrganisations { + organisations { + ...OrganisationFieldsForTable + } +} + ${OrganisationFieldsForTableFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class GetOrganisationsGQL extends Apollo.Query { + document = GetOrganisationsDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const GetOrganisationByIdDocument = gql` + query GetOrganisationById($id: ID!) { + organisationById(id: $id) { + ...OrganisationFieldsForPage + } +} + ${OrganisationFieldsForPageFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class GetOrganisationByIdGQL extends Apollo.Query { + document = GetOrganisationByIdDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const ReloadOrganisationByIdDocument = gql` + query ReloadOrganisationById($id: ID!) { + organisationById(id: $id) { + ...OrganisationFieldsForTable + } +} + ${OrganisationFieldsForTableFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class ReloadOrganisationByIdGQL extends Apollo.Query { + document = ReloadOrganisationByIdDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const CreateOrganisationDocument = gql` + mutation CreateOrganisation($organisation: OrganisationCreateInput!) { + createOrganisation(organisation: $organisation) { + ...OrganisationFieldsForTable + } +} + ${OrganisationFieldsForTableFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class CreateOrganisationGQL extends Apollo.Mutation { + document = CreateOrganisationDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const UpdateOrganisationDocument = gql` + mutation UpdateOrganisation($organisation: OrganisationUpdateInput!) { + updateOrganisation(organisation: $organisation) { + ...OrganisationFieldsForPage + } +} + ${OrganisationFieldsForPageFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class UpdateOrganisationGQL extends Apollo.Mutation { + document = UpdateOrganisationDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const LockOrganisationDocument = gql` + mutation LockOrganisation($id: ID!) { + lockOrganisation(id: $id) { + ...OrganisationFieldsForPage + } +} + ${OrganisationFieldsForPageFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class LockOrganisationGQL extends Apollo.Mutation { + document = LockOrganisationDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const UnlockOrganisationDocument = gql` + mutation UnlockOrganisation($id: ID!) { + unlockOrganisation(id: $id) { + ...OrganisationFieldsForPage + } +} + ${OrganisationFieldsForPageFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class UnlockOrganisationGQL extends Apollo.Mutation { + document = UnlockOrganisationDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const DeleteOrganisationDocument = gql` + mutation DeleteOrganisation($id: ID!) { + deleteOrganisation(id: $id) +} + `; + + @Injectable({ + providedIn: 'root' + }) + export class DeleteOrganisationGQL extends Apollo.Mutation { + document = DeleteOrganisationDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const GetPersonsDocument = gql` + query GetPersons { + persons { + ...PersonFieldsForTable + } +} + ${PersonFieldsForTableFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class GetPersonsGQL extends Apollo.Query { + document = GetPersonsDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const GetPersonByIdDocument = gql` + query GetPersonById($id: ID!) { + personById(id: $id) { + ...PersonFieldsForPage + } +} + ${PersonFieldsForPageFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class GetPersonByIdGQL extends Apollo.Query { + document = GetPersonByIdDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const ReloadPersonByIdDocument = gql` + query ReloadPersonById($id: ID!) { + personById(id: $id) { + ...PersonFieldsForTable + } +} + ${PersonFieldsForTableFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class ReloadPersonByIdGQL extends Apollo.Query { + document = ReloadPersonByIdDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const CreatePersonDocument = gql` + mutation CreatePerson($person: PersonCreateInput!) { + createPerson(person: $person) { + ...PersonFieldsForTable + } +} + ${PersonFieldsForTableFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class CreatePersonGQL extends Apollo.Mutation { + document = CreatePersonDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const UpdatePersonDocument = gql` + mutation UpdatePerson($person: PersonUpdateInput!) { + updatePerson(person: $person) { + ...PersonFieldsForPage + } +} + ${PersonFieldsForPageFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class UpdatePersonGQL extends Apollo.Mutation { + document = UpdatePersonDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const LockPersonDocument = gql` + mutation LockPerson($id: ID!) { + lockPerson(id: $id) { + ...PersonFieldsForPage + } +} + ${PersonFieldsForPageFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class LockPersonGQL extends Apollo.Mutation { + document = LockPersonDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const UnlockPersonDocument = gql` + mutation UnlockPerson($id: ID!) { + unlockPerson(id: $id) { + ...PersonFieldsForPage + } +} + ${PersonFieldsForPageFragmentDoc}`; + + @Injectable({ + providedIn: 'root' + }) + export class UnlockPersonGQL extends Apollo.Mutation { + document = UnlockPersonDocument; + + constructor(apollo: Apollo.Apollo) { + super(apollo); + } + } +export const DeletePersonDocument = gql` + mutation DeletePerson($id: ID!) { + deletePerson(id: $id) +} + `; + + @Injectable({ + providedIn: 'root' + }) + export class DeletePersonGQL extends Apollo.Mutation { + document = DeletePersonDocument; + constructor(apollo: Apollo.Apollo) { super(apollo); } diff --git a/src/styles.scss b/src/styles.scss index 592d569..936c719 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -5,7 +5,7 @@ html, body { height: 100%; } body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } h1 { - display: block; + display: inline-block; padding-bottom: 5px; position: relative; } @@ -18,7 +18,7 @@ h1:before { border-bottom: 3px solid #7fc600; } h2 { - display: block; + display: inline-block; padding-bottom: 0; position: relative; }