mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat(webapp): tax rates empty state
This commit is contained in:
@@ -8,7 +8,6 @@ import {
|
|||||||
Icon,
|
Icon,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { AbilitySubject, TaxRateAction } from '@/constants/abilityOption';
|
import { AbilitySubject, TaxRateAction } from '@/constants/abilityOption';
|
||||||
import { useTaxRatesLandingContext } from './TaxRatesLandingProvider';
|
|
||||||
|
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
|
||||||
@@ -22,9 +21,6 @@ function TaxRatesActionsBar({
|
|||||||
// #withDialogActions
|
// #withDialogActions
|
||||||
openDialog,
|
openDialog,
|
||||||
}) {
|
}) {
|
||||||
// Items list context.
|
|
||||||
const {} = useTaxRatesLandingContext();
|
|
||||||
|
|
||||||
// Handle `new item` button click.
|
// Handle `new item` button click.
|
||||||
const onClickNewItem = () => {
|
const onClickNewItem = () => {
|
||||||
openDialog(DialogsName.TaxRateForm);
|
openDialog(DialogsName.TaxRateForm);
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button, Intent } from '@blueprintjs/core';
|
import { Button, Intent } from '@blueprintjs/core';
|
||||||
import { useHistory } from 'react-router-dom';
|
import * as R from 'ramda';
|
||||||
import { EmptyStatus, Can, FormattedMessage as T } from '@/components';
|
import { EmptyStatus, Can, FormattedMessage as T } from '@/components';
|
||||||
import { SaleInvoiceAction, AbilitySubject } from '@/constants/abilityOption';
|
import { SaleInvoiceAction, AbilitySubject } from '@/constants/abilityOption';
|
||||||
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
export function TaxRatesLandingEmptyState() {
|
function TaxRatesLandingEmptyStateRoot({
|
||||||
const history = useHistory();
|
// #withDialogAction
|
||||||
|
openDialog,
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<EmptyStatus
|
<EmptyStatus
|
||||||
title={<T id={'the_organization_doesn_t_receive_money_yet'} />}
|
title={"The organization doesn't have taxes, yet!"}
|
||||||
description={
|
description={
|
||||||
<p>
|
<p>
|
||||||
<T id={'invoices_empty_status_description'} />
|
Setup the organization taxes to start tracking taxes on sales
|
||||||
|
transactions.
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
action={
|
action={
|
||||||
@@ -23,10 +27,10 @@ export function TaxRatesLandingEmptyState() {
|
|||||||
intent={Intent.PRIMARY}
|
intent={Intent.PRIMARY}
|
||||||
large={true}
|
large={true}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
history.push('/invoices/new');
|
openDialog(DialogsName.TaxRateForm);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<T id={'new_sale_invoice'} />
|
New tax rate
|
||||||
</Button>
|
</Button>
|
||||||
<Button intent={Intent.NONE} large={true}>
|
<Button intent={Intent.NONE} large={true}>
|
||||||
<T id={'learn_more'} />
|
<T id={'learn_more'} />
|
||||||
@@ -37,3 +41,7 @@ export function TaxRatesLandingEmptyState() {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const TaxRatesLandingEmptyState = R.compose(withDialogActions)(
|
||||||
|
TaxRatesLandingEmptyStateRoot,
|
||||||
|
);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export function useDeleteTaxRate(props) {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation((id) => apiRequest.post(`tax-rates/${id}`), {
|
return useMutation((id) => apiRequest.delete(`tax-rates/${id}`), {
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, id) => {
|
||||||
commonInvalidateQueries(queryClient);
|
commonInvalidateQueries(queryClient);
|
||||||
queryClient.invalidateQueries([QUERY_TYPES.TAX_RATES, id]);
|
queryClient.invalidateQueries([QUERY_TYPES.TAX_RATES, id]);
|
||||||
@@ -120,7 +120,7 @@ export function useInactivateTaxRate(props) {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation((id) => apiRequest.delete(`tax-rates/${id}/inactive`), {
|
return useMutation((id) => apiRequest.post(`tax-rates/${id}/inactive`), {
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, id) => {
|
||||||
commonInvalidateQueries(queryClient);
|
commonInvalidateQueries(queryClient);
|
||||||
queryClient.invalidateQueries([QUERY_TYPES.TAX_RATES, id]);
|
queryClient.invalidateQueries([QUERY_TYPES.TAX_RATES, id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user