diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/TravelinfoController.php b/public/typo3conf/ext/ep_products/Classes/Controller/TravelinfoController.php index 527b5344..9e880bc8 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/TravelinfoController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/TravelinfoController.php @@ -71,6 +71,12 @@ class TravelinfoController extends ActionController $travelData = []; } + try { + $pickupsPlanning = $this->apiClient->getPickupsPlanning($travelCode); + } catch (ApiException $e) { + $pickupsPlanning = []; + } + // extract courses from additional services $courses = array_filter($travelData['additionalServices'] ?? [], function ($service) { return 'KUR' === $service['subType']; @@ -91,6 +97,7 @@ class TravelinfoController extends ActionController $this->view->assign('travelInfo', $travelInfo); $this->view->assign('travelData', $travelData); + $this->view->assign('pickupsPlanning', $pickupsPlanning); $this->view->assign('courses', $courses); $this->view->assign('board', $board); $this->view->assign('departureDayTime', $departureDayTime); diff --git a/public/typo3conf/ext/ep_products/Classes/MyEP/ApiClient.php b/public/typo3conf/ext/ep_products/Classes/MyEP/ApiClient.php index d1dae47b..46dbc4be 100644 --- a/public/typo3conf/ext/ep_products/Classes/MyEP/ApiClient.php +++ b/public/typo3conf/ext/ep_products/Classes/MyEP/ApiClient.php @@ -117,6 +117,30 @@ class ApiClient } } + /** + * @throws ApiException + */ + public function getPickupsPlanning(string $travelCode): array + { + $httpClient = $this->getHttpClient(); + + try { + $response = $httpClient->request('GET', 'pickups-planning/' . $travelCode); + } catch (TransportExceptionInterface $e) { + throw new ApiException($e->getMessage()); + } + + try { + if (200 !== $response->getStatusCode()) { + throw new ApiException($response->getStatusCode()); + } + + return $response->toArray(false); + } catch (\Throwable $e) { + throw new ApiException($e->getMessage()); + } + } + private function getHttpClient(): HttpClientInterface { $config = GeneralUtility::makeInstance(ExtensionConfiguration::class) diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Travelinfo.html b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Travelinfo.html index 41507507..5a4c38cd 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Travelinfo.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Travelinfo.html @@ -77,27 +77,53 @@
-+ Bitte findet euch mindestens 20 Minuten vor Abfahrt an der gebuchten Haltestelle ein. +
+ {travelInfo.busInfoText -> f:format.html()} +| + Zustieg + | ++ Datum/Uhrzeit + | +
|---|---|
|
+ {pickup.city} {pickup.street} + |
+
+ {pickup.datetime -> f:format.date(format: 'd.m.Y')} {pickup.datetime -> f:format.date(format: 'H:i')} Uhr + |
+
+ Die Rückreise mit dem Bus startet {departureDayTime}. +
+