From 0224a589d062a8cd27b57d2ff021c107a7c78220 Mon Sep 17 00:00:00 2001 From: UxTom Date: Thu, 4 Dec 2025 18:36:14 +0000 Subject: [PATCH 001/169] Removed merge HEAD <<<< message --- app/views/_includes/task/main-tabs.njk | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/views/_includes/task/main-tabs.njk b/app/views/_includes/task/main-tabs.njk index 8483f646..01ca0802 100644 --- a/app/views/_includes/task/main-tabs.njk +++ b/app/views/_includes/task/main-tabs.njk @@ -1,10 +1,5 @@ {# _includes/task/main-tabs.njk #} -<<<<<<< HEAD - - -======= ->>>>>>> upstream/main {# ----------------------------- Tasks tab content ----------------------------- #} From 15856532c7456900bb3e1ab44ec5582851327b16 Mon Sep 17 00:00:00 2001 From: UxTom Date: Tue, 9 Dec 2025 15:03:11 +0000 Subject: [PATCH 002/169] Created disclosure-statuses.json Called as disclosureStatuses in session-data-defaults.js --- app/data/disclosure-statuses.json | 14 ++++++++++++++ app/data/session-data-defaults.js | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 app/data/disclosure-statuses.json diff --git a/app/data/disclosure-statuses.json b/app/data/disclosure-statuses.json new file mode 100644 index 00000000..38f861b3 --- /dev/null +++ b/app/data/disclosure-statuses.json @@ -0,0 +1,14 @@ +{ + "police": [ + "Passes disclosure test", + "Does not pass disclosure test" + ], + "cps": [ + "To be assessed", + "Disclosable", + "Disclosable by inspection", + "Not disclosable", + "Clearly not disclosable", + "Evidence" + ] +} \ No newline at end of file diff --git a/app/data/session-data-defaults.js b/app/data/session-data-defaults.js index b19be958..aa9d4782 100644 --- a/app/data/session-data-defaults.js +++ b/app/data/session-data-defaults.js @@ -1,9 +1,11 @@ const caseMaterials = require('./case-materials.json'); +const disclosureStatuses = require('./disclosure-statuses.json'); module.exports = { caseSort: 'Name', taskSort: 'Due date', // Insert values here - caseMaterials + caseMaterials, + disclosureStatuses } From 86f9a83ae79947519eb2fa1a50da83537025e9e4 Mon Sep 17 00:00:00 2001 From: UxTom Date: Tue, 9 Dec 2025 17:44:41 +0000 Subject: [PATCH 003/169] Updated material-viewer.js buildMetaPanel() _components/material-panel/template.njk --> to reflect new data model case-materials.json --- .../javascripts/components/material-viewer.js | 173 +++++++++++++----- app/data/case-materials.json | 26 +-- app/routes/case--material.js | 1 + .../_components/material-panel/template.njk | 10 +- 4 files changed, 141 insertions(+), 69 deletions(-) diff --git a/app/assets/javascripts/components/material-viewer.js b/app/assets/javascripts/components/material-viewer.js index 520fe6a5..a558aff8 100644 --- a/app/assets/javascripts/components/material-viewer.js +++ b/app/assets/javascripts/components/material-viewer.js @@ -718,13 +718,63 @@ // Meta panel builder // -------------------------------------- - function buildMetaPanel (meta, bodyId) { - var mat = (meta && meta.Material) || {} + function buildMetaPanel (meta, bodyId) { + // Meta may either be a flat material object, or { Material: { ... } } + var mat = (meta && meta.Material) || meta || {} + + // Related / digital structures (as before) var rel = (meta && meta.RelatedMaterials) || {} var dig = (meta && meta.DigitalRepresentation) || {} - var pol = (meta && meta.PoliceMaterial) || {} - var cps = (meta && meta.CPSMaterial) || {} - var insp = pol.Inspection || {} + + // Detect type – prefer mat.Type but fall back to meta.Type + var rawType = mat.Type || (meta && meta.Type) || '' + var typeNorm = String(rawType).toLowerCase().trim() + var isUnusedOrSensitive = (typeNorm === 'unused non-sensitive' || typeNorm === 'sensitive') + + // Disclosure objects ONLY exist on Unused non-sensitive / Sensitive + var pol = (mat && mat.policeDisclosure) || + (meta && meta.policeDisclosure) || + {} + var cps = (mat && mat.cpsDisclosure) || + (meta && meta.cpsDisclosure) || + {} + + // Helper: render a status value as a GOV.UK tag + function statusTagHTML (kind, value) { + var text = (value == null ? '' : String(value)).trim() + if (!text) return '—' + + var cls = 'govuk-tag' + var lower = text.toLowerCase() + + if (kind === 'police') { + // disclosureStatuses.police + if (lower === 'passes disclosure test') { + cls += ' govuk-tag--green' + } else if (lower === 'does not pass disclosure test') { + cls += ' govuk-tag--yellow' + } + } else if (kind === 'cps') { + // disclosureStatuses.cps + if (lower === 'to be assessed') { + cls += ' govuk-tag--grey' + } else if (lower === 'disclosable') { + // "light blue" – turquoise is the lighter govuk tag + cls += ' govuk-tag--turquoise' + } else if (lower === 'disclosable by inspection') { + cls += ' govuk-tag--purple' + } else if (lower === 'not disclosable') { + cls += ' govuk-tag--orange' + } else if (lower === 'clearly not disclosable') { + cls += ' govuk-tag--red' + } else if (lower === 'evidence') { + cls += ' govuk-tag--blue' + } + } + + return '' + esc(text) + '' + } + function rowsHTMLLocal (obj, mapping) { return mapping.map(function (m) { @@ -740,6 +790,9 @@ }).join('') } + // ...rest of your buildMetaPanel exactly as you already have it... + + function sectionHTMLLocal (title, rows) { if (!rows) return '' return ( @@ -755,19 +808,42 @@ ) } - var materialRows = rowsHTMLLocal(mat, [ - { key: 'Title', label: 'Title' }, - { key: 'Reference', label: 'Reference' }, - { key: 'ProducedbyWitnessId', label: 'Produced by (witness id)' }, - { key: 'MaterialClassification', label: 'Material classification' }, - { key: 'MaterialType', label: 'Material type' }, - { key: 'SentExternally', label: 'Sent externally' }, - { key: 'RelatedParticipantId', label: 'Related participant id' }, - { key: 'Incident', label: 'Incident' }, - { key: 'Location', label: 'Location' }, - { key: 'PeriodFrom', label: 'Period from' }, - { key: 'PeriodTo', label: 'Period to' } - ]) + // ---------------------------------- + // Core material rows + // ---------------------------------- + + var materialRows + + if (isUnusedOrSensitive) { + // Desired layout for Unused non-sensitive / Sensitive + materialRows = rowsHTMLLocal(mat, [ + { key: 'Reference', label: 'Reference' }, + { key: 'Title', label: 'Title' }, + { key: 'MaterialClassification', label: 'Classification' }, + { key: 'Description', label: 'Description' }, + { key: 'PeriodFrom', label: 'Period from' }, + { key: 'ProducedbyWitnessId', label: 'Produced by witness' } + ]) + } else { + // Default layout (Statements, Exhibits, etc) + materialRows = rowsHTMLLocal(mat, [ + { key: 'Title', label: 'Title' }, + { key: 'Reference', label: 'Reference' }, + { key: 'ProducedbyWitnessId', label: 'Produced by (witness id)' }, + { key: 'MaterialClassification', label: 'Material classification' }, + { key: 'MaterialType', label: 'Material type' }, + { key: 'SentExternally', label: 'Sent externally' }, + { key: 'RelatedParticipantId', label: 'Related participant id' }, + { key: 'Incident', label: 'Incident' }, + { key: 'Location', label: 'Location' }, + { key: 'PeriodFrom', label: 'Period from' }, + { key: 'PeriodTo', label: 'Period to' } + ]) + } + + // ---------------------------------- + // Related + digital (unchanged) + // ---------------------------------- var relatedRows = rowsHTMLLocal(rel, [ { key: 'RelatesToItem', label: 'Relates to item' }, @@ -807,27 +883,39 @@ ]) } - var policeRows = rowsHTMLLocal(pol, [ - { key: 'DisclosureStatus', label: 'Disclosure status' }, - { key: 'RationaleForDisclosureDecision', label: 'Rationale for disclosure decision' }, - { key: 'Rebuttable', label: 'Rebuttable' }, - { key: 'SensitivityRationale', label: 'Sensitivity rationale' }, - { key: 'Description', label: 'Description' }, - { key: 'Exceptions', label: 'Exceptions', render: function (arr) { - if (!Array.isArray(arr) || !arr.length) return '—' - return '
    ' + - arr.map(function (x) { return '
  • ' + esc(x) + '
  • ' }).join('') + - '
' - } }, - { label: 'Inspection date', get: function () { return insp.DateOfInspection } }, - { label: 'Inspected by', get: function () { return insp.InspectedBy } } - ]) + // ---------------------------------- + // Police / CPS disclosure (new model) + // ---------------------------------- + + var policeRows = '' + var cpsRows = '' + + if (isUnusedOrSensitive) { + policeRows = rowsHTMLLocal(pol, [ + { + key: 'status', + label: 'Police disclosure status', + render: function (v) { return statusTagHTML('police', v) } + }, + { key: 'rationale', label: 'Disclosure rationale' }, + { key: 'rebuttable', label: 'Rebuttable' }, + { key: 'exception', label: 'Exception' }, + { key: 'exceptionReason', label: 'Exception reason' }, + { key: 'InspectedBy', label: 'Inspected by' }, + { key: 'inspectedOn', label: 'Inspected on' } + ]) + + cpsRows = rowsHTMLLocal(cps, [ + { + key: 'status', + label: 'Disclosure status', + render: function (v) { return statusTagHTML('cps', v) } + }, + { key: 'rationale', label: 'Disclosure rationale' }, + { key: 'SensitivityDispute', label: 'Sensitivity dispute' } + ]) + } - var cpsRows = rowsHTMLLocal(cps, [ - { key: 'DisclosureStatus', label: 'Disclosure status' }, - { key: 'RationaleForDisclosureDecision', label: 'Rationale for disclosure decision' }, - { key: 'SensitivityDispute', label: 'Sensitivity dispute' } - ]) var metaBar = '
' + @@ -852,17 +940,18 @@ metaBar + '' + '
' } + + + // -------------------------------------- // Preview builder (pdf.js + chrome) // -------------------------------------- diff --git a/app/data/case-materials.json b/app/data/case-materials.json index 860b97d5..1431e256 100644 --- a/app/data/case-materials.json +++ b/app/data/case-materials.json @@ -245,29 +245,5 @@ "PeriodFrom": "2025-09-13T16:05:00Z", "PeriodTo": "2025-09-13T16:07:00Z" } - ], - - "RelatedMaterials": { - "RelatesToItem": "", - "RelatedItemId": "", - "RelationshipType": "" - }, - "DigitalRepresentation": { - "name": "Crime scene", - "document": "[**CHECK**will_fill_later]", - "Items": [ - { - "FileName": "Crime scene 1", - "ExternalFileURL": "/public/images/crime-scene-1.jpg", - "ExternalFileLocation": "/public/images/crime-scene-1.jpg", - "DigitalSignature": "2f9c1c3c4a5b6789d012e34f56a78bc9de01fa23b45c6789d012efab34567890" - }, - { - "FileName": "Crime scene 2", - "ExternalFileURL": "/public/images/crime-scene-2.jpg", - "ExternalFileLocation": "/public/images/crime-scene-2.jpg", - "DigitalSignature": "b1a2c3d4e5f60718293a4b5c6d7e8f9012ab34cd56ef7890ab12cd34ef56a7b8" - } - ] - } + ] } diff --git a/app/routes/case--material.js b/app/routes/case--material.js index cf2ead48..a4d0acb3 100644 --- a/app/routes/case--material.js +++ b/app/routes/case--material.js @@ -1,3 +1,4 @@ +//////// routes/case--materials.js const _ = require('lodash') const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() diff --git a/app/views/_components/material-panel/template.njk b/app/views/_components/material-panel/template.njk index d9fa7b38..ef8a17fc 100644 --- a/app/views/_components/material-panel/template.njk +++ b/app/views/_components/material-panel/template.njk @@ -64,9 +64,10 @@ Status: m.Status, Material: { + Type: m.Type, Title: m.Title, myFileUrl: m.myFileUrl, - MaterialStatus: m.materialStatus, + materialStatus: m.materialStatus, Reference: m.Reference, ProducedbyWitnessId: m.ProducedbyWitnessId, MaterialClassification: m.MaterialClassification, @@ -76,7 +77,11 @@ Incident: m.Incident, Location: m.Location, PeriodFrom: m.PeriodFrom, - PeriodTo: m.PeriodTo + PeriodTo: m.PeriodTo, + Description: m.Description, + + policeDisclosure: m.policeDisclosure, + cpsDisclosure: m.cpsDisclosure }, RelatedMaterials: cm.RelatedMaterials, @@ -84,6 +89,7 @@ PoliceMaterial: cm.PoliceMaterial, CPSMaterial: cm.CPSMaterial } %} + {% else %} {{ linkText }} From 1ed6991ef07b98d786ff033a3696ac6d2554982c Mon Sep 17 00:00:00 2001 From: UxTom Date: Wed, 10 Dec 2025 16:51:56 +0000 Subject: [PATCH 004/169] Updatd JSON to include Police disc status of 'Evidence' for Type:Exhibits Modifies material-viewer.js to reflect changes i the JSON --- .../javascripts/components/material-viewer.js | 427 ++++++++++-------- .../components/_materials-accordion-card.scss | 39 +- .../sass/components/_materials-accordion.scss | 4 + .../sass/components/_materials-viewer.scss | 6 +- app/data/case-materials.json | 53 ++- app/data/disclosure-statuses.json | 3 +- 6 files changed, 323 insertions(+), 209 deletions(-) diff --git a/app/assets/javascripts/components/material-viewer.js b/app/assets/javascripts/components/material-viewer.js index a558aff8..44b468e6 100644 --- a/app/assets/javascripts/components/material-viewer.js +++ b/app/assets/javascripts/components/material-viewer.js @@ -701,7 +701,7 @@ return ( '
' + '
' + - '' + '