Allow cross-store staff selection

This commit is contained in:
2026-04-05 23:58:21 -06:00
parent a3d454e119
commit b70afd66aa
6 changed files with 60 additions and 7 deletions

View File

@@ -121,4 +121,12 @@ public class DropdownApi {
}
return apiClient.getObjectMapper().readValue(response, new TypeReference<List<DropdownOption>>() {});
}
public List<DropdownOption> getEmployees() throws Exception {
String response = apiClient.getRawResponse("/api/v1/dropdowns/employees");
if (response == null || response.isEmpty()) {
throw new IllegalStateException("Empty response from all employees endpoint");
}
return apiClient.getObjectMapper().readValue(response, new TypeReference<List<DropdownOption>>() {});
}
}

View File

@@ -95,7 +95,12 @@ public class AdoptionDialogController {
new Thread(() -> {
try {
Long storeId = UserSession.getInstance().getStoreId();
List<DropdownOption> employees = storeId != null && storeId > 0 ? DropdownApi.getInstance().getStoreEmployees(storeId) : List.of();
List<DropdownOption> employees;
if (storeId != null && storeId > 0) {
employees = DropdownApi.getInstance().getStoreEmployees(storeId);
} else {
employees = DropdownApi.getInstance().getEmployees();
}
Platform.runLater(() -> {
cbEmployee.setItems(FXCollections.observableArrayList(employees));
applySelectedEmployee();

View File

@@ -427,9 +427,12 @@ public class AppointmentDialogController {
new Thread(() -> {
try {
Long storeId = UserSession.getInstance().getStoreId();
List<DropdownOption> employees = storeId != null && storeId > 0
? DropdownApi.getInstance().getStoreEmployees(storeId)
: List.of();
List<DropdownOption> employees;
if (storeId != null && storeId > 0) {
employees = DropdownApi.getInstance().getStoreEmployees(storeId);
} else {
employees = DropdownApi.getInstance().getEmployees();
}
Platform.runLater(() -> {
cbEmployee.setItems(FXCollections.observableArrayList(employees));
applySelectedEmployee();