Missing
KPCKevin Powell - Community
•Created by Missing on 8/18/2023 in #front-end
Drag event
and also here
const handleDragLeave = (info: EventDragStopArg) => {
const calendarEl = calendarWrapRef.current;
if (
calendarEl &&
info.jsEvent.offsetX > calendarEl?.offsetLeft + calendarEl?.offsetWidth &&
info.jsEvent.offsetY > window.innerHeight * 0.7
) {
const result = eventData.filter(
(event) => event.id === Number(info.event.id)
);
setMovingEvent(result[0]);
}
};
const handleDragLeave = (info: EventDragStopArg) => {
const calendarEl = calendarWrapRef.current;
if (
calendarEl &&
info.jsEvent.offsetX > calendarEl?.offsetLeft + calendarEl?.offsetWidth &&
info.jsEvent.offsetY > window.innerHeight * 0.7
) {
const result = eventData.filter(
(event) => event.id === Number(info.event.id)
);
setMovingEvent(result[0]);
}
};
4 replies
KPCKevin Powell - Community
•Created by Missing on 8/18/2023 in #front-end
Drag event
else {
if (info.jsEvent.shiftKey) {
delete result.data?.id;
delete result.data?.eventId;
if (result.data?.reminders && result.data?.reminders.length > 0) {
result.data.reminders = result.data?.reminders?.map((reminder) => {
return {
...reminder,
id: 0,
};
});
}
await saveAgenda({
...result.data,
start: dayjs(info.event.start).format("YYYY-MM-DD HH:mm:ss"),
end: dayjs(info.event.end).format("YYYY-MM-DD HH:mm:ss"),
});
} else {
await saveAgenda({
...result.data,
start: dayjs(info.event.start).format("YYYY-MM-DD HH:mm:ss"),
end: dayjs(info.event.end).format("YYYY-MM-DD HH:mm:ss"),
});
}
await reload();
}
};
else {
if (info.jsEvent.shiftKey) {
delete result.data?.id;
delete result.data?.eventId;
if (result.data?.reminders && result.data?.reminders.length > 0) {
result.data.reminders = result.data?.reminders?.map((reminder) => {
return {
...reminder,
id: 0,
};
});
}
await saveAgenda({
...result.data,
start: dayjs(info.event.start).format("YYYY-MM-DD HH:mm:ss"),
end: dayjs(info.event.end).format("YYYY-MM-DD HH:mm:ss"),
});
} else {
await saveAgenda({
...result.data,
start: dayjs(info.event.start).format("YYYY-MM-DD HH:mm:ss"),
end: dayjs(info.event.end).format("YYYY-MM-DD HH:mm:ss"),
});
}
await reload();
}
};
4 replies
KPCKevin Powell - Community
•Created by Missing on 8/18/2023 in #front-end
Drag event
here is the function
const result = await getEvent(info.oldEvent.id);
if (
info.oldEvent._def.resourceIds &&
info.event._def.resourceIds &&
info.oldEvent._def.resourceIds[0] !== info.event._def.resourceIds[0]
) {
result.data.resourceId = Number(info.event._def.resourceIds[0]);
result.data.practitionerId = Number(info.event._def.resourceIds[0]);
if (result.data.resourceName) delete result.data.resourceName;
if (result.data.practitionerFirstname)
delete result.data.practitionerFirstname;
if (result.data.practitionerLastname) delete result.data.resourceName;
}
if (result.data?.rrule && Number(result.data?.hasRecurrEvents) === 1) {
setModalProp({
...modalProp,
show: true,
children: (
<ModalConfirm
eventChange={{
...result.data,
start: dayjs(info.event.start).format("YYYY-MM-DD HH:mm:ss"),
end: dayjs(info.event.end).format("YYYY-MM-DD HH:mm:ss"),
}}
setModalProp={setModalProp}
param={param}
setParam={setParam}
isAll={
info.event.start?.getDate() !== info.oldEvent.start?.getDate()
}
/>
),
});
}
const result = await getEvent(info.oldEvent.id);
if (
info.oldEvent._def.resourceIds &&
info.event._def.resourceIds &&
info.oldEvent._def.resourceIds[0] !== info.event._def.resourceIds[0]
) {
result.data.resourceId = Number(info.event._def.resourceIds[0]);
result.data.practitionerId = Number(info.event._def.resourceIds[0]);
if (result.data.resourceName) delete result.data.resourceName;
if (result.data.practitionerFirstname)
delete result.data.practitionerFirstname;
if (result.data.practitionerLastname) delete result.data.resourceName;
}
if (result.data?.rrule && Number(result.data?.hasRecurrEvents) === 1) {
setModalProp({
...modalProp,
show: true,
children: (
<ModalConfirm
eventChange={{
...result.data,
start: dayjs(info.event.start).format("YYYY-MM-DD HH:mm:ss"),
end: dayjs(info.event.end).format("YYYY-MM-DD HH:mm:ss"),
}}
setModalProp={setModalProp}
param={param}
setParam={setParam}
isAll={
info.event.start?.getDate() !== info.oldEvent.start?.getDate()
}
/>
),
});
}
4 replies
KPCKevin Powell - Community
•Created by Missing on 8/10/2023 in #front-end
change border color compatible with header background
it's big project so to hard to provide my code 😭 . So i think it's hard to find a solution
5 replies