UNPKG

@hisptz/react-ui

Version:

A collection of reusable complex DHIS2 react ui components.

40 lines 958 B
import { compact, isEmpty } from "lodash"; export const orgUnitRootsQuery = { orgUnitRoots: { resource: "organisationUnits", params: { fields: "id,displayName,name", userDataViewFallback: true, paging: false } } }; export const orgUnitLevelAndGroupsQuery = { orgUnitGroups: { resource: "organisationUnitGroups", params: { fields: ["id", "displayName"] } }, orgUnitLevels: { resource: "organisationUnitLevels", params: { fields: ["id", "displayName", "level"] } } }; export const orgUnitSearchQuery = { orgUnits: { resource: "organisationUnits", params: _ref => { let { keyword, groups } = _ref; return { fields: ["id,path"], filter: compact([keyword ? "identifiable:token:".concat(keyword) : undefined, !isEmpty(groups) ? "organisationUnitGroups.id:in:[".concat(groups.join(","), "]") : undefined]) }; } } };