Skip to content

Commit

Permalink
Merge pull request #473 from ertush/hotfix
Browse files Browse the repository at this point in the history
Fixed the Naviagtions Button click handlers in facilities/index page
  • Loading branch information
ertush authored Sep 5, 2024
2 parents a65604b + f357077 commit 3cf4162
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions pages/facilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function FacilityHome (props){

const userSubCounty = userCtx?.user_sub_counties[0]?.sub_county

const [searchTerm, setSearchTerm] = useState('')


// const qf = props?.query?.qf ?? null

Expand Down Expand Up @@ -165,7 +167,9 @@ function FacilityHome (props){
pathname:'/facilities',
query: {
next: Buffer.from(`${props?.next}`).toString('base64'),
...userOrgUnit
...userOrgUnit,
...(() => searchTerm !== '' ? ({q: searchTerm}) : ({}))()

//default: page_size=30

// ...params
Expand All @@ -183,7 +187,10 @@ function FacilityHome (props){
pathname:'/facilities',
query: {
previous: Buffer.from(`${props?.previous}`).toString('base64'),
...userOrgUnit //default: page_size=30
...userOrgUnit,
...(() => searchTerm !== '' ? ({q: searchTerm}) : ({}))()

//default: page_size=30
//...params
}
})
Expand All @@ -195,11 +202,14 @@ function FacilityHome (props){

// const params = Object.fromEntries(pageParams.entries())


router.push({
pathname:'/facilities',
query: {
page,
...userOrgUnit()
...userOrgUnit(),
...(() => searchTerm !== '' ? ({q: searchTerm}) : ({}))()

// ...params
}
})
Expand Down Expand Up @@ -549,6 +559,9 @@ function FacilityHome (props){
const href = new URL(window.location.href)
const filter = href.searchParams.get('filter')
// console.log({values})
setSearchTerm(query)


switch(filter){
case "all_facilities":
router.push(`/facilities/?q=${query}&filter=all_facilities`)
Expand Down

0 comments on commit 3cf4162

Please sign in to comment.