fixes for editing calendar

This commit is contained in:
2022-05-23 17:30:40 +02:00
parent a025883a5d
commit 7dcd5be735
5 changed files with 42 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
import {COLORS} from '../const';
import {ISOToDatetime} from 'ChillMainAssets/chill/js/date';
const addIdToValue = (string, id) => {
let array = string ? string.split(',') : [];
@@ -18,8 +19,25 @@ const removeIdFromValue = (string, id) => {
* Assign missing keys for the ConcernedGroups component
*/
const mapEntity = (entity) => {
Object.assign(entity, {thirdParties: entity.professionals, users: entity.invites});
return entity;
console.log('mapEntity', entity);
let calendar = { ...entity};
Object.assign(calendar, {thirdParties: entity.professionals, users: entity.invites});
if (entity.startDate !== null ) {
calendar.startDate = ISOToDatetime(entity.startDate.datetime);
}
if (entity.endDate !== null) {
calendar.endDate = ISOToDatetime(entity.endDate.datetime);
}
if (entity.calendarRange !== null) {
calendar.calendarRange.calendarRangeId = entity.calendarRange.id;
calendar.calendarRange.id = `range_${entity.calendarRange.id}`;
}
console.log('new calendar object ', calendar);
return calendar;
};
const createUserData = (user, colorIndex) => {

View File

@@ -37,7 +37,7 @@
<div class="duration">
<p>
<i class="fa fa-fw fa-hourglass-end"></i>
{{ calendar.endDate.diff(calendar.startDate)|date("%H:%M")}}
{{ calendar.duration|date('%H:%I')}}
</p>
</div>
{% endif %}
@@ -47,12 +47,6 @@
</div>
<div class="item-col">
<ul class="list-content">
{% if calendar.user %}
<li>
<b>{{ 'by'|trans }}{{ calendar.user.usernameCanonical }}</b>
</li>
{% endif %}
{% if calendar.mainUser is not empty %}
<li>
<b>{{ 'main user concerned'|trans }}: {{ calendar.mainUser.usernameCanonical }}</b>
@@ -93,7 +87,7 @@
<div class="item-row details">
<div class="item-col">
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
'context': accompanyingCourse,
'context': 'calendar_accompanyingCourse',
'render': 'row',
'entity': calendar
} %}