Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Taxes - Edited tax is not grayed out in Tax list in submit manual flow. #42974

Merged
merged 4 commits into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/libs/actions/TaxRate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ function setPolicyTaxesEnabled(policyID: string, taxesIDsToUpdate: string[], isE
acc[taxID] = {
isDisabled: !isEnabled,
pendingFields: {isDisabled: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE},
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
errorFields: {isDisabled: null},
};
return acc;
Expand All @@ -214,7 +215,7 @@ function setPolicyTaxesEnabled(policyID: string, taxesIDsToUpdate: string[], isE
value: {
taxRates: {
taxes: taxesIDsToUpdate.reduce<TaxRateEnabledMap>((acc, taxID) => {
acc[taxID] = {pendingFields: {isDisabled: null}, errorFields: {isDisabled: null}};
acc[taxID] = {pendingFields: {isDisabled: null}, errorFields: {isDisabled: null}, pendingAction: null};
return acc;
}, {}),
},
Expand All @@ -231,6 +232,7 @@ function setPolicyTaxesEnabled(policyID: string, taxesIDsToUpdate: string[], isE
acc[taxID] = {
isDisabled: !!originalTaxes[taxID].isDisabled,
pendingFields: {isDisabled: null},
pendingAction: null,
errorFields: {isDisabled: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.error.updateFailureMessage')},
};
return acc;
Expand Down Expand Up @@ -346,6 +348,7 @@ function updatePolicyTaxValue(policyID: string, taxID: string, taxValue: number)
[taxID]: {
value: stringTaxValue,
pendingFields: {value: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE},
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
errorFields: {value: null},
},
},
Expand All @@ -360,7 +363,7 @@ function updatePolicyTaxValue(policyID: string, taxID: string, taxValue: number)
value: {
taxRates: {
taxes: {
[taxID]: {pendingFields: {value: null}, errorFields: {value: null}},
[taxID]: {pendingFields: {value: null}, pendingAction: null, errorFields: {value: null}},
},
},
},
Expand All @@ -376,6 +379,7 @@ function updatePolicyTaxValue(policyID: string, taxID: string, taxValue: number)
[taxID]: {
value: originalTaxRate.value,
pendingFields: {value: null},
pendingAction: null,
errorFields: {value: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.error.updateFailureMessage')},
},
},
Expand Down Expand Up @@ -408,6 +412,7 @@ function renamePolicyTax(policyID: string, taxID: string, newName: string) {
[taxID]: {
name: newName,
pendingFields: {name: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE},
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
errorFields: {name: null},
},
},
Expand All @@ -422,7 +427,7 @@ function renamePolicyTax(policyID: string, taxID: string, newName: string) {
value: {
taxRates: {
taxes: {
[taxID]: {pendingFields: {name: null}, errorFields: {name: null}},
[taxID]: {pendingFields: {name: null}, pendingAction: null, errorFields: {name: null}},
},
},
},
Expand All @@ -438,6 +443,7 @@ function renamePolicyTax(policyID: string, taxID: string, newName: string) {
[taxID]: {
name: originalTaxRate.name,
pendingFields: {name: null},
pendingAction: null,
errorFields: {name: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.error.updateFailureMessage')},
},
},
Expand Down
Loading