Guest User

Untitled

a guest
Dec 12th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.41 KB | None | 0 0
  1. JSP:
  2. <%@ include file="/WEB-INF/template/include.jsp" %>
  3. <%@ include file="/WEB-INF/template/header.jsp" %>
  4. <%@ include file="localHeader.jsp" %>
  5. <openmrs:htmlInclude file="/scripts/timepicker/timepicker.js" />
  6. <openmrs:htmlInclude file="/moduleResources/appointment/createAppointmentStyle.css"/>
  7. <openmrs:htmlInclude file="/scripts/jquery/jsTree/jquery.tree.min.js" />
  8. <openmrs:htmlInclude file="/scripts/jquery/jsTree/themes/classic/style.css" />
  9. <openmrs:htmlInclude file="/scripts/jquery/dataTables/css/dataTables.css" />
  10. <openmrs:htmlInclude file="/scripts/jquery/dataTables/js/jquery.dataTables.min.js" />
  11. <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
  12.  
  13. <script type="text/javascript" src='${pageContext.request.contextPath}/dwr/engine.js'></script>
  14. <script type="text/javascript" src='${pageContext.request.contextPath}/dwr/util.js'></script>
  15. <script type="text/javascript" src='${pageContext.request.contextPath}/dwr/interface/DWRAppointmentService.js'></script>
  16. <script type="text/javascript">
  17. function updateAppointmentBlockTable()
  18. {
  19. var selectedDate = document.getElementById('dateFilter').value;
  20. var selectedLocation = document.getElementById("locationId");
  21. var locationId = selectedLocation.options[selectedLocation.selectedIndex].value;
  22. var fromDate = null;
  23. var toDate = null;
  24.  
  25. var tableContent = '';
  26. if(selectedDate != "")
  27. {
  28. fromDate = new Date(selectedDate);
  29. toDate = new Date(fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate()+1);
  30. }
  31. document.getElementById('appointmentBlocksTable').innerHTML = tableContent;
  32. tableContent="<tr>";
  33. tableContent+='<th align="center"><spring:message code="appointment.AppointmentBlock.column.select"/></th>';
  34. tableContent+='<th align="center"> <spring:message code="appointment.AppointmentBlock.column.location"/> </th>';
  35. tableContent+='<th align="center"> <spring:message code="appointment.AppointmentBlock.column.user"/> </th>';
  36. tableContent+='<th align="center"> <spring:message code="appointment.AppointmentBlock.column.appointmentTypes"/> </th>';
  37. tableContent+='<th align="center"> <spring:message code="appointment.AppointmentBlock.column.startTime"/> </th>';
  38. tableContent+='<th align="center"> <spring:message code="appointment.AppointmentBlock.column.endTime"/> </th>';
  39. tableContent+="</tr>";
  40. document.getElementById('appointmentBlocksTable').innerHTML +=tableContent;
  41. DWRAppointmentService.getAppointmentBlocks(fromDate,toDate,locationId,function(appointmentBlocks){
  42. tableContent = '';
  43. for(var i=0;i<appointmentBlocks.length;i++)
  44. {
  45. tableContent += "<tr>";
  46. tableContent += '<td align="center">'+'<input type="radio" name="appointmentBlockCheckBox" value="'+appointmentBlocks[i].id+'"/></td>';
  47. tableContent += '<td align="center">'+appointmentBlocks[i].location+"</td>";
  48. tableContent += '<td align="center">'+appointmentBlocks[i].providor+"</td>";
  49. tableContent += '<td align="center">'+appointmentBlocks[i].types+"</td>";
  50. tableContent += '<td align="center">'+appointmentBlocks[i].startDate+'</td>';
  51. tableContent += '<td align="center">'+appointmentBlocks[i].endDate+'</td>';
  52. tableContent += "</tr>";
  53. }
  54. document.getElementById('appointmentBlocksTable').innerHTML +=tableContent;
  55. });
  56.  
  57. }
  58.  
  59. //Showing the jQuery data table when the page loaded.
  60. $j(document).ready(function() {
  61. updateAppointmentBlockTable();
  62. });
  63.  
  64. </script>
  65. <h2><spring:message code="appointment.AppointmentBlock.manage.title"/></h2>
  66. <br/><br/>
  67.  
  68. <fieldset style="clear: both">
  69. <legend><spring:message code="appointment.AppointmentBlock.legend.properties"/></legend>
  70. <div style="margin: 0.5em 0;">
  71. <table>
  72. <tr>
  73. <td><spring:message code="appointment.AppointmentBlock.pickDate"/>: </td>
  74. <td><input type="text" name="Date" id="dateFilter" size="16" value="" onfocus="showDateTimePicker(this)"/><img src="${pageContext.request.contextPath}/moduleResources/appointment/calendarIcon.png" class="calendarIcon" alt="" onClick="document.getElementById('dateFilter').focus();"/></td>
  75. </tr>
  76. <tr>
  77. <td><spring:message code="appointment.AppointmentBlock.column.location"/>: </td>
  78. <td><openmrs:fieldGen type="org.openmrs.Location" formFieldName="locationId" val="${selectedLocation}" /></td>
  79. </tr>
  80. <tr>
  81. <td><input type="button" value="Apply" onClick="updateAppointmentBlockTable()"></td>
  82. </tr>
  83. </table>
  84. </div>
  85. </fieldset>
  86.  
  87. <br/>
  88. <b class="boxHeader"><spring:message code="appointment.AppointmentBlock.list.title"/></b>
  89. <form method="post" class="box">
  90. <table id="appointmentBlocksTable">
  91.  
  92.  
  93. </table>
  94. </form>
  95. <table align="center">
  96. <tr><td><a href="appointmentBlockForm.form"><spring:message code="appointment.AppointmentBlock.add"/></a></td>
  97. <td><a href="appointmentBlockForm.form"><spring:message code="appointment.AppointmentBlock.edit"/></a></td>
  98. <td><a href="appointmentBlockForm.form"><spring:message code="appointment.AppointmentBlock.delete"/></a></td>
  99. </tr>
  100. </table>
  101.  
  102.  
  103.  
  104. <%@ include file="/WEB-INF/template/footer.jsp" %>
Advertisement
Add Comment
Please, Sign In to add comment