diff --git a/src/components/ComponentCadastroRapido.vue b/src/components/ComponentCadastroRapido.vue
index db29c5f..02fa936 100644
--- a/src/components/ComponentCadastroRapido.vue
+++ b/src/components/ComponentCadastroRapido.vue
@@ -197,8 +197,17 @@ function generateUser() {
});
}
-function patientsListRoute() {
+// Rota de destino do "Salvar e ver paciente". Em melissa, prefere a
+// view individual do paciente recém-criado (id vem de data.id no
+// emit('created')); fallback pra lista.
+function patientViewRoute(patientId) {
const p = String(route.path || '');
+ if (p.startsWith('/melissa') && patientId) {
+ return { path: '/melissa/paciente', query: { id: String(patientId) } };
+ }
+ if (p.startsWith('/melissa')) {
+ return '/melissa/pacientes';
+ }
return p.startsWith('/therapist') ? '/therapist/patients' : '/admin/pacientes';
}
@@ -252,7 +261,10 @@ async function submit(mode = 'only') {
emit('created', data);
if (props.closeOnCreated) close();
- if (mode === 'view') await router.push(patientsListRoute());
+ if (mode === 'view') {
+ const pid = data?.id || null;
+ await router.push(patientViewRoute(pid));
+ }
} catch (err) {
const msg = err?.message || err?.details || 'Não foi possível criar o paciente.';
errorMsg.value = msg;
@@ -334,10 +346,10 @@ async function submit(mode = 'only') {
-
+
-
+
diff --git a/src/components/ui/PatientCadastroDialog.vue b/src/components/ui/PatientCadastroDialog.vue
index 6f99c1e..e430ba2 100644
--- a/src/components/ui/PatientCadastroDialog.vue
+++ b/src/components/ui/PatientCadastroDialog.vue
@@ -65,11 +65,22 @@ const router = useRouter();
const isOnPatientsPage = computed(() => {
const p = String(route.path || '');
- return p.includes('/patients') || p.includes('/pacientes');
+ // /melissa/paciente (singular — prontuário) é página de paciente.
+ // /melissa/pacientes (plural — lista) também.
+ return p.includes('/patients') || p.includes('/pacientes') || p.startsWith('/melissa/paciente');
});
-function patientsListRoute() {
+// Rota de destino quando o usuário pede "Salvar e ver paciente":
+// — no Melissa, abre o prontuário do paciente (singular, via query id)
+// — no Therapist/Admin, volta pra lista (não há rota dedicada de view).
+function patientViewRoute(patientId) {
const p = String(route.path || '');
+ if (p.startsWith('/melissa') && patientId) {
+ return { path: '/melissa/paciente', query: { id: String(patientId) } };
+ }
+ if (p.startsWith('/melissa')) {
+ return '/melissa/pacientes';
+ }
return p.startsWith('/therapist') ? '/therapist/patients' : '/admin/pacientes';
}
@@ -82,7 +93,9 @@ async function onCreated(data) {
isOpen.value = false;
emit('created', data);
if (pendingMode.value === 'view') {
- await router.push(patientsListRoute());
+ // data.id vem do PatientsCadastroPage (criação ou edição)
+ const pid = data?.id || props.patientId || null;
+ await router.push(patientViewRoute(pid));
}
}
@@ -197,10 +210,10 @@ async function onCreated(data) {
-
+
-
+