feat(bookings): implement Booking UID filter for bookings data table. (#21380)
Fixes: #21357
This commit is contained in:
@@ -115,6 +115,7 @@ function BookingsContent({ status }: BookingsProps) {
|
||||
const dateRange = useFilterValue("dateRange", ZDateRangeFilterValue)?.data;
|
||||
const attendeeName = useFilterValue("attendeeName", ZTextFilterValue);
|
||||
const attendeeEmail = useFilterValue("attendeeEmail", ZTextFilterValue);
|
||||
const bookingUid = useFilterValue("bookingUid", ZTextFilterValue)?.data?.operand as string | undefined;
|
||||
|
||||
const { limit, offset } = useDataTable();
|
||||
|
||||
@@ -128,6 +129,7 @@ function BookingsContent({ status }: BookingsProps) {
|
||||
userIds,
|
||||
attendeeName,
|
||||
attendeeEmail,
|
||||
bookingUid,
|
||||
afterStartDate: dateRange?.startDate
|
||||
? dayjs(dateRange?.startDate).startOf("day").toISOString()
|
||||
: undefined,
|
||||
@@ -214,6 +216,21 @@ function BookingsContent({ status }: BookingsProps) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
columnHelper.accessor((row) => row.type === "data" && row.booking.uid, {
|
||||
id: "bookingUid",
|
||||
header: t("booking_uid"),
|
||||
enableColumnFilter: true,
|
||||
enableSorting: false,
|
||||
cell: () => null,
|
||||
meta: {
|
||||
filter: {
|
||||
type: ColumnFilterType.TEXT,
|
||||
textOptions: {
|
||||
allowedOperators: ["equals"],
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
columnHelper.display({
|
||||
id: "customView",
|
||||
cell: (props) => {
|
||||
@@ -336,6 +353,7 @@ function BookingsContent({ status }: BookingsProps) {
|
||||
attendeeName: false,
|
||||
attendeeEmail: false,
|
||||
dateRange: false,
|
||||
bookingUid: false,
|
||||
},
|
||||
},
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
|
||||
@@ -1779,6 +1779,7 @@
|
||||
"number_sms_notifications": "Phone number (SMS notifications)",
|
||||
"attendee_email_variable": "Attendee email",
|
||||
"attendee_email_info": "The person booking's email",
|
||||
"booking_uid": "Booking UID",
|
||||
"kbar_search_placeholder": "Type a command or search...",
|
||||
"invalid_credential": "It looks like permissions expired or were revoked for {{appName}}.",
|
||||
"invalid_credential_action": "Reinstall app",
|
||||
|
||||
@@ -28,6 +28,7 @@ type GetOptions = {
|
||||
eventTypeIds?: number[] | undefined;
|
||||
attendeeEmail?: string | TextFilterValue;
|
||||
attendeeName?: string | TextFilterValue;
|
||||
bookingUid?: string | undefined;
|
||||
};
|
||||
sort?: SortOptions;
|
||||
};
|
||||
|
||||
@@ -81,6 +81,16 @@ export class GetBookingsInput_2024_08_13 {
|
||||
})
|
||||
attendeeName?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
required: false,
|
||||
description: "Filter bookings by the booking Uid.",
|
||||
example: "2NtaeaVcKfpmSZ4CthFdfk",
|
||||
})
|
||||
bookingUid?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => {
|
||||
if (typeof value === "string") {
|
||||
|
||||
@@ -355,7 +355,12 @@ export async function getBookings({
|
||||
}
|
||||
}
|
||||
|
||||
// 6. Booking Start/End Time Range Filters
|
||||
// 6. Filter by Booking Uid (if provided)
|
||||
if (filters?.bookingUid) {
|
||||
fullQuery = fullQuery.where("Booking.uid", "=", filters.bookingUid.trim());
|
||||
}
|
||||
|
||||
// 7. Booking Start/End Time Range Filters
|
||||
if (filters?.afterStartDate) {
|
||||
fullQuery = fullQuery.where("Booking.startTime", ">=", dayjs.utc(filters.afterStartDate).toDate());
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ export const ZGetInputSchema = z.object({
|
||||
eventTypeIds: z.number().array().optional(),
|
||||
attendeeEmail: z.union([z.string(), ZTextFilterValue]).optional(),
|
||||
attendeeName: z.union([z.string(), ZTextFilterValue]).optional(),
|
||||
bookingUid: z.string().optional(),
|
||||
afterStartDate: z.string().optional(),
|
||||
beforeEndDate: z.string().optional(),
|
||||
afterUpdatedDate: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user