<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Create Breakin</title>
        <nav:resources override="true"/>
        <resource:dateChooser />
    </head>
    <body onload="document.createTaskForm.description.focus();">
        <div class="nav">
            <nav:renderSubItems group="nav"/>
        </div>
        <div class="body">
            <g:render template="/shared/messages" />
            <g:hasErrors bean="${taskInstance}">
            <div class="errors">
                <g:renderErrors bean="${taskInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:hasErrors bean="${entryFaultInstance}">
            <div class="errors">
                <g:renderErrors bean="${entryFaultInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:hasErrors bean="${entryWorkDoneInstance}">
            <div class="errors">
                <g:renderErrors bean="${entryWorkDoneInstance}" as="list" />
            </div>
            </g:hasErrors>

            <g:form action="saveBreakin" method="post" name="createTaskForm">
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description">Breakin Description:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'description','errors')}">
                                    <input type="text"  class="description" maxlength="75" id="description" name="description" value="${fieldValue(bean:taskInstance,field:'description')}"/>
                                    <g:helpBalloon class="helpballoon" code="task.description" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="comment">${entryFaultInstance?.entryType.encodeAsHTML()}:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:entryFaultInstance,field:'comment','errors')}">
                                    <textarea rows="5" cols="40" name="entryFault.comment">${fieldValue(bean:entryFaultInstance, field:'comment')}</textarea>
                                        <g:helpBalloon code="entry.comment.fault" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="durationHour">Fault Duration:</label>
                                </td>

                                <td valign="top" class="value">
                                    <input class="time ${hasErrors(bean:entryFaultInstance,field:'durationHour','errors')}"
                                        type="text" id="entryFault.durationHour" name="entryFault.durationHour"
                                        value="${fieldValue(bean:entryFaultInstance,field:'durationHour')}" />
                                    :
                                    <input class="time ${hasErrors(bean:entryFaultInstance,field:'durationMinute','errors')}"
                                        type="text" id="entryFault.durationMinute" name="entryFault.durationMinute" 
                                        value="${fieldValue(bean:entryFaultInstance,field:'durationMinute')}" />
                                    <g:helpBalloon code="entry.duration" />
                                </td> 
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="comment">${entryWorkDoneInstance?.entryType.encodeAsHTML()}:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:entryWorkDoneInstance,field:'comment','errors')}">
                                    <textarea rows="5" cols="40" name="entryWorkDone.comment">${fieldValue(bean:entryWorkDoneInstance, field:'comment')}</textarea>
                                        <g:helpBalloon code="entry.comment.work.done" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="durationHour">Work Duration:</label>
                                </td>

                                <td valign="top" class="value">
                                    <input class="time ${hasErrors(bean:entryWorkDoneInstance,field:'durationHour','errors')}"
                                        type="text" id="entryWorkDone.durationHour" name="entryWorkDone.durationHour"
                                        value="${fieldValue(bean:entryWorkDoneInstance,field:'durationHour')}" />
                                    :
                                    <input class="time ${hasErrors(bean:entryWorkDoneInstance,field:'durationMinute','errors')}"
                                        type="text" id="entryWorkDone.durationMinute" name="entryWorkDone.durationMinute" 
                                        value="${fieldValue(bean:entryWorkDoneInstance,field:'durationMinute')}" />
                                    <g:helpBalloon code="entry.duration" />
                                </td> 
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="primaryAsset">Primary Asset:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'primaryAsset','errors')}">
                                    <g:select optionKey="id" from="${Asset.list()}" name="primaryAsset.id" value="${taskInstance?.primaryAsset?.id}" noSelection="['null':'--None--']"></g:select>
                                    <g:helpBalloon code="task.primaryAsset" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="associatedAssets">Associated Assets:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'associatedAssets','errors')}">
                                    <g:select id="associatedAssets" name="associatedAssets"
                                                    from="${Asset.list()}"
                                                    size="5" multiple="yes" optionKey="id"
                                                    value="${taskInstance?.associatedAssets?.id}"  noSelection="['':'--None--']"/>
                                    <g:helpBalloon code="task.associatedAssets" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="Create" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
