66 * 2. Heading: "Add and assign consultees" (matches task list name)
77 * 3. Not-needed cards: no content rows, just tag in title — less redundancy
88 * 4. Detail page: removed opacity:0.5 on not-needed state
9- * 5. AddNew: shows only reason search first, separate story for after reason chosen
10- * 6. AddNew: no "not needed" checkbox (nonsensical for new consultations)
9+ * 5. AddNew: simplified to just consultee search (no reason search — can't add constraints)
10+ * 6. Manually-added consultees shown under "Other" card on overview
1111 * 7. New story: overview with success banner after returning from detail page
1212 * 8. Detail page: "Add another consultee" heading when consultees already exist
1313 * 9. Empty state: no submit button when there's nothing to confirm
1414 * 10. Removed dead cardStyle variable
1515 * 11. renderSuccessBanner now used in a story
1616 * 12. Breadcrumb matches heading
17+ * 13. "Add a consultee" link (not "Add another consultation" — can't add constraints)
1718 */
1819import { mockData , renderStatusTag } from "../../../helpers" ;
1920
@@ -33,8 +34,7 @@ export default {
3334// Data
3435// ---------------------------------------------------------------------------
3536
36- const { consultationReasons, availableConsultees, availableConstraints } =
37- mockData ;
37+ const { consultationReasons, availableConsultees } = mockData ;
3838
3939// ---------------------------------------------------------------------------
4040// Shared helpers
@@ -154,8 +154,46 @@ function renderReasonCard(reason, options = {}) {
154154 </div>` ;
155155}
156156
157+ function renderOtherCard ( otherConsultees , options = { } ) {
158+ const { readOnly = false } = options ;
159+ if ( ! otherConsultees || otherConsultees . length === 0 ) return "" ;
160+
161+ const consulteeRows = otherConsultees
162+ . map ( ( c , i ) => {
163+ const label =
164+ otherConsultees . length > 1 ? `Consultee ${ i + 1 } ` : "Consultee" ;
165+ return `
166+ <div class="govuk-summary-list__row">
167+ <dt class="govuk-summary-list__key">${ label } </dt>
168+ <dd class="govuk-summary-list__value">${ c . name } , ${ c . organisation } </dd>
169+ </div>` ;
170+ } )
171+ . join ( "" ) ;
172+
173+ const cardAction = readOnly
174+ ? ""
175+ : `<ul class="govuk-summary-card__actions">
176+ <li class="govuk-summary-card__action">
177+ <a class="govuk-link" href="#">Change<span class="govuk-visually-hidden"> other consultees</span></a>
178+ </li>
179+ </ul>` ;
180+
181+ return `
182+ <div class="govuk-summary-card">
183+ <div class="govuk-summary-card__title-wrapper">
184+ <h2 class="govuk-summary-card__title">Other</h2>
185+ ${ cardAction }
186+ </div>
187+ <div class="govuk-summary-card__content">
188+ <dl class="govuk-summary-list">
189+ ${ consulteeRows }
190+ </dl>
191+ </div>
192+ </div>` ;
193+ }
194+
157195function renderOverviewPage ( reasons , options = { } ) {
158- const { readOnly = false , banner = "" } = options ;
196+ const { readOnly = false , banner = "" , otherConsultees = [ ] } = options ;
159197
160198 const statusTag = readOnly
161199 ? `<p class="govuk-!-margin-bottom-4">${ renderStatusTag ( "complete" ) } </p>`
@@ -166,11 +204,12 @@ function renderOverviewPage(reasons, options = {}) {
166204 : `<p class="govuk-body">Consultees have been automatically matched to this application's planning constraints. Check the assignments are correct, make any changes, then confirm.</p>` ;
167205
168206 const cards = reasons . map ( ( r ) => renderReasonCard ( r , options ) ) . join ( "" ) ;
207+ const otherCardHtml = renderOtherCard ( otherConsultees , options ) ;
169208
170209 const addLink = readOnly
171210 ? ""
172211 : `<p class="govuk-body govuk-!-margin-top-4">
173- <a class="govuk-link" href="#">Add another consultation </a>
212+ <a class="govuk-link" href="#">Add a consultee </a>
174213 </p>` ;
175214
176215 const formButtons = readOnly
@@ -186,6 +225,7 @@ function renderOverviewPage(reasons, options = {}) {
186225 ${ statusTag }
187226 ${ intro }
188227 ${ cards }
228+ ${ otherCardHtml }
189229 ${ addLink }
190230 ${ formButtons }
191231 </div>
@@ -279,80 +319,23 @@ function renderNotNeededCheckbox(checked = false) {
279319 </div>` ;
280320}
281321
282- function renderReasonSearchSection ( options = { } ) {
283- const { searchQuery = "" , showSuggestions = false } = options ;
284-
285- const suggestionsHtml = showSuggestions
286- ? `<ul role="listbox" style="border: 1px solid #b1b4b6; list-style: none; padding: 0; margin-top: -1px; background: #fff; max-height: 200px; overflow-y: auto; position: absolute; width: 100%; z-index: 10; box-shadow: 0 2px 6px rgba(0,0,0,.15);">
287- ${ availableConstraints
288- . filter ( ( c ) =>
289- c . type . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) ) ,
290- )
291- . map (
292- ( c , i ) =>
293- `<li style="padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f3f2f1;${ i === 0 ? " background: #1d70b8; color: #fff;" : "" } ">
294- <strong>${ c . type } </strong><br>
295- <span style="font-size: 14px; color: ${ i === 0 ? "#fff" : "#505a5f" } ;">${ c . category } </span>
296- </li>` ,
297- )
298- . join ( "" ) }
299- </ul>`
300- : "" ;
301-
302- return `
303- <div class="govuk-form-group">
304- <label class="govuk-label" for="add-reason">
305- Reason for consultation
306- </label>
307- <div id="add-reason-hint" class="govuk-hint">
308- Search for a planning constraint or type a custom reason
309- </div>
310- <div style="position: relative;">
311- <input class="govuk-input" id="add-reason" type="text" value="${ searchQuery } " autocomplete="off" aria-describedby="add-reason-hint">
312- ${ suggestionsHtml }
313- </div>
314- </div>` ;
315- }
316-
317322function renderDetailPage ( reason , options = { } ) {
318323 const {
319324 showSearch = true ,
320325 searchQuery = "" ,
321326 showSuggestions = false ,
322327 notNeededChecked = false ,
323328 banner = "" ,
324- reasonSelected = false ,
325329 } = options ;
326330
327- // Empty state — adding a new consultation (step 1: pick a reason )
328- if ( ! reason && ! reasonSelected ) {
331+ // Add a consultee (not tied to a constraint — goes under "Other" )
332+ if ( ! reason ) {
329333 return `
330334 <div class="govuk-grid-row">
331335 <div class="govuk-grid-column-two-thirds">
332336 ${ renderBackLink ( ) }
333- <h1 class="govuk-heading-l">Add a consultation</h1>
334- <p class="govuk-body">Search for a planning constraint or enter a custom reason.</p>
335-
336- ${ renderReasonSearchSection ( { searchQuery, showSuggestions } ) }
337-
338- <div class="govuk-button-group govuk-!-margin-top-6">
339- <button class="govuk-button" type="submit">Continue</button>
340- </div>
341- </div>
342- </div>` ;
343- }
344-
345- // Empty state — reason selected, now assign a consultee (step 2)
346- if ( ! reason && reasonSelected ) {
347- return `
348- <div class="govuk-grid-row">
349- <div class="govuk-grid-column-two-thirds">
350- ${ renderBackLink ( ) }
351- <h1 class="govuk-heading-l">Ecology — habitat regulations</h1>
352- <p class="govuk-body">Custom reason</p>
353- <p class="govuk-hint">Manually added</p>
354-
355- <div class="govuk-inset-text">No consultees have been assigned to this constraint. Use the search below to find and assign one.</div>
337+ <h1 class="govuk-heading-l">Add a consultee</h1>
338+ <p class="govuk-body">Search for a consultee to add. They will not be linked to a specific constraint.</p>
356339
357340 ${ renderSearchSection ( { searchQuery, showSuggestions } ) }
358341
@@ -525,7 +508,24 @@ export const Completed = {
525508 } ,
526509} ;
527510
528- /** No constraints identified — empty state with add link, no submit button. */
511+ /** Overview with a manually-added consultee under "Other". */
512+ export const WithOtherConsultee = {
513+ render : ( ) => {
514+ return renderOverviewPage ( consultationReasons , {
515+ otherConsultees : [
516+ {
517+ name : "Highways Authority" ,
518+ organisation : "Transport for London" ,
519+ email : "highways@tfl.gov.uk" ,
520+ origin : "external" ,
521+ role : "Highways" ,
522+ } ,
523+ ] ,
524+ } ) ;
525+ } ,
526+ } ;
527+
528+ /** No constraints identified — empty state with add link, no confirm button. */
529529export const NoConstraintsIdentified = {
530530 render : ( ) => `
531531 <div class="govuk-grid-row">
@@ -534,11 +534,11 @@ export const NoConstraintsIdentified = {
534534 <h1 class="govuk-heading-l">Add and assign consultees</h1>
535535
536536 <div class="govuk-inset-text">
537- No planning constraints have been identified for this application. You can add consultations manually.
537+ No planning constraints have been identified for this application. You can still add consultees manually.
538538 </div>
539539
540540 <p class="govuk-body">
541- <a class="govuk-link" href="#">Add a consultation </a>
541+ <a class="govuk-link" href="#">Add a consultee </a>
542542 </p>
543543
544544 <div class="govuk-button-group govuk-!-margin-top-6">
@@ -603,18 +603,13 @@ export const ManageNotNeeded = {
603603 } ,
604604} ;
605605
606- /** Adding a new consultation — step 1: pick a reason (no consultee search yet) . */
607- export const AddNewStep1 = {
606+ /** Add a consultee (not tied to a constraint) — empty search. */
607+ export const AddConsultee = {
608608 render : ( ) => renderDetailPage ( null ) ,
609609} ;
610610
611- /** Adding a new consultation — step 1 with search results. */
612- export const AddNewStep1WithSearch = {
611+ /** Add a consultee — search with results showing . */
612+ export const AddConsulteeWithSearch = {
613613 render : ( ) =>
614- renderDetailPage ( null , { searchQuery : "Eco" , showSuggestions : true } ) ,
615- } ;
616-
617- /** Adding a new consultation — step 2: reason chosen, now assign a consultee. */
618- export const AddNewStep2 = {
619- render : ( ) => renderDetailPage ( null , { reasonSelected : true } ) ,
614+ renderDetailPage ( null , { searchQuery : "Hist" , showSuggestions : true } ) ,
620615} ;
0 commit comments