Search in sources :

Example 1 with TimerTicketService

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);
    }
}
Also used : Ticket(com.axelor.apps.helpdesk.db.Ticket) Timer(com.axelor.apps.base.db.Timer) TimerTicketService(com.axelor.apps.helpdesk.service.TimerTicketService)

Aggregations

Timer (com.axelor.apps.base.db.Timer)1 Ticket (com.axelor.apps.helpdesk.db.Ticket)1 TimerTicketService (com.axelor.apps.helpdesk.service.TimerTicketService)1