diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php index e06980fc..c18a1712 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php @@ -168,7 +168,6 @@ class AjaxTableController extends ActionController 'dateTableData' => $dates, 'template' => $this->settings['bpnBookingUrlTemplateCode'], 'paCode' => $paCode, - 'isDayTrip' => $product->isDaytrip(), 'showBookingButton' => false === $product->getHideBookingButton(), 'nonBookableDateUids' => $nonBookableDateUids, ]); diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php index 89a80249..5970370f 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php @@ -200,7 +200,7 @@ class ProductRepository extends AbstractRepository 'date.uid as dateUid', 'date.date_start as dateStart', 'date.date_end as dateEnd', 'date.bus_pro_id as dateBusProId', 'date.hotel as hotelUid', 'date.hotel_bus_pro_id as hotelBusProId', 'date.bus_included as dateBusIncluded', 'date.skipass_included as dateSkipassIncluded', - 'date.season as season', + 'date.season as season', 'date.product_detail_page as productDetailPage', 'room.uid as roomUid', 'room.bus_pro_id as roomBusProId', 'room.name as roomName', 'room.price as roomPrice', 'date.discount as roomDiscount', 'date.bus_price as busPrice', 'room.services as roomOptionalServices', 'room.nights as roomNights', 'room.available as roomAvailable' @@ -259,7 +259,7 @@ class ProductRepository extends AbstractRepository 'date.bus_included as dateBusIncluded', 'date.services_included as dateServicesIncluded', 'date.services_general as dateServicesGeneral', 'date.skipass_included as dateSkipassIncluded', 'date.bus_pro_id as dateBusProId', 'date.hotel_bus_pro_id as hotelBusProId', - 'date.available as available' + 'date.available as available', 'date.product_detail_page as productDetailPage', ) ->from('tx_epproducts_domain_model_date', 'date') ->innerJoin('date', 'tx_epproducts_domain_model_room', 'room', 'room.date = date.uid') diff --git a/public/typo3conf/ext/ep_products/Classes/Service/ContingentDataService.php b/public/typo3conf/ext/ep_products/Classes/Service/ContingentDataService.php index 10eaecf9..9908ea76 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/ContingentDataService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/ContingentDataService.php @@ -89,13 +89,13 @@ class ContingentDataService $data = $this->contingentRepository->getAvailableRooms($dateFrom, $dateTo, $hotel, $product); $period = new Period($dateFrom, $dateTo); $nights = $period->dateInterval()->format('%a'); + $rooms = []; foreach ($data as $row) { $row['bookingUrl'] = BookingUrlUtility::generateUrl([ - 'bookingId' => $row['busProId'], + 'dateId' => $row['busProId'], 'hotelId' => $row['hotelBusProId'], - 'dateEnd' => $dateTo, - 'template' => $template, + 'theme' => $template, ]); $row['summer'] = $row['season'] === 's'; diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php index 4b04aa5a..eea21300 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php @@ -132,7 +132,6 @@ class DateService implements SingletonInterface 'priceTableData' => $this->productRepository->getPricetable($product, $hotel, $filterSettings, $date), 'template' => $template, 'paCode' => $paCode, - 'isDayTrip' => $product->isDaytrip(), 'showBookingButton' => false === $product->getHideBookingButton(), 'nonBookableDateUids' => $nonBookableDateUids, ]); @@ -194,9 +193,8 @@ class DateService implements SingletonInterface public function preprocessPriceTable(array $options): array { $resolver = new OptionsResolver(); - $resolver->setDefined(['paCode', 'isDayTrip', 'showBookingButton', 'nonBookableDateUids']); + $resolver->setDefined(['paCode', 'showBookingButton', 'nonBookableDateUids']); $resolver->setRequired(['priceTableData', 'template']); - $resolver->setDefault('isDayTrip', false); $resolver->setDefault('showBookingButton', true); $resolvedOptions = $resolver->resolve($options); @@ -208,7 +206,6 @@ class DateService implements SingletonInterface $priceTableData = $resolvedOptions['priceTableData']; $template = $resolvedOptions['template']; $paCode = $resolvedOptions['paCode']; - $isDayTrip = $resolvedOptions['isDayTrip']; $nonBookableDateUids = $resolvedOptions['nonBookableDateUids']; foreach ($priceTableData as $row) { @@ -217,12 +214,11 @@ class DateService implements SingletonInterface $dateStart = new \DateTime($row['dateStart']); $dateEnd = new \DateTime($row['dateEnd']); $bookingUrl = BookingUrlUtility::generateUrl([ - 'bookingId' => $row['dateBusProId'], + 'dateId' => $row['dateBusProId'], 'hotelId' => $row['hotelBusProId'], - 'dateEnd' => $row['dateEnd'], - 'template' => $template, + 'theme' => $template, 'paCode' => $paCode, - 'isDayTrip' => $isDayTrip, + 'returnPageUid' => $row['productDetailPage'] ?? null, ]); $optionalServices = $this->preprocessOptionalServices(unserialize($row['roomOptionalServices'], ['allowed_classes' => false])); @@ -284,9 +280,8 @@ class DateService implements SingletonInterface public function preprocessDatesTable(array $options): array { $resolver = new OptionsResolver(); - $resolver->setDefined(['paCode', 'isDayTrip', 'showBookingButton', 'nonBookableDateUids']); + $resolver->setDefined(['paCode', 'showBookingButton', 'nonBookableDateUids']); $resolver->setRequired(['dateTableData', 'template']); - $resolver->setDefault('isDayTrip', false); $resolver->setDefault('showBookingButton', true); $resolver->setDefault('nonBookableDateUids', []); $resolvedOptions = $resolver->resolve($options); @@ -296,7 +291,6 @@ class DateService implements SingletonInterface $dateTableData = $resolvedOptions['dateTableData']; $template = $resolvedOptions['template']; $paCode = $resolvedOptions['paCode']; - $isDayTrip = $resolvedOptions['isDayTrip']; $nonBookableDateUids = $resolvedOptions['nonBookableDateUids']; foreach ($dateTableData as $row) { @@ -310,12 +304,11 @@ class DateService implements SingletonInterface $dateStart = new \DateTime($row['dateStart']); $dateEnd = new \DateTime($row['dateEnd']); $bookingUrl = BookingUrlUtility::generateUrl([ - 'bookingId' => $row['dateBusProId'], + 'dateId' => $row['dateBusProId'], 'hotelId' =>$row['hotelBusProId'], - 'dateEnd' => $row['dateEnd'], - 'template' => $template, + 'theme' => $template, 'paCode' => $paCode, - 'isDayTrip' => $isDayTrip, + 'returnPageUid' => $row['productDetailPage'] ?? null, ]); $dateTable[] = [ 'dateUid' => $row['dateUid'], @@ -386,11 +379,11 @@ class DateService implements SingletonInterface 'hotelTitle' => $row['hotelTitle'], 'hotelDetailPageUid' => $row['hotelMappingDetailPageUid'] ?? $row['hotelDetailPageUid'], 'bookingUrl' => BookingUrlUtility::generateUrl([ - 'bookingId' => $row['dateBusProId'], + 'dateId' => $row['dateBusProId'], 'hotelId' => $row['hotelBusProId'], - 'dateEnd' => $row['dateEnd'], - 'template' => $template, + 'theme' => $template, 'paCode' => $paCode, + 'returnPageUid' => $row['productDetailPage'] ?? null, ]), 'rooms' => [], ]; diff --git a/public/typo3conf/ext/ep_products/Classes/Service/ResellerDataService.php b/public/typo3conf/ext/ep_products/Classes/Service/ResellerDataService.php index 623a7498..4bf98620 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/ResellerDataService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/ResellerDataService.php @@ -145,10 +145,9 @@ class ResellerDataService implements SingletonInterface $data[$row['dateStart']] = $date; } - $data[$row['dateStart']]['bookingurl'] = BookingUrlUtility::generateResellerUrl([ - 'bookingId' => $row['dateBusProId'], + $data[$row['dateStart']]['bookingurl'] = BookingUrlUtility::generateUrl([ + 'dateId' => $row['dateBusProId'], 'hotelId' => $row['hotelBusProId'], - 'dateEnd' => $row['dateEnd'], 'paCode' => $paCode, ]); diff --git a/public/typo3conf/ext/ep_products/Classes/Utility/BookingUrlUtility.php b/public/typo3conf/ext/ep_products/Classes/Utility/BookingUrlUtility.php index c8d56d02..28428e35 100644 --- a/public/typo3conf/ext/ep_products/Classes/Utility/BookingUrlUtility.php +++ b/public/typo3conf/ext/ep_products/Classes/Utility/BookingUrlUtility.php @@ -2,145 +2,45 @@ namespace EP\EpProducts\Utility; -/*************************************************************** - * - * Copyright notice - * - * (c) 2016 Björn Fromme , dreipunktnull - * - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - use Symfony\Component\OptionsResolver\OptionsResolver; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use TYPO3\CMS\Core\Routing\RouterInterface; use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Utility\GeneralUtility; class BookingUrlUtility { - - const COOKIE_NAME = 'ep_trk'; - public static function generateUrl(array $options): string { + $config = GeneralUtility::makeInstance(ExtensionConfiguration::class) + ->get('ep_products'); + $resolver = new OptionsResolver(); - $resolver->setDefined('paCode'); - $resolver->setRequired(['bookingId', 'hotelId', 'dateEnd']); + $resolver->setDefined(['paCode', 'returnPageUid']); + $resolver->setRequired(['dateId', 'hotelId']); $resolver->setDefaults([ - 'template' => 'base', - 'isDayTrip' => false, + 'theme' => 'base', ]); $resolvedOptions = $resolver->resolve($options); - $bookingId = $resolvedOptions['bookingId']; - $hotelId = $resolvedOptions['hotelId']; - $dateEnd = $resolvedOptions['dateEnd']; - $template = $resolvedOptions['template']; - $paCode = $resolvedOptions['paCode']; - $isDayTrip = $resolvedOptions['isDayTrip']; - - $query = static::buildQuery($bookingId, $hotelId, $dateEnd, $template, $isDayTrip); - - if ('' === session_id()) { - session_start(); - } - - $trackingCode = $_SESSION['ep_trk'] ?? null; - - if (null !== $paCode) { - $query['agenturcode'] = $paCode; - } elseif (null !== $trackingCode) { - $queryParameter = static::getQueryParameter($trackingCode); - $query[$queryParameter] = $trackingCode; - } - - return static::buildUrl($query); - } - - public static function generateResellerUrl(array $options): string - { - $resolver = new OptionsResolver(); - $resolver->setDefined('paCode'); - $resolver->setRequired(['bookingId', 'hotelId', 'dateEnd']); - $resolver->setDefaults([ - 'template' => 'base', - 'isDayTrip' => false, - ]); - - $resolvedOptions = $resolver->resolve($options); - - $bookingId = $resolvedOptions['bookingId']; - $hotelId = $resolvedOptions['hotelId']; - $dateEnd = $resolvedOptions['dateEnd']; - $template = $resolvedOptions['template']; - $paCode = $resolvedOptions['paCode']; - $isDayTrip = $resolvedOptions['isDayTrip']; - - $query = static::buildQuery($bookingId, $hotelId, $dateEnd, $template, $isDayTrip); - - if ($paCode !== null) { - $query['agenturcode'] = $paCode; - } - - return static::buildUrl($query); - } - - protected static function buildQuery(string $bookingId, string $hotelId, ?string $dateEnd, string $template = 'base', bool $isDayTrip = false): array - { $query = [ - 'id' => $bookingId, - 'hotelid' => $hotelId, + 'date_id' => $resolvedOptions['dateId'], + 'hotel_id' => $resolvedOptions['hotelId'], + 'theme' => $resolvedOptions['theme'], ]; - if ($dateEnd && !$isDayTrip) { - $query['ruecktermin'] = date('d.m.Y', strtotime($dateEnd)); + if (null !== $resolvedOptions['paCode']) { + $query['agency'] = $resolvedOptions['paCode']; } - if ($template) { - $query['templatezusatz'] = '_' . $template; + if (null !== $resolvedOptions['returnPageUid'] && 0 < (int) $resolvedOptions['returnPageUid']) { + $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); + $site = $siteFinder->getSiteByPageId((int) $resolvedOptions['returnPageUid']); + + $query['r'] = (string) $site->getRouter()->generateUri((int) $resolvedOptions['returnPageUid'], [], '', RouterInterface::ABSOLUTE_URL); } - return $query; - } - - protected static function buildUrl(array $query): string - { - /** @var SiteFinder $siteFinder */ - $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); - - $pageId = $GLOBALS['TSFE']->id; - - if (null !== $pageId) { - $site = $siteFinder->getSiteByPageId($pageId); - } else { - $site = $siteFinder->getSiteByIdentifier('ep-reisen'); - } - - return $site->getBase() . '/buchung/maske_buchung.php?' . http_build_query($query); - } - - protected static function getQueryParameter($code) - { - if (!preg_match('/^PA\d{3,4}$/', $code)) { - return 'crminfo'; - } - - return 'agenturcode'; + return $config['myEpUrl'].'/bookings/create?'.http_build_query($query); } } diff --git a/public/typo3conf/ext/ep_products/ext_conf_template.txt b/public/typo3conf/ext/ep_products/ext_conf_template.txt index 04fb2ed8..35bf821f 100644 --- a/public/typo3conf/ext/ep_products/ext_conf_template.txt +++ b/public/typo3conf/ext/ep_products/ext_conf_template.txt @@ -1,6 +1,9 @@ # cat=General; type=int; label=Searchresult PID searchPageUid = 0 +# cat=MyEp; type=string; label=MyE&P URL +myEpUrl = + # cat=MyEpAPI; type=string; label=MyE&P API base URL (trailing slash!) myEpApiBaseUrl = diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index e3391fee..19b6b92e 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -35,6 +35,10 @@ $boot = function () { ], ]; + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants( + 'plugin.tx_epproducts.settings.myEpUrl = '.$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['ep_products']['myEpUrl'] + ); + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); $iconRegistry->registerIcon( 'ep-logo', diff --git a/public/typo3conf/ext/ep_theme/Classes/ViewHelpers/Uri/BookingViewHelper.php b/public/typo3conf/ext/ep_theme/Classes/ViewHelpers/Uri/BookingViewHelper.php index 7b8134d9..a4fd419f 100644 --- a/public/typo3conf/ext/ep_theme/Classes/ViewHelpers/Uri/BookingViewHelper.php +++ b/public/typo3conf/ext/ep_theme/Classes/ViewHelpers/Uri/BookingViewHelper.php @@ -82,9 +82,9 @@ class BookingViewHelper extends AbstractViewHelper } $options = [ - 'bookingId' => $arguments['bookingId'], + 'dateId' => $arguments['bookingId'], 'hotelId' => $arguments['hotelId'], - 'template' => $template, + 'theme' => $template, ]; return BookingUrlUtility::generateUrl($options); } diff --git a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/setup.typoscript b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/setup.typoscript index 431068e9..25e0fa0f 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/setup.typoscript +++ b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/setup.typoscript @@ -76,6 +76,10 @@ plugin.tx_eptheme { globalConceptCode = {$plugin.tx_eptheme.settings.globalConceptCode} travelAlertPageUid = {$plugin.tx_eptheme.settings.travelAlertPageUid} myEpPageUid = {$plugin.tx_eptheme.settings.myEpPageUid} + myEpApiEndpointUrl = {$plugin.tx_eptheme.settings.myEpApiEndpointUrl} + myEpApiToken = {$plugin.tx_eptheme.settings.myEpApiToken} + myEpApiTimeout = {$plugin.tx_eptheme.settings.myEpApiTimeout} + myEpUrl = {$plugin.tx_epproducts.settings.myEpUrl} facebookViewContentValues { productUid = {$plugin.tx_eptheme.settings.facebookViewContentProductUid} nameInternal = {$plugin.tx_eptheme.settings.facebookViewContentNameInternal} diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep.js deleted file mode 100644 index 88114795..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep.js +++ /dev/null @@ -1,16 +0,0 @@ -// Initialize vue app -import Vue from 'vue' -import vueCustomElement from 'vue-custom-element' -import dayjs from 'dayjs' -import 'dayjs/locale/de' -import 'document-register-element/build/document-register-element' -import App from './myep/App' - -Vue.filter('date', (value) => { - return dayjs(value).format('DD.MM.YY'); -}) - -Vue.use(vueCustomElement) -Vue.config.productionTip = false - -Vue.customElement('my-ep', App) diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue deleted file mode 100644 index 91f35376..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue +++ /dev/null @@ -1,130 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue deleted file mode 100644 index b9b688ce..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue +++ /dev/null @@ -1,82 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/BookingEdit.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/BookingEdit.vue deleted file mode 100644 index f64bed7d..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/BookingEdit.vue +++ /dev/null @@ -1,548 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/CrmData.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/CrmData.vue deleted file mode 100644 index 9b2d4675..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/CrmData.vue +++ /dev/null @@ -1,138 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Events.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Events.vue deleted file mode 100644 index 9d149791..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Events.vue +++ /dev/null @@ -1,157 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Login.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Login.vue deleted file mode 100644 index 68ece2b7..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Login.vue +++ /dev/null @@ -1,152 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Newsletter.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Newsletter.vue deleted file mode 100644 index e9e622d7..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Newsletter.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Registration.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Registration.vue deleted file mode 100644 index 5c2a76c5..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Registration.vue +++ /dev/null @@ -1,94 +0,0 @@ - -w - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Teamer.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Teamer.vue deleted file mode 100644 index 2a710a40..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Teamer.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/api/index.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/api/index.js deleted file mode 100644 index 35a2b5cc..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/api/index.js +++ /dev/null @@ -1,24 +0,0 @@ -const defaultOptions = { - headers: { - 'Content-Type': 'application/json' - }, - credentials: 'include', -} - -function checkStatus(response) { - if (response.ok) { - return response - } else { - return response - .json() - .then(error => { - const responseError = new Error(error.message) - if (error.hasOwnProperty('violations')) { - responseError.violations = error.violations - } - throw responseError - }) - } -} - -export { checkStatus, defaultOptions } diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/AccommodationSelect.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/AccommodationSelect.vue deleted file mode 100644 index 7b18e423..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/AccommodationSelect.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/CollapsiblePanel.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/CollapsiblePanel.vue deleted file mode 100644 index 2d71b4ef..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/CollapsiblePanel.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ContingentsOverview.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ContingentsOverview.vue deleted file mode 100644 index 97e59c65..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ContingentsOverview.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/FormGroup.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/FormGroup.vue deleted file mode 100644 index 8adfad18..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/FormGroup.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/MutableFields.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/MutableFields.vue deleted file mode 100644 index da7d1e0f..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/MutableFields.vue +++ /dev/null @@ -1,42 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/Panel.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/Panel.vue deleted file mode 100644 index 8cb803d1..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/Panel.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantAddressForm.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantAddressForm.vue deleted file mode 100644 index 53e2bc02..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantAddressForm.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantDataForm.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantDataForm.vue deleted file mode 100644 index 8f7dcc98..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantDataForm.vue +++ /dev/null @@ -1,66 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantSizesForm.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantSizesForm.vue deleted file mode 100644 index a57c379c..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ParticipantSizesForm.vue +++ /dev/null @@ -1,87 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/PickupSelect.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/PickupSelect.vue deleted file mode 100644 index 47f39f91..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/PickupSelect.vue +++ /dev/null @@ -1,66 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ServiceSelect.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ServiceSelect.vue deleted file mode 100644 index 3d4bebda..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ServiceSelect.vue +++ /dev/null @@ -1,98 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ServicesOverview.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ServicesOverview.vue deleted file mode 100644 index d0463d61..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/ServicesOverview.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/TransportationSelect.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/TransportationSelect.vue deleted file mode 100644 index 58830a75..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/TransportationSelect.vue +++ /dev/null @@ -1,76 +0,0 @@ - - - diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/router/index.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/router/index.js deleted file mode 100644 index 2c1497e6..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/router/index.js +++ /dev/null @@ -1,99 +0,0 @@ -import Vue from 'vue'; -import VueRouter from 'vue-router'; -import store from '../store'; - -Vue.use(VueRouter); - -const guard = (to, from, next) => { - if (store.getters.isLoggedIn === false) { - next({ name: 'login' }); - } else if (to.meta.requiresTeamer && store.getters.isTeamer === false) { - next(false); - } else { - next(); - } -}; - -import Address from '../Address' -import Events from '../Events' -import Login from '../Login' -import CrmData from '../CrmData' -import Newsletter from '../Newsletter' -import Registration from '../Registration' - -// Lazy load some components when they become required -const Teamer = () => import('../Teamer') -const BookingEdit = () => import('../BookingEdit') - -export default new VueRouter({ - routes: [ - { - name: 'login', - path: '/', - component: Login, - beforeEnter (from, to, next) { - if (store.getters.isLoggedIn === false) { - next(); - } else { - next({ name: 'address' }); - } - } - }, - { - name: 'register', - path: '/register', - component: Registration, - beforeEnter (from, to, next) { - if (store.getters.isLoggedIn === false) { - next(); - } else { - next({ name: 'address' }); - } - } - }, - { - name: 'address', - path: '/adressdaten', - component: Address, - beforeEnter: guard - }, - { - name: 'newsletter', - path: '/newsletter', - component: Newsletter, - beforeEnter: guard - }, - { - name: 'profile', - path: '/profil', - component: CrmData, - beforeEnter: guard - }, - { - name: 'events', - path: '/vorgaenge', - component: Events, - beforeEnter: guard, - }, - { - name: 'bookingEdit', - path: '/buchung/:id', - component: BookingEdit, - beforeEnter: guard - }, - { - name: 'teamer', - path: '/teamer', - component: Teamer, - meta: { requiresTeamer: true }, - beforeEnter: guard - }, - { - path: '*', - redirect: { name: 'login' } - } - ], - scrollBehavior (to, from, savedPosition) { - return { selector: '#myep', offset: { x: 0 , y: 160 } } - } -}); diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/store/index.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/store/index.js deleted file mode 100644 index 90be4846..00000000 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/store/index.js +++ /dev/null @@ -1,263 +0,0 @@ -import Vue from 'vue' -import Vuex from 'vuex' -import { checkStatus, defaultOptions } from '../api' - -const configElement = document.getElementById('appconfig') -const config = JSON.parse(configElement.innerHTML) - -Vue.use(Vuex) - -const defaultUserData = { - isTeamer: false, - isGroupManager: false, - email: '', - firstName: '', - lastName: '', - gender: '', - dateOfBirth: null, - street: '', - zipCode: '', - city: '', - phoneMobile: '', - phonePrivate: '', - newsletter: false, -}; - -export default new Vuex.Store({ - state: { - config: {}, - loading: false, - statusMessage: '', - authenticated: false, - userData: defaultUserData, - countries: [], - alert: { - message: '', - success: true, - } - }, - mutations: { - initConfig(state) { - state.config = config - }, - setUserData(state, data) { - if (state.userData.watchList) { - data.watchList = [...state.userData.watchList, ...data.watchList] - } - state.userData = data - }, - login(state) { - state.authenticated = true - }, - logout(state) { - state.userData = defaultUserData; - state.authenticated = false - }, - alert(state, payload) { - state.alert = payload; - }, - beginLoading(state, statusMessage) { - state.loading = true - state.statusMessage = statusMessage - state.alert = {message: '', success: true} - }, - endLoading(state) { - state.loading = false - state.statusMessage = '' - }, - setCountries(state, countries) { - state.countries = countries; - } - }, - actions: { - checkLoginState({commit, state}) { - commit('beginLoading') - - const options = { - ...defaultOptions - } - - return fetch(`${state.config.myEpApiBaseUrl}/api/ping`, options) - .then(checkStatus) - .then(response => response.json()) - .then(() => { - commit('login') - }) - .catch(() => {}) - .finally(() => { - commit('endLoading') - }) - }, - loadCountries({commit, state}) { - commit('beginLoading') - - const options = { - ...defaultOptions - } - - return fetch(`${state.config.myEpApiBaseUrl}/api/countries`, options) - .then(checkStatus) - .then(response => response.json()) - .then(data => { - commit('setCountries', data) - }) - .catch(error => { - commit('alert', { - message: 'Es ist ein Fehler aufgetreten: ' + error.message, - success: false, - }) - }) - .finally(() => { - commit('endLoading') - }) - }, - login({commit}, credentials) { - commit('beginLoading') - - const options = { - ...defaultOptions, - method: 'POST', - body: JSON.stringify({ - username: credentials.email, - password: credentials.password - }) - } - - return fetch(`${config.myEpApiBaseUrl}/api/login`, options) - .then(checkStatus) - .then(response => response.json()) - .then(data => { - commit('login', data) - }) - .catch(error => { - commit('logout') - commit('alert', { - message: 'Der Login ist fehlgeschlagen :(', - success: false, - }); - throw error - }) - .finally(() => { - commit('endLoading') - }) - }, - logout({commit}) { - commit('beginLoading') - - const options = { - ...defaultOptions - } - - return fetch(`${config.myEpApiBaseUrl}/api/logout`, options) - .then(checkStatus) - .catch(() => {}) - .finally(() => { - commit('logout') - commit('endLoading') - }) - }, - resetPassword({commit}, email) { - commit('beginLoading') - - const options = { - ...defaultOptions, - method: 'POST', - body: JSON.stringify({ - email - }) - } - - return fetch(`${config.myEpApiBaseUrl}/api/reset-password`, options) - .then(checkStatus) - .then(response => response.json()) - .then(response => response) - .catch(error => { - commit('alert', { - message: 'Es ist ein Fehler aufgetreten: ' + error.message, - success: false, - }) - }) - .finally(() => { - commit('endLoading') - }) - }, - register({commit}, userData) { - commit('beginLoading') - - const options = { - ...defaultOptions, - method: 'POST', - body: JSON.stringify(userData) - } - - return fetch(`${config.myEpApiBaseUrl}/api/register`, options) - .then(checkStatus) - .then(response => response.json()) - .then(data => data) - .catch(error => { - commit('alert', { - message: 'Es ist ein Fehler aufgetreten: ' + error.message, - success: false, - }) - throw error - }) - .finally(() => { - commit('endLoading') - }) - }, - loadAddress({commit}) { - commit('beginLoading') - - const options = { - ...defaultOptions, - } - - return fetch(`${config.myEpApiBaseUrl}/api/address`, options) - .then(checkStatus) - .then(response => response.json()) - .then(data => { - commit('setUserData', data) - if (data.watchlist) { - commit('setWatchlist', data.watchlist) - } - }) - .catch(error => { - commit('alert', { - message: 'Es ist ein Fehler aufgetreten: ' + error.message, - success: false, - }) - }) - .finally(() => { - commit('endLoading') - }) - }, - saveAddress({commit, state}, data) { - commit('beginLoading') - - const options = { - ...defaultOptions, - method: 'PUT', - body: JSON.stringify(data) - } - - return fetch(`${config.myEpApiBaseUrl}/api/address`, options) - .then(checkStatus) - .then(response => response.json()) - .then(() => { - commit('alert', { - message: 'Die Änderungen wurden gespeichert', - success: true, - }) - }) - .finally(() => { - commit('endLoading') - }) - } - }, - getters: { - onWatchlist: state => uid => state.userData.watchList.indexOf(uid) !== -1, - isLoggedIn: state => !!state.authenticated, - isTeamer: state => !!state.userData.isTeamer, - isGroupManager: state => !!state.userData.isGroupManager, - } -}); diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Topnav.html b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Topnav.html index d2dbb46c..95136606 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Topnav.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Topnav.html @@ -6,7 +6,7 @@ - +
@@ -37,7 +37,7 @@
- + {ep:icon(icon: 'user', class: 'w-5 h-5')} diff --git a/webpack.config.js b/webpack.config.js index ce717fbd..81691868 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,7 +9,6 @@ Encore .setOutputPath('./public/typo3conf/ext/ep_theme/Resources/Public/') .setPublicPath('/typo3conf/ext/ep_theme/Resources/Public/') .addEntry('main', './public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/main.js') - .addEntry('myep', './public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep.js') .addEntry('groups-calculator', './public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/groups-calculator.js') .addStyleEntry('rte', './public/typo3conf/ext/ep_theme/Resources/Private/Assets/scss/rte.scss') .splitEntryChunks()