Skip to content

Feature/location filter helper - #117

Open
delcroip wants to merge 7 commits into
developfrom
feature/location-filter-helper
Open

Feature/location filter helper#117
delcroip wants to merge 7 commits into
developfrom
feature/location-filter-helper

Conversation

@delcroip

Copy link
Copy Markdown
Member

#Thank you for your contribution to openIMIS!
#Please complete the sections below. Anything in comments is guidance and can be deleted.

Description

filter currently in insuree, would be better here

Type of Change

  • Feature
  • Bug fix
  • Chore (Refactor, Docs, CI/CD)
  • Other, please specify

Related Issue(s) / Task(s)

  • Requires [link to github PR], [link to github PR] needs to be merged first before this one
  • Relates to [link to github PR], this needs to be merged before [link to github PR]
  • External reference (e.g., Jira):

Demo

Upload screenshots/gifs or link to any demo video here.

Checklist

  • Unit tests added/modified
  • I18n / translation handled

delcroip added 7 commits June 9, 2026 14:05
- Replace direct prop references with shallow copies (`[...props.lXs]`)
  to avoid unintended state mutations across location levels (l0s–l3s)
- Add null/undefined fallback (`? [...prop] : []`) when spreading
  location arrays into state to prevent runtime errors
- Refactor list updates to use immutable `map` instead of mutating
  array elements directly via `delete` on filtered results
- Guard against missing `state.action` or `state.location` before
  processing post-mutation state updates
- Use spread to copy mutation object before journalizing
- Add missing `location.addLocation` translation key to `en.json`
…tocomplete

Refactor `HealthFacilityLegalFormPicker` and `HealthFacilitySubLevelPicker`
from class-based components using static `ConstantBasedPicker` to functional
components that fetch data dynamically via `useGraphqlQuery`. Both pickers
now use the `Autocomplete` component and support `withNull`, `withLabel`,
`withPlaceholder`, `readOnly`, and `required` props, providing a more
flexible and data-driven approach instead of relying on hardcoded constants.
Replace `null` with `""` for Select component state values in
`DeleteLocationDialog` and `MoveLocationDialog` to prevent React
MUI controlled/uncontrolled component warnings.

Additionally, auto-select the first available reassign location
when switching to the reassign action in `DeleteLocationDialog`,
and add value resolution logic in `MoveLocationDialog` to ensure
object-based values are matched correctly against their list.
…onCascader

- Import `getLocationLevel` utility to validate selection depth
- Add `required` and `requiredLevel` props to enforce minimum location depth
- Show error state and message when selection doesn't meet required level
- Fix CSS specificity by adding `&` prefix to nested selectors
- Add full-width styles to cascader root, `.rc-cascader`, and `.MuiFormControl-root`
- Prevent clearing invalid selection state when user picks a partial path
… placement

- Introduce `LocationCascaderMobile` component for small screens, rendered
  conditionally via `useMediaQuery` on the `sm` breakpoint
- Add `CASCADER_BUILT_IN_PLACEMENTS` config to control dropdown overflow and
  alignment (adjustX/Y, shiftX/Y, htmlRegion scroll)
- Implement `updatePlacement` to dynamically switch between `bottomLeft` and
  `bottomRight` based on available viewport space
- Compute adaptive `columnWidth` relative to viewport width on open
- Simplify `extractPathFromValue` to return only `uuids`, removing unused
  `names` array
- Extract `isLevelValid`, `getLevelErrorMessage`, and `handleLevelErrorChange`
  as named helpers for improved readability
- Replace viewport-width-only mobile detection with a combined check
  using both narrow viewport (`breakpoints.down("sm")`) and coarse
  pointer media query, ensuring touch devices are correctly identified
  regardless of screen size
- Remove manual placement calculation logic (`updatePlacement`,
  `handleOpenChange`, `CASCADER_BUILT_IN_PLACEMENTS`, `columnWidth`
  state) in favor of simpler built-in dropdown behavior
- Replace `dvh` units with `vh` fallback in `StyledDrawerPaper` and
  use `@supports` progressive enhancement for dynamic viewport height,
  improving compatibility with older browsers
- Add `handleActivate` in `LocationCascaderMobile` to prevent default
  event behavior and guard against `readOnly` state on activation
- Add `noSsr: true` to `useMediaQuery` calls to avoid SSR mismatch
…ilters

Introduce a new function that traverses a location's parent chain to generate filters for each level, enabling location-based filtering with configurable depth and anchor endpoint.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
8.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request next-release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants