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 {
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>
</>
}
/>