Skip to content

Commit

Permalink
A-1206201728816127 | Other Attributes handled through Configuration (#…
Browse files Browse the repository at this point in the history
…156)

* update. Other information to handle configurable fields

* handle visibilty of other attributes
  • Loading branch information
Arjun-Go authored Jan 17, 2024
1 parent 0f9ca79 commit 8622f39
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 546 deletions.
13 changes: 13 additions & 0 deletions src/api/personApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,16 @@ export async function updatePerson(uuid, payload) {
return error.response;
}
}

export async function fetchPersonAttributeConfig() {
try {
const url = Constants.registrationConfig;
return await fetch(url, {
method: 'GET',
credentials: 'include'
});
} catch (error) {
console.error(error);
return error.response;
}
}
13 changes: 3 additions & 10 deletions src/components/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@ const hostUrl = localStorage.getItem('host')
? 'https://' + localStorage.getItem('host')
: '';
const RESTWS_V1 = hostUrl + '/openmrs/ws/rest/v1';
const bahmniConfig = hostUrl + '/bahmni_config';
export const Constants = {
person: RESTWS_V1 + '/person',
personAttributeType: RESTWS_V1 + '/personattributetype'
personAttributeType: RESTWS_V1 + '/personattributetype',
registrationConfig: bahmniConfig + '/openmrs/apps/registration/app.json'
};
export const genderOptions = ['', 'Male', 'Female', 'Other'];
export const personAttributes = {
organization: 'organization',
email: 'email',
mobilePhone: 'mobilePhone',
workPhone: 'workPhone',
residencePhone: 'residencePhone',
otherPhone: 'otherPhone',
occupation: 'occupationNew'
};
export const phoneNumberPattern = '[0-9]{10}';
export const emailPattern = '[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4}$';
6 changes: 6 additions & 0 deletions src/containers/CreatePerson.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
width: 80%;
}

.other-attributes {
display: flex;
flex-wrap: wrap;
}

/* outer flex container with Name, Age, Gender sections */
.flex-container-row {
display: flex;
flex-wrap: wrap;
flex: 0 0 50%;
width: 100%;
padding-top: 10px;
}
Expand Down
Loading

0 comments on commit 8622f39

Please sign in to comment.