Commit c9ccb3c8 authored by ras19's avatar ras19
Browse files

Enabled multi-select in add project form, displays full names of all volunteers [RS, EW]

parent e2fa6b65
Pipeline #202332 passed with stage
in 1 minute and 5 seconds
......@@ -32,18 +32,13 @@ const CreateProject = () => {
}
const addUser = (e) => {
// let target = e.target
// let name = target.name
// //here
// let value = Array.from(target.selectedUsers, user => user.value);
// setSelectUsers(value);
// const addUser = (e) => {
// e.preventDefault()
// setSelectUsers(selectUsers.concat(e.target.value))
selectUsers.push(e.target.value)
console.log("A user has been added: " + e.target.value)
console.log("The users are now: " + selectUsers.map((user) => user.firstname))
}
// console.log("A user has been added: " + e.target.value)
// console.log("The users are now: " + selectUsers.map(user => { return user } ))
// }
return (
<div className="create-project">
......@@ -82,8 +77,8 @@ const CreateProject = () => {
<option value="Other">Other</option>
</select>
<label>Volunteers assigned to this project</label>
<select name="selectUsers" multiple={true} onChange={addUser} value={selectUsers} >
{users.map(user => <option value={user.username}>{user.username}</option>)}
<select multiple={true} onChange={(e) => setSelectUsers(selectUsers.concat(e.target.value))} value={selectUsers} >
{users.map(user => <option value={user.username}>{user.firstname} {user.surname}</option>)}
</select>
<label>Google Drive folder</label>
<textarea placeholder="Copy the link to the Google Drive folder for this project" value={files} onChange={(e) => setFiles(e.target.value)}></textarea>
......
......@@ -5,7 +5,7 @@ const MyProfile = () => {
const {username} = useParams();
const history = useHistory();
const {data: user, error, isPending} = useFetch("/users/john34")
const {data: user, error, isPending} = useFetch("/users/rs0409")
return (
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment