Remove ListaEspera e botões Procedimento/Financeiro
This commit is contained in:
parent
3022cbfc4b
commit
2729fdc868
@ -2,37 +2,19 @@
|
||||
|
||||
// Imports mantidos
|
||||
import { useEffect, useState } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import Link from "next/link";
|
||||
|
||||
// --- Imports do EventManager (NOVO) - MANTIDOS ---
|
||||
import { EventManager, type Event } from "@/components/features/general/event-manager";
|
||||
import { v4 as uuidv4 } from 'uuid'; // Usado para IDs de fallback
|
||||
|
||||
// Imports mantidos
|
||||
import { Sidebar } from "@/components/layout/sidebar";
|
||||
import { PagesHeader } from "@/components/features/dashboard/header";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { mockWaitingList } from "@/lib/mocks/appointment-mocks";
|
||||
import "./index.css";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { ThreeDWallCalendar, CalendarEvent } from "@/components/ui/three-dwall-calendar"; // Calendário 3D mantido
|
||||
|
||||
const ListaEspera = dynamic(
|
||||
() => import("@/components/features/agendamento/ListaEspera"),
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
export default function AgendamentoPage() {
|
||||
const [appointments, setAppointments] = useState<any[]>([]);
|
||||
const [waitingList, setWaitingList] = useState(mockWaitingList);
|
||||
const [activeTab, setActiveTab] = useState<"calendar" | "espera" | "3d">("calendar");
|
||||
|
||||
const [activeTab, setActiveTab] = useState<"calendar" | "3d">("calendar");
|
||||
const [threeDEvents, setThreeDEvents] = useState<CalendarEvent[]>([]);
|
||||
|
||||
// --- NOVO ESTADO ---
|
||||
@ -42,15 +24,8 @@ export default function AgendamentoPage() {
|
||||
|
||||
useEffect(() => {
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "c") {
|
||||
setActiveTab("calendar");
|
||||
}
|
||||
if (event.key === "f") {
|
||||
setActiveTab("espera");
|
||||
}
|
||||
if (event.key === "3") {
|
||||
setActiveTab("3d");
|
||||
}
|
||||
if (event.key === "c") setActiveTab("calendar");
|
||||
if (event.key === "3") setActiveTab("3d");
|
||||
});
|
||||
}, []);
|
||||
|
||||
@ -146,10 +121,6 @@ export default function AgendamentoPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleNotifyPatient = (patientId: string) => {
|
||||
console.log(`Notificando paciente ${patientId}`);
|
||||
};
|
||||
|
||||
const handleAddEvent = (event: CalendarEvent) => {
|
||||
setThreeDEvents((prev) => [...prev, event]);
|
||||
};
|
||||
@ -173,23 +144,6 @@ export default function AgendamentoPage() {
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex space-x-2">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger className="bg-primary hover:bg-primary/90 px-5 py-1 text-primary-foreground rounded-sm">
|
||||
Opções »
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
<Link href={"/agenda"}>
|
||||
<DropdownMenuItem>Agendamento</DropdownMenuItem>
|
||||
</Link>
|
||||
<Link href={"/procedimento"}>
|
||||
<DropdownMenuItem>Procedimento</DropdownMenuItem>
|
||||
</Link>
|
||||
<Link href={"/financeiro"}>
|
||||
<DropdownMenuItem>Financeiro</DropdownMenuItem>
|
||||
</Link>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
<div className="flex flex-row">
|
||||
<Button
|
||||
variant={"outline"}
|
||||
@ -201,19 +155,11 @@ export default function AgendamentoPage() {
|
||||
|
||||
<Button
|
||||
variant={"outline"}
|
||||
className="bg-muted hover:bg-primary! hover:text-white! transition-colors rounded-none"
|
||||
className="bg-muted hover:bg-primary! hover:text-white! transition-colors rounded-r-[100px] rounded-l-none"
|
||||
onClick={() => setActiveTab("3d")}
|
||||
>
|
||||
3D
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant={"outline"}
|
||||
className="bg-muted hover:bg-primary! hover:text-white! transition-colors rounded-r-[100px] rounded-l-none"
|
||||
onClick={() => setActiveTab("espera")}
|
||||
>
|
||||
Lista de espera
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -244,16 +190,9 @@ export default function AgendamentoPage() {
|
||||
onRemoveEvent={handleRemoveEvent}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
// A Lista de Espera foi MANTIDA
|
||||
<ListaEspera
|
||||
patients={waitingList}
|
||||
onNotify={handleNotifyPatient}
|
||||
onAddToWaitlist={() => {}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -72,6 +72,11 @@ export function EventManager({
|
||||
availableTags = ["Important", "Urgent", "Work", "Personal", "Team", "Client"],
|
||||
}: EventManagerProps) {
|
||||
const [events, setEvents] = useState<Event[]>(initialEvents)
|
||||
// controla dias expandidos no MonthView (key = YYYY-MM-DD)
|
||||
const [expandedDays, setExpandedDays] = useState<Record<string, boolean>>({})
|
||||
const toggleExpandedDay = useCallback((dayKey: string) => {
|
||||
setExpandedDays((prev) => ({ ...prev, [dayKey]: !prev[dayKey] }))
|
||||
}, [])
|
||||
const [currentDate, setCurrentDate] = useState(new Date())
|
||||
const [view, setView] = useState<"month" | "week" | "day" | "list">(defaultView)
|
||||
const [selectedEvent, setSelectedEvent] = useState<Event | null>(null)
|
||||
@ -702,6 +707,8 @@ export function EventManager({
|
||||
onDragEnd={() => handleDragEnd()}
|
||||
onDrop={handleDrop}
|
||||
getColorClasses={getColorClasses}
|
||||
expandedDays={expandedDays}
|
||||
toggleExpandedDay={toggleExpandedDay}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -1144,6 +1151,8 @@ function MonthView({
|
||||
onDragEnd,
|
||||
onDrop,
|
||||
getColorClasses,
|
||||
expandedDays,
|
||||
toggleExpandedDay,
|
||||
}: {
|
||||
currentDate: Date
|
||||
events: Event[]
|
||||
@ -1152,6 +1161,8 @@ function MonthView({
|
||||
onDragEnd: () => void
|
||||
onDrop: (date: Date) => void
|
||||
getColorClasses: (color: string) => { bg: string; text: string }
|
||||
expandedDays: Record<string, boolean>
|
||||
toggleExpandedDay: (dayKey: string) => void
|
||||
}) {
|
||||
const firstDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1)
|
||||
const lastDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0)
|
||||
@ -1177,6 +1188,9 @@ function MonthView({
|
||||
})
|
||||
}
|
||||
|
||||
const formatTime = (date: Date) =>
|
||||
date.toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" })
|
||||
|
||||
return (
|
||||
<Card className="overflow-hidden">
|
||||
<div className="grid grid-cols-7 border-b">
|
||||
@ -1224,16 +1238,48 @@ function MonthView({
|
||||
variant="compact"
|
||||
/>
|
||||
))}
|
||||
{dayEvents.length > 3 && (
|
||||
{dayEvents.length > 3 && (
|
||||
<div className="text-[10px] text-muted-foreground sm:text-xs">+{dayEvents.length - 3} mais</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
{(() => {
|
||||
const dayKey = day.toISOString().slice(0, 10)
|
||||
const isExpanded = !!expandedDays?.[dayKey]
|
||||
const eventsToShow = isExpanded ? dayEvents : dayEvents.slice(0, 3)
|
||||
return (
|
||||
<>
|
||||
{eventsToShow.map((event) => (
|
||||
<EventCard
|
||||
key={event.id}
|
||||
event={event}
|
||||
onEventClick={onEventClick}
|
||||
onDragStart={onDragStart}
|
||||
onDragEnd={onDragEnd}
|
||||
getColorClasses={getColorClasses}
|
||||
variant="compact"
|
||||
/>
|
||||
))}
|
||||
|
||||
{dayEvents.length > 3 && (
|
||||
<div className="text-[10px] text-muted-foreground sm:text-xs">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => toggleExpandedDay(dayKey)}
|
||||
className="text-primary underline hover:text-primary/80"
|
||||
>
|
||||
{isExpanded ? "Mostrar menos" : `+${dayEvents.length - 3} mais`}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
// Week View Component
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user