diff --git a/src/app/(dashboard)/encaminhados/encaminhamentos/page.tsx b/src/app/(dashboard)/encaminhados/encaminhamentos/page.tsx index e9cec52..ec02309 100644 --- a/src/app/(dashboard)/encaminhados/encaminhamentos/page.tsx +++ b/src/app/(dashboard)/encaminhados/encaminhamentos/page.tsx @@ -1,8 +1,11 @@ import type { Metadata } from 'next' +import { ReferralsTable } from './referrals-table' + export const metadata: Metadata = { title: 'Encaminhamentos', } + export default function Page() { - return

Encaminhamentos

+ return } diff --git a/src/app/(dashboard)/encaminhados/encaminhamentos/referrals-skeleton.tsx b/src/app/(dashboard)/encaminhados/encaminhamentos/referrals-skeleton.tsx new file mode 100644 index 0000000..348ad8b --- /dev/null +++ b/src/app/(dashboard)/encaminhados/encaminhamentos/referrals-skeleton.tsx @@ -0,0 +1,35 @@ +import { Skeleton } from '@/components/ui/skeleton' +import { TableBody, TableCell, TableRow } from '@/components/ui/table' + +export default function ReferralsSkeleton() { + const skeletons = Array.from({ length: 10 }).map((_, index) => index) + + return ( + + {skeletons.map((skeleton) => ( + + +
+ +
+
+ + + + + + + + + + + + + + + +
+ ))} +
+ ) +} diff --git a/src/app/(dashboard)/encaminhados/encaminhamentos/referrals-table.tsx b/src/app/(dashboard)/encaminhados/encaminhamentos/referrals-table.tsx new file mode 100644 index 0000000..e647a61 --- /dev/null +++ b/src/app/(dashboard)/encaminhados/encaminhamentos/referrals-table.tsx @@ -0,0 +1,212 @@ +'use client' +import { Eye } from 'lucide-react' +import { useState } from 'react' + +import { DataTableHeader } from '@/components/data-table/header' +import { DataTableHeaderActions } from '@/components/data-table/header/actions' +import { DataTableHeaderOrderBy } from '@/components/data-table/header/order-by' +import { DataTableHeaderSearch } from '@/components/data-table/header/search' +import { Pagination } from '@/components/pagination' +import { Card } from '@/components/ui/card' +import { TabSelect } from '@/components/ui/tab-select' +import { + Table, + TableBody, + TableButton, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@/components/ui/table' +import { Tag } from '@/components/ui/tag' +import { + PATIENT_CONDITIONS, + PatientCondition, + PATIENTS_REFERRALS_ORDER_OPTIONS, +} from '@/types/patients' + +import ReferralsSkeleton from './referrals-skeleton' + +const referrals = [ + { + id: 1, + nome: 'Ana Silva', + encaminhadoEm: '03/03/2025', + profissional: 'João Pereira', + especialidade: 'Medicina', + quadroGeral: 'stable', + }, + { + id: 2, + nome: 'Carlos Mendes', + encaminhadoEm: '03/03/2025', + profissional: 'Mariana Costa', + especialidade: 'Psicologia', + quadroGeral: 'outbreak', + }, + { + id: 3, + nome: 'Beatriz Rocha', + encaminhadoEm: '03/03/2025', + profissional: 'Lucas Andrade', + especialidade: 'Nutrição', + quadroGeral: 'stable', + }, + { + id: 4, + nome: 'Rafael Gomes', + encaminhadoEm: '03/03/2025', + profissional: 'Fernanda Lima', + especialidade: 'Enfermagem', + quadroGeral: 'outbreak', + }, + { + id: 5, + nome: 'Juliana Santos', + encaminhadoEm: '03/03/2025', + profissional: 'Pedro Albuquerque', + especialidade: 'Advocacia', + quadroGeral: 'stable', + }, + { + id: 6, + nome: 'Marcos Oliveira', + encaminhadoEm: '03/03/2025', + profissional: 'Camila Duarte', + especialidade: 'Medicina', + quadroGeral: 'stable', + }, + { + id: 7, + nome: 'Paula Ferreira', + encaminhadoEm: '03/03/2025', + profissional: 'Ricardo Matos', + especialidade: 'Psicologia', + quadroGeral: 'outbreak', + }, + { + id: 8, + nome: 'Daniel Azevedo', + encaminhadoEm: '03/03/2025', + profissional: 'Larissa Pires', + especialidade: 'Nutrição', + quadroGeral: 'stable', + }, + { + id: 9, + nome: 'Gabriela Martins', + encaminhadoEm: '03/03/2025', + profissional: 'Diego Amaral', + especialidade: 'Enfermagem', + quadroGeral: 'outbreak', + }, + { + id: 10, + nome: 'Vitor Souza', + encaminhadoEm: '03/03/2025', + profissional: 'Letícia Moura', + especialidade: 'Psicologia', + quadroGeral: 'stable', + }, +] + +export function ReferralsTable() { + const [isLoading] = useState(false) + const [isReferralsEmpty] = useState(referrals.length <= 0) + const [statusFilter, setStatusFilter] = useState('all') + + const filterOptions = [ + { + label: 'Todos', + isActive: statusFilter === 'all', + onClick: () => setStatusFilter('all'), + }, + { + label: 'Em surto', + isActive: statusFilter === 'outbreak', + onClick: () => setStatusFilter('outbreak'), + }, + { + label: 'Estável', + isActive: statusFilter === 'stable', + onClick: () => setStatusFilter('stable'), + }, + ] + + return ( +
+ + + + + + + + + + + + + Nome do paciente + Encaminhado em + Profissional + Especialidade + Quadro geral + Observações + + + + {isLoading && } + + {!isLoading && isReferralsEmpty && ( + + + +
+ Nenhum paciente encontrado +
+
+
+
+ )} + + {!isLoading && !isReferralsEmpty && ( + + {referrals?.map((forwarding) => { + const condition = + PATIENT_CONDITIONS[forwarding.quadroGeral as PatientCondition] + const ConditionIcon = condition.icon + return ( + + {forwarding.nome} + + {forwarding.encaminhadoEm} + {forwarding.profissional} + + + {forwarding.especialidade} + + + + + + {condition.label} + + + + + + + + + ) + })} + + )} +
+
+ + +
+ ) +} diff --git a/src/types/patients.ts b/src/types/patients.ts index 19162ce..029d0bc 100644 --- a/src/types/patients.ts +++ b/src/types/patients.ts @@ -111,3 +111,18 @@ export type PatientDocument = { created_at: string size: string } + +export const PATIENT_REFERRALS_ORDER = { + name_asc: 'Nome (Crescente)', + name_desc: 'Nome (Decrescente)', + date_asc: 'Data (Crescente)', + date_desc: 'Data (Decrescente)', + general_overview_asc: 'Em surto (Crescente)', + general_overview_desc: 'Estável (Decrescente)', +} + +export type PatientsReferralsOrderType = keyof typeof PATIENT_REFERRALS_ORDER + +export const PATIENTS_REFERRALS_ORDER_OPTIONS = convertObjectToOptions( + PATIENT_REFERRALS_ORDER, +)