@@ -251,32 +251,6 @@ const timeSlotsForGrid = computed(() => {
251251 return slots ;
252252});
253253
254- /**
255- * Generates an array of remote events that fall within the active week with grid positioning info
256- * Note we are still fetching monthly events to reduce the roundtrips
257- */
258- const filteredRemoteEventsForGrid = computed (() => {
259- const slots = timeSlotsForGrid .value ;
260- if (! slots .length ) return [];
261-
262- const { start, end } = props .activeDateRange ;
263- const remoteEventsWithinActiveWeek = props .events .filter ((remoteEvent ) => dj (remoteEvent .start ).isBetween (start , end ))
264-
265- return remoteEventsWithinActiveWeek .map (remoteEvent => {
266- const eventStart = dj (remoteEvent .start );
267- const eventEnd = dj (remoteEvent .end );
268-
269- const gridPosition = calculateEventGridPosition (eventStart , eventEnd , slots );
270-
271- if (gridPosition ) {
272- return {
273- ... remoteEvent ,
274- ... gridPosition ,
275- };
276- }
277- }).filter (Boolean )
278- });
279-
280254/**
281255 * Generates an array of pending appointments that fall within the active week with grid positioning info
282256 */
@@ -312,6 +286,37 @@ const filteredPendingAppointmentsForGrid = computed(() => {
312286 }).filter (Boolean )
313287});
314288
289+ /**
290+ * Generates an array of remote events that fall within the active week with grid positioning info
291+ * Note we are still fetching monthly events to reduce the roundtrips
292+ */
293+ const filteredRemoteEventsForGrid = computed (() => {
294+ const slots = timeSlotsForGrid .value ;
295+ if (! slots .length ) return [];
296+
297+ const { start, end } = props .activeDateRange ;
298+ const remoteEventsWithinActiveWeek = props .events .filter ((remoteEvent ) => dj (remoteEvent .start ).isBetween (start , end ))
299+
300+ return remoteEventsWithinActiveWeek .map (remoteEvent => {
301+ const eventStart = dj (remoteEvent .start );
302+ const eventEnd = dj (remoteEvent .end );
303+
304+ const gridPosition = calculateEventGridPosition (eventStart , eventEnd , slots );
305+ const hasPendingPlaceholder = filteredPendingAppointmentsForGrid .value .find (
306+ (a ) => a .title === remoteEvent .title && eventStart .isSame (a .start )
307+ );
308+
309+ // Only show remote event, if we have a valid grid position and if we don't already have calculated
310+ // a placeholder for a pending (HOLD) event
311+ if (gridPosition && ! hasPendingPlaceholder ) {
312+ return {
313+ ... remoteEvent ,
314+ ... gridPosition ,
315+ };
316+ }
317+ }).filter (Boolean );
318+ });
319+
315320/**
316321 * Generates an array of selectable time slots that fall within the active week with grid positioning info
317322 */
0 commit comments