Skip to content

Commit

Permalink
Merge branch 'main' into PIMS-2137-Export-Additions
Browse files Browse the repository at this point in the history
  • Loading branch information
LawrenceLau2020 authored Oct 21, 2024
2 parents dfe9e21 + a27b02a commit 9769fb0
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -29,6 +30,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -29,6 +30,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -29,6 +30,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -31,6 +32,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -30,6 +31,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -30,6 +31,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -29,6 +30,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -29,6 +30,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -29,6 +30,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<li>
{% if property.Type == "Parcel" %}
<span>
Site Address: {{ property.Address1 }}
<br>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}
<br>
Site Size: {{ property.TotalArea }} ha
Expand All @@ -41,8 +41,8 @@
</span>
{% else %}
<span>
Site Address: {{ property.Address1 }}
<br>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}
<br>
Rentable Area: {{ property.RentableArea }} Sq. M
Expand Down
2 changes: 2 additions & 0 deletions express-api/src/notificationTemplates/NewPropertiesOnERP.njk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{% if property.PropertyType == PropertyTypes.Land %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Site Size: {{ property.LandArea }} ha<br>
Zoned: {{ property.Zoning }}<br>
Expand All @@ -30,6 +31,7 @@
{% else %}
<span>
Site Address: {{ property.Address1 }}<br>
Site Location: {{ property.AdministrativeArea.Name }}<br>
Site Description: {{ property.Name }}<br>
Rentable Area: {{ property.RentableArea }} Sq. M<br>
Building Floors: {{ property.BuildingFloorCount }} <br>
Expand Down
2 changes: 2 additions & 0 deletions express-api/src/services/projects/projectsServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,14 @@ const handleProjectNotifications = async (
Evaluations: true,
Fiscals: true,
Agency: true,
AdministrativeArea: true,
BuildingPredominateUse: true,
},
Parcel: {
Evaluations: true,
Fiscals: true,
Agency: true,
AdministrativeArea: true,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddAdminAreaToERPNotifications1728680019519 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
-- update the "New Disposal Project Submitted template" first because of different formatting and spacing
-- add a new line for the Site Location using the admin area name
UPDATE notification_template
SET body = REGEXP_REPLACE(
body,
'Site Address: {{ property.Address1 }}' || chr(10) || '[[:space:]]+<br>', -- to find all instances of spaces before the <br> that follows after a new line
'Site Address: {{ property.Address1 }}<br>' || chr(10) || chr(9) || chr(9) || chr(9) || chr(9) || chr(9) || 'Site Location: {{ property.AdministrativeArea.Name }}<br>',
'g') -- 'g' to replace all instances within a template
WHERE body LIKE '%Site Address: {{ property.Address1 }}' || chr(10) || '%<br>%' AND id = 1`);
await queryRunner.query(`
-- update the other 10 templates which have different spacing
UPDATE notification_template
SET body = REGEXP_REPLACE(
body,
'Site Address: {{ property.Address1 }}<br>',
'Site Address: {{ property.Address1 }}<br>' || chr(10) || chr(9) || chr(9) || chr(9) || chr(9) || chr(9) || chr(9) || chr(9) || chr(9) || chr(9) || 'Site Location: {{ property.AdministrativeArea.Name }}<br>',
'g') -- 'g' to replace all instances within a template
WHERE body LIKE '%Site Address: {{ property.Address1 }}<br>%' AND id >= 5 and id <= 14`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
-- Remove administrative area line
UPDATE notification_template
SET body = REGEXP_REPLACE(
body,
'Site Address: {{ property.Address1 }}<br>[\\s\\t]*Site Location: {{ property.AdministrativeArea.Name }}<br>',
'Site Address: {{ property.Address1 }}' || chr(10) || chr(9) || chr(9) || chr(9) || chr(9) || chr(9) || '<br>',
'g')
WHERE body LIKE '%Site Location: {{ property.AdministrativeArea.Name }}<br>%'
AND id = 1`);

await queryRunner.query(`
-- Remove Site Location line and set it back the way it was
UPDATE notification_template
SET body = REGEXP_REPLACE(
body,
'Site Address: {{ property.Address1 }}<br>[\\s\\t]*Site Location: {{ property.AdministrativeArea.Name }}<br>',
'Site Address: {{ property.Address1 }}<br>',
'g') -- 'g' to replace all instances within a template
WHERE body LIKE '%Site Location: {{ property.AdministrativeArea.Name }}<br>%'
AND id >= 5 AND id <= 14
`);
}
}

0 comments on commit 9769fb0

Please sign in to comment.