"use client"; import { useState, useEffect } from "react"; import axios from "axios"; import { Tooltip } from "@/components/ui/tooltip"; const API_URL = "/api"; export function DataExplorer({ definitions }: { definitions: Record }) { const [data, setData] = useState([]); const [loading, setLoading] = useState(false); useEffect(() => { setLoading(true); axios.get(`${API_URL}/data/full?limit=200`).then(res => { setData(res.data); setLoading(false); }); }, []); const columns = [ "PO_NO", "Article", "Order Qty", "Reserver Qty as per Std Norms", "Actual Gr Opening", "Deviation", "Finish", "Route", "Product" ]; const getColumnLabel = (col: string) => { if (col === "PO_NO") return "PO (Production Order)"; if (col === "Reserver Qty as per Std Norms") return "Reserved Qty"; if (col === "Actual Gr Opening") return "Greige Issuance"; return col; }; if (loading) return
Loading Full Dataset...
; return (

Full Data Explorer

Top 200 Records
{columns.map(col => ( ))} {data.map((row, i) => ( ))}
{getColumnLabel(col)}
{row['PO_NO']} {row['Article']} {row['Order Qty']} {row['Reserver Qty as per Std Norms']} {row['Actual Gr Opening']} {row['Deviation'] > 0 ? "+" : ""}{row['Deviation']?.toFixed(1)} {row['Finish']} {row['Route']} {row['Product']}
) }