allow changing calendar entry title (#3272)

This commit is contained in:
Kevin Papst
2022-04-25 18:18:48 +02:00
committed by GitHub
parent e94d47bf0f
commit ef5977bcfe
9 changed files with 116 additions and 3 deletions

View File

@@ -62,6 +62,10 @@
<script>
activatePopover();
document.addEventListener('kimai.initialized', function() {
KimaiReloadPageWidget.create('kimai.systemConfigUpdate', true);
});
document.addEventListener('kimai.timesheetUpdate', function() {
jQuery('{{ calendarSelector }}').fullCalendar('refetchEvents');
});
@@ -98,9 +102,35 @@
if (color == null) {
color = defaultColor;
}
let title = apiItem.activity.name;
let description = '';
if (apiItem.description !== null && apiItem.description !== '') {
description = '{{ constant('\\App\\Form\\Type\\CalendarTitlePatternType::SPACER') }}' + apiItem.description;
}
{% if config.entryTitlePattern == constant('\\App\\Form\\Type\\CalendarTitlePatternType::PATTERN_PROJECT') %}
title = apiItem.project.name;
{% elseif config.entryTitlePattern == constant('\\App\\Form\\Type\\CalendarTitlePatternType::PATTERN_CUSTOMER') %}
title = apiItem.project.customer.name;
{% elseif config.entryTitlePattern == constant('\\App\\Form\\Type\\CalendarTitlePatternType::PATTERN_DESCRIPTION') %}
title = apiItem.description;
{% elseif config.entryTitlePattern == constant('\\App\\Form\\Type\\CalendarTitlePatternType::PATTERN_ACTIVITY_DESCRIPTION') %}
title = apiItem.activity.name + description;
{% elseif config.entryTitlePattern == constant('\\App\\Form\\Type\\CalendarTitlePatternType::PATTERN_PROJECT_DESCRIPTION') %}
title = apiItem.project.name + description;
{% elseif config.entryTitlePattern == constant('\\App\\Form\\Type\\CalendarTitlePatternType::PATTERN_CUSTOMER_DESCRIPTION') %}
title = apiItem.project.customer.name + description;
{% endif %}
if (title === '' || title === null) {
title = apiItem.activity.name;
}
return {
id: apiItem.id,
title: apiItem.activity.name,
title: title,
description: apiItem.description,
start: apiItem.begin,
end: apiItem.end,