Display an icon indicating whether a simulation is still valid
This commit is contained in:
parent
c691359356
commit
1184a529cf
@ -12,6 +12,7 @@ export function loadTableSimulations(onLoad?: (tableSimulations: TableArrangemen
|
||||
id: record.id,
|
||||
name: record.name,
|
||||
discomfort: record.discomfort,
|
||||
valid: record.valid,
|
||||
});
|
||||
}));
|
||||
}, (error) => {
|
||||
|
@ -12,7 +12,8 @@ export type TableArrangement = {
|
||||
number: number;
|
||||
name: string;
|
||||
guests?: Guest[];
|
||||
discomfort?: number
|
||||
discomfort?: number;
|
||||
valid?: boolean;
|
||||
}
|
||||
|
||||
export type User = {
|
||||
|
@ -7,6 +7,8 @@ import { TableArrangement } from '@/app/lib/definitions';
|
||||
import { classNames } from "../components/button";
|
||||
import TableOfContents from "../components/table-of-contents";
|
||||
import { loadTableSimulations } from "@/app/api/tableSimulations";
|
||||
import { ArchiveBoxXMarkIcon, CheckBadgeIcon } from "@heroicons/react/24/outline";
|
||||
import { Tooltip } from "primereact/tooltip";
|
||||
|
||||
export default function ArrangementsTable({ onArrangementSelected }: { onArrangementSelected: (arrangementId: string) => void }) {
|
||||
const [arrangements, setArrangements] = useState<Array<TableArrangement>>([]);
|
||||
@ -27,7 +29,7 @@ export default function ArrangementsTable ({onArrangementSelected}: {onArrangeme
|
||||
|
||||
return (
|
||||
<TableOfContents
|
||||
headers={['Name', 'Discomfort', 'Actions']}
|
||||
headers={['Name', 'Discomfort', 'Actions', 'Status']}
|
||||
caption='Simulations'
|
||||
elements={arrangements}
|
||||
rowRender={(arrangement) => (
|
||||
@ -41,6 +43,15 @@ export default function ArrangementsTable ({onArrangementSelected}: {onArrangeme
|
||||
<td>
|
||||
<button data-arrangement-id={arrangement.id} onClick={arrangementClicked} className={classNames('primary')}>Load</button>
|
||||
</td>
|
||||
<td>
|
||||
<Tooltip target=".tooltip-status" />
|
||||
|
||||
{
|
||||
arrangement.valid ?
|
||||
<CheckBadgeIcon className='size-6 tooltip-status' data-pr-position="right" data-pr-tooltip="Simulation is valid" /> :
|
||||
<ArchiveBoxXMarkIcon className='size-6 tooltip-status' data-pr-position="right" data-pr-tooltip="Simulation is expired due to attendance or affinity changes" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user