<%@ include file="/includes.jsp" %>

<link rel="stylesheet" href="../js/jquery/datatables.min.css" type="text/css" />
<script src="../js/jquery/datatables.min.js"> </script>
<sec:authorize access="hasRole('ADMIN')">
<fieldset class="nobg">
	<legend>Users</legend>
	<fieldset class="nobg">
	    
		<table id="usersTable" width="100%" class="display">
		<thead>
			<tr>
			   	<th>Username</th>
				<th>Full name</th>
				<th>Hospital</th>
				<th>Enabled</th>
				<th>Type</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="user" items="${webapp.usersDto }">
				<tr>
					<td><a href="userform.form?userId=<c:out value="${user.guid}"/>"><c:out value="${user.username }"/></a></td>
					<td><a href="userform.form?userId=<c:out value="${user.guid}"/>"><c:out value="${user.fullName}"/></a></td>
					<td><a href="userform.form?userId=<c:out value="${user.guid}"/>"><c:out value="${user.hospital.hospitalName}"/></a></td>
					<td><a href="userform.form?userId=<c:out value="${user.guid}"/>"><c:if test="${user.enabled}">Yes</c:if></a></td>
					<td><a href="userform.form?userId=<c:out value="${user.guid}"/>"><c:if test="${user.ldapUser}">Active Directory</c:if><c:if test="${not user.ldapUser}">eMDT</c:if></a></td>
				</tr>
			</c:forEach>
		</tbody>
		</table>
	</fieldset>
	<fieldset class="buttonFieldset">
		<input type="button" value="Create User" onclick="document.location='userform.form'"/>
	</fieldset>
</fieldset>

<h4>Supporting Staff Report <input type="button" value="Go" title="Go to Supporting Staff Report" onmouseover="this.style.cursor = cursorPointer; " onclick="location.href='../admin/supportingStaffReport.form'" />	</h4>
</sec:authorize>
<script>
	$(document).ready(function(){
		$('#usersTable').DataTable( {
				"pageLength": 20,
			     order: [[ 0, "asc" ]],
				stateSave: true
			
		});
	});
 </script >
