FPSMS-frontend
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

50 Zeilen
2.0 KiB

  1. import { DetailedProdScheduleLineProdTimeResult } from "@/app/api/scheduling"
  2. import { minutesToHoursMinutes } from "@/app/utils/formatUtil";
  3. import { Box, Divider, Grid, Typography } from "@mui/material";
  4. import React, { useMemo } from "react"
  5. import { useTranslation } from "react-i18next";
  6. interface Props {
  7. prodTimeInMinute: DetailedProdScheduleLineProdTimeResult[];
  8. }
  9. const ProdTimeColumn: React.FC<Props> = ({ prodTimeInMinute }) => {
  10. const { t } = useTranslation("schedule")
  11. const overallMinutes = useMemo(() =>
  12. prodTimeInMinute
  13. .map((ele) => ele.totalMinutes)
  14. .reduce((acc, cur) => acc + cur, 0)
  15. , [])
  16. return (
  17. <Box>
  18. {
  19. prodTimeInMinute.map(({ equipName, totalMinutes }, index) => {
  20. return (
  21. <Grid container key={`${equipName}-${index}`}>
  22. <Grid item key={`${equipName}-${index}-1`} xs={4} sx={{ display: 'flex', justifyContent: 'flex-end' }}>
  23. <Typography>{equipName}:</Typography>
  24. </Grid>
  25. <Grid item key={`${equipName}-${index}-2`} xs={8} sx={{ display: 'flex', justifyContent: 'flex-end' }}>
  26. <Typography>{minutesToHoursMinutes(totalMinutes)}</Typography>
  27. </Grid>
  28. </Grid>
  29. )
  30. })
  31. }
  32. <Divider sx={{ border: 1, borderColor: "darkgray" }} />
  33. <Grid container>
  34. <Grid item xs={4} sx={{ display: 'flex', justifyContent: 'flex-end' }}>
  35. <Typography>{t("Overall")}:</Typography>
  36. </Grid>
  37. <Grid item xs={8} sx={{ display: 'flex', justifyContent: 'flex-end' }}>
  38. <Typography>{minutesToHoursMinutes(overallMinutes)}</Typography>
  39. </Grid>
  40. </Grid>
  41. </Box>
  42. )
  43. }
  44. export default ProdTimeColumn