From 49bf41258026cb3acab2bd83f4b76b204a39466a Mon Sep 17 00:00:00 2001
From: Yasmin-jones <90312885+Yasmin-jones@users.noreply.github.com>
Date: Wed, 9 Oct 2024 13:02:41 +0100
Subject: [PATCH 1/6] Adjusting layout of hint text
---
app/form/v1_0/fields/accommodation.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/form/v1_0/fields/accommodation.ts b/app/form/v1_0/fields/accommodation.ts
index 665a122c..38a4fcd6 100644
--- a/app/form/v1_0/fields/accommodation.ts
+++ b/app/form/v1_0/fields/accommodation.ts
@@ -6,10 +6,11 @@ import sections from '../config/sections'
import { dependentOn } from './common/utils'
const immigrationAccommodationHint = `
-
+
This includes:
- Schedule 10 - Home Office provides accommodation under the Immigration Act 2016
+
- Schedule 4 - Home Office provides accommodation for those on immigration bail, prior to the Immigration Act 2016
From 46c77f9816536f5f7c5535e6cd7107ba47567b32 Mon Sep 17 00:00:00 2001
From: Yasmin-jones <90312885+Yasmin-jones@users.noreply.github.com>
Date: Wed, 9 Oct 2024 14:42:29 +0100
Subject: [PATCH 2/6] Draft - adding valid date validation and error message
---
app/form/v1_0/fields/accommodation.ts | 5 ++++-
app/form/v1_0/fields/common/utils.ts | 9 ++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/app/form/v1_0/fields/accommodation.ts b/app/form/v1_0/fields/accommodation.ts
index 38a4fcd6..01e6a5e6 100644
--- a/app/form/v1_0/fields/accommodation.ts
+++ b/app/form/v1_0/fields/accommodation.ts
@@ -104,7 +104,10 @@ class AccommodationFieldsFactory extends FieldsFactory {
text: 'Enter expected end date (optional)',
code: 'short_term_accommodation_end_date',
type: FieldType.Date,
- validate: [{ fn: utils.validateFutureDate, message: 'Enter a future date' }],
+ validate: [
+ { fn: utils.validateValidDate, message: 'Enter a valid date' },
+ { fn: utils.validateFutureDate, message: 'Enter a future date' },
+ ],
dependent: dependentOn(this.typeOfTemporaryAccommodation, 'SHORT_TERM'),
summary: {
displayFn: endDateSummaryDisplay,
diff --git a/app/form/v1_0/fields/common/utils.ts b/app/form/v1_0/fields/common/utils.ts
index 3d50a147..5d8dd56e 100644
--- a/app/form/v1_0/fields/common/utils.ts
+++ b/app/form/v1_0/fields/common/utils.ts
@@ -29,12 +29,19 @@ export function validateFutureDate(value: string) {
const now = DateTime.now().startOf('day')
const date = DateTime.fromISO(value)
return !value || value === '' ? true : date.isValid && date >= now
+ // return !value || value === '' ? true : date >= now
}
export function validatePastDate(value: string) {
const now = DateTime.now().startOf('day')
const date = DateTime.fromISO(value)
- return !value || value === '' ? true : date.isValid && date <= now
+ return !value || value === '' ? true : date.isValid && date >= now
+ // return !value || value === '' ? true : date <= now
+}
+
+export function validateValidDate(value: string){
+ const date = DateTime.fromISO(value)
+ return !value || value === '' ? true : date.isValid
}
export function requiredWhenValidator(field: string, requiredValue: string) {
From 1305805bfffbdefc450266e0351e69bff5642501 Mon Sep 17 00:00:00 2001
From: Yasmin-jones <90312885+Yasmin-jones@users.noreply.github.com>
Date: Mon, 14 Oct 2024 11:59:17 +0100
Subject: [PATCH 3/6] Adding space between details answers in summary screen
---
server/views/components/summary/template.njk | 1 +
1 file changed, 1 insertion(+)
diff --git a/server/views/components/summary/template.njk b/server/views/components/summary/template.njk
index 6461c5df..527a7f71 100644
--- a/server/views/components/summary/template.njk
+++ b/server/views/components/summary/template.njk
@@ -131,6 +131,7 @@
{% for answer in summaryField.answers %}
{{ answer.text | nl2br | safe }}
{{ renderNestedFields(answer.nestedFields) }}
+
{% endfor %}
{% endif %}
From f469951a2bf0f60930c85b992cb0eb663c0534d1 Mon Sep 17 00:00:00 2001
From: Yasmin-jones <90312885+Yasmin-jones@users.noreply.github.com>
Date: Mon, 14 Oct 2024 14:04:50 +0100
Subject: [PATCH 4/6] Adding spacing between PA questions
---
server/views/forms/summary/summary-analysis-complete.njk | 2 ++
1 file changed, 2 insertions(+)
diff --git a/server/views/forms/summary/summary-analysis-complete.njk b/server/views/forms/summary/summary-analysis-complete.njk
index b0f26c9c..8fc2c9d7 100644
--- a/server/views/forms/summary/summary-analysis-complete.njk
+++ b/server/views/forms/summary/summary-analysis-complete.njk
@@ -51,6 +51,7 @@
fields[section + "_practitioner_analysis_strengths_or_protective_factors_no_details"],
changeLink
) }}
+
{{ renderAnalysisSummaryRow(
"Linked to risk of serious harm",
fields[section + "_practitioner_analysis_risk_of_serious_harm"],
@@ -58,6 +59,7 @@
fields[section + "_practitioner_analysis_risk_of_serious_harm_no_details"],
changeLink
) }}
+
{{ renderAnalysisSummaryRow(
"Linked to risk of reoffending",
fields[section + "_practitioner_analysis_risk_of_reoffending"],
From 2753349387bed02b4429cd27ae99e7f35fbab456 Mon Sep 17 00:00:00 2001
From: Yasmin-jones <90312885+Yasmin-jones@users.noreply.github.com>
Date: Mon, 14 Oct 2024 15:08:37 +0100
Subject: [PATCH 5/6] fixing linting issues
---
app/form/v1_0/fields/common/utils.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/form/v1_0/fields/common/utils.ts b/app/form/v1_0/fields/common/utils.ts
index 5d8dd56e..255415c4 100644
--- a/app/form/v1_0/fields/common/utils.ts
+++ b/app/form/v1_0/fields/common/utils.ts
@@ -39,7 +39,7 @@ export function validatePastDate(value: string) {
// return !value || value === '' ? true : date <= now
}
-export function validateValidDate(value: string){
+export function validateValidDate(value: string) {
const date = DateTime.fromISO(value)
return !value || value === '' ? true : date.isValid
}
From 847262845e23913a6f34f059387f32ee967f2d8c Mon Sep 17 00:00:00 2001
From: Yasmin-jones <90312885+Yasmin-jones@users.noreply.github.com>
Date: Mon, 14 Oct 2024 15:09:58 +0100
Subject: [PATCH 6/6] Tidying code
---
app/form/v1_0/fields/common/utils.ts | 2 --
1 file changed, 2 deletions(-)
diff --git a/app/form/v1_0/fields/common/utils.ts b/app/form/v1_0/fields/common/utils.ts
index 255415c4..aa81cbd3 100644
--- a/app/form/v1_0/fields/common/utils.ts
+++ b/app/form/v1_0/fields/common/utils.ts
@@ -29,14 +29,12 @@ export function validateFutureDate(value: string) {
const now = DateTime.now().startOf('day')
const date = DateTime.fromISO(value)
return !value || value === '' ? true : date.isValid && date >= now
- // return !value || value === '' ? true : date >= now
}
export function validatePastDate(value: string) {
const now = DateTime.now().startOf('day')
const date = DateTime.fromISO(value)
return !value || value === '' ? true : date.isValid && date >= now
- // return !value || value === '' ? true : date <= now
}
export function validateValidDate(value: string) {