source: trunk/grails-app/views/inventoryItemPurchaseDetailed/search.gsp @ 615

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

Fix NPE during pagination after setSearchParamsMax in search views.

File size: 14.1 KB
Line 
1<html>
2    <head>
3        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4        <meta name="layout" content="main" />
5        <title>Inventory Item Purchase Search</title>
6        <filterpane:includes />
7        <nav:resources override="true"/>
8        <export:resource />
9    </head>
10    <body>
11        <div class="nav">
12            <nav:renderSubItems group="navAlt"/>
13        </div>
14
15        <div class="body">
16            <g:render template="/shared/messages" />
17            <filterpane:currentCriteria domainBean="InventoryItemPurchase"
18                                    action="search"
19                                    dateFormat="EEE, dd-MMM-yyyy"
20                                    removeImgDir="images"
21                                    removeImgFile="bullet_delete.png"
22                                    title="Advanced Search"/>
23
24            <div class="paginateButtons">
25                <span class="searchButtons">
26                    <a href='' onclick="showElement('searchPane'); return false;">Quick</a>
27                </span>
28                Results: ${inventoryItemPurchaseList.size()} / ${inventoryItemPurchaseTotal}
29                <span class="searchButtons">
30                    <filterpane:filterButton text="Advanced" appliedText="Advanced" />
31                </span>
32            </div>
33
34            <jsUtil:toggleControl toggleId="options"
35                                                    imageId="optionsImg"
36                                                    closedImgUrl="${resource(dir:'images/skin',file:'bullet_arrow_right.png')}"
37                                                    openImgUrl="${resource(dir:'images/skin',file:'bullet_arrow_down.png')}"
38                                                    text="${g.message(code: 'default.options.text')}"
39                                                    />
40
41            <div id="options" style="display:none;">
42                <g:form method="post" action="setSearchParamsMax" >
43                    <g:hiddenField name="params" value="${filterParams}" />
44                    <div class="dialog">
45                        <table>
46                            <tbody>
47
48                                <tr class="prop">
49                                    <td valign="top" class="name">
50                                        <label for="max">Results per page:</label>
51                                    </td>
52                                    <td valign="top" class="value">
53                                        <input type="text" maxlength="4" id="description" name="newMax" value="${params.max}"/>
54
55                                        <span class="buttons">
56                                            <g:actionSubmit action="setSearchParamsMax" class="go" value="Update" />
57                                        </span>
58                                    </td>
59                                </tr>
60
61                            </tbody>
62                        </table>
63                    </div>
64                <export:formats  params="${filterParams}" formats="['csv', 'excel', 'pdf', 'rtf']"/>
65                </g:form>
66            </div>
67
68            <br />
69
70            <g:if test="${inventoryItemPurchaseList.size() > 10}">
71                <g:if test="${inventoryItemPurchaseTotal > inventoryItemPurchaseList.size()}">
72                    <div class="paginateButtons">
73                        <g:paginate action="search" total="${inventoryItemPurchaseTotal}" params="${filterParams}" />
74                    </div>
75                </g:if>
76            </g:if>
77
78            <g:if test="${inventoryItemPurchaseList.size() > 0}">
79                <div class="list">
80                    <table>
81                        <thead>
82                            <tr>
83                                <g:sortableColumn property="purchaseOrderNumber"
84                                                                    title="Order #" params="${filterParams}"  />
85                                <g:sortableColumn property="date"
86                                                                    title="Date" params="${filterParams}" />
87                                <g:sortableColumn property="costCode"
88                                                                    title="Cost Code" params="${filterParams}" />
89                                <g:sortableColumn property="quantity"
90                                                                    title="Quantity" params="${filterParams}" />
91                                <g:sortableColumn property="orderValueAmount"
92                                                                    title="Order \$" params="${filterParams}" />
93                                <g:sortableColumn property="invoiceNumber"
94                                                                    title="Invoice Number" params="${filterParams}" />
95                                <g:sortableColumn property="inventoryItemPurchaseType"
96                                                                    title="Type" params="${filterParams}" />
97                                <th>
98                                    <img  src="${resource(dir:'images/skin',file:'database_go_grey.png')}" alt="Show" title="Show" />
99                                </th>
100                                <th>
101                                    <img  src="${resource(dir:'images/skin',file:'basket_put_grey.png')}" alt="Receive" title="Receive" />
102                                </th>
103                                <th>
104                                    <img  src="${resource(dir:'images/skin',file:'tick_grey.png')}" alt="Approve" title="Approve Payment" />
105                                </th>
106                            </tr>
107                        </thead>
108                        <tbody>
109                            <g:each in="${inventoryItemPurchaseList}" status="i" var="purchase">
110                                <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}"/>
111
112                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
113                                        ${fieldValue(bean:purchase, field:'purchaseOrderNumber')}
114                                    </td>
115                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
116                                        <g:formatDate date="${purchase.date}" format="EEE, dd-MMM-yyyy"/>
117                                    </td>
118                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
119                                        ${fieldValue(bean:purchase, field:'costCode')}
120                                    </td>
121                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
122                                        ${fieldValue(bean:purchase, field:'quantity')}
123                                    </td>
124                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
125                                        ${fieldValue(bean:purchase, field:'orderValueAmount')}
126                                        ${fieldValue(bean:purchase, field:'orderValueCurrency')}
127                                    </td>
128                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
129                                        ${fieldValue(bean:purchase, field:'invoiceNumber')}
130                                    </td>
131                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
132                                        ${fieldValue(bean:purchase, field:'inventoryItemPurchaseType')}
133                                    </td>
134                                    <td class="notClickable">
135                                        <g:link controller="inventoryItemPurchaseDetailed" action="show" params="[id: purchase.id, returnTo: 'search']">
136                                            <img  src="${resource(dir:'images/skin',file:'database_go.png')}" alt="Show" title="Show" />
137                                        </g:link>
138                                    </td>
139
140                                    <g:if test="${purchase.inventoryItemPurchaseType.id == 1}">
141                                        <g:if test="${!purchase.receivedComplete}">
142                                            <td class="notClickable">
143                                                <g:link controller="inventoryItemPurchaseDetailed" action="receive" params="[id: purchase.id, returnTo: 'search']">
144                                                    <img  src="${resource(dir:'images/skin',file:'basket_put.png')}" alt="Receive" title="Receive" />
145                                                </g:link>
146                                            </td>
147                                            <td class="notClickable">
148                                            </td>
149                                        </g:if>
150                                        <g:else>
151                                            <td class="notClickable">
152                                            </td>
153                                            <td class="notClickable">
154                                            </td>
155                                        </g:else>
156                                    </g:if>
157                                    <g:elseif test="${(purchase.inventoryItemPurchaseType.id == 2)||(purchase.inventoryItemPurchaseType.id == 3)}">
158                                        <g:if test="${!purchase.invoicePaymentApproved}">
159                                            <td class="notClickable">
160                                            </td>
161                                            <td class="notClickable">
162                                                <g:link controller="inventoryItemPurchaseDetailed" action="approveInvoicePayment" params="[id: purchase.id, returnTo: 'search']">
163                                                    <img  src="${resource(dir:'images/skin',file:'tick.png')}" alt="Approve" title="Approve Payment" />
164                                                </g:link>
165                                            </td>
166                                        </g:if>
167                                        <g:else>
168                                            <td class="notClickable">
169                                            </td>
170                                            <td class="notClickable">
171                                            </td>
172                                        </g:else>
173                                    </g:elseif>
174                                    <g:else>
175                                        <td class="notClickable">
176                                        </td>
177                                        <td class="notClickable">
178                                        </td>
179                                    </g:else>
180
181                                </tr>
182                            </g:each>
183                        </tbody>
184                    </table>
185                </div>
186            </g:if>
187            <div class="paginateButtons">
188                <g:paginate action="search" total="${inventoryItemPurchaseTotal}" params="${filterParams}" />
189            </div>
190
191            <filterpane:filterPane domainBean="InventoryItemPurchase"
192                                    title="Advanced Search"
193                                    action="search"
194                                    class="overlayPane"
195                                    excludeProperties="orderValueCurrency, dateCreated"
196                                    associatedProperties="inventoryItemPurchaseType.name"
197                                    filterPropertyValues="${['inventoryItemPurchaseType.name':[values:InventoryItemPurchaseType.findAllByIsActive(true)],
198                                                                                date:[years: associatedPropertyValues.yearRange,precision:'day']
199                                                                                ]}"/>
200        </div> <!-- end body  -->
201
202        <!-- Start Search Pane -->
203        <div class="overlayPane" id="searchPane" style="display:none;">
204            <h2>Quick Search</h2>
205            <g:form method="post" id="searchForm" name="searchForm" >
206                <table>
207                    <tbody>
208
209                        <tr class="prop">
210                            <td valign="top" class="name">
211                                <label>Type:</label>
212                            </td>
213                            <td valign="top" class="value">
214                                <g:link controller="inventoryItemPurchaseDetailed"
215                                                action="search"
216                                                params="[quickSearch: 'searchAllOrders']">
217                                                All Orders
218                                </g:link>
219                                <br />
220                                <g:link controller="inventoryItemPurchaseDetailed"
221                                                action="search"
222                                                params="[quickSearch: 'searchAllReceived']">
223                                                All Received
224                                </g:link>
225                            </td>
226                        </tr>
227
228                    </tbody>
229                </table>
230                <div class="buttons">
231                    <span class="button">
232                        <input type="button" value="${g.message(code:'fp.tag.filterPane.button.cancel.text', default:'Cancel')}" onclick="return hideElement('searchPane');" />
233                    </span>
234                </div>
235            </g:form>
236        </div> <!-- end search pane -->
237
238    </body>
239</html>
Note: See TracBrowser for help on using the repository browser.