Skip to content

Commit 2480198

Browse files
committed
feat: allow dragging events in calendar
1 parent 6f7c876 commit 2480198

File tree

1 file changed

+5
-1
lines changed
  • apps/frontend/src/routes/_auth/questionnaire/_questionnaire/$id

1 file changed

+5
-1
lines changed

apps/frontend/src/routes/_auth/questionnaire/_questionnaire/$id/entries.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ function QuestionnaireEntries() {
7979
createMutation.mutate({ body: entryRequest }, { onSuccess: handleReset });
8080
};
8181

82-
const handleUpdate = (id: number, { carer, ...rest }: Partial<EntryFormValues>) => {
82+
const handleUpdate = (id: number, { carer, ...rest }: Partial<EntryFormValues>, weekday?: number) => {
8383
const entryRequest = {
8484
...rest,
8585
carer: carer!,
86+
weekday,
8687
questionnaire: questionnaire.id,
8788
};
8889

@@ -134,6 +135,9 @@ function QuestionnaireEntries() {
134135
eventResize={({ event: { id, start, end } }) => {
135136
handleUpdate(parseInt(id), { startedAt: getTime(start!), endedAt: getTime(end!) });
136137
}}
138+
eventDrop={({ event: { id, start, end } }) => {
139+
handleUpdate(parseInt(id), { startedAt: getTime(start!), endedAt: getTime(end!) }, start!.getDay());
140+
}}
137141
eventContent={({ event }) => <QuestionnaireEntry event={event} />}
138142
/>
139143
<Group>

0 commit comments

Comments
 (0)