ItEr37S08CUCreacionUnidadesPlanificacionItEr36S11: When doing recommended allocation resources per day are always shown
This commit is contained in:
parent
5d79f4410f
commit
6fccde1f2f
2 changed files with 28 additions and 3 deletions
|
|
@ -213,6 +213,12 @@ public abstract class AllocationRow {
|
|||
return this.resourcesPerDay;
|
||||
}
|
||||
|
||||
public ResourcesPerDay getResourcesPerDayFromInput() {
|
||||
BigDecimal value = resourcesPerDayInput.getValue();
|
||||
value = value != null ? value : BigDecimal.ZERO;
|
||||
return ResourcesPerDay.amount(value);
|
||||
}
|
||||
|
||||
public void setResourcesPerDay(ResourcesPerDay resourcesPerDay) {
|
||||
this.resourcesPerDay = resourcesPerDay;
|
||||
resourcesPerDayInput.setValue(this.resourcesPerDay.getAmount());
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ class FormBinder {
|
|||
allocationRowsHandler.setCalculatedValue(calculatedValue);
|
||||
applyDisabledRules();
|
||||
loadValueForEndDate();
|
||||
sumResourcesPerDayFromRowsAndAssignToAllResourcesPerDay();
|
||||
applyButton.setDisabled(false);
|
||||
}
|
||||
|
||||
|
|
@ -291,9 +292,9 @@ class FormBinder {
|
|||
}
|
||||
|
||||
private void allResourcesPerDayVisibilityRule() {
|
||||
this.allResourcesPerDay.setVisible(allocationRowsHandler
|
||||
.getCalculatedValue() != CalculatedValue.RESOURCES_PER_DAY
|
||||
&& recommendedAllocation);
|
||||
this.allResourcesPerDay.setVisible(recommendedAllocation);
|
||||
this.allResourcesPerDay.setDisabled(allocationRowsHandler
|
||||
.getCalculatedValue() == CalculatedValue.RESOURCES_PER_DAY);
|
||||
}
|
||||
|
||||
public List<AllocationRow> getCurrentRows() {
|
||||
|
|
@ -305,6 +306,7 @@ class FormBinder {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
private List<AllocationRow> addListeners(List<AllocationRow> list) {
|
||||
for (AllocationRow each : list) {
|
||||
each.addListenerForInputChange(onChangeEnableApply);
|
||||
|
|
@ -322,6 +324,8 @@ class FormBinder {
|
|||
}
|
||||
});
|
||||
aggregate = lastAllocation.getAggregate();
|
||||
allResourcesPerDayVisibilityRule();
|
||||
sumResourcesPerDayFromRowsAndAssignToAllResourcesPerDay();
|
||||
reloadValues();
|
||||
}
|
||||
|
||||
|
|
@ -478,6 +482,7 @@ class FormBinder {
|
|||
allHoursInputChange);
|
||||
allResourcesPerDay.addEventListener(Events.ON_CHANGE,
|
||||
allResourcesPerDayChange);
|
||||
sumResourcesPerDayFromRowsAndAssignToAllResourcesPerDay();
|
||||
Util.reloadBindings(allocationsList);
|
||||
}
|
||||
|
||||
|
|
@ -514,4 +519,18 @@ class FormBinder {
|
|||
this.workerSearchTab = workerSearchTab;
|
||||
}
|
||||
|
||||
private void sumResourcesPerDayFromRowsAndAssignToAllResourcesPerDay() {
|
||||
if (allResourcesPerDay.isDisabled() && allResourcesPerDay.isVisible()) {
|
||||
allResourcesPerDay.setValue(sumResourcesPerDayFromInputs());
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal sumResourcesPerDayFromInputs() {
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
for (AllocationRow each : rows) {
|
||||
sum = sum.add(each.getResourcesPerDayFromInput().getAmount());
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue