From ca4ea87d37b2f573c24de26d54f0225ed1394d48 Mon Sep 17 00:00:00 2001 From: kovakmedya Date: Thu, 21 May 2026 23:01:52 +0300 Subject: [PATCH] feat(patients): drop phone/dateOfBirth, name fields optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduced the patient record to the minimum a dental clinic actually needs: just a code, optional first/last name and free-text notes. Phone and date-of-birth fields are gone from the UI everywhere — Add form, edit dialog inside the table, the Bağlantı Bilgileri block on job detail, and the table column list. The patient list now surfaces 'Notlar' instead. Backend - DB: firstName and lastName columns set to required=false via Appwrite MCP (tables_db_update_string_column). Existing rows untouched. - schema.ts Patient interface: firstName/lastName now optional, phone and dateOfBirth removed from the type entirely. The underlying columns are still in the DB so legacy rows aren't broken — we just stop referencing them in code. - validation/patient.ts: firstName/lastName drop min(1), phone and dob fields removed. - patient-actions.ts: pickFields no longer reads phone/dob, create and update payloads no longer write them. UI fallbacks - PatientsTable: header has 'Notlar' instead of Telefon/Doğum. Ad Soyad cell shows the joined name or em-dash. Edit dialog mirrors the same simplified form. - jobs/[jobId] detail page: when patient row has neither name, the page title falls back to 'Hasta {patientCode}' (same as before for jobs without a linked patient). The Hasta Bilgileri card now shows Ad Soyad and Patient Code side by side, with notes spanning both columns. --- src/app/(dashboard)/jobs/[jobId]/page.tsx | 20 ++++---- .../patients/components/patient-form.tsx | 26 ++-------- .../patients/components/patients-table.tsx | 47 ++++--------------- src/lib/appwrite/patient-actions.ts | 6 --- src/lib/appwrite/schema.ts | 6 +-- src/lib/validation/patient.ts | 11 ++--- 6 files changed, 32 insertions(+), 84 deletions(-) diff --git a/src/app/(dashboard)/jobs/[jobId]/page.tsx b/src/app/(dashboard)/jobs/[jobId]/page.tsx index d7cd44c..717f838 100644 --- a/src/app/(dashboard)/jobs/[jobId]/page.tsx +++ b/src/app/(dashboard)/jobs/[jobId]/page.tsx @@ -100,10 +100,13 @@ export default async function JobDetailPage({ {counterpartLabel}: {counterpart?.companyName ?? "—"}

- {patient ? `${patient.firstName} ${patient.lastName}` : `Hasta ${job.patientCode}`} + {(() => { + const name = [patient?.firstName, patient?.lastName].filter(Boolean).join(" "); + return name || `Hasta ${job.patientCode}`; + })()}

- {patient && ( + {patient && (patient.firstName || patient.lastName) && ( <> {job.patientCode} ·{" "} @@ -211,18 +214,15 @@ export default async function JobDetailPage({ dışında bir veri görmez. - + - {patient.firstName} {patient.lastName} + {[patient.firstName, patient.lastName].filter(Boolean).join(" ") || "—"} - {patient.phone || "—"} - - {patient.dateOfBirth - ? dateFormatter.format(new Date(patient.dateOfBirth)) - : "—"} + + {patient.patientCode} {patient.notes && ( -

+

Notlar

diff --git a/src/app/(dashboard)/patients/components/patient-form.tsx b/src/app/(dashboard)/patients/components/patient-form.tsx index 79ea77c..b08df4b 100644 --- a/src/app/(dashboard)/patients/components/patient-form.tsx +++ b/src/app/(dashboard)/patients/components/patient-form.tsx @@ -8,6 +8,7 @@ import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; + import { createPatientAction } from "@/lib/appwrite/patient-actions"; import { initialPatientFormState } from "@/lib/appwrite/patient-types"; @@ -48,38 +49,21 @@ export function PatientForm() {
- - + + {state.fieldErrors?.firstName && (

{state.fieldErrors.firstName}

)}
- - + + {state.fieldErrors?.lastName && (

{state.fieldErrors.lastName}

)}
-
- - -
- -
- - -
-