/* Copyright (C) 2024 Manuel Bustillo*/ 'use client'; import { Group, GroupSerializer } from '@/app/lib/group'; import TableOfContents from '../components/table-of-contents'; import { PencilIcon, TrashIcon } from '@heroicons/react/24/outline'; import { AbstractApi } from '@/app/api/abstract-api'; import { TreeTable } from 'primereact/treetable'; import { Column } from 'primereact/column'; import { TreeNode } from 'primereact/treenode'; export default function GroupsTable({ groups, onUpdate, onEdit }: { groups: Group[], onUpdate: () => void, onEdit: (group: Group) => void, }) { const api = new AbstractApi(); const serializer = new GroupSerializer(); const nodes:TreeNode[] = []; const headers = ['Name', 'Color', 'Confirmed', 'Tentative', 'Pending', 'Declined', 'Considered', 'Total', 'Actions']; return ( <> { headers.map((header, index) => )} ( {group.name}
{group.attendance?.confirmed} {group.attendance?.tentative} {group.attendance?.invited} {group.attendance?.declined} {group.attendance?.considered} {group.attendance?.total}
{ api.destroy(serializer, group, onUpdate) }} /> onEdit(group)} />
)} /> ) }