Skip to content

Commit

Permalink
Merge pull request #14 from openimis/develop
Browse files Browse the repository at this point in the history
MERGING RELEASE branches
  • Loading branch information
dragos-dobre authored Apr 24, 2023
2 parents e80ed08 + 1f4643f commit a0c8dab
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 28 deletions.
1 change: 1 addition & 0 deletions src/components/ContributionForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class ContributionForm extends Component {
save={!!save ? this.confirmSave : null}
update={update}
onActionToConfirm={this.onActionToConfirm}
openDirty={save}
/>
)}
</div>
Expand Down
87 changes: 59 additions & 28 deletions src/pages/ContributionsPage.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,71 @@
import React, { Component } from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import { injectIntl } from 'react-intl';
import { injectIntl } from "react-intl";

import { withTheme, withStyles } from "@material-ui/core/styles";
import { historyPush, withModulesManager, withHistory } from "@openimis/fe-core"
import ContributionSearcher from "../components/ContributionSearcher";

import {
historyPush,
withModulesManager,
withHistory,
clearCurrentPaginationPage,
} from "@openimis/fe-core";
import ContributionSearcher from "../components/ContributionSearcher";

const styles = theme => ({
page: theme.page,
fab: theme.fab
const styles = (theme) => ({
page: theme.page,
fab: theme.fab,
});


class ContributionsPage extends Component {
onDoubleClick = (c, newTab = false) => {
historyPush(
this.props.modulesManager,
this.props.history,
"contribution.contributionOverview",
[c.uuid],
newTab
);
};

onDoubleClick = (c, newTab = false) => {
historyPush(this.props.modulesManager, this.props.history, "contribution.contributionOverview", [c.uuid], newTab)
}

render() {
const { classes } = this.props;
return (
<div className={classes.page}>
<ContributionSearcher
cacheFiltersKey="contributionsPageFiltersCache"
onDoubleClick={this.onDoubleClick}
/>
</div>
)
}
componentDidMount = () => {
const moduleName = "contribution";
const { module } = this.props;
if (module !== moduleName) this.props.clearCurrentPaginationPage();
};

render() {
const { classes } = this.props;
return (
<div className={classes.page}>
<ContributionSearcher
cacheFiltersKey="contributionsPageFiltersCache"
onDoubleClick={this.onDoubleClick}
/>
</div>
);
}
}

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

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

export default injectIntl(withModulesManager(
withHistory(connect(mapStateToProps)(withTheme(withStyles(styles)(ContributionsPage))))
));
export default injectIntl(
withModulesManager(
withHistory(
connect(
mapStateToProps,
mapDispatchToProps
)(withTheme(withStyles(styles)(ContributionsPage)))
)
)
);

0 comments on commit a0c8dab

Please sign in to comment.