diff --git a/frontend/src/components/admin/testManagementConfigMenu/MethodRenameEntry.js b/frontend/src/components/admin/testManagementConfigMenu/MethodRenameEntry.js
index 0267a97e7..07ed8f440 100644
--- a/frontend/src/components/admin/testManagementConfigMenu/MethodRenameEntry.js
+++ b/frontend/src/components/admin/testManagementConfigMenu/MethodRenameEntry.js
@@ -1,35 +1,7 @@
import React, { useContext, useState, useEffect, useRef } from "react";
-import {
- Form,
- Heading,
- Button,
- Loading,
- Grid,
- Column,
- Section,
- DataTable,
- Table,
- TableHead,
- TableRow,
- TableBody,
- TableHeader,
- TableCell,
- TableSelectRow,
- TableSelectAll,
- TableContainer,
- Pagination,
- Search,
- Select,
- SelectItem,
- Stack,
- UnorderedList,
- ListItem,
-} from "@carbon/react";
+import { Heading, Button, Grid, Column, Section } from "@carbon/react";
import {
getFromOpenElisServer,
- postToOpenElisServer,
- postToOpenElisServerFormData,
- postToOpenElisServerFullResponse,
postToOpenElisServerJsonResponse,
} from "../../utils/Utils.js";
import { NotificationContext } from "../../layout/Layout.js";
@@ -39,8 +11,7 @@ import {
} from "../../common/CustomNotification.js";
import { FormattedMessage, injectIntl, useIntl } from "react-intl";
import PageBreadCrumb from "../../common/PageBreadCrumb.js";
-import CustomCheckBox from "../../common/CustomCheckBox.js";
-import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js";
+import RenameModelBox from "./renameModel/RenameModelBox.js";
let breadcrumbs = [
{ label: "home.label", link: "/" },
@@ -62,31 +33,198 @@ function MethodRenameEntry() {
const intl = useIntl();
const componentMounted = useRef(false);
+ const modalHeading = intl.formatMessage({
+ id: "method.browse.title",
+ });
+
+ const [isLoading, setIsLoading] = useState(false);
+ const [finished, setFinished] = useState(true);
+ const [isAddModalOpen, setIsAddModalOpen] = useState(false);
+ const [confirmationStep, setConfirmationStep] = useState(false);
+ const [inputError, setInputError] = useState(false);
+ const [methodRename, setMethodRename] = useState({});
+ const [methodListShow, setMethodListShow] = useState([]);
+ const [methodRenamePost, setMethodRenamePost] = useState({});
+ const [entityNamesProvider, setEntityNamesProvider] = useState({});
+ const [entityNamesProviderPost, setEntityNamesProviderPost] = useState({});
+ const [entityId, setEntityId] = useState();
+ const [entityName, setEntityName] = useState("method");
+ const [selectedItem, setSelectedItem] = useState({});
+
+ useEffect(() => {
+ componentMounted.current = true;
+ getFromOpenElisServer("/rest/MethodRenameEntry", handleMethodRename);
+ return () => {
+ componentMounted.current = false;
+ };
+ }, []);
+
+ const handleMethodRename = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setMethodRename(res);
+ setMethodRenamePost(res);
+ setMethodListShow(res.methodList);
+ }
+ };
+
+ useEffect(() => {
+ getFromOpenElisServer(
+ `/rest/EntityNamesProvider?entityId=${entityId}&entityName=${entityName}`,
+ handelEntityNamesProvider,
+ );
+ }, [entityId]);
+
+ const handelEntityNamesProvider = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setEntityNamesProvider(res);
+ setEntityNamesProviderPost(res);
+ }
+ };
+
+ function methodRenameUpdatePost() {
+ setIsLoading(true);
+ if (confirmationStep) {
+ postToOpenElisServerJsonResponse(
+ `/rest/MethodRenameEntry`,
+ JSON.stringify(methodRenamePost),
+ (res) => {
+ methodRenameUpdatePostCallback(res);
+ },
+ );
+ } else {
+ setConfirmationStep(true);
+ }
+ }
+
+ function methodRenameUpdatePostCallback(res) {
+ if (res) {
+ setIsLoading(false);
+ setFinished(false);
+ addNotification({
+ title: intl.formatMessage({
+ id: "notification.title",
+ }),
+ message: intl.formatMessage({
+ id: "notification.user.post.save.success",
+ }),
+ kind: NotificationKinds.success,
+ });
+ setNotificationVisible(true);
+ setIsAddModalOpen(false);
+ } else {
+ addNotification({
+ kind: NotificationKinds.error,
+ title: intl.formatMessage({ id: "notification.title" }),
+ message: intl.formatMessage({ id: "server.error.msg" }),
+ });
+ setNotificationVisible(true);
+ setTimeout(() => {
+ window.location.reload();
+ }, 200);
+ }
+ }
+
+ const openAppModle = (item) => {
+ setConfirmationStep(false);
+ setIsAddModalOpen(true);
+ setEntityId(item.id);
+ // setEntityName(test.value);
+ setSelectedItem(item);
+ };
+
+ const onInputChangeEn = (e) => {
+ const englishName = e.target.value;
+ setEntityNamesProviderPost((prev) => ({
+ name: {
+ ...prev.name,
+ english: englishName,
+ },
+ }));
+ setInputError(false);
+ };
+
+ const onInputChangeFr = (e) => {
+ const frenchName = e.target.value;
+ setEntityNamesProviderPost((prev) => ({
+ name: {
+ ...prev.name,
+ french: frenchName,
+ },
+ }));
+ setInputError(false);
+ };
+
+ useEffect(() => {
+ if (entityId && entityNamesProviderPost && entityNamesProviderPost.name) {
+ setMethodRenamePost((prev) => ({
+ ...prev,
+ methodId: entityId,
+ nameEnglish: entityNamesProviderPost.name.english,
+ nameFrench: entityNamesProviderPost.name.french,
+ }));
+ }
+ }, [entityNamesProviderPost, entityId]);
+
+ const closeAddModal = () => {
+ setIsAddModalOpen(false);
+ };
return (
<>
{notificationVisible === true ? : ""}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
>
);
diff --git a/frontend/src/components/admin/testManagementConfigMenu/SampleTypeRenameEntry.js b/frontend/src/components/admin/testManagementConfigMenu/SampleTypeRenameEntry.js
index 02424cc27..57a028c84 100644
--- a/frontend/src/components/admin/testManagementConfigMenu/SampleTypeRenameEntry.js
+++ b/frontend/src/components/admin/testManagementConfigMenu/SampleTypeRenameEntry.js
@@ -1,35 +1,7 @@
import React, { useContext, useState, useEffect, useRef } from "react";
-import {
- Form,
- Heading,
- Button,
- Loading,
- Grid,
- Column,
- Section,
- DataTable,
- Table,
- TableHead,
- TableRow,
- TableBody,
- TableHeader,
- TableCell,
- TableSelectRow,
- TableSelectAll,
- TableContainer,
- Pagination,
- Search,
- Select,
- SelectItem,
- Stack,
- UnorderedList,
- ListItem,
-} from "@carbon/react";
+import { Heading, Button, Grid, Column, Section } from "@carbon/react";
import {
getFromOpenElisServer,
- postToOpenElisServer,
- postToOpenElisServerFormData,
- postToOpenElisServerFullResponse,
postToOpenElisServerJsonResponse,
} from "../../utils/Utils.js";
import { NotificationContext } from "../../layout/Layout.js";
@@ -39,8 +11,7 @@ import {
} from "../../common/CustomNotification.js";
import { FormattedMessage, injectIntl, useIntl } from "react-intl";
import PageBreadCrumb from "../../common/PageBreadCrumb.js";
-import CustomCheckBox from "../../common/CustomCheckBox.js";
-import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js";
+import RenameModelBox from "./renameModel/RenameModelBox.js";
let breadcrumbs = [
{ label: "home.label", link: "/" },
@@ -62,31 +33,199 @@ function SampleTypeRenameEntry() {
const intl = useIntl();
const componentMounted = useRef(false);
+ const modalHeading = intl.formatMessage({ id: "field.sampleType" });
+
+ const [isLoading, setIsLoading] = useState(false);
+ const [finished, setFinished] = useState(true);
+ const [isAddModalOpen, setIsAddModalOpen] = useState(false);
+ const [confirmationStep, setConfirmationStep] = useState(false);
+ const [inputError, setInputError] = useState(false);
+ const [sampleType, setSampleType] = useState({});
+ const [sampleTypeListShow, setSampleTypeListShow] = useState([]);
+ const [sampleTypePost, setSampleTypePost] = useState({});
+ const [entityNamesProvider, setEntityNamesProvider] = useState({});
+ const [entityNamesProviderPost, setEntityNamesProviderPost] = useState({});
+ const [entityId, setEntityId] = useState();
+ const [entityName, setEntityName] = useState("sampleType");
+ const [selectedItem, setSelectedItem] = useState({});
+
+ useEffect(() => {
+ componentMounted.current = true;
+ getFromOpenElisServer(
+ "/rest/SampleTypeRenameEntry",
+ handelSampleTypeRename,
+ );
+ return () => {
+ componentMounted.current = false;
+ };
+ }, []);
+
+ const handelSampleTypeRename = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setSampleType(res);
+ setSampleTypePost(res);
+ setSampleTypeListShow(res.sampleTypeList);
+ }
+ };
+
+ useEffect(() => {
+ getFromOpenElisServer(
+ `/rest/EntityNamesProvider?entityId=${entityId}&entityName=${entityName}`,
+ handelEntityNamesProvider,
+ );
+ }, [entityId]);
+
+ const handelEntityNamesProvider = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setEntityNamesProvider(res);
+ setEntityNamesProviderPost(res);
+ }
+ };
+
+ function sampleTypeUpdatePost() {
+ setIsLoading(true);
+ if (confirmationStep) {
+ postToOpenElisServerJsonResponse(
+ `/rest/SampleTypeRenameEntry`,
+ JSON.stringify(sampleTypePost),
+ (res) => {
+ sampleTypeUpdatePostCallback(res);
+ },
+ );
+ } else {
+ setConfirmationStep(true);
+ }
+ }
+
+ function sampleTypeUpdatePostCallback(res) {
+ if (res) {
+ setIsLoading(false);
+ setFinished(false);
+ addNotification({
+ title: intl.formatMessage({
+ id: "notification.title",
+ }),
+ message: intl.formatMessage({
+ id: "notification.user.post.save.success",
+ }),
+ kind: NotificationKinds.success,
+ });
+ setNotificationVisible(true);
+ setIsAddModalOpen(false);
+ } else {
+ addNotification({
+ kind: NotificationKinds.error,
+ title: intl.formatMessage({ id: "notification.title" }),
+ message: intl.formatMessage({ id: "server.error.msg" }),
+ });
+ setNotificationVisible(true);
+ setTimeout(() => {
+ window.location.reload();
+ }, 200);
+ }
+ }
+
+ const openAppModle = (item) => {
+ setConfirmationStep(false);
+ setIsAddModalOpen(true);
+ setEntityId(item.id);
+ // setEntityName(test.value);
+ setSelectedItem(item);
+ };
+
+ const onInputChangeEn = (e) => {
+ const englishName = e.target.value;
+ setEntityNamesProviderPost((prev) => ({
+ name: {
+ ...prev.name,
+ english: englishName,
+ },
+ }));
+ setInputError(false);
+ };
+
+ const onInputChangeFr = (e) => {
+ const frenchName = e.target.value;
+ setEntityNamesProviderPost((prev) => ({
+ name: {
+ ...prev.name,
+ french: frenchName,
+ },
+ }));
+ setInputError(false);
+ };
+
+ useEffect(() => {
+ if (entityId && entityNamesProviderPost && entityNamesProviderPost.name) {
+ setSampleTypePost((prev) => ({
+ ...prev,
+ sampleTypeId: entityId,
+ nameEnglish: entityNamesProviderPost.name.english,
+ nameFrench: entityNamesProviderPost.name.french,
+ }));
+ }
+ }, [entityNamesProviderPost, entityId]);
+
+ const closeAddModal = () => {
+ setIsAddModalOpen(false);
+ };
return (
<>
{notificationVisible === true ? : ""}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
>
);
diff --git a/frontend/src/components/admin/testManagementConfigMenu/SelectListRenameEntry.js b/frontend/src/components/admin/testManagementConfigMenu/SelectListRenameEntry.js
index aeb45f6a5..608933d74 100644
--- a/frontend/src/components/admin/testManagementConfigMenu/SelectListRenameEntry.js
+++ b/frontend/src/components/admin/testManagementConfigMenu/SelectListRenameEntry.js
@@ -1,35 +1,16 @@
import React, { useContext, useState, useEffect, useRef } from "react";
import {
- Form,
Heading,
Button,
- Loading,
Grid,
Column,
Section,
- DataTable,
- Table,
- TableHead,
- TableRow,
- TableBody,
- TableHeader,
- TableCell,
- TableSelectRow,
- TableSelectAll,
- TableContainer,
- Pagination,
- Search,
- Select,
- SelectItem,
- Stack,
- UnorderedList,
- ListItem,
+ Loading,
+ Modal,
+ TextInput,
} from "@carbon/react";
import {
getFromOpenElisServer,
- postToOpenElisServer,
- postToOpenElisServerFormData,
- postToOpenElisServerFullResponse,
postToOpenElisServerJsonResponse,
} from "../../utils/Utils.js";
import { NotificationContext } from "../../layout/Layout.js";
@@ -39,8 +20,6 @@ import {
} from "../../common/CustomNotification.js";
import { FormattedMessage, injectIntl, useIntl } from "react-intl";
import PageBreadCrumb from "../../common/PageBreadCrumb.js";
-import CustomCheckBox from "../../common/CustomCheckBox.js";
-import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js";
let breadcrumbs = [
{ label: "home.label", link: "/" },
@@ -62,31 +41,315 @@ function SelectListRenameEntry() {
const intl = useIntl();
const componentMounted = useRef(false);
+ const modalHeading = intl.formatMessage({
+ id: "selectListRenameEntry.selectListEdit",
+ });
+
+ const [isLoading, setIsLoading] = useState(false);
+ const [finished, setFinished] = useState(true);
+ const [isAddModalOpen, setIsAddModalOpen] = useState(false);
+ const [confirmationStep, setConfirmationStep] = useState(false);
+ const [inputError, setInputError] = useState(false);
+ const [selectListRename, setSelectListRename] = useState({});
+ const [selectListRenameListShow, setSelectListRenameListShow] = useState([]);
+ const [displayValueList, setDisplayValueList] = useState([]);
+ const [selectListRenamePost, setSelectListRenamePost] = useState({});
+ const [selectedItem, setSelectedItem] = useState({});
+
+ useEffect(() => {
+ componentMounted.current = true;
+ getFromOpenElisServer(
+ "/rest/SelectListRenameEntry",
+ handleSelectListRename,
+ );
+ return () => {
+ componentMounted.current = false;
+ };
+ }, []);
+
+ const handleSelectListRename = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setSelectListRename(res);
+ setSelectListRenamePost(res);
+ setSelectListRenameListShow(res.resultSelectOptionList);
+ }
+ };
+
+ function selectListRenameUpdatePost() {
+ setIsLoading(true);
+ if (confirmationStep) {
+ postToOpenElisServerJsonResponse(
+ `/rest/SelectListRenameEntry`,
+ JSON.stringify(selectListRenamePost),
+ (res) => {
+ selectListRenameUpdatePostCallback(res);
+ },
+ );
+ } else {
+ setConfirmationStep(true);
+ }
+ }
+
+ function selectListRenameUpdatePostCallback(res) {
+ if (res) {
+ setIsLoading(false);
+ setFinished(false);
+ addNotification({
+ title: intl.formatMessage({
+ id: "notification.title",
+ }),
+ message: intl.formatMessage({
+ id: "notification.user.post.save.success",
+ }),
+ kind: NotificationKinds.success,
+ });
+ setNotificationVisible(true);
+ setIsAddModalOpen(false);
+ } else {
+ addNotification({
+ kind: NotificationKinds.error,
+ title: intl.formatMessage({ id: "notification.title" }),
+ message: intl.formatMessage({ id: "server.error.msg" }),
+ });
+ setNotificationVisible(true);
+ setTimeout(() => {
+ window.location.reload();
+ }, 200);
+ }
+ }
+
+ const openAppModle = (item) => {
+ setConfirmationStep(false);
+ setIsAddModalOpen(true);
+ setSelectedItem(item);
+ };
+
+ const onInputChangeEn = (e, index) => {
+ const updatedValue = e.target.value;
+ setDisplayValueList((prevList) =>
+ prevList.map((item, i) =>
+ i === index ? { ...item, displayValueEnglish: updatedValue } : item,
+ ),
+ );
+ setSelectedItem((prev) => ({ ...prev, displayValueEnglish: updatedValue }));
+ setInputError(false);
+ };
+
+ const onInputChangeFr = (e, index) => {
+ const updatedValue = e.target.value;
+ setDisplayValueList((prevList) =>
+ prevList.map((item, i) =>
+ i === index ? { ...item, displayValueFrench: updatedValue } : item,
+ ),
+ );
+ setSelectedItem((prev) => ({ ...prev, displayValueFrench: updatedValue }));
+ setInputError(false);
+ };
+
+ useEffect(() => {
+ if (selectedItem) {
+ setSelectListRenamePost((prev) => ({
+ ...prev,
+ resultSelectOptionId: selectedItem.id,
+ nameEnglish: selectedItem.displayValueEnglish,
+ nameFrench: selectedItem.displayValueFrench,
+ }));
+ }
+ }, [selectedItem]);
+
+ const closeAddModal = () => {
+ setIsAddModalOpen(false);
+ };
+
+ useEffect(() => {
+ if (selectListRenameListShow && selectListRenameListShow.length > 0) {
+ const extractedValues = selectListRenameListShow.map((item) => ({
+ id: item.id,
+ displayValueEnglish: item.displayValue,
+ displayValueFrench: item.displayValue,
+ }));
+ setDisplayValueList(extractedValues);
+ }
+ }, [selectListRenameListShow]);
return (
<>
{notificationVisible === true ? : ""}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {displayValueList ? (
+
+ {displayValueList.map((valueItem, index) => (
+
+
+
+ >
+ ) : (
+ <>
+
+ >
+ )
+ }
+ secondaryButtonText={
+ confirmationStep ? (
+ <>
+
+ >
+ ) : (
+ <>
+
+ >
+ )
+ }
+ onRequestSubmit={selectListRenameUpdatePost}
+ onRequestClose={closeAddModal}
+ >
+ {displayValueList &&
+ valueItem &&
+ valueItem.id &&
+ valueItem.displayValueEnglish &&
+ valueItem.displayValueFrench ? (
+
+
+
+
+
+
+ <>
+ :{" "}
+ {selectedItem.displayValueEnglish}
+ >
+
+
+ {
+ onInputChangeEn(e, index);
+ }}
+ required
+ invalid={inputError}
+ invalidText={
+
+ }
+ />
+
+ <>
+ :{" "}
+ {selectedItem.displayValueFrench}
+ >
+
+
+ {
+ onInputChangeFr(e, index);
+ }}
+ required
+ invalid={inputError}
+ invalidText={
+
+ }
+ />
+
+
+ ) : (
+ <>
+
+
+
+ >
+ )}
+
+ {confirmationStep && (
+ <>
+
+ >
+ )}
+
+
+
+ ))}
+
+ ) : (
+ <>
+
+ >
+ )}
+
>
);
diff --git a/frontend/src/components/admin/testManagementConfigMenu/TestSectionRenameEntry.js b/frontend/src/components/admin/testManagementConfigMenu/TestSectionRenameEntry.js
index 186885afb..c220f52c1 100644
--- a/frontend/src/components/admin/testManagementConfigMenu/TestSectionRenameEntry.js
+++ b/frontend/src/components/admin/testManagementConfigMenu/TestSectionRenameEntry.js
@@ -1,35 +1,7 @@
import React, { useContext, useState, useEffect, useRef } from "react";
-import {
- Form,
- Heading,
- Button,
- Loading,
- Grid,
- Column,
- Section,
- DataTable,
- Table,
- TableHead,
- TableRow,
- TableBody,
- TableHeader,
- TableCell,
- TableSelectRow,
- TableSelectAll,
- TableContainer,
- Pagination,
- Search,
- Select,
- SelectItem,
- Stack,
- UnorderedList,
- ListItem,
-} from "@carbon/react";
+import { Heading, Button, Grid, Column, Section } from "@carbon/react";
import {
getFromOpenElisServer,
- postToOpenElisServer,
- postToOpenElisServerFormData,
- postToOpenElisServerFullResponse,
postToOpenElisServerJsonResponse,
} from "../../utils/Utils.js";
import { NotificationContext } from "../../layout/Layout.js";
@@ -39,8 +11,7 @@ import {
} from "../../common/CustomNotification.js";
import { FormattedMessage, injectIntl, useIntl } from "react-intl";
import PageBreadCrumb from "../../common/PageBreadCrumb.js";
-import CustomCheckBox from "../../common/CustomCheckBox.js";
-import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js";
+import RenameModelBox from "./renameModel/RenameModelBox.js";
let breadcrumbs = [
{ label: "home.label", link: "/" },
@@ -62,31 +33,201 @@ function TestSectionRenameEntry() {
const intl = useIntl();
const componentMounted = useRef(false);
+ const modalHeading = intl.formatMessage({
+ id: "test.section.label",
+ });
+
+ const [isLoading, setIsLoading] = useState(false);
+ const [finished, setFinished] = useState(true);
+ const [isAddModalOpen, setIsAddModalOpen] = useState(false);
+ const [confirmationStep, setConfirmationStep] = useState(false);
+ const [inputError, setInputError] = useState(false);
+ const [testSectionName, setTestSectionName] = useState({});
+ const [testSectionListShow, setTestSectionListShow] = useState([]);
+ const [testSectionPost, setTestSectionPost] = useState({});
+ const [entityNamesProvider, setEntityNamesProvider] = useState({});
+ const [entityNamesProviderPost, setEntityNamesProviderPost] = useState({});
+ const [entityId, setEntityId] = useState();
+ const [entityName, setEntityName] = useState("testSection");
+ const [selectedItem, setSelectedItem] = useState({});
+
+ useEffect(() => {
+ componentMounted.current = true;
+ getFromOpenElisServer(
+ "/rest/TestSectionRenameEntry",
+ handelTestSectionRename,
+ );
+ return () => {
+ componentMounted.current = false;
+ };
+ }, []);
+
+ const handelTestSectionRename = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setTestSectionName(res);
+ setTestSectionPost(res);
+ setTestSectionListShow(res.testSectionList);
+ }
+ };
+
+ useEffect(() => {
+ getFromOpenElisServer(
+ `/rest/EntityNamesProvider?entityId=${entityId}&entityName=${entityName}`,
+ handelEntityNamesProvider,
+ );
+ }, [entityId]);
+
+ const handelEntityNamesProvider = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setEntityNamesProvider(res);
+ setEntityNamesProviderPost(res);
+ }
+ };
+
+ function testSectionUpdatePost() {
+ setIsLoading(true);
+ if (confirmationStep) {
+ postToOpenElisServerJsonResponse(
+ `/rest/TestSectionRenameEntry`,
+ JSON.stringify(testSectionPost),
+ (res) => {
+ testSectionUpdatePostCallback(res);
+ },
+ );
+ } else {
+ setConfirmationStep(true);
+ }
+ }
+
+ function testSectionUpdatePostCallback(res) {
+ if (res) {
+ setIsLoading(false);
+ setFinished(false);
+ addNotification({
+ title: intl.formatMessage({
+ id: "notification.title",
+ }),
+ message: intl.formatMessage({
+ id: "notification.user.post.save.success",
+ }),
+ kind: NotificationKinds.success,
+ });
+ setNotificationVisible(true);
+ setIsAddModalOpen(false);
+ } else {
+ addNotification({
+ kind: NotificationKinds.error,
+ title: intl.formatMessage({ id: "notification.title" }),
+ message: intl.formatMessage({ id: "server.error.msg" }),
+ });
+ setNotificationVisible(true);
+ setTimeout(() => {
+ window.location.reload();
+ }, 200);
+ }
+ }
+
+ const openAppModle = (item) => {
+ setConfirmationStep(false);
+ setIsAddModalOpen(true);
+ setEntityId(item.id);
+ // setEntityName(test.value);
+ setSelectedItem(item);
+ };
+
+ const onInputChangeEn = (e) => {
+ const englishName = e.target.value;
+ setEntityNamesProviderPost((prev) => ({
+ name: {
+ ...prev.name,
+ english: englishName,
+ },
+ }));
+ setInputError(false);
+ };
+
+ const onInputChangeFr = (e) => {
+ const frenchName = e.target.value;
+ setEntityNamesProviderPost((prev) => ({
+ name: {
+ ...prev.name,
+ french: frenchName,
+ },
+ }));
+ setInputError(false);
+ };
+
+ useEffect(() => {
+ if (entityId && entityNamesProviderPost && entityNamesProviderPost.name) {
+ setTestSectionPost((prev) => ({
+ ...prev,
+ testSectionId: entityId,
+ nameEnglish: entityNamesProviderPost.name.english,
+ nameFrench: entityNamesProviderPost.name.french,
+ }));
+ }
+ }, [entityNamesProviderPost, entityId]);
+
+ const closeAddModal = () => {
+ setIsAddModalOpen(false);
+ };
return (
<>
{notificationVisible === true ? : ""}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
>
);
diff --git a/frontend/src/components/admin/testManagementConfigMenu/UomRenameEntry.js b/frontend/src/components/admin/testManagementConfigMenu/UomRenameEntry.js
index 10f117592..b5e25d932 100644
--- a/frontend/src/components/admin/testManagementConfigMenu/UomRenameEntry.js
+++ b/frontend/src/components/admin/testManagementConfigMenu/UomRenameEntry.js
@@ -1,35 +1,7 @@
import React, { useContext, useState, useEffect, useRef } from "react";
-import {
- Form,
- Heading,
- Button,
- Loading,
- Grid,
- Column,
- Section,
- DataTable,
- Table,
- TableHead,
- TableRow,
- TableBody,
- TableHeader,
- TableCell,
- TableSelectRow,
- TableSelectAll,
- TableContainer,
- Pagination,
- Search,
- Select,
- SelectItem,
- Stack,
- UnorderedList,
- ListItem,
-} from "@carbon/react";
+import { Heading, Button, Grid, Column, Section } from "@carbon/react";
import {
getFromOpenElisServer,
- postToOpenElisServer,
- postToOpenElisServerFormData,
- postToOpenElisServerFullResponse,
postToOpenElisServerJsonResponse,
} from "../../utils/Utils.js";
import { NotificationContext } from "../../layout/Layout.js";
@@ -39,8 +11,7 @@ import {
} from "../../common/CustomNotification.js";
import { FormattedMessage, injectIntl, useIntl } from "react-intl";
import PageBreadCrumb from "../../common/PageBreadCrumb.js";
-import CustomCheckBox from "../../common/CustomCheckBox.js";
-import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js";
+import RenameModelBox from "./renameModel/RenameModelBox.js";
let breadcrumbs = [
{ label: "home.label", link: "/" },
@@ -62,31 +33,198 @@ function UomRenameEntry() {
const intl = useIntl();
const componentMounted = useRef(false);
+ const modalHeading = intl.formatMessage({
+ id: "uom.browse.title",
+ });
+
+ const [isLoading, setIsLoading] = useState(false);
+ const [finished, setFinished] = useState(true);
+ const [isAddModalOpen, setIsAddModalOpen] = useState(false);
+ const [confirmationStep, setConfirmationStep] = useState(false);
+ const [inputError, setInputError] = useState(false);
+ const [uomRename, setUomRename] = useState({});
+ const [uomListShow, setUomListShow] = useState([]);
+ const [uomRenamePost, setUomRenamePost] = useState({});
+ const [entityNamesProvider, setEntityNamesProvider] = useState({});
+ const [entityNamesProviderPost, setEntityNamesProviderPost] = useState({});
+ const [entityId, setEntityId] = useState();
+ const [entityName, setEntityName] = useState("unitOfMeasure");
+ const [selectedItem, setSelectedItem] = useState({});
+
+ useEffect(() => {
+ componentMounted.current = true;
+ getFromOpenElisServer("/rest/UomRenameEntry", handleUomRename);
+ return () => {
+ componentMounted.current = false;
+ };
+ }, []);
+
+ const handleUomRename = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setUomRename(res);
+ setUomRenamePost(res);
+ setUomListShow(res.uomList);
+ }
+ };
+
+ useEffect(() => {
+ getFromOpenElisServer(
+ `/rest/EntityNamesProvider?entityId=${entityId}&entityName=${entityName}`,
+ handelEntityNamesProvider,
+ );
+ }, [entityId]);
+
+ const handelEntityNamesProvider = (res) => {
+ if (!res) {
+ setIsLoading(true);
+ } else {
+ setEntityNamesProvider(res);
+ setEntityNamesProviderPost(res);
+ }
+ };
+
+ function uomRenameUpdatePost() {
+ setIsLoading(true);
+ if (confirmationStep) {
+ postToOpenElisServerJsonResponse(
+ `/rest/UomRenameEntry`,
+ JSON.stringify(uomRenamePost),
+ (res) => {
+ uomRenameUpdatePostCallback(res);
+ },
+ );
+ } else {
+ setConfirmationStep(true);
+ }
+ }
+
+ function uomRenameUpdatePostCallback(res) {
+ if (res) {
+ setIsLoading(false);
+ setFinished(false);
+ addNotification({
+ title: intl.formatMessage({
+ id: "notification.title",
+ }),
+ message: intl.formatMessage({
+ id: "notification.user.post.save.success",
+ }),
+ kind: NotificationKinds.success,
+ });
+ setNotificationVisible(true);
+ setIsAddModalOpen(false);
+ } else {
+ addNotification({
+ kind: NotificationKinds.error,
+ title: intl.formatMessage({ id: "notification.title" }),
+ message: intl.formatMessage({ id: "server.error.msg" }),
+ });
+ setNotificationVisible(true);
+ setTimeout(() => {
+ window.location.reload();
+ }, 200);
+ }
+ }
+
+ const openAppModle = (item) => {
+ setConfirmationStep(false);
+ setIsAddModalOpen(true);
+ setEntityId(item.id);
+ // setEntityName(test.value);
+ setSelectedItem(item);
+ };
+
+ const onInputChangeEn = (e) => {
+ const englishName = e.target.value;
+ setEntityNamesProviderPost((prev) => ({
+ name: {
+ ...prev.name,
+ english: englishName,
+ },
+ }));
+ setInputError(false);
+ };
+
+ const onInputChangeFr = (e) => {
+ const frenchName = e.target.value;
+ setEntityNamesProviderPost((prev) => ({
+ name: {
+ ...prev.name,
+ french: frenchName,
+ },
+ }));
+ setInputError(false);
+ };
+
+ useEffect(() => {
+ if (entityId && entityNamesProviderPost && entityNamesProviderPost.name) {
+ setUomRenamePost((prev) => ({
+ ...prev,
+ uomId: entityId,
+ nameEnglish: entityNamesProviderPost.name.english,
+ nameFrench: entityNamesProviderPost.name.french,
+ }));
+ }
+ }, [entityNamesProviderPost, entityId]);
+
+ const closeAddModal = () => {
+ setIsAddModalOpen(false);
+ };
return (
<>
{notificationVisible === true ? : ""}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
>
);
diff --git a/frontend/src/languages/en.json b/frontend/src/languages/en.json
index 56011e15b..e65b5ce59 100644
--- a/frontend/src/languages/en.json
+++ b/frontend/src/languages/en.json
@@ -1299,5 +1299,13 @@
"french.current": "FRENCH current",
"english.current": "ENGLISH current",
"required.invalidtext": "This field is required",
- "confirmation.rename": "Confirm Changes above you made."
+ "confirmation.rename": "Confirm Changes above you made.",
+ "sampleType.typeName": "Sample Type Name",
+ "testsection.testSectionName": "Test Section Name",
+ "uom.uomName": "Unit Of Measure Name",
+ "uom.browse.title": "Unit Of Measure",
+ "method.methodName": "Method Name",
+ "method.browse.title": "Method Section",
+ "selectListRenameEntry.selectList": "Select List Rename Entry",
+ "selectListRenameEntry.selectListEdit": "Select List Rename Entry Edit"
}
diff --git a/frontend/src/languages/fr.json b/frontend/src/languages/fr.json
index 37d9f0bcc..00006261c 100644
--- a/frontend/src/languages/fr.json
+++ b/frontend/src/languages/fr.json
@@ -1203,5 +1203,13 @@
"french.current": "FRANÇAIS actuel",
"english.current": "ANGLAIS actuel",
"required.invalidtext": "Ce champ est requis",
- "confirmation.rename": "Confirmez les modifications ci-dessus que vous avez apportées."
+ "confirmation.rename": "Confirmez les modifications ci-dessus que vous avez apportées.",
+ "sampleType.typeName": "Nom du type d'échantillon",
+ "testsection.testSectionName": "Nom de la section de test",
+ "uom.uomName": "Nom de l'unité de mesure",
+ "uom.browse.title": "Unité de mesure",
+ "method.methodName": "Nom de la méthode",
+ "method.browse.title": "Section de méthode",
+ "selectListRenameEntry.selectList": "Renommer une entrée de liste de sélection",
+ "selectListRenameEntry.selectListEdit": "Renommer une entrée de liste de sélection"
}