@@ -29,7 +29,7 @@ function renderErrors (errors) {
2929 } )
3030}
3131
32- export default function EditTeamForm ( { initialValues, onSubmit, staff, isCreateForm, extraTags = [ ] , profileValues } ) {
32+ export default function EditTeamForm ( { initialValues, onSubmit, staff, isCreateForm, orgTeamTags = [ ] , teamTags = [ ] , profileValues } ) {
3333 if ( profileValues ) {
3434 initialValues . tags = { }
3535 profileValues . forEach ( ( { id, value } ) => {
@@ -42,14 +42,34 @@ export default function EditTeamForm ({ initialValues, onSubmit, staff, isCreate
4242 onSubmit = { onSubmit }
4343 render = { ( { status, isSubmitting, submitForm, values, errors, setFieldValue, setErrors, setStatus } ) => {
4444 let uniqueOrgs
45- let extraFields
45+ let extraOrgTeamFields = [ ]
46+ let extraTeamFields = [ ]
4647 if ( staff && isCreateForm ) {
4748 uniqueOrgs = uniqBy ( prop ( 'organization_id' ) , staff . map ( ( { name, organization_id } ) => {
4849 return { name, organization_id }
4950 } ) )
5051 }
51- if ( extraTags . length > 0 ) {
52- extraFields = extraTags . map ( ( { id, name, required, description } ) => {
52+ if ( orgTeamTags . length > 0 ) {
53+ extraOrgTeamFields = orgTeamTags . map ( ( { id, name, required, description } ) => {
54+ return (
55+ < div className = 'form-control form-control__vertical' key = { `extra-tag-${ id } ` } >
56+ < label htmlFor = { `extra-tag-${ id } ` } > { name }
57+ { required ? < span className = 'form--required' > *</ span > : '' }
58+ { description ? descriptionPopup ( description ) : '' }
59+ </ label >
60+ < Field
61+ type = 'text'
62+ name = { `tags.key-${ id } ` }
63+ required = { required }
64+ value = { values . tags [ `key-${ id } ` ] }
65+ />
66+ </ div >
67+ )
68+ } )
69+ }
70+
71+ if ( teamTags . length > 0 ) {
72+ extraTeamFields = teamTags . map ( ( { id, name, required, description } ) => {
5373 return (
5474 < div className = 'form-control form-control__vertical' key = { `extra-tag-${ id } ` } >
5575 < label htmlFor = { `extra-tag-${ id } ` } > { name }
@@ -112,10 +132,17 @@ export default function EditTeamForm ({ initialValues, onSubmit, staff, isCreate
112132 )
113133 : ''
114134 }
115- { extraTags . length > 0
135+ { extraOrgTeamFields . length > 0
116136 ? < >
117137 < h2 > Org Attributes</ h2 >
118- { extraFields }
138+ { extraOrgTeamFields }
139+ </ >
140+ : ''
141+ }
142+ { extraTeamFields . length > 0
143+ ? < >
144+ < h2 > Other Team Attributes</ h2 >
145+ { extraTeamFields }
119146 </ >
120147 : ''
121148 }
0 commit comments