<%@ include file="/includes.jsp"%>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
    
    <script language="javascript">
		function createNewFormSequence() {
			var fsForm = document.getElementById("formSequenceList");
			fsForm.method="GET";
			fsForm.action = "../admin/formSequenceEdit.form";
			fsForm.submit();
			showPleaseWait();
		}
	</script>
    <br/>
    <br/>
    <sec:authorize access="hasRole('ADMIN')">
    <smvc:form action="../admin/formSequenceList.form" method="post" id="formSequenceList">
   	<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
	<smvc:errors />
        <table>
            <tr>
                <td class="error"><smvc:errors></smvc:errors></td>
                <c:if test="${deletionError != NULL}">
               	 	<td class="error"><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>
        <fieldset style="width: 700px" class="nobg">
            <legend>Auto Sequences</legend>
            <fieldset>
                <table >
                    <tr>
                        <td colspan="9"><B>Auto Sequences</B></td>
                    </tr>
                     <tr>
                        <td colspan="9">&#160;</td>
                    </tr>
                </table>
                <table width="100%" border = "1" bordercolor="#F8F8FF">
                    <tr>
                        <th class="label" width="10%">Id</th>
                        <th class="label" width="15%">Name</th>
                        <th class="label" width="10%">Prefix</th>
                        <th class="label" width="10%">Suffix</th>
                        <th class="label" width="10%">Increment</th>
                        <th class="label" width="15%">Current value</th>
                        <th class="label" width="15%">Format Mask</th>
                        <th class="label" width="10%">&#160;</th>
                        <th class="label" width="10%">&#160;</th>
                    </tr>
                    <c:forEach var="formSequence" items="${formSequences}">
	                    <tr>
	                    	<td width="10%" align="right"><c:out value="${formSequence.id}"/> </td>
	                        <td width="15%" align="left"><c:out value="${formSequence.name}"/></td>
	                        <td width="10%" align="left"><c:out value="${formSequence.prefix}"/></td>
	                        <td width="10%" align="left"><c:out value="${formSequence.suffix}"/></td>
	                        <td width="10%" align="right"><c:out value="${formSequence.increment}"/></td>
	                        <td width="15%" align="right"><c:out value="${formSequence.currentValue}"/></td>
	                        <td width="15%" align="right"><c:out value="${formSequence.formatMask}"/></td>
	                        <td width="10%" align="center"><a href="../admin/formSequenceEdit.form?formSequenceEditId=<c:out value="${formSequence.id}"/>">Edit</a></td>
	                        <td width="10%" align="center"><a href="../admin/formSequenceList.form?deleteId=<c:out value="${formSequence.id}"/>">Delete</a></td>
	                    </tr>
                    </c:forEach>
                </table>
            </fieldset>
            <fieldset class="buttonFieldset">
                <input type="submit" value="New" onclick="createNewFormSequence();" />
            </fieldset>
        </fieldset>        
                 

                
    </smvc:form>
</sec:authorize>