fixing dropdowns

This commit is contained in:
Alex
2026-04-08 18:10:18 -06:00
parent 1e37f25a7a
commit ccb0d0dc14
3 changed files with 87 additions and 14 deletions

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@@ -44,6 +45,7 @@ public class DropdownController {
return ResponseEntity.ok(
petRepository.findAll().stream()
.map(p -> new DropdownOption(p.getPetId(), p.getPetName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -64,6 +66,7 @@ public class DropdownController {
return ResponseEntity.ok(
userRepository.findByRoleAndActiveTrue(User.Role.CUSTOMER).stream()
.map(u -> new DropdownOption(u.getId(), u.getFirstName() + " " + u.getLastName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -74,6 +77,7 @@ public class DropdownController {
return ResponseEntity.ok(
userRepository.findByRoleAndActiveTrue(User.Role.CUSTOMER).stream()
.map(u -> new DropdownOption(u.getId(), u.getFirstName() + " " + u.getLastName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -83,6 +87,7 @@ public class DropdownController {
return ResponseEntity.ok(
serviceRepository.findAll().stream()
.map(s -> new DropdownOption(s.getServiceId(), s.getServiceName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -92,6 +97,7 @@ public class DropdownController {
return ResponseEntity.ok(
productRepository.findAll().stream()
.map(p -> new DropdownOption(p.getProdId(), p.getProdName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -101,6 +107,7 @@ public class DropdownController {
return ResponseEntity.ok(
categoryRepository.findAll().stream()
.map(c -> new DropdownOption(c.getCategoryId(), c.getCategoryName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -111,6 +118,7 @@ public class DropdownController {
categoryRepository.findAll().stream()
.filter(c -> "product".equalsIgnoreCase(c.getCategoryType()))
.map(c -> new DropdownOption(c.getCategoryId(), c.getCategoryName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -133,6 +141,7 @@ public class DropdownController {
return ResponseEntity.ok(
storeRepository.findAll().stream()
.map(s -> new DropdownOption(s.getStoreId(), s.getStoreName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -149,6 +158,7 @@ public class DropdownController {
return ResponseEntity.ok(
employees.stream()
.map(u -> new DropdownOption(u.getId(), u.getFirstName() + " " + u.getLastName()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}
@@ -169,6 +179,7 @@ public class DropdownController {
return ResponseEntity.ok(
supplierRepository.findAll().stream()
.map(s -> new DropdownOption(s.getSupId(), s.getSupCompany()))
.sorted(Comparator.comparing(DropdownOption::getLabel, String.CASE_INSENSITIVE_ORDER))
.collect(Collectors.toList())
);
}