Skip to content

Commit

Permalink
Merge pull request #101 from openimis/develop
Browse files Browse the repository at this point in the history
MERGING develop into release/24.04
  • Loading branch information
delcroip authored Apr 12, 2024
2 parents c968c64 + 473e150 commit 7f2b196
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/components/UserForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const setupState = (props) => ({
}
: props.user,
isSaved: false,
reset: 0,
});

class UserForm extends Component {
Expand Down Expand Up @@ -123,6 +124,7 @@ class UserForm extends Component {
// eslint-disable-next-line no-console
console.error(`[RELOAD_USER]: Fetching user details failed. ${error}`);
}
this.setState((state) => ({ ...state, reset: state.reset + 1 }));
return;
}

Expand All @@ -138,6 +140,7 @@ class UserForm extends Component {
// eslint-disable-next-line no-console
console.error(`[RELOAD_USER]: Fetching user details failed. ${error}`);
}
this.setState((state) => ({ ...state, reset: state.reset + 1 }));
return;
}

Expand Down Expand Up @@ -210,7 +213,7 @@ class UserForm extends Component {
obligatoryEoFields,
usernameLength,
} = this.props;
const { user, isSaved } = this.state;
const { user, isSaved, reset } = this.state;

if (!rights.includes(RIGHT_USERS)) return null;

Expand All @@ -236,6 +239,7 @@ class UserForm extends Component {
title={userId ? "admin.user.UserOverview.title" : "admin.user.UserOverview.newTitle"}
edited_id={userId}
edited={user}
reset={reset}
back={back}
add={add}
openDirty={save}
Expand Down
8 changes: 2 additions & 6 deletions src/components/UserMasterPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ const UserMasterPanel = (props) => {
district={edited.districts}
module="admin"
readOnly={readOnly}
required={
edited.userTypes.includes(
CLAIM_ADMIN_USER_TYPE,
) /* This field is also present in the claim administrator panel */
}
required={edited.userTypes.includes(CLAIM_ADMIN_USER_TYPE)}
onChange={(healthFacility) => onEditedChanged({ ...edited, healthFacility })}
/>
</Grid>
Expand Down Expand Up @@ -264,7 +260,7 @@ const UserMasterPanel = (props) => {
<PublishedComponent
pubRef="location.LocationPicker"
locationLevel={1}
value={edited.districts}
value={edited?.districts ?? []}
onChange={(districts) => onEditedChanged({ ...edited, districts })}
readOnly={readOnly}
required
Expand Down

0 comments on commit 7f2b196

Please sign in to comment.