From 4900895f5e9dbf6ca91ef70ecdaee33e51ad9494 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 25 Mar 2025 12:21:59 -0400 Subject: [PATCH] show funeral home and purchaser --- public/javascripts/contract.search.js | 30 +++++++++++++++++----- public/javascripts/contract.search.ts | 37 ++++++++++++++++++++------- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/public/javascripts/contract.search.js b/public/javascripts/contract.search.js index 1376b4f8..36e6276f 100644 --- a/public/javascripts/contract.search.js +++ b/public/javascripts/contract.search.js @@ -38,11 +38,27 @@ Object.defineProperty(exports, "__esModule", { value: true }); `; } - let deceasedHTML = ''; + let contactsHTML = ''; for (const interment of contract.contractInterments ?? []) { - deceasedHTML += `
  • + contactsHTML += `
  • ${cityssm.escapeHTML(interment.deceasedName ?? '')} +
  • `; + } + if (contract.purchaserName !== '') { + contactsHTML += `
  • + + ${cityssm.escapeHTML(contract.purchaserName)} +
  • `; + } + if (contract.funeralHomeName !== null && + contract.funeralHomeName !== '') { + contactsHTML += `
  • + + ${cityssm.escapeHTML(contract.funeralHomeName)}
  • `; } const feeTotal = (contract.contractFees?.reduce((soFar, currentFee) => soFar + @@ -66,7 +82,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); - ${cityssm.escapeHTML(contract.contractType ?? '')} + ${cityssm.escapeHTML(contract.contractType)}
    #${contract.contractId} @@ -84,9 +100,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); ? contract.contractEndDateString : '(No End Date)'} - ${deceasedHTML === '' + ${contactsHTML === '' ? '' - : ``} + : ``} ${feeIconHTML} @@ -104,7 +120,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); Burial Site Contract Date End Date - Recipient / Deceased + Contacts Fees and Transactions Print @@ -123,7 +139,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); } function getContracts() { // eslint-disable-next-line no-unsanitized/property - searchResultsContainerElement.innerHTML = sunrise.getLoadingParagraphHTML("Loading Contracts..."); + searchResultsContainerElement.innerHTML = sunrise.getLoadingParagraphHTML('Loading Contracts...'); cityssm.postJSON(`${sunrise.urlPrefix}/contracts/doSearchContracts`, searchFilterFormElement, renderContracts); } function resetOffsetAndGetContracts() { diff --git a/public/javascripts/contract.search.ts b/public/javascripts/contract.search.ts index 5aa359ad..87be8538 100644 --- a/public/javascripts/contract.search.ts +++ b/public/javascripts/contract.search.ts @@ -1,7 +1,6 @@ import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { Contract } from '../../types/recordTypes.js' - import type { Sunrise } from './types.js' declare const cityssm: cityssmGlobal @@ -30,9 +29,9 @@ declare const exports: Record // eslint-disable-next-line complexity function renderContracts(rawResponseJSON: unknown): void { const responseJSON = rawResponseJSON as { + contracts: Contract[] count: number offset: number - contracts: Contract[] } if (responseJSON.contracts.length === 0) { @@ -70,15 +69,35 @@ declare const exports: Record ` } - let deceasedHTML = '' + let contactsHTML = '' for (const interment of contract.contractInterments ?? []) { - deceasedHTML += `
  • + contactsHTML += `
  • ${cityssm.escapeHTML(interment.deceasedName ?? '')}
  • ` } + if (contract.purchaserName !== '') { + contactsHTML += `
  • + + ${cityssm.escapeHTML(contract.purchaserName)} +
  • ` + } + + if ( + contract.funeralHomeName !== null && + contract.funeralHomeName !== '' + ) { + contactsHTML += `
  • + + ${cityssm.escapeHTML(contract.funeralHomeName)} +
  • ` + } + const feeTotal = ( contract.contractFees?.reduce( (soFar, currentFee): number => @@ -120,7 +139,7 @@ declare const exports: Record - ${cityssm.escapeHTML(contract.contractType ?? '')} + ${cityssm.escapeHTML(contract.contractType)}
    #${contract.contractId} @@ -143,9 +162,9 @@ declare const exports: Record } ${ - deceasedHTML === '' + contactsHTML === '' ? '' - : `
      ${deceasedHTML}
    ` + : `
      ${contactsHTML}
    ` } ${feeIconHTML} @@ -168,7 +187,7 @@ declare const exports: Record Burial Site Contract Date End Date - Recipient / Deceased + Contacts Fees and Transactions Print @@ -200,7 +219,7 @@ declare const exports: Record function getContracts(): void { // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = sunrise.getLoadingParagraphHTML( - "Loading Contracts..." + 'Loading Contracts...' ) cityssm.postJSON(