-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Export Win - Support Provided (step 5 of 6) (#6462)
- Loading branch information
Showing
4 changed files
with
201 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 74 additions & 17 deletions
91
src/client/modules/ExportWins/Form/SupportProvidedStep.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,80 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import { H3 } from '@govuk-react/heading' | ||
|
||
import { useFormContext } from '../../../components/Form/hooks' | ||
import { Step, FieldInput } from '../../../components' | ||
import ResourceOptionsField from '../../../components/Form/elements/ResourceOptionsField' | ||
import { Step, FieldTypeahead, FieldCheckboxes } from '../../../components' | ||
import { OPTION_YES } from '../../../../common/constants' | ||
import { StyledHintParagraph } from './styled' | ||
import { steps } from './constants' | ||
import { | ||
HvcResource, | ||
SupportTypeResource, | ||
AssociatedProgrammeResource, | ||
} from '../../../components/Resource' | ||
|
||
const StyledFieldInput = styled(FieldInput)({ | ||
display: 'none', | ||
}) | ||
|
||
const SupportProvidedStep = () => { | ||
// eslint-disable-next-line no-unused-vars | ||
const { values } = useFormContext() | ||
return ( | ||
<Step name={steps.SUPPORT_PROVIDED}> | ||
<h1>Support provided</h1> | ||
<StyledFieldInput name="hidden" type="text" /> | ||
</Step> | ||
) | ||
} | ||
const SupportProvidedStep = () => ( | ||
<Step name={steps.SUPPORT_PROVIDED}> | ||
<H3 data-test="step-heading">Support given</H3> | ||
<StyledHintParagraph data-test="hint"> | ||
Did any of these help the customer achieve this win? | ||
</StyledHintParagraph> | ||
<ResourceOptionsField | ||
id="hvc" | ||
name="hvc" | ||
label="High Value Campaign (HVC) code (optional)" | ||
hint="If the win was linked to a HVC, select the appropriate campaign." | ||
resource={HvcResource} | ||
field={FieldTypeahead} | ||
/> | ||
<ResourceOptionsField | ||
name="type_of_support" | ||
id="type-of-support" | ||
label="What type of support was given?" | ||
hint="You can add up to 5 types of support." | ||
field={FieldTypeahead} | ||
resource={SupportTypeResource} | ||
fullWidth={true} | ||
isMulti={true} | ||
required="Select at least one type of support" | ||
validate={(value) => | ||
value?.length > 5 && 'Select a maximum of 5 types of support' | ||
} | ||
/> | ||
<ResourceOptionsField | ||
name="associated_programme" | ||
id="associated-programme" | ||
label="Was there a DBT campaign or event that contributed to this win?" | ||
hint="You can add up to 5 campaigns or events." | ||
field={FieldTypeahead} | ||
resource={AssociatedProgrammeResource} | ||
fullWidth={true} | ||
isMulti={true} | ||
required="Select at least one type of DBT campaign or event" | ||
validate={(value) => | ||
value?.length > 5 && 'Select a maximum of 5 DBT campaigns or events' | ||
} | ||
/> | ||
<FieldCheckboxes | ||
name="is_personally_confirmed" | ||
required="Confirm that this information is complete and accurate" | ||
options={[ | ||
{ | ||
value: OPTION_YES, | ||
label: 'I confirm that this information is complete and accurate.', | ||
}, | ||
]} | ||
/> | ||
<FieldCheckboxes | ||
name="is_line_manager_confirmed" | ||
required="Confirm your line manager has agreed that this win should be recorded" | ||
options={[ | ||
{ | ||
value: OPTION_YES, | ||
label: 'My line manager has agreed that this win should be recorded.', | ||
}, | ||
]} | ||
/> | ||
</Step> | ||
) | ||
|
||
export default SupportProvidedStep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters