mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
fix(webapp): code cleanup
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
ExpenseAction,
|
||||
CashflowAction,
|
||||
PreferencesAbility,
|
||||
TaxRateAction,
|
||||
} from '@/constants/abilityOption';
|
||||
import { DialogsName } from './dialogs';
|
||||
|
||||
@@ -410,6 +411,10 @@ export const SidebarMenu = [
|
||||
text: 'Tax Rates',
|
||||
href: '/tax-rates',
|
||||
type: ISidebarMenuItemType.Link,
|
||||
permission: {
|
||||
subject: AbilitySubject.TaxRate,
|
||||
ability: TaxRateAction.View,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ import { FastField } from 'formik';
|
||||
import ItemsEntriesTable from '@/containers/Entries/ItemsEntriesTable';
|
||||
import { useInvoiceFormContext } from './InvoiceFormProvider';
|
||||
import { entriesFieldShouldUpdate } from './utils';
|
||||
import { TaxType } from '@/interfaces/TaxRates';
|
||||
|
||||
/**
|
||||
* Invoice items entries editor field.
|
||||
@@ -33,7 +34,7 @@ export default function InvoiceItemsEntriesEditorField() {
|
||||
errors={error}
|
||||
linesNumber={4}
|
||||
currencyCode={values.currency_code}
|
||||
isInclusiveTax={values.inclusive_exclusive_tax === 'inclusive'}
|
||||
isInclusiveTax={values.inclusive_exclusive_tax === TaxType.Inclusive}
|
||||
/>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import { TaxType } from '@/interfaces/TaxRates';
|
||||
|
||||
export const InclusiveButtonOptions = [
|
||||
{ key: 'inclusive', label: 'Inclusive of Tax' },
|
||||
{ key: 'exclusive', label: 'Exclusive of Tax' },
|
||||
{ key: TaxType.Inclusive, label: 'Inclusive of Tax' },
|
||||
{ key: TaxType.Exclusive, label: 'Exclusive of Tax' },
|
||||
];
|
||||
|
||||
@@ -46,7 +46,7 @@ export const defaultInvoice = {
|
||||
due_date: moment().format('YYYY-MM-DD'),
|
||||
delivered: '',
|
||||
invoice_no: '',
|
||||
inclusive_exclusive_tax: 'inclusive',
|
||||
inclusive_exclusive_tax: TaxType.Inclusive,
|
||||
// Holds the invoice number that entered manually only.
|
||||
invoice_no_manually: '',
|
||||
reference_no: '',
|
||||
@@ -172,8 +172,10 @@ export function transformValueToRequest(values) {
|
||||
...(values.invoice_no_manually && {
|
||||
invoice_no: values.invoice_no,
|
||||
}),
|
||||
is_inclusive_tax: values.inclusive_exclusive_tax === 'inclusive',
|
||||
entries: entries.map((entry) => ({ ...omit(entry, ['amount']) })),
|
||||
is_inclusive_tax: values.inclusive_exclusive_tax === TaxType.Inclusive,
|
||||
entries: entries.map((entry) => ({
|
||||
...omit(entry, ['amount', 'tax_amount', 'tax_rate']),
|
||||
})),
|
||||
delivered: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import { useDeleteTaxRate } from '@/hooks/query/taxRates';
|
||||
|
||||
import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
|
||||
import withAlertActions from '@/containers/Alert/withAlertActions';
|
||||
import withItemsActions from '@/containers/Items/withItemsActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
@@ -51,7 +50,10 @@ function TaxRateDeleteAlert({
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
// handleDeleteErrors(errors);
|
||||
AppToaster.show({
|
||||
message: 'Something went wrong.',
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
},
|
||||
)
|
||||
.finally(() => {
|
||||
@@ -86,6 +88,5 @@ function TaxRateDeleteAlert({
|
||||
export default compose(
|
||||
withAlertStoreConnect(),
|
||||
withAlertActions,
|
||||
withItemsActions,
|
||||
withDrawerActions,
|
||||
)(TaxRateDeleteAlert);
|
||||
|
||||
@@ -4,8 +4,6 @@ import React from 'react';
|
||||
const TaxRateDeleteAlert = React.lazy(() => import('./TaxRateDeleteAlert'));
|
||||
|
||||
/**
|
||||
* Project alerts.
|
||||
* Tax rates alerts.
|
||||
*/
|
||||
export default [
|
||||
{ name: 'tax-rate-delete', component: TaxRateDeleteAlert },
|
||||
];
|
||||
export default [{ name: 'tax-rate-delete', component: TaxRateDeleteAlert }];
|
||||
|
||||
@@ -29,7 +29,7 @@ function TaxRatesLandingProvider({ tableState, ...props }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardInsider name={'cashflow-accounts'}>
|
||||
<DashboardInsider name={'tax-rate-form'}>
|
||||
<TaxRatesLandingContext.Provider value={provider} {...props} />
|
||||
</DashboardInsider>
|
||||
);
|
||||
|
||||
@@ -9,12 +9,8 @@ const TaxRateFormDialogContent = lazy(
|
||||
() => import('./TaxRateFormDialogContent'),
|
||||
);
|
||||
|
||||
const TaxRateDialog = styled(Dialog)`
|
||||
max-width: 450px;
|
||||
`;
|
||||
|
||||
/**
|
||||
* Account form dialog.
|
||||
* Tax rate form dialog.
|
||||
*/
|
||||
function TaxRateFormDialog({
|
||||
dialogName,
|
||||
@@ -39,4 +35,8 @@ function TaxRateFormDialog({
|
||||
);
|
||||
}
|
||||
|
||||
const TaxRateDialog = styled(Dialog)`
|
||||
max-width: 450px;
|
||||
`;
|
||||
|
||||
export default compose(withDialogRedux())(TaxRateFormDialog);
|
||||
|
||||
@@ -9,7 +9,7 @@ interface TaxRateFormDialogContentProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* Account dialog content.
|
||||
* Tax rate form dialog content.
|
||||
*/
|
||||
export default function TaxRateFormDialogContent({
|
||||
dialogName,
|
||||
|
||||
@@ -445,13 +445,12 @@ export function useTransactionsByReference(query, props) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Retrieves the sales tax liability summary report.
|
||||
*/
|
||||
export function useSalesTaxLiabilitySummary(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.BALANCE_SHEET, query],
|
||||
[t.FINANCIAL_REPORT, t.SALES_TAX_LIABILITY_SUMMARY, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/sales-tax-liability-summary',
|
||||
|
||||
@@ -32,6 +32,7 @@ const FINANCIAL_REPORTS = {
|
||||
REALIZED_GAIN_OR_LOSS: 'REALIZED_GAIN_OR_LOSS',
|
||||
UNREALIZED_GAIN_OR_LOSS: 'UNREALIZED_GAIN_OR_LOSS',
|
||||
PROJECT_PROFITABILITY_SUMMARY: 'PROJECT_PROFITABILITY_SUMMARY',
|
||||
SALES_TAX_LIABILITY_SUMMARY: 'SALES_TAX_LIABILITY_SUMMARY'
|
||||
};
|
||||
|
||||
const BILLS = {
|
||||
|
||||
@@ -1076,6 +1076,7 @@ export const getDashboardRoutes = () => [
|
||||
import('@/containers/TaxRates/pages/TaxRatesLanding'),
|
||||
),
|
||||
pageTitle: 'Tax Rates',
|
||||
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
||||
},
|
||||
// Homepage
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user