Skip to content

Commit

Permalink
feat(earnings): Implement earnings tabular list UI (#181)
Browse files Browse the repository at this point in the history
* feat(appcontext): add earnining menu item to the side nav

* feat(view): add earnings view component

* feat(components): add earnings table component

* feat(earnings table): add navbar

* feat(app context): add CreditCardIcon for the earnings side menu item

* feat(earnings table): style side menu with css

* feat(earnings table): move styles to a separate file

* feat(earnings top bar): add import and export buttons

* feat(earnings top bar): style the title

* feat(earnings table): display earnings table filled with dummy data

* feat(earnings table): display earnings table with dummy data

* feat(treetrackerapi): add getEarnings api

* feat(earnings table): style table header

* refactor(earnings table): dynamically displaying growers header and rows

* feat(earnings table): make renderTableHeaderColumns function completely dynamic

* feat(earnings table): style infoIcon horizontally align with effective date column

* feat(earnings table): customize earnings table pagination ui

* feat(earnings table): remove full colon on rows per page text

* feat(tree tracker api): change earnings api end point

* refactor(earnings table component): rename growers to earnings

* feat(earning table top bar): add and style import export buttons

* feat(earnings table columns): relatively position infoIcon

* feat(earnings table): call earnings api inside useEffect

* feat(earnings view): move side navigation menu to earnings view

* feat(earnings table): load earnings from mock api

* refactor(earnings table): put table header and body into their own components

* chore(earnings table): rename totalCount to total

* chore(earnings table): remove unsude MENU_WIDTH contant

* chore(earnings view): remove unused classes object

* feat(earnings table):  add filter button

* feat(earnings table): add date filter button

* feat(earnings table): style filter button

* feat(earnings table ): add filter earnings button

* feat(earnings table top bar): arrage well top bar actions

* feat(earnings table): add sort icon on table header

* feat: enable capture matching for dev deployment

* feat(earnings table filter): add filter and style filter header

* feat(earnings table filter): add funder and payment system select filters

* feat(earnings filter): adding action buttons

* feat(earnings table filter): styled filters according to the designs

* feat(earnings  filters): toggle open filter

* feat(earnigs table): add payment date column

* feat(earnings table): made earnings table top bar buttons responsive

* feat(earnings tool): add env variable to hide/show earnings tool

* build(packages): add react-csv libary for exporting data to csv

* feat(earnings table): export earnings to csv

* feat(earnings table): put earnings meta  data  in an array of objects

* feat(earnings table): display earning details

* feat(theme): move all colors to the theme

* feat(earnings details): render details page when when earning is not null

* feat(earnings table): use them spacing for all spacing in styles

* feat(earnings table): change rows per page options

* feat(earnings table): use ernings table metadata to handle show/hide info icon

* chore(app context): remove unused GrowerProvider variable

* feat(earnings details): implement earning details UI

* feat(earnings table): highligh select raw

Co-authored-by: Zaven Arra <[email protected]>
Co-authored-by: Nick Charlton <[email protected]>
  • Loading branch information
3 people authored Dec 1, 2021
1 parent cc512ee commit b7adb1c
Show file tree
Hide file tree
Showing 12 changed files with 1,061 additions and 67 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ REACT_APP_WEBMAP_DOMAIN=http://dev.treetracker.org
REACT_APP_API_ROOT=https://dev-k8s.treetracker.org/api/admin
REACT_APP_TREETRACKER_API_ROOT=https://dev-k8s.treetracker.org/treetracker
REACT_APP_ENABLE_CAPTURE_MATCHING=true
REACT_APP_ENABLE_EARNINGS=true
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
REACT_APP_WEBMAP_DOMAIN=http://test.treetracker.org

48 changes: 17 additions & 31 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,85 @@
## [1.28.1](https://github.com/Greenstand/treetracker-admin-client/compare/v1.28.0...v1.28.1) (2021-11-29)


### Bug Fixes

* sort Verify tool Species filter alphabetically ([#211](https://github.com/Greenstand/treetracker-admin-client/issues/211)) ([59d4ef3](https://github.com/Greenstand/treetracker-admin-client/commit/59d4ef320aaedfca3d879dbe24e2f2fe49202d74))
- sort Verify tool Species filter alphabetically ([#211](https://github.com/Greenstand/treetracker-admin-client/issues/211)) ([59d4ef3](https://github.com/Greenstand/treetracker-admin-client/commit/59d4ef320aaedfca3d879dbe24e2f2fe49202d74))

# [1.28.0](https://github.com/Greenstand/treetracker-admin-client/compare/v1.27.3...v1.28.0) (2021-11-28)


### Bug Fixes

* increased default page size in the Species tool ([#210](https://github.com/Greenstand/treetracker-admin-client/issues/210)) ([9f36227](https://github.com/Greenstand/treetracker-admin-client/commit/9f362279ef1bc48be0ac19624fd2e39e4b78ff94))

- increased default page size in the Species tool ([#210](https://github.com/Greenstand/treetracker-admin-client/issues/210)) ([9f36227](https://github.com/Greenstand/treetracker-admin-client/commit/9f362279ef1bc48be0ac19624fd2e39e4b78ff94))

### Features

* add copy button for Device Identifier in Grower Details ([#207](https://github.com/Greenstand/treetracker-admin-client/issues/207)) ([7a0037d](https://github.com/Greenstand/treetracker-admin-client/commit/7a0037d94abca97c42dd3cfef3370602bffeec46))
* adding Export Captures button ([#168](https://github.com/Greenstand/treetracker-admin-client/issues/168)) ([f59a11c](https://github.com/Greenstand/treetracker-admin-client/commit/f59a11ce23bb3b604b533ca839a48a7f9769555e))
* **grower-detail:** display device manufacturer with device id ([#196](https://github.com/Greenstand/treetracker-admin-client/issues/196)) ([ba9158f](https://github.com/Greenstand/treetracker-admin-client/commit/ba9158f7e4be30644b6568dbd7b2c65ebc95a46c))
- add copy button for Device Identifier in Grower Details ([#207](https://github.com/Greenstand/treetracker-admin-client/issues/207)) ([7a0037d](https://github.com/Greenstand/treetracker-admin-client/commit/7a0037d94abca97c42dd3cfef3370602bffeec46))
- adding Export Captures button ([#168](https://github.com/Greenstand/treetracker-admin-client/issues/168)) ([f59a11c](https://github.com/Greenstand/treetracker-admin-client/commit/f59a11ce23bb3b604b533ca839a48a7f9769555e))
- **grower-detail:** display device manufacturer with device id ([#196](https://github.com/Greenstand/treetracker-admin-client/issues/196)) ([ba9158f](https://github.com/Greenstand/treetracker-admin-client/commit/ba9158f7e4be30644b6568dbd7b2c65ebc95a46c))

## [1.27.3](https://github.com/Greenstand/treetracker-admin-client/compare/v1.27.2...v1.27.3) (2021-11-15)


### Bug Fixes

* clean up code and fix CapturesTable width ([4183afb](https://github.com/Greenstand/treetracker-admin-client/commit/4183afbeef55779e86fe2cd98470da4ce2e9501b))
- clean up code and fix CapturesTable width ([4183afb](https://github.com/Greenstand/treetracker-admin-client/commit/4183afbeef55779e86fe2cd98470da4ce2e9501b))

## [1.27.2](https://github.com/Greenstand/treetracker-admin-client/compare/v1.27.1...v1.27.2) (2021-11-14)


### Bug Fixes

* duplicate keys for Growers because of dup ids ([6c3dae0](https://github.com/Greenstand/treetracker-admin-client/commit/6c3dae018df42423612b4a358a2ca126af9216ad))
* scrolling to allow viewing the bottom of the page ([697d667](https://github.com/Greenstand/treetracker-admin-client/commit/697d667aba494604309a50b22742d5b475d5e20b))
- duplicate keys for Growers because of dup ids ([6c3dae0](https://github.com/Greenstand/treetracker-admin-client/commit/6c3dae018df42423612b4a358a2ca126af9216ad))
- scrolling to allow viewing the bottom of the page ([697d667](https://github.com/Greenstand/treetracker-admin-client/commit/697d667aba494604309a50b22742d5b475d5e20b))

## [1.27.1](https://github.com/Greenstand/treetracker-admin-client/compare/v1.27.0...v1.27.1) (2021-11-13)


### Bug Fixes

* remove toVerifyCounter which was causing repeated getCount requests ([#188](https://github.com/Greenstand/treetracker-admin-client/issues/188)) ([5cf9697](https://github.com/Greenstand/treetracker-admin-client/commit/5cf969767ba45b9627534c5a1eb7555303982718))
- remove toVerifyCounter which was causing repeated getCount requests ([#188](https://github.com/Greenstand/treetracker-admin-client/issues/188)) ([5cf9697](https://github.com/Greenstand/treetracker-admin-client/commit/5cf969767ba45b9627534c5a1eb7555303982718))

# [1.27.0](https://github.com/Greenstand/treetracker-admin-client/compare/v1.26.0...v1.27.0) (2021-11-12)


### Features

* enable capture matching for dev deployment ([6701a05](https://github.com/Greenstand/treetracker-admin-client/commit/6701a055264195c99fba1c352f56916cd9ec862c))
- enable capture matching for dev deployment ([6701a05](https://github.com/Greenstand/treetracker-admin-client/commit/6701a055264195c99fba1c352f56916cd9ec862c))

# [1.26.0](https://github.com/Greenstand/treetracker-admin-client/compare/v1.25.1...v1.26.0) (2021-11-06)


### Features

* **growers:** filter growers by deviceIdentifier ([799958e](https://github.com/Greenstand/treetracker-admin-client/commit/799958e5984f8880ad130fea73d0ae60c8268882))
- **growers:** filter growers by deviceIdentifier ([799958e](https://github.com/Greenstand/treetracker-admin-client/commit/799958e5984f8880ad130fea73d0ae60c8268882))

## [1.25.1](https://github.com/Greenstand/treetracker-admin-client/compare/v1.25.0...v1.25.1) (2021-10-30)


### Bug Fixes

* **capture:** enables scrolling in Capture page ([#182](https://github.com/Greenstand/treetracker-admin-client/issues/182)) ([9d2a145](https://github.com/Greenstand/treetracker-admin-client/commit/9d2a14527f1a2571b6dcb2db5f9a160473378827))
- **capture:** enables scrolling in Capture page ([#182](https://github.com/Greenstand/treetracker-admin-client/issues/182)) ([9d2a145](https://github.com/Greenstand/treetracker-admin-client/commit/9d2a14527f1a2571b6dcb2db5f9a160473378827))

# [1.25.0](https://github.com/Greenstand/treetracker-admin-client/compare/v1.24.0...v1.25.0) (2021-10-25)


### Features

* **grower:** show assigned organization in overview ([#178](https://github.com/Greenstand/treetracker-admin-client/issues/178)) ([76c061a](https://github.com/Greenstand/treetracker-admin-client/commit/76c061a440ac0198af1698a62e96b4356ccf270f))
- **grower:** show assigned organization in overview ([#178](https://github.com/Greenstand/treetracker-admin-client/issues/178)) ([76c061a](https://github.com/Greenstand/treetracker-admin-client/commit/76c061a440ac0198af1698a62e96b4356ccf270f))

# [1.24.0](https://github.com/Greenstand/treetracker-admin-client/compare/v1.23.0...v1.24.0) (2021-10-23)


### Bug Fixes

* **verify, growers and captures components:** removed toolbar gap ([#175](https://github.com/Greenstand/treetracker-admin-client/issues/175)) ([56de78c](https://github.com/Greenstand/treetracker-admin-client/commit/56de78c4bf1d41d135a1d72db7a0d62afdc58d8c))

- **verify, growers and captures components:** removed toolbar gap ([#175](https://github.com/Greenstand/treetracker-admin-client/issues/175)) ([56de78c](https://github.com/Greenstand/treetracker-admin-client/commit/56de78c4bf1d41d135a1d72db7a0d62afdc58d8c))

### Features

* **verify component:** disable species creation ([#174](https://github.com/Greenstand/treetracker-admin-client/issues/174)) ([88c135b](https://github.com/Greenstand/treetracker-admin-client/commit/88c135bae20f20fbefdd2b5583972721acdfcb8b))
- **verify component:** disable species creation ([#174](https://github.com/Greenstand/treetracker-admin-client/issues/174)) ([88c135b](https://github.com/Greenstand/treetracker-admin-client/commit/88c135bae20f20fbefdd2b5583972721acdfcb8b))

# [1.23.0](https://github.com/Greenstand/treetracker-admin-client/compare/v1.22.1...v1.23.0) (2021-10-19)


### Features

* include badge showing applied filters in Verify page ([#173](https://github.com/Greenstand/treetracker-admin-client/issues/173)) ([db18bc6](https://github.com/Greenstand/treetracker-admin-client/commit/db18bc6a162bf414e77db2a622d0b6792fc98250))
- include badge showing applied filters in Verify page ([#173](https://github.com/Greenstand/treetracker-admin-client/issues/173)) ([db18bc6](https://github.com/Greenstand/treetracker-admin-client/commit/db18bc6a162bf414e77db2a622d0b6792fc98250))

## [1.22.1](https://github.com/Greenstand/treetracker-admin-client/compare/v1.22.0...v1.22.1) (2021-10-11)


### Bug Fixes

* **species context:** remove species count queries ([#169](https://github.com/Greenstand/treetracker-admin-client/issues/169)) ([993d566](https://github.com/Greenstand/treetracker-admin-client/commit/993d56633b296b47f04ab667746ec2e428fae06e))
- **species context:** remove species count queries ([#169](https://github.com/Greenstand/treetracker-admin-client/issues/169)) ([993d566](https://github.com/Greenstand/treetracker-admin-client/commit/993d56633b296b47f04ab667746ec2e428fae06e))

# [1.22.0](https://github.com/Greenstand/treetracker-admin-client/compare/v1.21.2...v1.22.0) (2021-10-01)

Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions public/earnings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"earnings": [
{
"id": 1,
"grower": "Mohamed Sankoh",
"funder": "Environment for Africa",
"amount": "$2.34",
"paymentSystem": "Visa",
"effectiveDate": "Aug 10,2021",
"paymentDate": "Aug 11,2021"
},
{
"id": 2,
"grower": "Mohamed Sankoh",
"funder": "Environment for Africa",
"amount": "$2.34",
"paymentSystem": "Visa",
"effectiveDate": "Aug 10,2021",
"paymentDate": "Aug 11,2021"
},
{
"id": 3,
"grower": "Mohamed Sankoh",
"funder": "Environment for Africa",
"amount": "$2.34",
"paymentSystem": "Visa",
"effectiveDate": "Aug 10,2021",
"paymentDate": "Aug 11,2021"
},
{
"id": 4,
"grower": "Mohamed Sankoh",
"funder": "Environment for Africa",
"amount": "$2.34",
"paymentSystem": "Visa",
"effectiveDate": "Aug 10,2021",
"paymentDate": "Aug 11,2021"
},
{
"id": 5,
"grower": "Mohamed Sankoh",
"funder": "Environment for Africa",
"amount": "$2.34",
"paymentSystem": "Visa",
"effectiveDate": "Aug 10,2021",
"paymentDate": "Aug 11,2021"
},
{
"id": 6,
"grower": "Mohamed Sankoh",
"funder": "Environment for Africa",
"amount": "$2.34",
"paymentSystem": "Visa",
"effectiveDate": "Aug 10,2021",
"paymentDate": "Aug 11,2021"
},
{
"id": 7,
"grower": "Mohamed Sankoh",
"funder": "Environment for Africa",
"amount": "$2.34",
"paymentSystem": "Visa",
"effectiveDate": "Aug 10,2021",
"paymentDate": "Aug 11,2021"
},
{
"id": 8,
"grower": "Mohamed Sankoh",
"funder": "Environment for Africa",
"amount": "$2.34",
"paymentSystem": "Visa",
"effectiveDate": "Aug 10,2021",
"paymentDate": "Aug 11,2021"
}
],
"totalCount": 8,
"links": {
"prev": null,
"next": "http://dev-k8s.treetracker.org/earnings?&offset=1"
}
}
54 changes: 20 additions & 34 deletions src/api/treeTrackerApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,40 +98,6 @@ export default {
.then(handleResponse)
.catch(handleError);
},
/*
* to rollback from a wrong approving
*/
// undoCaptureImage(id) {
// const query = `${
// process.env.REACT_APP_API_ROOT
// }/api/${getOrganization()}trees/${id}`;
// return fetch(query, {
// method: 'PATCH',
// headers: {
// 'content-type': 'application/json',
// Authorization: session.token,
// },
// body: JSON.stringify({
// id: id,
// active: true,
// approved: false,
// }),
// })
// .then(handleResponse)
// .catch(handleError);
// },
// getUnverifiedCaptureCount() {
// const query = `${
// process.env.REACT_APP_API_ROOT
// }/api/${getOrganization()}trees/count?where[approved]=false&where[active]=true`;
// return fetch(query, {
// headers: {
// Authorization: session.token,
// },
// })
// .then(handleResponse)
// .catch(handleError);
// },
getCaptureCount(filter) {
const query = `${
process.env.REACT_APP_API_ROOT
Expand Down Expand Up @@ -174,6 +140,26 @@ export default {
.then(handleResponse)
.catch(handleError);
},

/**
* @function
* @name getEarnings
* @description get earnings
*
* @returns {Array} - list of earnings
*/
getEarnings() {
const query = `earnings.json`;
return fetch(query, {
method: 'GET',
headers: {
'content-type': 'application/json',
Authorization: session.token,
},
})
.then(handleResponse)
.catch(handleError);
},
/*
* get species by id
*/
Expand Down
Loading

0 comments on commit b7adb1c

Please sign in to comment.