Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- calendar event columns to form store

## [11.0.0] - 2026-07-09

### Added
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/apps/form-store-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ export type FormStoreFilters = {
formsAppId?: {
$in: (number | null)[]
}
/** Filter results by the calendar event title */
calendarEvent?: {
/** Filter results by the calendar event title */
name?: FormStoreFilter<string>
/** Filter results by the calendar event date and time */
dateTime?: FormStoreFilter<string>
}
}

export type FormStoreParameters = {
Expand Down
99 changes: 99 additions & 0 deletions src/components/formStore/table/useFormStoreTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import { FormTypes, SubmissionTypes } from '@oneblink/types'
import { isValid } from 'date-fns'
import { formStoreService, localisationService } from '../../../apps'
import {
useReactTable,
Expand Down Expand Up @@ -492,6 +493,104 @@ export default function useFormStoreTable({
</>
),
},
{
id: 'CALENDAR_EVENT_TITLE',
header: 'Calendar Booking - Event Title',
meta: {
sorting: {
property: 'calendarEvent.name',
direction: parameters.sorting?.find(
({ property }) => property === 'calendarEvent.name',
)?.direction,
},
filter: {
type: 'TEXT',
value: parameters.filters?.calendarEvent?.name as
| { $regex: string }
| undefined,
onChange: (newValue) => {
onChangeParameters(
(currentParameters) => ({
...currentParameters,
filters: {
...currentParameters.filters,
calendarEvent: {
...currentParameters.filters?.calendarEvent,
name: newValue,
},
},
}),
true,
)
},
},
},
cell: ({ row: { original: formStoreRecord } }) => (
<>
{formStoreRecord.calendarEvent?.name}
{formStoreRecord.calendarEvent?.name && (
<TableCellCopyButton
text={formStoreRecord.calendarEvent?.name}
/>
)}
</>
),
},
{
id: 'CALENDAR_EVENT_DATE_TIME',
header: 'Calendar Booking - Event Date Time',
meta: {
sorting: {
property: 'calendarEvent.dateTime',
direction: parameters.sorting?.find(
({ property }) => property === 'calendarEvent.dateTime',
)?.direction,
},
filter: {
type: 'DATETIME',
value: parameters.filters?.calendarEvent?.dateTime as
| { $gte?: string; $lte?: string }
| undefined,
onChange: (newValue) => {
onChangeParameters(
(currentParameters) => ({
...currentParameters,
filters: {
...currentParameters.filters,
calendarEvent: {
...currentParameters.filters?.calendarEvent,
dateTime: newValue,
},
},
}),
false,
)
},
},
},

cell: ({ row: { original: formStoreRecord } }) => {
if (!formStoreRecord.calendarEvent?.dateTime) {
return null
}
const calendarEventDate = new Date(
formStoreRecord.calendarEvent?.dateTime,
)
if (!isValid(calendarEventDate)) {
return null
}
const text = format(
calendarEventDate,
localisationService.getDateFnsFormats().longDateTime,
)
return (
<>
{text}
<TableCellCopyButton text={text} />
</>
)
},
},
],
})
}, [
Expand Down
Loading