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 { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +21,24 @@ export default function ManualJournalsEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/make-journal-entry');
}}
<Can
I={Manual_Journal_Abilities.Create}
a={AbilitySubject.ManualJournal}
>
<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}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +21,21 @@ export default function CustomersEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/customers/new');
}}
>
<T id={'new_customer'} />
</Button>
<Can I={Customer_Abilities.Create} a={AbilitySubject.Customer}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/customers/new');
}}
>
<T id={'new_customer'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +21,21 @@ export default function InvoicesEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/expenses/new');
}}
>
<T id={'new_expense'} />
</Button>
<Can I={Expense_Abilities.Create} a={AbilitySubject.Expense}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/expenses/new');
}}
>
<T id={'new_expense'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,8 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +18,21 @@ export default function ItemsEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/items/new');
}}
>
<T id={'new_item'} />
</Button>
<Can I={Item_Abilities.Create} a={AbilitySubject.Item}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/items/new');
}}
>
<T id={'new_item'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +21,21 @@ export default function BillsEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/bills/new');
}}
>
<T id={'new_bill'} />
</Button>
<Can I={Bill_Abilities.Create} a={AbilitySubject.Bill}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/bills/new');
}}
>
<T id={'new_bill'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +21,21 @@ export default function PaymentMadesEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/payment-mades/new');
}}
>
<T id={'new_bill_payment'} />
</Button>
<Can I={Payment_Made_Abilities.Create} a={AbilitySubject.PaymentMade}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/payment-mades/new');
}}
>
<T id={'new_bill_payment'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -16,18 +20,20 @@ export default function EstimatesEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/estimates/new');
}}
>
<T id={'new_sale_estimate'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Can I={Estimate_Abilities.Create} a={AbilitySubject.Estimate}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/estimates/new');
}}
>
<T id={'new_sale_estimate'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +21,20 @@ export default function EstimatesEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/invoices/new');
}}
>
<T id={'new_sale_invoice'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Can I={Invoice_Abilities.Create} a={AbilitySubject.Invoice}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/invoices/new');
}}
>
<T id={'new_sale_invoice'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -12,24 +16,31 @@ export default function PaymentReceivesEmptyStatus() {
title={<T id={'the_organization_doesn_t_receive_money_yet'} />}
description={
<p>
<T id={'receiving_customer_payments_is_one_pleasant_accounting_tasks'} />
<T
id={'receiving_customer_payments_is_one_pleasant_accounting_tasks'}
/>
</p>
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/payment-receives/new');
}}
<Can
I={Payment_Receive_Abilities.Create}
a={AbilitySubject.PaymentReceive}
>
<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}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +21,21 @@ export default function ReceiptsEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/receipts/new');
}}
>
<T id={'new_receipt'} />
</Button>
<Can I={Receipt_Abilities.Create} a={AbilitySubject.Receipt}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/receipts/new');
}}
>
<T id={'new_receipt'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'}/>
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
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() {
const history = useHistory();
@@ -17,19 +21,21 @@ export default function VendorsEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/vendors/new');
}}
>
<T id={'new_vendor'} />
</Button>
<Can I={Vendor_Abilities.Create} a={AbilitySubject.Vendor}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/vendors/new');
}}
>
<T id={'new_vendor'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>