diff --git a/helpers/lotOccupancyDB/getReportData.js b/helpers/lotOccupancyDB/getReportData.js index aa2e0a97..96c0e068 100644 --- a/helpers/lotOccupancyDB/getReportData.js +++ b/helpers/lotOccupancyDB/getReportData.js @@ -21,6 +21,19 @@ const lotOccupancyIdAlias = occupancyCamelCase + 'Id'; const occupancyTypeAlias = occupancyCamelCase + 'Type'; const occupancyStartDateAlias = occupancyCamelCase + 'StartDate'; const occupancyEndDateAlias = occupancyCamelCase + 'EndDate'; +const occupantCamelCase = camelCase(configFunctions.getProperty('aliases.occupant')); +const lotOccupantIndexAlias = occupantCamelCase + 'Index'; +const lotOccupantTypeAlias = occupantCamelCase + 'Type'; +const occupantNameAlias = occupantCamelCase + 'Name'; +const occupantAddress1Alias = occupantCamelCase + 'Address1'; +const occupantAddress2Alias = occupantCamelCase + 'Address2'; +const occupantCityAlias = occupantCamelCase + 'City'; +const occupantProvinceAlias = occupantCamelCase + 'Province'; +const occupantPostalCodeAlias = occupantCamelCase + 'PostalCode'; +const occupantPhoneNumberAlias = occupantCamelCase + 'PhoneNumber'; +const occupantEmailAddressAlias = occupantCamelCase + 'EmailAddress'; +const occupantCommentTitleAlias = occupantCamelCase + 'CommentTitle'; +const occupantCommentAlias = occupantCamelCase + 'Comment'; export async function getReportData(reportName, reportParameters = {}) { let sql; const sqlParameters = []; @@ -137,6 +150,26 @@ export async function getReportData(reportName, reportParameters = {}) { sql = 'select * from LotOccupancyOccupants'; break; } + case 'lotOccupancyOccupants-byLotOccupancyId': { + sql = `select o.lotOccupantIndex as ${lotOccupantIndexAlias}, + t.lotOccupantType as ${lotOccupantTypeAlias}, + o.occupantName as ${occupantNameAlias}, + o.occupantAddress1 as ${occupantAddress1Alias}, + o.occupantAddress2 as ${occupantAddress2Alias}, + o.occupantCity as ${occupantCityAlias}, + o.occupantProvince as ${occupantProvinceAlias}, + o.occupantPostalCode as ${occupantPostalCodeAlias}, + o.occupantPhoneNumber as ${occupantPhoneNumberAlias}, + o.occupantEmailAddress as ${occupantEmailAddressAlias}, + t.occupantCommentTitle as ${occupantCommentTitleAlias}, + o.occupantComment as ${occupantCommentAlias} + from LotOccupancyOccupants o + left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId + where o.recordDelete_timeMillis is null + and o.lotOccupancyId = ?`; + sqlParameters.push(reportParameters.lotOccupancyId); + break; + } case 'lotOccupancyTransactions-all': { sql = 'select * from LotOccupancyTransactions'; break; @@ -187,6 +220,20 @@ export async function getReportData(reportName, reportParameters = {}) { sql = 'select * from WorkOrderMilestones'; break; } + case 'workOrderMilestones-byWorkOrderId': { + sql = `select t.workOrderMilestoneType, + m.workOrderMilestoneDate, + m.workOrderMilestoneTime, + m.workOrderMilestoneDescription, + m.workOrderMilestoneCompletionDate, + m.workOrderMilestoneCompletionTime + from WorkOrderMilestones m + left join WorkOrderMilestoneTypes t on m.workOrderMilestoneTypeId = t.workOrderMilestoneTypeId + where m.recordDelete_timeMillis is null + and m.workOrderId = ?`; + sqlParameters.push(reportParameters.workOrderId); + break; + } case 'fees-all': { sql = 'select * from Fees'; break; diff --git a/helpers/lotOccupancyDB/getReportData.ts b/helpers/lotOccupancyDB/getReportData.ts index bf687218..3e51aa6c 100644 --- a/helpers/lotOccupancyDB/getReportData.ts +++ b/helpers/lotOccupancyDB/getReportData.ts @@ -33,6 +33,22 @@ const occupancyTypeAlias = occupancyCamelCase + 'Type' const occupancyStartDateAlias = occupancyCamelCase + 'StartDate' const occupancyEndDateAlias = occupancyCamelCase + 'EndDate' +const occupantCamelCase = camelCase( + configFunctions.getProperty('aliases.occupant') +) +const lotOccupantIndexAlias = occupantCamelCase + 'Index' +const lotOccupantTypeAlias = occupantCamelCase + 'Type' +const occupantNameAlias = occupantCamelCase + 'Name' +const occupantAddress1Alias = occupantCamelCase + 'Address1' +const occupantAddress2Alias = occupantCamelCase + 'Address2' +const occupantCityAlias = occupantCamelCase + 'City' +const occupantProvinceAlias = occupantCamelCase + 'Province' +const occupantPostalCodeAlias = occupantCamelCase + 'PostalCode' +const occupantPhoneNumberAlias = occupantCamelCase + 'PhoneNumber' +const occupantEmailAddressAlias = occupantCamelCase + 'EmailAddress' +const occupantCommentTitleAlias = occupantCamelCase + 'CommentTitle' +const occupantCommentAlias = occupantCamelCase + 'Comment' + export async function getReportData( reportName: string, reportParameters: ReportParameters = {} @@ -179,6 +195,27 @@ export async function getReportData( break } + case 'lotOccupancyOccupants-byLotOccupancyId': { + sql = `select o.lotOccupantIndex as ${lotOccupantIndexAlias}, + t.lotOccupantType as ${lotOccupantTypeAlias}, + o.occupantName as ${occupantNameAlias}, + o.occupantAddress1 as ${occupantAddress1Alias}, + o.occupantAddress2 as ${occupantAddress2Alias}, + o.occupantCity as ${occupantCityAlias}, + o.occupantProvince as ${occupantProvinceAlias}, + o.occupantPostalCode as ${occupantPostalCodeAlias}, + o.occupantPhoneNumber as ${occupantPhoneNumberAlias}, + o.occupantEmailAddress as ${occupantEmailAddressAlias}, + t.occupantCommentTitle as ${occupantCommentTitleAlias}, + o.occupantComment as ${occupantCommentAlias} + from LotOccupancyOccupants o + left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId + where o.recordDelete_timeMillis is null + and o.lotOccupancyId = ?` + sqlParameters.push(reportParameters.lotOccupancyId) + break + } + case 'lotOccupancyTransactions-all': { sql = 'select * from LotOccupancyTransactions' break @@ -241,6 +278,21 @@ export async function getReportData( break } + case 'workOrderMilestones-byWorkOrderId': { + sql = `select t.workOrderMilestoneType, + m.workOrderMilestoneDate, + m.workOrderMilestoneTime, + m.workOrderMilestoneDescription, + m.workOrderMilestoneCompletionDate, + m.workOrderMilestoneCompletionTime + from WorkOrderMilestones m + left join WorkOrderMilestoneTypes t on m.workOrderMilestoneTypeId = t.workOrderMilestoneTypeId + where m.recordDelete_timeMillis is null + and m.workOrderId = ?` + sqlParameters.push(reportParameters.workOrderId) + break + } + case 'fees-all': { sql = 'select * from Fees' break diff --git a/views/lotOccupancy-edit.ejs b/views/lotOccupancy-edit.ejs index ef6da56b..ff5a7137 100644 --- a/views/lotOccupancy-edit.ejs +++ b/views/lotOccupancy-edit.ejs @@ -411,26 +411,32 @@ <% if (!isCreate) { %>
-
-
-
-
-

- <%= configFunctions.getProperty("aliases.occupants") %> -

-
-
-
-
- -
-
+
+
+
+
+

+ <%= configFunctions.getProperty("aliases.occupants") %> +

+
+
+
+ +
+ +
-
+
+
diff --git a/views/lotOccupancy-view.ejs b/views/lotOccupancy-view.ejs index 84eced8a..132c8a3a 100644 --- a/views/lotOccupancy-view.ejs +++ b/views/lotOccupancy-view.ejs @@ -144,67 +144,81 @@
-

- <%= configFunctions.getProperty("aliases.occupants") %> -

-
- <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> -
-

- There are no <%= configFunctions.getProperty("aliases.occupants").toLowerCase() %> - associated with this record. -

+
+
+
+
+

<%= configFunctions.getProperty("aliases.occupants") %>

- <% } else { %> - - - - - - - - - - - <% for (const lotOccupancyOccupant of lotOccupancy.lotOccupancyOccupants) { %> - - - - - - - <% } %> - -
<%= configFunctions.getProperty("aliases.occupant") %>AddressOther ContactComment
- <%= lotOccupancyOccupant.occupantName %>
- - - <%= lotOccupancyOccupant.lotOccupantType %> - -
- <% if (lotOccupancyOccupant.occupantAddress1) { %> - <%= lotOccupancyOccupant.occupantAddress1 %>
- <% } %> - <% if (lotOccupancyOccupant.occupantAddress2) { %> - <%= lotOccupancyOccupant.occupantAddress2 %>
- <% } %> - <% if (lotOccupancyOccupant.occupantCity) { %> - <%= lotOccupancyOccupant.occupantCity %>, - <% } %> - <%= lotOccupancyOccupant.occupantProvince %>
- <%= lotOccupancyOccupant.occupantPostalCode %> -
- <% if (lotOccupancyOccupant.occupantPhoneNumber) { %> - <%= lotOccupancyOccupant.occupantPhoneNumber %>
- <% } %> - <%= lotOccupancyOccupant.occupantEmailAddress %> -
- - <%= lotOccupancyOccupant.occupantComment %> - -
- <% } %> +
+
+
+
+ <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> +
+

+ There are no <%= configFunctions.getProperty("aliases.occupants").toLowerCase() %> + associated with this record. +

+
+ <% } else { %> + + + + + + + + + + + <% for (const lotOccupancyOccupant of lotOccupancy.lotOccupancyOccupants) { %> + + + + + + + <% } %> + +
<%= configFunctions.getProperty("aliases.occupant") %>AddressOther ContactComment
+ <%= lotOccupancyOccupant.occupantName %>
+ + + <%= lotOccupancyOccupant.lotOccupantType %> + +
+ <% if (lotOccupancyOccupant.occupantAddress1) { %> + <%= lotOccupancyOccupant.occupantAddress1 %>
+ <% } %> + <% if (lotOccupancyOccupant.occupantAddress2) { %> + <%= lotOccupancyOccupant.occupantAddress2 %>
+ <% } %> + <% if (lotOccupancyOccupant.occupantCity) { %> + <%= lotOccupancyOccupant.occupantCity %>, + <% } %> + <%= lotOccupancyOccupant.occupantProvince %>
+ <%= lotOccupancyOccupant.occupantPostalCode %> +
+ <% if (lotOccupancyOccupant.occupantPhoneNumber) { %> + <%= lotOccupancyOccupant.occupantPhoneNumber %>
+ <% } %> + <%= lotOccupancyOccupant.occupantEmailAddress %> +
+ + <%= lotOccupancyOccupant.occupantComment %> + +
+ <% } %> +
<% if (lotOccupancy.lotOccupancyComments.length > 0) { %> diff --git a/views/map-search.ejs b/views/map-search.ejs index 2f88441f..8c316f26 100644 --- a/views/map-search.ejs +++ b/views/map-search.ejs @@ -1,44 +1,60 @@ <%- include('_header'); -%> -

- Find a <%= configFunctions.getProperty("aliases.map") %> -

+
+
+
+

+ Find a <%= configFunctions.getProperty("aliases.map") %> +

+
+
+ +
<% if (user.userProperties.canUpdate) { %> <% } %>
-
-
-
- name, description, and address" - accesskey="f" /> - - - -
-
-
+
+
+
+ name, description, and address" + accesskey="f" /> + + + +
+
+
@@ -46,7 +62,7 @@ <%- include('_footerA'); -%> diff --git a/views/report-search.ejs b/views/report-search.ejs index 859c4199..ada712ab 100644 --- a/views/report-search.ejs +++ b/views/report-search.ejs @@ -1,625 +1,624 @@ <%- include('_header'); -%> -
- -
- + +
+ -
- - - +
+
+ +
+
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ <% + const currentDateString = dateTimeFunctions.dateToString(new Date()); + %> + + + + +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + + <% if (!isCreate) { %>

Related <%= configFunctions.getProperty("aliases.lots") %>

@@ -255,72 +255,76 @@
- <% } %> + <% } %> - <% if (!isCreate) { %> -
-
-
-
-
-

- Comments -

-
+ <% if (!isCreate) { %> +
+
+
+
+
+

+ Comments +

-
-
- -
+
+
+
+
-
- <% } %> +
+
+ <% } %>
<% if (!isCreate) { %> -
-
-
-
-
-
-

Milestones

-
-
-
-
- -
-
- +
+
+
<% } %>
diff --git a/views/workOrder-view.ejs b/views/workOrder-view.ejs index 002c2eea..cd6df345 100644 --- a/views/workOrder-view.ejs +++ b/views/workOrder-view.ejs @@ -85,267 +85,271 @@
-
-
-
-
-
-

- Work Order Type
- <%= workOrder.workOrderType %> -

-

- Description
- <% if (workOrder.workOrderDescription) { %> - <%= workOrder.workOrderDescription %> - <% } else { %> - (No Description) - <% } %> -

-
-
-

- <%= configFunctions.getProperty("aliases.workOrderOpenDate") %>
- <%= workOrder.workOrderOpenDateString %> -

-

- <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>
- <% if (workOrder.workOrderCloseDate) { %> - <%= workOrder.workOrderCloseDateString %> - <% } else { %> - (No <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>) - <% } %> -

-
+
+
+
+
+
+

+ Work Order Type
+ <%= workOrder.workOrderType %> +

+

+ Description
+ <% if (workOrder.workOrderDescription) { %> + <%= workOrder.workOrderDescription %> + <% } else { %> + (No Description) + <% } %> +

+
+
+

+ <%= configFunctions.getProperty("aliases.workOrderOpenDate") %>
+ <%= workOrder.workOrderOpenDateString %> +

+

+ <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>
+ <% if (workOrder.workOrderCloseDate) { %> + <%= workOrder.workOrderCloseDateString %> + <% } else { %> + (No <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>) + <% } %> +

- -
-

Related <%= configFunctions.getProperty("aliases.lots") %>

-
- <% - const tabToSelect = (workOrder.workOrderLotOccupancies.length > 0 || workOrder.workOrderLots.length === 0 ? "lotOccupancies" : "lots"); - %> - -
-
" id="relatedTab--lotOccupancies"> - <% if (workOrder.workOrderLotOccupancies.length === 0) { %> -
-

- There are no - <%= configFunctions.getProperty("aliases.lot").toLowerCase() %> - <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> - records associated with this work order. -

-
- <% } else { %> - <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> - - - - - - - - - - - - - <% for (const lotOccupancy of workOrder.workOrderLotOccupancies) { %> - <% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %> - - - - - - - - - <% } %> - -
<%= configFunctions.getProperty("aliases.occupancy") %> Type<%= configFunctions.getProperty("aliases.lot") %><%= configFunctions.getProperty("aliases.occupancyStartDate") %>End Date<%= configFunctions.getProperty("aliases.occupants") %>
- <% if (isActive) { %> - "> - <% } else { %> - "> - <% } %> - - - <%= lotOccupancy.occupancyType %> - - - <% if (lotOccupancy.lotId) { %> - <%= lotOccupancy.lotName %> - <% } else { %> - (No <%= configFunctions.getProperty("aliases.lot") %>) - <% } %> - <%= lotOccupancy.occupancyStartDateString %> - <% if (lotOccupancy.occupancyEndDate) { %> - <%= lotOccupancy.occupancyEndDateString %> - <% } else { %> - (No End Date) - <% } %> - - <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> - (No <%= configFunctions.getProperty("aliases.occupants") %>) - <% } else { %> - <% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %> - - - <%= occupant.occupantName %> -
- <% } %> - <% } %> -
- <% } %> -
-
" id="relatedTab--lots"> - <% if (workOrder.workOrderLots.length === 0) { %> -
-

- There are no - <%= configFunctions.getProperty("aliases.lots").toLowerCase() %> - records associated with this work order. -

-
- <% } else { %> - - - - - - - - - - - <% for (const lot of workOrder.workOrderLots) { %> - - - - - - - <% } %> - -
<%= configFunctions.getProperty("aliases.lot") %><%= configFunctions.getProperty("aliases.map") %><%= configFunctions.getProperty("aliases.lot") %> TypeStatus
- <%= lot.lotName %> - <%= lot.mapName %><%= lot.lotType %><%= lot.lotStatus %>
- <% } %> -
-
-
-
- - <% if (workOrder.workOrderComments.length > 0) { %> -
-

Work Order Comments

-
- - - - - - - - - - <% for (const workOrderComment of workOrder.workOrderComments) { %> - - - - - - <% } %> - -
CommentorComment DateComment
<%= workOrderComment.recordCreate_userName %> - <%= workOrderComment.workOrderCommentDateString %> - <%= (workOrderComment.workOrderCommentTime === 0 ? "" : workOrderComment.workOrderCommentTimeString) %> - <%= workOrderComment.workOrderComment %>
-
-
- <% } %>
- <% if (workOrder.workOrderMilestones.length > 0) { %> -
-
-
-
-
-
-

Milestones

+ +
+

Related <%= configFunctions.getProperty("aliases.lots") %>

+
+ <% + const tabToSelect = (workOrder.workOrderLotOccupancies.length > 0 || workOrder.workOrderLots.length === 0 ? "lotOccupancies" : "lots"); + %> + +
+
" id="relatedTab--lotOccupancies"> + <% if (workOrder.workOrderLotOccupancies.length === 0) { %> +
+

+ There are no + <%= configFunctions.getProperty("aliases.lot").toLowerCase() %> + <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> + records associated with this work order. +

-
-
-
- -
-
-
+ <% } else { %> + <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> + + + + + + + + + + + + + <% for (const lotOccupancy of workOrder.workOrderLotOccupancies) { %> + <% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %> + + + + + + + + + <% } %> + +
<%= configFunctions.getProperty("aliases.occupancy") %> Type<%= configFunctions.getProperty("aliases.lot") %><%= configFunctions.getProperty("aliases.occupancyStartDate") %>End Date<%= configFunctions.getProperty("aliases.occupants") %>
+ <% if (isActive) { %> + "> + <% } else { %> + "> + <% } %> + + + <%= lotOccupancy.occupancyType %> + + + <% if (lotOccupancy.lotId) { %> + <%= lotOccupancy.lotName %> + <% } else { %> + (No <%= configFunctions.getProperty("aliases.lot") %>) + <% } %> + <%= lotOccupancy.occupancyStartDateString %> + <% if (lotOccupancy.occupancyEndDate) { %> + <%= lotOccupancy.occupancyEndDateString %> + <% } else { %> + (No End Date) + <% } %> + + <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> + (No <%= configFunctions.getProperty("aliases.occupants") %>) + <% } else { %> + <% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %> + + + <%= occupant.occupantName %> +
+ <% } %> + <% } %> +
+ <% } %>
- <% for (const milestone of workOrder.workOrderMilestones) { %> -
-
-
- <% if (milestone.workOrderMilestoneCompletionDate) { %> - - - - <% } else { %> - - - - <% } %> -
-
- <% if (milestone.workOrderMilestoneTypeId) { %> - <%= milestone.workOrderMilestoneType %>
- <% } %> - <%= milestone.workOrderMilestoneDateString %> - <% if (milestone.workOrderMilestoneTime !== 0) { %> - <%= milestone.workOrderMilestoneTimeString %> - <% } %> -
- <%= milestone.workOrderMilestoneDescription %> -
+
" id="relatedTab--lots"> + <% if (workOrder.workOrderLots.length === 0) { %> +
+

+ There are no + <%= configFunctions.getProperty("aliases.lots").toLowerCase() %> + records associated with this work order. +

-
- <% } %> + <% } else { %> + + + + + + + + + + + <% for (const lot of workOrder.workOrderLots) { %> + + + + + + + <% } %> + +
<%= configFunctions.getProperty("aliases.lot") %><%= configFunctions.getProperty("aliases.map") %><%= configFunctions.getProperty("aliases.lot") %> TypeStatus
+ <%= lot.lotName %> + <%= lot.mapName %><%= lot.lotType %><%= lot.lotStatus %>
+ <% } %> +
+
+
+
+ + <% if (workOrder.workOrderComments.length > 0) { %> +
+

Work Order Comments

+
+ + + + + + + + + + <% for (const workOrderComment of workOrder.workOrderComments) { %> + + + + + + <% } %> + +
CommentorComment DateComment
<%= workOrderComment.recordCreate_userName %> + <%= workOrderComment.workOrderCommentDateString %> + <%= (workOrderComment.workOrderCommentTime === 0 ? "" : workOrderComment.workOrderCommentTimeString) %> + <%= workOrderComment.workOrderComment %>
<% } %> +
+ <% if (workOrder.workOrderMilestones.length > 0) { %> +
+
+
+
+
+
+

Milestones

+
+
+ +
+
+ <% for (const milestone of workOrder.workOrderMilestones) { %> +
+
+
+ <% if (milestone.workOrderMilestoneCompletionDate) { %> + + + + <% } else { %> + + + + <% } %> +
+
+ <% if (milestone.workOrderMilestoneTypeId) { %> + <%= milestone.workOrderMilestoneType %>
+ <% } %> + <%= milestone.workOrderMilestoneDateString %> + <% if (milestone.workOrderMilestoneTime !== 0) { %> + <%= milestone.workOrderMilestoneTimeString %> + <% } %> +
+ <%= milestone.workOrderMilestoneDescription %> +
+
+
+ <% } %> +
+
+ <% } %>
<%- include('_footerA'); -%>