diff --git a/app/dashboard/guests/page.tsx b/app/dashboard/guests/page.tsx
index 2b65f56..2ce7335 100644
--- a/app/dashboard/guests/page.tsx
+++ b/app/dashboard/guests/page.tsx
@@ -1,24 +1,34 @@
/* Copyright (C) 2024 Manuel Bustillo*/
-import { lusitana } from '@/app/ui/fonts';
import AffinityGroupsTree from '@/app/ui/guests/affinity-groups-tree';
import GuestsTable from '@/app/ui/guests/table';
import React, { Suspense } from 'react';
import SkeletonTable from '@/app/ui/guests/skeleton-row';
-
-
+import { TabView, TabPanel } from 'primereact/tabview';
+import GroupsTable from '@/app/ui/groups/table';
export default function Page() {
return (
-
Guests
-
- }>
-
-
-
+
+
+
+ }>
+
+
+
+ TabPanel>
+
+
+ }>
+
+
+
+ TabPanel>
+ TabView>
+
);
}
\ No newline at end of file
diff --git a/app/lib/definitions.ts b/app/lib/definitions.ts
index 07eef8b..3ea3fe1 100644
--- a/app/lib/definitions.ts
+++ b/app/lib/definitions.ts
@@ -47,8 +47,19 @@ export type Group = {
guest_count: number;
icon: string;
children: Group[];
+ color: string;
+ attendance?: AttendanceSummary
};
+export type AttendanceSummary = {
+ considered: number;
+ invited: number;
+ confirmed: number;
+ declined: number;
+ tentative: number;
+ total: number;
+}
+
export type Invoice = {
id: string;
customer_id: string;
diff --git a/app/ui/groups/table.tsx b/app/ui/groups/table.tsx
new file mode 100644
index 0000000..387c7ea
--- /dev/null
+++ b/app/ui/groups/table.tsx
@@ -0,0 +1,75 @@
+/* Copyright (C) 2024 Manuel Bustillo*/
+
+'use client';
+
+import TableOfContents from '../components/table-of-contents';
+import React, { useState } from 'react';
+import { Group } from '@/app/lib/definitions';
+
+export default function GroupsTable() {
+ const [groups, setGroups] = useState>([]);
+ const [groupsLoaded, setGroupsLoaded] = useState(false);
+
+ function loadGroups() {
+ fetch("/api/groups")
+ .then((response) => response.json())
+ .then((data) => {
+ setGroups(data.map((record: any) => {
+ return ({
+ id: record.id,
+ name: record.name,
+ color: record.color,
+ attendance: {
+ considered: record.considered,
+ invited: record.invited,
+ confirmed: record.confirmed,
+ tentative: record.tentative,
+ declined: record.declined,
+ total: record.total,
+ }
+ });
+ }));
+ setGroupsLoaded(true);
+ }, (error) => {
+ return [];
+ });
+ }
+
+ !groupsLoaded && loadGroups();
+
+ return (
+ (
+
+
+ {group.name}
+ |
+
+
+ |
+
+ {group.attendance?.confirmed}
+ |
+
+ {group.attendance?.tentative}
+ |
+
+ {group.attendance?.invited}
+ |
+
+ {group.attendance?.declined}
+ |
+
+ {group.attendance?.considered}
+ |
+
+ {group.attendance?.total}
+ |
+
+ )}
+ />
+ )
+}