Skip to content

Commit

Permalink
Merge pull request #1329 from BLSQ/IA-2905-orgunit-tooltip
Browse files Browse the repository at this point in the history
IA-2905: missing org unit tooltip
  • Loading branch information
beygorghor authored May 30, 2024
2 parents 75997c5 + 736d2cc commit 90ec9e6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions hat/assets/js/apps/Iaso/domains/orgUnits/utils.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import React, { useCallback } from 'react';

import { textPlaceholder, useSafeIntl } from 'bluesquare-components';

import { orderOrgUnitsByDepth } from '../../utils/map/mapUtils.ts';

import { useGetOrgUnitValidationStatus } from './hooks/utils/useGetOrgUnitValidationStatus.ts';
import MESSAGES from './messages';
import { useGetValidationStatus } from '../forms/hooks/useGetValidationStatus.ts';

export const fetchLatestOrgUnitLevelId = levels => {
if (levels) {
Expand Down Expand Up @@ -191,13 +191,18 @@ export const getOrgUnitAncestors = orgUnit => {
};

export const useGetStatusMessage = () => {
const { data: validationStatusOptions } = useGetValidationStatus();
if (!validationStatusOptions) return () => '';
const getStatusMessage = status =>
validationStatusOptions.find(option => option.value === status)?.label;
const { data: validationStatusOptions } = useGetOrgUnitValidationStatus();
const getStatusMessage = useCallback(
status => {
if (!validationStatusOptions) return '';
return validationStatusOptions.find(
option => option.value === status,
)?.label;
},
[validationStatusOptions],
);
return getStatusMessage;
};

export const getOrgUnitGroups = orgUnit => (
<span>
{orgUnit.groups &&
Expand Down

0 comments on commit 90ec9e6

Please sign in to comment.