Fix permissão página de consulta do gestor
This commit is contained in:
parent
e31d7f7046
commit
c9aed9d4a4
@ -9,36 +9,8 @@ import Cookies from "js-cookie"; // Mantido apenas para a limpeza de segurança
|
|||||||
import { api } from "@/services/api.mjs";
|
import { api } from "@/services/api.mjs";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { LogOut, ChevronLeft, ChevronRight, Home, CalendarCheck2, ClipboardPlus, CalendarClock, Users, SquareUser, ClipboardList, Stethoscope, ClipboardMinus } from "lucide-react";
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogFooter,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
} from "@/components/ui/dialog";
|
|
||||||
import {
|
|
||||||
Search,
|
|
||||||
Bell,
|
|
||||||
Calendar,
|
|
||||||
User,
|
|
||||||
LogOut,
|
|
||||||
ChevronLeft,
|
|
||||||
ChevronRight,
|
|
||||||
Home,
|
|
||||||
CalendarCheck2,
|
|
||||||
ClipboardPlus,
|
|
||||||
SquareUserRound,
|
|
||||||
CalendarClock,
|
|
||||||
Users,
|
|
||||||
SquareUser,
|
|
||||||
ClipboardList,
|
|
||||||
Stethoscope,
|
|
||||||
ClipboardMinus,
|
|
||||||
} from "lucide-react";
|
|
||||||
import SidebarUserSection from "@/components/ui/userToolTip";
|
import SidebarUserSection from "@/components/ui/userToolTip";
|
||||||
|
|
||||||
interface UserData {
|
interface UserData {
|
||||||
@ -206,7 +178,7 @@ export default function Sidebar({ children }: SidebarProps) {
|
|||||||
{ href: "/manager/usuario", icon: Users, label: "Gestão de Usuários" },
|
{ href: "/manager/usuario", icon: Users, label: "Gestão de Usuários" },
|
||||||
{ href: "/manager/home", icon: Stethoscope, label: "Gestão de Médicos" },
|
{ href: "/manager/home", icon: Stethoscope, label: "Gestão de Médicos" },
|
||||||
{ href: "/manager/pacientes", icon: Users, label: "Gestão de Pacientes" },
|
{ href: "/manager/pacientes", icon: Users, label: "Gestão de Pacientes" },
|
||||||
{ href: "/doctor/consultas", icon: CalendarCheck2, label: "Consultas" }, //adicionar botão de voltar pra pagina anterior
|
{ href: "/secretary/appointments", icon: CalendarCheck2, label: "Consultas" }, //adicionar botão de voltar pra pagina anterior
|
||||||
];
|
];
|
||||||
|
|
||||||
let menuItems: MenuItem[];
|
let menuItems: MenuItem[];
|
||||||
@ -236,20 +208,12 @@ export default function Sidebar({ children }: SidebarProps) {
|
|||||||
const menuItems = SetMenuItems(role);
|
const menuItems = SetMenuItems(role);
|
||||||
|
|
||||||
if (!userData) {
|
if (!userData) {
|
||||||
return (
|
return <div className="flex h-screen w-full items-center justify-center">Carregando...</div>;
|
||||||
<div className="flex h-screen w-full items-center justify-center">
|
|
||||||
Carregando...
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gray-50 flex">
|
<div className="min-h-screen bg-gray-50 flex">
|
||||||
<div
|
<div className={`bg-white border-r border-gray-200 transition-all duration-300 fixed top-0 h-screen flex flex-col z-30 ${sidebarCollapsed ? "w-16" : "w-64"}`}>
|
||||||
className={`bg-white border-r border-gray-200 transition-all duration-300 fixed top-0 h-screen flex flex-col z-30 ${
|
|
||||||
sidebarCollapsed ? "w-16" : "w-64"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<div className="p-4 border-b border-gray-200 flex items-center justify-between">
|
<div className="p-4 border-b border-gray-200 flex items-center justify-between">
|
||||||
{!sidebarCollapsed && (
|
{!sidebarCollapsed && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
@ -262,17 +226,8 @@ export default function Sidebar({ children }: SidebarProps) {
|
|||||||
<span className="font-semibold text-gray-900">MedConnect</span>
|
<span className="font-semibold text-gray-900">MedConnect</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button variant="ghost" size="sm" onClick={() => setSidebarCollapsed(!sidebarCollapsed)} className="p-1">
|
||||||
variant="ghost"
|
{sidebarCollapsed ? <ChevronRight className="w-4 h-4" /> : <ChevronLeft className="w-4 h-4" />}
|
||||||
size="sm"
|
|
||||||
onClick={() => setSidebarCollapsed(!sidebarCollapsed)}
|
|
||||||
className="p-1"
|
|
||||||
>
|
|
||||||
{sidebarCollapsed ? (
|
|
||||||
<ChevronRight className="w-4 h-4" />
|
|
||||||
) : (
|
|
||||||
<ChevronLeft className="w-4 h-4" />
|
|
||||||
)}
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -282,35 +237,18 @@ export default function Sidebar({ children }: SidebarProps) {
|
|||||||
const isActive = pathname === item.href;
|
const isActive = pathname === item.href;
|
||||||
return (
|
return (
|
||||||
<Link key={item.label} href={item.href}>
|
<Link key={item.label} href={item.href}>
|
||||||
<div
|
<div className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${isActive ? "bg-blue-50 text-blue-600 border-r-2 border-blue-600" : "text-gray-600 hover:bg-gray-50"}`}>
|
||||||
className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${
|
|
||||||
isActive
|
|
||||||
? "bg-blue-50 text-blue-600 border-r-2 border-blue-600"
|
|
||||||
: "text-gray-600 hover:bg-gray-50"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<Icon className="w-5 h-5 flex-shrink-0" />
|
<Icon className="w-5 h-5 flex-shrink-0" />
|
||||||
{!sidebarCollapsed && (
|
{!sidebarCollapsed && <span className="font-medium">{item.label}</span>}
|
||||||
<span className="font-medium">{item.label}</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</nav>
|
</nav>
|
||||||
<SidebarUserSection
|
<SidebarUserSection userData={userData} sidebarCollapsed={false} handleLogout={handleLogout} isActive={role === "paciente" ? false : true}></SidebarUserSection>
|
||||||
userData={userData}
|
|
||||||
sidebarCollapsed={false}
|
|
||||||
handleLogout={handleLogout}
|
|
||||||
isActive={role === "paciente" ? false : true}
|
|
||||||
></SidebarUserSection>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div className={`flex-1 flex flex-col transition-all duration-300 w-full ${sidebarCollapsed ? "ml-16" : "ml-64"}`}>
|
||||||
className={`flex-1 flex flex-col transition-all duration-300 w-full ${
|
|
||||||
sidebarCollapsed ? "ml-16" : "ml-64"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<header className="bg-gray-50 px-4 md:px-6 py-4 flex items-center justify-between"></header>
|
<header className="bg-gray-50 px-4 md:px-6 py-4 flex items-center justify-between"></header>
|
||||||
<main className="flex-1 p-4 md:p-6">{children}</main>
|
<main className="flex-1 p-4 md:p-6">{children}</main>
|
||||||
</div>
|
</div>
|
||||||
@ -319,10 +257,7 @@ export default function Sidebar({ children }: SidebarProps) {
|
|||||||
<DialogContent className="sm:max-w-md">
|
<DialogContent className="sm:max-w-md">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Confirmar Saída</DialogTitle>
|
<DialogTitle>Confirmar Saída</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>Deseja realmente sair do sistema? Você precisará fazer login novamente para acessar sua conta.</DialogDescription>
|
||||||
Deseja realmente sair do sistema? Você precisará fazer login
|
|
||||||
novamente para acessar sua conta.
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogFooter className="flex gap-2">
|
<DialogFooter className="flex gap-2">
|
||||||
<Button variant="outline" onClick={cancelLogout}>
|
<Button variant="outline" onClick={cancelLogout}>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user