diff --git a/src/app-bundles/sites-bundle.js b/src/app-bundles/sites-bundle.js index a6614fc..9655933 100644 --- a/src/app-bundles/sites-bundle.js +++ b/src/app-bundles/sites-bundle.js @@ -56,7 +56,7 @@ export default { store.doDomainBendRnFetch(); }, - doSitesFetch: (data) => ({ dispatch, store, apiGet }) => { + doSitesFetch: (siteId) => ({ dispatch, store, apiGet }) => { dispatch({ type: 'SITES_FETCH_START' }); const params = store.selectSitesParams(); const pageSize = store.selectSitesPageSize(); @@ -69,10 +69,13 @@ export default { }); const queryById = queryFromObject({ - ...data, + ...params, + ...siteId, + size: pageSize, + page: pageNumber, }); - const url = `/psapi/siteDataEntry${data ? queryById : query}`; + const url = `/psapi/siteDataEntry${siteId ? queryById : query}`; apiGet(url, (err, body) => { if (!err) { diff --git a/src/app-pages/data-entry/datasheets/components/dataHeader.js b/src/app-pages/data-entry/datasheets/components/dataHeader.js index ebf5866..033a0c3 100644 --- a/src/app-pages/data-entry/datasheets/components/dataHeader.js +++ b/src/app-pages/data-entry/datasheets/components/dataHeader.js @@ -8,76 +8,66 @@ import { Row } from 'app-pages/data-entry/edit-data-sheet/forms/_shared/helper'; import '../../dataentry.scss'; const DataHeader = connect( - 'doFetchHeaderData', 'selectHeaderData', ({ - doFetchHeaderData, headerData, id, - office, - year, - project - }) => { - useEffect(() => { - doFetchHeaderData(id, office, year, project); - }, [id, office, year, project]); - - return ( - - - -
- -
- Site ID: - {id || '--'} -
-
- Year: - {headerData?.[0]?.year || '--'} -
-
- Field Office: - {headerData?.[0]?.fieldoffice || '--'} -
-
- Project: - {headerData?.[0]?.project || '--'} -
-
- Segment: - {headerData?.[0]?.segment || '--'} -
-
- Season: - {headerData?.[0]?.season || '--'} -
-
-
-
- -
- Sample Unit Type: - {headerData?.[0]?.sampleUnitType || '--'} -
-
- Sample Unit: - {headerData?.[0]?.bend || '--'} -
-
- R/N: - {headerData?.[0]?.bendrn || '--'} -
-
- Bend River Mile: - {headerData?.[0]?.bendrivermile || '--'} -
-
-
-
-
-
- ); - }); + }) => ( + + + +
+ +
+ Site ID: + {id || '--'} +
+
+ Year: + {headerData?.[0]?.year || '--'} +
+
+ Field Office: + {headerData?.[0]?.fieldoffice || '--'} +
+
+ Project: + {headerData?.[0]?.project || '--'} +
+
+ Segment: + {headerData?.[0]?.segment || '--'} +
+
+ Season: + {headerData?.[0]?.season || '--'} +
+
+
+
+ +
+ Sample Unit Type: + {headerData?.[0]?.sampleUnitType || '--'} +
+
+ Sample Unit: + {headerData?.[0]?.bend || '--'} +
+
+ R/N: + {headerData?.[0]?.bendrn || '--'} +
+
+ Bend River Mile: + {headerData?.[0]?.bendrivermile || '--'} +
+
+
+
+
+
+ ) +); export default DataHeader; \ No newline at end of file diff --git a/src/app-pages/data-entry/datasheets/pages/site-datasheet.js b/src/app-pages/data-entry/datasheets/pages/site-datasheet.js index 2c8a7c5..3a10e15 100644 --- a/src/app-pages/data-entry/datasheets/pages/site-datasheet.js +++ b/src/app-pages/data-entry/datasheets/pages/site-datasheet.js @@ -22,7 +22,11 @@ const SiteDatasheet = connect( searchEffortSitesDatasheetTotalResults, }) => { const [currentTab, setCurrentTab] = useState(0); - const { siteId, fieldoffice, year, projectId } = sitesData[0]; + + const siteId = sitesData?.[0]?.siteId ?? null; + const fieldoffice = sitesData?.[0]?.fieldoffice ?? null; + const year = sitesData?.[0]?.year ?? null; + const projectId = sitesData?.[0]?.projectId ?? null; useEffect(() => { const params = { siteId: siteId }; @@ -41,7 +45,7 @@ const SiteDatasheet = connect( {/* Top Level Info */} - + {/* Tab Container */} diff --git a/src/common/gridCellRenderers/siteIdCellRenderer.js b/src/common/gridCellRenderers/siteIdCellRenderer.js index 9edf866..eae6096 100644 --- a/src/common/gridCellRenderers/siteIdCellRenderer.js +++ b/src/common/gridCellRenderers/siteIdCellRenderer.js @@ -5,24 +5,32 @@ import Button from 'app-components/button'; import SitesFormModal from 'app-pages/data-entry/sites-list/components/modals/sitesForm'; const SiteIdCellRenderer = connect( + 'doFetchHeaderData', 'doSitesFetch', 'doUpdateUrl', 'doModalOpen', ({ + doFetchHeaderData, doSitesFetch, doUpdateUrl, doModalOpen, edit, data, value, - }) => ( -