Compare commits
8 Commits
8b94d5fb13
...
35995ca73c
Author | SHA1 | Date | |
---|---|---|---|
|
35995ca73c | ||
09a37675a9 | |||
9029d756e7 | |||
93662f5903 | |||
7dbfbb76b7 | |||
|
53811299c8 | ||
|
6731dcc874 | ||
c57bdec9fc |
@ -1,9 +1,26 @@
|
|||||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||||
|
|
||||||
|
'use client'
|
||||||
|
|
||||||
|
import { GlobalSummary as Summary } from '@/app/lib/definitions';
|
||||||
|
import { getSlug } from '@/app/lib/utils';
|
||||||
import GlobalSummary from '@/app/ui/dashboard/global-summary';
|
import GlobalSummary from '@/app/ui/dashboard/global-summary';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return(
|
const [globalSummary, setGlobalSummary] = useState<Summary | undefined>(undefined);
|
||||||
<GlobalSummary />
|
|
||||||
|
function refreshSummary() {
|
||||||
|
fetch(`/api/${getSlug()}/summary`)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
setGlobalSummary(data);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(refreshSummary, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
globalSummary && <GlobalSummary summary={globalSummary} />
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||||
|
|
||||||
|
import { AttendanceSummary } from "./group";
|
||||||
import { Guest } from "./guest";
|
import { Guest } from "./guest";
|
||||||
|
|
||||||
export interface Entity {
|
export interface Entity {
|
||||||
@ -38,3 +39,22 @@ export type Captcha = {
|
|||||||
export type StructuredErrors = {
|
export type StructuredErrors = {
|
||||||
[key: string]: string[] | string;
|
[key: string]: string[] | string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type GlobalSummary = {
|
||||||
|
expenses: ExpenseSummary;
|
||||||
|
guests: AttendanceSummary
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ExpenseSummary = {
|
||||||
|
projected: ExpensePossibleSummary;
|
||||||
|
confirmed: ExpensePossibleSummary;
|
||||||
|
status: StatusSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ExpensePossibleSummary = {
|
||||||
|
total: number;
|
||||||
|
guests: number;
|
||||||
|
}
|
||||||
|
export type StatusSummary = {
|
||||||
|
paid: number;
|
||||||
|
}
|
@ -21,7 +21,7 @@ const colorClasses = (style: Style) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function MainCard({ amount, title, subtitle, style, iconName }:
|
export function MainCard({ amount, title, subtitle, style, iconName }:
|
||||||
{
|
{
|
||||||
amount: string,
|
amount: string,
|
||||||
title: string,
|
title: string,
|
||||||
@ -42,7 +42,7 @@ export async function MainCard({ amount, title, subtitle, style, iconName }:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function SecondaryCard({ amount, title, iconName, style }: { amount: string, title: string, iconName: keyof typeof HeroIcon, style: Style }) {
|
export function SecondaryCard({ amount, title, iconName, style }: { amount: string, title: string, iconName: keyof typeof HeroIcon, style: Style }) {
|
||||||
return (
|
return (
|
||||||
<div className={`h-12 w-80 m-1 p-2 text-white flex flex-row items-center ${colorClasses(style)}`}>
|
<div className={`h-12 w-80 m-1 p-2 text-white flex flex-row items-center ${colorClasses(style)}`}>
|
||||||
<Icon className="m-3 h-7 w-7" name={iconName} />
|
<Icon className="m-3 h-7 w-7" name={iconName} />
|
||||||
|
@ -1,45 +1,41 @@
|
|||||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||||
|
|
||||||
|
import { GlobalSummary as Summary} from '@/app/lib/definitions';
|
||||||
import { MainCard, SecondaryCard } from '../components/dashboard-cards';
|
import { MainCard, SecondaryCard } from '../components/dashboard-cards';
|
||||||
|
|
||||||
export default async function GlobalSummary() {
|
export default function GlobalSummary({ summary }: { summary: Summary }) {
|
||||||
return (
|
return (
|
||||||
<div className="my-4">
|
<div className="my-4">
|
||||||
|
<div className="flex flex-row w-full my-2">
|
||||||
<div className="flex flex-row w-full my-2">
|
<div className="flex flex-col">
|
||||||
<MainCard style="green" amount="65000€" title="Projected" subtitle="150 guests" iconName="ArrowTrendingUpIcon" />
|
<MainCard amount={`${summary.expenses.projected.total}€`} title="Projected" subtitle={`${summary.expenses.projected.guests} guests`} style="blue" iconName="ArrowTrendingUpIcon" />
|
||||||
|
<MainCard amount={`${Math.round(summary.expenses.projected.total / summary.expenses.projected.guests)}€`} title="/ guest" iconName="UserIcon" style='blue' />
|
||||||
<div className="flex flex-col">
|
|
||||||
<MainCard amount="10000€" title="Paid already" iconName="Square3Stack3DIcon" style='blue' />
|
|
||||||
<MainCard amount="198€" title="/ guest" iconName="UserIcon" style='blue' />
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-col">
|
|
||||||
<MainCard amount="78000€" title="Max." subtitle='200 guests' iconName="ChevronDoubleUpIcon" style="orange" />
|
|
||||||
<MainCard amount="45000€" title="Min." subtitle="125 guests" iconName="ChevronDoubleDownIcon" style="green" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex flex-row w-full my-2">
|
|
||||||
<MainCard style="blue" amount="150" title="Invites sent" iconName="UsersIcon" />
|
|
||||||
|
|
||||||
<div className="flex flex-col">
|
|
||||||
<SecondaryCard amount="31%" title="confirmed (27 guests)" iconName="CheckIcon" style='green' />
|
|
||||||
<SecondaryCard amount="5%" title="declined (8 guests)" iconName="XMarkIcon" style='red' />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex flex-col">
|
|
||||||
<SecondaryCard amount="17%" title="tentative (14 guests)" iconName="QuestionMarkCircleIcon" style='orange' />
|
|
||||||
<SecondaryCard amount="65%" title="awaiting (72 guests)" iconName="EllipsisHorizontalIcon" style='gray' />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex flex-row w-full my-2">
|
|
||||||
<MainCard style="blue" amount="5" title="Table simulations" iconName="ServerStackIcon" />
|
|
||||||
<MainCard style="blue" amount="9" title="Bus simulations" iconName="TruckIcon" />
|
|
||||||
<MainCard style="blue" amount="98" title="QR codes" iconName="QrCodeIcon" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
<div className="flex flex-col">
|
||||||
|
<MainCard amount={`${summary.expenses.confirmed.total}€`} title="Min." subtitle={`${summary.expenses.confirmed.guests} guests`} iconName="ChevronDoubleDownIcon" style="green" />
|
||||||
|
<MainCard amount={`${Math.round(summary.expenses.confirmed.total / summary.expenses.confirmed.guests)}€`} title="/ guest" iconName="UserIcon" style='green' />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<MainCard amount={`${summary.expenses.status.paid}€`} title="Paid already" subtitle={`${Math.round(summary.expenses.status.paid / summary.expenses.projected.total * 100)}% of projected`} iconName="CheckIcon" style='blue' />
|
||||||
|
<MainCard amount={`${summary.expenses.projected.total - summary.expenses.status.paid}€`} title="To pay" subtitle={`${100 - Math.round(summary.expenses.status.paid / summary.expenses.projected.total * 100)}% of projected`} iconName="BanknotesIcon" style="orange" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-row w-full my-2">
|
||||||
|
<MainCard style="blue" amount={summary.guests.total.toString()} title="Invites sent" iconName="UsersIcon" />
|
||||||
|
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<SecondaryCard amount={`${Math.round(summary.guests.confirmed / summary.guests.total * 100)}%`} title={`confirmed (${summary.guests.confirmed} guests)`} iconName="CheckIcon" style='green' />
|
||||||
|
<SecondaryCard amount={`${Math.round(summary.guests.declined / summary.guests.total * 100)}%`} title={`declined (${summary.guests.declined} guests)`} iconName="XMarkIcon" style='red' />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<SecondaryCard amount={`${Math.round(summary.guests.tentative / summary.guests.total * 100)}%`} title={`tentative (${summary.guests.tentative} guests)`} iconName="QuestionMarkCircleIcon" style='orange' />
|
||||||
|
<SecondaryCard amount={`${Math.round(summary.guests.invited / summary.guests.total * 100)}%`} title={`awaiting (${summary.guests.invited} guests)`} iconName="EllipsisHorizontalIcon" style='gray' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ export default function SideNav() {
|
|||||||
<div className="flex h-full flex-col px-3 py-4 md:px-2">
|
<div className="flex h-full flex-col px-3 py-4 md:px-2">
|
||||||
<Link
|
<Link
|
||||||
className="mb-2 flex h-20 items-center justify-start rounded-md bg-blue-600 p-4 md:h-20"
|
className="mb-2 flex h-20 items-center justify-start rounded-md bg-blue-600 p-4 md:h-20"
|
||||||
href="/dashboard/guests"
|
href={`/${getSlug()}/dashboard`}
|
||||||
>
|
>
|
||||||
<div className={`${gloriaHallelujah.className} "w-32 text-white md:w-40 antialiased`}>
|
<div className={`${gloriaHallelujah.className} "w-32 text-white md:w-40 antialiased`}>
|
||||||
<h1>Wedding Planner</h1>
|
<h1>Wedding Planner</h1>
|
||||||
|
36
pnpm-lock.yaml
generated
36
pnpm-lock.yaml
generated
@ -25,10 +25,10 @@ importers:
|
|||||||
version: 2.1.1
|
version: 2.1.1
|
||||||
next:
|
next:
|
||||||
specifier: 15.1.0
|
specifier: 15.1.0
|
||||||
version: 15.1.0(@playwright/test@1.49.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
version: 15.1.0(@playwright/test@1.49.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||||
next-auth:
|
next-auth:
|
||||||
specifier: 5.0.0-beta.25
|
specifier: 5.0.0-beta.25
|
||||||
version: 5.0.0-beta.25(next@15.1.0(@playwright/test@1.49.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
version: 5.0.0-beta.25(next@15.1.0(@playwright/test@1.49.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||||
postcss:
|
postcss:
|
||||||
specifier: 8.4.49
|
specifier: 8.4.49
|
||||||
version: 8.4.49
|
version: 8.4.49
|
||||||
@ -59,7 +59,7 @@ importers:
|
|||||||
devDependencies:
|
devDependencies:
|
||||||
'@playwright/test':
|
'@playwright/test':
|
||||||
specifier: ^1.46.0
|
specifier: ^1.46.0
|
||||||
version: 1.49.0
|
version: 1.49.1
|
||||||
'@types/bcrypt':
|
'@types/bcrypt':
|
||||||
specifier: ^5.0.2
|
specifier: ^5.0.2
|
||||||
version: 5.0.2
|
version: 5.0.2
|
||||||
@ -306,8 +306,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
|
|
||||||
'@playwright/test@1.49.0':
|
'@playwright/test@1.49.1':
|
||||||
resolution: {integrity: sha512-DMulbwQURa8rNIQrf94+jPJQ4FmOVdpE5ZppRNvWVjvhC+6sOeo28r8MgIpQRYouXRtt/FCCXU7zn20jnHR4Qw==}
|
resolution: {integrity: sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@ -835,13 +835,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==}
|
resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==}
|
||||||
engines: {node: '>= 6'}
|
engines: {node: '>= 6'}
|
||||||
|
|
||||||
playwright-core@1.49.0:
|
playwright-core@1.49.1:
|
||||||
resolution: {integrity: sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA==}
|
resolution: {integrity: sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
playwright@1.49.0:
|
playwright@1.49.1:
|
||||||
resolution: {integrity: sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A==}
|
resolution: {integrity: sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@ -1340,9 +1340,9 @@ snapshots:
|
|||||||
'@pkgjs/parseargs@0.11.0':
|
'@pkgjs/parseargs@0.11.0':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@playwright/test@1.49.0':
|
'@playwright/test@1.49.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
playwright: 1.49.0
|
playwright: 1.49.1
|
||||||
|
|
||||||
'@swc/counter@0.1.3': {}
|
'@swc/counter@0.1.3': {}
|
||||||
|
|
||||||
@ -1732,13 +1732,13 @@ snapshots:
|
|||||||
|
|
||||||
nanoid@3.3.7: {}
|
nanoid@3.3.7: {}
|
||||||
|
|
||||||
next-auth@5.0.0-beta.25(next@15.1.0(@playwright/test@1.49.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
next-auth@5.0.0-beta.25(next@15.1.0(@playwright/test@1.49.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@auth/core': 0.37.2
|
'@auth/core': 0.37.2
|
||||||
next: 15.1.0(@playwright/test@1.49.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
next: 15.1.0(@playwright/test@1.49.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||||
react: 19.0.0-rc-f38c22b244-20240704
|
react: 19.0.0-rc-f38c22b244-20240704
|
||||||
|
|
||||||
next@15.1.0(@playwright/test@1.49.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
next@15.1.0(@playwright/test@1.49.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@next/env': 15.1.0
|
'@next/env': 15.1.0
|
||||||
'@swc/counter': 0.1.3
|
'@swc/counter': 0.1.3
|
||||||
@ -1758,7 +1758,7 @@ snapshots:
|
|||||||
'@next/swc-linux-x64-musl': 15.1.0
|
'@next/swc-linux-x64-musl': 15.1.0
|
||||||
'@next/swc-win32-arm64-msvc': 15.1.0
|
'@next/swc-win32-arm64-msvc': 15.1.0
|
||||||
'@next/swc-win32-x64-msvc': 15.1.0
|
'@next/swc-win32-x64-msvc': 15.1.0
|
||||||
'@playwright/test': 1.49.0
|
'@playwright/test': 1.49.1
|
||||||
sharp: 0.33.5
|
sharp: 0.33.5
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@babel/core'
|
- '@babel/core'
|
||||||
@ -1818,11 +1818,11 @@ snapshots:
|
|||||||
|
|
||||||
pirates@4.0.6: {}
|
pirates@4.0.6: {}
|
||||||
|
|
||||||
playwright-core@1.49.0: {}
|
playwright-core@1.49.1: {}
|
||||||
|
|
||||||
playwright@1.49.0:
|
playwright@1.49.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
playwright-core: 1.49.0
|
playwright-core: 1.49.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents: 2.3.2
|
fsevents: 2.3.2
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user