fix: tax rates API and UI improvements

- Add @ToNumber() decorator to rate field for proper validation
- Fix getTaxRates to return { data: taxRates } response
- Fix useTaxRate URL typo and response handling
- Fix activate/inactivate endpoint methods and paths
- Apply TEXT_MUTED class to description and compound tax
- Add dark mode support for rate number display
This commit is contained in:
Ahmed Bouhuolia
2026-02-12 20:06:49 +02:00
parent 5a017104ce
commit e0d9a56a29
6 changed files with 31 additions and 23 deletions

View File

@@ -1,8 +1,8 @@
// @ts-nocheck
import React from 'react';
import { Intent, Tag } from '@blueprintjs/core';
import { Intent, Tag, Classes } from '@blueprintjs/core';
import { Align } from '@/constants';
import styled from 'styled-components';
import clsx from 'classnames';
const codeAccessor = (taxRate) => {
return (
@@ -28,13 +28,17 @@ const nameAccessor = (taxRate) => {
return (
<>
<span>{taxRate.name}</span>
{!!taxRate.is_compound && <CompoundText>(Compound tax)</CompoundText>}
{!!taxRate.is_compound && (
<span className={clsx(Classes.TEXT_MUTED)}>(Compound tax)</span>
)}
</>
);
};
const DescriptionAccessor = (taxRate) => {
return <DescriptionText>{taxRate.description}</DescriptionText>;
return (
<span className={clsx(Classes.TEXT_MUTED)}>{taxRate.description}</span>
);
};
/**
@@ -72,11 +76,3 @@ export const useTaxRatesTableColumns = () => {
];
};
const CompoundText = styled('span')`
color: #738091;
margin-left: 5px;
`;
const DescriptionText = styled('span')`
color: #5f6b7c;
`;

View File

@@ -74,9 +74,13 @@ const TaxRateHeader = styled(`div`)`
const TaxRateAmount = styled('div')`
line-height: 1;
font-size: 30px;
color: #565b71;
font-weight: 600;
display: inline-block;
color: var(--x-color-amount-text, #565b71);
.bp4-dark & {
color: rgba(255, 255, 255, 0.9);
}
`;
const TaxRateActiveTag = styled(Tag)`