/* eslint-disable @typescript-eslint/no-explicit-any */ import React from "react"; import RequiredStar from "../RequiredStar"; interface PackageDetail { weight: string; length: string; width: string; height: string; package_description: string; customer_input_package_value: string; } interface PackageGridProps { packages: PackageDetail[]; onChange: (updatedPackages: PackageDetail[]) => void; errors?: any; } const PackageGrid: React.FC = ({ packages, onChange, errors, }) => { const handleInputChange = ( index: number, field: keyof PackageDetail, value: string ) => { const updated = [...packages]; updated[index] = { ...updated[index], [field]: value }; onChange(updated); }; return (
{packages.map((pkg, index) => (
{/* WEIGHT */}
handleInputChange(index, "weight", e.target.value) } placeholder="0 KG" />
{/* LENGTH */}
handleInputChange(index, "length", e.target.value) } placeholder="0" />
{errors?.[index]?.length}
{/* WIDTH */}
handleInputChange(index, "width", e.target.value) } placeholder="0" />
{errors?.[index]?.width}
{/* HEIGHT */}
handleInputChange(index, "height", e.target.value) } placeholder="0" />
{errors?.[index]?.height}
{/* DESCRIPTION */}
handleInputChange( index, "package_description", e.target.value ) } placeholder="Enter description" />
{/* PACKAGE VALUE */}
handleInputChange( index, "customer_input_package_value", e.target.value ) } placeholder="Package Value" />
{errors?.[index]?.customer_input_package_value}
))}
); }; export default PackageGrid;