feat: offered courses in travelinfo

This commit is contained in:
Björn Fromme
2024-12-10 14:39:59 +01:00
parent dd01073d05
commit 99eb7d331e
3 changed files with 28 additions and 13 deletions
@@ -65,10 +65,8 @@ class TravelinfoController extends ActionController
/** @var Date $date */ /** @var Date $date */
$date = $this->dateRepository->findForProductAndDate($product, $travelDate)->getFirst(); $date = $this->dateRepository->findForProductAndDate($product, $travelDate)->getFirst();
$hasCourses = null !== $date && 0 < count($date->getServicesGeneral('KUR'));
$this->view->assign('travelinfo', $travelinfo); $this->view->assign('travelinfo', $travelinfo);
$this->view->assign('date', $date); $this->view->assign('date', $date);
$this->view->assign('hasCourses', $hasCourses);
} }
} }
@@ -496,6 +496,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$this->coursesIncluded = $coursesIncluded; $this->coursesIncluded = $coursesIncluded;
} }
public function getActiveCoursesForTravelinfo()
{
return $this->getServicesGeneral('KUR');
}
public function getGuide() public function getGuide()
{ {
return unserialize($this->guide); return unserialize($this->guide);
@@ -117,16 +117,7 @@
</div> </div>
<div class="container px-4 lg:px-24 flex flex-col space-y-16 pb-16"> <div class="container px-4 lg:px-24 flex flex-col space-y-16 pb-16">
<f:for each="{travelinfo.teasers}" as="teaser"> <f:for each="{travelinfo.teasers}" as="teaser">
<f:if condition="{teaser.category} == 'course'"> <f:render section="Teaser" arguments="{_all}"/>
<f:then>
<f:if condition="{hasCourses}">
<f:render section="Teaser" arguments="{_all}"/>
</f:if>
</f:then>
<f:else>
<f:render section="Teaser" arguments="{_all}"/>
</f:else>
</f:if>
</f:for> </f:for>
</div> </div>
<div id="goodtoknow" class="bg-ep-primary-bg"> <div id="goodtoknow" class="bg-ep-primary-bg">
@@ -208,11 +199,32 @@
{teaser.title} {teaser.title}
</h2> </h2>
<f:if condition="{date}"> <f:if condition="{date}">
<f:if condition="{teaser.category} == food"> <f:if condition="{teaser.category} == 'food'">
<p> <p>
{date.board} {date.board}
</p> </p>
</f:if> </f:if>
<f:if condition="{teaser.category} == 'course'">
<f:if condition="{date.activeCoursesForTravelinfo -> f:count()} > 0">
<f:then>
<p>
<strong>Es finden folgende Kurse statt:</strong>
</p>
<ul>
<f:for as="course" each="{date.activeCoursesForTravelinfo}">
<li>
{course.label}
</li>
</f:for>
</ul>
</f:then>
<f:else>
<p>
Es finden keine Kurse über E&P Reisen statt.
</p>
</f:else>
</f:if>
</f:if>
</f:if> </f:if>
{teaser.bodytext -> f:format.html()} {teaser.bodytext -> f:format.html()}
</div> </div>