mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-25 21:39:21 +00:00
Can remove events
This commit is contained in:
parent
f5557d81e0
commit
983f26fee5
@ -49,8 +49,8 @@ class GroupPresencePage {
|
||||
|
||||
presences.forEach((e) => e.end = addOneDay(e.date));
|
||||
|
||||
console.log(presences)
|
||||
|
||||
|
||||
// Merge contiguous presence days
|
||||
for(let i = 0; i < presences.length; i++) {
|
||||
while(true) {
|
||||
if (presences.length == i + 1)
|
||||
@ -88,7 +88,7 @@ class GroupPresencePage {
|
||||
}
|
||||
},
|
||||
|
||||
// Update events
|
||||
// Update events size
|
||||
eventResize: async function(info) {
|
||||
try {
|
||||
await ForezPresenceHelper.UpdateEvents(group.id, info.oldEvent.start, info.oldEvent.end, info.event.start, info.event.end)
|
||||
@ -97,6 +97,16 @@ class GroupPresencePage {
|
||||
notify(tr("Failed to update presence!"), "danger")
|
||||
}
|
||||
},
|
||||
|
||||
// Drag event
|
||||
eventDrop: async function(info) {
|
||||
try {
|
||||
await ForezPresenceHelper.UpdateEvents(group.id, info.oldEvent.start, info.oldEvent.end, info.event.start, info.event.end)
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
notify(tr("Failed to update presence!"), "danger")
|
||||
}
|
||||
},
|
||||
|
||||
// Add new event
|
||||
dateClick: async function(info) {
|
||||
@ -114,7 +124,25 @@ class GroupPresencePage {
|
||||
console.error(e);
|
||||
notify(tr("Failed to update presence!"), "danger")
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Delete event
|
||||
eventClick: async function(info) {
|
||||
if (lastClick == null || new Date().getTime() - lastClick.getTime() > 500)
|
||||
{
|
||||
lastClick = new Date()
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await ForezPresenceHelper.UpdateEvents(group.id, info.event.start, info.event.end, new Date(), new Date(new Date().getTime() - 1))
|
||||
|
||||
calendar.getEventSources()[0].refetch()
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
notify(tr("Failed to update presence!"), "danger")
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
calendar.render()
|
||||
|
@ -6,11 +6,9 @@
|
||||
<h3 class="box-title">tr("Presence in Forez")</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<p>tr("Double-click to add or remove days of presence")</p>
|
||||
|
||||
<div class="calendar"></div>
|
||||
|
||||
<p>tr("Tip: Double-click to add or remove days of presence")</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user