Author: meynier Date: 2013-07-19 16:30:29 +0200 (Fri, 19 Jul 2013) New Revision: 371 Url: http://chorem.org/projects/chorem/repository/revisions/371 Log: Added project filter and small modifications on the dashboards Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/GanttAction.java trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardEmployee.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp trunk/chorem-webmotion/src/main/webapp/css/jquery.fn.gantt.css trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-07-19 13:50:40 UTC (rev 370) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-07-19 14:30:29 UTC (rev 371) @@ -1,6 +1,7 @@ package org.chorem.webmotion.actions.project; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Comparator; @@ -191,7 +192,7 @@ } - public Render employeeFilter(ChoremClient client, String id, Date from, Date to) { + public Render employeeFilter(ChoremClient client, String id, Date from, Date to, String[] quotationFilters) { //If no field has been set, sets the date to the actual month if(from == null || to == null) { @@ -215,17 +216,29 @@ List<Employee> employeeList = employeeResult.getAll(); //Fetch all the tasks on the interval - WikittyQuery taskQuery = new WikittyQueryMaker() - .and() - .exteq("Task") - .or() - .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to) - .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to) + WikittyQueryMaker taskQueryMaker = new WikittyQueryMaker() .and() - .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from) - .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to) - .end(); + .exteq("Task"); + + if(quotationFilters!=null) { + taskQueryMaker.or(); + for(String q : quotationFilters) { + taskQueryMaker .eq(Task.FQ_FIELD_TASK_QUOTATION,q); + System.out.println(client.restore(q));} + taskQueryMaker.close(); + } + + taskQueryMaker .or() + .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to) + .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to) + .and() + .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from) + .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to); + + WikittyQuery taskQuery = taskQueryMaker.end(); + System.out.println(taskQuery); List<Task> taskList = client.findAllByQuery(Task.class,taskQuery).getAll(); + System.out.println("RESULT : " + taskList); //Fetch the employee's workers on those tasks @@ -280,6 +293,14 @@ for(Employee e : kSet) { quotations.addAll(timePerQuotation.get(e).keySet()); } + List<Quotation> allQuotations = new ArrayList<Quotation>(); + WikittyQuery quotationQuery = new WikittyQueryMaker().or() + .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to) + .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to) + .and() + .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from) + .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to).end(); + allQuotations = client.findAllByQuery(Quotation.class, quotationQuery).getAll(); HashMap<Employee, HashMap<Quotation, Double>> percentages = new HashMap<Employee, HashMap<Quotation, Double>>(); @@ -307,7 +328,8 @@ "timePerQuotation", timePerQuotation, "quotations", quotations, "percentages", percentages, - "timeTotals", timeTotals); + "timeTotals", timeTotals, + "allQuotations", allQuotations); } @@ -328,9 +350,9 @@ return multiProjectFilter(client, from, to); } - public Render requestEmployee(ChoremClient client, String id, Date from, Date to) { - - return employeeFilter(client, id, from, to); + public Render requestEmployee(ChoremClient client, String id, Date from, Date to, String[] quotations) { + System.out.println("QUOTATIONS : " + Arrays.toString(quotations)); + return employeeFilter(client, id, from, to, quotations); } Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/GanttAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/GanttAction.java 2013-07-19 13:50:40 UTC (rev 370) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/GanttAction.java 2013-07-19 14:30:29 UTC (rev 371) @@ -66,13 +66,15 @@ else v = new Values[1]; v[0] = new Values(t.getBeginDate(), t.getEndDate(), t.getName(), customClass, t.getWikittyId()); + if(t.getDayExtension() != 0) { GregorianCalendar newEnd = new GregorianCalendar(); newEnd.setTime(t.getEndDate()); newEnd.add(Calendar.DAY_OF_YEAR, (int) t.getDayExtension()); - v[1]= new Values(t.getEndDate(), newEnd.getTime(), "Reestimated end", "ganttOrange", t.getWikittyId()); + v[1]= new Values(t.getEndDate(), newEnd.getTime(), "Day extension", "ganttOrange", t.getWikittyId()); } - JTask jt = new JTask(t.getName(), t.getDescription(), t.getWikittyId(),t.getPrice(), t.getEstimatedDays(), v); + JTask jt = new JTask(t.getName(), t.getDescription(), t.getWikittyId(),t.getPrice(), + t.getEstimatedDays(), t.getDayExtension(), v); lTask.add(jt); } @@ -111,33 +113,36 @@ private class JRender { - private List<JTask> source; - private String dateStart; - private String dateEnd; - private HashMap<String,String> extDate; + private List<JTask> source; + private String dateStart; + private String dateEnd; + private HashMap<String,String> extDate; public JRender(List<JTask> source,HashMap<String,String> extDate,String dateStart,String dateEnd) { - this.source = source; - this.dateStart = dateStart; - this.dateEnd = dateEnd; - this.extDate = extDate; + this.source = source; + this.dateStart = dateStart; + this.dateEnd = dateEnd; + this.extDate = extDate; } } private class JTask implements Comparable { - private String name; - private String desc; - private Values[] values; - private String status; - private String wikittyId; - private float price; - private double estimatedDays; - public JTask(String name, String desc, String wikittyId,float price, double estimatedDays, Values[] values) { - this.name = name; - this.desc = desc; - this.values = values; - this.wikittyId = wikittyId; - this.price = price; - this.estimatedDays = estimatedDays; + private String name; + private String desc; + private Values[] values; + private String status; + private String wikittyId; + private float price; + private double estimatedDays; + private double dayExtension; + public JTask(String name, String desc, String wikittyId,float price, + double estimatedDays, double dayExtension, Values[] values) { + this.name = name; + this.desc = desc; + this.values = values; + this.wikittyId = wikittyId; + this.price = price; + this.estimatedDays = estimatedDays; + this.dayExtension = dayExtension; } @Override public int compareTo(Object task) { @@ -147,17 +152,17 @@ } private class Values implements Comparable{ - private String from; - private String to; - private String label; - private String customClass; - private String dataObj; + private String from; + private String to; + private String label; + private String customClass; + private String dataObj; public Values(Date from, Date to, String label, String customClass, String dataObj) { - this.from = "/Date(" + from.getTime() + ")/"; - this.to = "/Date(" + to.getTime() + ")/"; - this.label = label; - this.customClass = customClass; - this.dataObj = dataObj; + this.from = "/Date(" + from.getTime() + ")/"; + this.to = "/Date(" + to.getTime() + ")/"; + this.label = label; + this.customClass = customClass; + this.dataObj = dataObj; } @Override public int compareTo(Object o) { Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardEmployee.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardEmployee.jsp 2013-07-19 13:50:40 UTC (rev 370) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardEmployee.jsp 2013-07-19 14:30:29 UTC (rev 371) @@ -49,6 +49,17 @@ </div> </div> +<div style="max-height:50px;background-color:#EEEEEE;padding:15px;margin:0px;overflow:auto;"> + <c:forEach items="${allQuotations}" var="q"> + <input type="checkbox" name="quotations" + <c:if test="${empty param.quotations or quotations.contains(q)}"> + checked="yes" + </c:if> + value="${q.wikittyId}"/> ${q.description} + </c:forEach> + +</div> + </form> <table class="table table-striped table-bordered table-condensed"> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-07-19 13:50:40 UTC (rev 370) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-07-19 14:30:29 UTC (rev 371) @@ -165,8 +165,8 @@ <th>TJM réel</th> <th>Gain attendu</th> <th>Gain/perte</th> - <th>SRP moyen</th> - <th>SRP réel</th> + <th>CJM moyen</th> + <th>CJM réel</th> </tr> </thead> <tbody> @@ -202,9 +202,9 @@ maxFractionDigits="2" value="${task.getLossOrProfit()}" /></td> <td class="number"><f:formatNumber type="number" - maxFractionDigits="2" value="${task.getAvgSrp()}" /></td> + maxFractionDigits="2" value="${task.getAvgReturn()}" /></td> <td class="number"><f:formatNumber type="number" - maxFractionDigits="2" value="${task.getRealSrp()}" /></td> + maxFractionDigits="2" value="${task.getRealReturn()}" /></td> </tr> Modified: trunk/chorem-webmotion/src/main/webapp/css/jquery.fn.gantt.css =================================================================== --- trunk/chorem-webmotion/src/main/webapp/css/jquery.fn.gantt.css 2013-07-19 13:50:40 UTC (rev 370) +++ trunk/chorem-webmotion/src/main/webapp/css/jquery.fn.gantt.css 2013-07-19 14:30:29 UTC (rev 371) @@ -55,7 +55,7 @@ display: inline-block; margin: 0 0 0 5px; color: #484A4D; - width: 110px; + width: 220px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; @@ -73,13 +73,10 @@ } .fn-gantt .leftPanel .name { - width: 110px; + width: 220px; font-weight: bold; } -.fn-gantt .leftPanel .desc { - width: 115px; -} .fn-gantt .leftPanel .fn-wide, .fn-gantt .leftPanel .fn-wide .fn-label { width: 225px; Modified: trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js =================================================================== --- trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js 2013-07-19 13:50:40 UTC (rev 370) +++ trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js 2013-07-19 14:30:29 UTC (rev 371) @@ -369,13 +369,15 @@ $.each(element.data, function (i, entry) { if (i >= element.pageNum * settings.itemsPerPage && i < (element.pageNum * settings.itemsPerPage + settings.itemsPerPage)) { entries.push('<div class="row name row' + i + (entry.desc ? '' : ' fn-wide') - + '" id="rowheader' + i + '" offset="' + + '" id="rowheader' + i + '" over="' + + "<b>" + entry.name + "</b><br/>" + entry.desc + +'" offset="' + i % settings.itemsPerPage * tools.getCellSize() + '" dataObj="' + entry.wikittyId + '">'); entries.push('<span class="fn-label' + (entry.cssClass ? ' ' + entry.cssClass : '') + '">' + entry.name + '</span>'); entries.push('</div>'); - if (entry.desc) { + /*if (entry.desc) { entries.push('<div class="row desc row' + i + ' " id="RowdId_' + i + '" data-id="' + entry.id + '" dataObj="' + entry.wikittyId + '">'); @@ -383,14 +385,13 @@ entries.push('<span class="fn-label' + (entry.cssClass ? ' ' + entry.cssClass : '') + '">' + entry.desc + '</span>'); entries.push('</div>'); - } + }*/ } }); ganttLeftPanel.append(entries.join("")); ganttLeftPanel.find('.row:not(.spacer)').mouseover(core.mover) .mouseout(core.mout) .mousemove(core.mmove) - .attr('over', 'text') .click(function (e) { e.stopPropagation(); settings.onItemClick($(this).attr("dataObj")); @@ -1005,7 +1006,7 @@ // **Progress Bar** // Return an element representing a progress of position within // the entire chart - createProgressBar: function (days, cls, desc, label,price, estimatedDays, dataObj) { + createProgressBar: function (days, cls, desc, label,price, estimatedDays,dayExtension, dataObj) { var cellWidth = tools.getCellSize(); var barMarg = tools.getProgressBarMargin() || 0; @@ -1022,8 +1023,9 @@ var hint; var str; - hint = $('<div class="fn-gantt-hint"/>').html(label + " :<br/>" - + desc + "<br/>Price : " + price + "<br />Estimated days : " + estimatedDays); + hint = $('<div class="fn-gantt-hint"/>').html("<b>" + label + "</b><br/>" + + desc + "<br/>Price : " + price + "<br />Estimated days : " + estimatedDays + + "<br/>Day extension : " + dayExtension); $("body").append(hint); hint.css("left", e.pageX); hint.css("top", e.pageY); @@ -1179,6 +1181,7 @@ day.label ? day.label : "", entry.price ? entry.price : "", entry.estimatedDays ? entry.estimatedDays : "", + entry.dayExtension ? entry.dayExtension : "0", day.dataObj ? day.dataObj : null ); @@ -1224,6 +1227,7 @@ day.label ? day.label : "", entry.price ? entry.price : "", entry.estimatedDays ? entry.estimatedDays : "", + entry.dayExtension ? entry.dayExtension : "0", day.dataObj ? day.dataObj : null ); @@ -1266,6 +1270,7 @@ day.label ? day.label : "", entry.price ? entry.price : "", entry.estimatedDays ? entry.estimatedDays : "", + entry.dayExtension ? entry.dayExtension : "0", day.dataObj ? day.dataObj : null ); @@ -1294,6 +1299,7 @@ day.label ? day.label : "", entry.price ? entry.price : "", entry.estimatedDays ? entry.estimatedDays : "", + entry.dayExtension ? entry.dayExtension : "0", day.dataObj ? day.dataObj : null );