"use client"; import { QcItemInfo } from "@/app/api/settings/qcCategory"; import { Box, Card, CircularProgress, Divider, List, ListItem, Stack, Typography, } from "@mui/material"; import { CheckCircleOutline, FormatListNumbered } from "@mui/icons-material"; import { useTranslation } from "react-i18next"; type Props = { qcItems: QcItemInfo[]; loading?: boolean; categorySelected?: boolean; }; const QcItemsList: React.FC = ({ qcItems, loading = false, categorySelected = false, }) => { const { t } = useTranslation("items"); // Sort items by order const sortedItems = [...qcItems].sort((a, b) => a.order - b.order); if (loading) { return ( {t("Loading QC items...")} ); } if (!categorySelected) { return ( {t("Select a QC template to view items")} ); } if (sortedItems.length === 0) { return ( {t("No QC items in this template")} ); } return ( {t("QC Checklist")} ({sortedItems.length}) {sortedItems.map((item, index) => ( {index > 0 && } {/* Order Number */} {item.order}. {/* Content */} {item.name || item.code} {item.description && ( {item.description} )} ))} ); }; export default QcItemsList;