Skip to content

Commit

Permalink
Merge pull request #42974 from Krishna2323/krishna2323/issue/42918
Browse files Browse the repository at this point in the history
fix: Taxes - Edited tax is not grayed out in Tax list in submit manual flow.
  • Loading branch information
MonilBhavsar authored Jun 12, 2024
2 parents 073ce7f + 36e98ca commit 9376991
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit 9376991

Please sign in to comment.