Search in sources :

Example 11 with Ticket

use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.

the class TicketController method stopTimer.

public void stopTimer(ActionRequest request, ActionResponse response) {
    try {
        Ticket ticket = request.getContext().asType(Ticket.class);
        Beans.get(TimerTicketService.class).stop(ticket, Beans.get(AppBaseService.class).getTodayDateTime().toLocalDateTime());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Ticket(com.axelor.apps.helpdesk.db.Ticket) AppBaseService(com.axelor.apps.base.service.app.AppBaseService) TimerTicketService(com.axelor.apps.helpdesk.service.TimerTicketService)

Example 12 with Ticket

use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.

the class TicketController method cancelTimer.

public void cancelTimer(ActionRequest request, ActionResponse response) {
    try {
        Ticket ticket = request.getContext().asType(Ticket.class);
        Beans.get(TimerTicketService.class).cancel(ticket);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Ticket(com.axelor.apps.helpdesk.db.Ticket) TimerTicketService(com.axelor.apps.helpdesk.service.TimerTicketService)

Example 13 with Ticket

use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.

the class TicketController method computeTotalTimerDuration.

public void computeTotalTimerDuration(ActionRequest request, ActionResponse response) {
    try {
        Ticket ticket = request.getContext().asType(Ticket.class);
        if (ticket.getId() != null) {
            Duration duration = Beans.get(TimerTicketService.class).compute(ticket);
            response.setValue("$_totalTimerDuration", duration.toMinutes() / 60F);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Ticket(com.axelor.apps.helpdesk.db.Ticket) TimerTicketService(com.axelor.apps.helpdesk.service.TimerTicketService) Duration(java.time.Duration)

Example 14 with Ticket

use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyCustomerTickets.

/* TICKETS OnClick */
public void showClientMyCustomerTickets(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.getTicketsOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("Customer 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 15 with Ticket

use of com.axelor.apps.helpdesk.db.Ticket in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyLateTickets.

public void showClientMyLateTickets(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.getLateTicketsOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("Late 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)

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