From 8aa02022c1d1217aa4b6dd398e59c9128bb72e26 Mon Sep 17 00:00:00 2001 From: Kevin Jackson <30411845+KevinJJackson@users.noreply.github.com> Date: Fri, 8 Sep 2023 10:40:41 -0400 Subject: [PATCH] enhancement/submittals-table (#187) --- package-lock.json | 141 +++++------ package.json | 3 +- src/app-bundles/chart-editor-bundle.js | 30 ++- src/app-bundles/district-rollup-bundle.js | 11 +- src/app-bundles/inclinometer-measurements.js | 36 ++- src/app-bundles/submittals-bundle.js | 19 +- .../time-series-measurements-bundle.js | 3 +- src/app-components/button/button.jsx | 2 +- src/app-components/chart/minify-plotly.js | 4 + src/app-components/table/table.jsx | 150 ++++++++---- .../instrument/timeseries/timeseries.jsx | 3 +- .../project/batch-plotting/batch-plotting.jsx | 70 +++++- .../batch-plot-chart-settings.jsx | 121 +++++++--- .../{ => components}/batch-plot-errors.jsx | 0 .../{ => components}/configuration-panel.jsx | 4 +- .../{ => components}/data-configuration.jsx | 10 +- .../{ => components}/print-button.jsx | 8 +- src/app-pages/project/batch-plotting/index.js | 2 +- .../{ => tab-content}/batch-plot-chart.jsx | 33 +-- .../tab-content/depth-chart.jsx | 219 ++++++++++++++++++ .../components/modals/districtRollupModal.jsx | 32 ++- .../components/modals/newEvaluationModal.jsx | 2 +- .../components/tables/submittalsTable.jsx | 106 ++++++--- 23 files changed, 779 insertions(+), 230 deletions(-) rename src/app-pages/project/batch-plotting/{ => components}/batch-plot-chart-settings.jsx (63%) rename src/app-pages/project/batch-plotting/{ => components}/batch-plot-errors.jsx (100%) rename src/app-pages/project/batch-plotting/{ => components}/configuration-panel.jsx (96%) rename src/app-pages/project/batch-plotting/{ => components}/data-configuration.jsx (93%) rename src/app-pages/project/batch-plotting/{ => components}/print-button.jsx (92%) rename src/app-pages/project/batch-plotting/{ => tab-content}/batch-plot-chart.jsx (79%) create mode 100644 src/app-pages/project/batch-plotting/tab-content/depth-chart.jsx diff --git a/package-lock.json b/package-lock.json index 088954ab..9a143029 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@mui/icons-material": "^5.14.0", + "@mui/material": "^5.14.2", "@tanstack/react-table": "^8.9.3", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^14.0.0", @@ -1492,15 +1493,14 @@ } }, "node_modules/@mui/base": { - "version": "5.0.0-beta.7", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.7.tgz", - "integrity": "sha512-Pjbwm6gjiS96kOMF7E5fjEJsenc0tZBesrLQ4rrdi3eT/c/yhSWnPbCUkHSz8bnS0l3/VQ8bA+oERSGSV2PK6A==", - "peer": true, + "version": "5.0.0-beta.8", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.8.tgz", + "integrity": "sha512-b4vVjMZx5KzzEMf4arXKoeV5ZegAMOoPwoy1vfUBwhvXc2QtaaAyBp50U7OA2L06Leubc1A+lEp3eqwZoFn87g==", "dependencies": { - "@babel/runtime": "^7.22.5", + "@babel/runtime": "^7.22.6", "@emotion/is-prop-valid": "^1.2.1", "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.7", + "@mui/utils": "^5.14.1", "@popperjs/core": "^2.11.8", "clsx": "^1.2.1", "prop-types": "^15.8.1", @@ -1527,14 +1527,12 @@ "node_modules/@mui/base/node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "peer": true + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.0.tgz", - "integrity": "sha512-SYBOVCatVDUf/lbrLGah09bHhX5WfUXg7kSskfLILr6SvKRni0NLp0aonxQ0SMALVVK3Qwa6cW4CdWuwS0gC1w==", - "peer": true, + "version": "5.14.2", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.2.tgz", + "integrity": "sha512-x+c/MgDL1t/IIy5lDbMlrDouFG5DYZbl3DP4dbbuhlpPFBnE9glYwmJEee/orVHQpOPwLxCAIWQs+2DKSaBVWQ==", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui" @@ -1566,17 +1564,16 @@ } }, "node_modules/@mui/material": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.14.0.tgz", - "integrity": "sha512-HP7CP71NhMkui2HUIEKl2/JfuHMuoarSUWAKlNw6s17bl/Num9rN61EM6uUzc2A2zHjj/00A66GnvDnmixEJEw==", - "peer": true, - "dependencies": { - "@babel/runtime": "^7.22.5", - "@mui/base": "5.0.0-beta.7", - "@mui/core-downloads-tracker": "^5.14.0", - "@mui/system": "^5.14.0", + "version": "5.14.2", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.14.2.tgz", + "integrity": "sha512-TgNR4/YRL11RifsnMWNhITNCkGJYVz20SCvVJBBoU5Y/KhUNSSJxjDpEB8VrnY+sUsV0NigLCkHZJglfsiS3Pw==", + "dependencies": { + "@babel/runtime": "^7.22.6", + "@mui/base": "5.0.0-beta.8", + "@mui/core-downloads-tracker": "^5.14.2", + "@mui/system": "^5.14.1", "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.7", + "@mui/utils": "^5.14.1", "@types/react-transition-group": "^4.4.6", "clsx": "^1.2.1", "csstype": "^3.1.2", @@ -1613,14 +1610,12 @@ "node_modules/@mui/material/node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "peer": true + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/@mui/private-theming": { "version": "5.13.7", "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.13.7.tgz", "integrity": "sha512-qbSr+udcij5F9dKhGX7fEdx2drXchq7htLNr2Qg2Ma+WJ6q0ERlEqGSBiPiVDJkptcjeVL4DGmcf1wl5+vD4EA==", - "peer": true, "dependencies": { "@babel/runtime": "^7.22.5", "@mui/utils": "^5.13.7", @@ -1647,7 +1642,6 @@ "version": "5.13.2", "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.13.2.tgz", "integrity": "sha512-VCYCU6xVtXOrIN8lcbuPmoG+u7FYuOERG++fpY74hPpEWkyFQG97F+/XfTQVYzlR2m7nPjnwVUgATcTCMEaMvw==", - "peer": true, "dependencies": { "@babel/runtime": "^7.21.0", "@emotion/cache": "^11.11.0", @@ -1676,16 +1670,15 @@ } }, "node_modules/@mui/system": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.14.0.tgz", - "integrity": "sha512-0HZGkX8miJbiNw+rjlZ9l0Cfkz1bSqfSHQH0EH9J+nx0aAm5cBleg9piOlLdCNIWGgecCqsw4x62erGrGjjcJg==", - "peer": true, + "version": "5.14.1", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.14.1.tgz", + "integrity": "sha512-u+xlsU34Jdkgx1CxmBnIC4Y08uPdVX5iEd3S/1dggDFtOGp+Lj8xmKRJAQ8PJOOJLOh8pDwaZx4AwXikL4l1QA==", "dependencies": { - "@babel/runtime": "^7.22.5", + "@babel/runtime": "^7.22.6", "@mui/private-theming": "^5.13.7", "@mui/styled-engine": "^5.13.2", "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.7", + "@mui/utils": "^5.14.1", "clsx": "^1.2.1", "csstype": "^3.1.2", "prop-types": "^15.8.1" @@ -1719,7 +1712,6 @@ "version": "7.2.4", "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.4.tgz", "integrity": "sha512-LBcwa8rN84bKF+f5sDyku42w1NTxaPgPyYKODsh01U1fVstTClbUoSA96oyRBnSNyEiAVjKm6Gwx9vjR+xyqHA==", - "peer": true, "peerDependencies": { "@types/react": "*" }, @@ -1730,12 +1722,11 @@ } }, "node_modules/@mui/utils": { - "version": "5.13.7", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.13.7.tgz", - "integrity": "sha512-/3BLptG/q0u36eYED7Nhf4fKXmcKb6LjjT7ZMwhZIZSdSxVqDqSTmATW3a56n3KEPQUXCU9TpxAfCBQhs6brVA==", - "peer": true, + "version": "5.14.1", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.14.1.tgz", + "integrity": "sha512-39KHKK2JeqRmuUcLDLwM+c2XfVC136C5/yUyQXmO2PVbOb2Bol4KxtkssEqCbTwg87PSCG3f1Tb0keRsK7cVGw==", "dependencies": { - "@babel/runtime": "^7.22.5", + "@babel/runtime": "^7.22.6", "@types/prop-types": "^15.7.5", "@types/react-is": "^18.2.1", "prop-types": "^15.8.1", @@ -1755,8 +1746,7 @@ "node_modules/@mui/utils/node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "peer": true + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", @@ -2216,7 +2206,6 @@ "version": "18.2.1", "resolved": "https://registry.npmjs.org/@types/react-is/-/react-is-18.2.1.tgz", "integrity": "sha512-wyUkmaaSZEzFZivD8F2ftSyAfk6L+DfFliVj/mYdOXbVjRcS87fQJLTnhk6dRZPuJjI+9g6RZJO4PNCngUrmyw==", - "peer": true, "dependencies": { "@types/react": "*" } @@ -9865,15 +9854,14 @@ "version": "3.1.0" }, "@mui/base": { - "version": "5.0.0-beta.7", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.7.tgz", - "integrity": "sha512-Pjbwm6gjiS96kOMF7E5fjEJsenc0tZBesrLQ4rrdi3eT/c/yhSWnPbCUkHSz8bnS0l3/VQ8bA+oERSGSV2PK6A==", - "peer": true, + "version": "5.0.0-beta.8", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.8.tgz", + "integrity": "sha512-b4vVjMZx5KzzEMf4arXKoeV5ZegAMOoPwoy1vfUBwhvXc2QtaaAyBp50U7OA2L06Leubc1A+lEp3eqwZoFn87g==", "requires": { - "@babel/runtime": "^7.22.5", + "@babel/runtime": "^7.22.6", "@emotion/is-prop-valid": "^1.2.1", "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.7", + "@mui/utils": "^5.14.1", "@popperjs/core": "^2.11.8", "clsx": "^1.2.1", "prop-types": "^15.8.1", @@ -9883,16 +9871,14 @@ "react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "peer": true + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" } } }, "@mui/core-downloads-tracker": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.0.tgz", - "integrity": "sha512-SYBOVCatVDUf/lbrLGah09bHhX5WfUXg7kSskfLILr6SvKRni0NLp0aonxQ0SMALVVK3Qwa6cW4CdWuwS0gC1w==", - "peer": true + "version": "5.14.2", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.2.tgz", + "integrity": "sha512-x+c/MgDL1t/IIy5lDbMlrDouFG5DYZbl3DP4dbbuhlpPFBnE9glYwmJEee/orVHQpOPwLxCAIWQs+2DKSaBVWQ==" }, "@mui/icons-material": { "version": "5.14.0", @@ -9903,17 +9889,16 @@ } }, "@mui/material": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.14.0.tgz", - "integrity": "sha512-HP7CP71NhMkui2HUIEKl2/JfuHMuoarSUWAKlNw6s17bl/Num9rN61EM6uUzc2A2zHjj/00A66GnvDnmixEJEw==", - "peer": true, - "requires": { - "@babel/runtime": "^7.22.5", - "@mui/base": "5.0.0-beta.7", - "@mui/core-downloads-tracker": "^5.14.0", - "@mui/system": "^5.14.0", + "version": "5.14.2", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.14.2.tgz", + "integrity": "sha512-TgNR4/YRL11RifsnMWNhITNCkGJYVz20SCvVJBBoU5Y/KhUNSSJxjDpEB8VrnY+sUsV0NigLCkHZJglfsiS3Pw==", + "requires": { + "@babel/runtime": "^7.22.6", + "@mui/base": "5.0.0-beta.8", + "@mui/core-downloads-tracker": "^5.14.2", + "@mui/system": "^5.14.1", "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.7", + "@mui/utils": "^5.14.1", "@types/react-transition-group": "^4.4.6", "clsx": "^1.2.1", "csstype": "^3.1.2", @@ -9925,8 +9910,7 @@ "react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "peer": true + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" } } }, @@ -9934,7 +9918,6 @@ "version": "5.13.7", "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.13.7.tgz", "integrity": "sha512-qbSr+udcij5F9dKhGX7fEdx2drXchq7htLNr2Qg2Ma+WJ6q0ERlEqGSBiPiVDJkptcjeVL4DGmcf1wl5+vD4EA==", - "peer": true, "requires": { "@babel/runtime": "^7.22.5", "@mui/utils": "^5.13.7", @@ -9945,7 +9928,6 @@ "version": "5.13.2", "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.13.2.tgz", "integrity": "sha512-VCYCU6xVtXOrIN8lcbuPmoG+u7FYuOERG++fpY74hPpEWkyFQG97F+/XfTQVYzlR2m7nPjnwVUgATcTCMEaMvw==", - "peer": true, "requires": { "@babel/runtime": "^7.21.0", "@emotion/cache": "^11.11.0", @@ -9954,16 +9936,15 @@ } }, "@mui/system": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.14.0.tgz", - "integrity": "sha512-0HZGkX8miJbiNw+rjlZ9l0Cfkz1bSqfSHQH0EH9J+nx0aAm5cBleg9piOlLdCNIWGgecCqsw4x62erGrGjjcJg==", - "peer": true, + "version": "5.14.1", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.14.1.tgz", + "integrity": "sha512-u+xlsU34Jdkgx1CxmBnIC4Y08uPdVX5iEd3S/1dggDFtOGp+Lj8xmKRJAQ8PJOOJLOh8pDwaZx4AwXikL4l1QA==", "requires": { - "@babel/runtime": "^7.22.5", + "@babel/runtime": "^7.22.6", "@mui/private-theming": "^5.13.7", "@mui/styled-engine": "^5.13.2", "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.7", + "@mui/utils": "^5.14.1", "clsx": "^1.2.1", "csstype": "^3.1.2", "prop-types": "^15.8.1" @@ -9973,16 +9954,14 @@ "version": "7.2.4", "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.4.tgz", "integrity": "sha512-LBcwa8rN84bKF+f5sDyku42w1NTxaPgPyYKODsh01U1fVstTClbUoSA96oyRBnSNyEiAVjKm6Gwx9vjR+xyqHA==", - "peer": true, "requires": {} }, "@mui/utils": { - "version": "5.13.7", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.13.7.tgz", - "integrity": "sha512-/3BLptG/q0u36eYED7Nhf4fKXmcKb6LjjT7ZMwhZIZSdSxVqDqSTmATW3a56n3KEPQUXCU9TpxAfCBQhs6brVA==", - "peer": true, + "version": "5.14.1", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.14.1.tgz", + "integrity": "sha512-39KHKK2JeqRmuUcLDLwM+c2XfVC136C5/yUyQXmO2PVbOb2Bol4KxtkssEqCbTwg87PSCG3f1Tb0keRsK7cVGw==", "requires": { - "@babel/runtime": "^7.22.5", + "@babel/runtime": "^7.22.6", "@types/prop-types": "^15.7.5", "@types/react-is": "^18.2.1", "prop-types": "^15.8.1", @@ -9992,8 +9971,7 @@ "react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "peer": true + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" } } }, @@ -10328,7 +10306,6 @@ "version": "18.2.1", "resolved": "https://registry.npmjs.org/@types/react-is/-/react-is-18.2.1.tgz", "integrity": "sha512-wyUkmaaSZEzFZivD8F2ftSyAfk6L+DfFliVj/mYdOXbVjRcS87fQJLTnhk6dRZPuJjI+9g6RZJO4PNCngUrmyw==", - "peer": true, "requires": { "@types/react": "*" } diff --git a/package.json b/package.json index 90834eea..58af9a44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hhd-ui", - "version": "0.13.2", + "version": "0.13.3", "private": true, "dependencies": { "@ag-grid-community/client-side-row-model": "^30.0.3", @@ -10,6 +10,7 @@ "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@mui/icons-material": "^5.14.0", + "@mui/material": "^5.14.2", "@tanstack/react-table": "^8.9.3", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^14.0.0", diff --git a/src/app-bundles/chart-editor-bundle.js b/src/app-bundles/chart-editor-bundle.js index 3bffe54e..946bd459 100644 --- a/src/app-bundles/chart-editor-bundle.js +++ b/src/app-bundles/chart-editor-bundle.js @@ -286,6 +286,7 @@ const chartEditorBundle = { Object.keys(dataByInstrumentId).forEach((id) => { const { timeseries } = dataByInstrumentId[id]; + if (!timeseries || !timeseries.length) return undefined; timeseries.sort((a, b) => { @@ -300,7 +301,7 @@ const chartEditorBundle = { const x = []; const y = []; - let plotData = []; + const plotData = []; if (isInclinometer) { const negateDepth = val => val < 0 ? val : -val; @@ -339,18 +340,18 @@ const chartEditorBundle = { y.push(item.value); }); - plotData = [{ + plotData.push({ type: 'scattergl', name: `${instrumentName} - ${name}`, x: x, y: y, ...style, - }]; + }); } const domainName = getDomainName(domains, parameter_id); - if (!chartData.find(y => y.name === parameter_id)) { + if (!chartData.find(x => x.name === parameter_id)) { chartData.push({ id: series.id, name: parameter_id, @@ -358,10 +359,7 @@ const chartEditorBundle = { unit: unit_id, data: plotData, }); - } else if ( - chartData.find(x => x.name === parameter_id).unit !== unit_id && - chartData.findIndex(y => y.name === parameter_id) !== -1 - ) { + } else if (chartData.find(x => x.name === parameter_id).unit !== unit_id && chartData.findIndex(y => y.name === parameter_id) !== -1) { chartData.push({ id: series.id, name: parameter_id, @@ -370,15 +368,25 @@ const chartEditorBundle = { data: plotData, }); } else { - const found = chartData.find(x => x.name === parameter_id); - found.id = series.id; - found.data.concat(plotData); + const foundIndex = chartData.findIndex(x => x.name === parameter_id); + const item = chartData[foundIndex]; + + chartData.splice(foundIndex, 1); + + chartData.push({ + id: series.id, + name: parameter_id, + domainName, + unit: unit_id, + data: [...item.data, ...plotData], + }); } }); }); if (showRainfall) { chartData.push(...rainfallData); } + return chartData; } ), diff --git a/src/app-bundles/district-rollup-bundle.js b/src/app-bundles/district-rollup-bundle.js index b323cfcc..0f7caaa6 100644 --- a/src/app-bundles/district-rollup-bundle.js +++ b/src/app-bundles/district-rollup-bundle.js @@ -24,11 +24,18 @@ export default { selectDistrictRollupMeasurement: (state) => state.districtRollup.measurement, // one of [`evaluation`, `measurement`] - doFetchDistrictRollup: (type) => ({ dispatch, store, apiGet }) => { + doFetchDistrictRollup: (type, fromDate = '', toDate = '') => ({ dispatch, store, apiGet }) => { dispatch({ type: 'ROLLUP_FETCH_START' }); const { projectId } = store.selectProjectsIdByRoute(); - const url = `/projects/${projectId}/district_rollup/${type}_submittals`; + let query = ''; + if (fromDate && toDate) { + const formattedFrom = fromDate.toISOString(); + const formattedTo = toDate.toISOString(); + query = `?from_timestamp_month=${formattedFrom}&to_timestamp_month=${formattedTo}`; + } + + const url = `/projects/${projectId}/district_rollup/${type}_submittals${query}`; apiGet(url, (err, body) => { if (err) { diff --git a/src/app-bundles/inclinometer-measurements.js b/src/app-bundles/inclinometer-measurements.js index 28e8c25d..dce469fd 100644 --- a/src/app-bundles/inclinometer-measurements.js +++ b/src/app-bundles/inclinometer-measurements.js @@ -10,7 +10,6 @@ export default createRestBundle({ // TODO: default before and after time periods should be implemented on // the backend. getTemplate: '/timeseries/:timeseriesId/inclinometer_measurements?before=2025-01-01T00:00:00.00Z&after=1900-01-01T00:00:00.00Z', - putTemplate: '', postTemplate: '/timeseries/:timeseriesId/inclinometer_measurements', deleteTemplate: '/timeseries/:timeseriesId/inclinometer_measurements?time={:item.date}', @@ -33,4 +32,39 @@ export default createRestBundle({ return whitelist.includes(hash) || pathnameWhitelist.some(elem => url.pathname.includes(elem)); }, + addons: { + doFetchInclinometerMeasurementsByTimeseriesId: (timeseriesId) => ({ dispatch, apiGet }) => { + const uri = `/timeseries/${timeseriesId}/inclinometer_measurements?before=2025-01-01T00:00:00.00Z&after=1900-01-01T00:00:00.00Z`; + + apiGet(uri, (err, body) => { + if (err) { + // eslint-disable-next-line no-console + console.log('error: ', err); + } else { + dispatch({ + type: 'SET_CURRENT_INCLINOMETER_MEASUREMENTS', + payload: { + timeseriesId, + measurements: body, + }, + }); + } + }); + }, + + selectCurrentInclinometerMeasurements: state => state.inclinometerMeasurements.currentMeasurements, + }, + reduceFurther: (state, { type, payload }) => { + if (type === 'SET_CURRENT_INCLINOMETER_MEASUREMENTS') { + return { + ...state, + 'currentMeasurements': { + ...state['currentMeasurements'], + [payload.timeseriesId]: payload.measurements, + }, + }; + } else { + return state; + } + }, }); diff --git a/src/app-bundles/submittals-bundle.js b/src/app-bundles/submittals-bundle.js index 36cc0833..a9702658 100644 --- a/src/app-bundles/submittals-bundle.js +++ b/src/app-bundles/submittals-bundle.js @@ -95,10 +95,27 @@ export default { } else { store.doFetchMissingSubmittalsByProjectId(); store.doFetchProjectAlertConfigs(); - // store.doFetchAlertConfigSubmittals(alertConfigId); } dispatch({ type: 'PUT_VERIFY_ALL_MISSING_SUBMITTALS_FINISHED' }); }); }, + + doVerifySingleSubmittals: (submittalId) => ({ dispatch, store, apiPut }) => { + dispatch({ type: 'PUT_VERIFY_SINGLE_SUBMITTAL_START' }); + + const url = `/submittals/${submittalId}/verify_missing`; + + apiPut(url, {}, (err, _body) => { + if (err) { + // eslint-disable-next-line no-console + console.log('error: ', err); + } else { + store.doFetchHistoricalSubmittalsByProjectId(); + store.doFetchProjectAlertConfigs(); + } + + dispatch({ type: 'PUT_VERIFY_SINGLE_SUBMITTAL_FISISHED' }); + }); + }, }; diff --git a/src/app-bundles/time-series-measurements-bundle.js b/src/app-bundles/time-series-measurements-bundle.js index f66e6655..d3b16424 100644 --- a/src/app-bundles/time-series-measurements-bundle.js +++ b/src/app-bundles/time-series-measurements-bundle.js @@ -41,6 +41,7 @@ export default createRestBundle({ doTimeseriesMeasurementsFetchById: ({ timeseriesId, dateRange, + threshold = 0, }) => ({ dispatch, store, apiGet }) => { dispatch({ type: 'TIMESERIES_FETCH_BY_ID_START', payload: {} }); const [after, before] = dateRange; @@ -48,7 +49,7 @@ export default createRestBundle({ const isoAfter = after ? after.toISOString() : afterDate; const isoBefore = before ? before.toISOString() : beforeDate; - const url = `/timeseries/${timeseriesId}/measurements?after=${isoAfter}&before=${isoBefore}`; + const url = `/timeseries/${timeseriesId}/measurements?after=${isoAfter}&before=${isoBefore}&threshold=${threshold}`; const flags = store['selectTimeseriesMeasurementsFlags'](); const itemsById = store['selectTimeseriesMeasurementsItemsObject'](); let fetchCount = store['selectTimeseriesMeasurementsFetchCount'](); diff --git a/src/app-components/button/button.jsx b/src/app-components/button/button.jsx index f82c108b..e1055816 100644 --- a/src/app-components/button/button.jsx +++ b/src/app-components/button/button.jsx @@ -42,6 +42,7 @@ const Button = ({ ]); const buttonProps = { + style: { zIndex: 'auto' }, className: classes, role: 'button', type, @@ -60,7 +61,6 @@ const Button = ({ ); - // @ts-ignore return React.createElement(elem, buttonProps, ); }; diff --git a/src/app-components/chart/minify-plotly.js b/src/app-components/chart/minify-plotly.js index d0502a00..4d88ab1e 100644 --- a/src/app-components/chart/minify-plotly.js +++ b/src/app-components/chart/minify-plotly.js @@ -1,6 +1,8 @@ import * as Plotly from 'plotly.js/lib/core'; import * as Bar from 'plotly.js/lib/bar'; import * as Pie from 'plotly.js/lib/pie'; +import * as Surface from 'plotly.js/lib/surface'; +import * as Scatter3D from 'plotly.js/lib/scatter3d'; Plotly.register([ /* @@ -10,6 +12,8 @@ Plotly.register([ */ Bar, Pie, + Surface, + Scatter3D, ]); export default Plotly; \ No newline at end of file diff --git a/src/app-components/table/table.jsx b/src/app-components/table/table.jsx index e530bbed..0d2764a4 100644 --- a/src/app-components/table/table.jsx +++ b/src/app-components/table/table.jsx @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import Select from 'react-select'; import { useReactTable, createColumnHelper, @@ -6,9 +7,11 @@ import { getCoreRowModel, getSortedRowModel, getFilteredRowModel, + getPaginationRowModel, } from '@tanstack/react-table'; import { ArrowDropDown, ArrowDropUp } from '@mui/icons-material'; +import Button from '../button'; import Filter from './filter'; import { classArray } from '../../common/helpers/utils'; @@ -35,7 +38,7 @@ const multiFilterFn = (row, columnId, filterValues) => { const Table = ({ data, columns, - // usePagination = false, + usePagination = false, className, }) => { const [columnFilters, setColumnFilters] = useState([]); @@ -68,48 +71,115 @@ const Table = ({ getCoreRowModel: getCoreRowModel(), getSortedRowModel: getSortedRowModel(), getFilteredRowModel: getFilteredRowModel(), + ...usePagination && ({ + getPaginationRowModel: getPaginationRowModel(), + }), }); + const currentIndex = table.getState().pagination.pageIndex; + return ( - - - {table.getHeaderGroups()?.map(headerGroup => ( - - {headerGroup.headers.map(header => ( - - ))} - - ))} - - - {table.getRowModel()?.rows?.map(row => ( - - {row.getVisibleCells().map(cell => ( - - ))} - - ))} - -
- - {header.isPlaceholder ? null : flexRender( - header.column.columnDef.header, - header.getContext() - )} - - {{ - asc: , - desc: , - }[header.column.getIsSorted()] ?? null} - {header.column.getCanFilter() ? ( - - ) : null} -
- {flexRender(cell.column.columnDef.cell, cell.getContext())} -
+ <> + + + {table.getHeaderGroups()?.map(headerGroup => ( + + {headerGroup.headers.map(header => ( + + ))} + + ))} + + + {table.getRowModel()?.rows?.map(row => ( + + {row.getVisibleCells().map(cell => ( + + ))} + + ))} + +
+ + {header.isPlaceholder ? null : flexRender( + header.column.columnDef.header, + header.getContext() + )} + + {{ + asc: , + desc: , + }[header.column.getIsSorted()] ?? null} + {header.column.getCanFilter() ? ( + + ) : null} +
+ {flexRender(cell.column.columnDef.cell, cell.getContext())} +
+ {usePagination ? ( +
+
+
+
+
+

diff --git a/src/app-pages/project/qa-qc/components/modals/newEvaluationModal.jsx b/src/app-pages/project/qa-qc/components/modals/newEvaluationModal.jsx index e73e728f..3d0de53a 100644 --- a/src/app-pages/project/qa-qc/components/modals/newEvaluationModal.jsx +++ b/src/app-pages/project/qa-qc/components/modals/newEvaluationModal.jsx @@ -2,10 +2,10 @@ import React, { useReducer } from 'react'; import { connect } from 'redux-bundler-react'; import ReactDatePicker from 'react-datepicker'; import Select from 'react-select'; +import { DateTime } from 'luxon'; import { ModalContent, ModalBody, ModalFooter, ModalHeader } from '../../../../../app-components/modal'; import { isSaveDisabled, reduceState, initState } from '../../../../../common/helpers/form-helpers'; -import { DateTime } from 'luxon'; const buildInstrumentOptions = (instruments = []) => ( instruments.map(instrument => { diff --git a/src/app-pages/project/qa-qc/components/tables/submittalsTable.jsx b/src/app-pages/project/qa-qc/components/tables/submittalsTable.jsx index c7350b87..87f3c95a 100644 --- a/src/app-pages/project/qa-qc/components/tables/submittalsTable.jsx +++ b/src/app-pages/project/qa-qc/components/tables/submittalsTable.jsx @@ -1,46 +1,98 @@ -import React, { useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import { connect } from 'redux-bundler-react'; +import { DateTime } from 'luxon'; +import { Circle, Check } from '@mui/icons-material'; +import Searchbar from '../../../../home/search-bar'; import Table from '../../../../../app-components/table'; -import { Circle } from '@mui/icons-material'; +import Button from '../../../../../app-components/button'; + +const filterItems = (filter, items) => { + const filtered = items.filter(item => ( + Object.values(item) + .join(' ') + .toUpperCase() + .indexOf(filter.toUpperCase()) !== -1 + )); + + return filtered; +}; const SubmittalsTable = connect( 'doFetchHistoricalSubmittalsByProjectId', 'selectSubmittalsHistory', + 'doVerifySingleSubmittals', ({ doFetchHistoricalSubmittalsByProjectId, submittalsHistory, + doVerifySingleSubmittals, }) => { + const [filter, setFilter] = useState(''); + const [filteredSubmittals, setFilteredSubmittals] = useState(submittalsHistory); + useEffect(() => { doFetchHistoricalSubmittalsByProjectId(); }, [doFetchHistoricalSubmittalsByProjectId]); + useEffect(() => { + if (filter) { + setFilteredSubmittals(filterItems(filter, submittalsHistory)); + } else { + setFilteredSubmittals(submittalsHistory); + } + }, [filter, submittalsHistory, filterItems, setFilteredSubmittals]); + return ( - ( - - ), - }, { - key: 'alert_config_name', - header: 'Alert Config Name', - isSortable: true, - }, { - key: 'alert_type_name', - header: 'Alert Type Name', - isSortable: true, - }, { - key: 'create_date', - header: 'Submittal Create Date' - }, { - key: 'due_date', - header: 'Submittla Due Date', - }]} - /> + <> + setFilter(e)} placeholder='Filter History...' /> +
( + + ), + }, { + key: 'alert_config_name', + header: 'Alert Configuration Name', + isSortable: true, + }, { + key: 'alert_type_name', + header: 'Alert Type', + isSortable: true, + }, { + key: 'create_date', + header: 'Submittal Create Date', + render: data => ( + {DateTime.fromISO(data?.create_date).toFormat('MMM dd, yyyy HH:mm:ss')} + ), + }, { + key: 'due_date', + header: 'Submittal Due Date', + render: data => ( + {DateTime.fromISO(data?.due_date).toFormat('MMM dd, yyyy HH:mm:ss')} + ), + }, { + key: 'mark_missing', + header: Verify Missing, + render: data => ( + + {data?.submittal_status_name === 'red' && !data?.marked_as_missing ? ( +