<%@ include file="/includes.jsp" %>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form" %>
    <script language="javascript">
		function createNewNrlUser() {
			var nrlForm = document.getElementById("nrlUsersList");
			nrlForm.method="GET";
			nrlForm.action = "../nrl/nrlUsersEdit.form";
			nrlForm.submit();
			showPleaseWait();
		}
		
		function deleteRecord(deleteId){
			if(confirm('Are you sure you want to delete this user?')){
				var nrlForm = document.getElementById("nrlUsersList");
				nrlForm.method="GET";
				document.getElementById('deleteId').value = deleteId;
				nrlForm.action = "../nrl/nrlUsersList.form";
				nrlForm.submit();
				showPleaseWait();
			}
		}
	</script>
    <br/>
    <br/>
    <smvc:form action="../nrl/nrlUsersList.form" method="post" id="nrlUsersList">
    <input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
    <input type="hidden" id="deleteId" name="deleteId"/>
	<smvc:errors />
        <table align="center">
            <tr>
                <td class="error" colspan="2"><smvc:errors></smvc:errors></td>
                <c:if test="${deletionError != NULL}">
               	 	<td class="error" align="center" colspan="2" ><c:out value="${deletionError}"/></td>
                </c:if>
            </tr>
        </table>
         <c:if test="${deletionSuccess != NULL}">               	 	
	        <table border="0" align="center" class="message" >
                  <tr>
                  	<td colspan="2"><c:out value="${deletionSuccess}"/></td>
                  </tr>  
		    </table>
		</c:if>
		<br/>
        <fieldset style="width: 900px" class="nobg" align="center">
            <legend>Nrl Users</legend>
            <fieldset>
                <table align="center">
                    <tr>
                        <td colspan="9"><B>Nrl Users</B></td>
                    </tr>
                     <tr>
                        <td colspan="9">&#160;</td>
                    </tr>
                </table>
                <table width="100%" border = "1" bordercolor="#F8F8FF" align="center" style="WORD-BREAK:BREAK-ALL">
                    <tr>
                        <th class="label" width="10%">Title</th>
                        <th class="label" width="15%">Last Name</th>
                        <th class="label" width="15%">First Name</th>
                        <th class="label" width="10%">UserName</th>
                        <th class="label" width="10%">Telephone</th>
                        <th class="label" width="17%">Email</th>
                        <th class="label" width="5%">&#160;</th>
                        <th class="label" width="8%">&#160;</th>
                    </tr>
                      <c:set var="resultCount" value="${fn:length(nrlUserList)}"/>
                      <c:choose>
                       <c:when test="${resultCount > 0}">
	                    <c:forEach var="nrlUser" items="${nrlUserList}">
		                    <tr>
		                    	<td width="10%" align="left"><c:out value="${nrlUser.title}"/> </td>
		                        <td width="15%" align="left"><c:out value="${nrlUser.lastname}"/></td>
		                        <td width="15%" align="left"><c:out value="${nrlUser.firstname}"/></td>
		                        <td width="10%" align="left"><c:out value="${nrlUser.mnemonic}"/></td>
		                        <td width="10%" align="left"><c:out value="${nrlUser.telephone}"/></td>
		                        <td width="17%" align="left"><c:out value="${nrlUser.email}"/></td>
		                        <td width="5%" align="center"><a href="../nrl/nrlUsersEdit.form?nrlUserEditId=<c:out value="${nrlUser.id}"/>">Edit</a></td>
		                        <td width="8%" align="center"><a href="javascript:deleteRecord('<c:out value="${nrlUser.id}"/>');">Delete</a></td>
		                    </tr>
	                    </c:forEach>
                     </c:when>
                    <c:otherwise>
                     <tr>
                            <td align="center" class="message" colspan="8" >No Record(s) Found</td>
                        </tr>
                    </c:otherwise>
                    </c:choose>
                </table>
            </fieldset>
            <fieldset class="buttonFieldset">
                <input type="submit" value="New" onclick="createNewNrlUser();" />
            </fieldset>
        </fieldset>        
                 

                
    </smvc:form>