@@ -323,25 +323,49 @@ function generateSupplierHtml(report: SupplierReport): string {
323323 . join ( "\n" ) ;
324324
325325 // Generate Table of Contents with two sections
326- const generateTocItems = ( packList : SupplierPackWithSpec [ ] ) =>
326+ const formatDate = ( isoDate : string ) : string => {
327+ const date = new Date ( isoDate ) ;
328+ return date . toLocaleDateString ( "en-GB" , {
329+ day : "2-digit" ,
330+ month : "short" ,
331+ year : "numeric" ,
332+ } ) ;
333+ } ;
334+
335+ const generateTocTableRows = ( packList : SupplierPackWithSpec [ ] ) =>
327336 packList
328337 . map ( ( { packSpecification, supplierPack } ) => {
329338 const anchorId = `pack-${ sanitizeAnchorId ( packSpecification . id ) } ` ;
330339 const approvalTooltip = getApprovalStatusTooltip ( supplierPack . approval ) ;
331340 const envTooltip = getEnvironmentStatusTooltip ( supplierPack . status ) ;
341+ const version = packSpecification . version ?? "-" ;
342+ const lastUpdated = packSpecification . updatedAt
343+ ? formatDate ( packSpecification . updatedAt )
344+ : "-" ;
332345 return `
333- <li >
334- < a href="#${ anchorId } "><code>${ escapeHtml ( packSpecification . id ) } </code> – ${ escapeHtml ( packSpecification . name ) } </a>
335- <span class="toc-statuses" >
336- <span class="toc-status approval-status status- ${ supplierPack . approval . toLowerCase ( ) } has-tooltip" data-tooltip=" ${ escapeHtml ( approvalTooltip ) } " >${ escapeHtml ( supplierPack . approval ) } </span >
337- <span class="toc-status env -status status-${ supplierPack . status . toLowerCase ( ) } has-tooltip" data-tooltip="${ escapeHtml ( envTooltip ) } ">${ escapeHtml ( supplierPack . status ) } </span>
338- < /span>
339- </li >` ;
346+ <tr >
347+ <td>< a href="#${ anchorId } "><code>${ escapeHtml ( packSpecification . id ) } </code> – ${ escapeHtml ( packSpecification . name ) } </a></td >
348+ <td> ${ escapeHtml ( version ) } </td >
349+ <td >${ escapeHtml ( lastUpdated ) } </td >
350+ <td>< span class="toc-status approval -status status-${ supplierPack . approval . toLowerCase ( ) } has-tooltip" data-tooltip="${ escapeHtml ( approvalTooltip ) } ">${ escapeHtml ( supplierPack . approval ) } </span></td >
351+ <td><span class="toc-status env-status status- ${ supplierPack . status . toLowerCase ( ) } has-tooltip" data-tooltip=" ${ escapeHtml ( envTooltip ) } "> ${ escapeHtml ( supplierPack . status ) } < /span></td >
352+ </tr >` ;
340353 } )
341354 . join ( "\n" ) ;
342355
343- const submittedTocItems = generateTocItems ( sortedSubmittedPacks ) ;
344- const draftTocItems = generateTocItems ( sortedDraftPacks ) ;
356+ const submittedTocRows = generateTocTableRows ( sortedSubmittedPacks ) ;
357+ const draftTocRows = generateTocTableRows ( sortedDraftPacks ) ;
358+
359+ const tocTableHeader = `
360+ <thead>
361+ <tr>
362+ <th>Pack</th>
363+ <th>Version</th>
364+ <th>Last Updated</th>
365+ <th>Approval</th>
366+ <th>Environment</th>
367+ </tr>
368+ </thead>` ;
345369
346370 const tocSection =
347371 packs . length > 0
@@ -352,19 +376,25 @@ function generateSupplierHtml(report: SupplierReport): string {
352376 sortedSubmittedPacks . length > 0
353377 ? `
354378 <h4 class="toc-section-header">Submitted & Approved Packs (${ sortedSubmittedPacks . length } )</h4>
355- <ol>
356- ${ submittedTocItems }
357- </ol>
379+ <table class="toc-table">
380+ ${ tocTableHeader }
381+ <tbody>
382+ ${ submittedTocRows }
383+ </tbody>
384+ </table>
358385 `
359386 : ""
360387 }
361388 ${
362389 sortedDraftPacks . length > 0
363390 ? `
364391 <h4 class="toc-section-header">Draft Packs (${ sortedDraftPacks . length } )</h4>
365- <ol>
366- ${ draftTocItems }
367- </ol>
392+ <table class="toc-table">
393+ ${ tocTableHeader }
394+ <tbody>
395+ ${ draftTocRows }
396+ </tbody>
397+ </table>
368398 `
369399 : ""
370400 }
@@ -769,16 +799,28 @@ function generateSupplierHtml(report: SupplierReport): string {
769799 margin-top: 0;
770800 }
771801
772- .toc ol {
773- margin: 0;
774- padding-left: 20px;
802+ .toc-table {
803+ width: 100%;
804+ border-collapse: collapse;
805+ margin-bottom: 15px;
775806 }
776807
777- .toc li {
778- margin: 8px 0;
779- display: flex;
780- align-items: center;
781- gap: 10px;
808+ .toc-table th,
809+ .toc-table td {
810+ padding: 10px;
811+ text-align: left;
812+ border-bottom: 1px solid var(--nhs-light-grey);
813+ }
814+
815+ .toc-table th {
816+ background-color: var(--nhs-pale-grey);
817+ color: var(--nhs-dark-blue);
818+ font-weight: 600;
819+ }
820+
821+ .toc-table td:nth-child(2),
822+ .toc-table td:nth-child(3) {
823+ white-space: nowrap;
782824 }
783825
784826 .toc a {
0 commit comments