Skip to content

Commit

Permalink
fix bug display amount
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Jun 5, 2024
1 parent 197268b commit c0bd795
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
import useAutoFocusInput from '@hooks/useAutoFocusInput';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import Navigation from '@libs/Navigation/Navigation';
import {validateTaxClaimableValue} from '@libs/PolicyDistanceRatesUtils';
import type {SettingsNavigatorParamList} from '@navigation/types';
Expand All @@ -34,7 +35,10 @@ function PolicyDistanceRateTaxReclaimableEditPage({route, policy}: PolicyDistanc
const customUnit = customUnits[Object.keys(customUnits)[0]];
const rate = customUnit.rates[rateID];
const currency = rate.currency ?? CONST.CURRENCY.USD;
const currentTaxReclaimableOnValue = rate.attributes?.taxClaimablePercentage && rate.rate ? (rate.attributes.taxClaimablePercentage * rate.rate) / 100 : '';
const extraDecimals = 1;
const decimals = CurrencyUtils.getCurrencyDecimals(currency) + extraDecimals;
const currentTaxReclaimableOnValue = rate.attributes?.taxClaimablePercentage && rate.rate ? ((rate.attributes.taxClaimablePercentage * rate.rate) / 100).toFixed(decimals) : '';

const submitTaxReclaimableOn = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.POLICY_DISTANCE_RATE_TAX_RECLAIMABLE_ON_EDIT_FORM>) => {
DistanceRate.updateDistanceTaxClaimableValue(policyID, customUnit, [
{
Expand Down Expand Up @@ -81,7 +85,7 @@ function PolicyDistanceRateTaxReclaimableEditPage({route, policy}: PolicyDistanc
<InputWrapperWithRef
InputComponent={AmountForm}
inputID={INPUT_IDS.TAX_CLAIMABLE_VALUE}
extraDecimals={1}
extraDecimals={extraDecimals}
defaultValue={currentTaxReclaimableOnValue?.toString() ?? ''}
isCurrencyPressable={false}
currency={currency}
Expand Down

0 comments on commit c0bd795

Please sign in to comment.