use of com.axelor.apps.project.service.TimerProjectTaskService in project axelor-open-suite by axelor.
the class ProjectTaskController method manageTimerButtons.
public void manageTimerButtons(ActionRequest request, ActionResponse response) {
try {
ProjectTask task = request.getContext().asType(ProjectTask.class);
TimerProjectTaskService service = Beans.get(TimerProjectTaskService.class);
if (task.getId() == null) {
return;
}
Timer timer = service.find(task);
boolean hideStart = false;
boolean hideCancel = true;
if (timer != null) {
hideStart = timer.getStatusSelect() == TimerRepository.TIMER_STARTED;
hideCancel = timer.getTimerHistoryList().isEmpty();
}
response.setAttr("startTimerBtn", HIDDEN_ATTR, hideStart);
response.setAttr("stopTimerBtn", HIDDEN_ATTR, !hideStart);
response.setAttr("cancelTimerBtn", HIDDEN_ATTR, hideCancel);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations