From a0c3751a317d56947ef87a4bc3388caec5407df7 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Fri, 4 Dec 2020 00:17:22 +0100 Subject: [PATCH] Add bikes, organisation and loanPeriod to lendingStation page --- .../fragments/lendingStation.graphql | 14 ++++--- .../fragments/organisation.graphql | 1 + .../lending-station.component.ts | 38 ++++++++++++++++++- src/generated/graphql.ts | 14 ++++++- 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/src/app/graphqlOperations/fragments/lendingStation.graphql b/src/app/graphqlOperations/fragments/lendingStation.graphql index bf79cf2..bce564c 100644 --- a/src/app/graphqlOperations/fragments/lendingStation.graphql +++ b/src/app/graphqlOperations/fragments/lendingStation.graphql @@ -39,9 +39,13 @@ fragment LendingStationFieldsForPage on LendingStation { timeFrames { ...TimeFrameFieldsForLendingStation } - # loanPeriod { - # generalRemark - # notes - # loanTimes - #} + loanPeriod { + mo + tu + we + th + fr + sa + su + } } \ No newline at end of file diff --git a/src/app/graphqlOperations/fragments/organisation.graphql b/src/app/graphqlOperations/fragments/organisation.graphql index e51d1a6..f18a749 100644 --- a/src/app/graphqlOperations/fragments/organisation.graphql +++ b/src/app/graphqlOperations/fragments/organisation.graphql @@ -4,4 +4,5 @@ fragment OrganisationFieldsGeneral on Organisation { address { ...AddressFields } + associationNo } diff --git a/src/app/pages/dataPages/lending-station/lending-station.component.ts b/src/app/pages/dataPages/lending-station/lending-station.component.ts index 3ecb516..de92414 100644 --- a/src/app/pages/dataPages/lending-station/lending-station.component.ts +++ b/src/app/pages/dataPages/lending-station/lending-station.component.ts @@ -28,8 +28,27 @@ export class LendingStationComponent implements OnInit { }, { type: 'Group', - title: 'Öffnungszeiten', - properties: [], + title: 'Ausleihzeiten', + properties: [ + { dataPath: 'loanPeriod.mo', translation: 'Montag' }, + { dataPath: 'loanPeriod.tu', translation: 'Dienstag' }, + { dataPath: 'loanPeriod.we', translation: 'Mittwoch' }, + { dataPath: 'loanPeriod.th', translation: 'Donnerstag' }, + { dataPath: 'loanPeriod.fr', translation: 'Freitag' }, + { dataPath: 'loanPeriod.sa', translation: 'Samstag' }, + { dataPath: 'loanPeriod.su', translation: 'Sonntag' }, + ], + }, + { + type: 'Group', + title: 'Organisation', + properties: [ + { dataPath: 'organisation.name', translation: 'Name', link: (data)=> "/organisation/" + data["organisation.id"] }, + { dataPath: 'organisation.address.street', translation: 'Straße'}, + { dataPath: 'organisation.address.number', translation: 'Hausnummer'}, + { dataPath: 'organisation.address.zip', translation: 'Postleitzahl'}, + { dataPath: 'organisation.associationNo', translation: 'Nummer'}, + ], }, { type: 'Group', @@ -119,6 +138,21 @@ export class LendingStationComponent implements OnInit { { dataPath: 'contactInformationExtern.note', translation: 'Anmerkung' }, ], }, + { + type: 'ReferenceTable', + title: 'Lastenräder', + dataPath: 'cargoBikes', + dataService: null, + columnInfo: [ + { + dataPath: 'name', + translation: 'Lastenrad', + link: (row) => '/bike/' + row['cargoBike.id'], + }, + ], + editableReferences: false, + linkToTable: () => '/table/bikes', + }, { type: 'ReferenceTable', title: 'Zeitscheiben', diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index 2852913..0ca3b9e 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -2103,11 +2103,11 @@ export type LendingStationFieldsForPageFragment = ( { __typename?: 'LendingStation', cargoBikes?: Maybe>, timeFrames: Array<( { __typename?: 'TimeFrame' } & TimeFrameFieldsForLendingStationFragment - )> } + )>, loanPeriod?: Maybe<{ __typename?: 'LoanPeriod', mo?: Maybe, tu?: Maybe, we?: Maybe, th?: Maybe, fr?: Maybe, sa?: Maybe, su?: Maybe }> } & LendingStationFieldsForTableFragment ); -export type OrganisationFieldsGeneralFragment = { __typename?: 'Organisation', id: string, name: string, address?: Maybe<( +export type OrganisationFieldsGeneralFragment = { __typename?: 'Organisation', id: string, name: string, associationNo?: Maybe, address?: Maybe<( { __typename?: 'Address' } & AddressFieldsFragment )> }; @@ -2291,6 +2291,7 @@ export const OrganisationFieldsGeneralFragmentDoc = gql` address { ...AddressFields } + associationNo } ${AddressFieldsFragmentDoc}`; export const LendingStationFieldsForBikePageFragmentDoc = gql` @@ -2652,6 +2653,15 @@ export const LendingStationFieldsForPageFragmentDoc = gql` timeFrames { ...TimeFrameFieldsForLendingStation } + loanPeriod { + mo + tu + we + th + fr + sa + su + } } ${LendingStationFieldsForTableFragmentDoc} ${TimeFrameFieldsForLendingStationFragmentDoc}`;