handel concurrency clash on an already clashed event (#6)
This commit is contained in:
parent
1645927f40
commit
c9b3075d19
33
main.js
33
main.js
@ -643,6 +643,7 @@ class CalendarView extends ItemView
|
|||||||
|
|
||||||
// check for concurrent events
|
// check for concurrent events
|
||||||
let classes = "frcal__event";
|
let classes = "frcal__event";
|
||||||
|
let concurrentClash = "";
|
||||||
for (let i in container.children)
|
for (let i in container.children)
|
||||||
{
|
{
|
||||||
let child = container.children[i];
|
let child = container.children[i];
|
||||||
@ -653,15 +654,35 @@ class CalendarView extends ItemView
|
|||||||
&& (time[0] < parseInt(child.dataset.end))
|
&& (time[0] < parseInt(child.dataset.end))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (time[0] < parseInt(child.dataset.start))
|
if (child.dataset.concurrentClash != "")
|
||||||
{
|
{
|
||||||
classes += " frcal__event_concurrent1";
|
let third = document.getElementById("fr_event_" + child.dataset.concurrentClash);
|
||||||
child.addClass("frcal__event_concurrent2");
|
if (
|
||||||
|
(time[1] > parseInt(third.dataset.start))
|
||||||
|
&& (time[0] < parseInt(third.dataset.end))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
console.warn("triple concurrent clashes are not suported with " + event.id + ", " + child.dataset.id + " and " + child.dataset.concurrentClash);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
classes += (child.hasClass("frcal__event_concurrent2")) ? " frcal__event_concurrent1" : " frcal__event_concurrent2";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child.addClass("frcal__event_concurrent1");
|
if (time[0] < parseInt(child.dataset.start))
|
||||||
classes += " frcal__event_concurrent2";
|
{
|
||||||
|
classes += " frcal__event_concurrent1";
|
||||||
|
child.addClass("frcal__event_concurrent2");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
child.addClass("frcal__event_concurrent1");
|
||||||
|
classes += " frcal__event_concurrent2";
|
||||||
|
}
|
||||||
|
child.dataset.concurrentClash = event.id;
|
||||||
|
concurrentClash = child.dataset.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -671,11 +692,13 @@ class CalendarView extends ItemView
|
|||||||
cls: classes,
|
cls: classes,
|
||||||
attr: {
|
attr: {
|
||||||
'id': "fr_event_" + event.id,
|
'id': "fr_event_" + event.id,
|
||||||
|
'data-id': event.id,
|
||||||
'data-group': event.group,
|
'data-group': event.group,
|
||||||
'data-state': event.state,
|
'data-state': event.state,
|
||||||
'data-type': event.type,
|
'data-type': event.type,
|
||||||
'data-start': time[0].toString(),
|
'data-start': time[0].toString(),
|
||||||
'data-end': time[1].toString(),
|
'data-end': time[1].toString(),
|
||||||
|
'data-concurrent-clash': concurrentClash,
|
||||||
'style': ((allDay) ? '' : 'top:' + (time[0]*this.zoom).toString() + 'px')
|
'style': ((allDay) ? '' : 'top:' + (time[0]*this.zoom).toString() + 'px')
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user