Skip to content

Commit

Permalink
Merge pull request #44 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 821fd9d + 790c79d commit 2c9f8f3
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export function updateMedicalItem(mm, medicalItem, clientMutationLabel) {
const requestedDateTime = new Date();
return graphql(
mutation.payload,
["MEDICAL_SERVICE_MUTATION_REQ", "MEDICAL_SERVICE_UPDATE_RESP", "MEDICAL_SERVICE_MUTATION_ERR"],
["MEDICAL_ITEM_MUTATION_REQ", "MEDICAL_ITEM_UPDATE_RESP", "MEDICAL_ITEM_MUTATION_ERR"],
{
clientMutationId: mutation.clientMutationId,
clientMutationLabel,
Expand Down
1 change: 1 addition & 0 deletions src/components/MedicalItemForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class MedicalItemForm extends Component {
onEditedChanged={this.onEditedChanged}
canSave={this.canSave}
save={save ? this.save : null}
openDirty={save}
onActionToConfirm={this.onActionToConfirm}
/>
)}
Expand Down
1 change: 1 addition & 0 deletions src/components/MedicalServiceForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class MedicalServiceForm extends Component {
onEditedChanged={this.onEditedChanged}
canSave={this.canSave}
save={save ? this.save : null}
openDirty={save}
onActionToConfirm={this.onActionToConfirm}
/>
)}
Expand Down
3 changes: 3 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ export const PATIENT_CATEGORIES = [
PATIENT_CATEGORY_MASK_ADULT,
PATIENT_CATEGORY_MASK_MINOR,
];

export const ITEMS_MODULE_NAME = "medicalItem";
export const SERVICES_MODULE_NAME = "medicalService";
18 changes: 15 additions & 3 deletions src/pages/MedicalItemsPage.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import React, { Component } from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import { injectIntl } from "react-intl";
import { Fab } from "@material-ui/core";
import AddIcon from "@material-ui/icons/Add";
import { withTheme, withStyles } from "@material-ui/core/styles";
import { RIGHT_MEDICALITEMS_ADD } from "../constants";
import { RIGHT_MEDICALITEMS_ADD, ITEMS_MODULE_NAME} from "../constants";
import {
formatMessage,
formatMessageWithValues,
Helmet,
historyPush,
withHistory,
withModulesManager,
withTooltip
withTooltip,
clearCurrentPaginationPage,
} from "@openimis/fe-core";
import MedicalItemSearcher from "../components/MedicalItemSearcher";

Expand All @@ -30,6 +32,11 @@ class MedicalItemsPage extends Component {
historyPush(this.props.modulesManager, this.props.history, "medical.medicalItemNew");
};

componentDidMount = () => {
const { module } = this.props;
if (module !== ITEMS_MODULE_NAME) this.props.clearCurrentPaginationPage();
};

render() {
const { classes, rights, intl } = this.props;
return (
Expand All @@ -52,8 +59,13 @@ class MedicalItemsPage extends Component {

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)(MedicalItemsPage))))),
withModulesManager(
withHistory(connect(mapStateToProps, mapDispatchToProps)(withTheme(withStyles(styles)(MedicalItemsPage)))),
),
);
18 changes: 15 additions & 3 deletions src/pages/MedicalServicesPage.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import React, { Component } from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import { injectIntl } from "react-intl";
import { Fab } from "@material-ui/core";
import AddIcon from "@material-ui/icons/Add";
import { withTheme, withStyles } from "@material-ui/core/styles";
import { RIGHT_MEDICALSERVICES_ADD } from "../constants";
import { RIGHT_MEDICALSERVICES_ADD, SERVICES_MODULE_NAME } from "../constants";
import {
formatMessage,
formatMessageWithValues,
Helmet,
historyPush,
withHistory,
withModulesManager,
withTooltip
withTooltip,
clearCurrentPaginationPage,
} from "@openimis/fe-core";
import MedicalServiceSearcher from "../components/MedicalServiceSearcher";

Expand All @@ -30,6 +32,11 @@ class MedicalServicesPage extends Component {
historyPush(this.props.modulesManager, this.props.history, "medical.medicalServiceNew");
};

componentDidMount = () => {
const { module } = this.props;
if (module !== SERVICES_MODULE_NAME) this.props.clearCurrentPaginationPage();
};

render() {
const { classes, rights, intl } = this.props;
return (
Expand All @@ -52,8 +59,13 @@ class MedicalServicesPage extends Component {

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)(MedicalServicesPage))))),
withModulesManager(
withHistory(connect(mapStateToProps, mapDispatchToProps)(withTheme(withStyles(styles)(MedicalServicesPage)))),
),
);
3 changes: 1 addition & 2 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"medical.visitType.R": "Referral",
"medical.visitType.O": "Other",
"medical.careType": "Care Type",
"medical.careType.any": "Any",
"medical.careType.null": "None",
"medical.careType.null": "Any",
"medical.careType.I": "In - Patient",
"medical.careType.O": "Out - Patient",
"medical.careType.B": "In & Out - Patient",
Expand Down

0 comments on commit 2c9f8f3

Please sign in to comment.