Render list of tables in an arrangement
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m40s
Add copyright notice / copyright_notice (pull_request) Successful in 2m1s
Playwright Tests / test (pull_request) Successful in 4m56s
Build Nginx-based docker image / build-static-assets (pull_request) Successful in 7m55s
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m40s
Add copyright notice / copyright_notice (pull_request) Successful in 2m1s
Playwright Tests / test (pull_request) Successful in 4m56s
Build Nginx-based docker image / build-static-assets (pull_request) Successful in 7m55s
This commit is contained in:
parent
094652d47e
commit
51d9a3d6e2
@ -1,10 +1,15 @@
|
|||||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||||
|
|
||||||
import { Table } from '@/app/ui/components/table';
|
import { Table } from '@/app/ui/components/table';
|
||||||
|
import Arrangement from '@/app/ui/arrangements/arrangement';
|
||||||
import Summary from '@/app/ui/expenses/summary';
|
import Summary from '@/app/ui/expenses/summary';
|
||||||
import { lusitana } from '@/app/ui/fonts';
|
import { lusitana } from '@/app/ui/fonts';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
|
|
||||||
|
return(
|
||||||
|
<Arrangement id="4a54516b-1c6e-49eb-9781-c20b93f89c85"/>
|
||||||
|
)
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="w-full items-center justify-between">
|
<div className="w-full items-center justify-between">
|
||||||
|
@ -26,6 +26,20 @@ export type Guest = {
|
|||||||
status?: 'Considered' | 'Invited' | 'Confirmed' | 'Declined' | 'Tentative';
|
status?: 'Considered' | 'Invited' | 'Confirmed' | 'Declined' | 'Tentative';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Banana = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
email?: string;
|
||||||
|
group_name?: string;
|
||||||
|
status?: 'Considered' | 'Invited' | 'Confirmed' | 'Declined' | 'Tentative';
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TableArrangement = {
|
||||||
|
number: number;
|
||||||
|
guests: Guest[];
|
||||||
|
discomfort?: number
|
||||||
|
}
|
||||||
|
|
||||||
export type Group = {
|
export type Group = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
44
app/ui/arrangements/arrangement.tsx
Normal file
44
app/ui/arrangements/arrangement.tsx
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import { TableArrangement, Guest } from '@/app/lib/definitions';
|
||||||
|
import { lusitana } from '@/app/ui/fonts';
|
||||||
|
import { Table } from '@/app/ui/components/table';
|
||||||
|
|
||||||
|
export default function Arrangement({ id }: { id: string }) {
|
||||||
|
|
||||||
|
const [guests, setGuests] = useState<Array<Guest>>([]);
|
||||||
|
const [tables, setTables] = useState<Array<TableArrangement>>([]);
|
||||||
|
|
||||||
|
|
||||||
|
function loadTables() {
|
||||||
|
fetch(`/api/tables_arrangements/${id}`)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
setTables(data.map((record: any) => {
|
||||||
|
return ({
|
||||||
|
id: record.id,
|
||||||
|
guests: record.guests
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
}, (error) => {
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
tables.length === 0 && loadTables();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="w-full items-center justify-between">
|
||||||
|
<h1 className={`${lusitana.className} text-2xl`}>Table distributions</h1>
|
||||||
|
<div className="flex flex-row flex-wrap justify-around">
|
||||||
|
{tables.map((table) => (
|
||||||
|
<Table guests={table.guests} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user