Skip to content

Commit

Permalink
Merge pull request #95 from openimis/develop
Browse files Browse the repository at this point in the history
MERGING develop into release/24.10
  • Loading branch information
delcroip authored Oct 22, 2024
2 parents 2e60818 + a0a510d commit 2a74fa0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
25 changes: 13 additions & 12 deletions src/components/EconomicUnitChangeButton.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { useSelector } from "react-redux";
import { useSelector } from 'react-redux';

import { makeStyles } from '@material-ui/core/styles';
import { IconButton, Tooltip } from '@material-ui/core';
import { Button } from '@material-ui/core';
import { PinDrop } from '@material-ui/icons';

import { useTranslations, useModulesManager } from '@openimis/fe-core';
Expand All @@ -11,14 +11,14 @@ import { MODULE_NAME, RIGHT_VIEW_EU_MODAL } from '../constants';
const useStyles = makeStyles((theme) => ({
button: {
margin: theme.spacing(2),
color: theme.palette.secondary.main,
color: theme.palette.primary.main,
},
}));

const EconomicUnitChangeButton = ({ onEconomicDialogOpen }) => {
const classes = useStyles();
const modulesManager = useModulesManager();
const rights = useSelector((store) => store.core.user?.i_user?.rights ?? [])
const rights = useSelector((store) => store.core.user?.i_user?.rights ?? []);
const { formatMessage } = useTranslations(MODULE_NAME, modulesManager);

const economicUnitConfig = modulesManager.getConf(
Expand All @@ -30,14 +30,15 @@ const EconomicUnitChangeButton = ({ onEconomicDialogOpen }) => {
if (!economicUnitConfig || !rights.includes(RIGHT_VIEW_EU_MODAL)) return null;

return (
<Tooltip title={formatMessage('EconomicUnitChangeButton.tooltip')}>
<IconButton
className={classes.button}
onClick={() => onEconomicDialogOpen()}
>
<PinDrop />
</IconButton>
</Tooltip>
<Button
variant='contained'
color='secondary'
startIcon={<PinDrop />}
className={classes.button}
onClick={() => onEconomicDialogOpen()}
>
<strong> {formatMessage('EconomicUnitChangeButton.label')} </strong>
</Button>
);
};

Expand Down
9 changes: 4 additions & 5 deletions src/dialogs/EconomicUnitDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
} from '@material-ui/core';
import { makeStyles } from '@material-ui/styles';
Expand All @@ -19,6 +18,9 @@ import EconomicUnitPicker from '../pickers/EconomicUnitPicker';
const useStyles = makeStyles((theme) => ({
primaryButton: theme.dialog.primaryButton,
secondaryButton: theme.dialog.secondaryButton,
dialogWidth: {
minWidth: '360px',
}
}));

const EconomicUnitDialog = ({ open, setEconomicUnitDialogOpen }) => {
Expand Down Expand Up @@ -68,10 +70,7 @@ const EconomicUnitDialog = ({ open, setEconomicUnitDialogOpen }) => {
return (
<Dialog open={open}>
<DialogTitle>{formatMessage('selectEconomicUnit.title')}</DialogTitle>
<DialogContent>
<DialogContentText>
{formatMessage('selectEconomicUnit.message')}
</DialogContentText>
<DialogContent className={classes.dialogWidth}>
<EconomicUnitPicker
readOnly={false}
value={value}
Expand Down
3 changes: 1 addition & 2 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@
"policyHolder.ReplacePolicyHolderUser.mutationLabel": "{newUser} is replacing {oldUser} on {policyHolder}",
"policyHolder.EconomicUnitPicker.label": "Economic Unit",
"policyHolder.selectEconomicUnit.title": "Select an Economic Unit",
"policyHolder.selectEconomicUnit.message": "Select the Economic Unit you want to work with.",
"policyHolder.selectEconomicUnit.confirm": "Confirm",
"policyHolder.selectEconomicUnit.logout": "Logout",
"policyHolder.EconomicUnitChangeButton.tooltip": "Change your Economic Unit"
"policyHolder.EconomicUnitChangeButton.label": "Change Company"
}

0 comments on commit 2a74fa0

Please sign in to comment.