Changeset 826


Ignore:
Timestamp:
Feb 24, 2011, 6:04:43 PM (8 years ago)
Author:
gav
Message:

AJAX PM Entry, first draft.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/EntryDetailedController.groovy

    r822 r826  
    9292    }
    9393
    94     def createMaintenanceAction = {
     94    def ajaxCreate = {
     95        if(!params.taskId || !params.entryTypeId) {
     96            flash.message = g.message(code:"entry.create.no.params")
     97            redirect(controller:"taskDetailed", action:"search")
     98            return
     99        }
    95100
    96 //         if(!params.taskInstance?.id || !params.entryType?.id) {
    97 //             flash.message = g.message(code:"entry.create.no.params")
    98 //             redirect(controller:"taskDetailed", action:"search")
    99 //             return
    100 //         }
     101        def taskInstance = Task.read(params.taskId)
    101102
    102         def taskInstance = Task.read(params.taskInstance.id)
    103         println taskInstance
    104         render "Done"
     103        if(!taskInstance) {
     104            flash.message = g.message(code:"task.notFound")
     105            redirect(controller:"taskDetailed", action:"search")
     106            return
     107        }
     108
     109        // Check for Complete task.
     110        if(taskInstance.taskStatus.id == 3) {
     111            flash.errorMessage = g.message(code:"task.operationNotPermittedOnCompleteTask")
     112            redirect(controller:"taskDetailed", action:"show", id: taskInstance.id)
     113            return
     114        }
     115
     116        def entryInstance = new Entry()
     117        entryInstance.task = taskInstance
     118        entryInstance.entryType = EntryType.read(params.entryTypeId)
     119        render(template: "create", model: ['entryInstance': entryInstance])
    105120    }
    106121
  • trunk/grails-app/services/CreateDataService.groovy

    r821 r826  
    989989        entryTypeInstance = new EntryType(name:"Work Request") // #5
    990990        saveAndTest(entryTypeInstance)
     991
     992        entryTypeInstance = new EntryType(name:"PM Entry") // #6
     993        saveAndTest(entryTypeInstance)
    991994    }
    992995
  • trunk/grails-app/views/taskDetailed/_showProcedureTab.gsp

    r823 r826  
    2323        <g:render template="/taskProcedureDetailed/taskProcedureRevision"
    2424                            model="['taskProcedureRevision':taskProcedureRevision]" />
     25        <br />
     26
     27        <div id="maintenanceEntryContainer"></div>
     28
     29        <div style="text-align:right;" id="maintenanceEntryButton">
     30            <span class="buttons">
     31                <input type="button"
     32                            class="add"
     33                            value="Add Maintenance Entry"
     34                            onclick="getMaintenanceEntryForm(${taskInstance?.id}, 6)" />
     35            </span>
     36        </div>
    2537    </g:else>
  • trunk/grails-app/views/taskDetailed/show.gsp

    r822 r826  
    66        <nav:resources override="true"/>
    77        <resource:tabView skin="tabviewCustom" />
     8        <resource:dateChooser />
     9        <g:javascript src="taskShow.js" />
    810    </head>
    911    <body>
Note: See TracChangeset for help on using the changeset viewer.