<%--
    Document   : editCompound
    Created on : Jul 11, 2013, 12:52:54 PM
    Author     : Joos Kiener <Joos.Kiener@gmail.com>
--%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<jsp:include page="/WEB-INF/jsp/header.jsp"/>
<script type="text/javascript">
$(function() {
    $("#delete").submit(function() {
        var answer = confirm("Are you sure you want to delete this compound?")
	if (answer){
            return true;
	}
	else{
            return false;
	}
    });
});
</script>
<div id="combinedStructure">
    <img src="<c:url value="/compound/${compound.getId()}/render?width=500&height=300"/>"/>
</div>
<form:form commandName="compound" class="cssform" method="post">
    <div>
        <label>Compound Name</label>
        <form:input path="compoundName" />
    </div>
    <div>
        <label>CAS</label>
        <form:input path="cas" />
    </div>
    <div>
        <label>Description</label>
        <form:input path="compoundDescription" />
    </div>
    <form:input path="id" hidden="true"/>
    <form:input path="version" hidden="true"/>
    <div class="buttons"><input id="saveButton" class="save" type="submit" value="Save Changes"/></div>
</form:form>
<form id="delete" class="cssform" method="post" action="delete">
    <div class="buttons"><input id="deleteButton" class="delete" type="submit" value="Delete Compound"/></div>
</form>
<jsp:include page="/WEB-INF/jsp/footer.jsp"/>