-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from openimis/develop
MERGING RELEASE branches
- Loading branch information
Showing
2 changed files
with
60 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | ||
) | ||
) | ||
); |