use of com.axelor.apps.helpdesk.service.TimerTicketService in project axelor-open-suite by axelor.
the class TicketController method manageTimerButtons.
public void manageTimerButtons(ActionRequest request, ActionResponse response) {
try {
Ticket ticket = request.getContext().asType(Ticket.class);
TimerTicketService service = Beans.get(TimerTicketService.class);
Timer timer = service.find(ticket);
boolean hideStart = false;
boolean hideCancel = true;
if (timer != null) {
hideStart = timer.getStatusSelect() == TimerRepository.TIMER_STARTED;
hideCancel = timer.getTimerHistoryList().isEmpty() || timer.getStatusSelect().equals(TimerRepository.TIMER_STOPPED);
}
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