<%--
    Document   : importCompounds
    Created on : May 29, 2013, 7:34:01 AM
    Author     : Joos Kiener <Joos.Kiener@gmail.com>
--%>

<jsp:include page="/WEB-INF/jsp/header.jsp"/>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<h3>Import Compounds from SD-File</h3>
    <form:form modelAttribute="fileUploadForm" class="cssform" method="post" enctype="multipart/form-data">
        <div>
            <form:label for="fileData" path="fileData">SD-File</form:label><br/>
            <form:input path="fileData" type="file"/>
        </div>
        <h4>Property Mappings</h4>
        <div>
            <form:label for="compoundName" path="compoundName">Compound Name</form:label><br/>
            <form:input path="compoundName" type="text"/>
        </div>
        <div>
            <form:label for="cas" path="cas">CAS</form:label><br/>
            <form:input path="cas" type="text"/>
        </div>
        <div>
            <form:label for="description" path="description">Description</form:label><br/>
            <form:input path="description" type="text"/>
        </div>
        <div>
            <div class="buttons"><input id="uploadButton" class="submit" type="submit" value="Import Compounds"/></div>
        </div>
    </form:form>
    <c:if test="${hasError != null}">
        <div class="cssform">
            <c:if test="${hasError == false}">
                    <span>Import successful!</span>
                    <div>
                        <label>Compounds imported</label>
                        <input type="text" readonly value="${imported}"/>
                    </div>
                    <div>
                        <label>Compounds already in Database</label>
                        <input type="text" readonly value="${present}"/>
                    </div>
                    <div>
                        <label>Compounds not imported due to invalid chemistry</label>
                        <input type="text" readonly value="${chemistyError}"/>
                    </div>
            </c:if>
            <c:if test="${hasError == true}">
                <span id="error">Import failed!</span>
            </c:if>
        </div>
    </c:if>
<jsp:include page="/WEB-INF/jsp/footer.jsp"/>
