diff --git a/package-lock.json b/package-lock.json index dfd7c2a0..2c6c9f2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46543,7 +46543,7 @@ "@jest/types": "^27.5.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "micromatch": "^4.0.4", "pretty-format": "^27.5.1", "slash": "^3.0.0", @@ -46559,7 +46559,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -46596,7 +46596,7 @@ "chalk": "^4.0.0", "emittery": "^0.8.1", "exit": "^0.1.2", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "jest-changed-files": "^27.5.1", "jest-config": "^27.5.1", "jest-haste-map": "^27.5.1", @@ -46703,7 +46703,7 @@ "@jest/types": "^27.5.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "micromatch": "^4.0.4", "pretty-format": "^27.5.1", "slash": "^3.0.0", @@ -46719,7 +46719,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -46868,7 +46868,7 @@ "@jest/types": "^27.5.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "micromatch": "^4.0.4", "pretty-format": "^27.5.1", "slash": "^3.0.0", @@ -46893,7 +46893,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -47025,7 +47025,7 @@ "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", "glob": "^7.1.2", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-instrument": "^5.1.0", "istanbul-lib-report": "^3.0.0", @@ -47119,7 +47119,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -47169,7 +47169,7 @@ "integrity": "sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg==", "requires": { "callsites": "^3.0.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "source-map": "^0.6.0" }, "dependencies": { @@ -47275,7 +47275,7 @@ "integrity": "sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ==", "requires": { "@jest/test-result": "^27.5.1", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "jest-haste-map": "^27.5.1", "jest-runtime": "^27.5.1" } @@ -47291,7 +47291,7 @@ "chalk": "^4.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "jest-haste-map": "^27.5.1", "jest-regex-util": "^27.5.1", "jest-util": "^27.5.1", @@ -47379,7 +47379,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -48788,7 +48788,7 @@ "chownr": "^1.1.1", "figgy-pudding": "^3.5.1", "glob": "^7.1.4", - "graceful-fs": "^4.1.15", + "graceful-fs": "^4.2.10", "infer-owner": "^1.0.3", "lru-cache": "^5.1.1", "mississippi": "^3.0.0", @@ -49169,7 +49169,7 @@ "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", "dev": true, "requires": { - "graceful-fs": "^4.2.0", + "graceful-fs": "^4.2.10", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } @@ -49359,7 +49359,7 @@ "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", "dev": true, "requires": { - "graceful-fs": "^4.1.6" + "graceful-fs": "^4.2.10" } }, "kind-of": { @@ -49972,7 +49972,7 @@ "figgy-pudding": "^3.5.1", "fs-minipass": "^2.0.0", "glob": "^7.1.4", - "graceful-fs": "^4.2.2", + "graceful-fs": "^4.2.10", "infer-owner": "^1.0.4", "lru-cache": "^5.1.1", "minipass": "^3.0.0", @@ -50486,7 +50486,7 @@ "chownr": "^1.1.1", "figgy-pudding": "^3.5.1", "glob": "^7.1.4", - "graceful-fs": "^4.1.15", + "graceful-fs": "^4.2.10", "infer-owner": "^1.0.3", "lru-cache": "^5.1.1", "mississippi": "^3.0.0", @@ -56253,7 +56253,7 @@ "chownr": "^1.1.1", "figgy-pudding": "^3.5.1", "glob": "^7.1.4", - "graceful-fs": "^4.1.15", + "graceful-fs": "^4.2.10", "infer-owner": "^1.0.3", "lru-cache": "^5.1.1", "mississippi": "^3.0.0", @@ -59361,7 +59361,7 @@ "@jest/types": "^27.5.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "micromatch": "^4.0.4", "pretty-format": "^27.5.1", "slash": "^3.0.0", @@ -60074,7 +60074,7 @@ "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "requires": { "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", + "graceful-fs": "^4.2.10", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } @@ -60279,7 +60279,7 @@ "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", "integrity": "sha512-+vSd9frUnapVC2RZYfL3FCB2p3g4TBhaUmrsWlSudsGdnxIuUvBB2QM1VZeBtc49QFwrp+wQLrDs3+xxDgI5gQ==", "requires": { - "graceful-fs": "^4.1.11", + "graceful-fs": "^4.2.10", "through2": "^2.0.3" }, "dependencies": { @@ -60310,7 +60310,7 @@ "integrity": "sha512-gehEzmPn2nAwr39eay+x3X34Ra+M2QlVUTLhkXPjWdeO8RF9kszk116avgBJM3ZyNHgHXBNx+VmPaFC36k0PzA==", "dev": true, "requires": { - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.2.10", "iferr": "^0.1.5", "imurmurhash": "^0.1.4", "readable-stream": "1 || 2" @@ -60752,7 +60752,7 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", "integrity": "sha512-ANhy2V2+tFpRajE3wN4DhkNQ08KDr0Ir1qL12/cUe5+a7STEK8jkW4onUYuY8/06qAFuT5je7mjAqzx0eKI2tQ==", "requires": { - "graceful-fs": "~1.2.0", + "graceful-fs": "^4.2.10", "inherits": "1", "minimatch": "~0.2.11" } @@ -61196,7 +61196,7 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", "requires": { - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.2.10", "pify": "^2.0.0", "pinkie-promise": "^2.0.0" } @@ -61758,7 +61758,7 @@ "requires": { "fs-mkdirp-stream": "^1.0.0", "glob-stream": "^6.1.0", - "graceful-fs": "^4.0.0", + "graceful-fs": "^4.2.10", "is-valid-glob": "^1.0.0", "lazystream": "^1.0.0", "lead": "^1.0.0", @@ -64535,7 +64535,7 @@ "@jest/types": "^27.5.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "micromatch": "^4.0.4", "pretty-format": "^27.5.1", "slash": "^3.0.0", @@ -64551,7 +64551,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -64980,7 +64980,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -65342,7 +65342,7 @@ "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "fsevents": "^2.3.2", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "jest-regex-util": "^27.5.1", "jest-serializer": "^27.5.1", "jest-util": "^27.5.1", @@ -65434,7 +65434,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -65706,7 +65706,7 @@ "@jest/types": "^25.5.0", "@types/stack-utils": "^1.0.1", "chalk": "^3.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.10", "micromatch": "^4.0.2", "slash": "^3.0.0", "stack-utils": "^1.0.1" @@ -66358,7 +66358,7 @@ "integrity": "sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==", "requires": { "@types/node": "*", - "graceful-fs": "^4.2.9" + "graceful-fs": "^4.2.10" } }, "jest-snapshot": { @@ -66833,7 +66833,7 @@ "@jest/types": "^28.1.3", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "micromatch": "^4.0.4", "pretty-format": "^28.1.3", "slash": "^3.0.0", @@ -66861,7 +66861,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -67067,7 +67067,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "picomatch": "^2.2.3" } }, @@ -67572,7 +67572,7 @@ "requires": { "copy-anything": "^2.0.1", "errno": "^0.1.1", - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.2.10", "image-size": "~0.5.0", "make-dir": "^2.1.0", "mime": "^1.4.1", @@ -68227,7 +68227,7 @@ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", "requires": { - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.2.10", "parse-json": "^2.2.0", "pify": "^2.0.0", "pinkie-promise": "^2.0.0", @@ -72412,7 +72412,7 @@ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", "requires": { - "graceful-fs": "^4.1.11", + "graceful-fs": "^4.2.10", "micromatch": "^3.1.10", "readable-stream": "^2.0.2" }, @@ -76499,7 +76499,7 @@ "resolved": "https://registry.npmjs.org/vinyl-file/-/vinyl-file-2.0.0.tgz", "integrity": "sha512-44i5QVLwRPbiRyuiHJ+zJXooNNRXUUifdfYIC1Gm7YTlemMgYQrZ+q1LERS6AYAN8w0xe7n9OgjEYckQjR5+4g==", "requires": { - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.2.10", "pify": "^2.3.0", "pinkie-promise": "^2.0.0", "strip-bom": "^2.0.0", @@ -76545,7 +76545,7 @@ "defaults": "^1.0.0", "glob-stream": "^3.1.5", "glob-watcher": "^0.0.6", - "graceful-fs": "^3.0.0", + "graceful-fs": "^4.2.10", "mkdirp": "^0.5.0", "strip-bom": "^1.0.0", "through2": "^0.6.1", @@ -76624,7 +76624,7 @@ "requires": { "append-buffer": "^1.0.2", "convert-source-map": "^1.5.0", - "graceful-fs": "^4.1.6", + "graceful-fs": "^4.2.10", "normalize-path": "^2.1.1", "now-and-later": "^2.0.0", "remove-bom-buffer": "^3.0.0", @@ -77553,7 +77553,7 @@ "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "requires": { "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", + "graceful-fs": "^4.2.10", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } diff --git a/src/components/common/Status.js b/src/components/common/Status.js index 624a13f0..baf720e1 100644 --- a/src/components/common/Status.js +++ b/src/components/common/Status.js @@ -28,14 +28,13 @@ const defaultProps = { style: {}, }; -const translateStatusBasedOnUser = ( +export const translateStatusBasedOnUser = ( status, user, isForVersionsList = false, ) => { let modifier = 'status__icon'; let statusName = status.code ? 'Unknown_status' : NO_PLAN; - switch (status.code) { case PLAN_STATUS.DRAFT: if (isUserAgreementHolder(user)) { @@ -196,6 +195,14 @@ const translateStatusBasedOnUser = ( statusName = 'Submitted as Mandatory'; modifier += isUserAgrologist(user) ? '--orange' : '--gray'; break; + case PLAN_STATUS.PENDING: + statusName = 'Pending'; + modifier += '--gray'; + break; + case PLAN_STATUS.COMPLETED: + statusName = 'Completed'; + modifier += '--gray'; + break; default: modifier += '--not-provided'; break; diff --git a/src/components/selectRangeUsePlanPage/PlanRow.js b/src/components/selectRangeUsePlanPage/PlanRow.js index a3fe6122..bea83b04 100644 --- a/src/components/selectRangeUsePlanPage/PlanRow.js +++ b/src/components/selectRangeUsePlanPage/PlanRow.js @@ -70,13 +70,6 @@ function PlanRow({ agreement, user, currentPage }) { )} {agreement.zone?.district?.code} - - {agreement.plan?.id ? ( - {agreement.plan.status.code} - ) : ( - - - )} - {agreement.plan?.id ? ( diff --git a/src/components/selectRangeUsePlanPage/SortableAgreementTable.js b/src/components/selectRangeUsePlanPage/SortableAgreementTable.js index 7595a050..331bbe82 100644 --- a/src/components/selectRangeUsePlanPage/SortableAgreementTable.js +++ b/src/components/selectRangeUsePlanPage/SortableAgreementTable.js @@ -1,23 +1,25 @@ +import { Checkbox, ListItemText, TablePagination } from '@material-ui/core'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; import TableContainer from '@material-ui/core/TableContainer'; import TableHead from '@material-ui/core/TableHead'; -import TablePagination from '@material-ui/core/TablePagination'; import TableRow from '@material-ui/core/TableRow'; import TableSortLabel from '@material-ui/core/TableSortLabel'; import Typography from '@material-ui/core/Typography'; import { makeStyles } from '@material-ui/core/styles'; import Skeleton from '@material-ui/lab/Skeleton'; +import FormControl from '@mui/material/FormControl'; +import MenuItem from '@mui/material/MenuItem'; +import Select from '@mui/material/Select'; import PropTypes from 'prop-types'; import React, { useEffect } from 'react'; import { useLocation } from 'react-router-dom'; +import { REFERENCE_KEY } from '../../constants/variables'; +import { useReferences } from '../../providers/ReferencesProvider'; import { useUser } from '../../providers/UserProvider'; import PlanRow from './PlanRow'; -import MenuItem from '@mui/material/MenuItem'; -import FormControl from '@mui/material/FormControl'; -import Select from '@mui/material/Select'; -import { Checkbox, ListItemText } from '@material-ui/core'; +import { translateStatusBasedOnUser } from '../common/Status'; const headCells = [ { @@ -76,12 +78,6 @@ const headCells = [ sortable: true, multiSelectable: true, }, - { - id: 'plan.status', - numeric: false, - disablePadding: false, - label: 'Status', - }, { id: 'actions', disablePadding: true }, { id: 'extension', label: 'Extension Requests', disablePadding: false }, ]; @@ -140,11 +136,7 @@ function EnhancedTableHead(props) { /> )} {headCell.multiSelectable && ( - + )} ))} @@ -153,74 +145,65 @@ function EnhancedTableHead(props) { ); } -function StatusCodesMultiSelect(props) { - const { onStatusCodeChange, filters, headCellID } = props; +const StatusCodesMultiSelect = (props) => { + const { onStatusCodeChange } = props; const ITEM_HEIGHT = 48; const ITEM_PADDING_TOP = 8; + const references = useReferences(); const MenuProps = { PaperProps: { style: { maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, - width: 250, + width: 400, }, }, }; - const status_codes = [ - 'C', - 'O', - 'P', - 'D', - 'R', - 'SD', - 'WM', - 'SW', - 'S', - 'NF', - 'NA', - 'A', - 'SR', - 'SFD', - 'RR', - 'RNR', - 'RFD', - 'AC', - 'RFS', - 'MSR', - 'SNR', - 'APS', - 'APA', - 'SAM', - ]; - const [selectedCodes, setSelectedCodes] = React.useState([]); + const user = useUser(); + const statusObjects = references[REFERENCE_KEY.PLAN_STATUS].map( + (statusObject) => { + statusObject.name = + translateStatusBasedOnUser(statusObject, user).statusName + + ` (${statusObject.code})`; + return statusObject; + }, + ); + const [selectedStatusName, setSelectedStatusName] = React.useState([]); const handleChange = (event) => { - const { - target: { value }, - } = event; - setSelectedCodes(typeof value === 'string' ? value.split(',') : value); + setSelectedStatusName(event.target.value); }; useEffect(() => { - onStatusCodeChange(selectedCodes); - }, [selectedCodes]); + const selectedStatusCodes = selectedStatusName.map((statusName) => { + const match = statusObjects.find((st) => st.name === statusName); + return match.code; + }); + onStatusCodeChange(selectedStatusCodes); + }, [selectedStatusName]); return ( ); -} +}; EnhancedTableHead.propTypes = { classes: PropTypes.object.isRequired, @@ -305,8 +288,8 @@ export default function SortableAgreementTable({ onFilterChange(property, event.target.value); }; - const handleStatusFilterChange = (codes) => { - onStatusCodeChange('plan.status_id', codes); + const handleStatusFilterChange = (selectedStatusCodes) => { + onStatusCodeChange('plan.status_id', selectedStatusCodes); }; const handleChangePage = (event, newPage) => {