- {filteredEmployees.map((employee: any) => {
- const userId = employee.user?.id;
- if (!userId) return null;
- const isAlreadyAdmin = existingAdminIds.includes(userId);
- return (
+
+ {/* Step 1: organization (page org preselected) */}
+
+
+ {isLoadingOrgs ? (
+
+
+
+ ) : (
+
+
+ {orgs.map((org) => (
- );
- })}
- {filteredEmployees.length === 0 && (
-
- {t("orgAdmins.assign.noUsersFound")}
-
- )}
+ ))}
+
+
+ )}
+
+
+ {/* Step 2: unit (or none → org admin) */}
+
+
+ {isLoadingUnits ? (
+
+
-
- )}
+ ) : (
+
+
+
+ {units.map((unit: any) => (
+
+ ))}
+
+
+ )}
+
+
+ {/* Step 3: user */}
+
+
+
setSearch(event.target.value)}
+ placeholder={t("orgAdmins.assign.searchUsers")}
+ />
+ {isLoadingEmployeesByOrg ? (
+
+
+
+ ) : isErrorEmployeesByOrg ? (
+
+ {t("orgAdmins.assign.loadError")}
+
+
+ ) : (
+
+
+ {filteredEmployees.map((employee: any) => {
+ const userId = employee.user?.id;
+ if (!userId) return null;
+ const isAlreadyAdmin = knownAdminIds.includes(userId);
+ return (
+
+ );
+ })}
+ {filteredEmployees.length === 0 && (
+
+ {t("orgAdmins.assign.noUsersFound")}
+
+ )}
+
+
+ )}
+