From dbd8391f2cc377688b27c014f339cf8b982709e5 Mon Sep 17 00:00:00 2001 From: saridsa2 Date: Tue, 24 Mar 2026 10:54:56 +0530 Subject: [PATCH] fix: UUID type mismatch, slot conflict, appt/enquiry tabs, dialler in header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed $id: ID! to $id: UUID! in all update mutations (4 files) - Removed redundant slot availability check (UI already disables booked slots) - Book Appt and Enquiry act as toggle tabs — one closes the other - Dialler moved from FAB to header dropdown next to status toggle Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/call-desk/active-call-card.tsx | 8 +- src/components/call-desk/appointment-form.tsx | 22 +--- src/components/call-desk/call-widget.tsx | 2 +- .../campaigns/campaign-edit-slideout.tsx | 2 +- src/pages/call-desk.tsx | 117 ++++++++---------- 5 files changed, 64 insertions(+), 87 deletions(-) diff --git a/src/components/call-desk/active-call-card.tsx b/src/components/call-desk/active-call-card.tsx index 8d6b39f..597731e 100644 --- a/src/components/call-desk/active-call-card.tsx +++ b/src/components/call-desk/active-call-card.tsx @@ -272,12 +272,12 @@ export const ActiveCallCard = ({ lead, callerPhone, missedCallId, onCallComplete
{/* Text+Icon primary actions */} - - + + onClick={() => { setEnquiryOpen(!enquiryOpen); setAppointmentOpen(false); }}>Enquiry diff --git a/src/components/call-desk/appointment-form.tsx b/src/components/call-desk/appointment-form.tsx index 2263032..af09eb6 100644 --- a/src/components/call-desk/appointment-form.tsx +++ b/src/components/call-desk/appointment-form.tsx @@ -208,7 +208,7 @@ export const AppointmentForm = ({ if (isEditMode && existingAppointment) { // Update existing appointment await apiClient.graphql( - `mutation UpdateAppointment($id: ID!, $data: AppointmentUpdateInput!) { + `mutation UpdateAppointment($id: UUID!, $data: AppointmentUpdateInput!) { updateAppointment(id: $id, data: $data) { id } }`, { @@ -224,22 +224,6 @@ export const AppointmentForm = ({ ); notify.success('Appointment Updated'); } else { - // Double-check slot availability before booking - const checkResult = await apiClient.graphql<{ appointments: { edges: Array<{ node: { status: string } }> } }>( - `{ appointments(filter: { - doctorId: { eq: "${doctor}" }, - scheduledAt: { gte: "${date}T${timeSlot}:00", lte: "${date}T${timeSlot}:00" } - }) { edges { node { status } } } }`, - ); - const activeBookings = checkResult.appointments.edges.filter(e => - e.node.status !== 'CANCELLED' && e.node.status !== 'NO_SHOW', - ); - if (activeBookings.length > 0) { - setError('This slot was just booked by someone else. Please select a different time.'); - setIsSaving(false); - return; - } - // Create appointment await apiClient.graphql( `mutation CreateAppointment($data: AppointmentCreateInput!) { @@ -263,7 +247,7 @@ export const AppointmentForm = ({ // Update lead status if we have a matched lead if (leadId) { await apiClient.graphql( - `mutation UpdateLead($id: ID!, $data: LeadUpdateInput!) { + `mutation UpdateLead($id: UUID!, $data: LeadUpdateInput!) { updateLead(id: $id, data: $data) { id } }`, { @@ -291,7 +275,7 @@ export const AppointmentForm = ({ setIsSaving(true); try { await apiClient.graphql( - `mutation CancelAppointment($id: ID!, $data: AppointmentUpdateInput!) { + `mutation CancelAppointment($id: UUID!, $data: AppointmentUpdateInput!) { updateAppointment(id: $id, data: $data) { id } }`, { diff --git a/src/components/call-desk/call-widget.tsx b/src/components/call-desk/call-widget.tsx index 944864c..f46ca44 100644 --- a/src/components/call-desk/call-widget.tsx +++ b/src/components/call-desk/call-widget.tsx @@ -223,7 +223,7 @@ export const CallWidget = () => { const newStatus = statusMap[disposition]; if (newStatus) { await apiClient.graphql( - `mutation UpdateLead($id: ID!, $data: LeadUpdateInput!) { + `mutation UpdateLead($id: UUID!, $data: LeadUpdateInput!) { updateLead(id: $id, data: $data) { id } }`, { diff --git a/src/components/campaigns/campaign-edit-slideout.tsx b/src/components/campaigns/campaign-edit-slideout.tsx index 00be675..1b2968b 100644 --- a/src/components/campaigns/campaign-edit-slideout.tsx +++ b/src/components/campaigns/campaign-edit-slideout.tsx @@ -53,7 +53,7 @@ export const CampaignEditSlideout = ({ isOpen, onOpenChange, campaign, onSaved } const budgetMicros = budget ? Number(budget) * 1_000_000 : null; await apiClient.graphql( - `mutation UpdateCampaign($id: ID!, $data: CampaignUpdateInput!) { + `mutation UpdateCampaign($id: UUID!, $data: CampaignUpdateInput!) { updateCampaign(id: $id, data: $data) { id } }`, { diff --git a/src/pages/call-desk.tsx b/src/pages/call-desk.tsx index 04192bb..41b2cd8 100644 --- a/src/pages/call-desk.tsx +++ b/src/pages/call-desk.tsx @@ -72,6 +72,61 @@ export const CallDeskPage = () => {
+ {!isInCall && ( +
+ + {diallerOpen && ( +
+
+ Dial + +
+
+ + {dialNumber || Enter number} + + {dialNumber && ( + + )} +
+
+ {['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'].map(key => ( + + ))} +
+ +
+ )} +
+ )} {totalPending > 0 && ( {totalPending} pending @@ -127,68 +182,6 @@ export const CallDeskPage = () => {
- {/* Dialler FAB */} - {!isInCall && ( -
- {diallerOpen && ( -
-
- Dial - -
- - {/* Number display */} -
- - {dialNumber || Enter number} - - {dialNumber && ( - - )} -
- - {/* Numpad */} -
- {['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'].map(key => ( - - ))} -
- - {/* Call button */} - -
- )} - -
- )} ); };