From dc05476d09e40f6e4007e39cf31ac6f66c24eb30 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 4 Nov 2023 14:18:51 +0100 Subject: [PATCH] Reload calendar after color config changed (references #2368) --- public/viewjs/calendar.js | 5 +++++ services/CalendarService.php | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/public/viewjs/calendar.js b/public/viewjs/calendar.js index 9439b8a6..fbe004ba 100644 --- a/public/viewjs/calendar.js +++ b/public/viewjs/calendar.js @@ -65,3 +65,8 @@ $("#configure-colors-button").on("click", function(e) $("#configure-colors-modal").modal("show"); }); + +$("#configure-colors-modal").on("hidden.bs.modal", function(e) +{ + window.location.href = U('/calendar'); +}) diff --git a/services/CalendarService.php b/services/CalendarService.php index 9422062d..e3320de5 100644 --- a/services/CalendarService.php +++ b/services/CalendarService.php @@ -162,7 +162,8 @@ class CalendarService extends BaseService 'title' => $titlePrefix . $titlePrefix2 . $mealPlanDayNote->note, 'start' => $start, 'date_format' => $dateFormat, - 'link' => $this->UrlManager->ConstructUrl('/mealplan' . '?start=' . $start) + 'link' => $this->UrlManager->ConstructUrl('/mealplan' . '?start=' . $start), + 'color' => $usersService->GetUserSettings(GROCY_USER_ID)['calendar_color_meal_plan'] ]; } @@ -190,7 +191,8 @@ class CalendarService extends BaseService 'title' => $titlePrefix . $titlePrefix2 . FindObjectInArrayByPropertyValue($products, 'id', $mealPlanDayProduct->product_id)->name, 'start' => $start, 'date_format' => $dateFormat, - 'link' => $this->UrlManager->ConstructUrl('/mealplan' . '?start=' . $start) + 'link' => $this->UrlManager->ConstructUrl('/mealplan' . '?start=' . $start), + 'color' => $usersService->GetUserSettings(GROCY_USER_ID)['calendar_color_meal_plan'] ]; } }