Show marks from timesheet dates in tasks when showing reported hours bar
FEA: ItEr77S12AdaptPlanningAccordingTimesheets
This commit is contained in:
parent
c9a638e4f3
commit
9e4cbd2484
10 changed files with 120 additions and 4 deletions
|
|
@ -24,11 +24,14 @@ package org.zkoss.ganttz;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.Days;
|
||||||
|
import org.joda.time.Duration;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.zkoss.ganttz.adapters.IDisabilityConfiguration;
|
import org.zkoss.ganttz.adapters.IDisabilityConfiguration;
|
||||||
import org.zkoss.ganttz.data.GanttDate;
|
import org.zkoss.ganttz.data.GanttDate;
|
||||||
|
|
@ -517,8 +520,34 @@ public class TaskComponent extends Div implements AfterCompose {
|
||||||
this.task.getHoursAdvanceEndDate()) + "px";
|
this.task.getHoursAdvanceEndDate()) + "px";
|
||||||
response(null, new AuInvoke(this, "resizeCompletionAdvance",
|
response(null, new AuInvoke(this, "resizeCompletionAdvance",
|
||||||
widthHoursAdvancePercentage));
|
widthHoursAdvancePercentage));
|
||||||
|
|
||||||
|
Date firstTimesheetDate = task.getFirstTimesheetDate();
|
||||||
|
Date lastTimesheetDate = task.getLastTimesheetDate();
|
||||||
|
if (firstTimesheetDate != null && lastTimesheetDate != null) {
|
||||||
|
Duration firstDuration = Days.daysBetween(
|
||||||
|
task.getBeginDateAsLocalDate(),
|
||||||
|
LocalDate.fromDateFields(firstTimesheetDate))
|
||||||
|
.toStandardDuration();
|
||||||
|
int pixelsFirst = getMapper().toPixels(firstDuration);
|
||||||
|
String positionFirst = pixelsFirst + "px";
|
||||||
|
|
||||||
|
Duration lastDuration = Days
|
||||||
|
.daysBetween(
|
||||||
|
task.getBeginDateAsLocalDate(),
|
||||||
|
LocalDate.fromDateFields(lastTimesheetDate)
|
||||||
|
.plusDays(1)).toStandardDuration();
|
||||||
|
int pixelsLast = getMapper().toPixels(lastDuration);
|
||||||
|
String positionLast = pixelsLast + "px";
|
||||||
|
|
||||||
|
response(null, new AuInvoke(this, "showTimsheetDateMarks",
|
||||||
|
positionFirst, positionLast));
|
||||||
|
} else {
|
||||||
|
response(null, new AuInvoke(this, "hideTimsheetDateMarks"));
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
response(null, new AuInvoke(this, "resizeCompletionAdvance", "0px"));
|
response(null, new AuInvoke(this, "resizeCompletionAdvance", "0px"));
|
||||||
|
response(null, new AuInvoke(this, "hideTimsheetDateMarks"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -313,4 +313,14 @@ public class DefaultFundamentalProperties implements ITaskFundamentalProperties
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getFirstTimesheetDate() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getLastTimesheetDate() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,4 +127,8 @@ public interface ITaskFundamentalProperties {
|
||||||
|
|
||||||
boolean isUpdatedFromTimesheets();
|
boolean isUpdatedFromTimesheets();
|
||||||
|
|
||||||
|
Date getFirstTimesheetDate();
|
||||||
|
|
||||||
|
Date getLastTimesheetDate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -553,4 +553,14 @@ public abstract class Task implements ITaskFundamentalProperties {
|
||||||
return fundamentalProperties.isUpdatedFromTimesheets();
|
return fundamentalProperties.isUpdatedFromTimesheets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getFirstTimesheetDate() {
|
||||||
|
return fundamentalProperties.getFirstTimesheetDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getLastTimesheetDate() {
|
||||||
|
return fundamentalProperties.getLastTimesheetDate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,18 @@ ganttz.TaskComponent = zk.$extends(zul.Widget, {
|
||||||
resizeCompletionAdvance : function(width){
|
resizeCompletionAdvance : function(width){
|
||||||
jq('#' + this.uuid + ' .completion:first').css('width', width);
|
jq('#' + this.uuid + ' .completion:first').css('width', width);
|
||||||
},
|
},
|
||||||
|
showTimsheetDateMarks : function(positionFirst, postionLast) {
|
||||||
|
var firstTimesheetDateMark = jq('#' + this.uuid + ' .first-timesheet-date');
|
||||||
|
var lastTimesheetDateMark = jq('#' + this.uuid + ' .last-timesheet-date');
|
||||||
|
firstTimesheetDateMark.css('left', positionFirst);
|
||||||
|
lastTimesheetDateMark.css('left', postionLast);
|
||||||
|
firstTimesheetDateMark.show();
|
||||||
|
lastTimesheetDateMark.show();
|
||||||
|
},
|
||||||
|
hideTimsheetDateMarks : function() {
|
||||||
|
jq('#' + this.uuid + ' .first-timesheet-date').hide();
|
||||||
|
jq('#' + this.uuid + ' .last-timesheet-date').hide();
|
||||||
|
},
|
||||||
resizeCompletion2Advance : function(width){
|
resizeCompletion2Advance : function(width){
|
||||||
jq('#' + this.uuid + ' .completion2:first').css('width', width);
|
jq('#' + this.uuid + ' .completion2:first').css('width', width);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ function(out){
|
||||||
out.push('<div class="completionMoneyCostBar"></div>');
|
out.push('<div class="completionMoneyCostBar"></div>');
|
||||||
out.push('<div class="completion"></div>');
|
out.push('<div class="completion"></div>');
|
||||||
out.push('<div class="completion2"></div>');
|
out.push('<div class="completion2"></div>');
|
||||||
|
out.push('<div class="timesheet-date-mark first-timesheet-date">|</div>');
|
||||||
|
out.push('<div class="timesheet-date-mark last-timesheet-date">|</div>');
|
||||||
|
|
||||||
out.push('<div id="tasktooltip', this.uuid,'" class="task_tooltip">',
|
out.push('<div id="tasktooltip', this.uuid,'" class="task_tooltip">',
|
||||||
this.getTooltipText(),
|
this.getTooltipText(),
|
||||||
|
|
|
||||||
|
|
@ -1616,4 +1616,18 @@ public abstract class OrderElement extends IntegrationEntity implements
|
||||||
return taskElement.isUpdatedFromTimesheets();
|
return taskElement.isUpdatedFromTimesheets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getFirstTimesheetDate() {
|
||||||
|
if (sumChargedEffort == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return sumChargedEffort.getFirstTimesheetDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastTimesheetDate() {
|
||||||
|
if (sumChargedEffort == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return sumChargedEffort.getLastTimesheetDate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1228,6 +1228,24 @@ _(
|
||||||
return taskElement.isUpdatedFromTimesheets();
|
return taskElement.isUpdatedFromTimesheets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getFirstTimesheetDate() {
|
||||||
|
OrderElement orderElement = taskElement.getOrderElement();
|
||||||
|
if (orderElement != null) {
|
||||||
|
return orderElement.getFirstTimesheetDate();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getLastTimesheetDate() {
|
||||||
|
OrderElement orderElement = taskElement.getOrderElement();
|
||||||
|
if (orderElement != null) {
|
||||||
|
return orderElement.getLastTimesheetDate();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,9 @@ public class AdaptPlanningCommand implements IAdaptPlanningCommand {
|
||||||
taskElement.setUpdatedFromTimesheets(false);
|
taskElement.setUpdatedFromTimesheets(false);
|
||||||
|
|
||||||
if (orderElement.hasTimesheetsReportingHours()) {
|
if (orderElement.hasTimesheetsReportingHours()) {
|
||||||
setStartDateAndConstraint(taskElement, orderElement
|
setStartDateAndConstraint(taskElement,
|
||||||
.getSumChargedEffort().getFirstTimesheetDate());
|
orderElement.getFirstTimesheetDate());
|
||||||
Date lastTimesheetDate = orderElement.getSumChargedEffort()
|
Date lastTimesheetDate = orderElement.getLastTimesheetDate();
|
||||||
.getLastTimesheetDate();
|
|
||||||
setEndDateIfNeeded(taskElement, lastTimesheetDate);
|
setEndDateIfNeeded(taskElement, lastTimesheetDate);
|
||||||
|
|
||||||
if (orderElement.isFinishedTimesheets()) {
|
if (orderElement.isFinishedTimesheets()) {
|
||||||
|
|
|
||||||
|
|
@ -274,6 +274,24 @@ div.box.limiting-unassigned {
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timesheet-date-mark {
|
||||||
|
color: #F21CFF;
|
||||||
|
font-size: 8px;
|
||||||
|
font-weight: bold;
|
||||||
|
/* By default marks are hidden */
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.first-timesheet-date {
|
||||||
|
position: absolute;
|
||||||
|
margin-top: -19px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.last-timesheet-date {
|
||||||
|
position: absolute;
|
||||||
|
margin-top: -19px;
|
||||||
|
}
|
||||||
|
|
||||||
.completion2 {
|
.completion2 {
|
||||||
width: 0%;
|
width: 0%;
|
||||||
height: 6px;
|
height: 6px;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue