diff --git a/src/main/bundles/prod.bundle b/src/main/bundles/prod.bundle index beeca76..cf0e708 100644 Binary files a/src/main/bundles/prod.bundle and b/src/main/bundles/prod.bundle differ diff --git a/src/main/java/com/primefactorsolutions/views/DocumentsListView.java b/src/main/java/com/primefactorsolutions/views/DocumentsListView.java index ed9d4a5..790a4ff 100644 --- a/src/main/java/com/primefactorsolutions/views/DocumentsListView.java +++ b/src/main/java/com/primefactorsolutions/views/DocumentsListView.java @@ -1,5 +1,6 @@ package com.primefactorsolutions.views; +import com.google.common.collect.Lists; import com.primefactorsolutions.model.Document; import com.primefactorsolutions.model.DocumentType; import com.primefactorsolutions.model.Employee; @@ -132,8 +133,20 @@ public class DocumentsListView extends BaseView { employeeFilter = new ComboBox<>("Empleado"); employeeFilter.setPlaceholder("Seleccionar ..."); employeeFilter.setClearButtonVisible(true); - List employees = employeeService.findAllEmployees(); - employeeFilter.setItems(employees); + + final List employees; + + if (isRoleAdmin()) { + employees = employeeService.findAllEmployees(); + employeeFilter.setItems(employees); + } else { + Employee employee = employeeService.getEmployee(getEmployeeId().get()); + employees = Lists.newArrayList(employee); + employeeFilter.setItems(employees); + employeeFilter.setValue(employees.getFirst()); + employeeFilter.setReadOnly(true); + } + employeeFilter.setItemLabelGenerator(this::getEmployeeLabel); employeeFilter.addValueChangeListener(event -> { updateDocumentGrid(documentTypeFilter.getValue(), event.getValue()); diff --git a/src/main/java/com/primefactorsolutions/views/EmployeeView.java b/src/main/java/com/primefactorsolutions/views/EmployeeView.java index 20ff9ef..89274ac 100644 --- a/src/main/java/com/primefactorsolutions/views/EmployeeView.java +++ b/src/main/java/com/primefactorsolutions/views/EmployeeView.java @@ -32,11 +32,11 @@ import com.vaadin.flow.data.value.ValueChangeMode; import com.vaadin.flow.router.*; import com.vaadin.flow.server.StreamResource; import com.vaadin.flow.spring.annotation.SpringComponent; +import com.vaadin.flow.spring.security.AuthenticationContext; import jakarta.annotation.security.PermitAll; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Scope; import org.vaadin.firitin.components.datepicker.VDatePicker; -import org.vaadin.firitin.form.BeanValidationForm; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -54,7 +54,7 @@ import java.util.UUID; @PageTitle("Employee") @Route(value = "/employees/:employeeId?/:action?", layout = MainLayout.class) @Slf4j -public class EmployeeView extends BeanValidationForm implements HasUrlParameter { +public class EmployeeView extends BaseEntityForm implements HasUrlParameter { private final EmployeeService employeeService; private final ReportService reportService; private final TimeOffRequestService requestService; @@ -123,13 +123,9 @@ public class EmployeeView extends BeanValidationForm implements HasUrl private final TextField sss = createTextField("Matricula de Asegurado (SSS)", 30, false); private final TextField beneficiarie1 = createTextField("Derechohabiente 1", 30, false); private final TextField beneficiarie2 = createTextField("Derechohabiente 2", 30, false); - private static final String SAVE_BUTTON_TEXT = "Save"; - private static final String EDIT_BUTTON_TEXT = "Edit"; private static final String NOTIFICATION_SAVE_SUCCESS = "Employee saved successfully."; private static final String NOTIFICATION_VALIDATE_ERROR = "Please complete the required fields correctly."; private static final String PHONE_NUMBER_ERROR_MESSAGE = "El teléfono debe contener solo números."; - private final Button saveButton = new Button(SAVE_BUTTON_TEXT, e -> saveEmployee()); - private final Button editButton = new Button(EDIT_BUTTON_TEXT, e -> enableEditMode()); private final Button reportButton = new Button("Generar Ficha de Contratación"); private final Dialog dialog = new Dialog(); private final PdfViewer pdfViewer = new PdfViewer(); @@ -149,16 +145,16 @@ public class EmployeeView extends BeanValidationForm implements HasUrl private final H3 datBanc = new H3("Datos Bancarios"); private final H3 datGest = new H3("Datos Gestora Pública y Seguro Social"); - public EmployeeView(final EmployeeService employeeService, + public EmployeeView(final AuthenticationContext authenticationContext, + final EmployeeService employeeService, final ReportService reportService, final TeamService teamService, final TimeOffRequestService requestService) { - super(Employee.class); + super(authenticationContext, Employee.class); this.employeeService = employeeService; this.reportService = reportService; this.requestService = requestService; this.teamService = teamService; - saveButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY); excelReportButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY); configureComponents(); addClassName("main-layout"); @@ -167,6 +163,7 @@ public class EmployeeView extends BeanValidationForm implements HasUrl ui.navigate(EmployeeReportView.class, getEntity().getId().toString()) ) ); + setSavedHandler(e -> saveEmployee(e)); } private void makeUpperCase(final TextField textField) { @@ -189,8 +186,6 @@ public class EmployeeView extends BeanValidationForm implements HasUrl lastName.addValueChangeListener(e -> validateNameField(lastName, e.getValue())); createTeamComboBox(); configureUpload(); - saveButton.setVisible(true); - editButton.setVisible(true); reportButton.setVisible(true); birthday.addValueChangeListener(event -> calculateAge()); birthday.setMin(LocalDate.now().minusYears(100)); @@ -456,14 +451,6 @@ public class EmployeeView extends BeanValidationForm implements HasUrl team.setWidthFull(); } - private ComboBox createComboBox(final String label, final T[] items) { - ComboBox comboBox = new ComboBox<>(label); - comboBox.setItems(items); - comboBox.setItemLabelGenerator(Object::toString); - comboBox.setWidthFull(); - return comboBox; - } - private ComboBox createGenderComboBox() { ComboBox comboBox = new ComboBox<>("Genero"); comboBox.setItems(Employee.Gender.values()); @@ -496,9 +483,8 @@ public class EmployeeView extends BeanValidationForm implements HasUrl } } - private void saveEmployee() { + private void saveEmployee(final Employee employee) { if (validateForm()) { - Employee employee = getEntity(); employee.setStatus(status.getValue()); employee.setAge(age.getValue()); employee.setSalaryBasic(salaryBasic.getValue()); @@ -521,39 +507,39 @@ public class EmployeeView extends BeanValidationForm implements HasUrl private void enableEditMode() { setFieldsEditable(); - saveButton.setVisible(true); - editButton.setVisible(false); } @Override public void setParameter(final BeforeEvent beforeEvent, final String action) { final RouteParameters params = beforeEvent.getRouteParameters(); final String s = params.get("employeeId").orElse(null); + if ("new".equals(action)) { setEntityWithEnabledSave(new Employee()); - saveButton.setVisible(true); - editButton.setVisible(false); setFieldsEditable(); upload.setVisible(true); profileImagePreview.setVisible(true); salaryTotal.setValue(BigDecimal.valueOf(0.0)); } else { - UUID employeeId = UUID.fromString(s); - var employee = employeeService.getEmployee(employeeId); - setEntityWithEnabledSave(employee); - if ("edit".equals(action) && !s.isEmpty()) { - saveButton.setVisible(true); - editButton.setVisible(false); + Employee employee = null; + + if (s != null) { + final UUID employeeId = UUID.fromString(s); + employee = employeeService.getEmployee(employeeId); + } else { + employee = employeeService.getEmployee(getEmployeeId().get()); + } + + if ("edit".equals(action)) { + setEntityWithEnabledSave(employee); status.setValue(employee.getStatus()); setFieldsEditable(); upload.setVisible(true); displayProfileImage(employee); profileImagePreview.setVisible(true); salaryTotal.setValue(employee.getSalaryTotal()); - } else if ("view".equals(action) && !s.isEmpty()) { - setFieldsReadOnly(); - saveButton.setVisible(false); - editButton.setVisible(true); + } else if ("view".equals(action) || "me".equals(action)) { + setEntity(employee); setFieldsReadOnly(); displayProfileImage(employee); salaryTotal.setValue(employee.getSalaryTotal()); @@ -701,6 +687,7 @@ public class EmployeeView extends BeanValidationForm implements HasUrl @Override protected List getFormComponents() { return List.of( + new HorizontalLayout(reportButton, excelReportButton), username, infoPer, infoGenr, @@ -724,7 +711,7 @@ public class EmployeeView extends BeanValidationForm implements HasUrl salaryBasic, professionalBonus, tenureBonus, salaryTotal, datBanc, bankName, accountNumber, datGest, gpss, sss, beneficiarie1, beneficiarie2, - saveButton, editButton, reportButton, excelReportButton, dialog + dialog ); } } \ No newline at end of file diff --git a/src/main/java/com/primefactorsolutions/views/MainLayout.java b/src/main/java/com/primefactorsolutions/views/MainLayout.java index d082442..58b1afd 100644 --- a/src/main/java/com/primefactorsolutions/views/MainLayout.java +++ b/src/main/java/com/primefactorsolutions/views/MainLayout.java @@ -175,7 +175,13 @@ public class MainLayout extends AppLayout { final SideNavItem profile = new SideNavItem("Employee"); profile.setPrefixComponent(LineAwesomeIcon.USER_TIE_SOLID.create()); - profile.addItem(new SideNavItem("Profiles", EmployeesListView.class, + + if (isAdmin(authContext)) { + profile.addItem(new SideNavItem("Profiles", EmployeesListView.class, + LineAwesomeIcon.USER_FRIENDS_SOLID.create())); + } + + profile.addItem(new SideNavItem("My Profile", "/employees/me", LineAwesomeIcon.USER_EDIT_SOLID.create())); profile.addItem(new SideNavItem("Documents", DocumentsListView.class, LineAwesomeIcon.FILE_ALT_SOLID.create())); diff --git a/src/main/java/com/primefactorsolutions/views/admin/TimeOffView.java b/src/main/java/com/primefactorsolutions/views/admin/TimeOffView.java index ce6401a..7999743 100644 --- a/src/main/java/com/primefactorsolutions/views/admin/TimeOffView.java +++ b/src/main/java/com/primefactorsolutions/views/admin/TimeOffView.java @@ -3,29 +3,29 @@ package com.primefactorsolutions.views.admin; import com.primefactorsolutions.model.TimeOff; import com.primefactorsolutions.model.TimeOffRequestType; import com.primefactorsolutions.service.TimeOffService; +import com.primefactorsolutions.views.BaseEntityForm; import com.primefactorsolutions.views.MainLayout; import com.vaadin.flow.component.Component; import com.vaadin.flow.component.combobox.ComboBox; import com.vaadin.flow.component.textfield.NumberField; import com.vaadin.flow.router.*; import com.vaadin.flow.spring.annotation.SpringComponent; +import com.vaadin.flow.spring.security.AuthenticationContext; import jakarta.annotation.security.PermitAll; import org.springframework.context.annotation.Scope; import org.vaadin.firitin.components.datepicker.VDatePicker; -import org.vaadin.firitin.form.BeanValidationForm; import java.time.LocalDate; import java.time.YearMonth; import java.util.List; import java.util.UUID; -@SuppressWarnings("deprecation") @SpringComponent @PermitAll @Scope("prototype") @PageTitle("Vacaciones") @Route(value = "/time-off/:hours-workedId?/:action?", layout = MainLayout.class) -public class TimeOffView extends BeanValidationForm implements HasUrlParameter { +public class TimeOffView extends BaseEntityForm implements HasUrlParameter { private final ComboBox category = new ComboBox<>("Categoria"); private final ComboBox type = new ComboBox<>("Tipo"); private final VDatePicker date = new VDatePicker("Fecha"); @@ -34,8 +34,9 @@ public class TimeOffView extends BeanValidationForm implements HasUrlPa private final TimeOffService timeOffService; - public TimeOffView(final TimeOffService timeOffService) { - super(TimeOff.class); + public TimeOffView(final AuthenticationContext authenticationContext, + final TimeOffService timeOffService) { + super(authenticationContext, TimeOff.class); this.timeOffService = timeOffService; initializeDateField(); @@ -60,11 +61,11 @@ public class TimeOffView extends BeanValidationForm implements HasUrlPa setEntityWithEnabledSave(timeOff); } else if ("view".equals(action) && !s.isEmpty()) { setEntity(timeOff); - duration.setEnabled(false); - expiration.setEnabled(false); - category.setEnabled(false); - type.setEnabled(false); - date.setEnabled(false); + duration.setReadOnly(true); + expiration.setReadOnly(true); + category.setReadOnly(true); + type.setReadOnly(true); + date.setReadOnly(true); } } } diff --git a/src/main/java/com/primefactorsolutions/views/assessment/CandidateView.java b/src/main/java/com/primefactorsolutions/views/assessment/CandidateView.java index 9b275f3..474beb5 100644 --- a/src/main/java/com/primefactorsolutions/views/assessment/CandidateView.java +++ b/src/main/java/com/primefactorsolutions/views/assessment/CandidateView.java @@ -2,6 +2,7 @@ package com.primefactorsolutions.views.assessment; import com.primefactorsolutions.model.Candidate; import com.primefactorsolutions.service.CandidateService; +import com.primefactorsolutions.views.BaseEntityForm; import com.primefactorsolutions.views.MainLayout; import com.vaadin.flow.component.Component; import com.vaadin.flow.component.textfield.EmailField; @@ -10,10 +11,10 @@ import com.vaadin.flow.router.HasUrlParameter; import com.vaadin.flow.router.PageTitle; import com.vaadin.flow.router.Route; import com.vaadin.flow.spring.annotation.SpringComponent; +import com.vaadin.flow.spring.security.AuthenticationContext; import jakarta.annotation.security.PermitAll; import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Scope; -import org.vaadin.firitin.form.BeanValidationForm; import java.util.List; import java.util.UUID; @@ -23,13 +24,14 @@ import java.util.UUID; @PageTitle("Assessments") @Route(value = "/candidates", layout = MainLayout.class) @PermitAll -public class CandidateView extends BeanValidationForm implements HasUrlParameter { +public class CandidateView extends BaseEntityForm implements HasUrlParameter { private final CandidateService candidateService; private EmailField email = null; - public CandidateView(final CandidateService candidateService) { - super(Candidate.class); + public CandidateView(final AuthenticationContext authenticationContext, + final CandidateService candidateService) { + super(authenticationContext, Candidate.class); this.candidateService = candidateService; email = new EmailField(); email.setWidthFull(); diff --git a/src/main/java/com/primefactorsolutions/views/assessment/QuestionView.java b/src/main/java/com/primefactorsolutions/views/assessment/QuestionView.java index 1e5fabf..5496c20 100644 --- a/src/main/java/com/primefactorsolutions/views/assessment/QuestionView.java +++ b/src/main/java/com/primefactorsolutions/views/assessment/QuestionView.java @@ -2,6 +2,7 @@ package com.primefactorsolutions.views.assessment; import com.primefactorsolutions.model.Question; import com.primefactorsolutions.service.QuestionService; +import com.primefactorsolutions.views.BaseEntityForm; import com.primefactorsolutions.views.MainLayout; import com.vaadin.flow.component.Component; import com.vaadin.flow.component.textfield.IntegerField; @@ -9,10 +10,10 @@ import com.vaadin.flow.component.textfield.TextArea; import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.router.*; import com.vaadin.flow.spring.annotation.SpringComponent; +import com.vaadin.flow.spring.security.AuthenticationContext; import jakarta.annotation.security.PermitAll; import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Scope; -import org.vaadin.firitin.form.BeanValidationForm; import java.util.List; import java.util.UUID; @@ -22,7 +23,7 @@ import java.util.UUID; @PageTitle("Assessments") @Route(value = "/questions", layout = MainLayout.class) @PermitAll -public class QuestionView extends BeanValidationForm implements HasUrlParameter { +public class QuestionView extends BaseEntityForm implements HasUrlParameter { private final QuestionService questionService; private TextField title = null; @@ -30,8 +31,9 @@ public class QuestionView extends BeanValidationForm implements HasUrl private TextArea content = null; private IntegerField timeMinutes = null; - public QuestionView(final QuestionService questionService) { - super(Question.class); + public QuestionView(final AuthenticationContext authenticationContext, + final QuestionService questionService) { + super(authenticationContext, Question.class); this.questionService = questionService; title = new TextField(); title.setWidthFull(); diff --git a/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffRequestView.java b/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffRequestView.java index daa97f1..d7771a6 100644 --- a/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffRequestView.java +++ b/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffRequestView.java @@ -166,11 +166,11 @@ public class TimeOffRequestView extends BaseEntityForm implement private void onCategoryChange(final TimeOffRequestType selectedCategory) { if (selectedCategory == TimeOffRequestType.VACACION_GESTION_ACTUAL || selectedCategory == TimeOffRequestType.VACACION_GESTION_ANTERIOR) { - startDate.setEnabled(true); - endDate.setEnabled(true); + startDate.setReadOnly(false); + endDate.setReadOnly(false); } else { - startDate.setEnabled(true); - endDate.setEnabled(false); + startDate.setReadOnly(false); + endDate.setReadOnly(true); } } diff --git a/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffRequestsListView.java b/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffRequestsListView.java index 527efe4..f80da09 100644 --- a/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffRequestsListView.java +++ b/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffRequestsListView.java @@ -56,9 +56,9 @@ public class TimeOffRequestsListView extends BaseView { private final EmployeeService employeeService; private final TeamService teamService; private final PagingGrid requestsGrid = new PagingGrid<>(); - private ComboBox employeeFilter; - private ComboBox teamFilter; - private ComboBox categoryFilter; + private final ComboBox employeeFilter = new ComboBox<>("Empleado"); + private final ComboBox teamFilter = new ComboBox<>("Equipo"); + private final ComboBox categoryFilter = new ComboBox<>("Categoría"); public TimeOffRequestsListView(final AuthenticationContext authenticationContext, final TimeOffRequestService requestService, @@ -69,14 +69,20 @@ public class TimeOffRequestsListView extends BaseView { this.employeeService = employeeService; this.teamService = teamService; initializeView(); - refreshGeneralRequestsGrid(null, null, null); + refreshGeneralRequestsGrid(employeeFilter.getValue(), teamFilter.getValue(), categoryFilter.getValue()); } private void initializeView() { final Button newRequestButton = new Button("Crear nueva peticion", event -> navigateToAddNew()); newRequestButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY); - final Button downloadReportButton = new Button("Descargar reporte de rechazos", event -> downloadReport()); - final HorizontalLayout hl = new HorizontalLayout(newRequestButton, downloadReportButton); + + final HorizontalLayout hl = new HorizontalLayout(newRequestButton); + + if (isRoleAdmin()) { + final Button downloadReportButton = new Button("Descargar reporte de rechazos", event -> downloadReport()); + hl.add(downloadReportButton); + } + getCurrentPageLayout().add(hl); setupFilters(); setupRequestsGrid(); @@ -188,12 +194,19 @@ public class TimeOffRequestsListView extends BaseView { } private ComboBox createEmployeeFilter() { - employeeFilter = new ComboBox<>("Empleado"); employeeFilter.setClearButtonVisible(true); employeeFilter.setPlaceholder("Seleccionar ..."); - final List employees = new ArrayList<>(employeeService.findAllEmployees()); - employeeFilter.setItems(employees); + if (isRoleAdmin()) { + final List employees = employeeService.findAllEmployees(); + employeeFilter.setItems(employees); + } else { + final Employee employee = employeeService.getEmployee(getEmployeeId().get()); + employeeFilter.setItems(List.of(employee)); + employeeFilter.setValue(employee); + employeeFilter.setReadOnly(true); + } + employeeFilter.setItemLabelGenerator(this::getEmployeeFullNameLabel); employeeFilter.addValueChangeListener(event -> refreshGeneralRequestsGrid( @@ -206,7 +219,6 @@ public class TimeOffRequestsListView extends BaseView { } private ComboBox createTeamFilter() { - teamFilter = new ComboBox<>("Equipo"); teamFilter.setClearButtonVisible(true); teamFilter.setPlaceholder("Seleccionar ..."); final List teams = new ArrayList<>(teamService.findAllTeams()); @@ -223,7 +235,6 @@ public class TimeOffRequestsListView extends BaseView { } private ComboBox createCategoryFilter() { - categoryFilter = new ComboBox<>("Categoría"); categoryFilter.setPlaceholder("Seleccionar ..."); categoryFilter.setClearButtonVisible(true); categoryFilter.setItems(TimeOffRequestType.values()); diff --git a/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffSummaryListView.java b/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffSummaryListView.java index 38acd93..517b82a 100644 --- a/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffSummaryListView.java +++ b/src/main/java/com/primefactorsolutions/views/timeoff/TimeOffSummaryListView.java @@ -52,8 +52,8 @@ public class TimeOffSummaryListView extends BaseView { private final TeamService teamService; private final TimeOffService timeOffService; private final PagingGrid requestGrid = new PagingGrid<>(); - private ComboBox employeeFilter; - private ComboBox teamFilter; + private final ComboBox employeeFilter = new ComboBox<>("Empleado");; + private final ComboBox teamFilter = new ComboBox<>("Equipo"); public TimeOffSummaryListView( final AuthenticationContext authenticationContext, @@ -67,7 +67,7 @@ public class TimeOffSummaryListView extends BaseView { this.teamService = teamService; this.timeOffService = timeOffService; initializeView(); - refreshGeneralRequestGrid(null, null); + refreshGeneralRequestGrid(employeeFilter.getValue(), teamFilter.getValue()); } private void initializeView() { @@ -334,12 +334,19 @@ public class TimeOffSummaryListView extends BaseView { } private ComboBox createEmployeeFilter() { - employeeFilter = new ComboBox<>("Empleado"); - - final List employees = new ArrayList<>(employeeService.findAllEmployees()); employeeFilter.setPlaceholder("Seleccionar ..."); employeeFilter.setClearButtonVisible(true); - employeeFilter.setItems(employees); + + if (isRoleAdmin()) { + final List employees = new ArrayList<>(employeeService.findAllEmployees()); + employeeFilter.setItems(employees); + } else { + final Employee employee = employeeService.getEmployee(getEmployeeId().get()); + employeeFilter.setItems(List.of(employee)); + employeeFilter.setValue(employee); + employeeFilter.setReadOnly(true); + } + employeeFilter.setItemLabelGenerator(this::getEmployeeFullName); employeeFilter.addValueChangeListener(event -> refreshGeneralRequestGrid( @@ -352,7 +359,6 @@ public class TimeOffSummaryListView extends BaseView { } private ComboBox createTeamFilter() { - teamFilter = new ComboBox<>("Equipo"); teamFilter.setPlaceholder("Seleccionar ..."); teamFilter.setClearButtonVisible(true); final List teams = new ArrayList<>(teamService.findAllTeams()); diff --git a/src/main/java/com/primefactorsolutions/views/timesheet/TimesheetEntryView.java b/src/main/java/com/primefactorsolutions/views/timesheet/TimesheetEntryView.java index 84bb945..83ecaaf 100644 --- a/src/main/java/com/primefactorsolutions/views/timesheet/TimesheetEntryView.java +++ b/src/main/java/com/primefactorsolutions/views/timesheet/TimesheetEntryView.java @@ -79,12 +79,12 @@ public class TimesheetEntryView extends BaseEntityForm implement setEntityWithEnabledSave(timesheetEntry); } else if ("view".equals(action) && !s.isEmpty()) { setEntity(timesheetEntry); - employee.setEnabled(false); - team.setEnabled(false); - task.setEnabled(false); - details.setEnabled(false); - date.setEnabled(false); - hours.setEnabled(false); + employee.setReadOnly(true); + team.setReadOnly(true); + task.setReadOnly(true); + details.setReadOnly(true); + date.setReadOnly(true); + hours.setReadOnly(true); } } } diff --git a/src/main/java/com/primefactorsolutions/views/timesheet/TimesheetListView.java b/src/main/java/com/primefactorsolutions/views/timesheet/TimesheetListView.java index 8442108..0b2c206 100644 --- a/src/main/java/com/primefactorsolutions/views/timesheet/TimesheetListView.java +++ b/src/main/java/com/primefactorsolutions/views/timesheet/TimesheetListView.java @@ -182,7 +182,7 @@ public class TimesheetListView extends BaseView { List employees = new ArrayList<>(employeeService.findAllEmployees()); if (!isRoleAdmin()) { - employeeFilter.setEnabled(false); + employeeFilter.setReadOnly(true); employees = employees.stream() .filter(e -> getEmployeeId().equals(Optional.ofNullable(e.getId()))) .toList();