Allow cross-store staff selection
This commit is contained in:
@@ -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>>() {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user