diff --git a/frontend/src/components/ValidateRoster.js b/frontend/src/components/ValidateRoster.js index 08770e31..439049f0 100644 --- a/frontend/src/components/ValidateRoster.js +++ b/frontend/src/components/ValidateRoster.js @@ -8,9 +8,12 @@ import { handThumbDown, handThumbUp, noSymbol, + pencil, + plus, shieldCheck, shieldExclamation, - xCircle + xCircle, + xMark } from "solid-heroicons/solid-mini"; import { createEffect, createSignal, For, Match, Show, Switch } from "solid-js"; import { onMount } from "solid-js"; @@ -19,6 +22,149 @@ import { accreditationChoices, matchUpChoices, minAge } from "../constants"; import { useStore } from "../store"; import { fetchUrl, getAge, getLabel } from "../utils"; +const allRoles = [ + "captain", + "spirit captain", + "coach", + "assistant coach", + "admin", + "player" +]; + +const EditPlayerRoles = props => { + let dialogRef; + + const [roles, setRoles] = createSignal(props.registration?.roles); + + const otherRoles = () => allRoles.filter(role => !roles().includes(role)); + + const updatePlayerRoles = async registration => { + console.log( + `person_id: ${registration?.person?.id}, reg_id: ${ + registration?.id + }, roles: ${roles()}` + ); + // const response = await fetch("/api/player/set-roles", { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // "X-CSRFToken": getCookie("csrftoken") + // }, + // credentials: "same-origin", + // body: JSON.stringify({ + // person_id: registration.person.id, + // registration_id: registration.id, + // roles: roles() + // }) + // }); + }; + + return ( + <> + +
+
+
+ Player - + + {props.registration?.person?.first_name}{" "} + {props.registration?.person?.last_name} + +
+ +
+ +
+ +
+
Current roles
+
+ + {role => ( + <> + + {role} + + + + )} + +
+
+ +
+
Other roles
+
+ + {role => ( + <> + + {role} + + + + )} + +
+
+ + +
+
+ + + + ); +}; + const groupByTeam = registrations => { const teamsMap = registrations?.reduce( (acc, r) => ({ ...acc, [r.team.id]: r.team }), @@ -398,6 +544,15 @@ const ValidateRoster = () => { )} > + + + {registration.person.first_name}{" "} {registration.person.last_name} diff --git a/frontend/src/index.css b/frontend/src/index.css index b5c61c95..eb528c86 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -1,3 +1,12 @@ @tailwind base; @tailwind components; @tailwind utilities; + +dialog { + padding: 0; + border-radius: 0.75rem; +} + +::backdrop { + background-color: rgb(55 65 81 / 0.9); +}