Skip to content

Commit

Permalink
WIP fix pay periods toggle and save for vacancies
Browse files Browse the repository at this point in the history
  • Loading branch information
CaitBarnard committed Nov 21, 2024
1 parent 311152f commit c55b258
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion front_end/src/Apps/Payroll.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default function Payroll() {
async function handleSavePayroll() {
try {
await api.postPayrollData(allPayroll);
await api.postVacancyData(vacancies);

setSaveSuccess(true);
localStorage.setItem("saveSuccess", "true");
Expand All @@ -64,6 +65,10 @@ export default function Payroll() {
dispatch({ type: "updatePayPeriods", employeeNo, index, enabled });
}

function handleToggleVacancyPayPeriods(id, index, enabled) {
dispatchVacancies({ type: "updatePayPeriods", id, index, enabled });
}

return (
<>
{saveSuccess && (
Expand Down Expand Up @@ -96,7 +101,7 @@ export default function Payroll() {
<EditPayroll
payroll={vacancies}
headers={vacancyHeaders}
onTogglePayPeriods={handleTogglePayPeriods}
onTogglePayPeriods={handleToggleVacancyPayPeriods}
RowComponent={VacancyRow}
/>
<button className="govuk-button" onClick={handleSavePayroll}>
Expand Down

0 comments on commit c55b258

Please sign in to comment.