diff --git a/src/components/WorkerImportDialog.js b/src/components/WorkerImportDialog.js
index 8542984..234c7c5 100644
--- a/src/components/WorkerImportDialog.js
+++ b/src/components/WorkerImportDialog.js
@@ -57,16 +57,16 @@ function WorkerImportDialog({
onChange={(event) => setImportPlan(event.target.value)}
>
{WORKER_IMPORT_PLANS.map(({ value, labelKey }) => (
- <>
- }
- label={formatMessage(labelKey)}
- />
- {importPlan === WORKER_IMPORT_GROUP_OF_WORKERS && }
- >
+ }
+ label={formatMessage(labelKey)}
+ />
))}
+ {importPlan === WORKER_IMPORT_GROUP_OF_WORKERS && (
+
+ )}
diff --git a/src/pickers/GroupPicker.js b/src/pickers/GroupPicker.js
index 86e514a..0f51fd0 100644
--- a/src/pickers/GroupPicker.js
+++ b/src/pickers/GroupPicker.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useState, useMemo } from 'react';
+import React, { useEffect, useMemo } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { useModulesManager, useTranslations, Autocomplete } from '@openimis/fe-core';
@@ -6,7 +6,7 @@ import { fetchGroupsAction } from '../actions';
import { ADMIN_RIGHT, MODULE_NAME } from '../constants';
function GroupPicker({
- withLabel = true, withPlaceholder = true, label, onChange,
+ withLabel = true, withPlaceholder = true, label, onChange, currentGroup,
}) {
const modulesManager = useModulesManager();
const dispatch = useDispatch();
@@ -18,8 +18,6 @@ function GroupPicker({
const { economicUnit } = useSelector((state) => state.policyHolder);
const rights = useSelector((state) => state.core?.user?.i_user?.rights ?? []);
- const [group, setGroup] = useState(null);
-
const isAdmin = useMemo(() => rights.includes(ADMIN_RIGHT), [rights]);
useEffect(() => {
@@ -36,7 +34,6 @@ function GroupPicker({
const handleChange = (selectedGroup) => {
onChange(selectedGroup);
- setGroup(selectedGroup);
};
return (
@@ -48,7 +45,7 @@ function GroupPicker({
options={groups}
isLoading={fetchingGroups}
isFetched={fetchedGroups}
- value={group}
+ value={currentGroup}
getOptionLabel={groupLabel}
onChange={handleChange}
onInputChange={() => {}}
diff --git a/src/pickers/WorkerMultiplePicker.js b/src/pickers/WorkerMultiplePicker.js
index 33caeb0..0bb38c8 100644
--- a/src/pickers/WorkerMultiplePicker.js
+++ b/src/pickers/WorkerMultiplePicker.js
@@ -116,9 +116,9 @@ function WorkerMultiplePicker({
const handleImport = () => {
setConfigurationDialogOpen(false);
- const currentWorkersSet = new Set(value.map((worker) => worker.id));
+ const currentWorkersSet = new Set(value.map((worker) => worker.uuid));
const importedWorkers = importPlanWorkers(importPlan);
- const uniqueImportedWorkers = importedWorkers.filter((worker) => !currentWorkersSet.has(worker.id));
+ const uniqueImportedWorkers = importedWorkers.filter((worker) => !currentWorkersSet.has(worker.uuid));
const updatedWorkers = [...value, ...uniqueImportedWorkers];
onChange(null, updatedWorkers);