develop #83
@ -423,7 +423,8 @@ export default function ConsultasPage() {
|
|||||||
<p className="text-muted-foreground">Visualize, filtre e gerencie todas as consultas da clínica.</p>
|
<p className="text-muted-foreground">Visualize, filtre e gerencie todas as consultas da clínica.</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Link href="/agenda">
|
{/* Pass origin so the Agenda page can return to Consultas when cancelling */}
|
||||||
|
<Link href="/agenda?origin=consultas">
|
||||||
<Button size="sm" className="h-8 gap-1 bg-blue-600">
|
<Button size="sm" className="h-8 gap-1 bg-blue-600">
|
||||||
<PlusCircle className="h-3.5 w-3.5" />
|
<PlusCircle className="h-3.5 w-3.5" />
|
||||||
<span className="sr-only sm:not-sr-only sm:whitespace-nowrap">Agendar Nova Consulta</span>
|
<span className="sr-only sm:not-sr-only sm:whitespace-nowrap">Agendar Nova Consulta</span>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import { CalendarRegistrationForm } from "@/components/forms/calendar-registration-form";
|
import { CalendarRegistrationForm } from "@/components/forms/calendar-registration-form";
|
||||||
import HeaderAgenda from "@/components/agenda/HeaderAgenda";
|
import HeaderAgenda from "@/components/agenda/HeaderAgenda";
|
||||||
import FooterAgenda from "@/components/agenda/FooterAgenda";
|
import FooterAgenda from "@/components/agenda/FooterAgenda";
|
||||||
@ -10,6 +10,8 @@ import { toast } from '@/hooks/use-toast';
|
|||||||
|
|
||||||
interface FormData {
|
interface FormData {
|
||||||
patientName?: string;
|
patientName?: string;
|
||||||
|
patientId?: string;
|
||||||
|
doctorId?: string;
|
||||||
cpf?: string;
|
cpf?: string;
|
||||||
rg?: string;
|
rg?: string;
|
||||||
birthDate?: string;
|
birthDate?: string;
|
||||||
@ -28,10 +30,15 @@ interface FormData {
|
|||||||
requestingProfessional?: string;
|
requestingProfessional?: string;
|
||||||
appointmentType?: string;
|
appointmentType?: string;
|
||||||
notes?: string;
|
notes?: string;
|
||||||
|
duration_minutes?: number;
|
||||||
|
chief_complaint?: string | null;
|
||||||
|
patient_notes?: string | null;
|
||||||
|
insurance_provider?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function NovoAgendamentoPage() {
|
export default function NovoAgendamentoPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
const [formData, setFormData] = useState<FormData>({});
|
const [formData, setFormData] = useState<FormData>({});
|
||||||
|
|
||||||
const handleFormChange = (data: FormData) => {
|
const handleFormChange = (data: FormData) => {
|
||||||
@ -69,6 +76,16 @@ export default function NovoAgendamentoPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
|
// If origin was provided (eg: consultas), return there. Default to calendar.
|
||||||
|
try {
|
||||||
|
const origin = searchParams?.get?.('origin');
|
||||||
|
if (origin === 'consultas') {
|
||||||
|
router.push('/consultas');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// fallback
|
||||||
|
}
|
||||||
router.push("/calendar");
|
router.push("/calendar");
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -77,8 +94,8 @@ export default function NovoAgendamentoPage() {
|
|||||||
<HeaderAgenda />
|
<HeaderAgenda />
|
||||||
<main className="flex-1 mx-auto w-full max-w-7xl px-8 py-8">
|
<main className="flex-1 mx-auto w-full max-w-7xl px-8 py-8">
|
||||||
<CalendarRegistrationForm
|
<CalendarRegistrationForm
|
||||||
formData={formData}
|
formData={formData as any}
|
||||||
onFormChange={handleFormChange}
|
onFormChange={handleFormChange as any}
|
||||||
createMode
|
createMode
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user