Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 158 additions & 0 deletions schemas/permission-to-remove-tree.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
119 changes: 119 additions & 0 deletions src/email/templates/permission-to-remove-tree.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<html>
<head>
<meta charset='utf-8' />
<style>
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333;
max-width: 800px; margin: 0 auto; padding: 20px; } .header {
background-color: #2c5282; color: white; padding: 20px; text-align:
center; border-radius: 5px 5px 0 0; } .content { background-color:
#f7fafc; padding: 30px; border: 1px solid #e2e8f0; border-top: none; }
.section { margin-bottom: 25px; background-color: white; padding: 20px;
border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.section-title { color: #2c5282; font-size: 18px; font-weight: bold;
margin-bottom: 15px; border-bottom: 2px solid #2c5282; padding-bottom:
5px; } .field { margin-bottom: 12px; } .field-label { font-weight: bold;
color: #4a5568; display: inline-block; width: 200px; } .field-value {
color: #1a202c; } .address-comparison { display: flex; gap: 20px; }
.address-box { flex: 1; border: 1px solid #e2e8f0; padding: 15px;
border-radius: 5px; } .old-address { background-color: #fed7d7; }
.new-address { background-color: #c6f6d5; } .footer { margin-top: 30px;
padding: 20px; background-color: #edf2f7; border-radius: 5px; text-align:
center; font-size: 14px; color: #718096; }
</style>
</head>
<body>
<div class='header'>
<h1>Request for Permission to Remove Protected Tree(s)</h1>
</div>

<div class='content'>
<p>A new request for permission to remove protected tree has been
submitted.</p>

<div class='section'>
<div class='section-title'>Personal Information</div>
<div class='field'>
<span class='field-label'>Name:</span>
<span class='field-value'>{{applicant.title}}
{{applicant.firstName}}
{{applicant.lastName}}</span>
</div>
<div class='field'>
<span class='field-label'>Address Line 1:</span>
<span class='field-value'>{{applicant.addressLine1}}</span>
</div>
{{#if applicant.addressLine2}}
<div class='field'>
<span class='field-label'>Address Line 2:</span>
<span class='field-value'>{{applicant.addressLine2}}</span>
</div>
{{/if}}
<div class='field'>
<span class='field-label'>Parish:</span>
<span class='field-value'>{{applicant.parish}}</span>
</div>
{{#if applicant.postalCode}}
<div class='field'>
<span class='field-label'>Postal Code:</span>
<span class='field-value'>{{applicant.postalCode}}</span>
</div>
{{/if}}
{{#if applicant.email}}
<div class='field'>
<span class='field-label'>Email:</span>
<span class='field-value'>{{applicant.email}}</span>
</div>
{{/if}}
{{#if applicant.mobileNumber}}
<div class='field'>
<span class='field-label'>Mobile Number:</span>
<span class='field-value'>{{applicant.mobileNumber}}</span>
</div>
{{/if}}
{{#if applicant.homeNumber}}
<div class='field'>
<span class='field-label'>Home Number:</span>
<span class='field-value'>{{applicant.homeNumber}}</span>
</div>
{{/if}}
</div>

{{#if treesToRemove}}
<div class='section'>
<div class='section-title'>Trees to remove</div>
{{#each treesToRemove}}
<div>
<div class='field'>
<span class='field-label'>Type of Protected Tree:</span>
<span class='field-value'> {{this.typeOfProtectedTree}}</span>
</div>
<div class='field'>
<span class='field-label'>Reason for Removing Tree:</span>
<span class='field-value'> {{this.reasonForRemovingTree}}</span>
</div>
<div class='field'>
<span class='field-label'>Address Line 1:</span>
<span class='field-value'> {{this.addressLine1}}</span>
</div>
<div class='field'>
<span class='field-label'>Address Line 2:</span>
<span class='field-value'> {{this.addressLine2}}</span>
</div>
<div class='field'>
<span class='field-label'>Parish:</span>
<span class='field-value'> {{this.parish}}</span>
</div>
</div>
{{/each}}
</div>
{{/if}}

<div class='footer'>
<p><strong>Submission ID:</strong> {{submissionId}}</p>
<p>This is an automated notification from the Permission to remove a
protected tree System.</p>
<p><em>Please review and process this address change request.</em></p>
</div>
</div>
</body>
</html>