'use client'; import { FolderTable, PlansModel } from '@/models/plans.model'; import { v4 } from 'uuid'; export interface IColumn { name: string; propertyId: string; } interface IProps { columns: FolderTable; data: FolderTable[]; plan: number; } const columnName = { time: 'Wagt aralygy', price: 'Bahasy', set_tv: 'TV', set_aydym: 'aydym.com', set_radio: 'Radio', set_belet: 'Belet', set_sub: 'Subtitle', set_web: 'Website', set_outside_monitors: 'LED', }; const Table = ({ columns, data, plan }: IProps) => { const cols = Object.keys(columns); const gridCols = cols.length; return (
{cols.map((col, id) => ( {plan == 3 && columnName[col as keyof typeof columnName] === 'Subtitle' ? 'Flyer' : columnName[col as keyof typeof columnName]} ))}
{data.map((item, index) => { const keys = Object.keys(item); return index % 2 === 0 ? (
{keys.map((key, id) => ( {item[key as keyof typeof item]} ))}
) : (
{keys.map((key, id) => ( {item[key as keyof typeof item]} ))}
); })}
); }; export default Table;