Ignore:
Timestamp:
Oct 17, 2009, 1:41:59 PM (15 years ago)
Author:
gav
Message:

Work on Task searching.
Add calendar view for Tasks.
Cleaner look for search and paginate buttons.
OverlayPane? css and javascript to fix filterPane width on smaller screens and for quick search panes.

Location:
trunk/grails-app/controllers
Files:
2 edited

Legend:

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

    r147 r155  
    2222        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100 )
    2323
    24         // Search urls:
     24        // Quick Search:
    2525        if(!params.filter)
    2626        {
     
    2828            def personInstance = Person.get(authenticateService.userDomain().id)
    2929
    30             if(params.searchMyTodays) {
     30            if(params.quickSearch == "searchMyTodays") {
    3131                taskInstanceList = taskSearchService.getMyTodays(params)
    3232                if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks for ${personInstance.firstName} ${personInstance.lastName}." }
    3333                else { params.message = "No tasks found for today." }
    3434            }
    35             else if(params.searchInTheLastWeek) {
     35            else if(params.quickSearch == "searchInTheLastWeek") {
    3636                taskInstanceList = taskSearchService.getInTheLastWeek(params)
    3737                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week." }
    3838                else { params.message = "No tasks found for today." }
    3939            }
    40             else if(params.searchMyInTheLastWeek) {
     40            else if(params.quickSearch == "searchMyInTheLastWeek") {
    4141                taskInstanceList = taskSearchService.getMyInTheLastWeek(params)
    4242                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week for ${personInstance.firstName} ${personInstance.lastName}." }
     
    4848                if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks." }
    4949                else { params.message = "No tasks found for today." }
    50             }
    51 
    52             return[ taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceList.totalCount]
     50                params.quickSearch = "searchTodays"
     51            }
     52            return[taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceList.totalCount, filterParams: params]
    5353        }
    5454        // filterPane:
     
    5959    }
    6060
    61     def advancedSearch = {
    62         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100 )
    63 
    64         if(!params._action_advancedSearch)
     61    def searchCalendar = {
     62//         println params
     63        params.max = 30
     64
     65        // Quick Search:
     66        if(!params.filter)
    6567        {
    66             // Default:
    67             def taskInstanceActivesList = Task.findAllByIsActive(true, params)
    68             def taskInstanceActivesTotal = Task.countByIsActive(true)
    69             return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal]
    70         }
    71         render( view:'advancedSearch',
    72             model:[ taskInstanceList: filterService.filter( params, Task ),
    73             taskInstanceTotal: filterService.count( params, Task ),
    74             filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
    75             params:params ] )
    76     }
    77    
    78 //     def searchTodays = {
    79 //         def taskInstanceList = taskSearchService.getTodays(params)
    80 //         
    81 //         if(taskInstanceList.totalCount > 0)
    82 //         {
    83 //             flash.message = "Today's tasks"
    84 //         }
    85 //         else { flash.message = "No tasks found for today" }
    86 //         
    87 //         render( view:'search',
    88 //             model:[ taskInstanceList: taskInstanceList,
    89 //             taskInstanceTotal: taskInstanceList.totalCount])
    90 //     }
    91    
    92 //     def searchMyTodays = {
    93 //         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    94 //             
    95 //         def taskInstanceList = Task.createCriteria().list() {
    96 //                 eq("leadPerson", Person.get(authenticateService.userDomain().id))
    97 //                 ge("targetStartDate", dateUtilService.getToday())
    98 //                 eq("isActive", true)
    99 //         }
    100 //             
    101 //         def taskInstanceTotal = Task.createCriteria().count() {
    102 //                 eq("leadPerson", Person.get(authenticateService.userDomain().id))
    103 //                 ge("targetStartDate", dateUtilService.getToday())
    104 //                 eq("isActive", true)
    105 //         }
    106 //         
    107 //         if(taskInstanceTotal > 0)
    108 //         {
    109 //             flash.message = "Today's tasks"
    110 //         }
    111 //         else { flash.message = "No tasks found for today" }
    112 //         
    113 //         render( view:'search',
    114 //             model:[ taskInstanceList: taskInstanceList,
    115 //             taskInstanceTotal: taskInstanceTotal])
    116 //     }
    117    
    118     def searchInTheLastWeek = {
    119         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    120            
    121         def taskInstanceList = Task.createCriteria().list() {
    122                 ge("targetStartDate", dateUtilService.getToday()-7)
    123                 eq("isActive", true)
    124         }
    125            
    126         def taskInstanceTotal = Task.createCriteria().count() {
    127                 ge("targetStartDate", dateUtilService.getToday()-7)
    128                 eq("isActive", true)
    129         }
    130        
    131         if(taskInstanceTotal > 0)
    132         {
    133             flash.message = "Tasks with target start date in the last week."
    134         }
    135        
    136         else {flash.message = "No tasks found with target start date in the last week." }
    137        
    138         render( view:'search',
    139             model:[ taskInstanceList: taskInstanceList,
    140             taskInstanceTotal: taskInstanceTotal])
    141     }
    142    
    143     def searchMyInTheLastWeek = {
    144         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    145            
    146         def taskInstanceList = Task.createCriteria().list() {
    147                 eq("leadPerson", Person.get(authenticateService.userDomain().id))
    148                 ge("targetStartDate", dateUtilService.getToday()-7)
    149                 eq("isActive", true)
    150         }
    151            
    152         def taskInstanceTotal = Task.createCriteria().count() {
    153                 eq("leadPerson", Person.get(authenticateService.userDomain().id))
    154                 ge("targetStartDate", dateUtilService.getToday()-7)
    155                 eq("isActive", true)
    156         }
    157        
    158         if(taskInstanceTotal > 0)
    159         {
    160             flash.message = "Tasks with target start date in the last week."
    161         }
    162         else { flash.message = "No tasks found with target start date in the last week." }
    163        
    164         render( view:'search',
    165             model:[ taskInstanceList: taskInstanceList,
    166             taskInstanceTotal: taskInstanceTotal])
    167     }
    168 
    169 //     def search = {
    170 //         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    171 //         
    172 //         if(!params.order) {
    173 //             params.sort = "id"
    174 //             params.order = "desc"
    175 //         }
    176 //         
    177 //         if(params.search == "ShowAll")
    178 //         {
    179 //             def taskInstanceActivesList = Task.findAllByIsActive(true, params)
    180 //             def taskInstanceActivesTotal = Task.countByIsActive(true)
    181 //             return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal]
    182 //         }
    183 //         if(params.search == "ShowDeleted")
    184 //         {
    185 //             def taskInstanceActivesList = Task.findAllByIsActive(false, params)
    186 //             def taskInstanceActivesTotal = Task.countByIsActive(false)
    187 //             return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal]
    188 //         }
    189 //         // Default:
    190 //         def taskInstanceActivesList = Task.findAllByIsActive(true, params)
    191 //         def taskInstanceActivesTotal = Task.countByIsActive(true)
    192 //         [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal]
    193 //     }
    194    
    195     def searchShowAll = {
    196         redirect(action:'search', params:[search:"ShowAll"])
    197     }
    198    
    199     def searchShowDeleted = {
    200         redirect(action:'search', params:[search:"ShowDeleted"])
     68            def taskInstanceList = []
     69            def personInstance = Person.get(authenticateService.userDomain().id)
     70
     71            if(params.quickSearch == "searchMyTodays") {
     72                taskInstanceList = taskSearchService.getMyTodays(params)
     73                if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks for ${personInstance.firstName} ${personInstance.lastName}." }
     74                else { params.message = "No tasks found for today." }
     75                if(taskInstanceList.totalCount > params.max) { params.message = "Too many results, only the first ${params.max} shown" }
     76            }
     77            else if(params.quickSearch == "searchInTheLastWeek") {
     78                taskInstanceList = taskSearchService.getInTheLastWeek(params)
     79                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week." }
     80                else { params.message = "No tasks found for today." }
     81                if(taskInstanceList.totalCount > params.max) { params.message = "Too many results, only the first ${params.max} shown" }
     82            }
     83            else if(params.quickSearch == "searchMyInTheLastWeek") {
     84                taskInstanceList = taskSearchService.getMyInTheLastWeek(params)
     85                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week for ${personInstance.firstName} ${personInstance.lastName}." }
     86                else { params.message = "No tasks found for today." }
     87                if(taskInstanceList.totalCount > params.max) { params.message = "Too many results, only the first ${params.max} shown" }
     88            }
     89            else {
     90                //Default:
     91                taskInstanceList = taskSearchService.getTodays(params)
     92                if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks." }
     93                else { params.message = "No tasks found for today." }
     94                if(taskInstanceList.totalCount > params.max) { params.message = "Too many results, only the first ${params.max} shown" }
     95                params.quickSearch = "searchTodays"
     96            }
     97            return[taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceList.totalCount, filterParams: params]
     98        }
     99        // filterPane:
     100        def taskInstanceTotal = filterService.count( params, Task )
     101        if(taskInstanceTotal > params.max) { params.message = "Too many results, only the first ${params.max} shown" }
     102        return[ taskInstanceList: filterService.filter( params, Task ),
     103            taskInstanceTotal: taskInstanceTotal,
     104            filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
     105            params:params ]
    201106    }
    202107
  • trunk/grails-app/controllers/TaskProcedureDetailedController.groovy

    r147 r155  
    22
    33class TaskProcedureDetailedController extends BaseController {
     4
     5    def filterService
    46
    57    def index = { redirect(action:list,params:params) }
     
    113115        } else {
    114116            flash.message = "Please select a task, then the Procedure tab.'"
    115             redirect(controller:"taskDetailed", action:"list")
     117            redirect(controller:"taskDetailed", action:"search")
    116118        }
    117119    }
Note: See TracChangeset for help on using the changeset viewer.