Commit 31fbead5 authored by TJHeeringa's avatar TJHeeringa

Added helper_text to Membertypes on MembershipRequest

parent 7a707d9c
......@@ -114,6 +114,7 @@ const MergeProfiles = ({ profiles, url, refreshSunmemberMe }) => {
<Typography variant={"h4"}>Profile</Typography>
<hr className={"box-title-separator"}/>
<Profile
infoOrForm={"form"}
profile={{}}
container={false}
onSuccess={onProfileCreate}
......
......@@ -96,6 +96,14 @@ const MembershipRequest = ({ onCancel, association, refreshSunmemberMe, preferre
});
};
const chooseable_membertypes = membertypes ? membertypes.filter(membertype=>!membertype.only_chooseable_by_board) : [];
const membertype_helper_text = chooseable_membertypes
.filter(membertype=>membertype.helper_text)
.reduce(
(helper_text, membertype) => helper_text + "\n" + membertype.type + ": " + membertype.helper_text,
""
);
return (
<Block>
<Typography variant={"h5"}>Additional information needed</Typography>
......@@ -123,18 +131,13 @@ const MembershipRequest = ({ onCancel, association, refreshSunmemberMe, preferre
label={"Member type"}
validators={["isTruthy"]}
errorMessages={["This field is required"]}
helperText={membertype_helper_text}
>
{ membertypes ? membertypes.map((membertype, m) => {
if (!membertype.only_chooseable_by_board) {
return (
<MenuItem key={m} value={membertype.url}>
{ membertype.type }
</MenuItem>
);
}
}) : (
<MenuItem value={undefined}> -- </MenuItem>
) }
{ chooseable_membertypes.map((membertype, m) => (
<MenuItem key={m} value={membertype.url}>
{ membertype.type }
</MenuItem>
)) }
</SelectField>
</Wrapper>
{ dataFields && dataFields.map((dataField, d)=>(
......
Markdown is supported
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