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,19 +21,24 @@ export default function ManualJournalsEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can
intent={Intent.PRIMARY} I={Manual_Journal_Abilities.Create}
large={true} a={AbilitySubject.ManualJournal}
onClick={() => {
history.push('/make-journal-entry');
}}
> >
<T id={'make_journal'} /> <Button
</Button> intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/make-journal-entry');
}}
>
<T id={'make_journal'} />
</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 {
AbilitySubject,
Customer_Abilities,
} from '../../../common/abilityOption';
export default function CustomersEmptyStatus() { export default function CustomersEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,19 +21,21 @@ export default function CustomersEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Customer_Abilities.Create} a={AbilitySubject.Customer}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/customers/new'); onClick={() => {
}} history.push('/customers/new');
> }}
<T id={'new_customer'} /> >
</Button> <T id={'new_customer'} />
</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 {
AbilitySubject,
Expense_Abilities,
} from '../../../common/abilityOption';
export default function InvoicesEmptyStatus() { export default function InvoicesEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,19 +21,21 @@ export default function InvoicesEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Expense_Abilities.Create} a={AbilitySubject.Expense}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/expenses/new'); onClick={() => {
}} history.push('/expenses/new');
> }}
<T id={'new_expense'} /> >
</Button> <T id={'new_expense'} />
</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,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,19 +18,21 @@ export default function ItemsEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Item_Abilities.Create} a={AbilitySubject.Item}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/items/new'); onClick={() => {
}} history.push('/items/new');
> }}
<T id={'new_item'} /> >
</Button> <T id={'new_item'} />
</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 {
Bill_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function BillsEmptyStatus() { export default function BillsEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,19 +21,21 @@ export default function BillsEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Bill_Abilities.Create} a={AbilitySubject.Bill}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/bills/new'); onClick={() => {
}} history.push('/bills/new');
> }}
<T id={'new_bill'} /> >
</Button> <T id={'new_bill'} />
</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_Made_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function PaymentMadesEmptyStatus() { export default function PaymentMadesEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,19 +21,21 @@ export default function PaymentMadesEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Payment_Made_Abilities.Create} a={AbilitySubject.PaymentMade}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/payment-mades/new'); onClick={() => {
}} history.push('/payment-mades/new');
> }}
<T id={'new_bill_payment'} /> >
</Button> <T id={'new_bill_payment'} />
</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 {
Estimate_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function EstimatesEmptyStatus() { export default function EstimatesEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -16,18 +20,20 @@ export default function EstimatesEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Estimate_Abilities.Create} a={AbilitySubject.Estimate}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/estimates/new'); onClick={() => {
}} history.push('/estimates/new');
> }}
<T id={'new_sale_estimate'} /> >
</Button> <T id={'new_sale_estimate'} />
<Button intent={Intent.NONE} large={true}> </Button>
<T id={'learn_more'} /> <Button intent={Intent.NONE} large={true}>
</Button> <T id={'learn_more'} />
</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,19 +21,20 @@ export default function EstimatesEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Invoice_Abilities.Create} a={AbilitySubject.Invoice}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/invoices/new'); onClick={() => {
}} history.push('/invoices/new');
> }}
<T id={'new_sale_invoice'} /> >
</Button> <T id={'new_sale_invoice'} />
</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,24 +16,31 @@ 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={
<> <>
<Button <Can
intent={Intent.PRIMARY} I={Payment_Receive_Abilities.Create}
large={true} a={AbilitySubject.PaymentReceive}
onClick={() => {
history.push('/payment-receives/new');
}}
> >
<T id={'new_payment_receive'} /> <Button
</Button> intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/payment-receives/new');
}}
>
<T id={'new_payment_receive'} />
</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 {
Receipt_Abilities,
AbilitySubject,
} from '../../../../common/abilityOption';
export default function ReceiptsEmptyStatus() { export default function ReceiptsEmptyStatus() {
const history = useHistory(); const history = useHistory();
@@ -17,19 +21,21 @@ export default function ReceiptsEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Receipt_Abilities.Create} a={AbilitySubject.Receipt}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/receipts/new'); onClick={() => {
}} history.push('/receipts/new');
> }}
<T id={'new_receipt'} /> >
</Button> <T id={'new_receipt'} />
</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,19 +21,21 @@ export default function VendorsEmptyStatus() {
} }
action={ action={
<> <>
<Button <Can I={Vendor_Abilities.Create} a={AbilitySubject.Vendor}>
intent={Intent.PRIMARY} <Button
large={true} intent={Intent.PRIMARY}
onClick={() => { large={true}
history.push('/vendors/new'); onClick={() => {
}} history.push('/vendors/new');
> }}
<T id={'new_vendor'} /> >
</Button> <T id={'new_vendor'} />
</Button>
<Button intent={Intent.NONE} large={true}> <Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} /> <T id={'learn_more'} />
</Button> </Button>
</Can>
</> </>
} }
/> />