feat: empty status ability.

This commit is contained in:
elforjani13
2021-11-24 11:47:18 +02:00
parent cc1f4cc26b
commit aef8eb7907
11 changed files with 213 additions and 143 deletions

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
AbilitySubject,
Manual_Journal_Abilities,
} from '../../../common/abilityOption';
export default function ManualJournalsEmptyStatus() { export default function ManualJournalsEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +21,10 @@ export default function ManualJournalsEmptyStatus() {
} }
action={ action={
<> <>
<Can
I={Manual_Journal_Abilities.Create}
a={AbilitySubject.ManualJournal}
>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -30,6 +38,7 @@ export default function ManualJournalsEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
AbilitySubject,
Customer_Abilities,
} from '../../../common/abilityOption';
export default function CustomersEmptyStatus() { export default function CustomersEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +21,7 @@ export default function CustomersEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Customer_Abilities.Create} a={AbilitySubject.Customer}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -30,6 +35,7 @@ export default function CustomersEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
AbilitySubject,
Expense_Abilities,
} from '../../../common/abilityOption';
export default function InvoicesEmptyStatus() { export default function InvoicesEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +21,7 @@ export default function InvoicesEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Expense_Abilities.Create} a={AbilitySubject.Expense}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -30,6 +35,7 @@ export default function InvoicesEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,8 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import { Item_Abilities, AbilitySubject } from '../../common/abilityOption';
export default function ItemsEmptyStatus() { export default function ItemsEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +18,7 @@ export default function ItemsEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Item_Abilities.Create} a={AbilitySubject.Item}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -30,6 +32,7 @@ export default function ItemsEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
Bill_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function BillsEmptyStatus() { export default function BillsEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +21,7 @@ export default function BillsEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Bill_Abilities.Create} a={AbilitySubject.Bill}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -30,6 +35,7 @@ export default function BillsEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
Payment_Made_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function PaymentMadesEmptyStatus() { export default function PaymentMadesEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +21,7 @@ export default function PaymentMadesEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Payment_Made_Abilities.Create} a={AbilitySubject.PaymentMade}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -30,6 +35,7 @@ export default function PaymentMadesEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
Estimate_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function EstimatesEmptyStatus() { export default function EstimatesEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -16,6 +20,7 @@ export default function EstimatesEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Estimate_Abilities.Create} a={AbilitySubject.Estimate}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -28,6 +33,7 @@ export default function EstimatesEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
Invoice_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function EstimatesEmptyStatus() { export default function EstimatesEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +21,7 @@ export default function EstimatesEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Invoice_Abilities.Create} a={AbilitySubject.Invoice}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -26,10 +31,10 @@ export default function EstimatesEmptyStatus() {
> >
<T id={'new_sale_invoice'} /> <T id={'new_sale_invoice'} />
</Button> </Button>
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
Payment_Receive_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function PaymentReceivesEmptyStatus() { export default function PaymentReceivesEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -12,11 +16,17 @@ export default function PaymentReceivesEmptyStatus() {
title={<T id={'the_organization_doesn_t_receive_money_yet'} />} title={<T id={'the_organization_doesn_t_receive_money_yet'} />}
description={ description={
<p> <p>
<T id={'receiving_customer_payments_is_one_pleasant_accounting_tasks'} /> <T
id={'receiving_customer_payments_is_one_pleasant_accounting_tasks'}
/>
</p> </p>
} }
action={ action={
<> <>
<Can
I={Payment_Receive_Abilities.Create}
a={AbilitySubject.PaymentReceive}
>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -30,6 +40,7 @@ export default function PaymentReceivesEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
Receipt_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function ReceiptsEmptyStatus() { export default function ReceiptsEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +21,7 @@ export default function ReceiptsEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Receipt_Abilities.Create} a={AbilitySubject.Receipt}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -28,8 +33,9 @@ export default function ReceiptsEmptyStatus() {
</Button> </Button>
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'}/> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core'; import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components'; import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components'; import { Can, FormattedMessage as T } from 'components';
import {
Vendor_Abilities,
AbilitySubject,
} from '../../../common/abilityOption';
export default function VendorsEmptyStatus() { export default function VendorsEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,6 +21,7 @@ export default function VendorsEmptyStatus() {
} }
action={ action={
<> <>
<Can I={Vendor_Abilities.Create} a={AbilitySubject.Vendor}>
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
large={true} large={true}
@@ -30,6 +35,7 @@ export default function VendorsEmptyStatus() {
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />