Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

47 righe
1.5 KiB

  1. import { CreateInvoiceInputs } from "@/app/api/invoices/actions";
  2. import { CreateProjectInputs } from "@/app/api/projects/actions";
  3. import { TaskGroup } from "@/app/api/tasks";
  4. import { moneyFormatter } from "@/app/utils/formatUtil";
  5. import { Divider, Stack, Typography } from "@mui/material";
  6. import React from "react";
  7. import { useFormContext } from "react-hook-form";
  8. import { useTranslation } from "react-i18next";
  9. const ProjectTotalFee: React.FC= ({}) => {
  10. const { t } = useTranslation();
  11. const { watch } = useFormContext<CreateInvoiceInputs>();
  12. const amount = watch("amount");
  13. let projectTotal = 0;
  14. return (
  15. <Stack spacing={1}>
  16. {/* {taskGroups.map((group, index) => {
  17. const payments = milestones[group.id]?.payments || [];
  18. const paymentTotal = payments.reduce((acc, p) => acc + p.amount, 0);
  19. projectTotal += paymentTotal;
  20. return (
  21. <Stack
  22. key={`${group.id}-${index}`}
  23. direction="row"
  24. justifyContent="space-between"
  25. >
  26. <Typography variant="subtitle2">{group.name}</Typography>
  27. <Typography>{moneyFormatter.format(paymentTotal)}</Typography>
  28. </Stack>
  29. );
  30. })} */}
  31. <Divider sx={{ paddingBlockStart: 2 }} />
  32. <Stack direction="row" justifyContent="space-between">
  33. <Typography variant="h6">{t("Project Total Fee")}</Typography>
  34. <Typography>{moneyFormatter.format(amount ? projectTotal += amount : projectTotal)}</Typography>
  35. </Stack>
  36. </Stack>
  37. );
  38. };
  39. export default ProjectTotalFee;