Changeset 453
- Timestamp:
- Mar 25, 2010, 3:37:34 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryItemDetailedController.groovy
r441 r453 232 232 flash.errorMessage = g.message(code: result.error.code, args: result.error.args) 233 233 redirect(action:search) 234 return235 234 } 236 235 … … 344 343 if(!result.error) { 345 344 flash.message = "Inventory Movement for ${result.inventoryMovementInstance.inventoryItem.name.encodeAsHTML()} created." 346 redirect(controller:"taskDetailed", action:"show", id: result.taskId) 347 } 348 else { 349 if(result.inventoryMovementInstance) { 350 def p = [:] 351 p.id = result.inventoryMovementInstance.inventoryItem?.id 352 def r = inventoryItemService.show(p) 353 354 def model = [ inventoryItemInstance: r.inventoryItemInstance, 355 inventoryMovementList: r.inventoryMovementList, 356 inventoryMovementListTotal: r.inventoryMovementListTotal, 357 inventoryMovementListMax: r.inventoryMovementListMax, 358 showTab: r.showTab] 359 360 model.inventoryMovementInstance = result.inventoryMovementInstance 361 362 render(view: 'show', model: model) 363 } 364 else { 365 flash.message = "Could not create inventory movement." 366 redirect(action:"search") 367 } 368 369 } 370 } 371 372 } 345 session.inventoryMovementTaskId = null 346 redirect(controller: "taskDetailed", 347 action: "show", 348 id: result.taskId, 349 params: [showTab: "showInventoryTab"]) 350 // Success. 351 return 352 } 353 354 // Prepare data for the show view. 355 def p = [:] 356 p.id = result.inventoryMovementInstance.inventoryItem?.id 357 def r = inventoryItemService.show(p) 358 359 // Render show view if data was successfully prepared. 360 if(!r.error) { 361 def model = [ inventoryItemInstance: r.inventoryItemInstance, 362 inventoryMovementList: r.inventoryMovementList, 363 inventoryMovementListTotal: r.inventoryMovementListTotal, 364 inventoryMovementListMax: r.inventoryMovementListMax, 365 inventoryItemPurchases: r.inventoryItemPurchases, 366 inventoryItemPurchasesTotal: r.inventoryItemPurchasesTotal, 367 showTab: r.showTab] 368 369 model.inventoryMovementInstance = result.inventoryMovementInstance // This will pass in the errors. 370 371 render(view: 'show', model: model) 372 return 373 } 374 375 // Could not prepare data for show view so doing the next best thing. 376 flash.errorMessage = g.message(code: r.error.code, args: r.error.args) 377 redirect(action:search) 378 379 } // useInventoryItem 380 381 /** 382 * Clear the use inventory item form in the show view. 383 * Accomplished by clearing the session variable and ajax. 384 */ 385 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager', 'ROLE_InventoryUser']) 386 def clearUseInventoryItem = { 387 session.inventoryMovementTaskId = null 388 render '' 389 } 390 391 } // end of class -
trunk/grails-app/services/AssetTreeService.groovy
r322 r453 19 19 } 20 20 def paneCloseHtmlClass() { 21 ' tree_pane_close'21 'pane_close' 22 22 } 23 23 def tableDivHtmlClass() { -
trunk/grails-app/views/inventoryItemDetailed/show.gsp
r441 r453 53 53 <g:if test="${inventoryMovementInstance}" > 54 54 55 <g:form controller="inventoryItemDetailed" method="post" > 56 <div class="dialog"> 57 <table> 58 <tbody> 59 <g:hiddenField name="task.id" value="${inventoryMovementInstance.task.id}"/> 60 <g:hiddenField name="inventoryItem.id" value="${inventoryItemInstance.id}"/> 61 <tr class="prop"> 62 <td valign="top" class="name">Use on task:</td> 63 <td valign="top" class="value"> 64 <g:link controller="taskDetailed" action="show" id="${inventoryMovementInstance.task.id}" > 65 ${Task.get(inventoryMovementInstance.task.id).encodeAsHTML()} 66 </g:link> 67 </td> 68 </tr> 69 70 <tr class="prop"> 71 <td valign="top" class="name"> 72 <label for="quantity">Quantity:</label> 73 </td> 74 <td valign="top"> 75 <input class="medium ${hasErrors(bean:inventoryMovementInstance,field:'quantity','errors')}" 76 type="text" id="quantity" name="quantity" 77 value="${fieldValue(bean:inventoryMovementInstance,field:'quantity')}"/> 78 ${inventoryItemInstance.unitOfMeasure?.encodeAsHTML()} 79 80 <span class="buttons"> 81 <g:actionSubmit action="useInventoryItem" class="save" value="${InventoryMovementType.get(1)}" /> 82 </span> 83 84 </td> 85 </tr> 86 87 </tbody> 88 </table> 55 <div id="useInventoryItemDiv" style="display:inline"> <!-- inline required for IE --> 56 <div class="pane_close" > 57 <g:remoteLink action="clearUseInventoryItem" update="useInventoryItemDiv"> 58 <img src="${resource(dir:'images/skin',file:'cross.png')}" alt="Clear" title="Clear"/> 59 </g:remoteLink> 89 60 </div> 90 </g:form> 91 92 <br /> 61 <g:form controller="inventoryItemDetailed" method="post" > 62 <div class="dialog"> 63 <table> 64 <tbody> 65 <g:hiddenField name="task.id" value="${inventoryMovementInstance.task.id}"/> 66 <g:hiddenField name="inventoryItem.id" value="${inventoryItemInstance.id}"/> 67 <tr class="prop"> 68 <td valign="top" class="name">Use on task:</td> 69 <td valign="top" class="value"> 70 <g:link controller="taskDetailed" action="show" id="${inventoryMovementInstance.task.id}" > 71 ${Task.get(inventoryMovementInstance.task.id).encodeAsHTML()} 72 </g:link> 73 </td> 74 </tr> 75 76 <tr class="prop"> 77 <td valign="top" class="name"> 78 <label for="quantity">Quantity:</label> 79 </td> 80 <td valign="top"> 81 <input class="medium ${hasErrors(bean:inventoryMovementInstance,field:'quantity','errors')}" 82 type="text" id="quantity" name="quantity" 83 value="${fieldValue(bean:inventoryMovementInstance,field:'quantity')}"/> 84 ${inventoryItemInstance.unitOfMeasure?.encodeAsHTML()} 85 86 <span class="buttons"> 87 <g:actionSubmit action="useInventoryItem" class="save" value="${InventoryMovementType.read(1)}" /> 88 </span> 89 90 </td> 91 </tr> 92 93 </tbody> 94 </table> 95 </div> 96 </g:form> 97 98 <br /> 99 </div> 93 100 94 101 </g:if> -
trunk/web-app/css/main.css
r452 r453 640 640 margin: 2px; 641 641 } 642 div. tree_pane_close {642 div.pane_close { 643 643 position: absolute; 644 644 right: 5px;
Note: See TracChangeset
for help on using the changeset viewer.