@@ -9,45 +9,127 @@ import { submitTemplate } from '@forms/SubmitTemplate/server-action';
99import { NHSNotifyMain } from '@atoms/NHSNotifyMain/NHSNotifyMain' ;
1010import { NHSNotifyButton } from '@atoms/NHSNotifyButton/NHSNotifyButton' ;
1111
12+ export const SubmitLetterTemplateProofingDisabled : FC < {
13+ templateName : string ;
14+ templateId : string ;
15+ action : ( payload : FormData ) => void ;
16+ } > = ( { templateName, templateId, action } ) => {
17+ const {
18+ proofingFlagDisabled : {
19+ afterSubmissionHeading,
20+ afterSubmissionText,
21+ buttonText,
22+ goBackButtonText,
23+ goBackPath,
24+ pageHeading,
25+ submitChecklistHeading,
26+ submitChecklistIntroduction,
27+ submitChecklistItems,
28+ warningCalloutChecklistIntroduction,
29+ warningCalloutChecklistItems,
30+ warningCalloutLabel,
31+ } ,
32+ } = content . components . submitLetterTemplate ;
33+
34+ return (
35+ < NHSNotifyMain >
36+ < div className = 'nhsuk-grid-row' >
37+ < div className = 'nhsuk-grid-column-two-thirds' >
38+ < h1 >
39+ { pageHeading } { `'${ templateName } '` }
40+ </ h1 >
41+ < h2 className = 'nhsuk-heading-s' > { submitChecklistHeading } </ h2 >
42+ < p > { submitChecklistIntroduction } </ p >
43+ < ul >
44+ { submitChecklistItems . map ( ( item ) => (
45+ < li key = { `submit-list-${ item . slice ( 0 , 5 ) } ` } > { item } </ li >
46+ ) ) }
47+ </ ul >
48+ < h2 className = 'nhsuk-heading-s' > { afterSubmissionHeading } </ h2 >
49+ { afterSubmissionText . map ( ( item ) => (
50+ < p key = { `after-submission-paragraph-${ item . slice ( 0 , 5 ) } ` } > { item } </ p >
51+ ) ) }
52+ < WarningCallout >
53+ < WarningCallout . Label headingLevel = 'h2' >
54+ { warningCalloutLabel }
55+ </ WarningCallout . Label >
56+ < p > { warningCalloutChecklistIntroduction } </ p >
57+ < ul >
58+ { warningCalloutChecklistItems . map ( ( item ) => (
59+ < li key = { `warning-callout-list-${ item . slice ( 0 , 5 ) } ` } > { item } </ li >
60+ ) ) }
61+ </ ul >
62+ </ WarningCallout >
63+ < NHSNotifyFormWrapper formId = 'submit-template-form' action = { action } >
64+ < input
65+ type = 'hidden'
66+ name = 'templateId'
67+ value = { templateId }
68+ readOnly
69+ />
70+ < NHSNotifyButton
71+ secondary
72+ id = 'go-back-button'
73+ className = 'nhsuk-u-margin-right-3'
74+ href = { `${ getBasePath ( ) } /${ goBackPath } /${ templateId } ` }
75+ >
76+ { goBackButtonText }
77+ </ NHSNotifyButton >
78+ < NHSNotifyButton id = 'submit-template-button' >
79+ { buttonText }
80+ </ NHSNotifyButton >
81+ </ NHSNotifyFormWrapper >
82+ </ div >
83+ </ div >
84+ </ NHSNotifyMain >
85+ ) ;
86+ } ;
87+
1288export const SubmitLetterTemplate : FC < {
1389 templateName : string ;
1490 templateId : string ;
1591} > = ( { templateName, templateId } ) => {
1692 const {
93+ buttonText,
94+ goBackButtonText,
95+ goBackPath,
96+ intro,
1797 pageHeading,
18- warningCalloutLabel,
19- warningCalloutChecklistIntroduction,
20- warningCalloutChecklistItems,
2198 submitChecklistHeading,
2299 submitChecklistIntroduction,
23100 submitChecklistItems,
24- goBackButtonText,
25- goBackPath,
26- buttonText,
27- afterSubmissionHeading,
28- afterSubmissionText,
101+ warningCalloutChecklistIntroduction,
102+ warningCalloutChecklistItems,
103+ warningCalloutLabel,
29104 } = content . components . submitLetterTemplate ;
30105
31106 const [ _ , action ] = useActionState ( submitTemplate , 'LETTER' ) ;
32107
108+ if ( process . env . NEXT_PUBLIC_ENABLE_PROOFING !== 'true' ) {
109+ return (
110+ < SubmitLetterTemplateProofingDisabled
111+ templateName = { templateName }
112+ templateId = { templateId }
113+ action = { action }
114+ />
115+ ) ;
116+ }
117+
33118 return (
34119 < NHSNotifyMain >
35120 < div className = 'nhsuk-grid-row' >
36121 < div className = 'nhsuk-grid-column-two-thirds' >
37122 < h1 >
38123 { pageHeading } { `'${ templateName } '` }
39124 </ h1 >
125+ < p className = 'nhsuk-body-l' > { intro } </ p >
40126 < h2 className = 'nhsuk-heading-s' > { submitChecklistHeading } </ h2 >
41127 < p > { submitChecklistIntroduction } </ p >
42128 < ul >
43129 { submitChecklistItems . map ( ( item ) => (
44130 < li key = { `submit-list-${ item . slice ( 0 , 5 ) } ` } > { item } </ li >
45131 ) ) }
46132 </ ul >
47- < h2 className = 'nhsuk-heading-s' > { afterSubmissionHeading } </ h2 >
48- { afterSubmissionText . map ( ( item ) => (
49- < p key = { `after-submission-paragraph-${ item . slice ( 0 , 5 ) } ` } > { item } </ p >
50- ) ) }
51133 < WarningCallout >
52134 < WarningCallout . Label headingLevel = 'h2' >
53135 { warningCalloutLabel }
0 commit comments