Skip to content

Commit

Permalink
fix(ApplicationsCard): add option to explicitly switch between extern…
Browse files Browse the repository at this point in the history
…al and internal application
  • Loading branch information
esinx committed Sep 24, 2023
1 parent e54e75f commit 665950c
Showing 1 changed file with 54 additions and 23 deletions.
77 changes: 54 additions & 23 deletions frontend/components/ClubEditPage/ApplicationsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
OBJECT_NAME_SINGULAR,
OBJECT_NAME_TITLE_SINGULAR,
} from '../../utils/branding'
import { Icon, Modal, Text } from '../common'
import { Checkbox, CheckboxLabel, Icon, Modal, Text } from '../common'
import {
ApplicationUpdateTextField,
CheckboxField,
Expand Down Expand Up @@ -203,6 +203,7 @@ export default function ApplicationsCard({ club }: Props): ReactElement {
const [show, setShow] = useState(false)
const showModal = () => setShow(true)
const hideModal = () => setShow(false)
const [isExternal, setIsExternal] = useState(false)
const [applicationName, setApplicationName] = useState('')
const [committees, setCommittees] = useState<{
label: string
Expand Down Expand Up @@ -346,34 +347,64 @@ export default function ApplicationsCard({ club }: Props): ReactElement {
club.is_wharton ? 'Read-only.' : ''
}`}
/>
<Field
name="external_url"
as={TextField}
type="url"
helpText={`The external URL where students can apply for your ${OBJECT_NAME_SINGULAR}.`}
/>
<Field
name="committees"
as={CreatableMultipleSelectField}
initialValues={committees}
helpText={`If your ${OBJECT_NAME_SINGULAR} has multiple committees to which students can apply, list them here. NOTE: you won't be able to edit this field after applications open.`}
/>
<Field
name="acceptance_email"
as={ApplicationUpdateTextField}
initialValues={
"<html> <body> <p> Congratulations {{ name }}! You've been accepted to {{ committee }} because {{reason}}! </p> </body> </html>"
}
helpText={`Acceptance email for your ${OBJECT_NAME_SINGULAR}.`}
/>
<Field
name="rejection_email"
as={ApplicationUpdateTextField}
initialValues={
"<html> <body> <p> Sorry {{ name }}, You've been rejected because {{ reason }}! </p> </body> </html>"
}
helpText={`Rejection email for your ${OBJECT_NAME_SINGULAR}.`}
/>

<div className="field is-horizontal">
<div className="field-label">
<label className="label">Use External Application?</label>
</div>
<div className="field-body">
<div className="field">
<div className="control">
<Checkbox
id="is_external"
checked={isExternal}
onChange={() => setIsExternal(!isExternal)}
/>
<CheckboxLabel
htmlFor="is_external"
style={{
marginLeft: '8px',
}}
>
Make this an external application
</CheckboxLabel>
</div>
</div>
</div>
</div>
{isExternal ? (
<Field
name="external_url"
as={TextField}
type="url"
helpText={`The external URL where students can apply for your ${OBJECT_NAME_SINGULAR}.`}
/>
) : (
<>
<Field
name="acceptance_email"
as={ApplicationUpdateTextField}
initialValues={
"<html> <body> <p> Congratulations {{ name }}! You've been accepted to {{ committee }} because {{reason}}! </p> </body> </html>"
}
helpText={`Acceptance email for your ${OBJECT_NAME_SINGULAR}.`}
/>
<Field
name="rejection_email"
as={ApplicationUpdateTextField}
initialValues={
"<html> <body> <p> Sorry {{ name }}, You've been rejected because {{ reason }}! </p> </body> </html>"
}
helpText={`Rejection email for your ${OBJECT_NAME_SINGULAR}.`}
/>
</>
)}
</>
}
confirmDeletion={true}
Expand Down

0 comments on commit 665950c

Please sign in to comment.