/* Copyright (C) 2024 Manuel Bustillo*/ 'use client' import React, { useState } from "react" import { TableArrangement } from '@/app/lib/definitions'; import { classNames } from "../components/button"; export default function ArrangementsTable ({onArrangementSelected}: {onArrangementSelected: (arrangementId: string) => void}) { const [arrangements, setArrangements] = useState>([]); function loadArrangements() { fetch("/api/tables_arrangements") .then((response) => response.json()) .then((data) => { setArrangements(data.map((record: any) => { return ({ id: record.id, discomfort: record.discomfort }); })); }, (error) => { return []; }); } function arrangementClicked(e: React.MouseEvent) { onArrangementSelected(e.currentTarget.getAttribute('data-arrangement-id') || ''); } arrangements.length === 0 && loadArrangements(); return(
{arrangements.map((arrangement) => ( ))}
Simulations

There are {arrangements.length} simmulations in the list

ID Discomfort Actions
{arrangement.id} {arrangement.discomfort}
); }