Skip to content

Commit

Permalink
feat(earninigs): display all earnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mloweedgar committed Jan 30, 2022
1 parent bb2ea0c commit fe7e5bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/components/EarningsTable/EarningsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ function EarningsTable() {

const response = await earningsAPI.getEarnings(queryParams);
const results = prepareRows(response.earnings);
const withOutPaidEarnings = results.filter(
({ status }) => status !== 'paid'
); // remove paid earnings
setEarnings(withOutPaidEarnings);
setEarnings(results);
setTotalEarnings(response.totalCount);

setIsLoading(false); // hide loading indicator when data is fetched
Expand Down
24 changes: 12 additions & 12 deletions src/context/AppContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,14 @@ function getRoutes(user) {
},
{
name: 'Earnings',
disabled:
process.env.REACT_APP_ENABLE_EARNINGS !== 'true' ||
process.env.REACT_APP_ENABLE_PAYMENTS !== 'true',
children: [
{
name: 'Earnings',
linkTo: '/earnings',
component: EarningsView,
icon: CreditCardIcon,
disabled:
process.env.REACT_APP_ENABLE_EARNINGS !== 'true' &&
process.env.REACT_APP_ENABLE_EARNINGS !== 'true' ||
!hasPermission(user, [
POLICIES.SUPER_PERMISSION,
POLICIES.MANAGE_EARNINGS,
Expand All @@ -109,21 +106,24 @@ function getRoutes(user) {
component: PaymentsView,
icon: PaymentsIcon,
disabled:
process.env.REACT_APP_ENABLE_PAYMENTS !== 'true' &&
process.env.REACT_APP_ENABLE_PAYMENTS !== 'true' ||
!hasPermission(user, [
POLICIES.SUPER_PERMISSION,
POLICIES.MANAGE_PAYMENTS,
POLICIES.LIST_PAYMENTS,
]),
},
],
disabled: !hasPermission(user, [
POLICIES.SUPER_PERMISSION,
POLICIES.MANAGE_EARNINGS,
POLICIES.MANAGE_PAYMENTS,
POLICIES.LIST_EARNINGS,
POLICIES.LIST_PAYMENTS,
]),
disabled:
process.env.REACT_APP_ENABLE_EARNINGS !== 'true' ||
process.env.REACT_APP_ENABLE_PAYMENTS !== 'true' ||
!hasPermission(user, [
POLICIES.SUPER_PERMISSION,
POLICIES.MANAGE_EARNINGS,
POLICIES.MANAGE_PAYMENTS,
POLICIES.LIST_EARNINGS,
POLICIES.LIST_PAYMENTS,
]),
},
{
name: 'Growers',
Expand Down

0 comments on commit fe7e5bb

Please sign in to comment.