-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DCM-47: Initiate the location mapping user interface
- Loading branch information
1 parent
83df953
commit ef06831
Showing
10 changed files
with
209 additions
and
5 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
api/src/main/java/org/openmrs/module/dhisconnector/LocationToOrgUnitMapping.java
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 |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package org.openmrs.module.dhisconnector; | ||
|
||
import org.codehaus.jackson.annotate.JsonIgnore; | ||
import org.codehaus.jackson.annotate.JsonIgnoreProperties; | ||
import org.codehaus.jackson.map.annotate.JsonSerialize; | ||
import org.openmrs.BaseOpenmrsObject; | ||
import org.openmrs.Location; | ||
import org.openmrs.User; | ||
|
||
import javax.annotation.Generated; | ||
import javax.persistence.*; | ||
import java.util.Date; | ||
|
||
/** | ||
* Represents a general mapping between an OpenMRS location against a DHIS2 Organisation unit | ||
*/ | ||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) | ||
@Generated("org.jsonschema2pojo") | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Entity | ||
@Table(name = "dhisconnector_location_to_orgunit") | ||
public class LocationToOrgUnitMapping extends BaseOpenmrsObject { | ||
|
||
@ManyToOne(optional = false) | ||
@JoinColumn(name = "creator") | ||
protected User creator; | ||
|
||
@Column(name = "date_created", nullable = false) | ||
private Date dateCreated; | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
@Column(name = "id", nullable = false) | ||
private Integer id; | ||
|
||
@Column(name = "org_unit_uid", nullable = false) | ||
private String orgUnitUid; | ||
|
||
@JsonIgnore | ||
@ManyToOne(optional = false) | ||
@JoinColumn(name = "location") | ||
private Location location; | ||
|
||
public LocationToOrgUnitMapping() { | ||
} | ||
|
||
public LocationToOrgUnitMapping(Location location, String orgUnitId) { | ||
setLocation(location); | ||
setOrgUnitUid(orgUnitId); | ||
} | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getOrgUnitUid() { | ||
return orgUnitUid; | ||
} | ||
|
||
public void setOrgUnitUid(String orgUnitUid) { | ||
this.orgUnitUid = orgUnitUid; | ||
} | ||
|
||
public Location getLocation() { | ||
return location; | ||
} | ||
|
||
public void setLocation(Location location) { | ||
this.location = location; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.Auditable#getCreator() | ||
*/ | ||
public User getCreator() { | ||
return creator; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.Auditable#setCreator(User) | ||
*/ | ||
public void setCreator(User creator) { | ||
this.creator = creator; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.Auditable#getDateCreated() | ||
*/ | ||
public Date getDateCreated() { | ||
return dateCreated; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.Auditable#setDateCreated(Date) | ||
*/ | ||
public void setDateCreated(Date dateCreated) { | ||
this.dateCreated = dateCreated; | ||
} | ||
} |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<%@ include file="/WEB-INF/template/include.jsp" %> | ||
<%@ include file="/WEB-INF/template/header.jsp" %> | ||
|
||
<openmrs:htmlInclude file="/moduleResources/dhisconnector/flexboxgrid.min.css"/> | ||
<openmrs:htmlInclude file="/moduleResources/dhisconnector/dhisconnector.css"/> | ||
|
||
<%@ include file="template/localHeader.jsp" %> | ||
|
||
<c:if test="${showLogin == 'true'}"> | ||
<c:redirect url="../../login.htm"/> | ||
</c:if> | ||
|
||
<h3><spring:message code="dhisconnector.locationMapping"/></h3> | ||
|
||
<form method="post"> | ||
<table id="locationMappingTable"> | ||
<thead> | ||
<tr> | ||
<th><spring:message code="dhisconnector.locationMapping.location"/></th> | ||
<th><spring:message code="dhisconnector.locationMapping.orgUnit"/></th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
<c:forEach items="${locations}" var="location"> | ||
<tr class="evenRow"> | ||
|
||
<td id="location_${location.uuid}">${location.name}</td> | ||
|
||
<c:set value="" var="savedOrgUnitUuid"/> | ||
<c:forEach items="${locationToOrgUnitMappings}" var="locationToOrgUnitMapping"> | ||
<c:if test="${location.id == locationToOrgUnitMapping.location.id}"> | ||
<c:set value="${locationToOrgUnitMapping.orgUnitUid}" var="savedOrgUnitUuid"/> | ||
</c:if> | ||
</c:forEach> | ||
|
||
<td> | ||
<select name="orgUnitOf_${location.uuid}"> | ||
<option></option> | ||
|
||
<c:forEach items="${orgUnits}" var="orgUnit"> | ||
<c:set value="" var="isSelected"/> | ||
<c:if test="${orgUnit.id == savedOrgUnitUuid}"> | ||
<c:set value="selected" var="isSelected"/> | ||
</c:if> | ||
|
||
<option ${isSelected} value="${orgUnit.id}">${orgUnit.name}</option> | ||
|
||
</c:forEach> | ||
</select> | ||
</td> | ||
|
||
</tr> | ||
</c:forEach> | ||
</tbody> | ||
</table> | ||
<input type="button" value="<spring:message code='dhisconnector.save'/>"> | ||
</form> | ||
|
||
<%@ include file="/WEB-INF/template/footer.jsp" %> | ||
<%@ include file="jembiOpenMRSFooter.jsp" %> |
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