From c96a2979f1dc8cac43f71e4bf261aa7044cb1409 Mon Sep 17 00:00:00 2001 From: olewandowski1 Date: Tue, 9 Jan 2024 09:34:08 +0100 Subject: [PATCH 1/5] OP-1725: remove null/empty options from dropdowns --- src/components/Uploader.js | 4 ++-- src/pages/RegistersPage.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Uploader.js b/src/components/Uploader.js index 6f57083..baee036 100644 --- a/src/components/Uploader.js +++ b/src/components/Uploader.js @@ -52,7 +52,7 @@ const Uploader = ({ } required constants={acceptableFormats} - withNull + withNull={false} /> )} diff --git a/src/components/ReportSearcher.js b/src/components/ReportSearcher.js index 63cf417..e06fe62 100644 --- a/src/components/ReportSearcher.js +++ b/src/components/ReportSearcher.js @@ -7,7 +7,7 @@ import { Box, Button } from "@material-ui/core"; import ReportDefinitionEditorDialog from "./ReportDefinitionEditorDialog"; import { RIGHT_REPORT_EDIT, RIGHT_REPORT_ADD } from "../constants" -const HEADERS = ["tools.report.description", "tools.report.module", "tools.report.name", ""]; +const HEADERS = ["tools.report.description", ""]; const ReportSearcher = () => { const modulesManager = useModulesManager(); @@ -18,8 +18,6 @@ const ReportSearcher = () => { const itemFormatters = useCallback( () => [ (r) => r.description, - (r) => r.module, - (r) => r.name, (r) => ( { diff --git a/src/translations/en.json b/src/translations/en.json index f6575b8..2935138 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -90,8 +90,6 @@ "tools.ReportForm.title": "Editing report {name}", "tools.ReportForm.unknownReport": "Unknown report", "tools.ReportSearcher.tableTitle": "Reports", - "tools.report.name": "Report Name", - "tools.report.module": "Module", "tools.report.validityFrom": "Valid From", "tools.report.description": "Description", "tools.report.definition": "Definition", From 7f3c52da13da73d06e5e958320b0c491cdeee509 Mon Sep 17 00:00:00 2001 From: olewandowski1 Date: Thu, 15 Feb 2024 10:26:29 +0100 Subject: [PATCH 3/5] OP-1800: add category name rows, add question mark anchor --- src/components/GenerateReportPicker.js | 2 +- src/components/ReportSearcher.js | 115 ++++++++++++++++++++----- src/translations/en.json | 3 +- 3 files changed, 95 insertions(+), 25 deletions(-) diff --git a/src/components/GenerateReportPicker.js b/src/components/GenerateReportPicker.js index 2e8d3ca..368bb21 100644 --- a/src/components/GenerateReportPicker.js +++ b/src/components/GenerateReportPicker.js @@ -34,7 +34,7 @@ const GenerateReportPicker = (props) => { {children ? ( children({ toggle }) ) : ( - )} diff --git a/src/components/ReportSearcher.js b/src/components/ReportSearcher.js index e06fe62..7ff81f5 100644 --- a/src/components/ReportSearcher.js +++ b/src/components/ReportSearcher.js @@ -1,35 +1,97 @@ import React, { useCallback, useState } from "react"; import { useSelector } from "react-redux"; + +import { Box, Button, Tooltip } from "@material-ui/core"; +import HelpOutlineIcon from "@material-ui/icons/HelpOutline"; + +import { + Searcher, + useTranslations, + useModulesManager, +} from "@openimis/fe-core"; +import { RIGHT_REPORT_EDIT, RIGHT_REPORT_ADD } from "../constants"; import { useReportsQuery } from "../hooks"; -import { Searcher, useTranslations, useModulesManager } from "@openimis/fe-core"; import GenerateReportPicker from "./GenerateReportPicker"; -import { Box, Button } from "@material-ui/core"; import ReportDefinitionEditorDialog from "./ReportDefinitionEditorDialog"; -import { RIGHT_REPORT_EDIT, RIGHT_REPORT_ADD } from "../constants" - -const HEADERS = ["tools.report.description", ""]; const ReportSearcher = () => { const modulesManager = useModulesManager(); - const { formatMessageWithValues, formatMessage } = useTranslations("tools", modulesManager); + const { formatMessageWithValues, formatMessage } = useTranslations( + "tools", + modulesManager + ); const { data, isLoading, error, refetch } = useReportsQuery(); const [editedReport, setEditedReport] = useState(); const rights = useSelector((state) => state.core?.user?.i_user?.rights ?? []); - const itemFormatters = useCallback( - () => [ - (r) => r.description, - (r) => ( - - { - rights.includes(RIGHT_REPORT_ADD) && - rights.includes(RIGHT_REPORT_EDIT) && - - } - - - ), + )} +
+ + + +
+ +
+ ); + + const itemFormatters = useCallback( + () => [ + (report) => + report.isCategory ? formatCategory(report) : formatReport(report), + formatActions, ], [] ); @@ -38,17 +100,24 @@ const ReportSearcher = () => { <> refetch()} itemsPageInfo={{ totalCount: data?.reports?.length ?? 0 }} - headers={() => HEADERS} + headers={() => []} itemFormatters={itemFormatters} withPagination={false} /> - {editedReport && setEditedReport(null)} />} + {editedReport && ( + setEditedReport(null)} + /> + )} ); }; diff --git a/src/translations/en.json b/src/translations/en.json index 2935138..56e6a99 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -107,5 +107,6 @@ "tools.RegistersPage.servicesBlockTitle": "Medical Services", "tools.RegistersPage.insureesBlockTitle": "Insurees", "tools.RegistersPage.insurees.uploadLabel": "Upload Insurees", - "tools.RegistersPage.insurees.downloadLabel": "Download Insurees" + "tools.RegistersPage.insurees.downloadLabel": "Download Insurees", + "tools.ReportSearcher.moduleName": "{module} Module" } From 00bfbfac6fd46982f8baf63ea009d97d207014bb Mon Sep 17 00:00:00 2001 From: olewandowski1 Date: Fri, 1 Mar 2024 16:04:25 +0100 Subject: [PATCH 4/5] hotfix: hide tools on moldova instance --- src/components/ToolsMainMenu.js | 34 ++++++++++----------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/components/ToolsMainMenu.js b/src/components/ToolsMainMenu.js index 9fedd64..62f4fec 100644 --- a/src/components/ToolsMainMenu.js +++ b/src/components/ToolsMainMenu.js @@ -6,6 +6,11 @@ import { connect } from "react-redux"; import { RIGHT_REGISTERS, RIGHT_REPORTS, RIGHT_EXTRACTS } from "../constants"; class ToolsMainMenu extends Component { + constructor(props) { + super(props); + this.isWorker = props.modulesManager.getConf("fe-core", "isWorker", false); + } + enablers = (enablers) => { var e; for (e of enablers) { @@ -15,8 +20,10 @@ class ToolsMainMenu extends Component { }; render() { - const { rights } = this.props; + if (this.isWorker) return null; + let entries = []; + if (this.enablers(RIGHT_REGISTERS)) { entries.push({ text: formatMessage(this.props.intl, "tools", "menu.registers"), @@ -24,19 +31,6 @@ class ToolsMainMenu extends Component { route: "/tools/registers", }); } - // Renewals are preformed automatically now. - // if (rights.includes(RIGHT_POLICY_RENEWALS)) { - // entries.push( - // { text: formatMessage(this.props.intl, "tools", "menu.renewals"), icon: , route: "/tools/policyRenewals" } - // ) - // } - // SMS sending feature is normally done automatically now. We'll consider adding this back if necessary - // if (rights.includes(RIGHT_FEEDBACK_PROMPT)) { - // entries.push( - // { text: formatMessage(this.props.intl, "tools", "menu.feedbacks"), icon: , route: "/tools/feedbackPrompts" }, - // ) - // } - // Extracts page is not implemented in the modular version yet. As it's not used as of now. if (this.enablers(RIGHT_EXTRACTS)) { entries.push( { text: formatMessage(this.props.intl, "tools", "menu.extracts"), icon: , route: "/tools/extracts" }, @@ -49,17 +43,9 @@ class ToolsMainMenu extends Component { route: "/tools/reports", }); } - // if (this.enablers(RIGHT_UTILITIES)) { - // entries.push( - // { text: formatMessage(this.props.intl, "tools", "menu.utilities"), icon: , route: "/tools/utilities" }, - // ) - // } - // if (rights.includes(RIGHT_EMAILSETTING)) { - // entries.push( - // { text: formatMessage(this.props.intl, "tools", "menu.emails"), icon: , route: "/tools/emailSettings" } - // ) - // } + if (!entries.length) return null; + return ( Date: Fri, 12 Apr 2024 15:37:55 +0200 Subject: [PATCH 5/5] OP-1858: adjust edit/add rights --- src/components/ReportSearcher.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/ReportSearcher.js b/src/components/ReportSearcher.js index 7ff81f5..2c58a54 100644 --- a/src/components/ReportSearcher.js +++ b/src/components/ReportSearcher.js @@ -3,13 +3,14 @@ import { useSelector } from "react-redux"; import { Box, Button, Tooltip } from "@material-ui/core"; import HelpOutlineIcon from "@material-ui/icons/HelpOutline"; +import EditIcon from '@material-ui/icons/Edit'; import { Searcher, useTranslations, useModulesManager, } from "@openimis/fe-core"; -import { RIGHT_REPORT_EDIT, RIGHT_REPORT_ADD } from "../constants"; +import { RIGHT_REPORT_EDIT } from "../constants"; import { useReportsQuery } from "../hooks"; import GenerateReportPicker from "./GenerateReportPicker"; import ReportDefinitionEditorDialog from "./ReportDefinitionEditorDialog"; @@ -66,12 +67,6 @@ const ReportSearcher = () => { const formatActions = (report) => !report.category && ( - {rights.includes(RIGHT_REPORT_ADD) && - rights.includes(RIGHT_REPORT_EDIT) && ( - - )}
{
+ {rights.includes(RIGHT_REPORT_EDIT) && ( + + )}
);