From de2602549c1bf2ccf0430e2196559d4109ad50d8 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Wed, 31 Aug 2022 10:55:44 -0400 Subject: [PATCH] fix lot occupancies --- views/lot-edit.ejs | 137 ++++++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 65 deletions(-) diff --git a/views/lot-edit.ejs b/views/lot-edit.ejs index 548de7c5..442f30a5 100644 --- a/views/lot-edit.ejs +++ b/views/lot-edit.ejs @@ -29,19 +29,16 @@

- <%= lot.lotName %> + <% if (isCreate) { %> + Create a New <%= configFunctions.getProperty("aliases.lot") %> + <% } else { %> + <%= lot.lotName %> + <% } %>

-
- -
-
@@ -51,7 +48,6 @@ <%= configFunctions.getProperty("aliases.lot") %> Name
- pattern="<%= configFunctions.getProperty("settings.lot.lotNamePattern").source %>" @@ -177,7 +173,7 @@ <% } %> <% if (lot.mapId && !mapIsFound) { %> @@ -219,6 +215,16 @@
+ +
+ +
<% if (isCreate) { %> @@ -272,62 +278,63 @@
+
+ <% if (lot.lotOccupancies.length === 0) { %> +
+

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

+
+ <% } else { %> + + + + + + + + + + + + <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> + <% for (const lotOccupancy of lot.lotOccupancies) { %> + <% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %> + + + + + + + + <% } %> + +
 <%= configFunctions.getProperty("aliases.occupancy") %> TypeStart DateEnd Date<%= configFunctions.getProperty("aliases.occupants") %>
+ <% if (isActive) { %> + "> + <% } else { %> + "> + <% } %> + + + <%= lotOccupancy.occupancyType %> + + <%= lotOccupancy.occupancyStartDateString %> + <% if (lotOccupancy.occupancyEndDate) { %> + <%= lotOccupancy.occupancyEndDateString %> + <% } else { %> + (No End Date) + <% } %> + + <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> + (No <%= configFunctions.getProperty("aliases.occupants") %>) + <% } else { %> + <% const occupant = lotOccupancy.lotOccupancyOccupants[0]; %> + <%= occupant.occupantName %> + <%= (lotOccupancy.lotOccupancyOccupants.length > 1 ? " plus " + (lotOccupancy.lotOccupancyOccupants.length - 1) : "") %> + <% } %> +
+ <% } %> +
- - <% if (lot.lotOccupancies.length === 0) { %> -
-

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

-
- <% } else { %> - - - - - - - - - - - - <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> - <% for (const lotOccupancy of lot.lotOccupancies) { %> - <% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %> - - - - - - - - <% } %> - -
 <%= configFunctions.getProperty("aliases.occupancy") %> TypeStart DateEnd Date<%= configFunctions.getProperty("aliases.occupants") %>
- <% if (isActive) { %> - "> - <% } else { %> - "> - <% } %> - - - <%= lotOccupancy.occupancyType %> - - <%= lotOccupancy.occupancyStartDateString %> - <% if (lotOccupancy.occupancyEndDate) { %> - <%= lotOccupancy.occupancyEndDateString %> - <% } else { %> - (No End Date) - <% } %> - - <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> - (No <%= configFunctions.getProperty("aliases.occupants") %>) - <% } else { %> - <% const occupant = lotOccupancy.lotOccupancyOccupants[0]; %> - <%= occupant.occupantName %> - <%= (lotOccupancy.lotOccupancyOccupants.length > 1 ? " plus " + (lotOccupancy.lotOccupancyOccupants.length - 1) : "") %> - <% } %> -
- <% } %> <% } %> <%- include('_footerA'); -%>