Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 8 additions & 5 deletions src/components/TransactionItemRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
isAmountMissing,
isMerchantMissing,
isScanning,
isTimeRequest,
isUnreportedAndHasInvalidDistanceRateTransaction,
} from '@libs/TransactionUtils';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -528,18 +529,20 @@ function TransactionItemRow({
key={CONST.SEARCH.TABLE_COLUMNS.TAX_RATE}
style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TAX_RATE)]}
>
<TextCell text={getTaxName(transactionItem.policy, transactionItem) ?? transactionItem.taxValue ?? ''} />
<TextCell text={isTimeRequest(transactionItem) ? '' : (getTaxName(transactionItem.policy, transactionItem) ?? transactionItem.taxValue ?? '')} />
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: (
<View
key={CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT}
style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT, undefined, undefined, isTaxAmountColumnWide)]}
>
<TaxCell
transactionItem={transactionItem}
shouldShowTooltip={shouldShowTooltip}
/>
{isTimeRequest(transactionItem) ? null : (
<TaxCell
transactionItem={transactionItem}
shouldShowTooltip={shouldShowTooltip}
/>
)}
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: (
Expand Down
26 changes: 26 additions & 0 deletions tests/ui/TransactionItemRowRBRTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,32 @@ describe('TransactionItemRowRBR', () => {
expect(screen.getByText('Unexpected error posting the comment. Please try again later. Missing category.')).toBeOnTheScreen();
});

it('should not display tax columns for time expense transactions', async () => {
const mockTimeTransaction = createBaseTransaction({
iouRequestType: CONST.IOU.REQUEST_TYPE.TIME,
taxAmount: 1000,
taxCode: 'TAX_CODE_1',
taxValue: '10%',
});
await Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${MOCK_TRANSACTION_ID}`, mockTimeTransaction);

render(
<ComposeProviders components={[OnyxListItemProvider, LocaleContextProvider, HTMLEngineProvider]}>
<TransactionItemRow
transactionItem={mockTimeTransaction}
violations={undefined}
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultProps}
columns={[CONST.SEARCH.TABLE_COLUMNS.TAX_RATE, CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]}
/>
</ComposeProviders>,
);
await waitForBatchedUpdates();

expect(screen.queryByText('10%')).not.toBeOnTheScreen();
expect(screen.queryByText('$10.00')).not.toBeOnTheScreen();
});

it('should display RBR message for transaction with violations, errors, and missing merchant error', async () => {
// Given a transaction with violations, errors, and missing merchant error
const mockViolations: TransactionViolations = [
Expand Down
Loading