From 2661a81344e5140f2cda0f3155436e67df23fd2f Mon Sep 17 00:00:00 2001 From: "Aditya @ArchLinux" <132184385+adityadeshlahre@users.noreply.github.com> Date: Wed, 24 Jul 2024 03:09:04 +0530 Subject: [PATCH 01/10] fix(TestNotificationConfigMenu): restController init --- .../TestNotificationConfigMenu.js | 5 + ...tNotificationConfigMenuRestController.java | 127 ++++++++++++++++++ .../TestNotificationConfigRestController.java | 115 ++++++++++++++++ 3 files changed, 247 insertions(+) create mode 100644 frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigMenu.js create mode 100644 src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigMenuRestController.java create mode 100644 src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigRestController.java diff --git a/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigMenu.js b/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigMenu.js new file mode 100644 index 000000000..8e0afd47b --- /dev/null +++ b/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigMenu.js @@ -0,0 +1,5 @@ +import { FormattedMessage, injectIntl, useIntl } from "react-intl"; + +function ProviderMenu() {} + +export default injectIntl(ProviderMenu); diff --git a/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigMenuRestController.java b/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigMenuRestController.java new file mode 100644 index 000000000..c18b14c06 --- /dev/null +++ b/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigMenuRestController.java @@ -0,0 +1,127 @@ +package org.openelisglobal.notification.controller.rest; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import org.openelisglobal.common.controller.BaseMenuController; +import org.openelisglobal.common.form.AdminOptionMenuForm; +import org.openelisglobal.common.log.LogEvent; +import org.openelisglobal.common.validator.BaseErrors; +import org.openelisglobal.notification.form.TestNotificationConfigMenuForm; +import org.openelisglobal.notification.service.TestNotificationConfigService; +import org.openelisglobal.notification.valueholder.TestNotificationConfig; +import org.openelisglobal.test.service.TestService; +import org.openelisglobal.test.valueholder.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.validation.Errors; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class TestNotificationConfigMenuRestController extends BaseMenuController { + + private static final String[] ALLOWED_FIELDS = new String[] { "menuList*.id", "menuList*.test.id", + "menuList*.providerSMS.active", "menuList*.providerEmail.active", "menuList*.patientEmail.active", + "menuList*.patientSMS.active", "menuList*.defaultPayloadTemplate.id" }; + + @InitBinder + public void initBinder(WebDataBinder binder) { + binder.setAllowedFields(ALLOWED_FIELDS); + } + + @Autowired + private TestService testService; + @Autowired + private TestNotificationConfigService testNotificationConfigService; + + @Override + protected int getPageSize() { + return -1; + } + + @GetMapping("/TestNotificationConfigMenu") + public TestNotificationConfigMenuForm displayNotificationConfig() + throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { + TestNotificationConfigMenuForm form = new TestNotificationConfigMenuForm(); + // request.setAttribute("menuDefinition", "TestNotificationMenuDefinition"); + String forward = performMenuAction(form, request); + // return findForward(forward, form); + return form; + } + + @PostMapping("/TestNotificationConfigMenu") + public TestNotificationConfigMenuForm updateNotificationConfig(HttpServletRequest request, + @RequestBody @Valid TestNotificationConfigMenuForm form, BindingResult result) + throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { + if (result.hasErrors()) { + saveErrors(result); + return displayNotificationConfig(); + } + try { + testNotificationConfigService.saveTestNotificationConfigsActiveStatuses(form.getMenuList(), + this.getSysUserId(request)); + } catch (RuntimeException e) { + LogEvent.logError("could not save result notification configs", e); + Errors errors = new BaseErrors(); + errors.reject("alert.error", "An error occured while saving"); + saveErrors(errors); + return displayNotificationConfig(); + } + + // redirectAttributes.addFlashAttribute(FWD_SUCCESS, true); + // return findForward(FWD_SUCCESS_INSERT, form); + return form; + } + + @Override + protected List createMenuList(AdminOptionMenuForm form, + HttpServletRequest request) { + List allOrderableTests = testService.getAllActiveOrderableTests(); + + List testNotificationConfigs = new ArrayList<>(); + for (Test test : allOrderableTests) { + TestNotificationConfig testNotificationConfig = testNotificationConfigService + .getTestNotificationConfigForTestId(test.getId()).orElse(new TestNotificationConfig()); + testNotificationConfig.setTest(test); + testNotificationConfigs.add(testNotificationConfig); + } + return testNotificationConfigs; + } + + @Override + protected String getDeactivateDisabled() { + return "false"; + } + + @Override + protected String findLocalForward(String forward) { + if (FWD_SUCCESS.equals(forward)) { + return "testNotificationMasterListsPageDefinition"; + } else if (FWD_FAIL.equals(forward)) { + return "redirect:/MasterListsPage"; + } else if (FWD_SUCCESS_INSERT.equals(forward)) { + return "redirect:/TestNotificationConfigMenu"; + } else if (FWD_FAIL_INSERT.equals(forward)) { + return "haitiMasterListsPageDefinition"; + } else { + return "PageNotFound"; + } + } + + @Override + protected String getPageTitleKey() { + return "testnotificationconfig.browse.title"; + } + + @Override + protected String getPageSubtitleKey() { + return "testnotificationconfig.browse.title"; + } +} diff --git a/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigRestController.java b/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigRestController.java new file mode 100644 index 000000000..b3d78dc27 --- /dev/null +++ b/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigRestController.java @@ -0,0 +1,115 @@ +package org.openelisglobal.notification.controller.rest; + +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import org.apache.commons.validator.GenericValidator; +import org.openelisglobal.common.controller.BaseController; +import org.openelisglobal.notification.form.TestNotificationConfigForm; +import org.openelisglobal.notification.service.NotificationPayloadTemplateService; +import org.openelisglobal.notification.service.TestNotificationConfigService; +import org.openelisglobal.notification.valueholder.NotificationPayloadTemplate.NotificationPayloadType; +import org.openelisglobal.notification.valueholder.TestNotificationConfig; +import org.openelisglobal.test.service.TestService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class TestNotificationConfigRestController extends BaseController { + + private static final String[] ALLOWED_FIELDS = new String[] { "config*", "editSystemDefaultPayloadTemplate", + "systemDefaultPayloadTemplate*" }; + + @Autowired + private TestNotificationConfigService testNotificationConfigService; + + @Autowired + private NotificationPayloadTemplateService payloadTemplateService; + @Autowired + private TestService testService; + + @InitBinder + public void initBinder(WebDataBinder binder) { + binder.setAllowedFields(ALLOWED_FIELDS); + } + + @GetMapping("/TestNotificationConfig") + public TestNotificationConfigForm displayNotificationConfig( + @RequestParam(name = "testId", required = false) String testId) { + TestNotificationConfigForm form = new TestNotificationConfigForm(); + + form.setFormName("TestNotificationConfigForm"); + form.setSystemDefaultPayloadTemplate( + payloadTemplateService.getSystemDefaultPayloadTemplateForType(NotificationPayloadType.TEST_RESULT)); + form.setConfig(testNotificationConfigService.getTestNotificationConfigForTestId(testId) + .orElse(new TestNotificationConfig())); + if (form.getConfig().getTest() == null || GenericValidator.isBlankOrNull(form.getConfig().getTest().getId())) { + form.getConfig().setTest(testService.get(testId)); + } + // return findForward(FWD_SUCCESS, form); + return form; + } + + @GetMapping(value = "/TestNotificationConfig/raw/list", produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public List getNotificationConfigs( + @RequestParam(name = "testIds", required = false) List testIds) { + List configs = testNotificationConfigService + .getTestNotificationConfigsForTestId(testIds); + return configs; + } + + @PostMapping("/TestNotificationConfig") + public TestNotificationConfigForm updateNotificationConfig(HttpServletRequest request, + @RequestBody @Valid TestNotificationConfigForm form, BindingResult result) { + if (result.hasErrors()) { + saveErrors(result); + return displayNotificationConfig(form.getConfig().getTest().getId()); + } + String sysUserId = this.getSysUserId(request); + + testNotificationConfigService.saveStatusAndMessages(form.getConfig(), sysUserId); + if (form.getEditSystemDefaultPayloadTemplate()) { + payloadTemplateService.updatePayloadTemplateMessagesAndSubject(form.getSystemDefaultPayloadTemplate(), + sysUserId); + } + testNotificationConfigService.removeEmptyPayloadTemplates(form.getConfig(), sysUserId); + // redirectAttributes.addFlashAttribute(FWD_SUCCESS, true); + // return findForward(FWD_SUCCESS_INSERT, form); + return form; + } + + @Override + protected String findLocalForward(String forward) { + if (FWD_SUCCESS.equals(forward)) { + return "testNotificationConfigDefinition"; + } else if (FWD_FAIL.equals(forward)) { + return "redirect:/TestNotificationConfigMenu"; + } else if (FWD_SUCCESS_INSERT.equals(forward)) { + return "redirect:/TestNotificationConfigMenu"; + } else if (FWD_FAIL_INSERT.equals(forward)) { + return "testNotificationConfigDefinition"; + } else { + return "PageNotFound"; + } + } + + @Override + protected String getPageTitleKey() { + return "testnotificationconfig.browse.title"; + } + + @Override + protected String getPageSubtitleKey() { + return "testnotificationconfig.browse.title"; + } +} From 29d709a332406f7e2e7a3e4bfd0a9322f3b315f9 Mon Sep 17 00:00:00 2001 From: "Aditya @ArchLinux" <132184385+adityadeshlahre@users.noreply.github.com> Date: Wed, 24 Jul 2024 04:36:31 +0530 Subject: [PATCH 02/10] fix(TestNotificationConfigMenu): restController localhost CM error fix --- ...TestNotificationConfigMenuRestController.java | 16 +++++++++------- .../TestNotificationConfigRestController.java | 13 ++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigMenuRestController.java b/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigMenuRestController.java index c18b14c06..9a7fad865 100644 --- a/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigMenuRestController.java +++ b/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigMenuRestController.java @@ -22,9 +22,11 @@ import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("/rest") public class TestNotificationConfigMenuRestController extends BaseMenuController { private static final String[] ALLOWED_FIELDS = new String[] { "menuList*.id", "menuList*.test.id", @@ -57,12 +59,11 @@ public TestNotificationConfigMenuForm displayNotificationConfig() } @PostMapping("/TestNotificationConfigMenu") - public TestNotificationConfigMenuForm updateNotificationConfig(HttpServletRequest request, - @RequestBody @Valid TestNotificationConfigMenuForm form, BindingResult result) - throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { + public TestNotificationConfigMenuForm updateNotificationConfig(@RequestBody @Valid TestNotificationConfigMenuForm form, BindingResult result){ if (result.hasErrors()) { - saveErrors(result); - return displayNotificationConfig(); + // saveErrors(result); + // return displayNotificationConfig(); + throw new RuntimeException("Validation errors occurred"); } try { testNotificationConfigService.saveTestNotificationConfigsActiveStatuses(form.getMenuList(), @@ -71,8 +72,9 @@ public TestNotificationConfigMenuForm updateNotificationConfig(HttpServletReques LogEvent.logError("could not save result notification configs", e); Errors errors = new BaseErrors(); errors.reject("alert.error", "An error occured while saving"); - saveErrors(errors); - return displayNotificationConfig(); + // saveErrors(errors); + // return displayNotificationConfig(); + throw new RuntimeException("An error occurred while saving"); } // redirectAttributes.addFlashAttribute(FWD_SUCCESS, true); diff --git a/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigRestController.java b/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigRestController.java index b3d78dc27..f4097cb25 100644 --- a/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigRestController.java +++ b/src/main/java/org/openelisglobal/notification/controller/rest/TestNotificationConfigRestController.java @@ -1,7 +1,6 @@ package org.openelisglobal.notification.controller.rest; import java.util.List; -import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.apache.commons.validator.GenericValidator; import org.openelisglobal.common.controller.BaseController; @@ -19,11 +18,12 @@ import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("/rest") public class TestNotificationConfigRestController extends BaseController { private static final String[] ALLOWED_FIELDS = new String[] { "config*", "editSystemDefaultPayloadTemplate", @@ -60,7 +60,6 @@ public TestNotificationConfigForm displayNotificationConfig( } @GetMapping(value = "/TestNotificationConfig/raw/list", produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody public List getNotificationConfigs( @RequestParam(name = "testIds", required = false) List testIds) { List configs = testNotificationConfigService @@ -69,11 +68,11 @@ public List getNotificationConfigs( } @PostMapping("/TestNotificationConfig") - public TestNotificationConfigForm updateNotificationConfig(HttpServletRequest request, - @RequestBody @Valid TestNotificationConfigForm form, BindingResult result) { + public TestNotificationConfigForm updateNotificationConfig(@RequestBody @Valid TestNotificationConfigForm form, BindingResult result) { if (result.hasErrors()) { - saveErrors(result); - return displayNotificationConfig(form.getConfig().getTest().getId()); + // saveErrors(result); + // return displayNotificationConfig(form.getConfig().getTest().getId()); + throw new RuntimeException("Validation errors occurred"); } String sysUserId = this.getSysUserId(request); From d8e82bcfae8b96ecee6ce6ca2768225346764092 Mon Sep 17 00:00:00 2001 From: "Aditya @ArchLinux" <132184385+adityadeshlahre@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:21:39 +0530 Subject: [PATCH 03/10] fix(TestNotificationConfigMenu): ReactJs page init --- frontend/src/components/admin/Admin.js | 8 ++ .../GenricTestNotificationConfigEdit.js | 119 ++++++++++++++++++ .../TestNotificationConfigMenu.js | 79 +++++++++++- frontend/src/languages/en.json | 25 +++- frontend/src/languages/fr.json | 25 +++- 5 files changed, 252 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/admin/testNotificationConfigMenu/GenricTestNotificationConfigEdit.js diff --git a/frontend/src/components/admin/Admin.js b/frontend/src/components/admin/Admin.js index 179efad4f..b4e3302bf 100644 --- a/frontend/src/components/admin/Admin.js +++ b/frontend/src/components/admin/Admin.js @@ -29,6 +29,7 @@ import { Bullhorn, User, BatchJob, + Popup, } from "@carbon/icons-react"; import PathRoute from "../utils/PathRoute"; import CalculatedValue from "./calculatedValue/CalculatedValueForm"; @@ -54,6 +55,7 @@ import UserManagement from "./userManagement/UserManagement"; import UserAddModify from "./userManagement/UserAddModify"; import ManageMethod from "./testManagement/ManageMethod.js"; import BatchTestReassignmentAndCancelation from "./BatchTestReassignmentAndCancellation/BatchTestReassignmentAndCancelation.js"; +import TestNotificationConfigMenu from "./testNotificationConfigMenu/TestNotificationConfigMenu.js"; function Admin() { const intl = useIntl(); @@ -188,6 +190,9 @@ function Admin() { defaultMessage={"Common Properties"} /> + + + @@ -325,6 +330,9 @@ function Admin() { id="sidenav.label.admin.formEntry.PrintedReportsconfig" /> + + + diff --git a/frontend/src/components/admin/testNotificationConfigMenu/GenricTestNotificationConfigEdit.js b/frontend/src/components/admin/testNotificationConfigMenu/GenricTestNotificationConfigEdit.js new file mode 100644 index 000000000..a6cf077d1 --- /dev/null +++ b/frontend/src/components/admin/testNotificationConfigMenu/GenricTestNotificationConfigEdit.js @@ -0,0 +1,119 @@ +import React, { useContext, useState, useEffect, useRef } from "react"; +import { + Heading, + Button, + Loading, + Grid, + Column, + Section, + DataTable, + Table, + TableHead, + TableRow, + TableBody, + TableHeader, + TableCell, + TableSelectRow, + TableSelectAll, + TableContainer, + Pagination, + Search, + Modal, + TextInput, + Dropdown, +} from "@carbon/react"; +import { + getFromOpenElisServer, + postToOpenElisServerFullResponse, +} from "../../utils/Utils.js"; +import { + ConfigurationContext, + NotificationContext, +} from "../../layout/Layout.js"; +import { + AlertDialog, + NotificationKinds, +} from "../../common/CustomNotification.js"; +import { FormattedMessage, injectIntl, useIntl } from "react-intl"; +import PageBreadCrumb from "../../common/PageBreadCrumb.js"; +import { ArrowLeft, ArrowRight } from "@carbon/icons-react"; +import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js"; + +let breadcrumbs = [ + { label: "home.label", link: "/" }, + { label: "breadcrums.admin.managment", link: "/MasterListsPage" }, + { + label: "testnotificationconfig.browse.title", + link: "/MasterListsPage#testNotificationConfigMenu", + }, +]; + +function GenricTestNotificationConfigEdit() { + const { notificationVisible, setNotificationVisible, addNotification } = + useContext(NotificationContext); + + const intl = useIntl(); + + const componentMounted = useRef(false); + + return ( + <> +
+ + + +
+
+ + + +
+
+
+
+
+ + +
+
+ + + +
+
+
+ +
+ +
+ +
+ +
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+ +
+ +
+
+
+
+
+ + ); +} + +export default injectIntl(GenricTestNotificationConfigEdit); diff --git a/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigMenu.js b/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigMenu.js index 8e0afd47b..2039aa6e0 100644 --- a/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigMenu.js +++ b/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigMenu.js @@ -1,5 +1,80 @@ +import React, { useContext, useState, useEffect, useRef } from "react"; +import { + Heading, + Button, + Loading, + Grid, + Column, + Section, + DataTable, + Table, + TableHead, + TableRow, + TableBody, + TableHeader, + TableCell, + TableSelectRow, + TableSelectAll, + TableContainer, + Pagination, + Search, + Modal, + TextInput, + Dropdown, +} from "@carbon/react"; +import { + getFromOpenElisServer, + postToOpenElisServerFullResponse, +} from "../../utils/Utils.js"; +import { + ConfigurationContext, + NotificationContext, +} from "../../layout/Layout.js"; +import { + AlertDialog, + NotificationKinds, +} from "../../common/CustomNotification.js"; import { FormattedMessage, injectIntl, useIntl } from "react-intl"; +import PageBreadCrumb from "../../common/PageBreadCrumb.js"; +import { ArrowLeft, ArrowRight } from "@carbon/icons-react"; +import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js"; -function ProviderMenu() {} +let breadcrumbs = [ + { label: "home.label", link: "/" }, + { label: "breadcrums.admin.managment", link: "/MasterListsPage" }, + { + label: "testnotificationconfig.browse.title", + link: "/MasterListsPage#testNotificationConfigMenu", + }, +]; -export default injectIntl(ProviderMenu); +function TestNotificationConfigMenu() { + const { notificationVisible, setNotificationVisible, addNotification } = + useContext(NotificationContext); + + const intl = useIntl(); + + const componentMounted = useRef(false); + + return ( + <> +
+ + + +
+
+ + + +
+
+
+
+
+
+ + ); +} + +export default injectIntl(TestNotificationConfigMenu); diff --git a/frontend/src/languages/en.json b/frontend/src/languages/en.json index d595c89fe..b4f183b1e 100644 --- a/frontend/src/languages/en.json +++ b/frontend/src/languages/en.json @@ -1239,5 +1239,28 @@ "notification.slideover.button.unsubscribe.success": "Unsubscribed successfully", "notification.slideover.button.unsubscribe.fail": "Unsubscribe failed", "notification.slideover.button.subscribe.success": "Subscribed successfully", - "notification.slideover.button.subscribe.fail": "Subscribe failed" + "notification.slideover.button.subscribe.fail": "Subscribe failed", + "testnotificationconfig.browse.title": "Test Notification Configuration", + "label.testName": "Test names", + "testnotification.instructionis.variables.body": "[testName] : Name of the test this is for", + "testnotification.instructionis.variables.body.0": "[testResult] : Result of the test", + "testnotification.instructionis.variables.body.1": "[patientFirstName] : Patient's first name ", + "testnotification.instructionis.variables.body.2": "[patientLastNameInitial] : Patient's last name's initial", + "testnotification.instructionis.variables.header": "List of variables:", + "testnotification.instructions.body": "When a notification is created, it will first check if a message template is defined for the recipient/message type.", + "testnotification.instructions.body.0": "If none exists, it will use the test default message.", + "testnotification.instructions.body.1": "If that does not exist, it will use the system default message.", + "testnotification.instructions.body.2": "Variables will be replaced by their corresponding values in the message body and the subject.", + "testnotification.instructions.body.3": "Variables should always include the square brackets and should have no whitespace.", + "testnotification.instructions.header": "Instructions:", + "testnotification.messagetemplate": "Message", + "testnotification.options": "Individiual Messages", + "testnotification.patient.email": "Patient Email", + "testnotification.patient.sms": "Patient SMS", + "testnotification.patiententry.header": "Result Reporting", + "testnotification.provider.email": "Provider Email", + "testnotification.provider.sms": "Provider SMS", + "testnotification.subjecttemplate": "Subject", + "testnotification.systemdefault.template": "System Default Message", + "testnotification.testdefault.template": "Default Message for Test" } diff --git a/frontend/src/languages/fr.json b/frontend/src/languages/fr.json index 6ae9c2203..d73a632ed 100644 --- a/frontend/src/languages/fr.json +++ b/frontend/src/languages/fr.json @@ -1143,5 +1143,28 @@ "notification.slideover.button.unsubscribe.success": "Désabonnement réussi", "notification.slideover.button.unsubscribe.fail": "Échec de l'annulation de l'abonnement", "notification.slideover.button.subscribe.success": "Abonnement réussi", - "notification.slideover.button.subscribe.fail": "Échec de l'abonnement" + "notification.slideover.button.subscribe.fail": "Échec de l'abonnement", + "testnotificationconfig.browse.title": "Configuration des notifications de test", + "label.testName": "Noms des tests", + "testnotification.instructionis.variables.body": "[testName] : Nom du test pour lequel cela est", + "testnotification.instructionis.variables.body.0": "[testResult] : Résultat du test", + "testnotification.instructionis.variables.body.1": "[patientFirstName] : Prénom du patient", + "testnotification.instructionis.variables.body.2": "[patientLastNameInitial] : Initiale du nom de famille du patient", + "testnotification.instructionis.variables.header": "Liste des variables :", + "testnotification.instructions.body": "Lorsqu'une notification est créée, elle vérifiera d'abord si un modèle de message est défini pour le destinataire/type de message.", + "testnotification.instructions.body.0": "S'il n'en existe pas, elle utilisera le message par défaut du test.", + "testnotification.instructions.body.1": "Si cela n'existe pas, elle utilisera le message par défaut du système.", + "testnotification.instructions.body.2": "Les variables seront remplacées par leurs valeurs correspondantes dans le corps du message et l'objet.", + "testnotification.instructions.body.3": "Les variables doivent toujours inclure les crochets et ne doivent pas contenir d'espaces.", + "testnotification.instructions.header": "Instructions :", + "testnotification.messagetemplate": "Message", + "testnotification.options": "Messages individuels", + "testnotification.patient.email": "E-mail du patient", + "testnotification.patient.sms": "SMS du patient", + "testnotification.patiententry.header": "Rapport de résultats", + "testnotification.provider.email": "E-mail du fournisseur", + "testnotification.provider.sms": "SMS du fournisseur", + "testnotification.subjecttemplate": "Objet", + "testnotification.systemdefault.template": "Message par défaut du système", + "testnotification.testdefault.template": "Message par défaut pour le test" } From 575f99cb6533143a88209e96231dd1685910cc71 Mon Sep 17 00:00:00 2001 From: "Aditya @ArchLinux" <132184385+adityadeshlahre@users.noreply.github.com> Date: Thu, 25 Jul 2024 02:58:42 +0530 Subject: [PATCH 04/10] fix(TestNotificationConfigMenu): testNotifConfIdEdit page init --- .../GenricTestNotificationConfigEdit.js | 119 ---- .../TestNotificationConfigEdit.js | 553 ++++++++++++++++++ frontend/src/languages/en.json | 3 +- frontend/src/languages/fr.json | 3 +- ...tNotificationConfigMenuRestController.java | 3 +- .../TestNotificationConfigRestController.java | 3 +- 6 files changed, 561 insertions(+), 123 deletions(-) delete mode 100644 frontend/src/components/admin/testNotificationConfigMenu/GenricTestNotificationConfigEdit.js create mode 100644 frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigEdit.js diff --git a/frontend/src/components/admin/testNotificationConfigMenu/GenricTestNotificationConfigEdit.js b/frontend/src/components/admin/testNotificationConfigMenu/GenricTestNotificationConfigEdit.js deleted file mode 100644 index a6cf077d1..000000000 --- a/frontend/src/components/admin/testNotificationConfigMenu/GenricTestNotificationConfigEdit.js +++ /dev/null @@ -1,119 +0,0 @@ -import React, { useContext, useState, useEffect, useRef } from "react"; -import { - Heading, - Button, - Loading, - Grid, - Column, - Section, - DataTable, - Table, - TableHead, - TableRow, - TableBody, - TableHeader, - TableCell, - TableSelectRow, - TableSelectAll, - TableContainer, - Pagination, - Search, - Modal, - TextInput, - Dropdown, -} from "@carbon/react"; -import { - getFromOpenElisServer, - postToOpenElisServerFullResponse, -} from "../../utils/Utils.js"; -import { - ConfigurationContext, - NotificationContext, -} from "../../layout/Layout.js"; -import { - AlertDialog, - NotificationKinds, -} from "../../common/CustomNotification.js"; -import { FormattedMessage, injectIntl, useIntl } from "react-intl"; -import PageBreadCrumb from "../../common/PageBreadCrumb.js"; -import { ArrowLeft, ArrowRight } from "@carbon/icons-react"; -import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js"; - -let breadcrumbs = [ - { label: "home.label", link: "/" }, - { label: "breadcrums.admin.managment", link: "/MasterListsPage" }, - { - label: "testnotificationconfig.browse.title", - link: "/MasterListsPage#testNotificationConfigMenu", - }, -]; - -function GenricTestNotificationConfigEdit() { - const { notificationVisible, setNotificationVisible, addNotification } = - useContext(NotificationContext); - - const intl = useIntl(); - - const componentMounted = useRef(false); - - return ( - <> -
- - - -
-
- - - -
-
-
-
-
- - -
-
- - - -
-
-
- -
- -
- -
- -
- -
-
-
-
- -
-
-
-
- -
- -
- -
- -
-
-
-
-
- - ); -} - -export default injectIntl(GenricTestNotificationConfigEdit); diff --git a/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigEdit.js b/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigEdit.js new file mode 100644 index 000000000..3a87feb9b --- /dev/null +++ b/frontend/src/components/admin/testNotificationConfigMenu/TestNotificationConfigEdit.js @@ -0,0 +1,553 @@ +import React, { useContext, useState, useEffect, useRef } from "react"; +import { + Heading, + Button, + Loading, + Grid, + Column, + Section, + DataTable, + Table, + TableHead, + TableRow, + TableBody, + TableHeader, + TableCell, + TableSelectRow, + TableSelectAll, + TableContainer, + Pagination, + Search, + Modal, + TextInput, + Dropdown, + TextArea, + Checkbox, +} from "@carbon/react"; +import { + getFromOpenElisServer, + postToOpenElisServerFullResponse, +} from "../../utils/Utils.js"; +import { + ConfigurationContext, + NotificationContext, +} from "../../layout/Layout.js"; +import { + AlertDialog, + NotificationKinds, +} from "../../common/CustomNotification.js"; +import { FormattedMessage, injectIntl, useIntl } from "react-intl"; +import PageBreadCrumb from "../../common/PageBreadCrumb.js"; +import { ArrowLeft, ArrowRight, Cost } from "@carbon/icons-react"; +import ActionPaginationButtonType from "../../common/ActionPaginationButtonType.js"; + +let breadcrumbs = [ + { label: "home.label", link: "/" }, + { label: "breadcrums.admin.managment", link: "/MasterListsPage" }, + { + label: "testnotificationconfig.browse.title", + link: "/MasterListsPage#testNotificationConfigMenu", + }, +]; + +function TestNotificationConfigEdit() { + const { notificationVisible, setNotificationVisible, addNotification } = + useContext(NotificationContext); + + const intl = useIntl(); + + const componentMounted = useRef(false); + const [indMsg, setIndMsg] = useState("0"); + + return ( + <> +
+ + + +
+
+ + + +
+
+
+
+
+ + +
+
+ + + +
+
+
+
+
+ + + { + // handleCheckboxChange(section.roleId); + // }} + /> + + + + + + + + + + + +
+
+
+ + +
+
+ + + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ + + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+ + +
+
+
+ + + +
+
+
+
+ + + +
+
+ + + + + + handleUserLoginNameChange(e)} + /> + + +
+ + + + + +
+ + +