Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial steps for planning and scheduling of a person

  • Loading branch information...
commit e8978aebb28610b3f25f5f5af1177bf4569dca01 1 parent 580da9d
@jettro authored
View
43 grails-app/controllers/nl/gridshore/scheduling/PersonController.groovy
@@ -1,14 +1,49 @@
package nl.gridshore.scheduling
+import grails.converters.JSON
+
class PersonController {
def scaffold = true
+ def planning = {
+
+ }
+
+ def planningDetail = {
+ def id = params.id
+ if (id) {
+ def person = Person.get(id)
+
+ } else {
+ redirect(action: "planning")
+ }
+ }
+
+ def planningDataAsJSON = {
+ response.setHeader("Cache-Control", "no-store")
+ def list = []
+ def persons = Person.list(params)
+ persons.each {
+ list << [
+ id:it.id,
+ name:it.name,
+ dataUrl: g.createLink(action:"planningDetail") + "/${it.id}"
+ ]
+ }
+ def data = [
+ totalRecords: Person.count(),
+ results: list
+ ]
+ render data as JSON
+ }
+
static navigation = [
- group:'tabs',
- order:150,
- subItems:[
- [group:'tabs',action:'create']
+ group: 'tabs',
+ order: 150,
+ subItems: [
+ [group: 'tabs', action: 'planning'],
+ [group: 'tabs', action: 'create']
]
]
View
30 grails-app/views/person/planning.gsp
@@ -0,0 +1,30 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<html>
+<head>
+ <title>Show all schedule items</title>
+ <meta name="layout" content="main"/>
+ <gui:resources components="dataTable"/>
+</head>
+<body>
+<div class="yui-skin-sam">
+ <gui:dataTable
+ id="personDatatable"
+ draggableColumns="true"
+ columnDefs="[
+ [key:'id', sortable:true, resizeable: true, label:'ID'],
+ [key:'name', sortable:true, resizeable: true, label:'Name'],
+ [key:'partTimeFactor', type:'number', sortable:true, resizeable: true, label: 'Part time factor']
+ ]"
+ paginatorConfig="[
+ template:'{PreviousPageLink} {PageLinks} {NextPageLink} {CurrentPageReport}',
+ pageReportTemplate:'{totalRecords} total records'
+ ]"
+ controller="person"
+ action="planningDataAsJSON"
+ resultsList="results"
+ rowExpansion="false"
+ rowsPerPage="15"
+ rowClickNavigation="true"/>
+</div>
+</body>
+</html>
View
13 grails-app/views/person/planningDetail.gsp
@@ -0,0 +1,13 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: jettropro
+ Date: Dec 21, 2009
+ Time: 5:49:46 PM
+ To change this template use File | Settings | File Templates.
+--%>
+
+<%@ page contentType="text/html;charset=UTF-8" %>
+<html>
+ <head><title>Simple GSP page</title></head>
+ <body>Place your content here</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.