export function getFieldValue(item: any, field: string): any { if (!item) return ""; if (field.includes(".")) { const parts = field.split("."); let value = item; for (const part of parts) { if (value === null || value === undefined) return ""; value = value[part]; } return value; } return item[field]; } export function getFieldLabel( field: string, translations: Record, lang: string ): string { const t = translations[lang] || {}; return ( t[field] || field.charAt(0).toUpperCase() + field.slice(1).replace(/_/g, " ") ); } export function getGridClasses(gridCols: 1 | 2 | 3 | 4 | 5 | 6): string { const baseClass = "grid grid-cols-1 gap-4"; const colClasses: Record = { 1: "", 2: "sm:grid-cols-2", 3: "sm:grid-cols-2 md:grid-cols-3", 4: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4", 5: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5", 6: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6", }; return `${baseClass} ${colClasses[gridCols]}`; }