diff --git a/src/app/(admin)/admin/contact-records/components/EditContactRecord.tsx b/src/app/(admin)/admin/contact-records/components/EditContactRecord.tsx index 8a77a39..d82e2b5 100644 --- a/src/app/(admin)/admin/contact-records/components/EditContactRecord.tsx +++ b/src/app/(admin)/admin/contact-records/components/EditContactRecord.tsx @@ -3,6 +3,7 @@ import { useState, useEffect, FormEvent, ChangeEvent } from 'react'; import { useRouter } from 'next/navigation'; import Link from 'next/link'; +import { CONTACT_TYPES } from '@/lib/constants'; interface ContactRecord { id: string; @@ -125,7 +126,7 @@ export default function EditContactRecord({ id }: EditContactRecordProps) { return (
-

Edit Contact Record

+

Edit Contact Record

{error && ( -
+
- +
-

{error}

+

{error}

)} -
+
-
-
+
+
+ + +
diff --git a/src/app/api/contact-records/route.ts b/src/app/api/contact-records/route.ts index 735c3a6..fa7abfe 100644 --- a/src/app/api/contact-records/route.ts +++ b/src/app/api/contact-records/route.ts @@ -10,6 +10,7 @@ export async function GET(request: NextRequest) { // Get query parameters const url = new URL(request.url); const customerId = url.searchParams.get('customerId'); + const contactType = url.searchParams.get('contactType'); const dateFrom = url.searchParams.get('dateFrom'); const dateTo = url.searchParams.get('dateTo'); @@ -27,6 +28,11 @@ export async function GET(request: NextRequest) { whereClause.customerId = customerId; } + // Filter by contact type if provided + if (contactType) { + whereClause.contactType = contactType; + } + // Filter by date range if provided if (dateFrom || dateTo) { whereClause.createdAt = {}; diff --git a/src/lib/constants.ts b/src/lib/constants.ts new file mode 100644 index 0000000..6708ba0 --- /dev/null +++ b/src/lib/constants.ts @@ -0,0 +1,9 @@ +// Contact record types +export const CONTACT_TYPES = [ + { value: 'Email', label: 'Email' }, + { value: 'EmailSent', label: 'Email sent' }, + { value: 'EmailReceived', label: 'Email received' }, + { value: 'Phone', label: 'Phone' }, + { value: 'Meeting', label: 'Meeting' }, + { value: 'Other', label: 'Other' } +];