forked from RiseUP/riseup-squad20
Remove ListaEspera e botões Procedimento/Financeiro
This commit is contained in:
parent
3022cbfc4b
commit
2729fdc868
@ -2,37 +2,19 @@
|
|||||||
|
|
||||||
// Imports mantidos
|
// Imports mantidos
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import dynamic from "next/dynamic";
|
|
||||||
import Link from "next/link";
|
|
||||||
|
|
||||||
// --- Imports do EventManager (NOVO) - MANTIDOS ---
|
// --- Imports do EventManager (NOVO) - MANTIDOS ---
|
||||||
import { EventManager, type Event } from "@/components/features/general/event-manager";
|
import { EventManager, type Event } from "@/components/features/general/event-manager";
|
||||||
import { v4 as uuidv4 } from 'uuid'; // Usado para IDs de fallback
|
import { v4 as uuidv4 } from 'uuid'; // Usado para IDs de fallback
|
||||||
|
|
||||||
// Imports mantidos
|
// Imports mantidos
|
||||||
import { Sidebar } from "@/components/layout/sidebar";
|
|
||||||
import { PagesHeader } from "@/components/features/dashboard/header";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { mockWaitingList } from "@/lib/mocks/appointment-mocks";
|
|
||||||
import "./index.css";
|
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
|
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() {
|
export default function AgendamentoPage() {
|
||||||
const [appointments, setAppointments] = useState<any[]>([]);
|
const [appointments, setAppointments] = useState<any[]>([]);
|
||||||
const [waitingList, setWaitingList] = useState(mockWaitingList);
|
const [activeTab, setActiveTab] = useState<"calendar" | "3d">("calendar");
|
||||||
const [activeTab, setActiveTab] = useState<"calendar" | "espera" | "3d">("calendar");
|
|
||||||
|
|
||||||
const [threeDEvents, setThreeDEvents] = useState<CalendarEvent[]>([]);
|
const [threeDEvents, setThreeDEvents] = useState<CalendarEvent[]>([]);
|
||||||
|
|
||||||
// --- NOVO ESTADO ---
|
// --- NOVO ESTADO ---
|
||||||
@ -42,15 +24,8 @@ export default function AgendamentoPage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.addEventListener("keydown", (event) => {
|
document.addEventListener("keydown", (event) => {
|
||||||
if (event.key === "c") {
|
if (event.key === "c") setActiveTab("calendar");
|
||||||
setActiveTab("calendar");
|
if (event.key === "3") setActiveTab("3d");
|
||||||
}
|
|
||||||
if (event.key === "f") {
|
|
||||||
setActiveTab("espera");
|
|
||||||
}
|
|
||||||
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) => {
|
const handleAddEvent = (event: CalendarEvent) => {
|
||||||
setThreeDEvents((prev) => [...prev, event]);
|
setThreeDEvents((prev) => [...prev, event]);
|
||||||
};
|
};
|
||||||
@ -173,23 +144,6 @@ export default function AgendamentoPage() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex space-x-2">
|
<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">
|
<div className="flex flex-row">
|
||||||
<Button
|
<Button
|
||||||
variant={"outline"}
|
variant={"outline"}
|
||||||
@ -201,19 +155,11 @@ export default function AgendamentoPage() {
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant={"outline"}
|
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")}
|
onClick={() => setActiveTab("3d")}
|
||||||
>
|
>
|
||||||
3D
|
3D
|
||||||
</Button>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -244,16 +190,9 @@ export default function AgendamentoPage() {
|
|||||||
onRemoveEvent={handleRemoveEvent}
|
onRemoveEvent={handleRemoveEvent}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : null}
|
||||||
// A Lista de Espera foi MANTIDA
|
</div>
|
||||||
<ListaEspera
|
</div>
|
||||||
patients={waitingList}
|
</div>
|
||||||
onNotify={handleNotifyPatient}
|
);
|
||||||
onAddToWaitlist={() => {}}
|
}
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -72,6 +72,11 @@ export function EventManager({
|
|||||||
availableTags = ["Important", "Urgent", "Work", "Personal", "Team", "Client"],
|
availableTags = ["Important", "Urgent", "Work", "Personal", "Team", "Client"],
|
||||||
}: EventManagerProps) {
|
}: EventManagerProps) {
|
||||||
const [events, setEvents] = useState<Event[]>(initialEvents)
|
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 [currentDate, setCurrentDate] = useState(new Date())
|
||||||
const [view, setView] = useState<"month" | "week" | "day" | "list">(defaultView)
|
const [view, setView] = useState<"month" | "week" | "day" | "list">(defaultView)
|
||||||
const [selectedEvent, setSelectedEvent] = useState<Event | null>(null)
|
const [selectedEvent, setSelectedEvent] = useState<Event | null>(null)
|
||||||
@ -702,6 +707,8 @@ export function EventManager({
|
|||||||
onDragEnd={() => handleDragEnd()}
|
onDragEnd={() => handleDragEnd()}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
getColorClasses={getColorClasses}
|
getColorClasses={getColorClasses}
|
||||||
|
expandedDays={expandedDays}
|
||||||
|
toggleExpandedDay={toggleExpandedDay}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -1144,6 +1151,8 @@ function MonthView({
|
|||||||
onDragEnd,
|
onDragEnd,
|
||||||
onDrop,
|
onDrop,
|
||||||
getColorClasses,
|
getColorClasses,
|
||||||
|
expandedDays,
|
||||||
|
toggleExpandedDay,
|
||||||
}: {
|
}: {
|
||||||
currentDate: Date
|
currentDate: Date
|
||||||
events: Event[]
|
events: Event[]
|
||||||
@ -1152,6 +1161,8 @@ function MonthView({
|
|||||||
onDragEnd: () => void
|
onDragEnd: () => void
|
||||||
onDrop: (date: Date) => void
|
onDrop: (date: Date) => void
|
||||||
getColorClasses: (color: string) => { bg: string; text: string }
|
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 firstDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1)
|
||||||
const lastDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0)
|
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 (
|
return (
|
||||||
<Card className="overflow-hidden">
|
<Card className="overflow-hidden">
|
||||||
<div className="grid grid-cols-7 border-b">
|
<div className="grid grid-cols-7 border-b">
|
||||||
@ -1224,16 +1238,48 @@ function MonthView({
|
|||||||
variant="compact"
|
variant="compact"
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{dayEvents.length > 3 && (
|
{dayEvents.length > 3 && (
|
||||||
<div className="text-[10px] text-muted-foreground sm:text-xs">+{dayEvents.length - 3} mais</div>
|
<div className="text-[10px] text-muted-foreground sm:text-xs">+{dayEvents.length - 3} mais</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
{(() => {
|
||||||
</div>
|
const dayKey = day.toISOString().slice(0, 10)
|
||||||
)
|
const isExpanded = !!expandedDays?.[dayKey]
|
||||||
})}
|
const eventsToShow = isExpanded ? dayEvents : dayEvents.slice(0, 3)
|
||||||
</div>
|
return (
|
||||||
</Card>
|
<>
|
||||||
)
|
{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
|
// Week View Component
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user