import { Box, Grid, Typography } from "@mui/material"; import RadialBarSemiCircularChart from "./RadialBarSemiCircularChart"; import { useTranslations } from "next-intl"; // Make sure to import React if it's not already imported const ReferredCharts = ({ reportList }) => { const t = useTranslations(); const DataItemsName = [ { id: "referred_loans_to_bank", name: t("reports.referred_loans_to_bank") }, { id: "paid_loans", name: t("reports.paid_loans") }, ]; return ( {Object.entries(reportList).map(([entryKey, innerObject]) => { const ItemName = DataItemsName.find((item) => item.id === entryKey).name; return ( {ItemName} {innerObject.map((item, index) => { let percentage = item.total_budget !== 0 ? (item.total_amount / item.total_budget) * 100 : 0; return ( {item.vehicle_type} {t("reports.dynamic_total_budget", { total_budget: (item.total_budget / 1000000).toLocaleString("en"), })} 100 ? 100 : percentage)} formatter={(val) => `${Math.round(percentage)}%`} label={t("reports.dynamic_label_referred", { count: item.count.toLocaleString("en"), total_amount: (item.total_amount / 1000000).toLocaleString("en"), })} /> ); })} ); })} ); }; export default ReferredCharts;