Search in sources :

Example 6 with Ticket

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

Example 7 with Ticket

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);
    }
}
Also used : ClientViewService(com.axelor.apps.portal.service.ClientViewService) Ticket(com.axelor.apps.helpdesk.db.Ticket) User(com.axelor.auth.db.User) Filter(com.axelor.rpc.filter.Filter)

Example 8 with Ticket

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);
    }
}
Also used : ClientViewService(com.axelor.apps.portal.service.ClientViewService) Ticket(com.axelor.apps.helpdesk.db.Ticket) User(com.axelor.auth.db.User) Filter(com.axelor.rpc.filter.Filter)

Example 9 with Ticket

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);
    }
}
Also used : Ticket(com.axelor.apps.helpdesk.db.Ticket) TicketRepository(com.axelor.apps.helpdesk.db.repo.TicketRepository) Transactional(com.google.inject.persist.Transactional)

Example 10 with Ticket

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);
    }
}
Also used : Ticket(com.axelor.apps.helpdesk.db.Ticket) TicketRepository(com.axelor.apps.helpdesk.db.repo.TicketRepository) Transactional(com.google.inject.persist.Transactional)

Aggregations

Ticket (com.axelor.apps.helpdesk.db.Ticket)15 TimerTicketService (com.axelor.apps.helpdesk.service.TimerTicketService)5 User (com.axelor.auth.db.User)5 ClientViewService (com.axelor.apps.portal.service.ClientViewService)4 Filter (com.axelor.rpc.filter.Filter)4 Transactional (com.google.inject.persist.Transactional)4 Timer (com.axelor.apps.base.db.Timer)2 AppBaseService (com.axelor.apps.base.service.app.AppBaseService)2 TicketRepository (com.axelor.apps.helpdesk.db.repo.TicketRepository)2 Duration (java.time.Duration)2 TimerHistory (com.axelor.apps.base.db.TimerHistory)1