use of com.axelor.apps.helpdesk.db.Ticket 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);
}
}
use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.
the class ClientViewController method showClientMyCompanyTickets.
public void showClientMyCompanyTickets(ActionRequest request, ActionResponse response) {
try {
ClientViewService clientViewService = Beans.get(ClientViewService.class);
User clientUser = clientViewService.getClientUser();
if (clientUser.getPartner() == null) {
response.setError(I18n.get(ITranslation.CLIENT_PORTAL_NO_PARTNER));
} else {
Filter filter = clientViewService.getCompanyTicketsOfUser(clientUser).get(0);
if (filter != null) {
response.setView(ActionView.define(I18n.get("Company tickets")).model(Ticket.class.getName()).add("grid", "ticket-grid").add("form", "ticket-form").param("search-filters", "ticket-filters").domain(filter.getQuery()).map());
}
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.
the class ClientViewController method showClientMyResolvedTickets.
public void showClientMyResolvedTickets(ActionRequest request, ActionResponse response) {
try {
ClientViewService clientViewService = Beans.get(ClientViewService.class);
User clientUser = clientViewService.getClientUser();
if (clientUser.getPartner() == null) {
response.setError(I18n.get(ITranslation.CLIENT_PORTAL_NO_PARTNER));
} else {
Filter filter = clientViewService.getResolvedTicketsOfUser(clientUser).get(0);
if (filter != null) {
response.setView(ActionView.define(I18n.get("Resolved tickets")).model(Ticket.class.getName()).add("grid", "ticket-grid").add("form", "ticket-form").param("search-filters", "ticket-filters").domain(filter.getQuery()).map());
}
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.
the class TicketController method timerStateOn.
@Transactional
public void timerStateOn(ActionRequest request, ActionResponse response) {
try {
TicketRepository ticketRepo = Beans.get(TicketRepository.class);
Ticket ticket = request.getContext().asType(Ticket.class);
ticket = ticketRepo.find(ticket.getId());
ticket.setTimerState(true);
ticketRepo.save(ticket);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.
the class TicketController method timerStateOff.
@Transactional
public void timerStateOff(ActionRequest request, ActionResponse response) {
try {
TicketRepository ticketRepo = Beans.get(TicketRepository.class);
Ticket ticket = request.getContext().asType(Ticket.class);
ticket = ticketRepo.find(ticket.getId());
ticket.setTimerState(false);
ticketRepo.save(ticket);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations