diff --git a/frontend/src/components/CANs/CANBudgetLineTable/CANBudgetLineTable.jsx b/frontend/src/components/CANs/CANBudgetLineTable/CANBudgetLineTable.jsx index a52d7cf4eb..4d2f47647e 100644 --- a/frontend/src/components/CANs/CANBudgetLineTable/CANBudgetLineTable.jsx +++ b/frontend/src/components/CANs/CANBudgetLineTable/CANBudgetLineTable.jsx @@ -2,6 +2,7 @@ import { formatDateNeeded } from "../../../helpers/utils"; import Table from "../../UI/Table"; import { TABLE_HEADERS } from "./CABBudgetLineTable.constants"; import CANBudgetLineTableRow from "./CANBudgetLineTableRow"; +import { calculatePercent } from "../../../helpers/utils"; /** * @typedef {import("../../../components/BudgetLineItems/BudgetLineTypes").BudgetLine} BudgetLine */ @@ -9,6 +10,7 @@ import CANBudgetLineTableRow from "./CANBudgetLineTableRow"; /** * @typedef {Object} CANBudgetLineTableProps * @property {BudgetLine[]} budgetLines + * @property {number} totalFunding */ /** @@ -16,7 +18,7 @@ import CANBudgetLineTableRow from "./CANBudgetLineTableRow"; * @param {CANBudgetLineTableProps} props * @returns {JSX.Element} - The component JSX. */ -const CANBudgetLineTable = ({ budgetLines }) => { +const CANBudgetLineTable = ({ budgetLines, totalFunding }) => { if (budgetLines.length === 0) { return
No budget lines have been added to this CAN.
; } @@ -31,9 +33,9 @@ const CANBudgetLineTable = ({ budgetLines }) => { agreementName="TBD" obligateDate={formatDateNeeded(budgetLine.date_needed || "")} fiscalYear={budgetLine.fiscal_year || "TBD"} - amount={budgetLine.amount || 0} + amount={budgetLine.amount ?? 0} fee={budgetLine.proc_shop_fee_percentage} - percentOfCAN={3} + percentOfCAN={calculatePercent(budgetLine.amount ?? 0, totalFunding)} status={budgetLine.status} inReview={budgetLine.in_review} creatorId={budgetLine.created_by} diff --git a/frontend/src/pages/cans/detail/CanSpending.jsx b/frontend/src/pages/cans/detail/CanSpending.jsx index 517e47353c..11cb4286b8 100644 --- a/frontend/src/pages/cans/detail/CanSpending.jsx +++ b/frontend/src/pages/cans/detail/CanSpending.jsx @@ -84,7 +84,10 @@ const CanSpending = ({ budgetLines, fiscalYear, canId }) => {This is a list of all budget lines allocating funding from this CAN for the selected fiscal year.
-