Skip to content

Commit

Permalink
Refactor months in table into loop
Browse files Browse the repository at this point in the history
  • Loading branch information
CaitBarnard committed Jan 13, 2025
1 parent eebbf42 commit 510e0ba
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions front_end/src/Components/EditPayroll/ForecastTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,11 @@ export default function ForecastTable({ forecast, months }) {
<th scope="row" className="govuk-table__header">
{row.natural_account_code}
</th>
<td className="govuk-table__cell">£{formatMoney(row.apr)}</td>
<td className="govuk-table__cell">£{formatMoney(row.may)}</td>
<td className="govuk-table__cell">£{formatMoney(row.jun)}</td>
<td className="govuk-table__cell">£{formatMoney(row.jul)}</td>
<td className="govuk-table__cell">£{formatMoney(row.aug)}</td>
<td className="govuk-table__cell">£{formatMoney(row.sep)}</td>
<td className="govuk-table__cell">£{formatMoney(row.oct)}</td>
<td className="govuk-table__cell">£{formatMoney(row.nov)}</td>
<td className="govuk-table__cell">£{formatMoney(row.dec)}</td>
<td className="govuk-table__cell">£{formatMoney(row.jan)}</td>
<td className="govuk-table__cell">£{formatMoney(row.feb)}</td>
<td className="govuk-table__cell">£{formatMoney(row.mar)}</td>
{months.map((month) => (
<td className="govuk-table__cell" key={month}>
£{formatMoney(row[month.toLowerCase()])}
</td>
))}
</tr>
);
})}
Expand Down

0 comments on commit 510e0ba

Please sign in to comment.