refactoring, development on contracts

deepsource-autofix-76c6eb20
Dan Gowans 2025-03-05 15:45:55 -05:00
parent 48262b2d92
commit 5f6c6a0be5
80 changed files with 1376 additions and 856 deletions

View File

@ -6,7 +6,6 @@ export const config = {
aliases: {}, aliases: {},
settings: { settings: {
fees: {}, fees: {},
cemeteries: {},
burialSites: {}, burialSites: {},
contracts: {}, contracts: {},
workOrders: {}, workOrders: {},

View File

@ -8,7 +8,6 @@ export const config: Config = {
aliases: {}, aliases: {},
settings: { settings: {
fees: {}, fees: {},
cemeteries: {},
burialSites: {}, burialSites: {},
contracts: {}, contracts: {},
workOrders: {}, workOrders: {},

View File

@ -1,4 +1,4 @@
import { type DateString } from '@cityssm/utils-datetime'; import { type DateString, type TimeString } from '@cityssm/utils-datetime';
import type { PoolConnection } from 'better-sqlite-pool'; import type { PoolConnection } from 'better-sqlite-pool';
export interface AddContractForm { export interface AddContractForm {
contractTypeId: string | number; contractTypeId: string | number;
@ -18,6 +18,9 @@ export interface AddContractForm {
purchaserRelationship?: string; purchaserRelationship?: string;
funeralHomeId?: string | number; funeralHomeId?: string | number;
funeralDirectorName?: string; funeralDirectorName?: string;
funeralDateString?: DateString | '';
funeralTimeString?: TimeString | '';
committalTypeId?: string | number;
deceasedName?: string; deceasedName?: string;
deceasedAddress1?: string; deceasedAddress1?: string;
deceasedAddress2?: string; deceasedAddress2?: string;
@ -28,8 +31,6 @@ export interface AddContractForm {
birthPlace?: string; birthPlace?: string;
deathDateString?: DateString | ''; deathDateString?: DateString | '';
deathPlace?: string; deathPlace?: string;
intermentDateString?: DateString | '';
intermentContainerTypeId?: string | number; intermentContainerTypeId?: string | number;
intermentCommittalTypeId?: string | number;
} }
export default function addContract(addForm: AddContractForm, user: User, connectedDatabase?: PoolConnection): Promise<number>; export default function addContract(addForm: AddContractForm, user: User, connectedDatabase?: PoolConnection): Promise<number>;

View File

@ -1,4 +1,4 @@
import { dateStringToInteger } from '@cityssm/utils-datetime'; import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime';
import addOrUpdateContractField from './addOrUpdateContractField.js'; import addOrUpdateContractField from './addOrUpdateContractField.js';
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
// eslint-disable-next-line complexity // eslint-disable-next-line complexity
@ -14,12 +14,18 @@ export default async function addContract(addForm, user, connectedDatabase) {
purchaserCity, purchaserProvince, purchaserPostalCode, purchaserCity, purchaserProvince, purchaserPostalCode,
purchaserPhoneNumber, purchaserEmail, purchaserRelationship, purchaserPhoneNumber, purchaserEmail, purchaserRelationship,
funeralHomeId, funeralDirectorName, funeralHomeId, funeralDirectorName,
funeralDate, funeralTime,
committalTypeId,
recordCreate_userName, recordCreate_timeMillis, recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis) recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(addForm.contractTypeId, addForm.burialSiteId === '' ? undefined : addForm.burialSiteId, contractStartDate, addForm.contractEndDateString === '' .run(addForm.contractTypeId, addForm.burialSiteId === '' ? undefined : addForm.burialSiteId, contractStartDate, addForm.contractEndDateString === ''
? undefined ? undefined
: dateStringToInteger(addForm.contractEndDateString), addForm.purchaserName ?? '', addForm.purchaserAddress1 ?? '', addForm.purchaserAddress2 ?? '', addForm.purchaserCity ?? '', addForm.purchaserProvince ?? '', addForm.purchaserPostalCode ?? '', addForm.purchaserPhoneNumber ?? '', addForm.purchaserEmail ?? '', addForm.purchaserRelationship ?? '', addForm.funeralHomeId === '' ? undefined : addForm.funeralHomeId, addForm.funeralDirectorName ?? '', user.userName, rightNowMillis, user.userName, rightNowMillis); : dateStringToInteger(addForm.contractEndDateString), addForm.purchaserName ?? '', addForm.purchaserAddress1 ?? '', addForm.purchaserAddress2 ?? '', addForm.purchaserCity ?? '', addForm.purchaserProvince ?? '', addForm.purchaserPostalCode ?? '', addForm.purchaserPhoneNumber ?? '', addForm.purchaserEmail ?? '', addForm.purchaserRelationship ?? '', addForm.funeralHomeId === '' ? undefined : addForm.funeralHomeId, addForm.funeralDirectorName ?? '', addForm.funeralDateString === ''
? undefined
: dateStringToInteger(addForm.funeralDateString), addForm.funeralTimeString === ''
? undefined
: timeStringToInteger(addForm.funeralTimeString), addForm.committalTypeId === '' ? undefined : addForm.committalTypeId, user.userName, rightNowMillis, user.userName, rightNowMillis);
const contractId = result.lastInsertRowid; const contractId = result.lastInsertRowid;
/* /*
* Add contract fields * Add contract fields
@ -46,22 +52,17 @@ export default async function addContract(addForm, user, connectedDatabase) {
deceasedCity, deceasedProvince, deceasedPostalCode, deceasedCity, deceasedProvince, deceasedPostalCode,
birthDate, deathDate, birthDate, deathDate,
birthPlace, deathPlace, birthPlace, deathPlace,
intermentDate, intermentContainerTypeId,
intermentContainerTypeId, intermentCommittalTypeId,
recordCreate_userName, recordCreate_timeMillis, recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis) recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(contractId, 1, addForm.deceasedName ?? '', addForm.deceasedAddress1 ?? '', addForm.deceasedAddress2 ?? '', addForm.deceasedCity ?? '', addForm.deceasedProvince ?? '', addForm.deceasedPostalCode ?? '', addForm.birthDateString === '' .run(contractId, 1, addForm.deceasedName ?? '', addForm.deceasedAddress1 ?? '', addForm.deceasedAddress2 ?? '', addForm.deceasedCity ?? '', addForm.deceasedProvince ?? '', addForm.deceasedPostalCode ?? '', addForm.birthDateString === ''
? undefined ? undefined
: dateStringToInteger(addForm.birthDateString), addForm.deathDateString === '' : dateStringToInteger(addForm.birthDateString), addForm.deathDateString === ''
? undefined ? undefined
: dateStringToInteger(addForm.deathDateString), addForm.birthPlace ?? '', addForm.deathPlace ?? '', addForm.intermentDateString === '' : dateStringToInteger(addForm.deathDateString), addForm.birthPlace ?? '', addForm.deathPlace ?? '', addForm.intermentContainerTypeId === ''
? undefined ? undefined
: dateStringToInteger(addForm.intermentDateString), addForm.intermentContainerTypeId === '' : addForm.intermentContainerTypeId, user.userName, rightNowMillis, user.userName, rightNowMillis);
? undefined
: addForm.intermentContainerTypeId, addForm.intermentCommittalTypeId === ''
? undefined
: addForm.intermentCommittalTypeId, user.userName, rightNowMillis, user.userName, rightNowMillis);
} }
if (connectedDatabase === undefined) { if (connectedDatabase === undefined) {
database.release(); database.release();

View File

@ -1,6 +1,8 @@
import { import {
type DateString, type DateString,
dateStringToInteger type TimeString,
dateStringToInteger,
timeStringToInteger
} from '@cityssm/utils-datetime' } from '@cityssm/utils-datetime'
import type { PoolConnection } from 'better-sqlite-pool' import type { PoolConnection } from 'better-sqlite-pool'
@ -29,6 +31,9 @@ export interface AddContractForm {
funeralHomeId?: string | number funeralHomeId?: string | number
funeralDirectorName?: string funeralDirectorName?: string
funeralDateString?: DateString | ''
funeralTimeString?: TimeString | ''
committalTypeId?: string | number
deceasedName?: string deceasedName?: string
deceasedAddress1?: string deceasedAddress1?: string
@ -41,9 +46,7 @@ export interface AddContractForm {
birthPlace?: string birthPlace?: string
deathDateString?: DateString | '' deathDateString?: DateString | ''
deathPlace?: string deathPlace?: string
intermentDateString?: DateString | ''
intermentContainerTypeId?: string | number intermentContainerTypeId?: string | number
intermentCommittalTypeId?: string | number
} }
// eslint-disable-next-line complexity // eslint-disable-next-line complexity
@ -69,9 +72,11 @@ export default async function addContract(
purchaserCity, purchaserProvince, purchaserPostalCode, purchaserCity, purchaserProvince, purchaserPostalCode,
purchaserPhoneNumber, purchaserEmail, purchaserRelationship, purchaserPhoneNumber, purchaserEmail, purchaserRelationship,
funeralHomeId, funeralDirectorName, funeralHomeId, funeralDirectorName,
funeralDate, funeralTime,
committalTypeId,
recordCreate_userName, recordCreate_timeMillis, recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis) recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
) )
.run( .run(
addForm.contractTypeId, addForm.contractTypeId,
@ -91,6 +96,13 @@ export default async function addContract(
addForm.purchaserRelationship ?? '', addForm.purchaserRelationship ?? '',
addForm.funeralHomeId === '' ? undefined : addForm.funeralHomeId, addForm.funeralHomeId === '' ? undefined : addForm.funeralHomeId,
addForm.funeralDirectorName ?? '', addForm.funeralDirectorName ?? '',
addForm.funeralDateString === ''
? undefined
: dateStringToInteger(addForm.funeralDateString as DateString),
addForm.funeralTimeString === ''
? undefined
: timeStringToInteger(addForm.funeralTimeString as TimeString),
addForm.committalTypeId === '' ? undefined : addForm.committalTypeId,
user.userName, user.userName,
rightNowMillis, rightNowMillis,
user.userName, user.userName,
@ -136,11 +148,10 @@ export default async function addContract(
deceasedCity, deceasedProvince, deceasedPostalCode, deceasedCity, deceasedProvince, deceasedPostalCode,
birthDate, deathDate, birthDate, deathDate,
birthPlace, deathPlace, birthPlace, deathPlace,
intermentDate, intermentContainerTypeId,
intermentContainerTypeId, intermentCommittalTypeId,
recordCreate_userName, recordCreate_timeMillis, recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis) recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
) )
.run( .run(
@ -160,15 +171,9 @@ export default async function addContract(
: dateStringToInteger(addForm.deathDateString as DateString), : dateStringToInteger(addForm.deathDateString as DateString),
addForm.birthPlace ?? '', addForm.birthPlace ?? '',
addForm.deathPlace ?? '', addForm.deathPlace ?? '',
addForm.intermentDateString === ''
? undefined
: dateStringToInteger(addForm.intermentDateString as DateString),
addForm.intermentContainerTypeId === '' addForm.intermentContainerTypeId === ''
? undefined ? undefined
: addForm.intermentContainerTypeId, : addForm.intermentContainerTypeId,
addForm.intermentCommittalTypeId === ''
? undefined
: addForm.intermentCommittalTypeId,
user.userName, user.userName,
rightNowMillis, rightNowMillis,
user.userName, user.userName,

View File

@ -1,4 +1,5 @@
import { clearCacheByTableName } from '../helpers/functions.cache.js' import { clearCacheByTableName } from '../helpers/functions.cache.js'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export interface AddForm { export interface AddForm {

View File

@ -0,0 +1,6 @@
export interface AddForm {
intermentContainerType: string;
isCremationType?: string;
orderNumber?: number;
}
export default function addIntermentContainerType(addForm: AddForm, user: User): Promise<number>;

View File

@ -0,0 +1,16 @@
import { clearCacheByTableName } from '../helpers/functions.cache.js';
import { acquireConnection } from './pool.js';
export default async function addIntermentContainerType(addForm, user) {
const database = await acquireConnection();
const rightNowMillis = Date.now();
const result = database
.prepare(`insert into IntermentContainerTypes (
intermentContainerType, isCremationType, orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?)`)
.run(addForm.intermentContainerType, addForm.isCremationType === undefined ? 0 : 1, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
database.release();
clearCacheByTableName('IntermentContainerTypes');
return result.lastInsertRowid;
}

View File

@ -0,0 +1,42 @@
import { clearCacheByTableName } from '../helpers/functions.cache.js'
import { acquireConnection } from './pool.js'
export interface AddForm {
intermentContainerType: string
isCremationType?: string
orderNumber?: number
}
export default async function addIntermentContainerType(
addForm: AddForm,
user: User
): Promise<number> {
const database = await acquireConnection()
const rightNowMillis = Date.now()
const result = database
.prepare(
`insert into IntermentContainerTypes (
intermentContainerType, isCremationType, orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?)`
)
.run(
addForm.intermentContainerType,
addForm.isCremationType === undefined ? 0 : 1,
addForm.orderNumber ?? -1,
user.userName,
rightNowMillis,
user.userName,
rightNowMillis
)
database.release()
clearCacheByTableName('IntermentContainerTypes')
return result.lastInsertRowid as number
}

View File

@ -1,3 +1,3 @@
type RecordTable = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'IntermentContainerTypes' | 'IntermentCommittalTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes'; type RecordTable = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'CommittalTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes';
export default function addRecord(recordTable: RecordTable, recordName: string, orderNumber: number | string, user: User): Promise<number>; export default function addRecord(recordTable: RecordTable, recordName: string, orderNumber: number | string, user: User): Promise<number>;
export {}; export {};

View File

@ -3,8 +3,7 @@ import { acquireConnection } from './pool.js';
const recordNameColumns = new Map(); const recordNameColumns = new Map();
recordNameColumns.set('BurialSiteStatuses', 'burialSiteStatus'); recordNameColumns.set('BurialSiteStatuses', 'burialSiteStatus');
recordNameColumns.set('BurialSiteTypes', 'burialSiteType'); recordNameColumns.set('BurialSiteTypes', 'burialSiteType');
recordNameColumns.set('IntermentContainerTypes', 'intermentContainerType'); recordNameColumns.set('CommittalTypes', 'committalType');
recordNameColumns.set('IntermentCommittalTypes', 'intermentCommittalType');
recordNameColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneType'); recordNameColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneType');
recordNameColumns.set('WorkOrderTypes', 'workOrderType'); recordNameColumns.set('WorkOrderTypes', 'workOrderType');
export default async function addRecord(recordTable, recordName, orderNumber, user) { export default async function addRecord(recordTable, recordName, orderNumber, user) {

View File

@ -5,16 +5,14 @@ import { acquireConnection } from './pool.js'
type RecordTable = type RecordTable =
| 'BurialSiteStatuses' | 'BurialSiteStatuses'
| 'BurialSiteTypes' | 'BurialSiteTypes'
| 'IntermentContainerTypes' | 'CommittalTypes'
| 'IntermentCommittalTypes'
| 'WorkOrderMilestoneTypes' | 'WorkOrderMilestoneTypes'
| 'WorkOrderTypes' | 'WorkOrderTypes'
const recordNameColumns = new Map<RecordTable, string>() const recordNameColumns = new Map<RecordTable, string>()
recordNameColumns.set('BurialSiteStatuses', 'burialSiteStatus') recordNameColumns.set('BurialSiteStatuses', 'burialSiteStatus')
recordNameColumns.set('BurialSiteTypes', 'burialSiteType') recordNameColumns.set('BurialSiteTypes', 'burialSiteType')
recordNameColumns.set('IntermentContainerTypes', 'intermentContainerType') recordNameColumns.set('CommittalTypes', 'committalType')
recordNameColumns.set('IntermentCommittalTypes', 'intermentCommittalType')
recordNameColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneType') recordNameColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneType')
recordNameColumns.set('WorkOrderTypes', 'workOrderType') recordNameColumns.set('WorkOrderTypes', 'workOrderType')

View File

@ -0,0 +1,2 @@
import type { CommittalType } from '../types/recordTypes.js';
export default function getCommittalTypes(): Promise<CommittalType[]>;

View File

@ -0,0 +1,21 @@
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export default async function getCommittalTypes() {
const database = await acquireConnection();
const committalTypes = database
.prepare(`select committalTypeId, committalType, orderNumber
from CommittalTypes
where recordDelete_timeMillis is null
order by orderNumber, committalType, committalTypeId`)
.all();
let expectedOrderNumber = -1;
for (const committalType of committalTypes) {
expectedOrderNumber += 1;
if (committalType.orderNumber !== expectedOrderNumber) {
updateRecordOrderNumber('CommittalTypes', committalType.committalTypeId, expectedOrderNumber, database);
committalType.orderNumber = expectedOrderNumber;
}
}
database.release();
return committalTypes;
}

View File

@ -0,0 +1,38 @@
import type { CommittalType } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export default async function getCommittalTypes(): Promise<CommittalType[]> {
const database = await acquireConnection()
const committalTypes = database
.prepare(
`select committalTypeId, committalType, orderNumber
from CommittalTypes
where recordDelete_timeMillis is null
order by orderNumber, committalType, committalTypeId`
)
.all() as CommittalType[]
let expectedOrderNumber = -1
for (const committalType of committalTypes) {
expectedOrderNumber += 1
if (committalType.orderNumber !== expectedOrderNumber) {
updateRecordOrderNumber(
'CommittalTypes',
committalType.committalTypeId,
expectedOrderNumber,
database
)
committalType.orderNumber = expectedOrderNumber
}
}
database.release()
return committalTypes
}

View File

@ -1,4 +1,4 @@
import { dateIntegerToString } from '@cityssm/utils-datetime'; import { dateIntegerToString, timeIntegerToString } from '@cityssm/utils-datetime';
import getContractComments from './getContractComments.js'; import getContractComments from './getContractComments.js';
import getContractFees from './getContractFees.js'; import getContractFees from './getContractFees.js';
import getContractFields from './getContractFields.js'; import getContractFields from './getContractFields.js';
@ -9,6 +9,7 @@ import { acquireConnection } from './pool.js';
export default async function getContract(contractId, connectedDatabase) { export default async function getContract(contractId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection()); const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString); database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
const contract = database const contract = database
.prepare(`select o.contractId, .prepare(`select o.contractId,
o.contractTypeId, t.contractType, t.isPreneed, o.contractTypeId, t.contractType, t.isPreneed,
@ -20,9 +21,13 @@ export default async function getContract(contractId, connectedDatabase) {
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode, o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship, o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
o.funeralHomeId, o.funeralDirectorName, o.funeralHomeId, o.funeralDirectorName,
o.funeralDate, userFn_dateIntegerToString(o.funeralDate) as funeralDateString,
o.funeralTime, userFn_timeIntegerToString(o.funeralTime) as funeralTimeString,
o.committalTypeId, c.committalType,
o.recordUpdate_timeMillis o.recordUpdate_timeMillis
from Contracts o from Contracts o
left join ContractTypes t on o.contractTypeId = t.contractTypeId left join ContractTypes t on o.contractTypeId = t.contractTypeId
left join CommittalTypes c on o.committalTypeId = c.committalTypeId
left join BurialSites l on o.burialSiteId = l.burialSiteId left join BurialSites l on o.burialSiteId = l.burialSiteId
left join Cemeteries m on l.cemeteryId = m.cemeteryId left join Cemeteries m on l.cemeteryId = m.cemeteryId
where o.recordDelete_timeMillis is null where o.recordDelete_timeMillis is null

View File

@ -1,4 +1,4 @@
import { dateIntegerToString } from '@cityssm/utils-datetime' import { dateIntegerToString, timeIntegerToString } from '@cityssm/utils-datetime'
import type { PoolConnection } from 'better-sqlite-pool' import type { PoolConnection } from 'better-sqlite-pool'
import type { Contract } from '../types/recordTypes.js' import type { Contract } from '../types/recordTypes.js'
@ -18,6 +18,7 @@ export default async function getContract(
const database = connectedDatabase ?? (await acquireConnection()) const database = connectedDatabase ?? (await acquireConnection())
database.function('userFn_dateIntegerToString', dateIntegerToString) database.function('userFn_dateIntegerToString', dateIntegerToString)
database.function('userFn_timeIntegerToString', timeIntegerToString)
const contract = database const contract = database
.prepare( .prepare(
@ -31,9 +32,13 @@ export default async function getContract(
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode, o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship, o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
o.funeralHomeId, o.funeralDirectorName, o.funeralHomeId, o.funeralDirectorName,
o.funeralDate, userFn_dateIntegerToString(o.funeralDate) as funeralDateString,
o.funeralTime, userFn_timeIntegerToString(o.funeralTime) as funeralTimeString,
o.committalTypeId, c.committalType,
o.recordUpdate_timeMillis o.recordUpdate_timeMillis
from Contracts o from Contracts o
left join ContractTypes t on o.contractTypeId = t.contractTypeId left join ContractTypes t on o.contractTypeId = t.contractTypeId
left join CommittalTypes c on o.committalTypeId = c.committalTypeId
left join BurialSites l on o.burialSiteId = l.burialSiteId left join BurialSites l on o.burialSiteId = l.burialSiteId
left join Cemeteries m on l.cemeteryId = m.cemeteryId left join Cemeteries m on l.cemeteryId = m.cemeteryId
where o.recordDelete_timeMillis is null where o.recordDelete_timeMillis is null

View File

@ -5,21 +5,18 @@ export default async function getContractInterments(contractId, connectedDatabas
database.function('userFn_dateIntegerToString', dateIntegerToString); database.function('userFn_dateIntegerToString', dateIntegerToString);
const interments = database const interments = database
.prepare(`select o.contractId, o.intermentNumber, .prepare(`select o.contractId, o.intermentNumber,
o.isCremated,
o.deceasedName, o.deceasedName,
o.deceasedAddress1, o.deceasedAddress2, o.deceasedCity, o.deceasedProvince, o.deceasedPostalCode,
o.birthDate, userFn_dateIntegerToString(o.birthDate) as birthDateString, o.birthDate, userFn_dateIntegerToString(o.birthDate) as birthDateString,
o.birthPlace, o.birthPlace,
o.deathDate, userFn_dateIntegerToString(o.deathDate) as deathDateString, o.deathDate, userFn_dateIntegerToString(o.deathDate) as deathDateString,
o.deathPlace, o.deathPlace,
o.intermentDate, userFn_dateIntegerToString(o.intermentDate) as intermentDateString, o.intermentContainerTypeId, t.intermentContainerType, t.isCremationType
o.intermentContainerTypeId, t.intermentContainerType,
o.intermentCommittalTypeId, c.intermentCommittalType
from ContractInterments o from ContractInterments o
left join IntermentContainerTypes t on o.intermentContainerTypeId = t.intermentContainerTypeId left join IntermentContainerTypes t on o.intermentContainerTypeId = t.intermentContainerTypeId
left join IntermentCommittalTypes c on o.intermentCommittalTypeId = c.intermentCommittalTypeId
where o.recordDelete_timeMillis is null where o.recordDelete_timeMillis is null
and o.contractId = ? and o.contractId = ?

View File

@ -18,21 +18,18 @@ export default async function getContractInterments(
const interments = database const interments = database
.prepare( .prepare(
`select o.contractId, o.intermentNumber, `select o.contractId, o.intermentNumber,
o.isCremated,
o.deceasedName, o.deceasedName,
o.deceasedAddress1, o.deceasedAddress2, o.deceasedCity, o.deceasedProvince, o.deceasedPostalCode,
o.birthDate, userFn_dateIntegerToString(o.birthDate) as birthDateString, o.birthDate, userFn_dateIntegerToString(o.birthDate) as birthDateString,
o.birthPlace, o.birthPlace,
o.deathDate, userFn_dateIntegerToString(o.deathDate) as deathDateString, o.deathDate, userFn_dateIntegerToString(o.deathDate) as deathDateString,
o.deathPlace, o.deathPlace,
o.intermentDate, userFn_dateIntegerToString(o.intermentDate) as intermentDateString, o.intermentContainerTypeId, t.intermentContainerType, t.isCremationType
o.intermentContainerTypeId, t.intermentContainerType,
o.intermentCommittalTypeId, c.intermentCommittalType
from ContractInterments o from ContractInterments o
left join IntermentContainerTypes t on o.intermentContainerTypeId = t.intermentContainerTypeId left join IntermentContainerTypes t on o.intermentContainerTypeId = t.intermentContainerTypeId
left join IntermentCommittalTypes c on o.intermentCommittalTypeId = c.intermentCommittalTypeId
where o.recordDelete_timeMillis is null where o.recordDelete_timeMillis is null
and o.contractId = ? and o.contractId = ?

View File

@ -8,7 +8,7 @@ export default async function getContractTypes() {
.prepare(`select contractTypeId, contractType, isPreneed, orderNumber .prepare(`select contractTypeId, contractType, isPreneed, orderNumber
from ContractTypes from ContractTypes
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
order by orderNumber, contractType`) order by orderNumber, contractType, contractTypeId`)
.all(); .all();
let expectedOrderNumber = -1; let expectedOrderNumber = -1;
for (const contractType of contractTypes) { for (const contractType of contractTypes) {

View File

@ -13,7 +13,7 @@ export default async function getContractTypes(): Promise<ContractType[]> {
`select contractTypeId, contractType, isPreneed, orderNumber `select contractTypeId, contractType, isPreneed, orderNumber
from ContractTypes from ContractTypes
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
order by orderNumber, contractType` order by orderNumber, contractType, contractTypeId`
) )
.all() as ContractType[] .all() as ContractType[]

View File

@ -1,4 +1,4 @@
import { dateIntegerToString, dateStringToInteger } from '@cityssm/utils-datetime'; import { dateIntegerToString, dateStringToInteger, timeIntegerToString } from '@cityssm/utils-datetime';
import { getConfigProperty } from '../helpers/config.helpers.js'; import { getConfigProperty } from '../helpers/config.helpers.js';
import { getContractTypeById } from '../helpers/functions.cache.js'; import { getContractTypeById } from '../helpers/functions.cache.js';
import { getBurialSiteNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWhereClause } from '../helpers/functions.sqlFilters.js'; import { getBurialSiteNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWhereClause } from '../helpers/functions.sqlFilters.js';
@ -13,9 +13,9 @@ function buildWhereClause(filters) {
sqlWhereClause += ' and o.burialSiteId = ?'; sqlWhereClause += ' and o.burialSiteId = ?';
sqlParameters.push(filters.burialSiteId); sqlParameters.push(filters.burialSiteId);
} }
const lotNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, filters.burialSiteNameSearchType ?? '', 'l'); const burialSiteNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, filters.burialSiteNameSearchType ?? '', 'l');
sqlWhereClause += lotNameFilters.sqlWhereClause; sqlWhereClause += burialSiteNameFilters.sqlWhereClause;
sqlParameters.push(...lotNameFilters.sqlParameters); sqlParameters.push(...burialSiteNameFilters.sqlParameters);
const occupantNameFilters = getOccupantNameWhereClause(filters.occupantName, 'o'); const occupantNameFilters = getOccupantNameWhereClause(filters.occupantName, 'o');
if (occupantNameFilters.sqlParameters.length > 0) { if (occupantNameFilters.sqlParameters.length > 0) {
sqlWhereClause += ` and o.contractId in ( sqlWhereClause += ` and o.contractId in (
@ -80,6 +80,7 @@ async function addInclusions(contract, options, database) {
export default async function getContracts(filters, options, connectedDatabase) { export default async function getContracts(filters, options, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection()); const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString); database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters); const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
let count = typeof options.limit === 'string' let count = typeof options.limit === 'string'
? Number.parseInt(options.limit, 10) ? Number.parseInt(options.limit, 10)
@ -105,9 +106,13 @@ export default async function getContracts(filters, options, connectedDatabase)
o.purchaserName, o.purchaserAddress1, o.purchaserAddress2, o.purchaserName, o.purchaserAddress1, o.purchaserAddress2,
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode, o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship, o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
o.funeralHomeId, o.funeralDirectorName o.funeralHomeId, o.funeralDirectorName,
o.funeralDate, userFn_dateIntegerToString(o.funeralDate) as funeralDateString,
o.funeralTime, userFn_timeIntegerToString(o.funeralTime) as funeralTimeString,
o.committalTypeId, c.committalType
from Contracts o from Contracts o
left join ContractTypes t on o.contractTypeId = t.contractTypeId left join ContractTypes t on o.contractTypeId = t.contractTypeId
left join CommittalTypes c on o.committalTypeId = c.committalTypeId
left join BurialSites l on o.burialSiteId = l.burialSiteId left join BurialSites l on o.burialSiteId = l.burialSiteId
left join BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId left join BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId
left join Cemeteries m on l.cemeteryId = m.cemeteryId left join Cemeteries m on l.cemeteryId = m.cemeteryId

View File

@ -1,7 +1,8 @@
import { import {
type DateString, type DateString,
dateIntegerToString, dateIntegerToString,
dateStringToInteger dateStringToInteger,
timeIntegerToString
} from '@cityssm/utils-datetime' } from '@cityssm/utils-datetime'
import type { PoolConnection } from 'better-sqlite-pool' import type { PoolConnection } from 'better-sqlite-pool'
@ -55,13 +56,13 @@ function buildWhereClause(filters: GetContractsFilters): {
sqlParameters.push(filters.burialSiteId) sqlParameters.push(filters.burialSiteId)
} }
const lotNameFilters = getBurialSiteNameWhereClause( const burialSiteNameFilters = getBurialSiteNameWhereClause(
filters.burialSiteName, filters.burialSiteName,
filters.burialSiteNameSearchType ?? '', filters.burialSiteNameSearchType ?? '',
'l' 'l'
) )
sqlWhereClause += lotNameFilters.sqlWhereClause sqlWhereClause += burialSiteNameFilters.sqlWhereClause
sqlParameters.push(...lotNameFilters.sqlParameters) sqlParameters.push(...burialSiteNameFilters.sqlParameters)
const occupantNameFilters = getOccupantNameWhereClause( const occupantNameFilters = getOccupantNameWhereClause(
filters.occupantName, filters.occupantName,
@ -168,6 +169,7 @@ export default async function getContracts(
const database = connectedDatabase ?? (await acquireConnection()) const database = connectedDatabase ?? (await acquireConnection())
database.function('userFn_dateIntegerToString', dateIntegerToString) database.function('userFn_dateIntegerToString', dateIntegerToString)
database.function('userFn_timeIntegerToString', timeIntegerToString)
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters) const { sqlWhereClause, sqlParameters } = buildWhereClause(filters)
@ -205,9 +207,13 @@ export default async function getContracts(
o.purchaserName, o.purchaserAddress1, o.purchaserAddress2, o.purchaserName, o.purchaserAddress1, o.purchaserAddress2,
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode, o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship, o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
o.funeralHomeId, o.funeralDirectorName o.funeralHomeId, o.funeralDirectorName,
o.funeralDate, userFn_dateIntegerToString(o.funeralDate) as funeralDateString,
o.funeralTime, userFn_timeIntegerToString(o.funeralTime) as funeralTimeString,
o.committalTypeId, c.committalType
from Contracts o from Contracts o
left join ContractTypes t on o.contractTypeId = t.contractTypeId left join ContractTypes t on o.contractTypeId = t.contractTypeId
left join CommittalTypes c on o.committalTypeId = c.committalTypeId
left join BurialSites l on o.burialSiteId = l.burialSiteId left join BurialSites l on o.burialSiteId = l.burialSiteId
left join BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId left join BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId
left join Cemeteries m on l.cemeteryId = m.cemeteryId left join Cemeteries m on l.cemeteryId = m.cemeteryId

View File

@ -1,2 +0,0 @@
import type { IntermentCommittalType } from '../types/recordTypes.js';
export default function getIntermentCommittalTypes(): Promise<IntermentCommittalType[]>;

View File

@ -1,12 +0,0 @@
import { acquireConnection } from './pool.js';
export default async function getIntermentCommittalTypes() {
const database = await acquireConnection();
const committalTypes = database
.prepare(`select intermentCommittalTypeId, intermentCommittalType, orderNumber
from IntermentCommittalTypes
where recordDelete_timeMillis is null
order by orderNumber, intermentCommittalType, intermentCommittalTypeId`)
.all();
database.release();
return committalTypes;
}

View File

@ -1,22 +0,0 @@
import type { IntermentCommittalType } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export default async function getIntermentCommittalTypes(): Promise<
IntermentCommittalType[]
> {
const database = await acquireConnection()
const committalTypes = database
.prepare(
`select intermentCommittalTypeId, intermentCommittalType, orderNumber
from IntermentCommittalTypes
where recordDelete_timeMillis is null
order by orderNumber, intermentCommittalType, intermentCommittalTypeId`
)
.all() as IntermentCommittalType[]
database.release()
return committalTypes
}

View File

@ -1,12 +1,21 @@
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export default async function getIntermentContainerTypes() { export default async function getIntermentContainerTypes() {
const database = await acquireConnection(); const database = await acquireConnection();
const containerTypes = database const containerTypes = database
.prepare(`select intermentContainerTypeId, intermentContainerType, orderNumber .prepare(`select intermentContainerTypeId, intermentContainerType, isCremationType, orderNumber
from IntermentContainerTypes from IntermentContainerTypes
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
order by orderNumber, intermentContainerType, intermentContainerTypeId`) order by isCremationType, orderNumber, intermentContainerType, intermentContainerTypeId`)
.all(); .all();
let expectedOrderNumber = -1;
for (const containerType of containerTypes) {
expectedOrderNumber += 1;
if (containerType.orderNumber !== expectedOrderNumber) {
updateRecordOrderNumber('IntermentContainerTypes', containerType.intermentContainerTypeId, expectedOrderNumber, database);
containerType.orderNumber = expectedOrderNumber;
}
}
database.release(); database.release();
return containerTypes; return containerTypes;
} }

View File

@ -1,6 +1,7 @@
import type { IntermentContainerType } from '../types/recordTypes.js' import type { IntermentContainerType } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export default async function getIntermentContainerTypes(): Promise< export default async function getIntermentContainerTypes(): Promise<
IntermentContainerType[] IntermentContainerType[]
@ -9,13 +10,30 @@ export default async function getIntermentContainerTypes(): Promise<
const containerTypes = database const containerTypes = database
.prepare( .prepare(
`select intermentContainerTypeId, intermentContainerType, orderNumber `select intermentContainerTypeId, intermentContainerType, isCremationType, orderNumber
from IntermentContainerTypes from IntermentContainerTypes
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
order by orderNumber, intermentContainerType, intermentContainerTypeId` order by isCremationType, orderNumber, intermentContainerType, intermentContainerTypeId`
) )
.all() as IntermentContainerType[] .all() as IntermentContainerType[]
let expectedOrderNumber = -1
for (const containerType of containerTypes) {
expectedOrderNumber += 1
if (containerType.orderNumber !== expectedOrderNumber) {
updateRecordOrderNumber(
'IntermentContainerTypes',
containerType.intermentContainerTypeId,
expectedOrderNumber,
database
)
containerType.orderNumber = expectedOrderNumber
}
}
database.release() database.release()
return containerTypes return containerTypes

View File

@ -5,7 +5,7 @@ export interface GetWorkOrdersFilters {
workOrderOpenStatus?: '' | 'open' | 'closed'; workOrderOpenStatus?: '' | 'open' | 'closed';
workOrderOpenDateString?: string; workOrderOpenDateString?: string;
occupantName?: string; occupantName?: string;
lotName?: string; burialSiteName?: string;
contractId?: number | string; contractId?: number | string;
} }
interface GetWorkOrdersOptions { interface GetWorkOrdersOptions {

View File

@ -36,7 +36,7 @@ function buildWhereClause(filters) {
))`; ))`;
sqlParameters.push(...occupantNameFilters.sqlParameters); sqlParameters.push(...occupantNameFilters.sqlParameters);
} }
const burialSiteNameFilters = getBurialSiteNameWhereClause(filters.lotName, '', 'l'); const burialSiteNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, '', 'l');
if (burialSiteNameFilters.sqlParameters.length > 0) { if (burialSiteNameFilters.sqlParameters.length > 0) {
sqlWhereClause += sqlWhereClause +=
` and w.workOrderId in ( ` and w.workOrderId in (
@ -130,7 +130,7 @@ export async function getWorkOrders(filters, options, connectedDatabase) {
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
group by workOrderId) m on w.workOrderId = m.workOrderId group by workOrderId) m on w.workOrderId = m.workOrderId
left join ( left join (
select workOrderId, count(lotId) as workOrderLotCount select workOrderId, count(burialSiteId) as workOrderLotCount
from WorkOrderLots from WorkOrderLots
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
group by workOrderId) l on w.workOrderId = l.workOrderId group by workOrderId) l on w.workOrderId = l.workOrderId

View File

@ -22,7 +22,7 @@ export interface GetWorkOrdersFilters {
workOrderOpenStatus?: '' | 'open' | 'closed' workOrderOpenStatus?: '' | 'open' | 'closed'
workOrderOpenDateString?: string workOrderOpenDateString?: string
occupantName?: string occupantName?: string
lotName?: string burialSiteName?: string
contractId?: number | string contractId?: number | string
} }
@ -77,7 +77,7 @@ function buildWhereClause(filters: GetWorkOrdersFilters): {
sqlParameters.push(...occupantNameFilters.sqlParameters) sqlParameters.push(...occupantNameFilters.sqlParameters)
} }
const burialSiteNameFilters = getBurialSiteNameWhereClause(filters.lotName, '', 'l') const burialSiteNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, '', 'l')
if (burialSiteNameFilters.sqlParameters.length > 0) { if (burialSiteNameFilters.sqlParameters.length > 0) {
sqlWhereClause += sqlWhereClause +=
` and w.workOrderId in ( ` and w.workOrderId in (
@ -213,7 +213,7 @@ export async function getWorkOrders(
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
group by workOrderId) m on w.workOrderId = m.workOrderId group by workOrderId) m on w.workOrderId = m.workOrderId
left join ( left join (
select workOrderId, count(lotId) as workOrderLotCount select workOrderId, count(burialSiteId) as workOrderLotCount
from WorkOrderLots from WorkOrderLots
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
group by workOrderId) l on w.workOrderId = l.workOrderId group by workOrderId) l on w.workOrderId = l.workOrderId

View File

@ -1,11 +1,12 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable no-secrets/no-secrets */ /* eslint-disable max-lines, no-secrets/no-secrets */
import sqlite from 'better-sqlite3'; import sqlite from 'better-sqlite3';
import Debug from 'debug'; import Debug from 'debug';
import { DEBUG_NAMESPACE } from '../debug.config.js'; import { DEBUG_NAMESPACE } from '../debug.config.js';
import { sunriseDB as databasePath } from '../helpers/database.helpers.js'; import { sunriseDB as databasePath } from '../helpers/database.helpers.js';
import addContractType from './addContractType.js'; import addContractType from './addContractType.js';
import addFeeCategory from './addFeeCategory.js'; import addFeeCategory from './addFeeCategory.js';
import addIntermentContainerType from './addIntermentContainerType.js';
import addRecord from './addRecord.js'; import addRecord from './addRecord.js';
const debug = Debug(`${DEBUG_NAMESPACE}:database/initializeDatabase`); const debug = Debug(`${DEBUG_NAMESPACE}:database/initializeDatabase`);
const recordColumns = `recordCreate_userName varchar(30) not null, const recordColumns = `recordCreate_userName varchar(30) not null,
@ -162,6 +163,13 @@ const createStatements = [
foreign key (contractTypeId) references ContractTypes (contractTypeId))`, foreign key (contractTypeId) references ContractTypes (contractTypeId))`,
`create index if not exists idx_ContractTypePrints_orderNumber `create index if not exists idx_ContractTypePrints_orderNumber
on ContractTypePrints (contractTypeId, orderNumber, printEJS)`, on ContractTypePrints (contractTypeId, orderNumber, printEJS)`,
`create table if not exists CommittalTypes (
committalTypeId integer not null primary key autoincrement,
committalType varchar(100) not null,
orderNumber smallint not null default 0,
${recordColumns})`,
`create index if not exists idx_CommittalType_orderNumber
on CommittalTypes (orderNumber, committalType)`,
`create table if not exists Contracts ( `create table if not exists Contracts (
contractId integer not null primary key autoincrement, contractId integer not null primary key autoincrement,
contractTypeId integer not null, contractTypeId integer not null,
@ -181,11 +189,15 @@ const createStatements = [
funeralHomeId integer, funeralHomeId integer,
funeralDirectorName varchar(100), funeralDirectorName varchar(100),
funeralDate integer check (funeralDate > 0),
funeralTime integer check (funeralTime >= 0),
committalTypeId integer,
${recordColumns}, ${recordColumns},
foreign key (burialSiteId) references BurialSites (burialSiteId), foreign key (burialSiteId) references BurialSites (burialSiteId),
foreign key (contractTypeId) references ContractTypes (contractTypeId), foreign key (contractTypeId) references ContractTypes (contractTypeId),
foreign key (funeralHomeId) references FuneralHomes (funeralHomeId))`, foreign key (funeralHomeId) references FuneralHomes (funeralHomeId),
foreign key (committalTypeId) references CommittalTypes (committalTypeId))`,
`create table if not exists ContractFields ( `create table if not exists ContractFields (
contractId integer not null, contractId integer not null,
contractTypeFieldId integer not null, contractTypeFieldId integer not null,
@ -210,17 +222,11 @@ const createStatements = [
`create table if not exists IntermentContainerTypes ( `create table if not exists IntermentContainerTypes (
intermentContainerTypeId integer not null primary key autoincrement, intermentContainerTypeId integer not null primary key autoincrement,
intermentContainerType varchar(100) not null, intermentContainerType varchar(100) not null,
isCremationType bit not null default 0,
orderNumber smallint not null default 0, orderNumber smallint not null default 0,
${recordColumns})`, ${recordColumns})`,
`create index if not exists idx_IntermentContainerTypes_orderNumber `create index if not exists idx_IntermentContainerTypes_orderNumber
on IntermentContainerTypes (orderNumber, intermentContainerType)`, on IntermentContainerTypes (orderNumber, intermentContainerType)`,
`create table if not exists IntermentCommittalTypes (
intermentCommittalTypeId integer not null primary key autoincrement,
intermentCommittalType varchar(100) not null,
orderNumber smallint not null default 0,
${recordColumns})`,
`create index if not exists idx_IntermentCommittalType_orderNumber
on IntermentCommittalTypes (orderNumber, intermentCommittalType)`,
`create table if not exists ContractInterments ( `create table if not exists ContractInterments (
contractId integer not null, contractId integer not null,
intermentNumber integer not null, intermentNumber integer not null,
@ -240,17 +246,12 @@ const createStatements = [
deathDate integer, deathDate integer,
deathPlace varchar(100), deathPlace varchar(100),
intermentDate integer check (intermentDate > 0),
intermentTime integer check (intermentTime >= 0),
intermentContainerTypeId integer, intermentContainerTypeId integer,
intermentCommittalTypeId integer,
${recordColumns}, ${recordColumns},
primary key (contractId, intermentNumber), primary key (contractId, intermentNumber),
foreign key (contractId) references Contracts (contractId), foreign key (contractId) references Contracts (contractId),
foreign key (intermentContainerTypeId) references IntermentContainerTypes (intermentContainerTypeId), foreign key (intermentContainerTypeId) references IntermentContainerTypes (intermentContainerTypeId)) without rowid`,
foreign key (intermentCommittalTypeId) references IntermentCommittalTypes (intermentCommittalTypeId)) without rowid`,
/* /*
* Fees and Transactions * Fees and Transactions
*/ */
@ -402,6 +403,7 @@ async function initializeData() {
await addRecord('BurialSiteStatuses', 'Available', 1, initializingUser); await addRecord('BurialSiteStatuses', 'Available', 1, initializingUser);
await addRecord('BurialSiteStatuses', 'Reserved', 2, initializingUser); await addRecord('BurialSiteStatuses', 'Reserved', 2, initializingUser);
await addRecord('BurialSiteStatuses', 'Taken', 3, initializingUser); await addRecord('BurialSiteStatuses', 'Taken', 3, initializingUser);
// Contract Types
await addContractType({ await addContractType({
contractType: 'Preneed', contractType: 'Preneed',
isPreneed: '1', isPreneed: '1',
@ -409,23 +411,40 @@ async function initializeData() {
}, initializingUser); }, initializingUser);
await addContractType({ await addContractType({
contractType: 'Interment', contractType: 'Interment',
isPreneed: '0',
orderNumber: 2 orderNumber: 2
}, initializingUser); }, initializingUser);
await addContractType({ await addContractType({
contractType: 'Cremation', contractType: 'Cremation',
isPreneed: '0',
orderNumber: 3 orderNumber: 3
}, initializingUser); }, initializingUser);
await addRecord('IntermentContainerTypes', 'No Shell', 1, initializingUser); // Interment Container Types
await addRecord('IntermentContainerTypes', 'Concrete Liner', 2, initializingUser); await addIntermentContainerType({
await addRecord('IntermentContainerTypes', 'Unpainted Vault', 3, initializingUser); intermentContainerType: 'No Shell',
await addRecord('IntermentContainerTypes', 'Concrete Vault', 4, initializingUser); orderNumber: 1
await addRecord('IntermentContainerTypes', 'Wooden Shell', 5, initializingUser); }, initializingUser);
await addRecord('IntermentContainerTypes', 'Steel Vault', 6, initializingUser); await addIntermentContainerType({
await addRecord('IntermentCommittalTypes', 'Graveside', 1, initializingUser); intermentContainerType: 'Concrete Liner',
await addRecord('IntermentCommittalTypes', 'Chapel', 2, initializingUser); orderNumber: 2
await addRecord('IntermentCommittalTypes', 'Church', 3, initializingUser); }, initializingUser);
await addIntermentContainerType({
intermentContainerType: 'Unpainted Vault',
orderNumber: 3
}, initializingUser);
await addIntermentContainerType({
intermentContainerType: 'Concrete Vault',
orderNumber: 4
}, initializingUser);
await addIntermentContainerType({ intermentContainerType: 'Wooden Shell', orderNumber: 5 }, initializingUser);
await addIntermentContainerType({ intermentContainerType: 'Steel Vault', orderNumber: 6 }, initializingUser);
await addIntermentContainerType({
intermentContainerType: 'Urn',
isCremationType: '1',
orderNumber: 7
}, initializingUser);
// Committal Types
await addRecord('CommittalTypes', 'Graveside', 1, initializingUser);
await addRecord('CommittalTypes', 'Chapel', 2, initializingUser);
await addRecord('CommittalTypes', 'Church', 3, initializingUser);
/* /*
* Fee Categories * Fee Categories
*/ */

View File

@ -1,5 +1,5 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable no-secrets/no-secrets */ /* eslint-disable max-lines, no-secrets/no-secrets */
import sqlite from 'better-sqlite3' import sqlite from 'better-sqlite3'
import Debug from 'debug' import Debug from 'debug'
@ -9,6 +9,7 @@ import { sunriseDB as databasePath } from '../helpers/database.helpers.js'
import addContractType from './addContractType.js' import addContractType from './addContractType.js'
import addFeeCategory from './addFeeCategory.js' import addFeeCategory from './addFeeCategory.js'
import addIntermentContainerType from './addIntermentContainerType.js'
import addRecord from './addRecord.js' import addRecord from './addRecord.js'
const debug = Debug(`${DEBUG_NAMESPACE}:database/initializeDatabase`) const debug = Debug(`${DEBUG_NAMESPACE}:database/initializeDatabase`)
@ -192,6 +193,15 @@ const createStatements = [
`create index if not exists idx_ContractTypePrints_orderNumber `create index if not exists idx_ContractTypePrints_orderNumber
on ContractTypePrints (contractTypeId, orderNumber, printEJS)`, on ContractTypePrints (contractTypeId, orderNumber, printEJS)`,
`create table if not exists CommittalTypes (
committalTypeId integer not null primary key autoincrement,
committalType varchar(100) not null,
orderNumber smallint not null default 0,
${recordColumns})`,
`create index if not exists idx_CommittalType_orderNumber
on CommittalTypes (orderNumber, committalType)`,
`create table if not exists Contracts ( `create table if not exists Contracts (
contractId integer not null primary key autoincrement, contractId integer not null primary key autoincrement,
contractTypeId integer not null, contractTypeId integer not null,
@ -211,11 +221,15 @@ const createStatements = [
funeralHomeId integer, funeralHomeId integer,
funeralDirectorName varchar(100), funeralDirectorName varchar(100),
funeralDate integer check (funeralDate > 0),
funeralTime integer check (funeralTime >= 0),
committalTypeId integer,
${recordColumns}, ${recordColumns},
foreign key (burialSiteId) references BurialSites (burialSiteId), foreign key (burialSiteId) references BurialSites (burialSiteId),
foreign key (contractTypeId) references ContractTypes (contractTypeId), foreign key (contractTypeId) references ContractTypes (contractTypeId),
foreign key (funeralHomeId) references FuneralHomes (funeralHomeId))`, foreign key (funeralHomeId) references FuneralHomes (funeralHomeId),
foreign key (committalTypeId) references CommittalTypes (committalTypeId))`,
`create table if not exists ContractFields ( `create table if not exists ContractFields (
contractId integer not null, contractId integer not null,
@ -245,21 +259,13 @@ const createStatements = [
`create table if not exists IntermentContainerTypes ( `create table if not exists IntermentContainerTypes (
intermentContainerTypeId integer not null primary key autoincrement, intermentContainerTypeId integer not null primary key autoincrement,
intermentContainerType varchar(100) not null, intermentContainerType varchar(100) not null,
isCremationType bit not null default 0,
orderNumber smallint not null default 0, orderNumber smallint not null default 0,
${recordColumns})`, ${recordColumns})`,
`create index if not exists idx_IntermentContainerTypes_orderNumber `create index if not exists idx_IntermentContainerTypes_orderNumber
on IntermentContainerTypes (orderNumber, intermentContainerType)`, on IntermentContainerTypes (orderNumber, intermentContainerType)`,
`create table if not exists IntermentCommittalTypes (
intermentCommittalTypeId integer not null primary key autoincrement,
intermentCommittalType varchar(100) not null,
orderNumber smallint not null default 0,
${recordColumns})`,
`create index if not exists idx_IntermentCommittalType_orderNumber
on IntermentCommittalTypes (orderNumber, intermentCommittalType)`,
`create table if not exists ContractInterments ( `create table if not exists ContractInterments (
contractId integer not null, contractId integer not null,
intermentNumber integer not null, intermentNumber integer not null,
@ -279,17 +285,12 @@ const createStatements = [
deathDate integer, deathDate integer,
deathPlace varchar(100), deathPlace varchar(100),
intermentDate integer check (intermentDate > 0),
intermentTime integer check (intermentTime >= 0),
intermentContainerTypeId integer, intermentContainerTypeId integer,
intermentCommittalTypeId integer,
${recordColumns}, ${recordColumns},
primary key (contractId, intermentNumber), primary key (contractId, intermentNumber),
foreign key (contractId) references Contracts (contractId), foreign key (contractId) references Contracts (contractId),
foreign key (intermentContainerTypeId) references IntermentContainerTypes (intermentContainerTypeId), foreign key (intermentContainerTypeId) references IntermentContainerTypes (intermentContainerTypeId)) without rowid`,
foreign key (intermentCommittalTypeId) references IntermentCommittalTypes (intermentCommittalTypeId)) without rowid`,
/* /*
* Fees and Transactions * Fees and Transactions
@ -473,6 +474,8 @@ async function initializeData(): Promise<void> {
await addRecord('BurialSiteStatuses', 'Reserved', 2, initializingUser) await addRecord('BurialSiteStatuses', 'Reserved', 2, initializingUser)
await addRecord('BurialSiteStatuses', 'Taken', 3, initializingUser) await addRecord('BurialSiteStatuses', 'Taken', 3, initializingUser)
// Contract Types
await addContractType( await addContractType(
{ {
contractType: 'Preneed', contractType: 'Preneed',
@ -485,7 +488,6 @@ async function initializeData(): Promise<void> {
await addContractType( await addContractType(
{ {
contractType: 'Interment', contractType: 'Interment',
isPreneed: '0',
orderNumber: 2 orderNumber: 2
}, },
initializingUser initializingUser
@ -494,22 +496,69 @@ async function initializeData(): Promise<void> {
await addContractType( await addContractType(
{ {
contractType: 'Cremation', contractType: 'Cremation',
isPreneed: '0',
orderNumber: 3 orderNumber: 3
}, },
initializingUser initializingUser
) )
await addRecord('IntermentContainerTypes', 'No Shell', 1, initializingUser) // Interment Container Types
await addRecord('IntermentContainerTypes', 'Concrete Liner', 2, initializingUser)
await addRecord('IntermentContainerTypes', 'Unpainted Vault', 3, initializingUser)
await addRecord('IntermentContainerTypes', 'Concrete Vault', 4, initializingUser)
await addRecord('IntermentContainerTypes', 'Wooden Shell', 5, initializingUser)
await addRecord('IntermentContainerTypes', 'Steel Vault', 6, initializingUser)
await addRecord('IntermentCommittalTypes', 'Graveside', 1, initializingUser) await addIntermentContainerType(
await addRecord('IntermentCommittalTypes', 'Chapel', 2, initializingUser) {
await addRecord('IntermentCommittalTypes', 'Church', 3, initializingUser) intermentContainerType: 'No Shell',
orderNumber: 1
},
initializingUser
)
await addIntermentContainerType(
{
intermentContainerType: 'Concrete Liner',
orderNumber: 2
},
initializingUser
)
await addIntermentContainerType(
{
intermentContainerType: 'Unpainted Vault',
orderNumber: 3
},
initializingUser
)
await addIntermentContainerType(
{
intermentContainerType: 'Concrete Vault',
orderNumber: 4
},
initializingUser
)
await addIntermentContainerType(
{ intermentContainerType: 'Wooden Shell', orderNumber: 5 },
initializingUser
)
await addIntermentContainerType(
{ intermentContainerType: 'Steel Vault', orderNumber: 6 },
initializingUser
)
await addIntermentContainerType(
{
intermentContainerType: 'Urn',
isCremationType: '1',
orderNumber: 7
},
initializingUser
)
// Committal Types
await addRecord('CommittalTypes', 'Graveside', 1, initializingUser)
await addRecord('CommittalTypes', 'Chapel', 2, initializingUser)
await addRecord('CommittalTypes', 'Church', 3, initializingUser)
/* /*
* Fee Categories * Fee Categories

View File

@ -1,4 +1,4 @@
import type { PoolConnection } from 'better-sqlite-pool'; import type { PoolConnection } from 'better-sqlite-pool';
type RecordTable = 'FeeCategories' | 'Fees' | 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'ContractTypes' | 'ContractTypeFields' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes'; type RecordTable = 'FeeCategories' | 'Fees' | 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'IntermentContainerTypes' | 'CommittalTypes' | 'ContractTypes' | 'ContractTypeFields' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes';
export declare function updateRecordOrderNumber(recordTable: RecordTable, recordId: number | string, orderNumber: number | string, connectedDatabase: PoolConnection): boolean; export declare function updateRecordOrderNumber(recordTable: RecordTable, recordId: number | string, orderNumber: number | string, connectedDatabase: PoolConnection): boolean;
export {}; export {};

View File

@ -4,6 +4,8 @@ recordIdColumns.set('Fees', 'feeId');
recordIdColumns.set('BurialSiteStatuses', 'burialSiteStatusId'); recordIdColumns.set('BurialSiteStatuses', 'burialSiteStatusId');
recordIdColumns.set('BurialSiteTypes', 'burialSiteTypeId'); recordIdColumns.set('BurialSiteTypes', 'burialSiteTypeId');
recordIdColumns.set('BurialSiteTypeFields', 'burialSiteTypeFieldId'); recordIdColumns.set('BurialSiteTypeFields', 'burialSiteTypeFieldId');
recordIdColumns.set('IntermentContainerTypes', 'intermentContainerTypeId');
recordIdColumns.set('CommittalTypes', 'committalTypeId');
recordIdColumns.set('ContractTypes', 'contractTypeId'); recordIdColumns.set('ContractTypes', 'contractTypeId');
recordIdColumns.set('ContractTypeFields', 'contractTypeFieldId'); recordIdColumns.set('ContractTypeFields', 'contractTypeFieldId');
recordIdColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneTypeId'); recordIdColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneTypeId');

View File

@ -6,6 +6,8 @@ type RecordTable =
| 'BurialSiteStatuses' | 'BurialSiteStatuses'
| 'BurialSiteTypes' | 'BurialSiteTypes'
| 'BurialSiteTypeFields' | 'BurialSiteTypeFields'
| 'IntermentContainerTypes'
| 'CommittalTypes'
| 'ContractTypes' | 'ContractTypes'
| 'ContractTypeFields' | 'ContractTypeFields'
| 'WorkOrderMilestoneTypes' | 'WorkOrderMilestoneTypes'
@ -17,6 +19,8 @@ recordIdColumns.set('Fees', 'feeId')
recordIdColumns.set('BurialSiteStatuses', 'burialSiteStatusId') recordIdColumns.set('BurialSiteStatuses', 'burialSiteStatusId')
recordIdColumns.set('BurialSiteTypes', 'burialSiteTypeId') recordIdColumns.set('BurialSiteTypes', 'burialSiteTypeId')
recordIdColumns.set('BurialSiteTypeFields', 'burialSiteTypeFieldId') recordIdColumns.set('BurialSiteTypeFields', 'burialSiteTypeFieldId')
recordIdColumns.set('IntermentContainerTypes', 'intermentContainerTypeId')
recordIdColumns.set('CommittalTypes', 'committalTypeId')
recordIdColumns.set('ContractTypes', 'contractTypeId') recordIdColumns.set('ContractTypes', 'contractTypeId')
recordIdColumns.set('ContractTypeFields', 'contractTypeFieldId') recordIdColumns.set('ContractTypeFields', 'contractTypeFieldId')
recordIdColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneTypeId') recordIdColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneTypeId')

View File

@ -64,7 +64,7 @@ function buildEventDescriptionHTML_occupancies(request, milestone) {
</a> </a>
</td> </td>
<td> <td>
${occupancy.lotName ? escapeHTML(occupancy.lotName) : '(Not Set)'} ${occupancy.burialSiteName ? escapeHTML(occupancy.burialSiteName) : '(Not Set)'}
</td> </td>
<td> <td>
${occupancy.contractStartDateString} ${occupancy.contractStartDateString}

View File

@ -99,7 +99,7 @@ function buildEventDescriptionHTML_occupancies(
</a> </a>
</td> </td>
<td> <td>
${occupancy.lotName ? escapeHTML(occupancy.lotName) : '(Not Set)'} ${occupancy.burialSiteName ? escapeHTML(occupancy.burialSiteName) : '(Not Set)'}
</td> </td>
<td> <td>
${occupancy.contractStartDateString} ${occupancy.contractStartDateString}

View File

@ -1,7 +1,7 @@
import getContract from '../../database/getContract.js'; import getContract from '../../database/getContract.js';
import getFuneralHomes from '../../database/getFuneralHomes.js'; import getFuneralHomes from '../../database/getFuneralHomes.js';
import { getConfigProperty } from '../../helpers/config.helpers.js'; import { getConfigProperty } from '../../helpers/config.helpers.js';
import { getContractTypePrintsById, getContractTypes, getWorkOrderTypes } from '../../helpers/functions.cache.js'; import { getCommittalTypes, getContractTypePrintsById, getContractTypes, getIntermentContainerTypes, getWorkOrderTypes } from '../../helpers/functions.cache.js';
export default async function handler(request, response) { export default async function handler(request, response) {
const contract = await getContract(request.params.contractId); const contract = await getContract(request.params.contractId);
if (contract === undefined) { if (contract === undefined) {
@ -11,6 +11,8 @@ export default async function handler(request, response) {
const contractTypePrints = await getContractTypePrintsById(contract.contractTypeId); const contractTypePrints = await getContractTypePrintsById(contract.contractTypeId);
const contractTypes = await getContractTypes(); const contractTypes = await getContractTypes();
const funeralHomes = await getFuneralHomes(); const funeralHomes = await getFuneralHomes();
const committalTypes = await getCommittalTypes();
const intermentContainerTypes = await getIntermentContainerTypes();
const workOrderTypes = await getWorkOrderTypes(); const workOrderTypes = await getWorkOrderTypes();
response.render('contract-edit', { response.render('contract-edit', {
headTitle: 'Contract Update', headTitle: 'Contract Update',
@ -18,6 +20,8 @@ export default async function handler(request, response) {
contractTypePrints, contractTypePrints,
contractTypes, contractTypes,
funeralHomes, funeralHomes,
committalTypes,
intermentContainerTypes,
workOrderTypes, workOrderTypes,
isCreate: false isCreate: false
}); });

View File

@ -4,8 +4,10 @@ import getContract from '../../database/getContract.js'
import getFuneralHomes from '../../database/getFuneralHomes.js' import getFuneralHomes from '../../database/getFuneralHomes.js'
import { getConfigProperty } from '../../helpers/config.helpers.js' import { getConfigProperty } from '../../helpers/config.helpers.js'
import { import {
getCommittalTypes,
getContractTypePrintsById, getContractTypePrintsById,
getContractTypes, getContractTypes,
getIntermentContainerTypes,
getWorkOrderTypes getWorkOrderTypes
} from '../../helpers/functions.cache.js' } from '../../helpers/functions.cache.js'
@ -32,6 +34,8 @@ export default async function handler(
const contractTypes = await getContractTypes() const contractTypes = await getContractTypes()
const funeralHomes = await getFuneralHomes() const funeralHomes = await getFuneralHomes()
const committalTypes = await getCommittalTypes()
const intermentContainerTypes = await getIntermentContainerTypes()
const workOrderTypes = await getWorkOrderTypes() const workOrderTypes = await getWorkOrderTypes()
response.render('contract-edit', { response.render('contract-edit', {
@ -41,6 +45,8 @@ export default async function handler(
contractTypes, contractTypes,
funeralHomes, funeralHomes,
committalTypes,
intermentContainerTypes,
workOrderTypes, workOrderTypes,
isCreate: false isCreate: false

View File

@ -2,7 +2,7 @@ import { dateToInteger, dateToString } from '@cityssm/utils-datetime';
import getBurialSite from '../../database/getBurialSite.js'; import getBurialSite from '../../database/getBurialSite.js';
import getFuneralHomes from '../../database/getFuneralHomes.js'; import getFuneralHomes from '../../database/getFuneralHomes.js';
import { getConfigProperty } from '../../helpers/config.helpers.js'; import { getConfigProperty } from '../../helpers/config.helpers.js';
import { getContractTypes } from '../../helpers/functions.cache.js'; import { getCommittalTypes, getContractTypes, getIntermentContainerTypes } from '../../helpers/functions.cache.js';
export default async function handler(request, response) { export default async function handler(request, response) {
const startDate = new Date(); const startDate = new Date();
const contract = { const contract = {
@ -23,11 +23,15 @@ export default async function handler(request, response) {
} }
const contractTypes = await getContractTypes(); const contractTypes = await getContractTypes();
const funeralHomes = await getFuneralHomes(); const funeralHomes = await getFuneralHomes();
const committalTypes = await getCommittalTypes();
const intermentContainerTypes = await getIntermentContainerTypes();
response.render('contract-edit', { response.render('contract-edit', {
headTitle: 'Create a New Contract', headTitle: 'Create a New Contract',
contract, contract,
contractTypes, contractTypes,
funeralHomes, funeralHomes,
committalTypes,
intermentContainerTypes,
isCreate: true isCreate: true
}); });
} }

View File

@ -4,7 +4,7 @@ import type { Request, Response } from 'express'
import getBurialSite from '../../database/getBurialSite.js' import getBurialSite from '../../database/getBurialSite.js'
import getFuneralHomes from '../../database/getFuneralHomes.js' import getFuneralHomes from '../../database/getFuneralHomes.js'
import { getConfigProperty } from '../../helpers/config.helpers.js' import { getConfigProperty } from '../../helpers/config.helpers.js'
import { getContractTypes } from '../../helpers/functions.cache.js' import { getCommittalTypes, getContractTypes, getIntermentContainerTypes } from '../../helpers/functions.cache.js'
import type { Contract } from '../../types/recordTypes.js' import type { Contract } from '../../types/recordTypes.js'
export default async function handler( export default async function handler(
@ -34,6 +34,8 @@ export default async function handler(
const contractTypes = await getContractTypes() const contractTypes = await getContractTypes()
const funeralHomes = await getFuneralHomes() const funeralHomes = await getFuneralHomes()
const committalTypes = await getCommittalTypes()
const intermentContainerTypes = await getIntermentContainerTypes()
response.render('contract-edit', { response.render('contract-edit', {
headTitle: 'Create a New Contract', headTitle: 'Create a New Contract',
@ -41,6 +43,8 @@ export default async function handler(
contractTypes, contractTypes,
funeralHomes, funeralHomes,
committalTypes,
intermentContainerTypes,
isCreate: true isCreate: true
}) })

View File

@ -1,6 +1,6 @@
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
export default function handler(request: Request<unknown, unknown, { export default function handler(request: Request<unknown, unknown, {
lotId: string; burialSiteId: string;
burialSiteStatusId: string; burialSiteStatusId: string;
workOrderId: string; workOrderId: string;
}>, response: Response): Promise<void>; }>, response: Response): Promise<void>;

View File

@ -1,7 +1,7 @@
import getBurialSites from '../../database/getBurialSites.js'; import getBurialSites from '../../database/getBurialSites.js';
import { updateBurialSiteStatus } from '../../database/updateBurialSite.js'; import { updateBurialSiteStatus } from '../../database/updateBurialSite.js';
export default async function handler(request, response) { export default async function handler(request, response) {
const success = await updateBurialSiteStatus(request.body.lotId, request.body.burialSiteStatusId, request.session.user); const success = await updateBurialSiteStatus(request.body.burialSiteId, request.body.burialSiteStatusId, request.session.user);
const results = await getBurialSites({ const results = await getBurialSites({
workOrderId: request.body.workOrderId workOrderId: request.body.workOrderId
}, { }, {

View File

@ -7,12 +7,12 @@ export default async function handler(
request: Request< request: Request<
unknown, unknown,
unknown, unknown,
{ lotId: string; burialSiteStatusId: string; workOrderId: string } { burialSiteId: string; burialSiteStatusId: string; workOrderId: string }
>, >,
response: Response response: Response
): Promise<void> { ): Promise<void> {
const success = await updateBurialSiteStatus( const success = await updateBurialSiteStatus(
request.body.lotId, request.body.burialSiteId,
request.body.burialSiteStatusId, request.body.burialSiteStatusId,
request.session.user as User request.session.user as User
) )

View File

@ -1,4 +1,4 @@
import type { BurialSiteStatus, BurialSiteType, ContractType, ContractTypeField, IntermentCommittalType, IntermentContainerType, WorkOrderMilestoneType, WorkOrderType } from '../types/recordTypes.js'; import type { BurialSiteStatus, BurialSiteType, CommittalType, ContractType, ContractTypeField, IntermentContainerType, WorkOrderMilestoneType, WorkOrderType } from '../types/recordTypes.js';
export declare function getBurialSiteStatuses(): Promise<BurialSiteStatus[]>; export declare function getBurialSiteStatuses(): Promise<BurialSiteStatus[]>;
export declare function getBurialSiteStatusById(burialSiteStatusId: number): Promise<BurialSiteStatus | undefined>; export declare function getBurialSiteStatusById(burialSiteStatusId: number): Promise<BurialSiteStatus | undefined>;
export declare function getBurialSiteStatusByBurialSiteStatus(burialSiteStatus: string): Promise<BurialSiteStatus | undefined>; export declare function getBurialSiteStatusByBurialSiteStatus(burialSiteStatus: string): Promise<BurialSiteStatus | undefined>;
@ -12,8 +12,8 @@ export declare function getContractTypeByContractType(contractTypeString: string
export declare function getContractTypePrintsById(contractTypeId: number): Promise<string[]>; export declare function getContractTypePrintsById(contractTypeId: number): Promise<string[]>;
export declare function getIntermentContainerTypes(): Promise<IntermentContainerType[]>; export declare function getIntermentContainerTypes(): Promise<IntermentContainerType[]>;
export declare function getIntermentContainerTypeById(intermentContainerTypeId: number): Promise<IntermentContainerType | undefined>; export declare function getIntermentContainerTypeById(intermentContainerTypeId: number): Promise<IntermentContainerType | undefined>;
export declare function getIntermentCommittalTypes(): Promise<IntermentCommittalType[]>; export declare function getCommittalTypes(): Promise<CommittalType[]>;
export declare function getIntermentCommittalTypeById(intermentCommittalTypeId: number): Promise<IntermentCommittalType | undefined>; export declare function getCommittalTypeById(committalTypeId: number): Promise<CommittalType | undefined>;
export declare function getWorkOrderTypes(): Promise<WorkOrderType[]>; export declare function getWorkOrderTypes(): Promise<WorkOrderType[]>;
export declare function getWorkOrderTypeById(workOrderTypeId: number): Promise<WorkOrderType | undefined>; export declare function getWorkOrderTypeById(workOrderTypeId: number): Promise<WorkOrderType | undefined>;
export declare function getWorkOrderMilestoneTypes(): Promise<WorkOrderMilestoneType[]>; export declare function getWorkOrderMilestoneTypes(): Promise<WorkOrderMilestoneType[]>;
@ -21,6 +21,6 @@ export declare function getWorkOrderMilestoneTypeById(workOrderMilestoneTypeId:
export declare function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneTypeString: string): Promise<WorkOrderMilestoneType | undefined>; export declare function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneTypeString: string): Promise<WorkOrderMilestoneType | undefined>;
export declare function preloadCaches(): Promise<void>; export declare function preloadCaches(): Promise<void>;
export declare function clearCaches(): void; export declare function clearCaches(): void;
type CacheTableNames = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'ContractTypes' | 'ContractTypeFields' | 'ContractTypePrints' | 'IntermentContainerTypes' | 'IntermentCommittalTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes' | 'FeeCategories' | 'Fees'; type CacheTableNames = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'ContractTypes' | 'ContractTypeFields' | 'ContractTypePrints' | 'IntermentContainerTypes' | 'CommittalTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes' | 'FeeCategories' | 'Fees';
export declare function clearCacheByTableName(tableName: CacheTableNames, relayMessage?: boolean): void; export declare function clearCacheByTableName(tableName: CacheTableNames, relayMessage?: boolean): void;
export {}; export {};

View File

@ -4,9 +4,9 @@ import cluster from 'node:cluster';
import Debug from 'debug'; import Debug from 'debug';
import getBurialSiteStatusesFromDatabase from '../database/getBurialSiteStatuses.js'; import getBurialSiteStatusesFromDatabase from '../database/getBurialSiteStatuses.js';
import getBurialSiteTypesFromDatabase from '../database/getBurialSiteTypes.js'; import getBurialSiteTypesFromDatabase from '../database/getBurialSiteTypes.js';
import getCommittalTypesFromDatabase from '../database/getCommittalTypes.js';
import getContractTypeFieldsFromDatabase from '../database/getContractTypeFields.js'; import getContractTypeFieldsFromDatabase from '../database/getContractTypeFields.js';
import getContractTypesFromDatabase from '../database/getContractTypes.js'; import getContractTypesFromDatabase from '../database/getContractTypes.js';
import getIntermentCommittalTypesFromDatabase from '../database/getIntermentCommittalTypes.js';
import getIntermentContainerTypesFromDatabase from '../database/getIntermentContainerTypes.js'; import getIntermentContainerTypesFromDatabase from '../database/getIntermentContainerTypes.js';
import getWorkOrderMilestoneTypesFromDatabase from '../database/getWorkOrderMilestoneTypes.js'; import getWorkOrderMilestoneTypesFromDatabase from '../database/getWorkOrderMilestoneTypes.js';
import getWorkOrderTypesFromDatabase from '../database/getWorkOrderTypes.js'; import getWorkOrderTypesFromDatabase from '../database/getWorkOrderTypes.js';
@ -116,21 +116,21 @@ function clearIntermentContainerTypesCache() {
intermentContainerTypes = undefined; intermentContainerTypes = undefined;
} }
/* /*
* Interment Committal Types * Committal Types
*/ */
let intermentCommittalTypes; let committalTypes;
export async function getIntermentCommittalTypes() { export async function getCommittalTypes() {
if (intermentCommittalTypes === undefined) { if (committalTypes === undefined) {
intermentCommittalTypes = await getIntermentCommittalTypesFromDatabase(); committalTypes = await getCommittalTypesFromDatabase();
} }
return intermentCommittalTypes; return committalTypes;
} }
export async function getIntermentCommittalTypeById(intermentCommittalTypeId) { export async function getCommittalTypeById(committalTypeId) {
const cachedCommittalTypes = await getIntermentCommittalTypes(); const cachedCommittalTypes = await getCommittalTypes();
return cachedCommittalTypes.find((currentCommittalType) => currentCommittalType.intermentCommittalTypeId === intermentCommittalTypeId); return cachedCommittalTypes.find((currentCommittalType) => currentCommittalType.committalTypeId === committalTypeId);
} }
function clearIntermentCommittalTypesCache() { function clearCommittalTypesCache() {
intermentCommittalTypes = undefined; committalTypes = undefined;
} }
/* /*
* Work Order Types * Work Order Types
@ -175,6 +175,8 @@ export async function preloadCaches() {
await getBurialSiteStatuses(); await getBurialSiteStatuses();
await getBurialSiteTypes(); await getBurialSiteTypes();
await getContractTypes(); await getContractTypes();
await getCommittalTypes();
await getIntermentContainerTypes();
await getWorkOrderTypes(); await getWorkOrderTypes();
await getWorkOrderMilestoneTypes(); await getWorkOrderMilestoneTypes();
} }
@ -182,6 +184,8 @@ export function clearCaches() {
clearBurialSiteStatusesCache(); clearBurialSiteStatusesCache();
clearBurialSiteTypesCache(); clearBurialSiteTypesCache();
clearContractTypesCache(); clearContractTypesCache();
clearCommittalTypesCache();
clearIntermentContainerTypesCache();
clearWorkOrderTypesCache(); clearWorkOrderTypesCache();
clearWorkOrderMilestoneTypesCache(); clearWorkOrderMilestoneTypesCache();
} }
@ -209,8 +213,8 @@ export function clearCacheByTableName(tableName, relayMessage = true) {
clearIntermentContainerTypesCache(); clearIntermentContainerTypesCache();
break; break;
} }
case 'IntermentCommittalTypes': { case 'CommittalTypes': {
clearIntermentCommittalTypesCache(); clearCommittalTypesCache();
break; break;
} }
case 'WorkOrderMilestoneTypes': { case 'WorkOrderMilestoneTypes': {

View File

@ -7,9 +7,9 @@ import Debug from 'debug'
import getBurialSiteStatusesFromDatabase from '../database/getBurialSiteStatuses.js' import getBurialSiteStatusesFromDatabase from '../database/getBurialSiteStatuses.js'
import getBurialSiteTypesFromDatabase from '../database/getBurialSiteTypes.js' import getBurialSiteTypesFromDatabase from '../database/getBurialSiteTypes.js'
import getCommittalTypesFromDatabase from '../database/getCommittalTypes.js'
import getContractTypeFieldsFromDatabase from '../database/getContractTypeFields.js' import getContractTypeFieldsFromDatabase from '../database/getContractTypeFields.js'
import getContractTypesFromDatabase from '../database/getContractTypes.js' import getContractTypesFromDatabase from '../database/getContractTypes.js'
import getIntermentCommittalTypesFromDatabase from '../database/getIntermentCommittalTypes.js'
import getIntermentContainerTypesFromDatabase from '../database/getIntermentContainerTypes.js' import getIntermentContainerTypesFromDatabase from '../database/getIntermentContainerTypes.js'
import getWorkOrderMilestoneTypesFromDatabase from '../database/getWorkOrderMilestoneTypes.js' import getWorkOrderMilestoneTypesFromDatabase from '../database/getWorkOrderMilestoneTypes.js'
import getWorkOrderTypesFromDatabase from '../database/getWorkOrderTypes.js' import getWorkOrderTypesFromDatabase from '../database/getWorkOrderTypes.js'
@ -21,9 +21,9 @@ import type {
import type { import type {
BurialSiteStatus, BurialSiteStatus,
BurialSiteType, BurialSiteType,
CommittalType,
ContractType, ContractType,
ContractTypeField, ContractTypeField,
IntermentCommittalType,
IntermentContainerType, IntermentContainerType,
WorkOrderMilestoneType, WorkOrderMilestoneType,
WorkOrderType WorkOrderType
@ -214,34 +214,34 @@ function clearIntermentContainerTypesCache(): void {
} }
/* /*
* Interment Committal Types * Committal Types
*/ */
let intermentCommittalTypes: IntermentCommittalType[] | undefined let committalTypes: CommittalType[] | undefined
export async function getIntermentCommittalTypes(): Promise< export async function getCommittalTypes(): Promise<
IntermentCommittalType[] CommittalType[]
> { > {
if (intermentCommittalTypes === undefined) { if (committalTypes === undefined) {
intermentCommittalTypes = await getIntermentCommittalTypesFromDatabase() committalTypes = await getCommittalTypesFromDatabase()
} }
return intermentCommittalTypes return committalTypes
} }
export async function getIntermentCommittalTypeById( export async function getCommittalTypeById(
intermentCommittalTypeId: number committalTypeId: number
): Promise<IntermentCommittalType | undefined> { ): Promise<CommittalType | undefined> {
const cachedCommittalTypes = await getIntermentCommittalTypes() const cachedCommittalTypes = await getCommittalTypes()
return cachedCommittalTypes.find( return cachedCommittalTypes.find(
(currentCommittalType) => (currentCommittalType) =>
currentCommittalType.intermentCommittalTypeId === intermentCommittalTypeId currentCommittalType.committalTypeId === committalTypeId
) )
} }
function clearIntermentCommittalTypesCache(): void { function clearCommittalTypesCache(): void {
intermentCommittalTypes = undefined committalTypes = undefined
} }
/* /*
@ -321,6 +321,8 @@ export async function preloadCaches(): Promise<void> {
await getBurialSiteStatuses() await getBurialSiteStatuses()
await getBurialSiteTypes() await getBurialSiteTypes()
await getContractTypes() await getContractTypes()
await getCommittalTypes()
await getIntermentContainerTypes()
await getWorkOrderTypes() await getWorkOrderTypes()
await getWorkOrderMilestoneTypes() await getWorkOrderMilestoneTypes()
} }
@ -329,6 +331,8 @@ export function clearCaches(): void {
clearBurialSiteStatusesCache() clearBurialSiteStatusesCache()
clearBurialSiteTypesCache() clearBurialSiteTypesCache()
clearContractTypesCache() clearContractTypesCache()
clearCommittalTypesCache()
clearIntermentContainerTypesCache()
clearWorkOrderTypesCache() clearWorkOrderTypesCache()
clearWorkOrderMilestoneTypesCache() clearWorkOrderMilestoneTypesCache()
} }
@ -345,7 +349,7 @@ type CacheTableNames =
| 'ContractTypeFields' | 'ContractTypeFields'
| 'ContractTypePrints' | 'ContractTypePrints'
| 'IntermentContainerTypes' | 'IntermentContainerTypes'
| 'IntermentCommittalTypes' | 'CommittalTypes'
| 'WorkOrderMilestoneTypes' | 'WorkOrderMilestoneTypes'
| 'WorkOrderTypes' | 'WorkOrderTypes'
| 'FeeCategories' | 'FeeCategories'
@ -379,8 +383,8 @@ export function clearCacheByTableName(
break break
} }
case 'IntermentCommittalTypes': { case 'CommittalTypes': {
clearIntermentCommittalTypesCache() clearCommittalTypesCache()
break break
} }

View File

@ -13,16 +13,16 @@
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<form id="form--lotStatusEdit"> <form id="form--lotStatusEdit">
<input id="lotStatusEdit--lotId" name="lotId" type="hidden" value="" /> <input id="lotStatusEdit--burialSiteId" name="burialSiteId" type="hidden" value="" />
<div class="field"> <div class="field">
<label class="label" for="lotStatusEdit--lotName" <label class="label" for="lotStatusEdit--burialSiteName"
><span class="alias" data-alias="Lot"></span> Name</label ><span class="alias" data-alias="Lot"></span> Name</label
> >
<div class="control"> <div class="control">
<input <input
class="input is-readonly" class="input is-readonly"
id="lotStatusEdit--lotName" id="lotStatusEdit--burialSiteName"
readonly readonly
/> />
</div> </div>

View File

@ -26,15 +26,15 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label class="label" for="lotSearch--lotName"> <label class="label" for="lotSearch--burialSiteName">
<span class="alias" data-alias="Lot"></span> <span class="alias" data-alias="Lot"></span>
Name Name
</label> </label>
<div class="control has-icons-left"> <div class="control has-icons-left">
<input <input
class="input" class="input"
id="lotSearch--lotName" id="lotSearch--burialSiteName"
name="lotName" name="burialSiteName"
type="text" type="text"
/> />
<span class="icon is-small is-left"> <span class="icon is-small is-left">

View File

@ -51,15 +51,15 @@
</div> </div>
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label class="label" for="contractSearch--lotName"> <label class="label" for="contractSearch--burialSiteName">
<span class="alias" data-alias="Lot"></span> <span class="alias" data-alias="Lot"></span>
Name Name
</label> </label>
<div class="control has-icons-left"> <div class="control has-icons-left">
<input <input
class="input" class="input"
id="contractSearch--lotName" id="contractSearch--burialSiteName"
name="lotName" name="burialSiteName"
type="text" type="text"
/> />
<span class="icon is-small is-left"> <span class="icon is-small is-left">

View File

@ -455,8 +455,72 @@ Object.defineProperty(exports, "__esModule", { value: true });
*/ */
let contractInterments = exports.contractInterments; let contractInterments = exports.contractInterments;
delete exports.contractInterments; delete exports.contractInterments;
function openEditContractInterment(clickEvent) { }
function deleteContractInterment(clickEvent) { }
function renderContractInterments() { function renderContractInterments() {
const containerElement = document.querySelector('#container--contractInterments');
if (contractInterments.length === 0) {
containerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no interments associated with this record.</p>
</div>`;
return;
} }
const tableElement = document.createElement('table');
tableElement.className = 'table is-fullwidth is-striped is-hoverable';
tableElement.innerHTML = `<thead><tr>
<th>Name</th>
<th>Vital Statistics</th>
<th>Container</th>
<th class="is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>`;
for (const interment of contractInterments) {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.intermentNumber =
interment.intermentNumber?.toString();
tableRowElement.innerHTML = `<td>
${cityssm.escapeHTML(interment.deceasedName ?? '')}<br />
${cityssm.escapeHTML(interment.deceasedAddress1 ?? '')}<br />
${cityssm.escapeHTML(interment.deceasedAddress2 ?? '')}<br />
${cityssm.escapeHTML(interment.deceasedCity ?? '')}, ${cityssm.escapeHTML(interment.deceasedProvince ?? '')}<br />
${cityssm.escapeHTML(interment.deceasedPostalCode ?? '')}
</td>
<td>
<p class="mb-2">
<strong>Birth:</strong><br />
${cityssm.escapeHTML(interment.birthDateString ?? '')}<br />
${cityssm.escapeHTML(interment.birthPlace ?? '')}
</p>
<p>
<strong>Death:</strong><br />
${cityssm.escapeHTML(interment.deathDateString ?? '')}<br />
${cityssm.escapeHTML(interment.deathPlace ?? '')}
</p>
</td>
<td>${cityssm.escapeHTML(interment.intermentContainerType ?? '')}</td>
<td class="is-hidden-print">
<div class="buttons is-justify-content-end">
<button class="button is-small is-info button--edit" type="button" data-tooltip="Edit Interment">
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Edit</span>
</button>
<button class="button is-small is-danger button--delete" type="button" data-tooltip="Remove Interment">
<span class="icon"><i class="fas fa-trash" aria-hidden="true"></i></span>
</button>
</div>
</td>`;
tableRowElement
.querySelector('.button--edit')
?.addEventListener('click', openEditContractInterment);
tableRowElement
.querySelector('.button--delete')
?.addEventListener('click', deleteContractInterment);
tableElement.querySelector('tbody')?.append(tableRowElement);
}
containerElement.innerHTML = '';
containerElement.append(tableElement);
}
renderContractInterments();
/** /**
* Comments * Comments
*/ */
@ -570,12 +634,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
contractComment.contractCommentId?.toString(); contractComment.contractCommentId?.toString();
tableRowElement.innerHTML = `<td>${cityssm.escapeHTML(contractComment.recordCreate_userName ?? '')}</td> tableRowElement.innerHTML = `<td>${cityssm.escapeHTML(contractComment.recordCreate_userName ?? '')}</td>
<td> <td>
${cityssm.escapeHTML(contractComment.contractCommentDateString ?? '')} ${cityssm.escapeHTML(contractComment.commentDateString ?? '')}
${cityssm.escapeHTML(contractComment.contractCommentTime === 0 ${cityssm.escapeHTML(contractComment.commentTime === 0
? '' ? ''
: contractComment.contractCommentTimePeriodString ?? '')} : contractComment.commentTimePeriodString ?? '')}
</td> </td>
<td>${cityssm.escapeHTML(contractComment.contractComment ?? '')}</td> <td>${cityssm.escapeHTML(contractComment.comment ?? '')}</td>
<td class="is-hidden-print"> <td class="is-hidden-print">
<div class="buttons are-small is-justify-content-end"> <div class="buttons are-small is-justify-content-end">
<button class="button is-primary button--edit" type="button"> <button class="button is-primary button--edit" type="button">

View File

@ -729,10 +729,89 @@ declare const exports: Record<string, unknown>
let contractInterments = exports.contractInterments as ContractInterment[] let contractInterments = exports.contractInterments as ContractInterment[]
delete exports.contractInterments delete exports.contractInterments
function renderContractInterments(): void { function openEditContractInterment(clickEvent: Event): void {}
function deleteContractInterment(clickEvent: Event): void {}
function renderContractInterments(): void {
const containerElement = document.querySelector(
'#container--contractInterments'
) as HTMLElement
if (contractInterments.length === 0) {
containerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no interments associated with this record.</p>
</div>`
return
} }
const tableElement = document.createElement('table')
tableElement.className = 'table is-fullwidth is-striped is-hoverable'
tableElement.innerHTML = `<thead><tr>
<th>Name</th>
<th>Vital Statistics</th>
<th>Container</th>
<th class="is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>`
for (const interment of contractInterments) {
const tableRowElement = document.createElement('tr')
tableRowElement.dataset.intermentNumber =
interment.intermentNumber?.toString()
tableRowElement.innerHTML = `<td>
${cityssm.escapeHTML(interment.deceasedName ?? '')}<br />
${cityssm.escapeHTML(interment.deceasedAddress1 ?? '')}<br />
${cityssm.escapeHTML(interment.deceasedAddress2 ?? '')}<br />
${cityssm.escapeHTML(interment.deceasedCity ?? '')}, ${cityssm.escapeHTML(
interment.deceasedProvince ?? ''
)}<br />
${cityssm.escapeHTML(interment.deceasedPostalCode ?? '')}
</td>
<td>
<p class="mb-2">
<strong>Birth:</strong><br />
${cityssm.escapeHTML(interment.birthDateString ?? '')}<br />
${cityssm.escapeHTML(interment.birthPlace ?? '')}
</p>
<p>
<strong>Death:</strong><br />
${cityssm.escapeHTML(interment.deathDateString ?? '')}<br />
${cityssm.escapeHTML(interment.deathPlace ?? '')}
</p>
</td>
<td>${cityssm.escapeHTML(interment.intermentContainerType ?? '')}</td>
<td class="is-hidden-print">
<div class="buttons is-justify-content-end">
<button class="button is-small is-info button--edit" type="button" data-tooltip="Edit Interment">
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Edit</span>
</button>
<button class="button is-small is-danger button--delete" type="button" data-tooltip="Remove Interment">
<span class="icon"><i class="fas fa-trash" aria-hidden="true"></i></span>
</button>
</div>
</td>`
tableRowElement
.querySelector('.button--edit')
?.addEventListener('click', openEditContractInterment)
tableRowElement
.querySelector('.button--delete')
?.addEventListener('click', deleteContractInterment)
tableElement.querySelector('tbody')?.append(tableRowElement)
}
containerElement.innerHTML = ''
containerElement.append(tableElement)
}
renderContractInterments()
/** /**
* Comments * Comments
*/ */
@ -920,14 +999,14 @@ declare const exports: Record<string, unknown>
tableRowElement.innerHTML = `<td>${cityssm.escapeHTML(contractComment.recordCreate_userName ?? '')}</td> tableRowElement.innerHTML = `<td>${cityssm.escapeHTML(contractComment.recordCreate_userName ?? '')}</td>
<td> <td>
${cityssm.escapeHTML(contractComment.contractCommentDateString ?? '')} ${cityssm.escapeHTML(contractComment.commentDateString ?? '')}
${cityssm.escapeHTML( ${cityssm.escapeHTML(
contractComment.contractCommentTime === 0 contractComment.commentTime === 0
? '' ? ''
: contractComment.contractCommentTimePeriodString ?? '' : contractComment.commentTimePeriodString ?? ''
)} )}
</td> </td>
<td>${cityssm.escapeHTML(contractComment.contractComment ?? '')}</td> <td>${cityssm.escapeHTML(contractComment.comment ?? '')}</td>
<td class="is-hidden-print"> <td class="is-hidden-print">
<div class="buttons are-small is-justify-content-end"> <div class="buttons are-small is-justify-content-end">
<button class="button is-primary button--edit" type="button"> <button class="button is-primary button--edit" type="button">
@ -1529,11 +1608,9 @@ declare const exports: Record<string, unknown>
// eslint-disable-next-line no-unsanitized/property // eslint-disable-next-line no-unsanitized/property
panelBlockElement.innerHTML = `<strong>${cityssm.escapeHTML(fee.feeName ?? '')}</strong><br /> panelBlockElement.innerHTML = `<strong>${cityssm.escapeHTML(fee.feeName ?? '')}</strong><br />
<small> <small>
${ ${cityssm
cityssm
.escapeHTML(fee.feeDescription ?? '') .escapeHTML(fee.feeDescription ?? '')
.replaceAll('\n', '<br />') .replaceAll('\n', '<br />')}
}
</small>` </small>`
if (!feeCategory.isGroupedFee) { if (!feeCategory.isGroupedFee) {
@ -1619,7 +1696,10 @@ declare const exports: Record<string, unknown>
10 10
) )
const transaction = contractTransactions.find((possibleTransaction) => possibleTransaction.transactionIndex === transactionIndex) as ContractTransaction const transaction = contractTransactions.find(
(possibleTransaction) =>
possibleTransaction.transactionIndex === transactionIndex
) as ContractTransaction
let editCloseModalFunction: () => void let editCloseModalFunction: () => void

View File

@ -41,6 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let deceasedHTML = ''; let deceasedHTML = '';
for (const interment of contract.contractInterments ?? []) { for (const interment of contract.contractInterments ?? []) {
deceasedHTML += `<li class="has-tooltip-left"> deceasedHTML += `<li class="has-tooltip-left">
<span class="fa-li"><i class="fas fa-user"></i></span>
${cityssm.escapeHTML(interment.deceasedName ?? '')} ${cityssm.escapeHTML(interment.deceasedName ?? '')}
</li>`; </li>`;
} }
@ -103,7 +104,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>Deceased</th> <th>Recipient / Deceased</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>

View File

@ -74,6 +74,7 @@ declare const exports: Record<string, unknown>
for (const interment of contract.contractInterments ?? []) { for (const interment of contract.contractInterments ?? []) {
deceasedHTML += `<li class="has-tooltip-left"> deceasedHTML += `<li class="has-tooltip-left">
<span class="fa-li"><i class="fas fa-user"></i></span>
${cityssm.escapeHTML(interment.deceasedName ?? '')} ${cityssm.escapeHTML(interment.deceasedName ?? '')}
</li>` </li>`
} }
@ -167,7 +168,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>Deceased</th> <th>Recipient / Deceased</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>

View File

@ -1,9 +1,9 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
const los = exports.sunrise; const sunrise = exports.sunrise;
const workOrderNumberCircleElements = document.querySelectorAll('.fa-circle[data-work-order-number]'); const workOrderNumberCircleElements = document.querySelectorAll('.fa-circle[data-work-order-number]');
for (const workOrderNumberCircleElement of workOrderNumberCircleElements) { for (const workOrderNumberCircleElement of workOrderNumberCircleElements) {
workOrderNumberCircleElement.style.color = los.getRandomColor(workOrderNumberCircleElement.dataset.workOrderNumber ?? ''); workOrderNumberCircleElement.style.color = sunrise.getRandomColor(workOrderNumberCircleElement.dataset.workOrderNumber ?? '');
} }
})(); })();

View File

@ -1,14 +1,14 @@
import type { LOS } from '../../types/globalTypes.js' import type { Sunrise } from './types.js'
declare const exports: Record<string, unknown> declare const exports: Record<string, unknown>
;(() => { ;(() => {
const los = exports.sunrise as LOS const sunrise = exports.sunrise as Sunrise
const workOrderNumberCircleElements: NodeListOf<HTMLElement> = const workOrderNumberCircleElements: NodeListOf<HTMLElement> =
document.querySelectorAll('.fa-circle[data-work-order-number]') document.querySelectorAll('.fa-circle[data-work-order-number]')
for (const workOrderNumberCircleElement of workOrderNumberCircleElements) { for (const workOrderNumberCircleElement of workOrderNumberCircleElements) {
workOrderNumberCircleElement.style.color = los.getRandomColor( workOrderNumberCircleElement.style.color = sunrise.getRandomColor(
workOrderNumberCircleElement.dataset.workOrderNumber ?? '' workOrderNumberCircleElement.dataset.workOrderNumber ?? ''
) )
} }

View File

@ -184,10 +184,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
}); });
} }
function addBurialSite(lotId, callbackFunction) { function addBurialSite(burialSiteId, callbackFunction) {
cityssm.postJSON(`${los.urlPrefix}/workOrders/doAddWorkOrderBurialSite`, { cityssm.postJSON(`${los.urlPrefix}/workOrders/doAddWorkOrderBurialSite`, {
workOrderId, workOrderId,
lotId burialSiteId
}, (rawResponseJSON) => { }, (rawResponseJSON) => {
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
@ -229,8 +229,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
}); });
} }
function addBurialSiteFromLotOccupancy(clickEvent) { function addBurialSiteFromLotOccupancy(clickEvent) {
const lotId = clickEvent.currentTarget.dataset.lotId ?? ''; const burialSiteId = clickEvent.currentTarget.dataset.burialSiteId ?? '';
addBurialSite(lotId); addBurialSite(burialSiteId);
} }
function renderRelatedOccupancies() { function renderRelatedOccupancies() {
const occupanciesContainerElement = document.querySelector('#container--lotOccupancies'); const occupanciesContainerElement = document.querySelector('#container--lotOccupancies');
@ -263,8 +263,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
contract.contractId.toString(); contract.contractId.toString();
const isActive = !(contract.contractEndDate && const isActive = !(contract.contractEndDate &&
contract.contractEndDateString < currentDateString); contract.contractEndDateString < currentDateString);
const hasLotRecord = contract.lotId && const hasLotRecord = contract.burialSiteId &&
workOrderLots.some((lot) => contract.lotId === lot.lotId); workOrderLots.some((lot) => contract.burialSiteId === lot.burialSiteId);
// eslint-disable-next-line no-unsanitized/property // eslint-disable-next-line no-unsanitized/property
rowElement.innerHTML = `<td class="is-width-1 has-text-centered"> rowElement.innerHTML = `<td class="is-width-1 has-text-centered">
${isActive ${isActive
@ -276,14 +276,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
</a><br /> </a><br />
<span class="is-size-7">#${contract.contractId}</span> <span class="is-size-7">#${contract.contractId}</span>
</td>`; </td>`;
if (contract.lotId) { if (contract.burialSiteId) {
// eslint-disable-next-line no-unsanitized/method // eslint-disable-next-line no-unsanitized/method
rowElement.insertAdjacentHTML('beforeend', `<td> rowElement.insertAdjacentHTML('beforeend', `<td>
${cityssm.escapeHTML(contract.lotName ?? '')} ${cityssm.escapeHTML(contract.burialSiteName ?? '')}
${hasLotRecord ${hasLotRecord
? '' ? ''
: ` <button class="button is-small is-light is-success button--addBurialSite" : ` <button class="button is-small is-light is-success button--addBurialSite"
data-lot-id="${contract.lotId.toString()}" data-lot-id="${contract.burialSiteId.toString()}"
data-tooltip="Add ${los.escapedAliases.Lot}" data-tooltip="Add ${los.escapedAliases.Lot}"
aria-label="Add ${los.escapedAliases.Lot}" type="button"> aria-label="Add ${los.escapedAliases.Lot}" type="button">
<i class="fas fa-plus" aria-hidden="true"></i> <i class="fas fa-plus" aria-hidden="true"></i>
@ -333,8 +333,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
} }
function openEditLotStatus(clickEvent) { function openEditLotStatus(clickEvent) {
const lotId = Number.parseInt(clickEvent.currentTarget.closest('.container--lot').dataset.lotId ?? '', 10); const burialSiteId = Number.parseInt(clickEvent.currentTarget.closest('.container--lot').dataset.burialSiteId ?? '', 10);
const lot = workOrderLots.find((possibleLot) => possibleLot.lotId === lotId); const lot = workOrderLots.find((possibleLot) => possibleLot.burialSiteId === burialSiteId);
let editCloseModalFunction; let editCloseModalFunction;
function doUpdateBurialSiteStatus(submitEvent) { function doUpdateBurialSiteStatus(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
@ -357,8 +357,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.openHtmlModal('lot-editLotStatus', { cityssm.openHtmlModal('lot-editLotStatus', {
onshow(modalElement) { onshow(modalElement) {
los.populateAliases(modalElement); los.populateAliases(modalElement);
modalElement.querySelector('#lotStatusEdit--lotId').value = lotId.toString(); modalElement.querySelector('#lotStatusEdit--burialSiteId').value = burialSiteId.toString();
modalElement.querySelector('#lotStatusEdit--lotName').value = lot.lotName ?? ''; modalElement.querySelector('#lotStatusEdit--burialSiteName').value = lot.burialSiteName ?? '';
const lotStatusElement = modalElement.querySelector('#lotStatusEdit--burialSiteStatusId'); const lotStatusElement = modalElement.querySelector('#lotStatusEdit--burialSiteStatusId');
let lotStatusFound = false; let lotStatusFound = false;
for (const lotStatus of exports.lotStatuses) { for (const lotStatus of exports.lotStatuses) {
@ -397,11 +397,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
}); });
} }
function deleteLot(clickEvent) { function deleteLot(clickEvent) {
const lotId = clickEvent.currentTarget.closest('.container--lot').dataset.lotId; const burialSiteId = clickEvent.currentTarget.closest('.container--lot').dataset.burialSiteId;
function doDelete() { function doDelete() {
cityssm.postJSON(`${los.urlPrefix}/workOrders/doDeleteWorkOrderBurialSite`, { cityssm.postJSON(`${los.urlPrefix}/workOrders/doDeleteWorkOrderBurialSite`, {
workOrderId, workOrderId,
lotId burialSiteId
}, (rawResponseJSON) => { }, (rawResponseJSON) => {
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
@ -451,11 +451,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
for (const lot of workOrderLots) { for (const lot of workOrderLots) {
const rowElement = document.createElement('tr'); const rowElement = document.createElement('tr');
rowElement.className = 'container--lot'; rowElement.className = 'container--lot';
rowElement.dataset.lotId = lot.lotId.toString(); rowElement.dataset.burialSiteId = lot.burialSiteId.toString();
// eslint-disable-next-line no-unsanitized/property // eslint-disable-next-line no-unsanitized/property
rowElement.innerHTML = `<td> rowElement.innerHTML = `<td>
<a class="has-text-weight-bold" href="${los.getBurialSiteURL(lot.lotId)}"> <a class="has-text-weight-bold" href="${los.getBurialSiteURL(lot.burialSiteId)}">
${cityssm.escapeHTML(lot.lotName ?? '')} ${cityssm.escapeHTML(lot.burialSiteName ?? '')}
</a> </a>
</td><td> </td><td>
${cityssm.escapeHTML(lot.cemeteryName ?? '')} ${cityssm.escapeHTML(lot.cemeteryName ?? '')}
@ -541,8 +541,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
<td class="has-text-weight-bold"> <td class="has-text-weight-bold">
${cityssm.escapeHTML(contract.contractType ?? '')} ${cityssm.escapeHTML(contract.contractType ?? '')}
</td>`; </td>`;
if (contract.lotId) { if (contract.burialSiteId) {
rowElement.insertAdjacentHTML('beforeend', `<td>${cityssm.escapeHTML(contract.lotName ?? '')}</td>`); rowElement.insertAdjacentHTML('beforeend', `<td>${cityssm.escapeHTML(contract.burialSiteName ?? '')}</td>`);
} }
else { else {
// eslint-disable-next-line no-unsanitized/method // eslint-disable-next-line no-unsanitized/method
@ -590,7 +590,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const occupantNameElement = modalElement.querySelector('#contractSearch--occupantName'); const occupantNameElement = modalElement.querySelector('#contractSearch--occupantName');
occupantNameElement.addEventListener('change', doSearch); occupantNameElement.addEventListener('change', doSearch);
occupantNameElement.focus(); occupantNameElement.focus();
modalElement.querySelector('#contractSearch--lotName').addEventListener('change', doSearch); modalElement.querySelector('#contractSearch--burialSiteName').addEventListener('change', doSearch);
searchFormElement.addEventListener('submit', doSearch); searchFormElement.addEventListener('submit', doSearch);
}, },
onremoved() { onremoved() {
@ -601,8 +601,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
}); });
function doAddLot(clickEvent) { function doAddLot(clickEvent) {
const rowElement = clickEvent.currentTarget.closest('tr'); const rowElement = clickEvent.currentTarget.closest('tr');
const lotId = rowElement.dataset.lotId ?? ''; const burialSiteId = rowElement.dataset.burialSiteId ?? '';
addBurialSite(lotId, (success) => { addBurialSite(burialSiteId, (success) => {
if (success) { if (success) {
rowElement.remove(); rowElement.remove();
} }
@ -642,13 +642,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
for (const lot of responseJSON.lots) { for (const lot of responseJSON.lots) {
const rowElement = document.createElement('tr'); const rowElement = document.createElement('tr');
rowElement.className = 'container--lot'; rowElement.className = 'container--lot';
rowElement.dataset.lotId = lot.lotId.toString(); rowElement.dataset.burialSiteId = lot.burialSiteId.toString();
rowElement.innerHTML = `<td class="has-text-centered"> rowElement.innerHTML = `<td class="has-text-centered">
<button class="button is-small is-success button--addBurialSite" data-tooltip="Add" type="button" aria-label="Add"> <button class="button is-small is-success button--addBurialSite" data-tooltip="Add" type="button" aria-label="Add">
<i class="fas fa-plus" aria-hidden="true"></i> <i class="fas fa-plus" aria-hidden="true"></i>
</button> </button>
</td><td class="has-text-weight-bold"> </td><td class="has-text-weight-bold">
${cityssm.escapeHTML(lot.lotName ?? '')} ${cityssm.escapeHTML(lot.burialSiteName ?? '')}
</td><td> </td><td>
${cityssm.escapeHTML(lot.cemeteryName ?? '')} ${cityssm.escapeHTML(lot.cemeteryName ?? '')}
</td><td> </td><td>
@ -682,9 +682,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
}, },
onshown(modalElement) { onshown(modalElement) {
bulmaJS.toggleHtmlClipped(); bulmaJS.toggleHtmlClipped();
const lotNameElement = modalElement.querySelector('#lotSearch--lotName'); const burialSiteNameElement = modalElement.querySelector('#lotSearch--burialSiteName');
lotNameElement.addEventListener('change', doSearch); burialSiteNameElement.addEventListener('change', doSearch);
lotNameElement.focus(); burialSiteNameElement.focus();
modalElement modalElement
.querySelector('#lotSearch--burialSiteStatusId') .querySelector('#lotSearch--burialSiteStatusId')
?.addEventListener('change', doSearch); ?.addEventListener('change', doSearch);

View File

@ -271,14 +271,14 @@ declare const exports: Record<string, unknown>
} }
function addBurialSite( function addBurialSite(
lotId: number | string, burialSiteId: number | string,
callbackFunction?: (success: boolean) => void callbackFunction?: (success: boolean) => void
): void { ): void {
cityssm.postJSON( cityssm.postJSON(
`${los.urlPrefix}/workOrders/doAddWorkOrderBurialSite`, `${los.urlPrefix}/workOrders/doAddWorkOrderBurialSite`,
{ {
workOrderId, workOrderId,
lotId burialSiteId
}, },
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
@ -341,9 +341,9 @@ declare const exports: Record<string, unknown>
} }
function addBurialSiteFromLotOccupancy(clickEvent: Event): void { function addBurialSiteFromLotOccupancy(clickEvent: Event): void {
const lotId = const burialSiteId =
(clickEvent.currentTarget as HTMLElement).dataset.lotId ?? '' (clickEvent.currentTarget as HTMLElement).dataset.burialSiteId ?? ''
addBurialSite(lotId) addBurialSite(burialSiteId)
} }
function renderRelatedOccupancies(): void { function renderRelatedOccupancies(): void {
@ -394,8 +394,8 @@ declare const exports: Record<string, unknown>
) )
const hasLotRecord = const hasLotRecord =
contract.lotId && contract.burialSiteId &&
workOrderLots.some((lot) => contract.lotId === lot.lotId) workOrderLots.some((lot) => contract.burialSiteId === lot.burialSiteId)
// eslint-disable-next-line no-unsanitized/property // eslint-disable-next-line no-unsanitized/property
rowElement.innerHTML = `<td class="is-width-1 has-text-centered"> rowElement.innerHTML = `<td class="is-width-1 has-text-centered">
@ -411,17 +411,17 @@ declare const exports: Record<string, unknown>
<span class="is-size-7">#${contract.contractId}</span> <span class="is-size-7">#${contract.contractId}</span>
</td>` </td>`
if (contract.lotId) { if (contract.burialSiteId) {
// eslint-disable-next-line no-unsanitized/method // eslint-disable-next-line no-unsanitized/method
rowElement.insertAdjacentHTML( rowElement.insertAdjacentHTML(
'beforeend', 'beforeend',
`<td> `<td>
${cityssm.escapeHTML(contract.lotName ?? '')} ${cityssm.escapeHTML(contract.burialSiteName ?? '')}
${ ${
hasLotRecord hasLotRecord
? '' ? ''
: ` <button class="button is-small is-light is-success button--addBurialSite" : ` <button class="button is-small is-light is-success button--addBurialSite"
data-lot-id="${contract.lotId.toString()}" data-lot-id="${contract.burialSiteId.toString()}"
data-tooltip="Add ${los.escapedAliases.Lot}" data-tooltip="Add ${los.escapedAliases.Lot}"
aria-label="Add ${los.escapedAliases.Lot}" type="button"> aria-label="Add ${los.escapedAliases.Lot}" type="button">
<i class="fas fa-plus" aria-hidden="true"></i> <i class="fas fa-plus" aria-hidden="true"></i>
@ -491,17 +491,17 @@ declare const exports: Record<string, unknown>
} }
function openEditLotStatus(clickEvent: Event): void { function openEditLotStatus(clickEvent: Event): void {
const lotId = Number.parseInt( const burialSiteId = Number.parseInt(
( (
(clickEvent.currentTarget as HTMLElement).closest( (clickEvent.currentTarget as HTMLElement).closest(
'.container--lot' '.container--lot'
) as HTMLElement ) as HTMLElement
).dataset.lotId ?? '', ).dataset.burialSiteId ?? '',
10 10
) )
const lot = workOrderLots.find( const lot = workOrderLots.find(
(possibleLot) => possibleLot.lotId === lotId (possibleLot) => possibleLot.burialSiteId === burialSiteId
) as Lot ) as Lot
let editCloseModalFunction: () => void let editCloseModalFunction: () => void
@ -539,14 +539,14 @@ declare const exports: Record<string, unknown>
los.populateAliases(modalElement) los.populateAliases(modalElement)
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotStatusEdit--lotId' '#lotStatusEdit--burialSiteId'
) as HTMLInputElement ) as HTMLInputElement
).value = lotId.toString() ).value = burialSiteId.toString()
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotStatusEdit--lotName' '#lotStatusEdit--burialSiteName'
) as HTMLInputElement ) as HTMLInputElement
).value = lot.lotName ?? '' ).value = lot.burialSiteName ?? ''
const lotStatusElement = modalElement.querySelector( const lotStatusElement = modalElement.querySelector(
'#lotStatusEdit--burialSiteStatusId' '#lotStatusEdit--burialSiteStatusId'
@ -601,18 +601,18 @@ declare const exports: Record<string, unknown>
} }
function deleteLot(clickEvent: Event): void { function deleteLot(clickEvent: Event): void {
const lotId = ( const burialSiteId = (
(clickEvent.currentTarget as HTMLElement).closest( (clickEvent.currentTarget as HTMLElement).closest(
'.container--lot' '.container--lot'
) as HTMLElement ) as HTMLElement
).dataset.lotId ).dataset.burialSiteId
function doDelete(): void { function doDelete(): void {
cityssm.postJSON( cityssm.postJSON(
`${los.urlPrefix}/workOrders/doDeleteWorkOrderBurialSite`, `${los.urlPrefix}/workOrders/doDeleteWorkOrderBurialSite`,
{ {
workOrderId, workOrderId,
lotId burialSiteId
}, },
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
@ -682,12 +682,12 @@ declare const exports: Record<string, unknown>
const rowElement = document.createElement('tr') const rowElement = document.createElement('tr')
rowElement.className = 'container--lot' rowElement.className = 'container--lot'
rowElement.dataset.lotId = lot.lotId.toString() rowElement.dataset.burialSiteId = lot.burialSiteId.toString()
// eslint-disable-next-line no-unsanitized/property // eslint-disable-next-line no-unsanitized/property
rowElement.innerHTML = `<td> rowElement.innerHTML = `<td>
<a class="has-text-weight-bold" href="${los.getBurialSiteURL(lot.lotId)}"> <a class="has-text-weight-bold" href="${los.getBurialSiteURL(lot.burialSiteId)}">
${cityssm.escapeHTML(lot.lotName ?? '')} ${cityssm.escapeHTML(lot.burialSiteName ?? '')}
</a> </a>
</td><td> </td><td>
${cityssm.escapeHTML(lot.cemeteryName ?? '')} ${cityssm.escapeHTML(lot.cemeteryName ?? '')}
@ -800,10 +800,10 @@ declare const exports: Record<string, unknown>
${cityssm.escapeHTML(contract.contractType ?? '')} ${cityssm.escapeHTML(contract.contractType ?? '')}
</td>` </td>`
if (contract.lotId) { if (contract.burialSiteId) {
rowElement.insertAdjacentHTML( rowElement.insertAdjacentHTML(
'beforeend', 'beforeend',
`<td>${cityssm.escapeHTML(contract.lotName ?? '')}</td>` `<td>${cityssm.escapeHTML(contract.burialSiteName ?? '')}</td>`
) )
} else { } else {
// eslint-disable-next-line no-unsanitized/method // eslint-disable-next-line no-unsanitized/method
@ -899,7 +899,7 @@ declare const exports: Record<string, unknown>
occupantNameElement.focus() occupantNameElement.focus()
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#contractSearch--lotName' '#contractSearch--burialSiteName'
) as HTMLInputElement ) as HTMLInputElement
).addEventListener('change', doSearch) ).addEventListener('change', doSearch)
@ -921,9 +921,9 @@ declare const exports: Record<string, unknown>
'tr' 'tr'
) as HTMLTableRowElement ) as HTMLTableRowElement
const lotId = rowElement.dataset.lotId ?? '' const burialSiteId = rowElement.dataset.burialSiteId ?? ''
addBurialSite(lotId, (success) => { addBurialSite(burialSiteId, (success) => {
if (success) { if (success) {
rowElement.remove() rowElement.remove()
} }
@ -974,14 +974,14 @@ declare const exports: Record<string, unknown>
for (const lot of responseJSON.lots) { for (const lot of responseJSON.lots) {
const rowElement = document.createElement('tr') const rowElement = document.createElement('tr')
rowElement.className = 'container--lot' rowElement.className = 'container--lot'
rowElement.dataset.lotId = lot.lotId.toString() rowElement.dataset.burialSiteId = lot.burialSiteId.toString()
rowElement.innerHTML = `<td class="has-text-centered"> rowElement.innerHTML = `<td class="has-text-centered">
<button class="button is-small is-success button--addBurialSite" data-tooltip="Add" type="button" aria-label="Add"> <button class="button is-small is-success button--addBurialSite" data-tooltip="Add" type="button" aria-label="Add">
<i class="fas fa-plus" aria-hidden="true"></i> <i class="fas fa-plus" aria-hidden="true"></i>
</button> </button>
</td><td class="has-text-weight-bold"> </td><td class="has-text-weight-bold">
${cityssm.escapeHTML(lot.lotName ?? '')} ${cityssm.escapeHTML(lot.burialSiteName ?? '')}
</td><td> </td><td>
${cityssm.escapeHTML(lot.cemeteryName ?? '')} ${cityssm.escapeHTML(lot.cemeteryName ?? '')}
</td><td> </td><td>
@ -1035,12 +1035,12 @@ declare const exports: Record<string, unknown>
onshown(modalElement) { onshown(modalElement) {
bulmaJS.toggleHtmlClipped() bulmaJS.toggleHtmlClipped()
const lotNameElement = modalElement.querySelector( const burialSiteNameElement = modalElement.querySelector(
'#lotSearch--lotName' '#lotSearch--burialSiteName'
) as HTMLInputElement ) as HTMLInputElement
lotNameElement.addEventListener('change', doSearch) burialSiteNameElement.addEventListener('change', doSearch)
lotNameElement.focus() burialSiteNameElement.focus()
modalElement modalElement
.querySelector('#lotSearch--burialSiteStatusId') .querySelector('#lotSearch--burialSiteStatusId')

View File

@ -48,7 +48,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
<i class="fas fa-vector-square" <i class="fas fa-vector-square"
aria-label="${los.escapedAliases.Lot}"></i> aria-label="${los.escapedAliases.Lot}"></i>
</span> </span>
${cityssm.escapeHTML(lot.lotName ?? '')} ${cityssm.escapeHTML(lot.burialSiteName ?? '')}
</li>`; </li>`;
} }
for (const contract of milestone.workOrderContracts ?? []) { for (const contract of milestone.workOrderContracts ?? []) {

View File

@ -86,7 +86,7 @@ declare const exports: Record<string, unknown>
<i class="fas fa-vector-square" <i class="fas fa-vector-square"
aria-label="${los.escapedAliases.Lot}"></i> aria-label="${los.escapedAliases.Lot}"></i>
</span> </span>
${cityssm.escapeHTML(lot.lotName ?? '')} ${cityssm.escapeHTML(lot.burialSiteName ?? '')}
</li>` </li>`
} }

View File

@ -26,9 +26,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
<i class="fas fa-fw fa-vector-square" <i class="fas fa-fw fa-vector-square"
aria-label="${los.escapedAliases.Lot}"></i> aria-label="${los.escapedAliases.Lot}"></i>
</span> </span>
${cityssm.escapeHTML((lot.lotName ?? '') === '' ${cityssm.escapeHTML((lot.burialSiteName ?? '') === ''
? `(No ${los.escapedAliases.Lot} Name)` ? `(No ${los.escapedAliases.Lot} Name)`
: lot.lotName ?? '')} : lot.burialSiteName ?? '')}
</li>`; </li>`;
} }
for (const occupancy of workOrder.workOrderContracts ?? []) { for (const occupancy of workOrder.workOrderContracts ?? []) {

View File

@ -58,9 +58,9 @@ declare const exports: Record<string, unknown>
aria-label="${los.escapedAliases.Lot}"></i> aria-label="${los.escapedAliases.Lot}"></i>
</span> </span>
${cityssm.escapeHTML( ${cityssm.escapeHTML(
(lot.lotName ?? '') === '' (lot.burialSiteName ?? '') === ''
? `(No ${los.escapedAliases.Lot} Name)` ? `(No ${los.escapedAliases.Lot} Name)`
: lot.lotName ?? '' : lot.burialSiteName ?? ''
)} )}
</li>` </li>`
} }

View File

@ -9,8 +9,8 @@ import handler_doUpdateFuneralHome from '../handlers/funeralHomes-post/doUpdateF
import { updateGetHandler, updatePostHandler } from '../handlers/permissions.js'; import { updateGetHandler, updatePostHandler } from '../handlers/permissions.js';
export const router = Router(); export const router = Router();
router.get('/', handler_search); router.get('/', handler_search);
router.get('/:funeralHomeId', handler_view);
router.get('/new', updateGetHandler, handler_new); router.get('/new', updateGetHandler, handler_new);
router.get('/:funeralHomeId', handler_view);
router.post('/doCreateFuneralHome', updatePostHandler, handler_doCreateFuneralHome); router.post('/doCreateFuneralHome', updatePostHandler, handler_doCreateFuneralHome);
router.get('/:funeralHomeId/edit', updateGetHandler, handler_edit); router.get('/:funeralHomeId/edit', updateGetHandler, handler_edit);
router.post('/doUpdateFuneralHome', updatePostHandler, handler_doUpdateFuneralHome); router.post('/doUpdateFuneralHome', updatePostHandler, handler_doUpdateFuneralHome);

View File

@ -13,10 +13,10 @@ export const router = Router()
router.get('/', handler_search) router.get('/', handler_search)
router.get('/:funeralHomeId', handler_view)
router.get('/new', updateGetHandler, handler_new) router.get('/new', updateGetHandler, handler_new)
router.get('/:funeralHomeId', handler_view)
router.post( router.post(
'/doCreateFuneralHome', '/doCreateFuneralHome',
updatePostHandler, updatePostHandler,

View File

@ -159,7 +159,7 @@ async function importFromMasterCSV() {
let burialSiteId; let burialSiteId;
if (masterRow.CM_CEMETERY !== '00') { if (masterRow.CM_CEMETERY !== '00') {
burialSiteId = await addBurialSite({ burialSiteId = await addBurialSite({
lotName, burialSiteName,
burialSiteTypeId, burialSiteTypeId,
burialSiteStatusId: importIds.availableBurialSiteStatusId, burialSiteStatusId: importIds.availableBurialSiteStatusId,
cemeteryId: cemetery.cemeteryId, cemeteryId: cemetery.cemeteryId,
@ -199,7 +199,7 @@ async function importFromMasterCSV() {
} }
preneedcontractId = await addContract({ preneedcontractId = await addContract({
contractTypeId: importIds.preneedContractType.contractTypeId, contractTypeId: importIds.preneedContractType.contractTypeId,
lotId: burialSiteId ?? '', burialSiteId: burialSiteId ?? '',
contractStartDateString: preneedcontractStartDateString, contractStartDateString: preneedcontractStartDateString,
contractEndDateString, contractEndDateString,
contractTypeFieldIds: '' contractTypeFieldIds: ''
@ -268,7 +268,7 @@ async function importFromMasterCSV() {
: importIds.cremationContractType; : importIds.cremationContractType;
deceasedcontractId = await addContract({ deceasedcontractId = await addContract({
contractTypeId: contractType.contractTypeId, contractTypeId: contractType.contractTypeId,
lotId: burialSiteId ?? '', burialSiteId: burialSiteId ?? '',
contractStartDateString: deceasedcontractStartDateString, contractStartDateString: deceasedcontractStartDateString,
contractEndDateString: deceasedcontractEndDateString, contractEndDateString: deceasedcontractEndDateString,
contractTypeFieldIds: '' contractTypeFieldIds: ''
@ -443,7 +443,7 @@ async function importFromPrepaidCSV() {
const map = await getCemetery({ const map = await getCemetery({
cemetery cemetery
}); });
const lotName = importData.buildLotName({ const burialSiteName = importData.buildLotName({
cemetery, cemetery,
block: prepaidRow.CMPP_BLOCK, block: prepaidRow.CMPP_BLOCK,
range1: prepaidRow.CMPP_RANGE1, range1: prepaidRow.CMPP_RANGE1,
@ -454,32 +454,32 @@ async function importFromPrepaidCSV() {
grave2: prepaidRow.CMPP_GRAVE2, grave2: prepaidRow.CMPP_GRAVE2,
interment: prepaidRow.CMPP_INTERMENT interment: prepaidRow.CMPP_INTERMENT
}); });
lot = await getBurialSiteByLotName(lotName); lot = await getBurialSiteByLotName(burialSiteName);
if (!lot) { if (!lot) {
const burialSiteTypeId = importIds.getburialSiteTypeId({ const burialSiteTypeId = importIds.getburialSiteTypeId({
cemetery cemetery
}); });
const lotId = await addBurialSite({ const burialSiteId = await addBurialSite({
lotName, burialSiteName,
burialSiteTypeId, burialSiteTypeId,
burialSiteStatusId: importIds.reservedburialSiteStatusId, burialSiteStatusId: importIds.reservedburialSiteStatusId,
cemeteryId: map.cemeteryId ?? '', cemeteryId: map.cemeteryId ?? '',
mapKey: lotName.includes(',') ? lotName.split(',')[0] : lotName, mapKey: burialSiteName.includes(',') ? burialSiteName.split(',')[0] : burialSiteName,
burialSiteLatitude: '', burialSiteLatitude: '',
burialSiteLongitude: '' burialSiteLongitude: ''
}, user); }, user);
lot = await getBurialSite(lotId); lot = await getBurialSite(burialSiteId);
} }
} }
if (lot && if (lot &&
lot.burialSiteStatusId === importIds.availableburialSiteStatusId) { lot.burialSiteStatusId === importIds.availableburialSiteStatusId) {
await updateBurialSiteStatus(lot.lotId, importIds.reservedburialSiteStatusId, user); await updateBurialSiteStatus(lot.burialSiteId, importIds.reservedburialSiteStatusId, user);
} }
const contractStartDateString = formatDateString(prepaidRow.CMPP_PURCH_YR, prepaidRow.CMPP_PURCH_MON, prepaidRow.CMPP_PURCH_DAY); const contractStartDateString = formatDateString(prepaidRow.CMPP_PURCH_YR, prepaidRow.CMPP_PURCH_MON, prepaidRow.CMPP_PURCH_DAY);
let contractId; let contractId;
if (lot) { if (lot) {
const possibleLotOccupancies = await getContracts({ const possibleLotOccupancies = await getContracts({
lotId: lot.lotId, burialSiteId: lot.burialSiteId,
contractTypeId: importIds.preneedContractType.contractTypeId, contractTypeId: importIds.preneedContractType.contractTypeId,
occupantName: prepaidRow.CMPP_PREPAID_FOR_NAME, occupantName: prepaidRow.CMPP_PREPAID_FOR_NAME,
contractStartDateString contractStartDateString
@ -496,7 +496,7 @@ async function importFromPrepaidCSV() {
} }
} }
contractId ||= await addContract({ contractId ||= await addContract({
lotId: lot ? lot.lotId : '', burialSiteId: lot ? lot.burialSiteId : '',
contractTypeId: importIds.preneedContractType.contractTypeId, contractTypeId: importIds.preneedContractType.contractTypeId,
contractStartDateString, contractStartDateString,
contractEndDateString: '' contractEndDateString: ''
@ -691,7 +691,7 @@ async function importFromWorkOrderCSV() {
} }
let lot; let lot;
if (workOrderRow.WO_CEMETERY !== '00') { if (workOrderRow.WO_CEMETERY !== '00') {
const lotName = importData.buildLotName({ const burialSiteName = importData.buildLotName({
cemetery: workOrderRow.WO_CEMETERY, cemetery: workOrderRow.WO_CEMETERY,
block: workOrderRow.WO_BLOCK, block: workOrderRow.WO_BLOCK,
range1: workOrderRow.WO_RANGE1, range1: workOrderRow.WO_RANGE1,
@ -702,31 +702,31 @@ async function importFromWorkOrderCSV() {
grave2: workOrderRow.WO_GRAVE2, grave2: workOrderRow.WO_GRAVE2,
interment: workOrderRow.WO_INTERMENT interment: workOrderRow.WO_INTERMENT
}); });
lot = await getBurialSiteByLotName(lotName); lot = await getBurialSiteByLotName(burialSiteName);
if (lot) { if (lot) {
await updateBurialSiteStatus(lot.lotId, importIds.takenburialSiteStatusId, user); await updateBurialSiteStatus(lot.burialSiteId, importIds.takenburialSiteStatusId, user);
} }
else { else {
const map = await getCemetery({ cemetery: workOrderRow.WO_CEMETERY }); const map = await getCemetery({ cemetery: workOrderRow.WO_CEMETERY });
const burialSiteTypeId = importIds.getburialSiteTypeId({ const burialSiteTypeId = importIds.getburialSiteTypeId({
cemetery: workOrderRow.WO_CEMETERY cemetery: workOrderRow.WO_CEMETERY
}); });
const lotId = await addBurialSite({ const burialSiteId = await addBurialSite({
cemeteryId: map.cemeteryId, cemeteryId: map.cemeteryId,
lotName, burialSiteName,
mapKey: lotName.includes(',') ? lotName.split(',')[0] : lotName, mapKey: burialSiteName.includes(',') ? burialSiteName.split(',')[0] : burialSiteName,
burialSiteStatusId: importIds.takenburialSiteStatusId, burialSiteStatusId: importIds.takenburialSiteStatusId,
burialSiteTypeId, burialSiteTypeId,
burialSiteLatitude: '', burialSiteLatitude: '',
burialSiteLongitude: '' burialSiteLongitude: ''
}, user); }, user);
lot = await getBurialSite(lotId); lot = await getBurialSite(burialSiteId);
} }
const workOrderContainsLot = workOrder.workOrderLots.find((possibleLot) => (possibleLot.lotId = lot.lotId)); const workOrderContainsLot = workOrder.workOrderLots.find((possibleLot) => (possibleLot.burialSiteId = lot.burialSiteId));
if (!workOrderContainsLot) { if (!workOrderContainsLot) {
await addWorkOrderBurialSite({ await addWorkOrderBurialSite({
workOrderId: workOrder.workOrderId, workOrderId: workOrder.workOrderId,
lotId: lot.lotId burialSiteId: lot.burialSiteId
}, user); }, user);
workOrder.workOrderLots.push(lot); workOrder.workOrderLots.push(lot);
} }
@ -739,7 +739,7 @@ async function importFromWorkOrderCSV() {
? importIds.deceasedContractType ? importIds.deceasedContractType
: importIds.cremationContractType; : importIds.cremationContractType;
const contractId = await addContract({ const contractId = await addContract({
lotId: lot ? lot.lotId : '', burialSiteId: lot ? lot.burialSiteId : '',
contractTypeId: contractType.contractTypeId, contractTypeId: contractType.contractTypeId,
contractStartDateString, contractStartDateString,
contractEndDateString: '' contractEndDateString: ''

View File

@ -367,7 +367,7 @@ async function importFromMasterCSV(): Promise<void> {
if (masterRow.CM_CEMETERY !== '00') { if (masterRow.CM_CEMETERY !== '00') {
burialSiteId = await addBurialSite( burialSiteId = await addBurialSite(
{ {
lotName, burialSiteName,
burialSiteTypeId, burialSiteTypeId,
burialSiteStatusId: importIds.availableBurialSiteStatusId, burialSiteStatusId: importIds.availableBurialSiteStatusId,
cemeteryId: cemetery.cemeteryId!, cemeteryId: cemetery.cemeteryId!,
@ -441,7 +441,7 @@ async function importFromMasterCSV(): Promise<void> {
preneedcontractId = await addContract( preneedcontractId = await addContract(
{ {
contractTypeId: importIds.preneedContractType.contractTypeId, contractTypeId: importIds.preneedContractType.contractTypeId,
lotId: burialSiteId ?? '', burialSiteId: burialSiteId ?? '',
contractStartDateString: preneedcontractStartDateString, contractStartDateString: preneedcontractStartDateString,
contractEndDateString, contractEndDateString,
contractTypeFieldIds: '' contractTypeFieldIds: ''
@ -558,7 +558,7 @@ async function importFromMasterCSV(): Promise<void> {
deceasedcontractId = await addContract( deceasedcontractId = await addContract(
{ {
contractTypeId: contractType.contractTypeId, contractTypeId: contractType.contractTypeId,
lotId: burialSiteId ?? '', burialSiteId: burialSiteId ?? '',
contractStartDateString: deceasedcontractStartDateString, contractStartDateString: deceasedcontractStartDateString,
contractEndDateString: deceasedcontractEndDateString, contractEndDateString: deceasedcontractEndDateString,
contractTypeFieldIds: '' contractTypeFieldIds: ''
@ -842,7 +842,7 @@ async function importFromPrepaidCSV(): Promise<void> {
cemetery cemetery
}) })
const lotName = importData.buildLotName({ const burialSiteName = importData.buildLotName({
cemetery, cemetery,
block: prepaidRow.CMPP_BLOCK, block: prepaidRow.CMPP_BLOCK,
range1: prepaidRow.CMPP_RANGE1, range1: prepaidRow.CMPP_RANGE1,
@ -854,27 +854,27 @@ async function importFromPrepaidCSV(): Promise<void> {
interment: prepaidRow.CMPP_INTERMENT interment: prepaidRow.CMPP_INTERMENT
}) })
lot = await getBurialSiteByLotName(lotName) lot = await getBurialSiteByLotName(burialSiteName)
if (!lot) { if (!lot) {
const burialSiteTypeId = importIds.getburialSiteTypeId({ const burialSiteTypeId = importIds.getburialSiteTypeId({
cemetery cemetery
}) })
const lotId = await addBurialSite( const burialSiteId = await addBurialSite(
{ {
lotName, burialSiteName,
burialSiteTypeId, burialSiteTypeId,
burialSiteStatusId: importIds.reservedburialSiteStatusId, burialSiteStatusId: importIds.reservedburialSiteStatusId,
cemeteryId: map.cemeteryId ?? '', cemeteryId: map.cemeteryId ?? '',
mapKey: lotName.includes(',') ? lotName.split(',')[0] : lotName, mapKey: burialSiteName.includes(',') ? burialSiteName.split(',')[0] : burialSiteName,
burialSiteLatitude: '', burialSiteLatitude: '',
burialSiteLongitude: '' burialSiteLongitude: ''
}, },
user user
) )
lot = await getBurialSite(lotId) lot = await getBurialSite(burialSiteId)
} }
} }
@ -883,7 +883,7 @@ async function importFromPrepaidCSV(): Promise<void> {
lot.burialSiteStatusId === importIds.availableburialSiteStatusId lot.burialSiteStatusId === importIds.availableburialSiteStatusId
) { ) {
await updateBurialSiteStatus( await updateBurialSiteStatus(
lot.lotId, lot.burialSiteId,
importIds.reservedburialSiteStatusId, importIds.reservedburialSiteStatusId,
user user
) )
@ -900,7 +900,7 @@ async function importFromPrepaidCSV(): Promise<void> {
if (lot) { if (lot) {
const possibleLotOccupancies = await getContracts( const possibleLotOccupancies = await getContracts(
{ {
lotId: lot.lotId, burialSiteId: lot.burialSiteId,
contractTypeId: importIds.preneedContractType.contractTypeId, contractTypeId: importIds.preneedContractType.contractTypeId,
occupantName: prepaidRow.CMPP_PREPAID_FOR_NAME, occupantName: prepaidRow.CMPP_PREPAID_FOR_NAME,
contractStartDateString contractStartDateString
@ -922,7 +922,7 @@ async function importFromPrepaidCSV(): Promise<void> {
contractId ||= await addContract( contractId ||= await addContract(
{ {
lotId: lot ? lot.lotId : '', burialSiteId: lot ? lot.burialSiteId : '',
contractTypeId: importIds.preneedContractType.contractTypeId, contractTypeId: importIds.preneedContractType.contractTypeId,
contractStartDateString, contractStartDateString,
contractEndDateString: '' contractEndDateString: ''
@ -1197,7 +1197,7 @@ async function importFromWorkOrderCSV(): Promise<void> {
let lot: recordTypes.Lot let lot: recordTypes.Lot
if (workOrderRow.WO_CEMETERY !== '00') { if (workOrderRow.WO_CEMETERY !== '00') {
const lotName = importData.buildLotName({ const burialSiteName = importData.buildLotName({
cemetery: workOrderRow.WO_CEMETERY, cemetery: workOrderRow.WO_CEMETERY,
block: workOrderRow.WO_BLOCK, block: workOrderRow.WO_BLOCK,
range1: workOrderRow.WO_RANGE1, range1: workOrderRow.WO_RANGE1,
@ -1209,11 +1209,11 @@ async function importFromWorkOrderCSV(): Promise<void> {
interment: workOrderRow.WO_INTERMENT interment: workOrderRow.WO_INTERMENT
}) })
lot = await getBurialSiteByLotName(lotName) lot = await getBurialSiteByLotName(burialSiteName)
if (lot) { if (lot) {
await updateBurialSiteStatus( await updateBurialSiteStatus(
lot.lotId, lot.burialSiteId,
importIds.takenburialSiteStatusId, importIds.takenburialSiteStatusId,
user user
) )
@ -1224,11 +1224,11 @@ async function importFromWorkOrderCSV(): Promise<void> {
cemetery: workOrderRow.WO_CEMETERY cemetery: workOrderRow.WO_CEMETERY
}) })
const lotId = await addBurialSite( const burialSiteId = await addBurialSite(
{ {
cemeteryId: map.cemeteryId!, cemeteryId: map.cemeteryId!,
lotName, burialSiteName,
mapKey: lotName.includes(',') ? lotName.split(',')[0] : lotName, mapKey: burialSiteName.includes(',') ? burialSiteName.split(',')[0] : burialSiteName,
burialSiteStatusId: importIds.takenburialSiteStatusId, burialSiteStatusId: importIds.takenburialSiteStatusId,
burialSiteTypeId, burialSiteTypeId,
burialSiteLatitude: '', burialSiteLatitude: '',
@ -1237,18 +1237,18 @@ async function importFromWorkOrderCSV(): Promise<void> {
user user
) )
lot = await getBurialSite(lotId) lot = await getBurialSite(burialSiteId)
} }
const workOrderContainsLot = workOrder.workOrderLots!.find( const workOrderContainsLot = workOrder.workOrderLots!.find(
(possibleLot) => (possibleLot.lotId = lot.lotId) (possibleLot) => (possibleLot.burialSiteId = lot.burialSiteId)
) )
if (!workOrderContainsLot) { if (!workOrderContainsLot) {
await addWorkOrderBurialSite( await addWorkOrderBurialSite(
{ {
workOrderId: workOrder.workOrderId!, workOrderId: workOrder.workOrderId!,
lotId: lot.lotId burialSiteId: lot.burialSiteId
}, },
user user
) )
@ -1273,7 +1273,7 @@ async function importFromWorkOrderCSV(): Promise<void> {
const contractId = await addContract( const contractId = await addContract(
{ {
lotId: lot ? lot.lotId : '', burialSiteId: lot ? lot.burialSiteId : '',
contractTypeId: contractType.contractTypeId, contractTypeId: contractType.contractTypeId,
contractStartDateString, contractStartDateString,
contractEndDateString: '' contractEndDateString: ''

View File

@ -117,19 +117,19 @@ describe('functions.sqlFilters', () => {
describe('LotName filter', () => { describe('LotName filter', () => {
it('returns startsWith filter', () => { it('returns startsWith filter', () => {
const filter = sqlFilterFunctions.getBurialSiteNameWhereClause('TEST1 TEST2', 'startsWith', 'l'); const filter = sqlFilterFunctions.getBurialSiteNameWhereClause('TEST1 TEST2', 'startsWith', 'l');
assert.strictEqual(filter.sqlWhereClause, " and l.lotName like ? || '%'"); assert.strictEqual(filter.sqlWhereClause, " and l.burialSiteName like ? || '%'");
assert.strictEqual(filter.sqlParameters.length, 1); assert.strictEqual(filter.sqlParameters.length, 1);
assert.ok(filter.sqlParameters.includes('TEST1 TEST2')); assert.ok(filter.sqlParameters.includes('TEST1 TEST2'));
}); });
it('returns endsWith filter', () => { it('returns endsWith filter', () => {
const filter = sqlFilterFunctions.getBurialSiteNameWhereClause('TEST1 TEST2', 'endsWith', 'l'); const filter = sqlFilterFunctions.getBurialSiteNameWhereClause('TEST1 TEST2', 'endsWith', 'l');
assert.strictEqual(filter.sqlWhereClause, " and l.lotName like '%' || ?"); assert.strictEqual(filter.sqlWhereClause, " and l.burialSiteName like '%' || ?");
assert.strictEqual(filter.sqlParameters.length, 1); assert.strictEqual(filter.sqlParameters.length, 1);
assert.strictEqual(filter.sqlParameters[0], 'TEST1 TEST2'); assert.strictEqual(filter.sqlParameters[0], 'TEST1 TEST2');
}); });
it('returns contains filter', () => { it('returns contains filter', () => {
const filter = sqlFilterFunctions.getBurialSiteNameWhereClause('TEST1 TEST2', '', 'l'); const filter = sqlFilterFunctions.getBurialSiteNameWhereClause('TEST1 TEST2', '', 'l');
assert.strictEqual(filter.sqlWhereClause, ' and instr(lower(l.lotName), ?) and instr(lower(l.lotName), ?)'); assert.strictEqual(filter.sqlWhereClause, ' and instr(lower(l.burialSiteName), ?) and instr(lower(l.burialSiteName), ?)');
assert.ok(filter.sqlParameters.includes('test1')); assert.ok(filter.sqlParameters.includes('test1'));
assert.ok(filter.sqlParameters.includes('test2')); assert.ok(filter.sqlParameters.includes('test2'));
}); });

View File

@ -188,7 +188,7 @@ describe('functions.sqlFilters', () => {
'l' 'l'
) )
assert.strictEqual(filter.sqlWhereClause, " and l.lotName like ? || '%'") assert.strictEqual(filter.sqlWhereClause, " and l.burialSiteName like ? || '%'")
assert.strictEqual(filter.sqlParameters.length, 1) assert.strictEqual(filter.sqlParameters.length, 1)
assert.ok(filter.sqlParameters.includes('TEST1 TEST2')) assert.ok(filter.sqlParameters.includes('TEST1 TEST2'))
}) })
@ -200,7 +200,7 @@ describe('functions.sqlFilters', () => {
'l' 'l'
) )
assert.strictEqual(filter.sqlWhereClause, " and l.lotName like '%' || ?") assert.strictEqual(filter.sqlWhereClause, " and l.burialSiteName like '%' || ?")
assert.strictEqual(filter.sqlParameters.length, 1) assert.strictEqual(filter.sqlParameters.length, 1)
assert.strictEqual(filter.sqlParameters[0], 'TEST1 TEST2') assert.strictEqual(filter.sqlParameters[0], 'TEST1 TEST2')
}) })
@ -213,7 +213,7 @@ describe('functions.sqlFilters', () => {
) )
assert.strictEqual( assert.strictEqual(
filter.sqlWhereClause, filter.sqlWhereClause,
' and instr(lower(l.lotName), ?) and instr(lower(l.lotName), ?)' ' and instr(lower(l.burialSiteName), ?) and instr(lower(l.burialSiteName), ?)'
) )
assert.ok(filter.sqlParameters.includes('test1')) assert.ok(filter.sqlParameters.includes('test1'))

View File

@ -172,18 +172,18 @@ export interface DynamicsGPDocument {
export interface IntermentContainerType extends Record { export interface IntermentContainerType extends Record {
intermentContainerTypeId: number; intermentContainerTypeId: number;
intermentContainerType: string; intermentContainerType: string;
isCremationType: boolean;
orderNumber?: number; orderNumber?: number;
} }
export interface IntermentCommittalType extends Record { export interface CommittalType extends Record {
intermentCommittalTypeId: number; committalTypeId: number;
intermentCommittalType: string; committalType: string;
orderNumber?: number; orderNumber?: number;
} }
export interface ContractInterment extends Record { export interface ContractInterment extends Record {
contractId?: number; contractId?: number;
intermentNumber?: number; intermentNumber?: number;
deceasedName?: string; deceasedName?: string;
isCremated?: boolean;
deceasedAddress1?: string; deceasedAddress1?: string;
deceasedAddress2?: string; deceasedAddress2?: string;
deceasedCity?: string; deceasedCity?: string;
@ -195,12 +195,9 @@ export interface ContractInterment extends Record {
deathDate?: number; deathDate?: number;
deathDateString?: string; deathDateString?: string;
deathPlace?: string; deathPlace?: string;
intermentDate?: number;
intermentDateString?: string;
intermentContainerTypeId?: number; intermentContainerTypeId?: number;
intermentContainerType?: string; intermentContainerType?: string;
intermentCommittalTypeId?: number; isCremationType?: boolean;
intermentCommittalType?: string;
contractIdCount?: number; contractIdCount?: number;
recordUpdate_timeMillisMax?: number; recordUpdate_timeMillisMax?: number;
} }
@ -247,6 +244,12 @@ export interface Contract extends Record {
funeralHomeId?: number; funeralHomeId?: number;
funeralHomeName?: string; funeralHomeName?: string;
funeralDirectorName?: string; funeralDirectorName?: string;
funeralDate?: number;
funeralDateString?: string;
funeralTime?: number;
funeralTimeString?: string;
committalTypeId?: number;
committalType?: string;
contractFields?: ContractField[]; contractFields?: ContractField[];
contractComments?: ContractComment[]; contractComments?: ContractComment[];
contractInterments?: ContractInterment[]; contractInterments?: ContractInterment[];

View File

@ -222,12 +222,13 @@ export interface DynamicsGPDocument {
export interface IntermentContainerType extends Record { export interface IntermentContainerType extends Record {
intermentContainerTypeId: number intermentContainerTypeId: number
intermentContainerType: string intermentContainerType: string
isCremationType: boolean
orderNumber?: number orderNumber?: number
} }
export interface IntermentCommittalType extends Record { export interface CommittalType extends Record {
intermentCommittalTypeId: number committalTypeId: number
intermentCommittalType: string committalType: string
orderNumber?: number orderNumber?: number
} }
@ -236,8 +237,6 @@ export interface ContractInterment extends Record {
intermentNumber?: number intermentNumber?: number
deceasedName?: string deceasedName?: string
isCremated?: boolean
deceasedAddress1?: string deceasedAddress1?: string
deceasedAddress2?: string deceasedAddress2?: string
deceasedCity?: string deceasedCity?: string
@ -252,14 +251,9 @@ export interface ContractInterment extends Record {
deathDateString?: string deathDateString?: string
deathPlace?: string deathPlace?: string
intermentDate?: number
intermentDateString?: string
intermentContainerTypeId?: number intermentContainerTypeId?: number
intermentContainerType?: string intermentContainerType?: string
isCremationType?: boolean
intermentCommittalTypeId?: number
intermentCommittalType?: string
contractIdCount?: number contractIdCount?: number
recordUpdate_timeMillisMax?: number recordUpdate_timeMillisMax?: number
@ -322,6 +316,13 @@ export interface Contract extends Record {
funeralHomeName?: string funeralHomeName?: string
funeralDirectorName?: string funeralDirectorName?: string
funeralDate?: number
funeralDateString?: string
funeralTime?: number
funeralTimeString?: string
committalTypeId?: number
committalType?: string
contractFields?: ContractField[] contractFields?: ContractField[]
contractComments?: ContractComment[] contractComments?: ContractComment[]
contractInterments?: ContractInterment[] contractInterments?: ContractInterment[]

View File

@ -322,7 +322,7 @@
</div> </div>
<div class="panel"> <div class="panel">
<h2 class="panel-heading">Funeral Home</h2> <h2 class="panel-heading">Funeral</h2>
<div class="panel-block is-block"> <div class="panel-block is-block">
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
@ -334,18 +334,27 @@
<div class="select is-fullwidth"> <div class="select is-fullwidth">
<select id="contract--funeralHomeId" name="funeralHomeId"> <select id="contract--funeralHomeId" name="funeralHomeId">
<option value="">(No Funeral Home)</option> <option value="">(No Funeral Home)</option>
<% let funeralHomeIsFound = false; %>
<% for (const funeralHome of funeralHomes) { %> <% for (const funeralHome of funeralHomes) { %>
<%
if (contract.funeralHomeId === funeralHome.funeralHomeId) {
funeralHomeIsFound = true;
}
%>
<option value="<%= funeralHome.funeralHomeId %>" <option value="<%= funeralHome.funeralHomeId %>"
<%= (contract.funeralHomeId === funeralHome.funeralHomeId ? " selected" : "") %>> <%= (contract.funeralHomeId === funeralHome.funeralHomeId ? " selected" : "") %>>
<%= funeralHome.funeralHomeName %> <%= funeralHome.funeralHomeName %>
</option> </option>
<% } %> <% } %>
<% if (contract.funeralHomeId && !funeralHomeIsFound) { %>
<option value="<%= contract.funeralHomeId %>" selected>
<%= contract.funeralHomeName %>
</option>
<% } %>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="column">
<div class="field"> <div class="field">
<label class="label" for="contract--funeralDirectorName"> <label class="label" for="contract--funeralDirectorName">
Funeral Director's Name Funeral Director's Name
@ -355,6 +364,60 @@
</div> </div>
</div> </div>
</div> </div>
<div class="column">
<div class="columns is-mobile mb-0">
<div class="column">
<div class="field">
<label class="label" for="contract--funeralDateString">Funeral Date</label>
<div class="control has-icons-left">
<input class="input" id="contract--funeralDateString" name="funeralDateString" type="date"
value="<%= contract.funeralDateString %>" />
<span class="icon is-left">
<i class="fas fa-calendar" aria-hidden="true"></i>
</span>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label" for="contract--funeralTimeString">Time</label>
<div class="control has-icons-left">
<input class="input" id="contract--funeralTimeString" name="funeralTimeString" type="time" value="<%= contract.funeralTimeString %>" />
<span class="icon is-left">
<i class="fas fa-clock" aria-hidden="true"></i>
</span>
</div>
</div>
</div>
</div>
<div class="field">
<label class="label" for="contract--committalTypeId">Committal Type</label>
<div class="control">
<div class="select is-fullwidth">
<select id="contract--committalTypeId" name="committalTypeId">
<option value="">(No Type)</option>
<% let committalTypeIsFound = false; %>
<% for (const committalType of committalTypes) { %>
<%
if (contract.committalTypeId === committalType.committalTypeId) {
committalTypeIsFound = true;
}
%>
<option value="<%= committalType.committalTypeId %>"
<%= (contract.committalTypeId === committalType.committalTypeId ? " selected" : "") %>>
<%= committalType.committalType %>
</option>
<% } %>
<% if (contract.committalTypeId && !committalTypeIsFound) { %>
<option value="<%= contract.committalTypeId %>" selected>
<%= contract.committalType %>
</option>
<% } %>
</select>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -429,7 +492,10 @@
</div> </div>
<div class="field"> <div class="field">
<label class="label" for="contract--purchaserRelationship"> <label class="label" for="contract--purchaserRelationship">
Relationship to Deceased Relationship to
<span class="is-recipient-or-deceased">
<%= (contract.isPreneed ? "Recipient" : "Deceased") %>
</span>
</label> </label>
<div class="control"> <div class="control">
<input class="input" id="contract--purchaserRelationship" name="purchaserRelationship" type="text" maxlength="100" autocomplete="off" value="<%= contract.purchaserRelationship %>" /> <input class="input" id="contract--purchaserRelationship" name="purchaserRelationship" type="text" maxlength="100" autocomplete="off" value="<%= contract.purchaserRelationship %>" />
@ -557,6 +623,41 @@
</div> </div>
</div> </div>
</div> </div>
<div class="field">
<label class="label" for="contract--intermentContainerTypeId">Container</label>
<div class="select is-fullwidth">
<select id="contract--intermentContainerTypeId" name="intermentContainerTypeId">
<option value="">(No Container)</option>
<optgroup label="Non-Cremated">
<%
let containerIsFound = false;
let isCremationType = false;
%>
<% for (const container of intermentContainerTypes) { %>
<% if (container.isCremationType && !isCremationType) { %>
</optgroup>
<optgroup label="Cremated">
<% isCremationType = true; %>
<% } %>
<%
if (contract.intermentContainerTypeId === container.intermentContainerTypeId) {
containerIsFound = true;
}
%>
<option value="<%= container.intermentContainerTypeId %>">
<%= (contract.intermentContainerTypeId === container.intermentContainerTypeId ? " selected" : "") %>
<%= container.intermentContainerType %>
</option>
<% } %>
</optgroup>
<% if (contract.intermentContainerTypeId && !containerIsFound) { %>
<option value="<%= contract.intermentContainerTypeId %>" selected>
<%= contract.intermentContainerType %>
</option>
<% } %>
</select>
</div>
</div>
<div class="message is-info is-small"> <div class="message is-info is-small">
<p class="message-body"> <p class="message-body">
Any additional interments associated with this contract can be added after the contract is created. Any additional interments associated with this contract can be added after the contract is created.
@ -585,9 +686,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="panel-block is-block"> <div class="panel-block is-block" id="container--contractInterments"></div>
</div>
</div> </div>
<% } %> <% } %>
</div> </div>
@ -748,7 +847,7 @@
exports.workOrderTypes = <%- JSON.stringify(workOrderTypes) %>; exports.workOrderTypes = <%- JSON.stringify(workOrderTypes) %>;
<% } %> <% } %>
</script> </script>
<script src="<%= urlPrefix %>/javascripts/contract.edit.js"></script> <script src="<%= urlPrefix %>/javascripts/contract.edit.js"></script>

View File

@ -4,40 +4,40 @@
<ul> <ul>
<li><a href="<%= urlPrefix %>/dashboard">Home</a></li> <li><a href="<%= urlPrefix %>/dashboard">Home</a></li>
<li> <li>
<a href="<%= urlPrefix %>/lotOccupancies"> <a href="<%= urlPrefix %>/contracts">
<span class="icon is-small"> <span class="icon is-small">
<span class="fa-layers fa-fw" aria-hidden="true"> <span class="fa-layers fa-fw" aria-hidden="true">
<i class="fas fa-vector-square"></i> <i class="fas fa-vector-square"></i>
<i class="fas fa-user" data-fa-transform="shrink-10"></i> <i class="fas fa-user" data-fa-transform="shrink-10"></i>
</span> </span>
</span> </span>
<span><%= configFunctions.getConfigProperty("aliases.occupancies") %></span> <span>Contracts</span>
</a> </a>
</li> </li>
<li class="is-active"> <li class="is-active">
<a href="#" aria-current="page"> <a href="#" aria-current="page">
<%= configFunctions.getConfigProperty("aliases.occupancy") %> #<%= contract.contractId %>: <%= contract.lotName || ("(No " + configFunctions.getConfigProperty("aliases.lot") + ")") %> Contract #<%= contract.contractId %>: <%= contract.burialSiteName ?? "(No Burial Site)" %>
</a> </a>
</li> </li>
</ul> </ul>
</nav> </nav>
<h1 class="title is-1"> <h1 class="title is-1">
<%= configFunctions.getConfigProperty("aliases.occupancy") %> Contract
#<%= contract.contractId %>: #<%= contract.contractId %>:
<%= contract.lotName || ("(No " + configFunctions.getConfigProperty("aliases.lot") + ")") %> <%= contract.burialSiteName || "(No Burial Site)" %>
</h1> </h1>
<div class="level is-fixed-bottom is-mobile has-background-white has-shadow is-hidden-print"> <div class="level is-fixed-bottom is-mobile has-background-white has-shadow is-hidden-print">
<div class="level-left"> <div class="level-left">
<span class="level-item has-text-weight-bold"> <span class="level-item has-text-weight-bold">
<%= configFunctions.getConfigProperty("aliases.occupancy") %> #<%= contract.contractId %>: Contract #<%= contract.contractId %>:
<%= contract.lotName || ("(No " + configFunctions.getConfigProperty("aliases.lot") + ")") %> <%= contract.burialSiteName ?? "(No Burial Site)" %>
</span> </span>
</div> </div>
<div class="level-right"> <div class="level-right">
<% if (ContractTypePrints.length > 0) { %> <% if (contractTypePrints.length > 0) { %>
<% if (ContractTypePrints.length === 1) { %> <% if (contractTypePrints.length === 1) { %>
<div class="level-item"> <div class="level-item">
<a href="<%= urlPrefix %>/print/<%= ContractTypePrints[0] %>/?contractId=<%= contract.contractId %>" target="_blank" aria-label="Print"> <a href="<%= urlPrefix %>/print/<%= ContractTypePrints[0] %>/?contractId=<%= contract.contractId %>" target="_blank" aria-label="Print">
<span class="icon"><i class="fas fa-print" aria-hidden="true"></i></span> <span class="icon"><i class="fas fa-print" aria-hidden="true"></i></span>
@ -56,7 +56,7 @@
</div> </div>
<div class="dropdown-menu"> <div class="dropdown-menu">
<div class="dropdown-content"> <div class="dropdown-content">
<% for (const printName of ContractTypePrints) { %> <% for (const printName of contractTypePrints) { %>
<% const printConfig = printFunctions.getPrintConfig(printName); %> <% const printConfig = printFunctions.getPrintConfig(printName); %>
<% if (printConfig) { %> <% if (printConfig) { %>
<a class="dropdown-item" href="<%= urlPrefix %>/print/<%= printName %>/?contractId=<%= contract.contractId %>" target="_blank"> <a class="dropdown-item" href="<%= urlPrefix %>/print/<%= printName %>/?contractId=<%= contract.contractId %>" target="_blank">
@ -73,8 +73,8 @@
<% } %> <% } %>
<% if (user.userProperties.canUpdate) { %> <% if (user.userProperties.canUpdate) { %>
<div class="level-item"> <div class="level-item">
<a class="button <%= (contract.occupancyEndDate ? "is-warning" : "is-primary") %>" <a class="button <%= (contract.contractEndDate ? "is-warning" : "is-primary") %>"
href="<%= urlPrefix %>/lotOccupancies/<%= contract.contractId %>/edit" href="<%= urlPrefix %>/contracts/<%= contract.contractId %>/edit"
accesskey="e"> accesskey="e">
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span> <span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Switch to Edit Mode</span> <span>Switch to Edit Mode</span>
@ -89,39 +89,39 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<p> <p>
<strong><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</strong><br /> <strong>Contract Type</strong><br />
<%= contract.contractType %> <%= contract.contractType %>
</p> </p>
</div> </div>
<div class="column"> <div class="column">
<p class="mb-2"> <p class="mb-2">
<strong>Burial Site</strong><br /> <strong>Burial Site</strong><br />
<% if (contract.lotId) { %> <% if (contract.burialSiteId) { %>
<a href="<%= urlPrefix %>/burialSites/<%= contract.lotId %>"><%= contract.lotName %></a> <a href="<%= urlPrefix %>/burialSites/<%= contract.burialSiteId %>"><%= contract.burialSiteName %></a>
<% } else { %> <% } else { %>
<span class="has-text-grey">(No Burial Site)</span> <span class="has-text-grey">(No Burial Site)</span>
<% } %> <% } %>
</p> </p>
<p> <p>
<strong><%= configFunctions.getConfigProperty("aliases.map") %></strong><br /> <strong>Cemetery</strong><br />
<% if (contract.mapId) { %> <% if (contract.cemeteryId) { %>
<a href="<%= urlPrefix %>/maps/<%= contract.mapId %>"><%= contract.mapName %></a> <a href="<%= urlPrefix %>/cemeteries/<%= contract.cemeteryId %>"><%= contract.cemeteryName %></a>
<% } else { %> <% } else { %>
<span class="has-text-grey">(No <%= configFunctions.getConfigProperty("aliases.map") %>)</span> <span class="has-text-grey">(No Cemetery)</span>
<% } %> <% } %>
</p> </p>
</div> </div>
<div class="column"> <div class="column">
<p class="mb-2"> <p class="mb-2">
<strong><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></strong><br /> <strong>Contract Date</strong><br />
<%= contract.occupancyStartDateString %> <%= contract.contractStartDateString %>
</p> </p>
<p> <p>
<strong>End Date</strong><br /> <strong>End Date</strong><br />
<% if (contract.occupancyEndDateString === "") { %> <% if (contract.contractEndDateString === "") { %>
<span class="has-text-grey">(No End Date)</span> <span class="has-text-grey">(No End Date)</span>
<% } else { %> <% } else { %>
<%= contract.occupancyEndDateString %> <%= contract.contractEndDateString %>
<% } %> <% } %>
</p> </p>
</div> </div>
@ -143,17 +143,70 @@
</div> </div>
</div> </div>
<div class="panel"> <div class="columns">
<div class="column">
<div class="panel">
<h2 class="panel-heading">Purchaser</h2>
<div class="panel-block is-block">
<div class="columns">
<div class="column">
<p>
<%= contract.purchaserName %><br />
<span class="is-size-7">
<% if (contract.purchaserAddress1) { %>
<%= contract.purchaserAddress1 %><br />
<% } %>
<% if (contract.purchaserAddress2) { %>
<%= contract.purchaserAddress2 %><br />
<% } %>
<% if (contract.purchaserCity) { %>
<%= contract.purchaserCity %>,
<% } %>
<%= contract.purchaserProvince %><br />
<%= contract.purchaserPostalCode %>
</span>
</p>
</div>
<div class="column">
<% if ((contract.purchaserPhoneNumber ?? '') !== '') { %>
<p class="mb-2">
<strong>Phone</strong><br />
<%= contract.purchaserPhoneNumber %>
</p>
<% } %>
<% if ((contract.purchaserEmail ?? '') !== '') { %>
<p class="mb-2">
<strong>Email</strong><br />
<%= contract.purchaserEmail %>
</p>
<% } %>
<p>
<strong>
Relationship to
<%= (contract.isPreneed ? "Recipient" : "Deceased") %>
</strong><br />
<%= contract.purchaserRelationship %>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="column">
<div class="panel">
<div class="panel-heading"> <div class="panel-heading">
<div class="level is-mobile"> <div class="level is-mobile">
<div class="level-left"> <div class="level-left">
<div class="level-item"> <div class="level-item">
<h2 class="has-text-weight-bold is-size-5"><%= configFunctions.getConfigProperty("aliases.occupants") %></h2> <h2 class="has-text-weight-bold is-size-5">
<%= (contract.isPreneed ? "Recipient" : "Deceased") %>
</h2>
</div> </div>
</div> </div>
<div class="level-right"> <div class="level-right">
<div class="level-item"> <div class="level-item">
<a class="button is-link is-small is-hidden-print has-text-weight-normal" href="<%= urlPrefix %>/reports/contractOccupants-byLotOccupancyId/?contractId=<%= contract.contractId %>" target="_blank" download> <a class="button is-link is-small is-hidden-print has-text-weight-normal"
href="<%= urlPrefix %>/reports/contractInterments-byContractId/?contractId=<%= contract.contractId %>" target="_blank" download>
<span class="icon is-small"><i class="fas fa-download" aria-hidden="true"></i></span> <span class="icon is-small"><i class="fas fa-download" aria-hidden="true"></i></span>
<span>Export</span> <span>Export</span>
</a> </a>
@ -162,55 +215,37 @@
</div> </div>
</div> </div>
<div class="panel-block is-block"> <div class="panel-block is-block">
<% if (contract.contractOccupants.length === 0) { %> <% if (contract.contractInterments.length === 0) { %>
<div class="message is-warning"> <div class="message is-warning">
<p class="message-body"> <p class="message-body">
There are no <%= configFunctions.getConfigProperty("aliases.occupants").toLowerCase() %> There are no interments associated with this record.
associated with this record.
</p> </p>
</div> </div>
<% } else { %> <% } else { %>
<table class="table is-fullwidth is-striped is-hoverable"> <table class="table is-fullwidth is-striped is-hoverable">
<thead> <thead>
<tr> <tr>
<th><%= configFunctions.getConfigProperty("aliases.occupant") %></th> <th><%= (contract.isPreneed ? "Recipient" : "Deceased") %></th>
<th>Address</th> <th>Address</th>
<th>Other Contact</th>
<th>Comment</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% for (const contractOccupant of contract.contractOccupants) { %> <% for (const contractInterment of contract.contractInterments) { %>
<tr> <tr>
<td> <td>
<%= contractOccupant.occupantName %> <%= contractOccupant.occupantFamilyName %><br /> <%= contractInterment.deceasedName %><br />
<span class="tag"> <span class="is-size-7">
<i class="fas fa-fw fa-<%= contractOccupant.fontAwesomeIconClass %>" aria-hidden="true"></i> <% if (contractInterment.deceasedAddress1) { %>
<span class="ml-1"><%= contractOccupant.lotOccupantType %></span> <%= contractInterment.deceasedAddress1 %><br />
</span>
</td>
<td>
<% if (contractOccupant.occupantAddress1) { %>
<%= contractOccupant.occupantAddress1 %><br />
<% } %> <% } %>
<% if (contractOccupant.occupantAddress2) { %> <% if (contractInterment.deceasedAddress2) { %>
<%= contractOccupant.occupantAddress2 %><br /> <%= contractInterment.deceasedAddress2 %><br />
<% } %> <% } %>
<% if (contractOccupant.occupantCity) { %> <% if (contractInterment.deceasedCity) { %>
<%= contractOccupant.occupantCity %>, <%= contractInterment.deceasedCity %>,
<% } %> <% } %>
<%= contractOccupant.occupantProvince %><br /> <%= contractInterment.deceasedProvince %><br />
<%= contractOccupant.occupantPostalCode %> <%= contractInterment.deceasedPostalCode %>
</td>
<td>
<% if (contractOccupant.occupantPhoneNumber) { %>
<%= contractOccupant.occupantPhoneNumber %><br />
<% } %>
<%= contractOccupant.occupantEmailAddress %>
</td>
<td>
<span data-tooltip="<%= (contractOccupant.occupantCommentTitle ?? '') === '' ? 'Comment' : contractOccupant.occupantCommentTitle %>">
<%= contractOccupant.occupantComment %>
</span> </span>
</td> </td>
</tr> </tr>
@ -219,87 +254,10 @@
</table> </table>
<% } %> <% } %>
</div> </div>
</div>
</div>
</div> </div>
<% if (contract.contractComments.length > 0) { %>
<div class="panel">
<h2 class="panel-heading">Comments</h2>
<div class="panel-block is-block">
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Commentor</th>
<th>Comment Date</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<% for (const contractComment of contract.contractComments) { %>
<tr>
<td><%= contractComment.recordCreate_userName %></td>
<td>
<%= contractComment.contractCommentDateString %>
<%= (contractComment.contractCommentTime === 0 ? "" : contractComment.contractCommentTimePeriodString) %>
</td>
<td><%= contractComment.contractComment %></td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
<% } %>
<% if (contract.workOrders.length > 0) { %>
<%
const workOrderOpenDateAlias = configFunctions.getConfigProperty("aliases.workOrderOpenDate");
const workOrderCloseDateAlias = configFunctions.getConfigProperty("aliases.workOrderCloseDate");
%>
<div class="panel">
<h2 class="panel-heading">Work Orders</h2>
<div class="panel-block is-block">
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Work Order Number</th>
<th>Description</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<% for (const workOrder of contract.workOrders) { %>
<tr>
<td>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/workOrders/<%= workOrder.workOrderId %>">
<%= workOrder.workOrderNumber %>
</a>
</td>
<td>
<%= workOrder.workOrderType %><br />
<span class="is-size-7"><%= workOrder.workOrderDescription %></span>
</td>
<td class="is-nowrap">
<span class="has-tooltip-left" data-tooltip="<%= workOrderOpenDateAlias %>">
<i class="fas fa-fw fa-play" aria-label="<%= workOrderOpenDateAlias %>"></i>
<%= workOrder.workOrderOpenDateString %>
</span><br />
<span class="has-tooltip-left" data-tooltip="<%= workOrderCloseDateAlias %>">
<i class="fas fa-fw fa-stop" aria-label="<%= workOrderCloseDateAlias %>"></i>
<% if (workOrder.workOrderCloseDate) { %>
<%= workOrder.workOrderCloseDateString %>
<% } else { %>
<span class="has-text-grey">(No <%= workOrderCloseDateAlias %>)</span>
<% } %>
</span>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
<% } %>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="panel"> <div class="panel">
@ -308,7 +266,7 @@
<% if (contract.contractFees.length === 0) { %> <% if (contract.contractFees.length === 0) { %>
<div class="message is-info"> <div class="message is-info">
<p class="message-body"> <p class="message-body">
There are no fees applied to this <%= configFunctions.getConfigProperty("aliases.occupancy").toLowerCase() %> record. There are no fees applied to this contract.
</p> </p>
</div> </div>
<% } else { %> <% } else { %>
@ -374,7 +332,7 @@
<% if (contract.contractTransactions.length === 0) { %> <% if (contract.contractTransactions.length === 0) { %>
<div class="message is-info"> <div class="message is-info">
<p class="message-body"> <p class="message-body">
There are no transactions associated with this <%= configFunctions.getConfigProperty("aliases.occupancy").toLowerCase() %> record. There are no transactions associated with this contract.
</p> </p>
</div> </div>
<% } else { %> <% } else { %>
@ -435,6 +393,85 @@
</div> </div>
</div> </div>
<% if (contract.workOrders.length > 0) { %>
<%
const workOrderOpenDateAlias = configFunctions.getConfigProperty("aliases.workOrderOpenDate");
const workOrderCloseDateAlias = configFunctions.getConfigProperty("aliases.workOrderCloseDate");
%>
<div class="panel">
<h2 class="panel-heading">Work Orders</h2>
<div class="panel-block is-block">
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Work Order Number</th>
<th>Description</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<% for (const workOrder of contract.workOrders) { %>
<tr>
<td>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/workOrders/<%= workOrder.workOrderId %>">
<%= workOrder.workOrderNumber %>
</a>
</td>
<td>
<%= workOrder.workOrderType %><br />
<span class="is-size-7"><%= workOrder.workOrderDescription %></span>
</td>
<td class="is-nowrap">
<span class="has-tooltip-left" data-tooltip="<%= workOrderOpenDateAlias %>">
<i class="fas fa-fw fa-play" aria-label="<%= workOrderOpenDateAlias %>"></i>
<%= workOrder.workOrderOpenDateString %>
</span><br />
<span class="has-tooltip-left" data-tooltip="<%= workOrderCloseDateAlias %>">
<i class="fas fa-fw fa-stop" aria-label="<%= workOrderCloseDateAlias %>"></i>
<% if (workOrder.workOrderCloseDate) { %>
<%= workOrder.workOrderCloseDateString %>
<% } else { %>
<span class="has-text-grey">(No <%= workOrderCloseDateAlias %>)</span>
<% } %>
</span>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
<% } %>
<% if (contract.contractComments.length > 0) { %>
<div class="panel">
<h2 class="panel-heading">Comments</h2>
<div class="panel-block is-block">
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Commentor</th>
<th>Comment Date</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<% for (const contractComment of contract.contractComments) { %>
<tr>
<td><%= contractComment.recordCreate_userName %></td>
<td>
<%= contractComment.contractCommentDateString %>
<%= (contractComment.contractCommentTime === 0 ? "" : contractComment.contractCommentTimePeriodString) %>
</td>
<td><%= contractComment.contractComment %></td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
<% } %>
<%- include('_footerA'); -%> <%- include('_footerA'); -%>
<%- include('_footerB'); -%> <%- include('_footerB'); -%>

View File

@ -82,7 +82,7 @@
<p class="has-text-centered"> <p class="has-text-centered">
in in
<span class="field" style="width:300px"> <span class="field" style="width:300px">
<%= contract.mapName %> <%= contract.cemeteryName %>
</span> </span>
cemetery<br /> cemetery<br />
<span class="is-capitalized">operated by</span><br /> <span class="is-capitalized">operated by</span><br />
@ -215,12 +215,12 @@
<h2 class="is-10pt is-capitalized">Details</h2> <h2 class="is-10pt is-capitalized">Details</h2>
<table class="is-10pt data-table"> <table class="is-10pt data-table">
<tr> <tr>
<td><%= configFunctions.getConfigProperty("aliases.map") %></td> <td>Cemetery</td>
<td><%= contract.mapName ?? '(No ' + configFunctions.getConfigProperty("aliases.map") + ')' %></td> <td><%= contract.cemeteryName ?? '(No ' + configFunctions.getConfigProperty("aliases.map") + ')' %></td>
</tr> </tr>
<tr> <tr>
<td>Burial Site</td> <td>Burial Site</td>
<td><%= contract.lotName ?? '(No ' + configFunctions.getConfigProperty("aliases.lot") + ')' %></td> <td><%= contract.burialSiteName ?? '(No ' + configFunctions.getConfigProperty("aliases.lot") + ')' %></td>
</tr> </tr>
<% <%
for (const field of contract.contractFields) { for (const field of contract.contractFields) {

View File

@ -15,7 +15,7 @@
<thead> <thead>
<tr> <tr>
<th>Burial Site</th> <th>Burial Site</th>
<th><%= configFunctions.getConfigProperty("aliases.map") %></th> <th>Cemetery</th>
<th>Burial Site Type</th> <th>Burial Site Type</th>
<th>Status</th> <th>Status</th>
</tr> </tr>
@ -23,8 +23,8 @@
<tbody> <tbody>
<% for (const lot of workOrder.workOrderLots) { %> <% for (const lot of workOrder.workOrderLots) { %>
<tr> <tr>
<td><%= lot.lotName %></td> <td><%= lot.burialSiteName %></td>
<td><%= lot.mapName %></td> <td><%= lot.cemeteryName %></td>
<td><%= lot.lotType %></td> <td><%= lot.lotType %></td>
<td><%= lot.lotStatus %></td> <td><%= lot.lotStatus %></td>
</tr> </tr>
@ -39,7 +39,7 @@
<table class="data-table"> <table class="data-table">
<thead> <thead>
<tr> <tr>
<th><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</th> <th>Contract Type</th>
<th>Burial Site</th> <th>Burial Site</th>
<th><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></th> <th><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></th>
<th>End Date</th> <th>End Date</th>
@ -50,7 +50,7 @@
<% for (const occupancy of workOrder.workOrderLotOccupancies) { %> <% for (const occupancy of workOrder.workOrderLotOccupancies) { %>
<tr> <tr>
<td><%= occupancy.contractType %></td> <td><%= occupancy.contractType %></td>
<td><%= occupancy.lotName %></td> <td><%= occupancy.burialSiteName %></td>
<td><%= occupancy.occupancyStartDateString %></td> <td><%= occupancy.occupancyStartDateString %></td>
<td><%= occupancy.occupancyStartEndString %></td> <td><%= occupancy.occupancyStartEndString %></td>
<td> <td>

View File

@ -2,31 +2,31 @@
<h1 class="title is-2 has-text-centered"> <h1 class="title is-2 has-text-centered">
Burial Site Burial Site
<%= configFunctions.getConfigProperty("aliases.occupancy") %> Contract
</h1> </h1>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<p> <p>
<strong><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</strong><br /> <strong>Contract Type</strong><br />
<%= contract.contractType %> <%= contract.contractType %>
</p> </p>
</div> </div>
<div class="column"> <div class="column">
<p class="mb-2"> <p class="mb-2">
<strong>Burial Site</strong><br /> <strong>Burial Site</strong><br />
<% if (contract.lotId) { %> <% if (contract.burialSiteId) { %>
<%= contract.lotName %> <%= contract.burialSiteName %>
<% } else { %> <% } else { %>
(No Burial Site) (No Burial Site)
<% } %> <% } %>
</p> </p>
<p> <p>
<strong><%= configFunctions.getConfigProperty("aliases.map") %></strong><br /> <strong>Cemetery</strong><br />
<% if (contract.mapId) { %> <% if (contract.cemeteryId) { %>
<%= contract.mapName %> <%= contract.cemeteryName %>
<% } else { %> <% } else { %>
(No <%= configFunctions.getConfigProperty("aliases.map") %>) (No Cemetery)
<% } %> <% } %>
</p> </p>
</div> </div>

View File

@ -14,26 +14,26 @@
</a> </a>
</li> </li>
<li> <li>
<a href="#tab--lotOccupancies" aria-label="<%= configFunctions.getConfigProperty("aliases.occupancies") %>"> <a href="#tab--contracts" aria-label="Contracts">
<span class="icon"> <span class="icon">
<span class="fa-layers fa-fw" aria-hidden="true"> <span class="fa-layers fa-fw" aria-hidden="true">
<i class="fas fa-vector-square"></i> <i class="fas fa-vector-square"></i>
<i class="fas fa-user" data-fa-transform="shrink-10"></i> <i class="fas fa-user" data-fa-transform="shrink-10"></i>
</span> </span>
</span> </span>
<span class="is-hidden-touch"><%= configFunctions.getConfigProperty("aliases.occupancies") %></span> <span class="is-hidden-touch">Contacts</span>
</a> </a>
</li> </li>
<li> <li>
<a href="#tab--lots" aria-label="Burial Sites"> <a href="#tab--burialSites" aria-label="Burial Sites">
<span class="icon"><i class="fas fa-fw fa-vector-square" aria-hidden="true"></i></span> <span class="icon"><i class="fas fa-fw fa-vector-square" aria-hidden="true"></i></span>
<span class="is-hidden-touch">Burial Sites</span> <span class="is-hidden-touch">Burial Sites</span>
</a> </a>
</li> </li>
<li> <li>
<a href="#tab--maps" aria-label="<%= configFunctions.getConfigProperty("aliases.maps") %>"> <a href="#tab--cemeteries" aria-label="Cemeteries">
<span class="icon"><i class="far fa-fw fa-map" aria-hidden="true"></i></span> <span class="icon"><i class="far fa-fw fa-map" aria-hidden="true"></i></span>
<span class="is-hidden-touch"><%= configFunctions.getConfigProperty("aliases.maps") %></span> <span class="is-hidden-touch">Cemeteries</span>
</a> </a>
</li> </li>
</ul> </ul>
@ -113,11 +113,11 @@
</div> </div>
</div> </div>
<div class="is-hidden" id="tab--lotOccupancies"> <div class="is-hidden" id="tab--contracts">
<h1 class="title is-1"><%= configFunctions.getConfigProperty("aliases.occupancy") %> Reports</h1> <h1 class="title is-1">Contract Reports</h1>
<div class="panel"> <div class="panel">
<form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/lotOccupancies-current-byMapId"> <form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/contracts-current-byCemeteryId">
<div class="has-text-centered my-2 ml-2 mr-3"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i> <i class="fas fa-2x fa-file" aria-hidden="true"></i>
@ -126,20 +126,20 @@
</div> </div>
<div> <div>
<h2 class="title is-5 is-marginless"> <h2 class="title is-5 is-marginless">
Current <%= configFunctions.getConfigProperty("aliases.occupancy") %> By <%= configFunctions.getConfigProperty("aliases.map") %> Current Contract By Cemetery
</h2> </h2>
<div class="field has-addons mt-2"> <div class="field has-addons mt-2">
<div class="control"> <div class="control">
<label class="button is-small is-static" for="lotOccupancies-current-byMapId--mapId"> <label class="button is-small is-static" for="contracts-current-byCemeteryId--cemeteryId">
<%= configFunctions.getConfigProperty("aliases.map") %> Cemetery
</label> </label>
</div> </div>
<div class="control is-expanded"> <div class="control is-expanded">
<div class="select is-small is-fullwidth"> <div class="select is-small is-fullwidth">
<select id="lotOccupancies-current-byMapId--mapId" name="mapId"> <select id="contracts-current-byCemeteryId--cemeteryId" name="cemeteryId">
<% for (const map of maps) { %> <% for (const cemetery of cemeteries) { %>
<option value="<%= map.mapId %>"> <option value="<%= cemetery.cemeteryId %>">
<%= map.mapName || "(No Name)" %> <%= cemetery.cemeteryName || "(No Name)" %>
</option> </option>
<% } %> <% } %>
</select> </select>
@ -181,11 +181,11 @@
</form> </form>
</div> </div>
</div> </div>
<div class="is-hidden" id="tab--lots"> <div class="is-hidden" id="tab--burialSites">
<h1 class="title is-1">Burial Site Reports</h1> <h1 class="title is-1">Burial Site Reports</h1>
<div class="panel"> <div class="panel">
<form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/lots-byMapId"> <form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/lots-byCemeteryId">
<div class="has-text-centered my-2 ml-2 mr-3"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i> <i class="fas fa-2x fa-file" aria-hidden="true"></i>
@ -194,20 +194,20 @@
</div> </div>
<div> <div>
<h2 class="title is-5 is-marginless"> <h2 class="title is-5 is-marginless">
Burial Sites By <%= configFunctions.getConfigProperty("aliases.map") %> Burial Sites By Cemetery
</h2> </h2>
<div class="field has-addons mt-2"> <div class="field has-addons mt-2">
<div class="control"> <div class="control">
<label class="button is-small is-static" for="lots-byMapId--mapId"> <label class="button is-small is-static" for="burialSites-byCemeteryId--cemeteryId">
<%= configFunctions.getConfigProperty("aliases.map") %> Cemetery
</label> </label>
</div> </div>
<div class="control is-expanded"> <div class="control is-expanded">
<div class="select is-small is-fullwidth"> <div class="select is-small is-fullwidth">
<select id="lots-byMapId--mapId" name="mapId"> <select id="burialSites-byCemeteryId--cemeteryId" name="cemeteryId">
<% for (const map of maps) { %> <% for (const cemetery of cemeteries) { %>
<option value="<%= map.mapId %>"> <option value="<%= cemetery.cemeteryId %>">
<%= map.mapName || "(No Name)" %> <%= cemetery.cemeteryName || "(No Name)" %>
</option> </option>
<% } %> <% } %>
</select> </select>
@ -221,7 +221,7 @@
</div> </div>
</div> </div>
</form> </form>
<form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/lots-byburialSiteTypeId"> <form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/burialSites-byburialSiteTypeId">
<div class="has-text-centered my-2 ml-2 mr-3"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i> <i class="fas fa-2x fa-file" aria-hidden="true"></i>
@ -239,9 +239,9 @@
<div class="control is-expanded"> <div class="control is-expanded">
<div class="select is-small is-fullwidth"> <div class="select is-small is-fullwidth">
<select id="lots-byburialSiteTypeId--burialSiteTypeId" name="burialSiteTypeId"> <select id="lots-byburialSiteTypeId--burialSiteTypeId" name="burialSiteTypeId">
<% for (const lotType of lotTypes) { %> <% for (const burialSiteType of burialSiteTypes) { %>
<option value="<%= lotType.burialSiteTypeId %>"> <option value="<%= burialSiteType.burialSiteTypeId %>">
<%= lotType.lotType %> <%= burialSiteType.burialSiteType %>
</option> </option>
<% } %> <% } %>
</select> </select>
@ -255,7 +255,7 @@
</div> </div>
</div> </div>
</form> </form>
<form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/lots-byburialSiteStatusId"> <form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/burialSites-byBurialSiteStatusId">
<div class="has-text-centered my-2 ml-2 mr-3"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i> <i class="fas fa-2x fa-file" aria-hidden="true"></i>
@ -266,16 +266,16 @@
<h2 class="title is-5 is-marginless">Burial Sites By Status</h2> <h2 class="title is-5 is-marginless">Burial Sites By Status</h2>
<div class="field has-addons mt-2"> <div class="field has-addons mt-2">
<div class="control"> <div class="control">
<label class="button is-small is-static" for="lots-byburialSiteStatusId--burialSiteStatusId"> <label class="button is-small is-static" for="burialSites-byBurialSiteStatusId--burialSiteStatusId">
Burial Site Status Burial Site Status
</label> </label>
</div> </div>
<div class="control is-expanded"> <div class="control is-expanded">
<div class="select is-small is-fullwidth"> <div class="select is-small is-fullwidth">
<select id="lots-byburialSiteStatusId--burialSiteStatusId" name="burialSiteStatusId"> <select id="burialSites-byBurialSiteStatusId--burialSiteStatusId" name="burialSiteStatusId">
<% for (const lotStatus of lotStatuses) { %> <% for (const burialSiteStatus of burialSiteStatuses) { %>
<option value="<%= lotStatus.burialSiteStatusId %>"> <option value="<%= burialSiteStatus.burialSiteStatusId %>">
<%= lotStatus.lotStatus %> <%= burialSiteStatus.burialSiteStatus %>
</option> </option>
<% } %> <% } %>
</select> </select>
@ -291,8 +291,8 @@
</form> </form>
</div> </div>
</div> </div>
<div class="is-hidden" id="tab--maps"> <div class="is-hidden" id="tab--cemeteries">
<h1 class="title is-1"><%= configFunctions.getConfigProperty("aliases.map") %> Reports</h1> <h1 class="title is-1">Cemetery Reports</h1>
<div class="panel"> <div class="panel">
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/maps-formatted" download> <a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/maps-formatted" download>
<div class="has-text-centered my-2 ml-2 mr-3"> <div class="has-text-centered my-2 ml-2 mr-3">
@ -302,9 +302,9 @@
<span class="tag is-info">CSV</span> <span class="tag is-info">CSV</span>
</div> </div>
<div> <div>
<h2 class="title is-5 is-marginless">Full <%= configFunctions.getConfigProperty("aliases.map") %> List</h2> <h2 class="title is-5 is-marginless">Full Cemetery List</h2>
<p> <p>
All active <%= configFunctions.getConfigProperty("aliases.maps").toLowerCase() %>. All active cemeteries.
</p> </p>
</div> </div>
</a> </a>
@ -322,7 +322,7 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="panel"> <div class="panel">
<h2 class="panel-heading">Occupancy (<%= configFunctions.getConfigProperty("aliases.occupancy") %>) Tables</h2> <h2 class="panel-heading">Occupancy (Contract) Tables</h2>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/lotOccupancies-all" download> <a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/lotOccupancies-all" download>
<div class="has-text-centered my-2 ml-2 mr-3"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">
@ -563,7 +563,7 @@
</div> </div>
<div class="column"> <div class="column">
<div class="panel"> <div class="panel">
<h2 class="panel-heading">Occupancy (<%= configFunctions.getConfigProperty("aliases.occupancy") %>) Tables</h2> <h2 class="panel-heading">Occupancy (Contract) Tables</h2>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/contractTypes-all" download> <a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/contractTypes-all" download>
<div class="has-text-centered my-2 ml-2 mr-3"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">
@ -632,6 +632,6 @@
<%- include('_footerA'); -%> <%- include('_footerA'); -%>
<script src="<%= urlPrefix %>/javascripts/reportSearch.js"></script> <script src="<%= urlPrefix %>/javascripts/report.search.js"></script>
<%- include('_footerB'); -%> <%- include('_footerB'); -%>

View File

@ -244,7 +244,7 @@
<div class="box has-background-light has-text-right p-3"> <div class="box has-background-light has-text-right p-3">
<button class="button is-small is-success" id="button--addLotOccupancy" type="button"> <button class="button is-small is-success" id="button--addLotOccupancy" type="button">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span> <span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add Related <%= configFunctions.getConfigProperty("aliases.occupancy") %></span> <span>Add Related Contract</span>
</button> </button>
</div> </div>
<div id="container--lotOccupancies"></div> <div id="container--lotOccupancies"></div>

View File

@ -101,9 +101,9 @@
</div> </div>
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label class="label" for="searchFilter--lotName">Related Burial Site Name</label> <label class="label" for="searchFilter--burialSiteName">Related Burial Site Name</label>
<div class="control is-expanded has-icons-left"> <div class="control is-expanded has-icons-left">
<input class="input" id="searchFilter--lotName" name="lotName" type="text" /> <input class="input" id="searchFilter--burialSiteName" name="burialSiteName" type="text" />
<span class="icon is-small is-left"> <span class="icon is-small is-left">
<i class="fas fa-search" aria-hidden="true"></i> <i class="fas fa-search" aria-hidden="true"></i>
</span> </span>

View File

@ -162,7 +162,7 @@
<thead> <thead>
<tr> <tr>
<th class="has-width-1"></th> <th class="has-width-1"></th>
<th><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</th> <th>Contract Type</th>
<th>Burial Site</th> <th>Burial Site</th>
<th><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></th> <th><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></th>
<th>End Date</th> <th>End Date</th>
@ -175,9 +175,9 @@
<tr> <tr>
<td class="has-text-centered"> <td class="has-text-centered">
<% if (isActive) { %> <% if (isActive) { %>
<i class="fas fa-play" title="Current <%= configFunctions.getConfigProperty("aliases.occupancy") %>"></i> <i class="fas fa-play" title="Current Contract"></i>
<% } else { %> <% } else { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getConfigProperty("aliases.occupancy") %>"></i> <i class="fas fa-stop" title="Previous Contract"></i>
<% } %> <% } %>
</td> </td>
<td> <td>
@ -190,8 +190,8 @@
</span> </span>
</td> </td>
<td> <td>
<% if (contract.lotId) { %> <% if (contract.burialSiteId) { %>
<%= contract.lotName %> <%= contract.burialSiteName %>
<% } else { %> <% } else { %>
<span class="has-text-grey">(No Burial Site)</span> <span class="has-text-grey">(No Burial Site)</span>
<% } %> <% } %>
@ -243,7 +243,7 @@
<thead> <thead>
<tr> <tr>
<th>Burial Site</th> <th>Burial Site</th>
<th><%= configFunctions.getConfigProperty("aliases.map") %></th> <th>Cemetery</th>
<th>Burial Site Type</th> <th>Burial Site Type</th>
<th>Status</th> <th>Status</th>
</tr> </tr>
@ -252,9 +252,9 @@
<% for (const lot of workOrder.workOrderLots) { %> <% for (const lot of workOrder.workOrderLots) { %>
<tr> <tr>
<td> <td>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/burialSites/<%= lot.lotId %>"><%= lot.lotName %></a> <a class="has-text-weight-bold" href="<%= urlPrefix %>/burialSites/<%= lot.burialSiteId %>"><%= lot.burialSiteName %></a>
</td> </td>
<td><%= lot.mapName %></td> <td><%= lot.cemeteryName %></td>
<td><%= lot.lotType %></td> <td><%= lot.lotType %></td>
<td><%= lot.lotStatus %></td> <td><%= lot.lotStatus %></td>
</tr> </tr>