Search in sources :

Example 41 with Filter

use of com.axelor.rpc.filter.Filter 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 42 with Filter

use of com.axelor.rpc.filter.Filter 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)

Example 43 with Filter

use of com.axelor.rpc.filter.Filter in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyNewTasks.

public void showClientMyNewTasks(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.getNewTasksOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("New tasks")).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 44 with Filter

use of com.axelor.rpc.filter.Filter in project axelor-open-suite by axelor.

the class ClientViewController method showClientReversions.

public void showClientReversions(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.getReversionsOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("My reversions")).model(StockMove.class.getName()).add("grid", "stock-move-grid").add("form", "stock-move-form").param("search-filters", "internal-stock-move-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) StockMove(com.axelor.apps.stock.db.StockMove) Filter(com.axelor.rpc.filter.Filter)

Example 45 with Filter

use of com.axelor.rpc.filter.Filter in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyOverdueInvoices.

/* INVOICE OnClick */
public void showClientMyOverdueInvoices(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.getOverdueInvoicesOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("Overdue 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)

Aggregations

Filter (com.axelor.rpc.filter.Filter)47 JPQLFilter (com.axelor.rpc.filter.JPQLFilter)23 ArrayList (java.util.ArrayList)22 User (com.axelor.auth.db.User)21 ClientViewService (com.axelor.apps.portal.service.ClientViewService)19 StockMove (com.axelor.apps.stock.db.StockMove)7 Invoice (com.axelor.apps.account.db.Invoice)5 Ticket (com.axelor.apps.helpdesk.db.Ticket)5 SaleOrder (com.axelor.apps.sale.db.SaleOrder)5 ProjectTask (com.axelor.apps.project.db.ProjectTask)4 StockMoveRepository (com.axelor.apps.stock.db.repo.StockMoveRepository)3 HashMap (java.util.HashMap)3 AdvancedExport (com.axelor.apps.base.db.AdvancedExport)2 AdvancedExportService (com.axelor.apps.base.service.advancedExport.AdvancedExportService)2 Project (com.axelor.apps.project.db.Project)2 SaleOrderRepository (com.axelor.apps.sale.db.repo.SaleOrderRepository)2 JpaSecurity (com.axelor.db.JpaSecurity)2 Model (com.axelor.db.Model)2 I18n (com.axelor.i18n.I18n)2 Beans (com.axelor.inject.Beans)2