<%@ include file="/common/taglibs.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<head>
    <title><fmt:message key="title.admin.license"/></title>
    <meta name="menu" content="admin"/>
	<meta name="current_user_id" content="${currentUser.id}"/>
</head>

<div class="fullContent">
	<div class="Pane" id="admin-application-pane">
		<div class="content-pane some-pane TabPanel">
		    <div class="Tabs">
		        <ul class="">
		        	<li><a href="/admin/users/">Users</a></li>
					<li class="current"><a href="/admin/license/">License</a></li>
		        </ul>
			</div>
			<div class="Pane working-pane">
				<div class="scroll-pane ">
				
					<s:form method="post" action="license" enctype="multipart/form-data"> 
					<div class="Pane">
					<s:if test="hasActionErrors()">
					    <div class="feedback error">
					        <ul>
					            <s:iterator value="actionErrors">
					                <li><s:property/></li>
					            </s:iterator>
					        </ul>
					    </div>
					</s:if>
					<%-- Success Messages --%>
					<c:if test="${not empty messages}">
					    <div class="feedback notification">
					        <ul>
					            <c:forEach var="msg" items="${messages}">
					                <li><c:out value="${msg}" escapeXml="false"/></li>
					            </c:forEach>
					        </ul>
					    </div>
					    <c:remove var="messages" scope="session"/>
					</c:if>
						<div>
						    <span class="Field "><s:file name="license" cssClass="text file" theme="xhtml" key="label.setup.license"/></span>
						</div>
					</div>

						<div class="Actions">
					    <ul id="submit">
					        <li>
					            <s:submit key="action.license"/>
					        </li>
					    </ul>
						</div>
					</s:form>
				</div>
			</div>
		</div>

		<div class="actions-pane some-pane ">
			<div class="working-pane ">
				<div class="scroll-pane ">
					<h2><fmt:message key="heading.license.current"/></h2>
					<p>Licensed to : ${currentLicense.licensedTo}</p>
				    <div>
				    	<c:choose>
				    		<c:when test="${currentLicense != null}">
					    		<c:choose>
						        	<c:when test="${currentLicense.users == 999999}">
						        		<p>Enterprise license</p>
						        		<p>Licensed for Unlimited Users</p>
						        	</c:when>
						        	<c:otherwise>
						        		<p>Commercial license</p>
						        		<p>Licensed for ${currentLicense.users} Named Users</p>
						        	</c:otherwise>
						        </c:choose>
						    </c:when>
						    <c:otherwise>
						    	<p>Trial license</p>
						    	<p>Licensed for 1 User and 10 Contacts</p>
						    </c:otherwise>
						</c:choose>
				    </div>
				</div>
			</div>
		</div>
	</div>
</div>