@@ -8,7 +8,6 @@ import enLocale from "@fullcalendar/core/locales/en-gb";
88import frLocale from "@fullcalendar/core/locales/fr" ;
99import interactionPlugin , { type EventResizeDoneArg } from "@fullcalendar/interaction" ;
1010import resourceTimelinePlugin from "@fullcalendar/resource-timeline" ;
11-
1211import { paginated } from "#core:utils/api" ;
1312import { inheritHtmlElement , registerComponent } from "#core:utils/web-components" ;
1413import {
@@ -19,8 +18,6 @@ import {
1918 type SlotSchema ,
2019} from "#openapi" ;
2120import type { SlotSelectedEventArg } from "#reservation:reservation/types" ;
22- import interactionPlugin from "@fullcalendar/interaction" ;
23- import resourceTimelinePlugin from "@fullcalendar/resource-timeline" ;
2421
2522@registerComponent ( "room-scheduler" )
2623export class RoomScheduler extends inheritHtmlElement ( "div" ) {
@@ -76,17 +73,15 @@ export class RoomScheduler extends inheritHtmlElement("div") {
7673 * Send a request to the API to change
7774 * the start and the duration of a reservation slot
7875 */
79- async changeReservation ( args : EventDropArg ) {
80- const duration = new Date ( args . event . end . getTime ( ) - args . event . start . getTime ( ) ) ;
76+ async changeReservation ( args : EventDropArg | EventResizeDoneArg ) {
8177 const response = await reservationslotUpdateSlot ( {
8278 // biome-ignore lint/style/useNamingConvention: api is snake_case
8379 path : { slot_id : Number . parseInt ( args . event . id ) } ,
84- body : {
85- start_at : args . event . startStr ,
86- end_at : args . event . endStr ,
87- } ,
80+ // biome-ignore lint/style/useNamingConvention: api is snake_case
81+ body : { start_at : args . event . startStr , end_at : args . event . endStr } ,
8882 } ) ;
8983 if ( response . response . ok ) {
84+ document . dispatchEvent ( new CustomEvent ( "reservationSlotChanged" ) ) ;
9085 this . scheduler . refetchEvents ( ) ;
9186 }
9287 }
@@ -134,6 +129,7 @@ export class RoomScheduler extends inheritHtmlElement("div") {
134129 selectConstraint : { start : new Date ( ) } ,
135130 nowIndicator : true ,
136131 eventDrop : this . changeReservation ,
132+ eventResize : this . changeReservation ,
137133 } ) ;
138134 this . scheduler . render ( ) ;
139135 }
0 commit comments