diff --git a/apps/infoalloggi/src/components/tables/ricerca-table.tsx b/apps/infoalloggi/src/components/tables/ricerca-table.tsx index a2892d5..bdc23e8 100644 --- a/apps/infoalloggi/src/components/tables/ricerca-table.tsx +++ b/apps/infoalloggi/src/components/tables/ricerca-table.tsx @@ -32,12 +32,20 @@ export const TabRicerca = ({ ); } + const first_choice = data.findIndex((s) => !s.isInterrotto && s.isOkAcconto); + const second_choice = data.findIndex((s) => !s.isInterrotto); + const getDefaultOpen = (idx: number) => { + if (first_choice !== -1) return idx === first_choice; + if (second_choice !== -1) return idx === second_choice; + return idx === 0; + }; + return (