From b88b680e4e82cfdb4f0ac50ebf41fb690866e17f Mon Sep 17 00:00:00 2001 From: ricardo051199 Date: Thu, 5 Sep 2024 19:54:47 -0400 Subject: [PATCH] #5, #9 Perfil de Personal Administrativo - Cambiar formato de ruta --- .../java/com/primefactorsolutions/views/EmployeeView.java | 6 +++--- .../com/primefactorsolutions/views/EmployeesListView.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/primefactorsolutions/views/EmployeeView.java b/src/main/java/com/primefactorsolutions/views/EmployeeView.java index 36f055e..15b272d 100644 --- a/src/main/java/com/primefactorsolutions/views/EmployeeView.java +++ b/src/main/java/com/primefactorsolutions/views/EmployeeView.java @@ -27,7 +27,7 @@ import java.util.UUID; @PermitAll @Scope("prototype") @PageTitle("Employee") -@Route(value = "/employees/:action?/:employeeId?", layout = MainLayout.class) +@Route(value = "/employees/:employeeId?/:action?", layout = MainLayout.class) public class EmployeeView extends BeanValidationForm implements HasUrlParameter { private static final String SAVE_BUTTON_TEXT = "Save"; @@ -163,9 +163,9 @@ public class EmployeeView extends BeanValidationForm implements HasUrl } @Override - public void setParameter(final BeforeEvent beforeEvent, final String s) { + public void setParameter(final BeforeEvent beforeEvent, final String action) { RouteParameters params = beforeEvent.getRouteParameters(); - String action = params.get("action").orElse("new"); + String s = params.get("employeeId").orElse(null); if ("new".equals(action)) { setEntityWithEnabledSave(new Employee()); diff --git a/src/main/java/com/primefactorsolutions/views/EmployeesListView.java b/src/main/java/com/primefactorsolutions/views/EmployeesListView.java index f1cc6e5..fed246b 100644 --- a/src/main/java/com/primefactorsolutions/views/EmployeesListView.java +++ b/src/main/java/com/primefactorsolutions/views/EmployeesListView.java @@ -68,11 +68,11 @@ public class EmployeesListView extends Main { } private void navigateToEditView(final Employee employee) { - getUI().ifPresent(ui -> ui.navigate(EmployeeView.class, "edit/" + employee.getId().toString())); + getUI().ifPresent(ui -> ui.navigate(EmployeeView.class, employee.getId().toString() + "/edit")); } private void navigateToEmployeeView(final Employee employee) { - getUI().ifPresent(ui -> ui.navigate(EmployeeView.class, "view/" + employee.getId().toString())); + getUI().ifPresent(ui -> ui.navigate(EmployeeView.class, employee.getId().toString() + "/view")); } private void navigateToAddEmployeeView() {