use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class ExpenseController method validateExpense.
public void validateExpense(ActionRequest request, ActionResponse response) {
User user = AuthUtils.getUser();
Employee employee = user.getEmployee();
ActionViewBuilder actionView = ActionView.define(I18n.get("Expenses to Validate")).model(Expense.class.getName()).add("grid", "expense-validate-grid").add("form", "expense-form").param("search-filters", "expense-filters");
Beans.get(HRMenuValidateService.class).createValidateDomain(user, employee, actionView);
response.setView(actionView.map());
}
use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class ExpenseController method showSubordinateExpenses.
public void showSubordinateExpenses(ActionRequest request, ActionResponse response) {
User user = AuthUtils.getUser();
Company activeCompany = user.getActiveCompany();
ActionViewBuilder actionView = ActionView.define(I18n.get("Expenses to be Validated by your subordinates")).model(Expense.class.getName()).add("grid", "expense-grid").add("form", "expense-form").param("search-filters", "expense-filters");
String domain = "self.user.employee.managerUser.employee.managerUser = :_user AND self.company = :_activeCompany AND self.statusSelect = 2";
long nbExpenses = Query.of(Expense.class).filter(domain).bind("_user", user).bind("_activeCompany", activeCompany).count();
if (nbExpenses == 0) {
response.setNotify(I18n.get("No expense to be validated by your subordinates"));
} else {
response.setView(actionView.domain(domain).context("_user", user).context("_activeCompany", activeCompany).map());
}
}
use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class ProjectPlanningTimeController method showPlanning.
public void showPlanning(ActionRequest request, ActionResponse response) {
Context context = request.getContext();
Collection<Map<String, Object>> users = (Collection<Map<String, Object>>) context.get("userSet");
Map<String, Object> project = (Map<String, Object>) context.get("_project");
String userIds = "";
if (users != null) {
for (Map<String, Object> user : users) {
if (userIds.isEmpty()) {
userIds = user.get("id").toString();
} else {
userIds += "," + user.get("id").toString();
}
}
}
String projectId = "";
if (project != null && project.get("id") != null) {
projectId = project.get("id").toString();
}
ActionViewBuilder builder = ActionView.define(I18n.get("Project Planning time")).model(ProjectPlanningTime.class.getName());
String url = "project/planning";
if (!userIds.isEmpty() && !projectId.isEmpty()) {
url += "?userIds=" + userIds + "&projectIds=" + projectId;
} else if (!userIds.isEmpty()) {
url += "?userIds=" + userIds;
} else if (!projectId.isEmpty()) {
url += "?projectIds=" + projectId;
}
builder.add("html", url);
response.setView(builder.map());
response.setCanClose(true);
}
use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class TimesheetController method validateTimesheet.
public void validateTimesheet(ActionRequest request, ActionResponse response) {
User user = AuthUtils.getUser();
Employee employee = user.getEmployee();
ActionViewBuilder actionView = ActionView.define(I18n.get("Timesheets to Validate")).model(Timesheet.class.getName()).add("grid", "timesheet-validate-grid").add("form", "timesheet-form").param("search-filters", "timesheet-filters").context("todayDate", Beans.get(AppBaseService.class).getTodayDate(user.getActiveCompany()));
Beans.get(HRMenuValidateService.class).createValidateDomain(user, employee, actionView);
response.setView(actionView.map());
}
use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class TimesheetController method allTimesheet.
public void allTimesheet(ActionRequest request, ActionResponse response) {
User user = AuthUtils.getUser();
Employee employee = user.getEmployee();
ActionViewBuilder actionView = ActionView.define(I18n.get("Timesheets")).model(Timesheet.class.getName()).add("grid", "all-timesheet-grid").add("form", "timesheet-form").param("search-filters", "timesheet-filters");
if (employee == null || !employee.getHrManager()) {
if (employee == null || employee.getManagerUser() == null) {
actionView.domain("self.user = :_user OR self.user.employee.managerUser = :_user").context("_user", user);
} else {
actionView.domain("self.user.employee.managerUser = :_user").context("_user", user);
}
}
response.setView(actionView.map());
}
Aggregations