ENCOA-274

This commit is contained in:
Carlos-Mesquita
2024-12-11 15:28:38 +00:00
parent 7538392e44
commit efba1939e5
12 changed files with 344 additions and 130 deletions

View File

@@ -185,12 +185,12 @@ export default function BatchCreateUser({ user, entities = [], permissions, onFi
if (!confirm(`You are about to ${[newUsersSentence, existingUsersSentence].filter((x) => !!x).join(" and ")}, are you sure you want to continue?`))
return;
/*Promise.all(duplicatedUsers.map(async (u) => await axios.post(`/api/invites`, {to: u.id, entity, from: user.id})))
.then(() => toast.success(`Successfully invited ${duplicatedUsers.length} registered student(s)!`))
Promise.all(newUsers.map(async (u) => await axios.post(`/api/invites`, {to: u.id, entity, from: user.id})))
.then(() => toast.success(`Successfully invited ${newUsers.length} registered student(s)!`))
.finally(() => {
if (newUsers.length === 0) setIsLoading(false);
});
*/
if (newUsers.length > 0) {
setIsLoading(true);
@@ -392,6 +392,7 @@ export default function BatchCreateUser({ user, entities = [], permissions, onFi
<UserTable users={duplicatedUsers} />
</div>
)}
{(duplicatedUsers.length !== 0 && newUsers.length === 0) && <span className="text-red-500 font-bold">The imported .csv only contains duplicated users!</span>}
<Button className="my-auto mt-4" onClick={makeUsers} disabled={newUsers.length === 0}>
Create {newUsers.length !== 0 ? `${newUsers.length} New Users` : ''}
</Button>