show funeral home and purchaser

pull/3/head
Dan Gowans 2025-03-25 12:21:59 -04:00
parent 261f1ba354
commit 4900895f5e
2 changed files with 51 additions and 16 deletions

View File

@ -38,11 +38,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
<i class="fas fa-stop" aria-label="Past Contract"></i> <i class="fas fa-stop" aria-label="Past Contract"></i>
</span>`; </span>`;
} }
let deceasedHTML = ''; let contactsHTML = '';
for (const interment of contract.contractInterments ?? []) { for (const interment of contract.contractInterments ?? []) {
deceasedHTML += `<li class="has-tooltip-left"> contactsHTML += `<li class="has-tooltip-left"
data-tooltip="${contract.isPreneed ? 'Recipient' : 'Deceased'}">
<span class="fa-li"><i class="fas fa-user"></i></span> <span class="fa-li"><i class="fas fa-user"></i></span>
${cityssm.escapeHTML(interment.deceasedName ?? '')} ${cityssm.escapeHTML(interment.deceasedName ?? '')}
</li>`;
}
if (contract.purchaserName !== '') {
contactsHTML += `<li class="has-tooltip-left has-text-grey"
data-tooltip="Purchaser">
<span class="fa-li"><i class="fas fa-hand-holding-dollar"></i></span>
${cityssm.escapeHTML(contract.purchaserName)}
</li>`;
}
if (contract.funeralHomeName !== null &&
contract.funeralHomeName !== '') {
contactsHTML += `<li class="has-tooltip-left has-text-grey"
data-tooltip="Funeral Home">
<span class="fa-li"><i class="fas fa-church"></i></span>
${cityssm.escapeHTML(contract.funeralHomeName)}
</li>`; </li>`;
} }
const feeTotal = (contract.contractFees?.reduce((soFar, currentFee) => soFar + const feeTotal = (contract.contractFees?.reduce((soFar, currentFee) => soFar +
@ -66,7 +82,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
</td><td> </td><td>
<a class="has-text-weight-bold" <a class="has-text-weight-bold"
href="${sunrise.getContractURL(contract.contractId)}"> href="${sunrise.getContractURL(contract.contractId)}">
${cityssm.escapeHTML(contract.contractType ?? '')} ${cityssm.escapeHTML(contract.contractType)}
</a><br /> </a><br />
<span class="is-size-7">#${contract.contractId}</span> <span class="is-size-7">#${contract.contractId}</span>
</td><td> </td><td>
@ -84,9 +100,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
? contract.contractEndDateString ? contract.contractEndDateString
: '<span class="has-text-grey">(No End Date)</span>'} : '<span class="has-text-grey">(No End Date)</span>'}
</td><td> </td><td>
${deceasedHTML === '' ${contactsHTML === ''
? '' ? ''
: `<ul class="fa-ul ml-5">${deceasedHTML}</ul>`} : `<ul class="fa-ul ml-5">${contactsHTML}</ul>`}
</td><td> </td><td>
${feeIconHTML} ${feeIconHTML}
</td><td> </td><td>
@ -104,7 +120,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
<th>Burial Site</th> <th>Burial Site</th>
<th>Contract Date</th> <th>Contract Date</th>
<th>End Date</th> <th>End Date</th>
<th>Recipient / Deceased</th> <th>Contacts</th>
<th class="has-width-1"><span class="is-sr-only">Fees and Transactions</span></th> <th class="has-width-1"><span class="is-sr-only">Fees and Transactions</span></th>
<th class="has-width-1"><span class="is-sr-only">Print</span></th> <th class="has-width-1"><span class="is-sr-only">Print</span></th>
</tr></thead> </tr></thead>
@ -123,7 +139,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
function getContracts() { function getContracts() {
// eslint-disable-next-line no-unsanitized/property // 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); cityssm.postJSON(`${sunrise.urlPrefix}/contracts/doSearchContracts`, searchFilterFormElement, renderContracts);
} }
function resetOffsetAndGetContracts() { function resetOffsetAndGetContracts() {

View File

@ -1,7 +1,6 @@
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { Contract } from '../../types/recordTypes.js' import type { Contract } from '../../types/recordTypes.js'
import type { Sunrise } from './types.js' import type { Sunrise } from './types.js'
declare const cityssm: cityssmGlobal declare const cityssm: cityssmGlobal
@ -30,9 +29,9 @@ declare const exports: Record<string, unknown>
// eslint-disable-next-line complexity // eslint-disable-next-line complexity
function renderContracts(rawResponseJSON: unknown): void { function renderContracts(rawResponseJSON: unknown): void {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
contracts: Contract[]
count: number count: number
offset: number offset: number
contracts: Contract[]
} }
if (responseJSON.contracts.length === 0) { if (responseJSON.contracts.length === 0) {
@ -70,15 +69,35 @@ declare const exports: Record<string, unknown>
</span>` </span>`
} }
let deceasedHTML = '' let contactsHTML = ''
for (const interment of contract.contractInterments ?? []) { for (const interment of contract.contractInterments ?? []) {
deceasedHTML += `<li class="has-tooltip-left"> contactsHTML += `<li class="has-tooltip-left"
data-tooltip="${contract.isPreneed ? 'Recipient' : 'Deceased'}">
<span class="fa-li"><i class="fas fa-user"></i></span> <span class="fa-li"><i class="fas fa-user"></i></span>
${cityssm.escapeHTML(interment.deceasedName ?? '')} ${cityssm.escapeHTML(interment.deceasedName ?? '')}
</li>` </li>`
} }
if (contract.purchaserName !== '') {
contactsHTML += `<li class="has-tooltip-left has-text-grey"
data-tooltip="Purchaser">
<span class="fa-li"><i class="fas fa-hand-holding-dollar"></i></span>
${cityssm.escapeHTML(contract.purchaserName)}
</li>`
}
if (
contract.funeralHomeName !== null &&
contract.funeralHomeName !== ''
) {
contactsHTML += `<li class="has-tooltip-left has-text-grey"
data-tooltip="Funeral Home">
<span class="fa-li"><i class="fas fa-church"></i></span>
${cityssm.escapeHTML(contract.funeralHomeName)}
</li>`
}
const feeTotal = ( const feeTotal = (
contract.contractFees?.reduce( contract.contractFees?.reduce(
(soFar, currentFee): number => (soFar, currentFee): number =>
@ -120,7 +139,7 @@ declare const exports: Record<string, unknown>
</td><td> </td><td>
<a class="has-text-weight-bold" <a class="has-text-weight-bold"
href="${sunrise.getContractURL(contract.contractId)}"> href="${sunrise.getContractURL(contract.contractId)}">
${cityssm.escapeHTML(contract.contractType ?? '')} ${cityssm.escapeHTML(contract.contractType)}
</a><br /> </a><br />
<span class="is-size-7">#${contract.contractId}</span> <span class="is-size-7">#${contract.contractId}</span>
</td><td> </td><td>
@ -143,9 +162,9 @@ declare const exports: Record<string, unknown>
} }
</td><td> </td><td>
${ ${
deceasedHTML === '' contactsHTML === ''
? '' ? ''
: `<ul class="fa-ul ml-5">${deceasedHTML}</ul>` : `<ul class="fa-ul ml-5">${contactsHTML}</ul>`
} }
</td><td> </td><td>
${feeIconHTML} ${feeIconHTML}
@ -168,7 +187,7 @@ declare const exports: Record<string, unknown>
<th>Burial Site</th> <th>Burial Site</th>
<th>Contract Date</th> <th>Contract Date</th>
<th>End Date</th> <th>End Date</th>
<th>Recipient / Deceased</th> <th>Contacts</th>
<th class="has-width-1"><span class="is-sr-only">Fees and Transactions</span></th> <th class="has-width-1"><span class="is-sr-only">Fees and Transactions</span></th>
<th class="has-width-1"><span class="is-sr-only">Print</span></th> <th class="has-width-1"><span class="is-sr-only">Print</span></th>
</tr></thead> </tr></thead>
@ -200,7 +219,7 @@ declare const exports: Record<string, unknown>
function getContracts(): void { function getContracts(): void {
// eslint-disable-next-line no-unsanitized/property // eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = sunrise.getLoadingParagraphHTML( searchResultsContainerElement.innerHTML = sunrise.getLoadingParagraphHTML(
"Loading Contracts..." 'Loading Contracts...'
) )
cityssm.postJSON( cityssm.postJSON(