Advertisement
Guest User

manageReports

a guest
Dec 10th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.06 KB | None | 0 0
  1. <%@ include file="/WEB-INF/template/include.jsp"%>
  2. <%@ include file="/WEB-INF/template/header.jsp"%>
  3. <%@ include file="localInclude.jsp" %>
  4. <openmrs:require privilege="Manage Report Templates" otherwise="/login.htm" redirect="/module/integration/manageReportTemplates.form" />
  5. <script type="text/javascript" charset="utf-8">
  6. $j(document).ready(function() {
  7. $j('#report-table').dataTable( {
  8. "bPaginate": false,
  9. "iDisplayLength": 8,
  10. "bLengthChange": false,
  11. "bFilter": false,
  12. "bSort": true,
  13. "bInfo": true,
  14. "bAutoWidth": false,
  15. "bScrollY" : true,
  16. } );
  17.  
  18. $j('.edit').click(function() {
  19. var reportId = $j(this).attr('id').substring(4); // strip 'edit'
  20. alert(reportId);
  21. $("#id").val(reportId);
  22. $("#reportName").val($j.trim($j("#name"+reportId).html()));
  23. $("#mappedReport").val($j.trim($j("#mappedReport"+reportId).html()));
  24. $("#baseCohort").val($j.trim($j("#baseCohort"+reportId).html()));
  25. $('#editReportTemplateMapping').dialog('open');
  26. } );
  27.  
  28. $j('.mapDE').click(function() {
  29. var reportId = $j(this).attr('id').substring(5); // strip 'mapDE'
  30. alert(reportId);
  31. var url = "showDataElements.form?reportTemplateId=${reportId}&server=${server.serverName}";
  32. alert(url);
  33. window.location = url;
  34. } );
  35.  
  36. $j('.mapOS').click(function() {
  37. var reportId = $j(this).attr('id').substring(5); // strip 'mapOS'
  38. alert(reportId);
  39. var url = "showOptions.form?reportTemplateId=${reportId}&server=${server.serverName}";
  40. alert(url);
  41. window.location = url;
  42. } );
  43.  
  44. $j('.reportRow').click(function() {
  45. var reportId = $j(this).attr('id').substring(4); // strip 'name'
  46. alert("reportId: " + reportId);
  47. $j('#combo-table').fnFilter($j("name${reportId}.value"),0,false,false,false,true);
  48. } );
  49.  
  50. $j('#editReportTemplateMapping').dialog({
  51. autoOpen: false,
  52. modal: true,
  53. title: '<openmrs:message code="integration.general.reportMappedTo" javaScriptEscape="true" />',
  54. width: '90%'
  55. } );
  56.  
  57. $j(".cancel").click( function() {
  58. $j('#editReportTemplateMapping').dialog('close');
  59. } );
  60.  
  61. $j('#combo-table').dataTable( {
  62. "bPaginate": false,
  63. "iDisplayLength": 8,
  64. "bLengthChange": false,
  65. "bFilter": false,
  66. "bSort": true,
  67. "bInfo": true,
  68. "bAutoWidth": false,
  69. "bScrollY" : true,
  70. } );
  71.  
  72. $j('.deText').click(function()) {
  73. var deId = $j(this).attr('id');
  74. alert("DE: " + deId);
  75. } );
  76.  
  77. $j('.osText').click(function()) {
  78. var osId = $j(this).attr('id');
  79. alert("OS: " + osId);
  80. } );
  81.  
  82. // emulate a click on the first row of the report table
  83. var rid = $j(".reportRow"[0]).attr('id');
  84. $j('#combo-table').fnFilter($j("name${rid}.value"),0,false,false,false,true);
  85. } );
  86. </script>
  87.  
  88. <style>
  89. .small { font-size: x-small; }
  90. .oddRow { background-color: white; }
  91. .evenRow { background-color: whitesmoke; }
  92. .deText { border-style: none; font-style: italic;}
  93. .osText { border-style: none; font-style: italic;}
  94. </style>
  95.  
  96. <div id="breadCrumbs">
  97. <a href="integrationServerAdmin.form">
  98. <openmrs:message code="integration.return.serverAdministration"/>
  99. </a>|
  100. </div>
  101. <h2>
  102. <openmrs:message code="integration.general.reportTemplatesFor"/> <openmrs:message code="integration.serverAdmin"/> : ${server.serverName}
  103. </h2>
  104.  
  105. <div id="base-page"><form>
  106. <div >
  107. <br/>
  108. <table id="report-table" width="90%">
  109. <thead>
  110. <tr>
  111. <th><openmrs:message code="integration.general.name"/></th>
  112. <th><openmrs:message code="integration.general.code"/></th>
  113. <th><openmrs:message code="integration.general.frequency"/></th>
  114. <th><openmrs:message code="integration.general.baseCohort"/></th>
  115. <th><openmrs:message code="integration.general.reportMappedTo"/></th>
  116. <th align="center" width="1%"><openmrs:message code="integration.general.actions"/></th>
  117. </tr>
  118. </thead>
  119. <tbody>
  120. <c:forEach items="${reportTemplates}" var="reportTemplate" varStatus="rtstatus">
  121. <tr id="${reportTemplate.id}" style="background-color:${rtstatus.index % 2 == 0 ? 'white' : 'whitesmoke'}" >
  122. <td width="20%" id="name${reportTemplate.id}" class="reportRow">
  123. ${reportTemplate.name}
  124. </td>
  125. <td width="10%" id="code${reportTemplate.id}">
  126. ${reportTemplate.code}
  127. </td>
  128. <td width="10%" id="frequency${reportTemplate.id}">
  129. ${reportTemplate.frequency}
  130. </td>
  131. <td width="10%" id="baseCohort${reportTemplate.id}">
  132. ${uuidToReportDefinitionMap[reportTemplate.mappedReportUuid].baseCohortDefinition}
  133. </td>
  134. <td width="10%" id="mappedReport${reportTemplate.id}">
  135. ${uuidToReportDefinitionMap[reportTemplate.mappedReportUuid].name}
  136. </td>
  137. <td align="center" nowrap>
  138. <button type="button" class="edit" id="edit${reportTemplate.id}">
  139. <openmrs:message code="integration.button.editReports"/>
  140. </button>
  141.  
  142. <button type="button" class="mapeDE" id="mapDE${reportTemplate.id}">
  143. <openmrs:message code="integration.button.mapDataElement"/>
  144. </button>
  145.  
  146. <button type="button" class="mapOS" "mapOS${reportTemplate.id}">
  147. <openmrs:message code="integration.button.mapOptionSets"/>
  148. </button>
  149. </td>
  150. </tr>
  151. </c:forEach>
  152. </tbody>
  153. </table>
  154. </div>
  155.  
  156. <div id="report-mapping">
  157. <br/>
  158. <table id="combo-table" width="90%">
  159. <thead>
  160. <tr>
  161. <th><openmrs:message code="integration.dhis.dataElement"/></th>
  162. <th><openmrs:message code="integration.dhis.categoryCombo"/></th>
  163. <th><openmrs:message code="integration.dhis.optionSet"/></th>
  164. </tr>
  165. </thead>
  166. <tbody>
  167. <c:forEach items="${reportMapDisplay}" var="rd" varStatus="rdstatus">
  168. <tr id={$rd.reportId} style="background-color:${rdstatus.index % 2 == 0 ? 'white' : 'whitesmoke'}; padding:20" >
  169. <td>
  170. <c:forEach items="${rd.elements}" var="de">
  171. <c:if test="${!de.mapped}">
  172. <img src="<c:url value='/images/alert.gif'/>" border="0" />
  173. </c:if>
  174. <button type="button" id="${de.id }" class="deText">
  175. ${de.name}
  176. </button>
  177. <c:if test="${de.mapped}">
  178. <img src="<c:url value='/images/checkmark.png'/>" border="0" />
  179. </c:if>
  180. <br/>
  181. </c:forEach>
  182. </td>
  183. <td id="${rd.comboId }">
  184. ${rd.comboName }
  185. </td>
  186. <td>
  187. <c:forEach items="${rd.optionSets}" var="os">
  188. <c:if test="${!os.mapped}">
  189. <img src="<c:url value='/images/alert.gif'/>" border="0" />
  190. </c:if>
  191. <button type="button" id="${os.id}" class="osText">
  192. ${os.name}
  193. </button>
  194. <c:if test="${os.mapped}">
  195. <img src="<c:url value='/images/checkmark.png'/>" border="0" />
  196. </c:if>
  197. <br/>
  198. </c:forEach>
  199. </td>
  200. </c:forEach>
  201. </tbody>
  202. </table>
  203. </div>
  204. </form></div>
  205.  
  206. <div id="editReportTemplateMapping">
  207. <form method="post" id="detailsedit" action="saveReportTemplateMapping.form">
  208. <table>
  209. <tbody>
  210. <tr>
  211. <td><openmrs:message code="integration.general.name"/></td>
  212. <td>:</td>
  213. <td>
  214. <input id="id" type="hidden"/>
  215. <input id="reportName" type="text" width="50" input="disabled" />
  216. </td>
  217. </tr>
  218. <tr>
  219. <td><openmrs:message code="integration.general.reportMappedTo"/></td>
  220. <td>:</td>
  221. <td> <input id="mappedReport" type="text" size="40" /></td>
  222. </tr>
  223. <tr>
  224. <td><openmrs:message code="integration.general.baseCohort"/></td>
  225. <td>:</td>
  226. <td><input id="baseCohort" type="text" size="40" /></td>
  227. </tr>
  228. <tr></tr>
  229. <tr>
  230. <td></td>
  231. <td></td>
  232. <td>
  233. <input type="submit" name="submit" value='<openmrs:message code="integration.button.save"/>' javaScriptEscape="true" />
  234. <input type="reset" id="cancel" value='<openmrs:message code="integration.button.cancel" javaScriptEscape="true"/>' class="cancel">
  235. </td>
  236. </tr>
  237. </tbody>
  238. </table>
  239. </form>
  240. </div>
  241.  
  242. <%@ include file="/WEB-INF/template/footer.jsp"%>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement