adicionando-atualização-medicos #28
@ -177,7 +177,7 @@ export default function PacientesPage() {
|
|||||||
<PatientRegistrationForm
|
<PatientRegistrationForm
|
||||||
inline
|
inline
|
||||||
mode={editingId ? "edit" : "create"}
|
mode={editingId ? "edit" : "create"}
|
||||||
patientId={editingId ? Number(editingId) : null}
|
patientId={editingId}
|
||||||
onSaved={handleSaved}
|
onSaved={handleSaved}
|
||||||
onClose={() => setShowForm(false)}
|
onClose={() => setShowForm(false)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -37,7 +37,7 @@ type Mode = "create" | "edit";
|
|||||||
export interface PatientRegistrationFormProps {
|
export interface PatientRegistrationFormProps {
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
onOpenChange?: (open: boolean) => void;
|
onOpenChange?: (open: boolean) => void;
|
||||||
patientId?: number | null;
|
patientId?: string | number | null;
|
||||||
inline?: boolean;
|
inline?: boolean;
|
||||||
mode?: Mode;
|
mode?: Mode;
|
||||||
onSaved?: (paciente: Paciente) => void;
|
onSaved?: (paciente: Paciente) => void;
|
||||||
@ -112,7 +112,9 @@ export function PatientRegistrationForm({
|
|||||||
async function load() {
|
async function load() {
|
||||||
if (mode !== "edit" || patientId == null) return;
|
if (mode !== "edit" || patientId == null) return;
|
||||||
try {
|
try {
|
||||||
|
console.log("[PatientForm] Carregando paciente ID:", patientId);
|
||||||
const p = await buscarPacientePorId(String(patientId));
|
const p = await buscarPacientePorId(String(patientId));
|
||||||
|
console.log("[PatientForm] Dados recebidos:", p);
|
||||||
setForm((s) => ({
|
setForm((s) => ({
|
||||||
...s,
|
...s,
|
||||||
nome: p.full_name || "", // 👈 trocar nome → full_name
|
nome: p.full_name || "", // 👈 trocar nome → full_name
|
||||||
@ -133,13 +135,10 @@ export function PatientRegistrationForm({
|
|||||||
observacoes: p.notes || "",
|
observacoes: p.notes || "",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ax = await listarAnexos(String(patientId)).catch(() => []);
|
const ax = await listarAnexos(String(patientId)).catch(() => []);
|
||||||
setServerAnexos(Array.isArray(ax) ? ax : []);
|
setServerAnexos(Array.isArray(ax) ? ax : []);
|
||||||
} catch {
|
} catch (err) {
|
||||||
|
console.error("[PatientForm] Erro ao carregar paciente:", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
load();
|
load();
|
||||||
|
|||||||
3
susconecta/next-env.d.ts
vendored
3
susconecta/next-env.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
/// <reference path="./.next/types/routes.d.ts" />
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user