mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-05-18 20:08:19 +00:00
fix: QA defects — phone format E.164, call history shows phone not Unknown
- appointment-form: normalize phone to +91XXXXXXXXXX before patient create - appointment-form: use empty string not 'Unknown' for name fallback - call-history: show formatted phone number instead of 'Unknown' when no lead Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -264,13 +264,16 @@ export const AppointmentForm = ({
|
||||
if (!resolvedPatientId && callerNumber) {
|
||||
const trimmedName = patientName.trim();
|
||||
const nameParts = {
|
||||
firstName: trimmedName.split(' ')[0] || 'Unknown',
|
||||
firstName: trimmedName.split(' ')[0] || '',
|
||||
lastName: trimmedName.split(' ').slice(1).join(' ') || '',
|
||||
};
|
||||
// Normalize phone to +91XXXXXXXXXX format
|
||||
const phoneDigits = callerNumber.replace(/\D/g, '').slice(-10);
|
||||
const phoneE164 = `+91${phoneDigits}`;
|
||||
try {
|
||||
const created = await apiClient.graphql<{ createPatient: { id: string } }>(
|
||||
`mutation($data: PatientCreateInput!) { createPatient(data: $data) { id } }`,
|
||||
{ data: { fullName: nameParts, phones: { primaryPhoneNumber: callerNumber }, patientType: 'NEW' } },
|
||||
{ data: { fullName: nameParts, phones: { primaryPhoneNumber: phoneE164 }, patientType: 'NEW' } },
|
||||
);
|
||||
resolvedPatientId = created.createPatient.id;
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user