From 661747f8b7e4b1a92a116405fb4817bf0efea77b Mon Sep 17 00:00:00 2001 From: Jazlene Rae Guevarra <43012576+jguevarra@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:30:59 -0400 Subject: [PATCH] Fix Find Datasheet functionality (#108) --- .../datasheets/pages/find-data-sheet.js | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/app-pages/data-entry/datasheets/pages/find-data-sheet.js b/src/app-pages/data-entry/datasheets/pages/find-data-sheet.js index e77d050..1bf4a8f 100644 --- a/src/app-pages/data-entry/datasheets/pages/find-data-sheet.js +++ b/src/app-pages/data-entry/datasheets/pages/find-data-sheet.js @@ -18,6 +18,7 @@ const FindDataSheet = connect( 'doFetchTelemetryDataEntry', 'doFetchProcedureDataEntry', 'doUpdateUrl', + 'doUpdateCurrentTab', 'selectUserRole', ({ doFetchMoRiverDataEntry, @@ -27,6 +28,7 @@ const FindDataSheet = connect( doFetchTelemetryDataEntry, doFetchProcedureDataEntry, doUpdateUrl, + doUpdateCurrentTab, userRole, }) => { const [pitTag, setPitTag] = useState(''); @@ -49,24 +51,30 @@ const FindDataSheet = connect( id: userRole.id, }; - switch(dataSheetType) { + switch (dataSheetType) { + case 'missouriRiver': + doFetchMoRiverDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/missouriRiver-edit'), true); + doUpdateCurrentTab(0); + break; case 'fish': - doFetchFishDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/fish-edit'), true); + doFetchFishDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/missouriRiver-edit'), true); + doUpdateCurrentTab(1); break; case 'supplemental': - doFetchSupplementalDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/supplemental-edit'), true); + doFetchSupplementalDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/missouriRiver-edit'), true); + doUpdateCurrentTab(2); break; - case 'missouriRiver': - doFetchMoRiverDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/missouriRiver-edit'), true); + case 'procedures': + doFetchProcedureDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/missouriRiver-edit'), true); + doUpdateCurrentTab(3); break; case 'searchEffort': doFetchSearchDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/searchEffort-edit'), true); + doUpdateCurrentTab(0); break; case 'telemetry': - doFetchTelemetryDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/telemetry-edit'), true); - break; - case 'procedures': - doFetchProcedureDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/procedure-edit'), true); + doFetchTelemetryDataEntry(params, () => doUpdateUrl('/sites-list/datasheet/searchEffort-edit'), true); + doUpdateCurrentTab(1); break; default: console.log('Select a datasheet type');