Ignore:
Timestamp:
May 13, 2009, 12:51:15 PM (15 years ago)
Author:
gav
Message:

Add icons from famfamfam silk icons, add acknowledgement page to suite.
Adjust AssignedPerson? controller so that a task.id is required to create.
Move Add AssignedPerson? link up to TaskDetailed? show page.
Further improvements to taskDetailed show tabs.
Adjust TaskProcedureDetailed? controller to allow linking a Procedure to a task during creation.
Adjust TaskRecurringSchedule? to a one-to-one cascading relationship.
Modify CSS class duration to time and added icons.
Regenerate some pages.

File:
1 edited

Legend:

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

    r133 r134  
    2020    }
    2121
    22 //     def show = {
    23 //         def taskInstance = Task.get( params.id )
    24 //
    25 //         if(!taskInstance) {
    26 //             flash.message = "Task not found with id ${params.id}"
    27 //             redirect(action:list)
    28 //         }
    29 //         else {
    30 //             def taskProcedureInstance = TaskProcedure.get(taskInstance?.taskProcedure?.id)
    31 //             return [ taskInstance : taskInstance,  taskProcedureInstance: taskProcedureInstance]
    32 //
    33 //         }
    34 //     }
    35 
    3622    def show = {
    3723        def taskInstance = Task.get( params.id )
     
    4228        }
    4329        else {
     30                        params.max = 10
     31                        params.order = "desc"
     32                        params.sort = "id"
     33
     34                        def subTaskInstanceList = Task.findAllByParentTask(taskInstance, params)
     35                        def subTaskInstanceTotal = Task.countByParentTask(taskInstance)                                 
     36            def showTaskTab = new String("true")
     37
    4438            def taskProcedureInstance = TaskProcedure.get(taskInstance.taskProcedure?.id)
    4539            def taskProcedureExits = new Boolean("true")
    46             def showTaskTab = new String("true")
    47 
    4840            if(!taskProcedureInstance) {
    4941                taskProcedureExits = false
    5042            }
     43//                      else {
     44                                params.order = "asc"
     45                                params.sort = "procedureStepNumber"
     46                                def maintenanceActionList = MaintenanceAction.findAllByTaskProcedure(taskProcedureInstance, params)
     47//                      }
     48                                               
     49            def taskRecurringScheduleInstance = TaskRecurringSchedule.get(taskInstance.taskRecurringSchedule?.id)
     50            def taskRecurringScheduleExits= new Boolean("true")
     51                        if(!taskRecurringScheduleInstance) {
     52                taskRecurringScheduleExits = false
     53            }
     54                       
    5155            return [ taskInstance : taskInstance,
    5256                            taskProcedureInstance: taskProcedureInstance,
    5357                            taskProcedureExits: taskProcedureExits,
    54                             showTaskTab: showTaskTab]
     58                            showTaskTab: showTaskTab,
     59                                                        subTaskInstanceList: subTaskInstanceList,
     60                                                        subTaskInstanceTotal: subTaskInstanceTotal,
     61                                                        subTaskInstanceMax: params.max,
     62                                                        maintenanceActionList: maintenanceActionList,
     63                                                        taskRecurringScheduleInstance: taskRecurringScheduleInstance,
     64                                                        taskRecurringScheduleExits: taskRecurringScheduleExits]
    5565        }
    5666    }
     
    136146        }
    137147    }
    138 
    139     //Generate a new TaskProcedure for a taskInstance.
    140     def generateProcedure = {
    141         def taskProcedureInstance = new TaskProcedure()
    142         taskProcedureInstance.properties = params
    143 
    144         def taskInstance = Task.get(params.taskInstance.id)
    145         def taskProcedureExits = new Boolean("true")
    146         def showProcedureTab = new String("true")
    147 
    148         if(!taskProcedureInstance.hasErrors() && taskProcedureInstance.save()) {
    149             taskProcedureInstance.addToTasks(taskInstance)
    150             flash.message = "Procedure created, you can now add steps to the procedure"
    151 //             redirect(action:show, id:params.taskInstance.id)
     148       
     149        def listSubTasks = {
     150                def parentTaskInstance = Task.get(params.id)
     151                               
     152        if(!parentTaskInstance) {
     153            flash.message = "Task not found with id ${params.id}"
     154            redirect(action:list)
    152155        }
    153156        else {
    154             taskProcedureExits = false
    155         }
    156 
    157         render(view:'show',model:[ taskInstance : taskInstance, 
    158                                                         taskProcedureInstance: taskProcedureInstance,
    159                                                         taskProcedureExits: taskProcedureExits,
    160                                                         showProcedureTab: showProcedureTab])
    161     }
    162 
    163     def findProcedure = {
    164         redirect(controller:"taskProcedureDetailed", action:"list", id:params.taskInstance.id)
    165     }
     157                params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
     158                def subTaskInstanceList = Task.findAllByParentTask(parentTaskInstance, params)
     159                def subTaskInstanceTotal = Task.countByParentTask(parentTaskInstance)
     160                               
     161        [ taskInstanceList: subTaskInstanceList,
     162                        taskInstanceTotal:  subTaskInstanceTotal,
     163                        parentTaskInstance: parentTaskInstance]
     164                }
     165        }
    166166       
    167167}
Note: See TracChangeset for help on using the changeset viewer.