Changeset 435 for trunk/grails-app
- Timestamp:
- Mar 8, 2010, 10:58:13 AM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryItemDetailedController.groovy
r425 r435 240 240 if(!result.error) { 241 241 def possibleAlternateItems = inventoryItemService.getPossibleAlternateItems(result.inventoryItemInstance) 242 return [ inventoryItemInstance : result.inventoryItemInstance, possibleAlternateItems: possibleAlternateItems] 242 def suppliers = Supplier.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 243 def manufacturers = Manufacturer.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 244 245 return [ inventoryItemInstance : result.inventoryItemInstance, 246 possibleAlternateItems: possibleAlternateItems, 247 suppliers: suppliers, 248 manufacturers: manufacturers] 243 249 } 244 250 … … 263 269 264 270 def possibleAlternateItems = inventoryItemService.getPossibleAlternateItems(result.inventoryItemInstance) 265 render(view:'edit', model:[inventoryItemInstance: result.inventoryItemInstance.attach(), possibleAlternateItems: possibleAlternateItems]) 271 def suppliers = Supplier.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 272 def manufacturers = Manufacturer.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 273 render(view:'edit', model:[inventoryItemInstance: result.inventoryItemInstance.attach(), 274 possibleAlternateItems: possibleAlternateItems, 275 suppliers: suppliers, 276 manufacturers: manufacturers]) 266 277 } 267 278 268 279 def create = { 269 280 def result = inventoryItemService.create(params) 281 def suppliers = Supplier.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 282 def manufacturers = Manufacturer.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 270 283 271 284 if(!result.error) 272 return [inventoryItemInstance: result.inventoryItemInstance] 285 return [inventoryItemInstance: result.inventoryItemInstance, 286 suppliers: suppliers, 287 manufacturers: manufacturers] 273 288 274 289 //flash.errorMessage = g.message(code: result.error.code, args: result.error.args) … … 285 300 } 286 301 302 def suppliers = Supplier.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 303 def manufacturers = Manufacturer.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 304 287 305 //flash.errorMessage = g.message(code: result.error.code, args: result.error.args) 288 render(view:'create', model:[inventoryItemInstance: result.inventoryItemInstance]) 306 render(view:'create', model:[inventoryItemInstance: result.inventoryItemInstance, 307 suppliers: suppliers, 308 manufacturers: manufacturers]) 289 309 } 290 310 -
trunk/grails-app/domain/InventoryItem.groovy
r425 r435 6 6 Period averageDeliveryPeriod 7 7 Picture picture 8 Supplier preferredSupplier 9 Manufacturer preferredManufacturer 8 10 String name 9 11 String description = "" … … 28 30 spareFor: Asset, 29 31 inventoryMovements: InventoryMovement, 30 manufacturers: Manufacturer,31 suppliers: Supplier]32 alternateManufacturers: Manufacturer, 33 alternateSuppliers: Supplier] 32 34 33 35 // static belongsTo = [] … … 51 53 manufacturersPartNumber(blank:true, nullable:true) 52 54 suppliersPartNumber(blank:true, nullable:true) 55 preferredSupplier(nullable:true) 56 preferredManufacturer(nullable:true) 53 57 averageDeliveryTime(nullable:true) 54 58 averageDeliveryPeriod(nullable:true) -
trunk/grails-app/views/inventoryItemDetailed/create.gsp
r422 r435 147 147 <tr class="prop"> 148 148 <td valign="top" class="name"> 149 <label for="suppliers">Suppliers:</label> 150 </td> 151 <td valign="top" class="value ${hasErrors(bean:inventoryItemInstance,field:'suppliers','errors')}"> 152 <g:select id="suppliers" name="suppliers" 153 from="${ Supplier.list().sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }" 149 <label for="preferredSupplier">Preferred Supplier:</label> 150 </td> 151 <td valign="top"> 152 <g:select optionKey="id" from="${suppliers}" name="preferredSupplier.id" value="${inventoryItemInstance.preferredSupplier?.id}" noSelection="['null':'--None--']"></g:select> 153 154 <p><g:link controller="supplierDetailed" action="create">+Add Supplier</g:link></p> 155 </td> 156 </tr> 157 158 <tr class="prop"> 159 <td valign="top" class="name"> 160 <label for="alternateSuppliers">Alternate Suppliers:</label> 161 </td> 162 <td valign="top" class="value ${hasErrors(bean:inventoryItemInstance,field:'alternateSuppliers','errors')}"> 163 <g:select id="alternateSuppliers" name="alternateSuppliers" 164 from="${suppliers}" 154 165 size="5" multiple="yes" optionKey="id" 155 value="${inventoryItemInstance?.suppliers?.id}" noSelection="['':'--None--']"/> 156 157 <p><g:link controller="supplierDetailed" action="create">+Add Supplier</g:link></p> 166 value="${inventoryItemInstance.alternateSuppliers?.id}" noSelection="['':'--None--']"/> 158 167 </td> 159 168 </tr> … … 170 179 <tr class="prop"> 171 180 <td valign="top" class="name"> 172 <label for="manufacturers">Manufacturers:</label> 173 </td> 174 <td valign="top" class="value ${hasErrors(bean:inventoryItemInstance,field:'manufacturers','errors')}"> 175 <g:select id="manufacturers" name="manufacturers" 176 from="${ Manufacturer.list().sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }" 181 <label for="preferredManufacturer">Preferred Manufacturer:</label> 182 </td> 183 <td valign="top"> 184 <g:select optionKey="id" from="${manufacturers}" name="preferredManufacturer.id" value="${inventoryItemInstance?.preferredManufacturer?.id}" noSelection="['null':'--None--']"></g:select> 185 186 <p><g:link controller="manufacturerDetailed" action="create">+Add Manufacturer</g:link></p> 187 </td> 188 </tr> 189 190 <tr class="prop"> 191 <td valign="top" class="name"> 192 <label for="manufacturers">Alternate Manufacturers:</label> 193 </td> 194 <td valign="top" class="value ${hasErrors(bean:inventoryItemInstance,field:'alternateManufacturers','errors')}"> 195 <g:select id="alternateManufacturers" name="alternateManufacturers" 196 from="${manufacturers}" 177 197 size="5" multiple="yes" optionKey="id" 178 value="${inventoryItemInstance?.manufacturers?.id}" noSelection="['':'--None--']" /> 179 180 <p><g:link controller="manufacturerDetailed" action="create">+Add Manufacturer</g:link></p> 198 value="${inventoryItemInstance.alternateManufacturers?.id}" noSelection="['':'--None--']" /> 181 199 </td> 182 200 </tr> -
trunk/grails-app/views/inventoryItemDetailed/edit.gsp
r425 r435 184 184 <tr class="prop"> 185 185 <td valign="top" class="name"> 186 <label for="suppliers">Suppliers:</label> 187 </td> 188 <td valign="top" class="value ${hasErrors(bean:inventoryItemInstance,field:'suppliers','errors')}"> 189 <g:select id="suppliers" name="suppliers" 190 from="${ Supplier.list().sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }" 191 size="5" multiple="yes" optionKey="id" 192 value="${inventoryItemInstance?.suppliers.id}" noSelection="['':'--None--']"/> 193 194 <p><g:link controller="supplierDetailed" action="create">+Add Supplier</g:link></p> 186 <label for="preferredSupplier">Preferred Supplier:</label> 187 </td> 188 <td valign="top"> 189 <g:select optionKey="id" from="${suppliers}" name="preferredSupplier.id" value="${inventoryItemInstance.preferredSupplier?.id}" noSelection="['null':'--None--']"></g:select> 190 191 <p><g:link controller="supplierDetailed" action="create">+Add Supplier</g:link></p> 192 </td> 193 </tr> 194 195 <tr class="prop"> 196 <td valign="top" class="name"> 197 <label for="alternateSuppliers">Alternate Suppliers:</label> 198 </td> 199 <td valign="top" class="value ${hasErrors(bean:inventoryItemInstance,field:'alternateSuppliers','errors')}"> 200 <g:select id="alternateSuppliers" name="alternateSuppliers" 201 from="${suppliers}" 202 size="5" multiple="yes" optionKey="id" 203 value="${inventoryItemInstance.alternateSuppliers?.id}" noSelection="['':'--None--']"/> 195 204 </td> 196 205 </tr> … … 207 216 <tr class="prop"> 208 217 <td valign="top" class="name"> 209 <label for="manufacturers">Manufacturers:</label> 210 </td> 211 <td valign="top" class="value ${hasErrors(bean:inventoryItemInstance,field:'manufacturers','errors')}"> 212 <g:select id="manufacturers" name="manufacturers" 213 from="${ Manufacturer.list().sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }" 214 size="5" multiple="yes" optionKey="id" 215 value="${inventoryItemInstance?.manufacturers.id}" noSelection="['':'--None--']"/> 218 <label for="preferredManufacturer">Preferred Manufacturer:</label> 219 </td> 220 <td valign="top"> 221 <g:select optionKey="id" from="${manufacturers}" name="preferredManufacturer.id" value="${inventoryItemInstance.preferredManufacturer?.id}" noSelection="['null':'--None--']"></g:select> 216 222 217 223 <p><g:link controller="manufacturerDetailed" action="create">+Add Manufacturer</g:link></p> 224 </td> 225 </tr> 226 227 <tr class="prop"> 228 <td valign="top" class="name"> 229 <label for="manufacturers">Alternate Manufacturers:</label> 230 </td> 231 <td valign="top" class="value ${hasErrors(bean:inventoryItemInstance,field:'alternateManufacturers','errors')}"> 232 <g:select id="alternateManufacturers" name="alternateManufacturers" 233 from="${manufacturers}" 234 size="5" multiple="yes" optionKey="id" 235 value="${inventoryItemInstance.alternateManufacturers?.id}" noSelection="['':'--None--']" /> 218 236 </td> 219 237 </tr> -
trunk/grails-app/views/inventoryItemDetailed/search.gsp
r423 r435 166 166 action="search" 167 167 class="overlayPane" 168 excludeProperties="" 168 excludeProperties="estimatedUnitPriceCurrency, 169 averageDeliveryTime" 169 170 associatedProperties="inventoryLocation.name, 170 171 spareFor.name, 171 manufacturers.name,172 suppliers.name"172 preferredManufacturer.name, 173 preferredSupplier.name" 173 174 filterPropertyValues="${['inventoryLocation.name':[values:InventoryLocation.list()], 174 175 'spareFor.name':[values:Asset.list()], 175 ' manufacturers.name':[values:Manufacturer.list()],176 ' suppliers.name':[values:Supplier.list()],176 'preferredManufacturer.name':[values:Manufacturer.findAllByIsActive(true)], 177 'preferredSupplier.name':[values:Supplier.findAllByIsActive(true)], 177 178 ]}"/> 178 179 </div> <!-- end body div --> -
trunk/grails-app/views/inventoryItemDetailed/show.gsp
r425 r435 243 243 244 244 <tr class="prop"> 245 <td valign="top" class="name">Suppliers:</td> 245 <td valign="top" class="name">Preferred Supplier:</td> 246 247 <td valign="top" style="text-align:left;" class="value"> 248 <g:link controller="supplierDetailed" action="show" id="${inventoryItemInstance.preferredSupplier?.id}"> 249 ${inventoryItemInstance.preferredSupplier?.encodeAsHTML()} 250 </g:link> 251 </td> 252 </tr> 253 254 <tr class="prop"> 255 <td valign="top" class="name">Alternate Suppliers:</td> 246 256 247 257 <td valign="top" style="text-align:left;" class="value"> 248 258 <ul> 249 <g:each var="s" in="${ inventoryItemInstance. suppliers.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">259 <g:each var="s" in="${ inventoryItemInstance.alternateSuppliers.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }"> 250 260 <li><g:link controller="supplierDetailed" action="show" id="${s.id}">${s?.encodeAsHTML()}</g:link></li> 251 261 </g:each> … … 268 278 269 279 <tr class="prop"> 270 <td valign="top" class="name">Manufacturers:</td> 280 <td valign="top" class="name">Preferred Manufacturer:</td> 281 282 <td valign="top" style="text-align:left;" class="value"> 283 <g:link controller="manufacturerDetailed" action="show" id="${inventoryItemInstance.preferredManufacturer?.id}"> 284 ${inventoryItemInstance.preferredManufacturer?.encodeAsHTML()} 285 </g:link> 286 </td> 287 </tr> 288 289 <tr class="prop"> 290 <td valign="top" class="name">Alternate Manufacturers:</td> 271 291 272 292 <td valign="top" style="text-align:left;" class="value"> 273 293 <ul> 274 <g:each var="m" in="${ inventoryItemInstance. manufacturers.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">294 <g:each var="m" in="${ inventoryItemInstance.alternateManufacturers.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }"> 275 295 <li><g:link controller="manufacturerDetailed" action="show" id="${m.id}">${m?.encodeAsHTML()}</g:link></li> 276 296 </g:each>
Note: See TracChangeset
for help on using the changeset viewer.