Skip to content

Commit

Permalink
OP-1858: adjust edit/add rights
Browse files Browse the repository at this point in the history
  • Loading branch information
olewandowski1 committed Apr 12, 2024
1 parent 3e281e8 commit 0b36587
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/ReportSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -66,12 +67,6 @@ const ReportSearcher = () => {
const formatActions = (report) =>
!report.category && (
<Box display="flex" justifyContent={"flex-end"} gridGap={12}>
{rights.includes(RIGHT_REPORT_ADD) &&
rights.includes(RIGHT_REPORT_EDIT) && (
<Button onClick={() => setEditedReport(report)} size="small">
{formatMessage("ReportSearcher.editBtn")}
</Button>
)}
<div
style={{
display: "flex",
Expand All @@ -83,6 +78,11 @@ const ReportSearcher = () => {
<HelpOutlineIcon fontSize="small" />
</Tooltip>
</div>
{rights.includes(RIGHT_REPORT_EDIT) && (
<Button onClick={() => setEditedReport(report)} size="small" startIcon={<EditIcon />}>
{formatMessage("ReportSearcher.editBtn")}
</Button>
)}
<GenerateReportPicker name={report.name} />
</Box>
);
Expand Down

0 comments on commit 0b36587

Please sign in to comment.