diff --git a/public/javascripts/burialSite.edit.js b/public/javascripts/burialSite.edit.js index 68c300da..107639ec 100644 --- a/public/javascripts/burialSite.edit.js +++ b/public/javascripts/burialSite.edit.js @@ -367,4 +367,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); ?.addEventListener('click', openAddCommentModal); renderBurialSiteComments(); } + /* + * Contracts + */ + document + .querySelector('#burialSite--contractsToggle') + ?.addEventListener('click', () => { + const tableRowElements = document.querySelectorAll('#burialSite--contractsTbody tr[data-is-active="false"]'); + for (const tableRowElement of tableRowElements) { + tableRowElement.classList.toggle('is-hidden'); + } + }); })(); diff --git a/public/javascripts/burialSite.edit.ts b/public/javascripts/burialSite.edit.ts index be1855bf..2c551f41 100644 --- a/public/javascripts/burialSite.edit.ts +++ b/public/javascripts/burialSite.edit.ts @@ -8,7 +8,6 @@ import type { BurialSiteComment, BurialSiteTypeField } from '../../types/recordTypes.js' - import type { Sunrise } from './types.js' declare const cityssm: cityssmGlobal @@ -401,9 +400,9 @@ declare const exports: Record }, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { - success: boolean - errorMessage?: string burialSiteComments: BurialSiteComment[] + errorMessage?: string + success: boolean } if (responseJSON.success) { @@ -508,8 +507,8 @@ declare const exports: Record formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { - success: boolean burialSiteComments: BurialSiteComment[] + success: boolean } if (responseJSON.success) { @@ -559,4 +558,20 @@ declare const exports: Record ?.addEventListener('click', openAddCommentModal) renderBurialSiteComments() } + + /* + * Contracts + */ + + document + .querySelector('#burialSite--contractsToggle') + ?.addEventListener('click', () => { + const tableRowElements = document.querySelectorAll( + '#burialSite--contractsTbody tr[data-is-active="false"]' + ) + + for (const tableRowElement of tableRowElements) { + tableRowElement.classList.toggle('is-hidden') + } + }) })() diff --git a/public/javascripts/burialSite.view.js b/public/javascripts/burialSite.view.js index 01e40749..e4ae39b7 100644 --- a/public/javascripts/burialSite.view.js +++ b/public/javascripts/burialSite.view.js @@ -3,7 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); (() => { const mapContainerElement = document.querySelector('#burialSite--cemeterySvg'); if (mapContainerElement !== null) { - ; exports.sunrise.highlightMap(mapContainerElement, mapContainerElement.dataset.cemeterySvgId ?? '', 'success'); } + document + .querySelector('#burialSite--contractsToggle') + ?.addEventListener('click', () => { + const tableRowElements = document.querySelectorAll('#burialSite--contractsTbody tr[data-is-active="false"]'); + for (const tableRowElement of tableRowElements) { + tableRowElement.classList.toggle('is-hidden'); + } + }); })(); diff --git a/public/javascripts/burialSite.view.ts b/public/javascripts/burialSite.view.ts index 48f9b94f..8f703df3 100644 --- a/public/javascripts/burialSite.view.ts +++ b/public/javascripts/burialSite.view.ts @@ -1,15 +1,30 @@ import type { Sunrise } from './types.js' -declare const exports: Record +declare const exports: { + sunrise: Sunrise +} ;(() => { - const mapContainerElement: HTMLElement | null = - document.querySelector('#burialSite--cemeterySvg') + const mapContainerElement: HTMLElement | null = document.querySelector( + '#burialSite--cemeterySvg' + ) if (mapContainerElement !== null) { - ;(exports.sunrise as Sunrise).highlightMap( + exports.sunrise.highlightMap( mapContainerElement, mapContainerElement.dataset.cemeterySvgId ?? '', 'success' ) } + + document + .querySelector('#burialSite--contractsToggle') + ?.addEventListener('click', () => { + const tableRowElements = document.querySelectorAll( + '#burialSite--contractsTbody tr[data-is-active="false"]' + ) + + for (const tableRowElement of tableRowElements) { + tableRowElement.classList.toggle('is-hidden') + } + }) })() diff --git a/views/burialSite-edit.ejs b/views/burialSite-edit.ejs index 6cd4bb50..85268b70 100644 --- a/views/burialSite-edit.ejs +++ b/views/burialSite-edit.ejs @@ -416,8 +416,10 @@

Contracts - <%= burialSite.contracts.length %> -

+ +
+
+ <%= burialSite.contracts.length %>
@@ -427,6 +429,15 @@ Create New Contract
+ <% if (burialSite.contracts.length > 0) { %> +
+ +
+ <% } %> @@ -438,7 +449,7 @@

<% } else { %> - +
@@ -448,11 +459,11 @@ - + <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> <% for (const contract of burialSite.contracts) { %> <% const isActive = !(contract.contractEndDate && contract.contractEndDate < currentDate); %> - + ">
 Interments
<% if (isActive) { %> diff --git a/views/burialSite-view.ejs b/views/burialSite-view.ejs index c7dfbdfb..50d54e62 100644 --- a/views/burialSite-view.ejs +++ b/views/burialSite-view.ejs @@ -144,10 +144,29 @@ <% } %>
-

- Contracts - <%= burialSite.contracts.length %> -

+
+
+
+
+

Contracts

+
+
+ <%= burialSite.contracts.length %> +
+
+ <% if (burialSite.contracts.length > 0) { %> +
+
+ +
+
+ <% } %> +
+
<% if (burialSite.contracts.length === 0) { %>
@@ -156,7 +175,7 @@

<% } else { %> - +
@@ -166,11 +185,11 @@ - + <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> <% for (const contract of burialSite.contracts) { %> <% const isActive = !(contract.contractEndDate && contract.contractEndDate < currentDate); %> - + ">
 Interments
<% if (isActive) { %>