Skip to content

Commit

Permalink
feedback fixes to seasons & segments filters (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
jguevarra authored Mar 27, 2024
1 parent 30a1ff4 commit 180a2d7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/app-bundles/data-entry-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ export default {
doDataEntryLoadData: () => ({ store }) => {
store.doDomainFieldOfficesFetch();
store.doDomainProjectsFetch();
store.doDomainSeasonsFetch();
store.doDomainSampleUnitTypesFetch();
},

Expand Down
11 changes: 7 additions & 4 deletions src/app-bundles/domains-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,16 @@ export default {
});
},

doDomainSeasonsFetch: () => ({ dispatch, apiGet, store }) => {
doDomainSeasonsFetch: (year = null) => ({ dispatch, apiGet, store }) => {
const project = store.selectUserRole()?.projectCode;
const office = store.selectUserRole()?.officeCode;

const url = '/psapi/seasons?' + new URLSearchParams({
project: project
});
const params = {
office: office,
project: project,
};

const url = '/psapi/seasons?' + new URLSearchParams(year === null ? params : { ...params, year: year });

apiGet(url, (_err, body) => {
dispatch({
Expand Down
2 changes: 1 addition & 1 deletion src/app-bundles/sites-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ export default {
id: store.selectUserRole()?.id,
project: store.selectUserRole()?.projectCode
};

dispatch({ type: 'UPDATE_SITE_PARAMS', payload: { ...searchParams, ...paramObj } });
store.doDomainSeasonsFetch(searchParams?.year);
store.doSitesFetch();
},
};
12 changes: 5 additions & 7 deletions src/app-pages/data-entry/sites-list/components/sites-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,13 @@ const SitesList = connect(
</div>
<div className='col-sm-4 col-xs-12'>
<div className='form-group'>
<FilterSelect
ref={segRef}
isDisabled={!yearFilter}
<Select
showPlaceholderWhileValid
label='Select Segment'
handleInputChange={value => setSegmentFilter(value)}
onChange={(_, __, val) => setSegmentValue(val)}
placeholderText='Segment...'
onChange={value => setSegmentFilter(value)}
value={segmentFilter}
placeholder='Segment...'
items={createDropdownOptions(segments)}
options={createDropdownOptions(segments)}
/>
</div>
</div>
Expand Down

0 comments on commit 180a2d7

Please sign in to comment.