Skip to content

Commit

Permalink
fix: reset form calculation if there's change in apprenticeship
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast committed Mar 6, 2024
1 parent 3ac9dcd commit 99b09bf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions frontend/benefit/handler/src/hooks/useFormActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ const useFormActions = (
values: Partial<Application>
): Calculation => {
// Return the calculation values as they are
if (values.paySubsidyGranted === initialApplication?.paySubsidyGranted) {
if (
values.paySubsidyGranted === initialApplication?.paySubsidyGranted &&
values.apprenticeshipProgram === initialApplication?.apprenticeshipProgram
) {
return {
...values.calculation,
monthlyPay: stringToFloatValue(values.employee.monthlyPay),
Expand All @@ -196,7 +199,10 @@ const useFormActions = (
const getPayloadForPaySubsidies = (
values: Partial<Application>
): PaySubsidy[] => {
if (values.paySubsidyGranted === initialApplication?.paySubsidyGranted) {
if (
values.paySubsidyGranted === initialApplication?.paySubsidyGranted &&
values.apprenticeshipProgram === initialApplication?.apprenticeshipProgram
) {
return [...values.paySubsidies];
}
return [
Expand Down

0 comments on commit 99b09bf

Please sign in to comment.