Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/rename case data title #54

Merged
merged 6 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2025-01-24T08:32:36.797Z\n"
"PO-Revision-Date: 2025-01-24T08:32:36.797Z\n"
"POT-Creation-Date: 2025-01-24T10:58:18.826Z\n"
"PO-Revision-Date: 2025-01-24T10:58:18.826Z\n"

msgid "Low"
msgstr ""
Expand Down Expand Up @@ -87,7 +87,7 @@ msgstr ""
msgid "Edit Details"
msgstr ""

msgid "Edit historical case data"
msgid "Replace case data"
msgstr ""

msgid "Complete Event"
Expand Down Expand Up @@ -120,7 +120,10 @@ msgstr ""
msgid "Download empty template"
msgstr ""

msgid "Download historical data"
msgid "Clear Case Data"
msgstr ""

msgid "Download Case Data"
msgstr ""

msgid "Confirm remove the file"
Expand Down Expand Up @@ -165,6 +168,27 @@ msgstr ""
msgid "Status: "
msgstr ""

msgid "You do not have permission to create/edit events"
msgstr ""

msgid "You do not have permission to replace case data"
msgstr ""

msgid "You do not have permission to create/edit IM team member assignments"
msgstr ""

msgid "You do not have permission to create/edit incident action plans"
msgstr ""

msgid "You do not have permission to create/edit incident response actions"
msgstr ""

msgid "You do not have permission to create/edit risk assessments"
msgstr ""

msgid "You do not have permission to create/edit this form"
msgstr ""

msgid "Select duration"
msgstr ""

Expand Down
30 changes: 27 additions & 3 deletions i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2025-01-24T08:31:59.988Z\n"
"POT-Creation-Date: 2025-01-24T10:58:18.826Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -86,7 +86,7 @@ msgstr ""
msgid "Edit Details"
msgstr ""

msgid "Edit historical case data"
msgid "Replace case data"
msgstr ""

msgid "Complete Event"
Expand Down Expand Up @@ -119,7 +119,10 @@ msgstr ""
msgid "Download empty template"
msgstr ""

msgid "Download historical data"
msgid "Clear Case Data"
msgstr ""

msgid "Download Case Data"
msgstr ""

msgid "Confirm remove the file"
Expand Down Expand Up @@ -164,6 +167,27 @@ msgstr ""
msgid "Status: "
msgstr ""

msgid "You do not have permission to create/edit events"
msgstr ""

msgid "You do not have permission to replace case data"
msgstr ""

msgid "You do not have permission to create/edit IM team member assignments"
msgstr ""

msgid "You do not have permission to create/edit incident action plans"
msgstr ""

msgid "You do not have permission to create/edit incident response actions"
msgstr ""

msgid "You do not have permission to create/edit risk assessments"
msgstr ""

msgid "You do not have permission to create/edit this form"
msgstr ""

msgid "Select duration"
msgstr ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const EventTrackerFormSummary: React.FC<EventTrackerFormSummaryProps> = R
onClick={onEditCaseDataClick}
startIcon={<BackupIcon />}
>
{i18n.t("Edit historical case data")}
{i18n.t("Replace case data")}
</Button>
) : null}

Expand Down
45 changes: 35 additions & 10 deletions src/webapp/components/import-file/ImportFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,31 @@ export const ImportFile: React.FC<ImportFileProps> = React.memo(props => {
</FlexContainer>
{file && (
<RemoveContainer>
<IconButton
className="remove-file"
icon={<CloseIcon />}
ariaLabel="Delete current uploaded file"
onClick={onOpenConfirmationModalRemoveFile}
/>
{fileId ? (
<RemoveButton onClick={onOpenConfirmationModalRemoveFile}>
<StyledButtonText>{i18n.t("Clear Case Data")}</StyledButtonText>
</RemoveButton>
) : (
<IconButton
className="remove-file"
icon={<CloseIcon />}
ariaLabel="Delete current uploaded file"
onClick={onOpenConfirmationModalRemoveFile}
/>
)}

<Link
href={URL.createObjectURL(file)}
download={fileId && fileNameLabel ? fileNameLabel : file.name}
underline="hover"
>
{fileId ? i18n.t("Download historical data") : file.name}
{fileId ? (
<StyledButtonText primary>
{i18n.t("Download Case Data")}
</StyledButtonText>
) : (
file.name
)}
</Link>
<SimpleModal
open={openDeleteModal}
Expand Down Expand Up @@ -213,9 +226,21 @@ const RemoveContainer = styled.div`
display: flex;
align-items: center;
margin-block-start: 5px;
.remove-file {
color: ${props => props.theme.palette.common.red700};
}
gap: 0 4px;
`;

const RemoveButton = styled.button`
all: unset;
cursor: pointer;
`;

const StyledButtonText = styled.div<{ primary?: boolean }>`
border-radius: 4px;
background-color: ${props =>
props.primary ? props.theme.palette.common.green500 : props.theme.palette.common.grey600};
font-size: 12px;
color: white;
padding: 4px 8px;
`;

const Text = styled.div`
Expand Down
21 changes: 14 additions & 7 deletions src/webapp/hooks/useHasCurrentUserCaptureAccess.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect } from "react";
import i18n from "../../utils/i18n";
import { useAppContext } from "../contexts/app-context";
import { FormType } from "../pages/form-page/FormPage";
import { useSnackbar } from "@eyeseetea/d2-ui-components";
Expand All @@ -13,34 +14,40 @@ export function useCheckWritePermission(formType: FormType) {
if (!currentUser.hasCaptureAccess) {
switch (formType) {
case "disease-outbreak-event":
snackbar.error("You do not have permission to create/edit events");
snackbar.error(i18n.t("You do not have permission to create/edit events"));
break;
case "disease-outbreak-event-case-data":
snackbar.error("You do not have permission to edit historical case data");
snackbar.error(i18n.t("You do not have permission to replace case data"));
break;
case "incident-management-team-member-assignment":
snackbar.error(
"You do not have permission to create/edit IM team member assignments"
i18n.t(
"You do not have permission to create/edit IM team member assignments"
)
);
break;
case "incident-action-plan":
snackbar.error(
"You do not have permission to create/edit incident action plans"
i18n.t("You do not have permission to create/edit incident action plans")
);
break;
case "incident-response-actions":
case "incident-response-action":
snackbar.error(
"You do not have permission to create/edit incident response actions"
i18n.t(
"You do not have permission to create/edit incident response actions"
)
);
break;
case "risk-assessment-grading":
case "risk-assessment-questionnaire":
case "risk-assessment-summary":
snackbar.error("You do not have permission to create/edit risk assessments");
snackbar.error(
i18n.t("You do not have permission to create/edit risk assessments")
);
break;
default:
snackbar.error("You do not have permission to create/edit this form");
snackbar.error(i18n.t("You do not have permission to create/edit this form"));
break;
}
history.goBack();
Expand Down
Loading