Search in sources :

Example 6 with ClientViewService

use of com.axelor.apps.portal.service.ClientViewService 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 7 with ClientViewService

use of com.axelor.apps.portal.service.ClientViewService in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyTasksInProgress.

public void showClientMyTasksInProgress(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.getTasksInProgressOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("Tasks in progress")).model(ProjectTask.class.getName()).add("grid", "project-task-grid").add("form", "project-task-form").param("search-filters", "project-task-filters").domain(filter.getQuery()).map());
            }
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ClientViewService(com.axelor.apps.portal.service.ClientViewService) User(com.axelor.auth.db.User) Filter(com.axelor.rpc.filter.Filter) ProjectTask(com.axelor.apps.project.db.ProjectTask)

Example 8 with ClientViewService

use of com.axelor.apps.portal.service.ClientViewService in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyTotalRemaining.

public void showClientMyTotalRemaining(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.getTotalRemainingOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("Total remaining")).model(Invoice.class.getName()).add("grid", "invoice-grid").add("form", "invoice-form").param("search-filters", "customer-invoices-filters").domain(filter.getQuery()).map());
            }
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ClientViewService(com.axelor.apps.portal.service.ClientViewService) User(com.axelor.auth.db.User) Invoice(com.axelor.apps.account.db.Invoice) Filter(com.axelor.rpc.filter.Filter)

Example 9 with ClientViewService

use of com.axelor.apps.portal.service.ClientViewService in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyAwaitingInvoices.

public void showClientMyAwaitingInvoices(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.getAwaitingInvoicesOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("Awaiting invoices")).model(Invoice.class.getName()).add("grid", "invoice-grid").add("form", "invoice-form").param("search-filters", "customer-invoices-filters").domain(filter.getQuery()).map());
            }
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ClientViewService(com.axelor.apps.portal.service.ClientViewService) User(com.axelor.auth.db.User) Invoice(com.axelor.apps.account.db.Invoice) Filter(com.axelor.rpc.filter.Filter)

Example 10 with ClientViewService

use of com.axelor.apps.portal.service.ClientViewService in project axelor-open-suite by axelor.

the class ClientViewController method completeClientViewIndicators.

public void completeClientViewIndicators(ActionRequest request, ActionResponse response) {
    try {
        Map<String, Object> map;
        ClientViewService clientViewService = Beans.get(ClientViewService.class);
        User clientUser = clientViewService.getClientUser();
        if (clientUser.getPartner() == null) {
            response.setError(I18n.get(ITranslation.CLIENT_PORTAL_NO_PARTNER));
        } else {
            map = clientViewService.updateClientViewIndicators();
            response.setValues(map);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ClientViewService(com.axelor.apps.portal.service.ClientViewService) User(com.axelor.auth.db.User)

Aggregations

ClientViewService (com.axelor.apps.portal.service.ClientViewService)20 User (com.axelor.auth.db.User)20 Filter (com.axelor.rpc.filter.Filter)19 Invoice (com.axelor.apps.account.db.Invoice)4 Ticket (com.axelor.apps.helpdesk.db.Ticket)4 StockMove (com.axelor.apps.stock.db.StockMove)4 ProjectTask (com.axelor.apps.project.db.ProjectTask)3 SaleOrder (com.axelor.apps.sale.db.SaleOrder)3 StockMoveRepository (com.axelor.apps.stock.db.repo.StockMoveRepository)2 Project (com.axelor.apps.project.db.Project)1 SaleOrderRepository (com.axelor.apps.sale.db.repo.SaleOrderRepository)1