WIP groups tree table
This commit is contained in:
		
							parent
							
								
									770f1854d1
								
							
						
					
					
						commit
						2b0fab797e
					
				| @ -6,6 +6,9 @@ import { Group, GroupSerializer } from '@/app/lib/group'; | |||||||
| import TableOfContents from '../components/table-of-contents'; | import TableOfContents from '../components/table-of-contents'; | ||||||
| import { PencilIcon, TrashIcon } from '@heroicons/react/24/outline'; | import { PencilIcon, TrashIcon } from '@heroicons/react/24/outline'; | ||||||
| import { AbstractApi } from '@/app/api/abstract-api'; | 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 }: { | export default function GroupsTable({ groups, onUpdate, onEdit }: { | ||||||
|   groups: Group[], |   groups: Group[], | ||||||
| @ -16,9 +19,19 @@ export default function GroupsTable({ groups, onUpdate, onEdit }: { | |||||||
|   const api = new AbstractApi<Group>(); |   const api = new AbstractApi<Group>(); | ||||||
|   const serializer = new GroupSerializer(); |   const serializer = new GroupSerializer(); | ||||||
| 
 | 
 | ||||||
|  |   const nodes:TreeNode[] = []; | ||||||
|  | 
 | ||||||
|  |   const headers = ['Name', 'Color', 'Confirmed', 'Tentative', 'Pending', 'Declined', 'Considered', 'Total', 'Actions']; | ||||||
|  | 
 | ||||||
|   return ( |   return ( | ||||||
|  |     <> | ||||||
|  |       <TreeTable value={nodes} tableStyle={{ minWidth: '50rem' }}> | ||||||
|  |         { headers.map((header, index) => <Column key={index} field={header} header={header}></Column>)} | ||||||
|  |       | ||||||
|  |       </TreeTable> | ||||||
|  | 
 | ||||||
|       <TableOfContents |       <TableOfContents | ||||||
|       headers={['Name', 'Color', 'Confirmed', 'Tentative', 'Pending', 'Declined', 'Considered', 'Total', 'Actions']} |         headers={headers} | ||||||
|         caption='Groups' |         caption='Groups' | ||||||
|         elements={groups} |         elements={groups} | ||||||
|         rowRender={(group) => ( |         rowRender={(group) => ( | ||||||
| @ -56,5 +69,6 @@ export default function GroupsTable({ groups, onUpdate, onEdit }: { | |||||||
|           </tr> |           </tr> | ||||||
|         )} |         )} | ||||||
|       /> |       /> | ||||||
|  |     </> | ||||||
|   ) |   ) | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user