source: trunk/grails-app/views/entryDetailed/create.gsp @ 482

Last change on this file since 482 was 482, checked in by gav, 14 years ago

Refactor entry creation to provide correct error messages when trying to create a new entry on a complete task.

File size: 6.2 KB
Line 
1
2
3<html>
4    <head>
5        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
6        <meta name="layout" content="main" />
7        <title>Create Entry</title>
8        <nav:resources override="true"/>
9        <resource:dateChooser />
10    </head>
11    <body>
12        <div class="nav">
13            <h1>Create Entry</h1>
14        </div>
15        <div class="body">
16            <g:render template="/shared/messages" />
17            <g:hasErrors bean="${entryInstance}">
18            <div class="errors">
19                <g:renderErrors bean="${entryInstance}" as="list" />
20            </div>
21            </g:hasErrors>
22            <g:form action="save" method="post" >
23                <g:hiddenField name="task.id" value="${entryInstance.task.id}" />
24                <g:hiddenField name="entryType.id" value="${entryInstance.entryType.id}" />
25                <div class="dialog">
26                    <table>
27                        <tbody>
28                       
29                            <tr class="prop">
30                                <td valign="top" class="name">
31                                    <label for="task">Task:</label>
32                                </td>
33                                <td valign="top" class="name">
34                                    <g:link controller="taskDetailed" action="show" id="${entryInstance.task.id}" >
35                                        ${entryInstance?.task.encodeAsHTML()}
36                                    </g:link>
37                                </td>
38                            </tr>
39                       
40                            <tr class="prop">
41                                <td valign="top" class="name">
42                                    <label for="comment">${entryInstance?.entryType.encodeAsHTML()}:</label>
43                                </td>
44                                <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'comment','errors')}">
45                                    <textarea rows="5" cols="40" name="comment">${fieldValue(bean:entryInstance, field:'comment')}</textarea>
46                                    <g:if test="${entryInstance?.entryType?.id == 1}">
47                                        <g:helpBalloon code="entry.comment.fault" />
48                                    </g:if>
49                                    <g:elseif test="${entryInstance?.entryType?.id == 2}">
50                                        <g:helpBalloon code="entry.comment.cause" />
51                                    </g:elseif>
52                                    <g:elseif test="${entryInstance?.entryType?.id == 3}">
53                                        <g:helpBalloon code="entry.comment.work.done" />
54                                    </g:elseif>
55                                </td>
56                            </tr>
57                       
58                            <tr class="prop">
59                                <td valign="top" class="name">
60                                    <label for="dateDone">Date Done:</label>
61                                </td>
62                                <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'dateDone','errors')}">
63                                    <richui:dateChooser name="dateDone" format="dd-MM-yyyy" value="${entryInstance.dateDone}" />
64                                    <g:helpBalloon code="entry.date.done" />
65                                </td>
66                            </tr>
67
68                            <g:if test="${entryInstance?.entryType?.id == 1}">
69                                <tr class="prop">
70                                    <td valign="top" class="name">
71                                        <label for="productionReference">Production:</label>
72                                    </td>
73                                    <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}">
74                                        <g:select optionKey="id"
75                                                            from="${ProductionReference.findAllByIsActive(true)}"
76                                                            name="productionReference.id"
77                                                            value="${entryInstance.productionReference?.id}"
78                                                            noSelection="['null':'--None--']">
79                                        </g:select>
80                                        <g:helpBalloon code="entry.productionReference.fault" />
81                                    </td>
82                                </tr>
83                            </g:if>
84
85                            <g:if test="${entryInstance?.entryType?.id != 2}">
86                                <tr class="prop">
87                                    <td valign="top" class="name">
88                                        <label for="durationHour">Duration:</label>
89                                    </td>
90
91                                    <td valign="top" class="value">
92                                        <input class="time ${hasErrors(bean:entryInstance,field:'durationHour','errors')}"
93                                            type="text" id="durationHour" name="durationHour"
94                                            value="${fieldValue(bean:entryInstance,field:'durationHour')}" />
95                                        :
96                                        <input class="time ${hasErrors(bean:entryInstance,field:'durationMinute','errors')}"
97                                            type="text" id="durationMinute" name="durationMinute"
98                                            value="${fieldValue(bean:entryInstance,field:'durationMinute')}" />
99                                        <g:helpBalloon code="entry.duration" />
100                                    </td>
101                                </tr>
102                            </g:if>
103                       
104                        </tbody>
105                    </table>
106                </div>
107                <div class="buttons">
108                    <span class="button"><input class="save" type="submit" value="Create" /></span>
109                </div>
110            </g:form>
111        </div>
112    </body>
113</html>
Note: See TracBrowser for help on using the repository browser.