From b6ce6738dbc6f69a673d245396358538080dde5e Mon Sep 17 00:00:00 2001 From: Shannon Clarke Date: Tue, 6 Jan 2026 08:31:00 -0400 Subject: [PATCH 1/2] feat: add schema for permission to remove protected tree --- schemas/permission-to-remove-tree.json | 158 ++++++++++++++++++ .../templates/permission-to-remove-tree.hbs | 103 ++++++++++++ 2 files changed, 261 insertions(+) create mode 100644 schemas/permission-to-remove-tree.json create mode 100644 src/email/templates/permission-to-remove-tree.hbs diff --git a/schemas/permission-to-remove-tree.json b/schemas/permission-to-remove-tree.json new file mode 100644 index 0000000..923db55 --- /dev/null +++ b/schemas/permission-to-remove-tree.json @@ -0,0 +1,158 @@ +{ + "id": "permission-to-remove-tree", + "name": "Apply for permission to remove a protected tree", + "description": "Apply for permission to remove a protected tree", + "fields": [ + { + "name": "applicant", + "type": "object", + "required": true, + "fields": [ + { + "name": "title", + "type": "string", + "label": "Title", + "required": true, + "validations": { + "regex": "^(mr|ms|mrs)$", + "message": "Must select a valid title" + } + }, + { + "name": "firstName", + "type": "string", + "label": "First name", + "required": true, + "validations": { + "min": 2, + "max": 100, + "message": "First name is required" + } + }, + { + "name": "middleName", + "type": "string", + "label": "Middle name", + "required": false, + "validations": { + "max": 100, + "message": "Middle name is required" + } + }, + { + "name": "lastName", + "type": "string", + "label": "Last name", + "required": true, + "validations": { + "min": 2, + "max": 100, + "message": "Last name is required" + } + }, + { + "name": "addressLine1", + "type": "string", + "label": "Address Line 1", + "required": true, + "validations": { + "min": 5, + "max": 200, + "message": "Address must be at least 5 characters" + } + }, + { + "name": "addressLine2", + "type": "string", + "label": "Address Line 2", + "required": false, + "validations": { + "max": 200 + } + }, + { + "name": "parish", + "type": "string", + "label": "Parish", + "required": true, + "validations": { + "regex": "^(christ-church|st-andrew|st-george|st-james|st-john|st-joseph|st-lucy|st-michael|st-peter|st-philip|st-thomas)$", + "message": "Must select a valid parish" + } + }, + { + "name": "postalCode", + "type": "string", + "label": "Postal Code", + "required": false, + "validations": { + "regex": "^BB\\d{5}$", + "message": "Enter a valid postal code (e.g., BB17004)" + } + }, + { + "name": "email", + "type": "email", + "label": "Email Address", + "required": true + }, + { + "name": "mobileNumber", + "type": "string", + "label": "Mobile number", + "required": true, + "validations": { + "regex": "^\\+?[0-9]{10,15}$", + "message": "Mobile number must be 10-15 digits" + } + }, + { + "name": "homeNumber", + "type": "string", + "label": "Home number", + "required": true, + "validations": { + "regex": "^\\+?[0-9]{10,15}$", + "message": "Home number must be 10-15 digits" + } + } + ] + }, + { + "name": "treesToRemove", + "type": "array", + "label": "Tell us about the protected tree you want to remove", + "required": false, + "items": { + "type": "object", + "properties": { + "typeOfProtectedTree": { + "type": "string" + }, + "reasonForRemovingTree": { + "type": "string" + }, + "addressLine1": { + "type": "string" + }, + "addressLine2": { + "type": "string" + }, + "parish": { + "type": "string" + } + } + } + } + ], + "processors": [ + { + "type": "email", + "config": { + "to": "{{db:permission-to-remove-tree:admin_email}}", + "subject": "New Request to remove protected tree - {{formData.applicant.firstName}} {{formData.applicant.lastName}}", + "template": "permission-to-remove-tree" + } + } + ] +} diff --git a/src/email/templates/permission-to-remove-tree.hbs b/src/email/templates/permission-to-remove-tree.hbs new file mode 100644 index 0000000..c624f89 --- /dev/null +++ b/src/email/templates/permission-to-remove-tree.hbs @@ -0,0 +1,103 @@ + + + + + + +
+

Request for Permission to Remove Protected Tree(s)

+
+ +
+

A new request for permission to remove protected tree has been + submitted.

+ +
+
Personal Information
+
+ Name: + {{applicant.title}} + {{applicant.firstName}} + {{applicant.lastName}} +
+
+ Address Line 1: + {{applicant.addressLine1}} +
+ {{#if applicant.addressLine2}} +
+ Address Line 2: + {{applicant.addressLine2}} +
+ {{/if}} +
+ Parish: + {{applicant.parish}} +
+ {{#if applicant.postalCode}} +
+ Postal Code: + {{applicant.postalCode}} +
+ {{/if}} + {{#if applicant.email}} +
+ Email: + {{applicant.email}} +
+ {{/if}} + {{#if applicant.mobileNumber}} +
+ Mobile Number: + {{applicant.mobileNumber}} +
+ {{/if}} + {{#if applicant.homeNumber}} +
+ Home Number: + {{applicant.homeNumber}} +
+ {{/if}} +
+ + {{#if treesToRemove}} +
+
Trees to remove
+ {{#each treesToRemove}} +
+ Type of Protected Tree: + {{this.typeOfProtectedTree}} + Reason for Removing Tree: + {{this.reasonForRemovingTree}} +
+ {{/each}} +
+ {{/if}} + + +
+ + \ No newline at end of file From 3230186b9ee3035f8c6c963f75bebec2f104c6dc Mon Sep 17 00:00:00 2001 From: Shannon Clarke Date: Tue, 6 Jan 2026 08:40:03 -0400 Subject: [PATCH 2/2] chore: update email template --- .../templates/permission-to-remove-tree.hbs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/email/templates/permission-to-remove-tree.hbs b/src/email/templates/permission-to-remove-tree.hbs index c624f89..ff3b442 100644 --- a/src/email/templates/permission-to-remove-tree.hbs +++ b/src/email/templates/permission-to-remove-tree.hbs @@ -82,11 +82,27 @@
Trees to remove
{{#each treesToRemove}} -
- Type of Protected Tree: - {{this.typeOfProtectedTree}} - Reason for Removing Tree: - {{this.reasonForRemovingTree}} +
+
+ Type of Protected Tree: + {{this.typeOfProtectedTree}} +
+
+ Reason for Removing Tree: + {{this.reasonForRemovingTree}} +
+
+ Address Line 1: + {{this.addressLine1}} +
+
+ Address Line 2: + {{this.addressLine2}} +
+
+ Parish: + {{this.parish}} +
{{/each}}