diff --git a/frontend/components/chat/patient-form-dialog.tsx b/frontend/components/chat/patient-form-dialog.tsx index 7c40b75..b5da5fd 100644 --- a/frontend/components/chat/patient-form-dialog.tsx +++ b/frontend/components/chat/patient-form-dialog.tsx @@ -23,6 +23,8 @@ import { DialogTitle, } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; +import { Tabs, TabsList, TabsTab } from "@/components/ui/tabs"; +import { PatientDetail } from "@/components/patients/patient-detail"; import { ROLE_LABELS } from "@/lib/access"; import { authClient } from "@/lib/auth-client"; import { cn } from "@/lib/utils"; @@ -239,6 +241,11 @@ export function PatientFormDialog({ isEdit && patient ? patient.fileNumber : generateFileNumber() ); const [step, setStep] = useState<"form" | "wallet">("form"); + // Editing an existing record shows Show/Add tabs: "Show" (default) is the + // read-only record; "Add" is the editable form with the Add buttons. Create + // and import-review keep the plain form (nothing to show yet). + const showTabs = isEdit && !isReview && Boolean(patient); + const [tab, setTab] = useState<"add" | "show">(showTabs ? "show" : "add"); // Only edits to an existing (non-review) record can sync to a wallet — a newly // created patient has no wallet, and review mode stages an import. @@ -453,10 +460,27 @@ export function PatientFormDialog({ /> ) : (
+ {showTabs && ( +
+ setTab(value as "add" | "show")} + value={tab} + > + + {t("patientForm.tabs.add")} + {t("patientForm.tabs.show")} + + +
+ )} + {showTabs && tab === "show" && patient ? ( + + ) : ( + <>
+ + )} @@ -787,17 +813,19 @@ export function PatientFormDialog({

{error}

)} }> - {t("patientForm.cancel")} + {tab === "show" ? t("patientForm.close") : t("patientForm.cancel")} - + {tab !== "show" && ( + + )}
)} diff --git a/frontend/lib/i18n/locales/ar/translation.json b/frontend/lib/i18n/locales/ar/translation.json index f172d94..c0486e9 100644 --- a/frontend/lib/i18n/locales/ar/translation.json +++ b/frontend/lib/i18n/locales/ar/translation.json @@ -1566,6 +1566,11 @@ "moreActions": "إجراءات إضافية" }, "patientForm": { + "close": "إغلاق", + "tabs": { + "add": "إضافة", + "show": "عرض" + }, "editTitle": "تعديل السجل", "createTitle": "إضافة مريض", "editDescription": "حدّث سجل {{name}} وأضف بيانات جديدة.", diff --git a/frontend/lib/i18n/locales/de/translation.json b/frontend/lib/i18n/locales/de/translation.json index 57b9782..31a5408 100644 --- a/frontend/lib/i18n/locales/de/translation.json +++ b/frontend/lib/i18n/locales/de/translation.json @@ -1546,6 +1546,11 @@ "moreActions": "Weitere Aktionen" }, "patientForm": { + "close": "Schließen", + "tabs": { + "add": "Hinzufügen", + "show": "Anzeigen" + }, "editTitle": "Datensatz bearbeiten", "createTitle": "Patient hinzufügen", "editDescription": "Aktualisieren Sie die Akte von {{name}} und fügen Sie neue Daten hinzu.", diff --git a/frontend/lib/i18n/locales/en/translation.json b/frontend/lib/i18n/locales/en/translation.json index 4c4c8fa..de46698 100644 --- a/frontend/lib/i18n/locales/en/translation.json +++ b/frontend/lib/i18n/locales/en/translation.json @@ -1546,6 +1546,11 @@ "moreActions": "More actions" }, "patientForm": { + "close": "Close", + "tabs": { + "add": "Add", + "show": "Show" + }, "editTitle": "Edit record", "createTitle": "Add patient", "editDescription": "Update {{name}}'s chart and add new data.", diff --git a/frontend/lib/i18n/locales/fr/translation.json b/frontend/lib/i18n/locales/fr/translation.json index 3761650..c52d11e 100644 --- a/frontend/lib/i18n/locales/fr/translation.json +++ b/frontend/lib/i18n/locales/fr/translation.json @@ -1546,6 +1546,11 @@ "moreActions": "Plus d’actions" }, "patientForm": { + "close": "Fermer", + "tabs": { + "add": "Ajouter", + "show": "Afficher" + }, "editTitle": "Modifier le dossier", "createTitle": "Ajouter un patient", "editDescription": "Mettez à jour le dossier de {{name}} et ajoutez de nouvelles données.", diff --git a/frontend/lib/i18n/locales/so/translation.json b/frontend/lib/i18n/locales/so/translation.json index c7b23ab..3110d4a 100644 --- a/frontend/lib/i18n/locales/so/translation.json +++ b/frontend/lib/i18n/locales/so/translation.json @@ -1546,6 +1546,11 @@ "moreActions": "Ficillo dheeraad ah" }, "patientForm": { + "close": "Xir", + "tabs": { + "add": "Ku dar", + "show": "Muuji" + }, "editTitle": "Wax ka beddel diiwaanka", "createTitle": "Ku dar bukaan", "editDescription": "Cusbooneysii diiwaanka {{name}} oo ku dar xog cusub.",