Skip to content

Commit

Permalink
Add Team belongs to Organization checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
LanesGood committed Jan 19, 2023
1 parent 514d9ff commit 3c7390b
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions src/components/edit-team-form.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useState } from 'react'
import { Formik, Field, Form } from 'formik'
import descriptionPopup from './description-popup'
import urlRegex from 'url-regex'
Expand Down Expand Up @@ -38,6 +38,7 @@ export default function EditTeamForm({
teamTags = [],
profileValues,
}) {
const [orgTeam, setOrgTeam] = useState(false)
if (profileValues) {
initialValues.tags = {}
profileValues.forEach(({ id, value }) => {
Expand Down Expand Up @@ -168,22 +169,32 @@ export default function EditTeamForm({
non-members.
</small>
</div>
{staff && isCreateForm ? (
{staff && isCreateForm && (
<div className='form-control form-control__vertical'>
<label htmlFor='organization'>Add to Organization</label>
<Field as='select' name='organization'>
<option value=''>Select organization</option>
{uniqueOrgs.map(({ organization_id, name }) => {
return (
<option key={organization_id} value={organization_id}>
{name}
</option>
)
})}
</Field>
<label htmlFor='orgTeam-checkbox'>
<input
id='orgTeam-checkbox'
name='orgTeam-checkbox'
type='checkbox'
checked={orgTeam}
style={{ minWidth: '1rem' }}
onChange={(e) => setOrgTeam(e.target.checked)}
/>
This team belongs to an organization
</label>
{orgTeam && (
<Field as='select' name='organization'>
<option value=''>Select organization</option>
{uniqueOrgs.map(({ organization_id, name }) => {
return (
<option key={organization_id} value={organization_id}>
{name}
</option>
)
})}
</Field>
)}
</div>
) : (
''
)}
{extraOrgTeamFields.length > 0 ? (
<>
Expand Down

0 comments on commit 3c7390b

Please sign in to comment.