diff --git a/site/config/routes/month-dates.php b/site/config/routes/month-dates.php index 20b57b4..e6c42ad 100644 --- a/site/config/routes/month-dates.php +++ b/site/config/routes/month-dates.php @@ -39,7 +39,7 @@ return [ if ($event->isMapadoEvent() == 'false') { foreach ($event->sessions()->toStructure() as $session) { - $sessionMonth = $session->date()->toDate('Y-m'); + $sessionMonth = $session->date()->toDate('Y-MM'); if ($sessionMonth === $requestMonth) { $day = intval($session->date()->toDate('d')); $dates[$day][] = array_merge($eventInfos, [ @@ -51,26 +51,9 @@ return [ } } - if ($event->isMapadoEvent() == 'true') { - $request = [ - "requestEndPoint" => "ticketings/" . $event->mapadoId()->value(), - "requestParams" => [], - "requestFields" => [ - ["name" => "title"], - ["name" => "address"], - ["name" => "slug"], - [ - "name" => "eventDateList", - "subfields" => [ - ["name" => "startDate"], - ["name" => "endDate"], - ["name" => "bookableStock"] - ] - ], - ] - ]; - - $mapadoEvent = fetchMapadoEvent($request); + if ($event->isMapadoEvent() == 'true') { + $request = createMapadoEventRequest($event); + $mapadoEvent = fetchMapadoEvent($request); $duration = null; @@ -106,11 +89,8 @@ return [ ]; } } - $event->update([ - "mapadoSlug" => $mapadoEvent->slug, - "remoteDuration" => $duration, - "remoteSessions" => $sessionsToSave - ]); + + saveMapadoEvent($mapadoEvent, $event); } } diff --git a/site/snippets/calendar-strip.php b/site/snippets/calendar-strip.php index c256879..441c4a9 100644 --- a/site/snippets/calendar-strip.php +++ b/site/snippets/calendar-strip.php @@ -16,6 +16,8 @@ async updateDates() { document.body.classList.toggle('progress') this.dates = getDatesInMonth(this.monthNumb); + + this.dates = await getMergedDates(this.monthNumb, this.dates) diff --git a/site/templates/home.php b/site/templates/home.php index 427b1b2..0ccc467 100644 --- a/site/templates/home.php +++ b/site/templates/home.php @@ -9,7 +9,7 @@ - + children()->first()->children();