Skip to content

Commit

Permalink
CM-452: added button deduplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
sniedzielski committed Jan 11, 2024
1 parent 0d3dbbc commit 3c8bb64
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 9 deletions.
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
"@rollup/plugin-json": "^4.0.3",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-url": "^5.0.0",
"moment": "^2.25.3",
"prop-types": "^15.7.2",
"react-autosuggest": "^10.0.2",
"react-intl": "^2.9.0",
"react-router-dom": "^5.2.0",
"redux": "^4.0.5",
"redux-api-middleware": "^3.2.1",
"eslint": "^7.32.0 || ^8.2.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"rollup": "^2.10.0"
},
"files": [
Expand Down
114 changes: 114 additions & 0 deletions src/components/dialogs/DeduplicationFieldSelectionDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import React, { useState } from "react";
import { injectIntl } from "react-intl";
import Button from "@material-ui/core/Button";
import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogTitle from "@material-ui/core/DialogTitle";
import {
formatMessage,
formatMessageWithValues,
} from "@openimis/fe-core";
import { withTheme, withStyles } from "@material-ui/core/styles";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";

const styles = (theme) => ({
item: theme.paper.item,
});

const DeduplicationFieldSelectionDialog = ({
intl,
classes,
benefitPlan,
}) => {
console.log('intl', intl);

const [isOpen, setIsOpen] = useState(false);

const handleOpen = () => {
setIsOpen(true);
};

const handleClose = () => {
setIsOpen(false);
};

return (
<>
<Button
onClick={handleOpen}
variant="outlined"
color="#DFEDEF"
className={classes.button}
style={{
border: "0px",
textAlign: "right",
display: "block",
marginLeft: "auto",
marginRight: 0
}}
>
{formatMessage(intl, "deduplication", "deduplicate")}
</Button>
<Dialog
open={isOpen}
onClose={handleClose}
PaperProps={{
style: {
width: 900,
maxWidth: 900,
},
}}
>
<DialogTitle
style={{
marginTop: "10px",
}}
>
Pr
</DialogTitle>
<DialogContent>
<></>
</DialogContent>
<DialogActions
style={{
display: "inline",
paddingLeft: "10px",
marginTop: "25px",
marginBottom: "15px"
}}
>
<div>
<div style={{ float: "left" }}>
</div>
<div style={{
float: "right",
paddingRight: "16px"
}}
>
<Button
onClick={handleClose}
variant="outlined"
autoFocus
style={{ margin: "0 16px" }}
>
{formatMessage(intl, "deduplication", "deduplicate.button.cancel")}
</Button>
</div>
</div>
</DialogActions>
</Dialog>
</>
);
};

const mapStateToProps = (state, props) => ({
rights: !!state.core && !!state.core.user && !!state.core.user.i_user ? state.core.user.i_user.rights : [],
confirmed: state.core.confirmed,
});

const mapDispatchToProps = (dispatch) => bindActionCreators({
}, dispatch);

export default injectIntl(withTheme(withStyles(styles)(connect(mapStateToProps, mapDispatchToProps)(DeduplicationFieldSelectionDialog))));
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import messages_en from "./translations/en.json";
import DeduplicationFieldSelectionDialog from "./components/dialogs/DeduplicationFieldSelectionDialog";

const DEFAULT_CONFIG = {
"translations": [{ key: "en", messages: messages_en }],
translations: [{ key: "en", messages: messages_en }],
'deduplication.deduplicationFieldSelectionDialog': [
DeduplicationFieldSelectionDialog
]
}

export const DeduplicationModule = (cfg) => {
return { ...DEFAULT_CONFIG, ...cfg };
}
}
3 changes: 3 additions & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
{
"deduplication.deduplicate": "Deduplicate",
"deduplication.deduplicate.title": "Deduplication - {benefitPlanName}",
"dedulication.deduplicate.button.cancel": "Cancel"
}

0 comments on commit 3c8bb64

Please sign in to comment.