diff --git a/package.json b/package.json index 209a580..18cb231 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "type": "module", "dependencies": { "@f0rce/ace-widget": "1.0.2", - "@polymer/polymer": "3.5.2", + "@polymer/polymer": "3.5.1", "@vaadin-component-factory/vcf-pdf-viewer": "2.0.1", "@vaadin/bundles": "24.5.1", "@vaadin/common-frontend": "0.0.19", @@ -19,30 +19,30 @@ "@vaadin/vaadin-usage-statistics": "2.1.3", "construct-style-sheets-polyfill": "3.1.0", "date-fns": "2.29.3", - "lit": "3.2.1", + "lit": "3.1.4", "print-js": "1.6.0", "proj4": "2.12.1", "react": "18.3.1", "react-dom": "18.3.1", - "react-router-dom": "6.26.2" + "react-router-dom": "6.23.1" }, "devDependencies": { - "@babel/preset-react": "7.25.7", + "@babel/preset-react": "7.24.7", "@preact/signals-react-transform": "0.4.0", - "@rollup/plugin-replace": "6.0.1", - "@rollup/pluginutils": "5.1.2", - "@types/react": "18.3.11", - "@types/react-dom": "18.3.1", - "@vitejs/plugin-react": "4.3.3", - "async": "3.2.6", - "glob": "10.4.5", + "@rollup/plugin-replace": "5.0.7", + "@rollup/pluginutils": "5.1.0", + "@types/react": "18.3.3", + "@types/react-dom": "18.3.0", + "@vitejs/plugin-react": "4.3.1", + "async": "3.2.5", + "glob": "10.4.1", "rollup-plugin-brotli": "3.1.0", "rollup-plugin-visualizer": "5.12.0", "strip-css-comments": "5.0.0", "transform-ast": "2.4.4", - "typescript": "5.6.3", - "vite": "5.4.9", - "vite-plugin-checker": "0.8.0", + "typescript": "5.4.5", + "vite": "5.3.3", + "vite-plugin-checker": "0.6.4", "workbox-build": "7.1.1", "workbox-core": "7.1.0", "workbox-precaching": "7.1.0" @@ -50,7 +50,7 @@ "vaadin": { "dependencies": { "@f0rce/ace-widget": "1.0.2", - "@polymer/polymer": "3.5.2", + "@polymer/polymer": "3.5.1", "@vaadin-component-factory/vcf-pdf-viewer": "2.0.1", "@vaadin/bundles": "24.5.1", "@vaadin/common-frontend": "0.0.19", @@ -65,30 +65,30 @@ "@vaadin/vaadin-usage-statistics": "2.1.3", "construct-style-sheets-polyfill": "3.1.0", "date-fns": "2.29.3", - "lit": "3.2.1", + "lit": "3.1.4", "print-js": "1.6.0", "proj4": "2.12.1", "react": "18.3.1", "react-dom": "18.3.1", - "react-router-dom": "6.26.2" + "react-router-dom": "6.23.1" }, "devDependencies": { - "@babel/preset-react": "7.25.7", + "@babel/preset-react": "7.24.7", "@preact/signals-react-transform": "0.4.0", - "@rollup/plugin-replace": "6.0.1", - "@rollup/pluginutils": "5.1.2", - "@types/react": "18.3.11", - "@types/react-dom": "18.3.1", - "@vitejs/plugin-react": "4.3.3", - "async": "3.2.6", - "glob": "10.4.5", + "@rollup/plugin-replace": "5.0.7", + "@rollup/pluginutils": "5.1.0", + "@types/react": "18.3.3", + "@types/react-dom": "18.3.0", + "@vitejs/plugin-react": "4.3.1", + "async": "3.2.5", + "glob": "10.4.1", "rollup-plugin-brotli": "3.1.0", "rollup-plugin-visualizer": "5.12.0", "strip-css-comments": "5.0.0", "transform-ast": "2.4.4", - "typescript": "5.6.3", - "vite": "5.4.9", - "vite-plugin-checker": "0.8.0", + "typescript": "5.4.5", + "vite": "5.3.3", + "vite-plugin-checker": "0.6.4", "workbox-build": "7.1.1", "workbox-core": "7.1.0", "workbox-precaching": "7.1.0" diff --git a/src/main/java/com/primefactorsolutions/views/RequestRegisterView.java b/src/main/java/com/primefactorsolutions/views/RequestRegisterView.java index 6551bd3..4d56f10 100644 --- a/src/main/java/com/primefactorsolutions/views/RequestRegisterView.java +++ b/src/main/java/com/primefactorsolutions/views/RequestRegisterView.java @@ -137,6 +137,7 @@ public class RequestRegisterView extends VerticalLayout { .filter(category -> isCategoryAllowedByGender(category, employee.getGender())) .filter(category -> category != TimeOffRequestType.TODOS) .filter(category -> shouldIncludeVacationGestionActual(employeeRequests, category)) + .filter(category -> shouldIncludeVacationGestionAnterior(employeeRequests, category)) .toList(); categoryComboBox.setItems(availableCategories); @@ -154,6 +155,16 @@ public class RequestRegisterView extends VerticalLayout { && request.getState() == TimeOffRequestStatus.TOMADO); } + private boolean shouldIncludeVacationGestionAnterior(final List employeeRequests, + final TimeOffRequestType category) { + if (category != TimeOffRequestType.VACACION_GESTION_ANTERIOR) { + return true; + } + return employeeRequests.stream() + .noneMatch(request -> request.getCategory() == TimeOffRequestType.VACACION_GESTION_ANTERIOR + && request.getDaysBalance() == 0); + } + private void onCategoryChange(final TimeOffRequestType selectedCategory) { if (selectedCategory == TimeOffRequestType.VACACION_GESTION_ACTUAL || selectedCategory == TimeOffRequestType.VACACION_GESTION_ANTERIOR) {