

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Edit Contact</title>
    </head>
    <body>
        <div class="nav">
            <h1>Edit Contact</h1>
        </div>
        <div class="body">
            <g:render template="/shared/messages" />
            <g:hasErrors bean="${contactInstance}">
            <div class="errors">
                <g:renderErrors bean="${contactInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${contactInstance?.id}" />
                <input type="hidden" name="version" value="${contactInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>

                            <g:if test="${contactInstance.supplier}">
                                <g:hiddenField name="supplier.id" value="${contactInstance.supplier.id}"/>
                                <tr class="prop">
                                    <td valign="top" class="name">
                                        <label for="supplier">Supplier:</label>
                                    </td>
                                    <td valign="top" class="value ${hasErrors(bean:contactInstance,field:'supplier','errors')}">
                                        <g:link controller="supplierDetailed" action="show" id="${contactInstance.supplier.id}">
                                            ${contactInstance.supplier.encodeAsHTML()}
                                        </g:link>
                                    </td>
                                </tr>
                            </g:if>

                            <g:if test="${contactInstance.person}">
                                <g:hiddenField name="person.id" value="${contactInstance.person.id}"/>
                                <tr class="prop">
                                    <td valign="top" class="name">
                                        <label for="person">Person:</label>
                                    </td>
                                    <td valign="top" class="value">
                                        <g:link controller="person" action="show" id="${contactInstance.person.id}">
                                            ${contactInstance.person.encodeAsHTML()}
                                        </g:link>
                                    </td>
                                </tr>
                            </g:if>

                            <g:if test="${contactInstance.site}">
                                <g:hiddenField name="site.id" value="${contactInstance.site.id}"/>
                                <tr class="prop">
                                    <td valign="top" class="name">
                                        <label for="site">Site:</label>
                                    </td>
                                    <td valign="top" class="value">
                                        <g:link controller="siteDetailed" action="show" id="${contactInstance.site.id}">
                                            ${contactInstance.site.encodeAsHTML()}
                                        </g:link>
                                    </td>
                                </tr>
                            </g:if>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="contactType">Contact Type:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:contactInstance,field:'contactType','errors')}">
                                    <g:select optionKey="id" from="${ContactType.list()}" name="contactType.id" value="${contactInstance?.contactType?.id}" ></g:select>
                                </td>
                            </tr> 

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="email">Value:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:contactInstance,field:'value','errors')}">
                                    <input type="text" id="value" name="value" value="${fieldValue(bean:contactInstance,field:'value')}"/>
                                </td>
                            </tr>

                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="Update" /></span>
                    <span class="button"><g:actionSubmit class="cancel" value="Cancel" action="Show"/></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
