diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index 49bced64..c0a49a4f 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -224,9 +224,8 @@ function angeltype_controller_shiftsFilterDays(AngelType $angeltype) $days = []; foreach ($all_shifts as $shift) { $day = Carbon::make($shift['start'])->format('Y-m-d'); - $dayFormatted = Carbon::make($shift['start'])->format(__('Y-m-d')); if (!isset($days[$day])) { - $days[$day] = $dayFormatted; + $days[$day] = dateWithEventDay($day); } } ksort($days); diff --git a/includes/controller/locations_controller.php b/includes/controller/locations_controller.php index b1d0bff1..629510ac 100644 --- a/includes/controller/locations_controller.php +++ b/includes/controller/locations_controller.php @@ -28,7 +28,7 @@ function location_controller(): array foreach ($all_shifts as $shift) { $day = $shift->start->format('Y-m-d'); if (!isset($days[$day])) { - $days[$day] = $shift->start->format(__('Y-m-d')); + $days[$day] = dateWithEventDay($day); } } diff --git a/includes/helper/legacy_helper.php b/includes/helper/legacy_helper.php index 8cfeb5c4..617e787f 100644 --- a/includes/helper/legacy_helper.php +++ b/includes/helper/legacy_helper.php @@ -3,6 +3,8 @@ declare(strict_types=1); use Engelsystem\Renderer\Twig\Extensions\Globals; +use Engelsystem\Helpers\Carbon; +use Engelsystem\Helpers\DayOfEvent; function theme_id(): int { @@ -25,3 +27,16 @@ function theme_type(): string { return theme()['type']; } + +function dateWithEventDay(string $day): string +{ + $date = Carbon::createFromFormat('Y-m-d', $day); + $dayOfEvent = DayOfEvent::get($date); + $dateFormatted = $date->format(__('Y-m-d')); + + if (!config('enable_show_day_of_event') || is_null($dayOfEvent)) { + return $dateFormatted; + } + + return $dateFormatted . ' (' . $dayOfEvent . ')'; +} diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index d805ea22..2fd84293 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -286,7 +286,7 @@ function view_user_shifts() } $formattedDays = collect($days)->map(function ($value) { - return Carbon::make($value)->format(__('Y-m-d')); + return dateWithEventDay(Carbon::make($value)->format('Y-m-d')); })->toArray(); $link = button(url('/admin-shifts'), icon('plus-lg'), 'add'); @@ -321,7 +321,10 @@ function view_user_shifts() $types, $shiftsFilter->getTypes(), 'types', - icon('person-lines-fill') . __('angeltypes.angeltypes') . '1', + icon('person-lines-fill') . __('angeltypes.angeltypes') + . ' ', $ownAngelTypes ), 'filled_select' => make_select( @@ -330,12 +333,6 @@ function view_user_shifts() 'filled', icon('person-fill-slash') . __('Occupancy') ), - 'task_notice' => - '1' - . __('The tasks shown here are influenced by the angeltypes you joined already!') - . ' ' - . __('Description of the jobs.') - . '', 'shifts_table' => msg() . $shiftCalendarRenderer->render(), 'ical_text' => div('mt-3', ical_hint()), 'filter' => __('Filter'), diff --git a/includes/view/ShiftsFilterRenderer.php b/includes/view/ShiftsFilterRenderer.php index 53158003..a8df82d1 100644 --- a/includes/view/ShiftsFilterRenderer.php +++ b/includes/view/ShiftsFilterRenderer.php @@ -49,7 +49,7 @@ class ShiftsFilterRenderer $toolbar = []; if ($this->daySelectionEnabled && !empty($this->days)) { $selected_day = date('Y-m-d', $this->shiftsFilter->getStartTime()); - $selected_day_formatted = date(__('Y-m-d'), $this->shiftsFilter->getStartTime()); + $selected_day_formatted = dateWithEventDay($selected_day); $day_dropdown_items = []; foreach ($this->days as $value => $day) { $link = $page_link . '&shifts_filter_day=' . $value; diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index c9929b2a..997ef5be 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -856,9 +856,6 @@ msgstr "" "Die Schichten, die hier angezeigt werden, sind von Deinen Einstellungen " "(Engeltypen/Aufgaben) abhängig!" -msgid "Description of the jobs." -msgstr "Beschreibung der Aufgaben." - msgid "Filter" msgstr "Filter" diff --git a/resources/views/pages/user-shifts.html b/resources/views/pages/user-shifts.html index e425ca55..91504522 100644 --- a/resources/views/pages/user-shifts.html +++ b/resources/views/pages/user-shifts.html @@ -70,11 +70,6 @@
%task_notice%
-