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: {},
settings: {
fees: {},
cemeteries: {},
burialSites: {},
contracts: {},
workOrders: {},

View File

@ -8,7 +8,6 @@ export const config: Config = {
aliases: {},
settings: {
fees: {},
cemeteries: {},
burialSites: {},
contracts: {},
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';
export interface AddContractForm {
contractTypeId: string | number;
@ -18,6 +18,9 @@ export interface AddContractForm {
purchaserRelationship?: string;
funeralHomeId?: string | number;
funeralDirectorName?: string;
funeralDateString?: DateString | '';
funeralTimeString?: TimeString | '';
committalTypeId?: string | number;
deceasedName?: string;
deceasedAddress1?: string;
deceasedAddress2?: string;
@ -28,8 +31,6 @@ export interface AddContractForm {
birthPlace?: string;
deathDateString?: DateString | '';
deathPlace?: string;
intermentDateString?: DateString | '';
intermentContainerTypeId?: string | number;
intermentCommittalTypeId?: string | 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 { acquireConnection } from './pool.js';
// eslint-disable-next-line complexity
@ -14,12 +14,18 @@ export default async function addContract(addForm, user, connectedDatabase) {
purchaserCity, purchaserProvince, purchaserPostalCode,
purchaserPhoneNumber, purchaserEmail, purchaserRelationship,
funeralHomeId, funeralDirectorName,
funeralDate, funeralTime,
committalTypeId,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(addForm.contractTypeId, addForm.burialSiteId === '' ? undefined : addForm.burialSiteId, contractStartDate, addForm.contractEndDateString === ''
? 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;
/*
* Add contract fields
@ -46,22 +52,17 @@ export default async function addContract(addForm, user, connectedDatabase) {
deceasedCity, deceasedProvince, deceasedPostalCode,
birthDate, deathDate,
birthPlace, deathPlace,
intermentDate,
intermentContainerTypeId, intermentCommittalTypeId,
intermentContainerTypeId,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(contractId, 1, addForm.deceasedName ?? '', addForm.deceasedAddress1 ?? '', addForm.deceasedAddress2 ?? '', addForm.deceasedCity ?? '', addForm.deceasedProvince ?? '', addForm.deceasedPostalCode ?? '', addForm.birthDateString === ''
? undefined
: dateStringToInteger(addForm.birthDateString), addForm.deathDateString === ''
? undefined
: dateStringToInteger(addForm.deathDateString), addForm.birthPlace ?? '', addForm.deathPlace ?? '', addForm.intermentDateString === ''
: dateStringToInteger(addForm.deathDateString), addForm.birthPlace ?? '', addForm.deathPlace ?? '', addForm.intermentContainerTypeId === ''
? undefined
: dateStringToInteger(addForm.intermentDateString), addForm.intermentContainerTypeId === ''
? undefined
: addForm.intermentContainerTypeId, addForm.intermentCommittalTypeId === ''
? undefined
: addForm.intermentCommittalTypeId, user.userName, rightNowMillis, user.userName, rightNowMillis);
: addForm.intermentContainerTypeId, user.userName, rightNowMillis, user.userName, rightNowMillis);
}
if (connectedDatabase === undefined) {
database.release();

View File

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

View File

@ -1,4 +1,5 @@
import { clearCacheByTableName } from '../helpers/functions.cache.js'
import { acquireConnection } from './pool.js'
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 {};

View File

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

View File

@ -5,16 +5,14 @@ import { acquireConnection } from './pool.js'
type RecordTable =
| 'BurialSiteStatuses'
| 'BurialSiteTypes'
| 'IntermentContainerTypes'
| 'IntermentCommittalTypes'
| 'CommittalTypes'
| 'WorkOrderMilestoneTypes'
| 'WorkOrderTypes'
const recordNameColumns = new Map<RecordTable, string>()
recordNameColumns.set('BurialSiteStatuses', 'burialSiteStatus')
recordNameColumns.set('BurialSiteTypes', 'burialSiteType')
recordNameColumns.set('IntermentContainerTypes', 'intermentContainerType')
recordNameColumns.set('IntermentCommittalTypes', 'intermentCommittalType')
recordNameColumns.set('CommittalTypes', 'committalType')
recordNameColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneType')
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 getContractFees from './getContractFees.js';
import getContractFields from './getContractFields.js';
@ -9,6 +9,7 @@ import { acquireConnection } from './pool.js';
export default async function getContract(contractId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
const contract = database
.prepare(`select o.contractId,
o.contractTypeId, t.contractType, t.isPreneed,
@ -20,9 +21,13 @@ export default async function getContract(contractId, connectedDatabase) {
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
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
from Contracts o
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 Cemeteries m on l.cemeteryId = m.cemeteryId
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 { Contract } from '../types/recordTypes.js'
@ -18,6 +18,7 @@ export default async function getContract(
const database = connectedDatabase ?? (await acquireConnection())
database.function('userFn_dateIntegerToString', dateIntegerToString)
database.function('userFn_timeIntegerToString', timeIntegerToString)
const contract = database
.prepare(
@ -31,9 +32,13 @@ export default async function getContract(
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
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
from Contracts o
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 Cemeteries m on l.cemeteryId = m.cemeteryId
where o.recordDelete_timeMillis is null

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ export default async function getContractTypes(): Promise<ContractType[]> {
`select contractTypeId, contractType, isPreneed, orderNumber
from ContractTypes
where recordDelete_timeMillis is null
order by orderNumber, contractType`
order by orderNumber, contractType, contractTypeId`
)
.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 { getContractTypeById } from '../helpers/functions.cache.js';
import { getBurialSiteNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWhereClause } from '../helpers/functions.sqlFilters.js';
@ -13,9 +13,9 @@ function buildWhereClause(filters) {
sqlWhereClause += ' and o.burialSiteId = ?';
sqlParameters.push(filters.burialSiteId);
}
const lotNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, filters.burialSiteNameSearchType ?? '', 'l');
sqlWhereClause += lotNameFilters.sqlWhereClause;
sqlParameters.push(...lotNameFilters.sqlParameters);
const burialSiteNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, filters.burialSiteNameSearchType ?? '', 'l');
sqlWhereClause += burialSiteNameFilters.sqlWhereClause;
sqlParameters.push(...burialSiteNameFilters.sqlParameters);
const occupantNameFilters = getOccupantNameWhereClause(filters.occupantName, 'o');
if (occupantNameFilters.sqlParameters.length > 0) {
sqlWhereClause += ` and o.contractId in (
@ -80,6 +80,7 @@ async function addInclusions(contract, options, database) {
export default async function getContracts(filters, options, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
let count = typeof options.limit === 'string'
? Number.parseInt(options.limit, 10)
@ -105,9 +106,13 @@ export default async function getContracts(filters, options, connectedDatabase)
o.purchaserName, o.purchaserAddress1, o.purchaserAddress2,
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
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
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 BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId
left join Cemeteries m on l.cemeteryId = m.cemeteryId

View File

@ -1,7 +1,8 @@
import {
type DateString,
dateIntegerToString,
dateStringToInteger
dateStringToInteger,
timeIntegerToString
} from '@cityssm/utils-datetime'
import type { PoolConnection } from 'better-sqlite-pool'
@ -55,13 +56,13 @@ function buildWhereClause(filters: GetContractsFilters): {
sqlParameters.push(filters.burialSiteId)
}
const lotNameFilters = getBurialSiteNameWhereClause(
const burialSiteNameFilters = getBurialSiteNameWhereClause(
filters.burialSiteName,
filters.burialSiteNameSearchType ?? '',
'l'
)
sqlWhereClause += lotNameFilters.sqlWhereClause
sqlParameters.push(...lotNameFilters.sqlParameters)
sqlWhereClause += burialSiteNameFilters.sqlWhereClause
sqlParameters.push(...burialSiteNameFilters.sqlParameters)
const occupantNameFilters = getOccupantNameWhereClause(
filters.occupantName,
@ -168,6 +169,7 @@ export default async function getContracts(
const database = connectedDatabase ?? (await acquireConnection())
database.function('userFn_dateIntegerToString', dateIntegerToString)
database.function('userFn_timeIntegerToString', timeIntegerToString)
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters)
@ -205,9 +207,13 @@ export default async function getContracts(
o.purchaserName, o.purchaserAddress1, o.purchaserAddress2,
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
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
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 BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId
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 { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export default async function getIntermentContainerTypes() {
const database = await acquireConnection();
const containerTypes = database
.prepare(`select intermentContainerTypeId, intermentContainerType, orderNumber
.prepare(`select intermentContainerTypeId, intermentContainerType, isCremationType, orderNumber
from IntermentContainerTypes
where recordDelete_timeMillis is null
order by orderNumber, intermentContainerType, intermentContainerTypeId`)
order by isCremationType, orderNumber, intermentContainerType, intermentContainerTypeId`)
.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();
return containerTypes;
}

View File

@ -1,6 +1,7 @@
import type { IntermentContainerType } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export default async function getIntermentContainerTypes(): Promise<
IntermentContainerType[]
@ -9,13 +10,30 @@ export default async function getIntermentContainerTypes(): Promise<
const containerTypes = database
.prepare(
`select intermentContainerTypeId, intermentContainerType, orderNumber
`select intermentContainerTypeId, intermentContainerType, isCremationType, orderNumber
from IntermentContainerTypes
where recordDelete_timeMillis is null
order by orderNumber, intermentContainerType, intermentContainerTypeId`
order by isCremationType, orderNumber, intermentContainerType, intermentContainerTypeId`
)
.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()
return containerTypes

View File

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

View File

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

View File

@ -22,7 +22,7 @@ export interface GetWorkOrdersFilters {
workOrderOpenStatus?: '' | 'open' | 'closed'
workOrderOpenDateString?: string
occupantName?: string
lotName?: string
burialSiteName?: string
contractId?: number | string
}
@ -77,7 +77,7 @@ function buildWhereClause(filters: GetWorkOrdersFilters): {
sqlParameters.push(...occupantNameFilters.sqlParameters)
}
const burialSiteNameFilters = getBurialSiteNameWhereClause(filters.lotName, '', 'l')
const burialSiteNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, '', 'l')
if (burialSiteNameFilters.sqlParameters.length > 0) {
sqlWhereClause +=
` and w.workOrderId in (
@ -213,7 +213,7 @@ export async function getWorkOrders(
where recordDelete_timeMillis is null
group by workOrderId) m on w.workOrderId = m.workOrderId
left join (
select workOrderId, count(lotId) as workOrderLotCount
select workOrderId, count(burialSiteId) as workOrderLotCount
from WorkOrderLots
where recordDelete_timeMillis is null
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 no-secrets/no-secrets */
/* eslint-disable max-lines, no-secrets/no-secrets */
import sqlite from 'better-sqlite3';
import Debug from 'debug';
import { DEBUG_NAMESPACE } from '../debug.config.js';
import { sunriseDB as databasePath } from '../helpers/database.helpers.js';
import addContractType from './addContractType.js';
import addFeeCategory from './addFeeCategory.js';
import addIntermentContainerType from './addIntermentContainerType.js';
import addRecord from './addRecord.js';
const debug = Debug(`${DEBUG_NAMESPACE}:database/initializeDatabase`);
const recordColumns = `recordCreate_userName varchar(30) not null,
@ -162,6 +163,13 @@ const createStatements = [
foreign key (contractTypeId) references ContractTypes (contractTypeId))`,
`create index if not exists idx_ContractTypePrints_orderNumber
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 (
contractId integer not null primary key autoincrement,
contractTypeId integer not null,
@ -181,11 +189,15 @@ const createStatements = [
funeralHomeId integer,
funeralDirectorName varchar(100),
funeralDate integer check (funeralDate > 0),
funeralTime integer check (funeralTime >= 0),
committalTypeId integer,
${recordColumns},
foreign key (burialSiteId) references BurialSites (burialSiteId),
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 (
contractId integer not null,
contractTypeFieldId integer not null,
@ -210,17 +222,11 @@ const createStatements = [
`create table if not exists IntermentContainerTypes (
intermentContainerTypeId integer not null primary key autoincrement,
intermentContainerType varchar(100) not null,
isCremationType bit not null default 0,
orderNumber smallint not null default 0,
${recordColumns})`,
`create index if not exists idx_IntermentContainerTypes_orderNumber
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 (
contractId integer not null,
intermentNumber integer not null,
@ -240,17 +246,12 @@ const createStatements = [
deathDate integer,
deathPlace varchar(100),
intermentDate integer check (intermentDate > 0),
intermentTime integer check (intermentTime >= 0),
intermentContainerTypeId integer,
intermentCommittalTypeId integer,
${recordColumns},
primary key (contractId, intermentNumber),
foreign key (contractId) references Contracts (contractId),
foreign key (intermentContainerTypeId) references IntermentContainerTypes (intermentContainerTypeId),
foreign key (intermentCommittalTypeId) references IntermentCommittalTypes (intermentCommittalTypeId)) without rowid`,
foreign key (intermentContainerTypeId) references IntermentContainerTypes (intermentContainerTypeId)) without rowid`,
/*
* Fees and Transactions
*/
@ -402,6 +403,7 @@ async function initializeData() {
await addRecord('BurialSiteStatuses', 'Available', 1, initializingUser);
await addRecord('BurialSiteStatuses', 'Reserved', 2, initializingUser);
await addRecord('BurialSiteStatuses', 'Taken', 3, initializingUser);
// Contract Types
await addContractType({
contractType: 'Preneed',
isPreneed: '1',
@ -409,23 +411,40 @@ async function initializeData() {
}, initializingUser);
await addContractType({
contractType: 'Interment',
isPreneed: '0',
orderNumber: 2
}, initializingUser);
await addContractType({
contractType: 'Cremation',
isPreneed: '0',
orderNumber: 3
}, initializingUser);
await addRecord('IntermentContainerTypes', 'No Shell', 1, initializingUser);
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 addRecord('IntermentCommittalTypes', 'Chapel', 2, initializingUser);
await addRecord('IntermentCommittalTypes', 'Church', 3, initializingUser);
// Interment Container Types
await addIntermentContainerType({
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
*/

View File

@ -1,5 +1,5 @@
// 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 Debug from 'debug'
@ -9,6 +9,7 @@ import { sunriseDB as databasePath } from '../helpers/database.helpers.js'
import addContractType from './addContractType.js'
import addFeeCategory from './addFeeCategory.js'
import addIntermentContainerType from './addIntermentContainerType.js'
import addRecord from './addRecord.js'
const debug = Debug(`${DEBUG_NAMESPACE}:database/initializeDatabase`)
@ -192,6 +193,15 @@ const createStatements = [
`create index if not exists idx_ContractTypePrints_orderNumber
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 (
contractId integer not null primary key autoincrement,
contractTypeId integer not null,
@ -211,11 +221,15 @@ const createStatements = [
funeralHomeId integer,
funeralDirectorName varchar(100),
funeralDate integer check (funeralDate > 0),
funeralTime integer check (funeralTime >= 0),
committalTypeId integer,
${recordColumns},
foreign key (burialSiteId) references BurialSites (burialSiteId),
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 (
contractId integer not null,
@ -245,21 +259,13 @@ const createStatements = [
`create table if not exists IntermentContainerTypes (
intermentContainerTypeId integer not null primary key autoincrement,
intermentContainerType varchar(100) not null,
isCremationType bit not null default 0,
orderNumber smallint not null default 0,
${recordColumns})`,
`create index if not exists idx_IntermentContainerTypes_orderNumber
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 (
contractId integer not null,
intermentNumber integer not null,
@ -279,17 +285,12 @@ const createStatements = [
deathDate integer,
deathPlace varchar(100),
intermentDate integer check (intermentDate > 0),
intermentTime integer check (intermentTime >= 0),
intermentContainerTypeId integer,
intermentCommittalTypeId integer,
${recordColumns},
primary key (contractId, intermentNumber),
foreign key (contractId) references Contracts (contractId),
foreign key (intermentContainerTypeId) references IntermentContainerTypes (intermentContainerTypeId),
foreign key (intermentCommittalTypeId) references IntermentCommittalTypes (intermentCommittalTypeId)) without rowid`,
foreign key (intermentContainerTypeId) references IntermentContainerTypes (intermentContainerTypeId)) without rowid`,
/*
* Fees and Transactions
@ -473,6 +474,8 @@ async function initializeData(): Promise<void> {
await addRecord('BurialSiteStatuses', 'Reserved', 2, initializingUser)
await addRecord('BurialSiteStatuses', 'Taken', 3, initializingUser)
// Contract Types
await addContractType(
{
contractType: 'Preneed',
@ -485,7 +488,6 @@ async function initializeData(): Promise<void> {
await addContractType(
{
contractType: 'Interment',
isPreneed: '0',
orderNumber: 2
},
initializingUser
@ -494,22 +496,69 @@ async function initializeData(): Promise<void> {
await addContractType(
{
contractType: 'Cremation',
isPreneed: '0',
orderNumber: 3
},
initializingUser
)
await addRecord('IntermentContainerTypes', 'No Shell', 1, initializingUser)
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)
// Interment Container Types
await addRecord('IntermentCommittalTypes', 'Graveside', 1, initializingUser)
await addRecord('IntermentCommittalTypes', 'Chapel', 2, initializingUser)
await addRecord('IntermentCommittalTypes', 'Church', 3, initializingUser)
await addIntermentContainerType(
{
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

View File

@ -1,4 +1,4 @@
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 {};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import getBurialSites from '../../database/getBurialSites.js';
import { updateBurialSiteStatus } from '../../database/updateBurialSite.js';
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({
workOrderId: request.body.workOrderId
}, {

View File

@ -7,12 +7,12 @@ export default async function handler(
request: Request<
unknown,
unknown,
{ lotId: string; burialSiteStatusId: string; workOrderId: string }
{ burialSiteId: string; burialSiteStatusId: string; workOrderId: string }
>,
response: Response
): Promise<void> {
const success = await updateBurialSiteStatus(
request.body.lotId,
request.body.burialSiteId,
request.body.burialSiteStatusId,
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 getBurialSiteStatusById(burialSiteStatusId: number): 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 getIntermentContainerTypes(): Promise<IntermentContainerType[]>;
export declare function getIntermentContainerTypeById(intermentContainerTypeId: number): Promise<IntermentContainerType | undefined>;
export declare function getIntermentCommittalTypes(): Promise<IntermentCommittalType[]>;
export declare function getIntermentCommittalTypeById(intermentCommittalTypeId: number): Promise<IntermentCommittalType | undefined>;
export declare function getCommittalTypes(): Promise<CommittalType[]>;
export declare function getCommittalTypeById(committalTypeId: number): Promise<CommittalType | undefined>;
export declare function getWorkOrderTypes(): Promise<WorkOrderType[]>;
export declare function getWorkOrderTypeById(workOrderTypeId: number): Promise<WorkOrderType | undefined>;
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 preloadCaches(): Promise<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 {};

View File

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

View File

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

View File

@ -13,16 +13,16 @@
</header>
<section class="modal-card-body">
<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">
<label class="label" for="lotStatusEdit--lotName"
<label class="label" for="lotStatusEdit--burialSiteName"
><span class="alias" data-alias="Lot"></span> Name</label
>
<div class="control">
<input
class="input is-readonly"
id="lotStatusEdit--lotName"
id="lotStatusEdit--burialSiteName"
readonly
/>
</div>

View File

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

View File

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

View File

@ -455,8 +455,72 @@ Object.defineProperty(exports, "__esModule", { value: true });
*/
let contractInterments = exports.contractInterments;
delete exports.contractInterments;
function openEditContractInterment(clickEvent) { }
function deleteContractInterment(clickEvent) { }
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
*/
@ -551,42 +615,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
const containerElement = document.querySelector('#container--contractComments');
if (contractComments.length === 0) {
containerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no comments associated with this record.</p>
</div>`;
<p class="message-body">There are no comments 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>Author</th>
<th>Comment Date</th>
<th>Comment</th>
<th class="is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>`;
<th>Author</th>
<th>Comment Date</th>
<th>Comment</th>
<th class="is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>`;
for (const contractComment of contractComments) {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.contractCommentId =
contractComment.contractCommentId?.toString();
tableRowElement.innerHTML = `<td>${cityssm.escapeHTML(contractComment.recordCreate_userName ?? '')}</td>
<td>
${cityssm.escapeHTML(contractComment.contractCommentDateString ?? '')}
${cityssm.escapeHTML(contractComment.contractCommentTime === 0
<td>
${cityssm.escapeHTML(contractComment.commentDateString ?? '')}
${cityssm.escapeHTML(contractComment.commentTime === 0
? ''
: contractComment.contractCommentTimePeriodString ?? '')}
</td>
<td>${cityssm.escapeHTML(contractComment.contractComment ?? '')}</td>
<td class="is-hidden-print">
<div class="buttons are-small is-justify-content-end">
<button class="button is-primary button--edit" type="button">
<span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Edit</span>
</button>
<button class="button is-light is-danger button--delete" data-tooltip="Delete Comment" type="button" aria-label="Delete">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</td>`;
: contractComment.commentTimePeriodString ?? '')}
</td>
<td>${cityssm.escapeHTML(contractComment.comment ?? '')}</td>
<td class="is-hidden-print">
<div class="buttons are-small is-justify-content-end">
<button class="button is-primary button--edit" type="button">
<span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Edit</span>
</button>
<button class="button is-light is-danger button--delete" data-tooltip="Delete Comment" type="button" aria-label="Delete">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</td>`;
tableRowElement
.querySelector('.button--edit')
?.addEventListener('click', openEditContractComment);

View File

@ -729,10 +729,89 @@ declare const exports: Record<string, unknown>
let contractInterments = exports.contractInterments as ContractInterment[]
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
*/
@ -898,20 +977,20 @@ declare const exports: Record<string, unknown>
if (contractComments.length === 0) {
containerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no comments associated with this record.</p>
</div>`
<p class="message-body">There are no comments 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>Author</th>
<th>Comment Date</th>
<th>Comment</th>
<th class="is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>`
<th>Author</th>
<th>Comment Date</th>
<th>Comment</th>
<th class="is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>`
for (const contractComment of contractComments) {
const tableRowElement = document.createElement('tr')
@ -919,26 +998,26 @@ declare const exports: Record<string, unknown>
contractComment.contractCommentId?.toString()
tableRowElement.innerHTML = `<td>${cityssm.escapeHTML(contractComment.recordCreate_userName ?? '')}</td>
<td>
${cityssm.escapeHTML(contractComment.contractCommentDateString ?? '')}
${cityssm.escapeHTML(
contractComment.contractCommentTime === 0
? ''
: contractComment.contractCommentTimePeriodString ?? ''
)}
</td>
<td>${cityssm.escapeHTML(contractComment.contractComment ?? '')}</td>
<td class="is-hidden-print">
<div class="buttons are-small is-justify-content-end">
<button class="button is-primary button--edit" type="button">
<span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Edit</span>
</button>
<button class="button is-light is-danger button--delete" data-tooltip="Delete Comment" type="button" aria-label="Delete">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</td>`
<td>
${cityssm.escapeHTML(contractComment.commentDateString ?? '')}
${cityssm.escapeHTML(
contractComment.commentTime === 0
? ''
: contractComment.commentTimePeriodString ?? ''
)}
</td>
<td>${cityssm.escapeHTML(contractComment.comment ?? '')}</td>
<td class="is-hidden-print">
<div class="buttons are-small is-justify-content-end">
<button class="button is-primary button--edit" type="button">
<span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Edit</span>
</button>
<button class="button is-light is-danger button--delete" data-tooltip="Delete Comment" type="button" aria-label="Delete">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</td>`
tableRowElement
.querySelector('.button--edit')
@ -1529,11 +1608,9 @@ declare const exports: Record<string, unknown>
// eslint-disable-next-line no-unsanitized/property
panelBlockElement.innerHTML = `<strong>${cityssm.escapeHTML(fee.feeName ?? '')}</strong><br />
<small>
${
cityssm
.escapeHTML(fee.feeDescription ?? '')
.replaceAll('\n', '<br />')
}
${cityssm
.escapeHTML(fee.feeDescription ?? '')
.replaceAll('\n', '<br />')}
</small>`
if (!feeCategory.isGroupedFee) {
@ -1619,7 +1696,10 @@ declare const exports: Record<string, unknown>
10
)
const transaction = contractTransactions.find((possibleTransaction) => possibleTransaction.transactionIndex === transactionIndex) as ContractTransaction
const transaction = contractTransactions.find(
(possibleTransaction) =>
possibleTransaction.transactionIndex === transactionIndex
) as ContractTransaction
let editCloseModalFunction: () => void

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -117,19 +117,19 @@ describe('functions.sqlFilters', () => {
describe('LotName filter', () => {
it('returns startsWith filter', () => {
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.ok(filter.sqlParameters.includes('TEST1 TEST2'));
});
it('returns endsWith filter', () => {
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[0], 'TEST1 TEST2');
});
it('returns contains filter', () => {
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('test2'));
});

View File

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

View File

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

View File

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

View File

@ -245,84 +245,84 @@
</div>
</div>
<div class="column">
<div id="container--contractFields">
<% if (isCreate) { %>
<div class="message is-info">
<p class="message-body">
Select the contract type to load the available fields.
</p>
</div>
<% } else if (contract.contractFields.length === 0) { %>
<div class="message is-info">
<p class="message-body">
The current contract type has no additional fields.
</p>
</div>
<% } else { %>
<% let contractTypeFieldIds = ""; %>
<% for (const contractField of contract.contractFields) { %>
<% contractTypeFieldIds += "," + contractField.contractTypeFieldId; %>
<div class="field">
<label class="label" for="contract--fieldValue_<%= contractField.contractTypeFieldId %>">
<%= contractField.contractTypeField %>
</label>
<div class="control">
<% if (contractField.fieldType === 'select' || (contractField.fieldValues ?? '') !== "") { %>
<%
const fieldValues = contractField.fieldValues.split("\n");
let valueFound = false;
%>
<div class="select is-fullwidth">
<select id="contract--fieldValue_<%= contractField.contractTypeFieldId %>"
name="fieldValue_<%= contractField.contractTypeFieldId %>">
<% if (!contractField.isRequired || contractField.contractFieldValue === "") { %>
<option value="">(Not Set)</option>
<% } %>
<% for (const fieldValue of fieldValues) { %>
<%
if (fieldValue === contractField.fieldValue) {
valueFound = true;
}
%>
<option value="<%= fieldValue %>"
<%= (fieldValue === contractField.fieldValue ? " selected" : "") %>>
<%= fieldValue %>
</option>
<% } %>
<% if (!valueFound && contractField.fieldValue !== "") { %>
<option value="<%= contractField.fieldValue %>" selected>
<%= contractField.fieldValue %>
</option>
<% } %>
</select>
</div>
<% } else { %>
<input class="input"
id="contract--fieldValue_<%= contractField.contractTypeFieldId %>"
name="fieldValue_<%= contractField.contractTypeFieldId %>"
type="<%= contractField.fieldType %>"
value="<%= contractField.fieldValue %>"
<% if (contractField.pattern !== "") { %>
pattern="<%= contractField.pattern %>"
<div id="container--contractFields">
<% if (isCreate) { %>
<div class="message is-info">
<p class="message-body">
Select the contract type to load the available fields.
</p>
</div>
<% } else if (contract.contractFields.length === 0) { %>
<div class="message is-info">
<p class="message-body">
The current contract type has no additional fields.
</p>
</div>
<% } else { %>
<% let contractTypeFieldIds = ""; %>
<% for (const contractField of contract.contractFields) { %>
<% contractTypeFieldIds += "," + contractField.contractTypeFieldId; %>
<div class="field">
<label class="label" for="contract--fieldValue_<%= contractField.contractTypeFieldId %>">
<%= contractField.contractTypeField %>
</label>
<div class="control">
<% if (contractField.fieldType === 'select' || (contractField.fieldValues ?? '') !== "") { %>
<%
const fieldValues = contractField.fieldValues.split("\n");
let valueFound = false;
%>
<div class="select is-fullwidth">
<select id="contract--fieldValue_<%= contractField.contractTypeFieldId %>"
name="fieldValue_<%= contractField.contractTypeFieldId %>">
<% if (!contractField.isRequired || contractField.contractFieldValue === "") { %>
<option value="">(Not Set)</option>
<% } %>
minlength="<%= contractField.minLength %>"
maxlength="<%= contractField.maxLength %>"
<%= contractField.isRequired ? " required" : "" %>
/>
<% } %>
</div>
<% for (const fieldValue of fieldValues) { %>
<%
if (fieldValue === contractField.fieldValue) {
valueFound = true;
}
%>
<option value="<%= fieldValue %>"
<%= (fieldValue === contractField.fieldValue ? " selected" : "") %>>
<%= fieldValue %>
</option>
<% } %>
<% if (!valueFound && contractField.fieldValue !== "") { %>
<option value="<%= contractField.fieldValue %>" selected>
<%= contractField.fieldValue %>
</option>
<% } %>
</select>
</div>
<% } else { %>
<input class="input"
id="contract--fieldValue_<%= contractField.contractTypeFieldId %>"
name="fieldValue_<%= contractField.contractTypeFieldId %>"
type="<%= contractField.fieldType %>"
value="<%= contractField.fieldValue %>"
<% if (contractField.pattern !== "") { %>
pattern="<%= contractField.pattern %>"
<% } %>
minlength="<%= contractField.minLength %>"
maxlength="<%= contractField.maxLength %>"
<%= contractField.isRequired ? " required" : "" %>
/>
<% } %>
</div>
<% } %>
<input id="contract--contractTypeFieldIds" name="contractTypeFieldIds" type="hidden" value="<%= contractTypeFieldIds.slice(1) %>" />
</div>
<% } %>
</div>
<input id="contract--contractTypeFieldIds" name="contractTypeFieldIds" type="hidden" value="<%= contractTypeFieldIds.slice(1) %>" />
<% } %>
</div>
</div>
</div>
</div>
</div>
<div class="panel">
<h2 class="panel-heading">Funeral Home</h2>
<h2 class="panel-heading">Funeral</h2>
<div class="panel-block is-block">
<div class="columns">
<div class="column">
@ -334,18 +334,27 @@
<div class="select is-fullwidth">
<select id="contract--funeralHomeId" name="funeralHomeId">
<option value="">(No Funeral Home)</option>
<% let funeralHomeIsFound = false; %>
<% for (const funeralHome of funeralHomes) { %>
<%
if (contract.funeralHomeId === funeralHome.funeralHomeId) {
funeralHomeIsFound = true;
}
%>
<option value="<%= funeralHome.funeralHomeId %>"
<%= (contract.funeralHomeId === funeralHome.funeralHomeId ? " selected" : "") %>>
<%= funeralHome.funeralHomeName %>
</option>
<% } %>
<% if (contract.funeralHomeId && !funeralHomeIsFound) { %>
<option value="<%= contract.funeralHomeId %>" selected>
<%= contract.funeralHomeName %>
</option>
<% } %>
</select>
</div>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label" for="contract--funeralDirectorName">
Funeral Director's Name
@ -355,6 +364,60 @@
</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>
@ -429,7 +492,10 @@
</div>
<div class="field">
<label class="label" for="contract--purchaserRelationship">
Relationship to Deceased
Relationship to
<span class="is-recipient-or-deceased">
<%= (contract.isPreneed ? "Recipient" : "Deceased") %>
</span>
</label>
<div class="control">
<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 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">
<p class="message-body">
Any additional interments associated with this contract can be added after the contract is created.
@ -585,9 +686,7 @@
</div>
</div>
</div>
<div class="panel-block is-block">
</div>
<div class="panel-block is-block" id="container--contractInterments"></div>
</div>
<% } %>
</div>
@ -748,7 +847,7 @@
exports.workOrderTypes = <%- JSON.stringify(workOrderTypes) %>;
<% } %>
</script>
</script>
<script src="<%= urlPrefix %>/javascripts/contract.edit.js"></script>

View File

@ -4,40 +4,40 @@
<ul>
<li><a href="<%= urlPrefix %>/dashboard">Home</a></li>
<li>
<a href="<%= urlPrefix %>/lotOccupancies">
<a href="<%= urlPrefix %>/contracts">
<span class="icon is-small">
<span class="fa-layers fa-fw" aria-hidden="true">
<i class="fas fa-vector-square"></i>
<i class="fas fa-user" data-fa-transform="shrink-10"></i>
</span>
</span>
<span><%= configFunctions.getConfigProperty("aliases.occupancies") %></span>
<span>Contracts</span>
</a>
</li>
<li class="is-active">
<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>
</li>
</ul>
</nav>
<h1 class="title is-1">
<%= configFunctions.getConfigProperty("aliases.occupancy") %>
Contract
#<%= contract.contractId %>:
<%= contract.lotName || ("(No " + configFunctions.getConfigProperty("aliases.lot") + ")") %>
<%= contract.burialSiteName || "(No Burial Site)" %>
</h1>
<div class="level is-fixed-bottom is-mobile has-background-white has-shadow is-hidden-print">
<div class="level-left">
<span class="level-item has-text-weight-bold">
<%= configFunctions.getConfigProperty("aliases.occupancy") %> #<%= contract.contractId %>:
<%= contract.lotName || ("(No " + configFunctions.getConfigProperty("aliases.lot") + ")") %>
Contract #<%= contract.contractId %>:
<%= contract.burialSiteName ?? "(No Burial Site)" %>
</span>
</div>
<div class="level-right">
<% if (ContractTypePrints.length > 0) { %>
<% if (ContractTypePrints.length === 1) { %>
<% if (contractTypePrints.length > 0) { %>
<% if (contractTypePrints.length === 1) { %>
<div class="level-item">
<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>
@ -56,7 +56,7 @@
</div>
<div class="dropdown-menu">
<div class="dropdown-content">
<% for (const printName of ContractTypePrints) { %>
<% for (const printName of contractTypePrints) { %>
<% const printConfig = printFunctions.getPrintConfig(printName); %>
<% if (printConfig) { %>
<a class="dropdown-item" href="<%= urlPrefix %>/print/<%= printName %>/?contractId=<%= contract.contractId %>" target="_blank">
@ -73,8 +73,8 @@
<% } %>
<% if (user.userProperties.canUpdate) { %>
<div class="level-item">
<a class="button <%= (contract.occupancyEndDate ? "is-warning" : "is-primary") %>"
href="<%= urlPrefix %>/lotOccupancies/<%= contract.contractId %>/edit"
<a class="button <%= (contract.contractEndDate ? "is-warning" : "is-primary") %>"
href="<%= urlPrefix %>/contracts/<%= contract.contractId %>/edit"
accesskey="e">
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Switch to Edit Mode</span>
@ -89,41 +89,41 @@
<div class="columns">
<div class="column">
<p>
<strong><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</strong><br />
<strong>Contract Type</strong><br />
<%= contract.contractType %>
</p>
</div>
<div class="column">
<p class="mb-2">
<strong>Burial Site</strong><br />
<% if (contract.lotId) { %>
<a href="<%= urlPrefix %>/burialSites/<%= contract.lotId %>"><%= contract.lotName %></a>
<% } else { %>
<span class="has-text-grey">(No Burial Site)</span>
<% } %>
</p>
<p>
<strong><%= configFunctions.getConfigProperty("aliases.map") %></strong><br />
<% if (contract.mapId) { %>
<a href="<%= urlPrefix %>/maps/<%= contract.mapId %>"><%= contract.mapName %></a>
<% } else { %>
<span class="has-text-grey">(No <%= configFunctions.getConfigProperty("aliases.map") %>)</span>
<% } %>
</p>
<p class="mb-2">
<strong>Burial Site</strong><br />
<% if (contract.burialSiteId) { %>
<a href="<%= urlPrefix %>/burialSites/<%= contract.burialSiteId %>"><%= contract.burialSiteName %></a>
<% } else { %>
<span class="has-text-grey">(No Burial Site)</span>
<% } %>
</p>
<p>
<strong>Cemetery</strong><br />
<% if (contract.cemeteryId) { %>
<a href="<%= urlPrefix %>/cemeteries/<%= contract.cemeteryId %>"><%= contract.cemeteryName %></a>
<% } else { %>
<span class="has-text-grey">(No Cemetery)</span>
<% } %>
</p>
</div>
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></strong><br />
<%= contract.occupancyStartDateString %>
</p>
<p>
<strong>End Date</strong><br />
<% if (contract.occupancyEndDateString === "") { %>
<span class="has-text-grey">(No End Date)</span>
<% } else { %>
<%= contract.occupancyEndDateString %>
<% } %>
</p>
<p class="mb-2">
<strong>Contract Date</strong><br />
<%= contract.contractStartDateString %>
</p>
<p>
<strong>End Date</strong><br />
<% if (contract.contractEndDateString === "") { %>
<span class="has-text-grey">(No End Date)</span>
<% } else { %>
<%= contract.contractEndDateString %>
<% } %>
</p>
</div>
<% if (contract.contractFields.length > 0) { %>
<div class="column">
@ -143,162 +143,120 @@
</div>
</div>
<div class="panel">
<div class="panel-heading">
<div class="level is-mobile">
<div class="level-left">
<div class="level-item">
<h2 class="has-text-weight-bold is-size-5"><%= configFunctions.getConfigProperty("aliases.occupants") %></h2>
</div>
</div>
<div class="level-right">
<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>
<span class="icon is-small"><i class="fas fa-download" aria-hidden="true"></i></span>
<span>Export</span>
</a>
<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="panel-block is-block">
<% if (contract.contractOccupants.length === 0) { %>
<div class="message is-warning">
<p class="message-body">
There are no <%= configFunctions.getConfigProperty("aliases.occupants").toLowerCase() %>
associated with this record.
</p>
</div>
<% } else { %>
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th><%= configFunctions.getConfigProperty("aliases.occupant") %></th>
<th>Address</th>
<th>Other Contact</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<% for (const contractOccupant of contract.contractOccupants) { %>
<tr>
<td>
<%= contractOccupant.occupantName %> <%= contractOccupant.occupantFamilyName %><br />
<span class="tag">
<i class="fas fa-fw fa-<%= contractOccupant.fontAwesomeIconClass %>" aria-hidden="true"></i>
<span class="ml-1"><%= contractOccupant.lotOccupantType %></span>
</span>
</td>
<td>
<% if (contractOccupant.occupantAddress1) { %>
<%= contractOccupant.occupantAddress1 %><br />
<% } %>
<% if (contractOccupant.occupantAddress2) { %>
<%= contractOccupant.occupantAddress2 %><br />
<% } %>
<% if (contractOccupant.occupantCity) { %>
<%= contractOccupant.occupantCity %>,
<% } %>
<%= contractOccupant.occupantProvince %><br />
<%= contractOccupant.occupantPostalCode %>
</td>
<td>
<% if (contractOccupant.occupantPhoneNumber) { %>
<%= contractOccupant.occupantPhoneNumber %><br />
<% } %>
<%= contractOccupant.occupantEmailAddress %>
</td>
<td>
<span data-tooltip="<%= (contractOccupant.occupantCommentTitle ?? '') === '' ? 'Comment' : contractOccupant.occupantCommentTitle %>">
<%= contractOccupant.occupantComment %>
</span>
</td>
</tr>
<% } %>
</tbody>
</table>
<% } %>
</div>
</div>
<% if (contract.contractComments.length > 0) { %>
<div class="column">
<div class="panel">
<h2 class="panel-heading">Comments</h2>
<div class="panel-heading">
<div class="level is-mobile">
<div class="level-left">
<div class="level-item">
<h2 class="has-text-weight-bold is-size-5">
<%= (contract.isPreneed ? "Recipient" : "Deceased") %>
</h2>
</div>
</div>
<div class="level-right">
<div class="level-item">
<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>Export</span>
</a>
</div>
</div>
</div>
</div>
<div class="panel-block is-block">
<% if (contract.contractInterments.length === 0) { %>
<div class="message is-warning">
<p class="message-body">
There are no interments associated with this record.
</p>
</div>
<% } else { %>
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Commentor</th>
<th>Comment Date</th>
<th>Comment</th>
<th><%= (contract.isPreneed ? "Recipient" : "Deceased") %></th>
<th>Address</th>
</tr>
</thead>
<tbody>
<% for (const contractComment of contract.contractComments) { %>
<% for (const contractInterment of contract.contractInterments) { %>
<tr>
<td><%= contractComment.recordCreate_userName %></td>
<td>
<%= contractComment.contractCommentDateString %>
<%= (contractComment.contractCommentTime === 0 ? "" : contractComment.contractCommentTimePeriodString) %>
<%= contractInterment.deceasedName %><br />
<span class="is-size-7">
<% if (contractInterment.deceasedAddress1) { %>
<%= contractInterment.deceasedAddress1 %><br />
<% } %>
<% if (contractInterment.deceasedAddress2) { %>
<%= contractInterment.deceasedAddress2 %><br />
<% } %>
<% if (contractInterment.deceasedCity) { %>
<%= contractInterment.deceasedCity %>,
<% } %>
<%= contractInterment.deceasedProvince %><br />
<%= contractInterment.deceasedPostalCode %>
</span>
</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>
</div>
<div class="columns">
<div class="column">
@ -306,63 +264,63 @@
<h2 class="panel-heading">Fees</h2>
<div class="panel-block is-block">
<% if (contract.contractFees.length === 0) { %>
<div class="message is-info">
<p class="message-body">
There are no fees applied to this <%= configFunctions.getConfigProperty("aliases.occupancy").toLowerCase() %> record.
</p>
</div>
<div class="message is-info">
<p class="message-body">
There are no fees applied to this contract.
</p>
</div>
<% } else { %>
<%
let feeAmountTotal = 0;
let taxAmountTotal = 0;
%>
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Fee</th>
<th class="has-text-right"><span class="is-sr-only">Unit Cost</span></th>
<th class="has-width-1"><span class="is-sr-only">&times;</span></th>
<th class="has-width-1 has-text-right"><span class="is-sr-only">Quantity</span></th>
<th class="has-width-1"><span class="is-sr-only">=</span></th>
<th class="has-width-1 has-text-right">Total</th>
</tr>
</thead>
<tbody>
<% for (const contractFee of contract.contractFees) { %>
<%
feeAmountTotal += (contractFee.feeAmount * contractFee.quantity);
taxAmountTotal += (contractFee.taxAmount * contractFee.quantity);
%>
<tr>
<td colspan="<%= (contractFee.quantity === 1 ? "5" : "1") %>">
<%= contractFee.feeName %><br />
<span class="tag"><%= contractFee.feeCategory %></span>
</td>
<% if (contractFee.quantity !== 1) { %>
<td class="has-text-right">$<%= contractFee.feeAmount.toFixed(2) %></td>
<td>&times;</td>
<td class="has-text-right"><%= contractFee.quantity %></td>
<td>=</td>
<% } %>
<td class="has-text-right">$<%= (contractFee.feeAmount * contractFee.quantity).toFixed(2) %></td>
</tr>
<% } %>
</tbody>
<tfoot>
<tr>
<th colspan="5">Subtotal</th>
<td class="has-text-right has-text-weight-bold">$<%= feeAmountTotal.toFixed(2) %></td>
</tr>
<tr>
<th colspan="5">Tax</th>
<td class="has-text-right">$<%= taxAmountTotal.toFixed(2) %></td>
</tr>
<tr>
<th colspan="5">Grand Total</th>
<td class="has-text-right has-text-weight-bold">$<%= (feeAmountTotal + taxAmountTotal).toFixed(2) %></td>
</tr>
</tfoot>
</table>
<%
let feeAmountTotal = 0;
let taxAmountTotal = 0;
%>
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Fee</th>
<th class="has-text-right"><span class="is-sr-only">Unit Cost</span></th>
<th class="has-width-1"><span class="is-sr-only">&times;</span></th>
<th class="has-width-1 has-text-right"><span class="is-sr-only">Quantity</span></th>
<th class="has-width-1"><span class="is-sr-only">=</span></th>
<th class="has-width-1 has-text-right">Total</th>
</tr>
</thead>
<tbody>
<% for (const contractFee of contract.contractFees) { %>
<%
feeAmountTotal += (contractFee.feeAmount * contractFee.quantity);
taxAmountTotal += (contractFee.taxAmount * contractFee.quantity);
%>
<tr>
<td colspan="<%= (contractFee.quantity === 1 ? "5" : "1") %>">
<%= contractFee.feeName %><br />
<span class="tag"><%= contractFee.feeCategory %></span>
</td>
<% if (contractFee.quantity !== 1) { %>
<td class="has-text-right">$<%= contractFee.feeAmount.toFixed(2) %></td>
<td>&times;</td>
<td class="has-text-right"><%= contractFee.quantity %></td>
<td>=</td>
<% } %>
<td class="has-text-right">$<%= (contractFee.feeAmount * contractFee.quantity).toFixed(2) %></td>
</tr>
<% } %>
</tbody>
<tfoot>
<tr>
<th colspan="5">Subtotal</th>
<td class="has-text-right has-text-weight-bold">$<%= feeAmountTotal.toFixed(2) %></td>
</tr>
<tr>
<th colspan="5">Tax</th>
<td class="has-text-right">$<%= taxAmountTotal.toFixed(2) %></td>
</tr>
<tr>
<th colspan="5">Grand Total</th>
<td class="has-text-right has-text-weight-bold">$<%= (feeAmountTotal + taxAmountTotal).toFixed(2) %></td>
</tr>
</tfoot>
</table>
<% } %>
</div>
</div>
@ -374,7 +332,7 @@
<% if (contract.contractTransactions.length === 0) { %>
<div class="message is-info">
<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>
</div>
<% } else { %>
@ -435,6 +393,85 @@
</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('_footerB'); -%>

View File

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

View File

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

View File

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

View File

@ -14,26 +14,26 @@
</a>
</li>
<li>
<a href="#tab--lotOccupancies" aria-label="<%= configFunctions.getConfigProperty("aliases.occupancies") %>">
<a href="#tab--contracts" aria-label="Contracts">
<span class="icon">
<span class="fa-layers fa-fw" aria-hidden="true">
<i class="fas fa-vector-square"></i>
<i class="fas fa-user" data-fa-transform="shrink-10"></i>
</span>
<span class="fa-layers fa-fw" aria-hidden="true">
<i class="fas fa-vector-square"></i>
<i class="fas fa-user" data-fa-transform="shrink-10"></i>
</span>
</span>
<span class="is-hidden-touch"><%= configFunctions.getConfigProperty("aliases.occupancies") %></span>
<span class="is-hidden-touch">Contacts</span>
</a>
</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="is-hidden-touch">Burial Sites</span>
</a>
</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="is-hidden-touch"><%= configFunctions.getConfigProperty("aliases.maps") %></span>
<span class="is-hidden-touch">Cemeteries</span>
</a>
</li>
</ul>
@ -113,11 +113,11 @@
</div>
</div>
<div class="is-hidden" id="tab--lotOccupancies">
<h1 class="title is-1"><%= configFunctions.getConfigProperty("aliases.occupancy") %> Reports</h1>
<div class="is-hidden" id="tab--contracts">
<h1 class="title is-1">Contract Reports</h1>
<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">
<span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i>
@ -126,24 +126,24 @@
</div>
<div>
<h2 class="title is-5 is-marginless">
Current <%= configFunctions.getConfigProperty("aliases.occupancy") %> By <%= configFunctions.getConfigProperty("aliases.map") %>
Current Contract By Cemetery
</h2>
<div class="field has-addons mt-2">
<div class="control">
<label class="button is-small is-static" for="lotOccupancies-current-byMapId--mapId">
<%= configFunctions.getConfigProperty("aliases.map") %>
</label>
<label class="button is-small is-static" for="contracts-current-byCemeteryId--cemeteryId">
Cemetery
</label>
</div>
<div class="control is-expanded">
<div class="select is-small is-fullwidth">
<select id="lotOccupancies-current-byMapId--mapId" name="mapId">
<% for (const map of maps) { %>
<option value="<%= map.mapId %>">
<%= map.mapName || "(No Name)" %>
</option>
<% } %>
</select>
</div>
<div class="select is-small is-fullwidth">
<select id="contracts-current-byCemeteryId--cemeteryId" name="cemeteryId">
<% for (const cemetery of cemeteries) { %>
<option value="<%= cemetery.cemeteryId %>">
<%= cemetery.cemeteryName || "(No Name)" %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-small is-primary" type="submit">
@ -161,31 +161,31 @@
<span class="tag is-info">CSV</span>
</div>
<div>
<h2 class="title is-5 is-marginless">Transactions by Date</h2>
<div class="field has-addons mt-2">
<div class="control">
<label class="button is-small is-static" for="contractTransactions-byTransactionDateString--transactionDateString">
Transaction Date
</label>
</div>
<div class="control is-expanded">
<input class="input is-small" id="contractTransactions-byTransactionDateString--transactionDateString" name="transactionDateString" type="date" value="<%= dateTimeFunctions.dateToString(new Date()) %>" required />
</div>
<div class="control">
<button class="button is-small is-primary" type="submit">
Export
</button>
</div>
<h2 class="title is-5 is-marginless">Transactions by Date</h2>
<div class="field has-addons mt-2">
<div class="control">
<label class="button is-small is-static" for="contractTransactions-byTransactionDateString--transactionDateString">
Transaction Date
</label>
</div>
<div class="control is-expanded">
<input class="input is-small" id="contractTransactions-byTransactionDateString--transactionDateString" name="transactionDateString" type="date" value="<%= dateTimeFunctions.dateToString(new Date()) %>" required />
</div>
<div class="control">
<button class="button is-small is-primary" type="submit">
Export
</button>
</div>
</div>
</div>
</form>
</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>
<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">
<span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i>
@ -194,22 +194,22 @@
</div>
<div>
<h2 class="title is-5 is-marginless">
Burial Sites By <%= configFunctions.getConfigProperty("aliases.map") %>
Burial Sites By Cemetery
</h2>
<div class="field has-addons mt-2">
<div class="control">
<label class="button is-small is-static" for="lots-byMapId--mapId">
<%= configFunctions.getConfigProperty("aliases.map") %>
<label class="button is-small is-static" for="burialSites-byCemeteryId--cemeteryId">
Cemetery
</label>
</div>
<div class="control is-expanded">
<div class="select is-small is-fullwidth">
<select id="lots-byMapId--mapId" name="mapId">
<% for (const map of maps) { %>
<option value="<%= map.mapId %>">
<%= map.mapName || "(No Name)" %>
</option>
<% } %>
<select id="burialSites-byCemeteryId--cemeteryId" name="cemeteryId">
<% for (const cemetery of cemeteries) { %>
<option value="<%= cemetery.cemeteryId %>">
<%= cemetery.cemeteryName || "(No Name)" %>
</option>
<% } %>
</select>
</div>
</div>
@ -221,41 +221,41 @@
</div>
</div>
</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">
<span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i>
</span><br />
<span class="tag is-info">CSV</span>
<span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i>
</span><br />
<span class="tag is-info">CSV</span>
</div>
<div>
<h2 class="title is-5 is-marginless">Burial Sites By Type</h2>
<div class="field has-addons mt-2">
<div class="control">
<label class="button is-small is-static" for="lots-byburialSiteTypeId--burialSiteTypeId">
Burial Site Type
</label>
</div>
<div class="control is-expanded">
<div class="select is-small is-fullwidth">
<select id="lots-byburialSiteTypeId--burialSiteTypeId" name="burialSiteTypeId">
<% for (const lotType of lotTypes) { %>
<option value="<%= lotType.burialSiteTypeId %>">
<%= lotType.lotType %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-small is-primary" type="submit">
Export
</button>
<div class="control">
<label class="button is-small is-static" for="lots-byburialSiteTypeId--burialSiteTypeId">
Burial Site Type
</label>
</div>
<div class="control is-expanded">
<div class="select is-small is-fullwidth">
<select id="lots-byburialSiteTypeId--burialSiteTypeId" name="burialSiteTypeId">
<% for (const burialSiteType of burialSiteTypes) { %>
<option value="<%= burialSiteType.burialSiteTypeId %>">
<%= burialSiteType.burialSiteType %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-small is-primary" type="submit">
Export
</button>
</div>
</div>
</div>
</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">
<span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i>
@ -266,18 +266,18 @@
<h2 class="title is-5 is-marginless">Burial Sites By Status</h2>
<div class="field has-addons mt-2">
<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
</label>
</div>
<div class="control is-expanded">
<div class="select is-small is-fullwidth">
<select id="lots-byburialSiteStatusId--burialSiteStatusId" name="burialSiteStatusId">
<% for (const lotStatus of lotStatuses) { %>
<option value="<%= lotStatus.burialSiteStatusId %>">
<%= lotStatus.lotStatus %>
</option>
<% } %>
<select id="burialSites-byBurialSiteStatusId--burialSiteStatusId" name="burialSiteStatusId">
<% for (const burialSiteStatus of burialSiteStatuses) { %>
<option value="<%= burialSiteStatus.burialSiteStatusId %>">
<%= burialSiteStatus.burialSiteStatus %>
</option>
<% } %>
</select>
</div>
</div>
@ -291,8 +291,8 @@
</form>
</div>
</div>
<div class="is-hidden" id="tab--maps">
<h1 class="title is-1"><%= configFunctions.getConfigProperty("aliases.map") %> Reports</h1>
<div class="is-hidden" id="tab--cemeteries">
<h1 class="title is-1">Cemetery Reports</h1>
<div class="panel">
<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">
@ -302,9 +302,9 @@
<span class="tag is-info">CSV</span>
</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>
All active <%= configFunctions.getConfigProperty("aliases.maps").toLowerCase() %>.
All active cemeteries.
</p>
</div>
</a>
@ -322,7 +322,7 @@
<div class="columns">
<div class="column">
<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>
<div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info">
@ -563,7 +563,7 @@
</div>
<div class="column">
<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>
<div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info">
@ -632,6 +632,6 @@
<%- include('_footerA'); -%>
<script src="<%= urlPrefix %>/javascripts/reportSearch.js"></script>
<script src="<%= urlPrefix %>/javascripts/report.search.js"></script>
<%- include('_footerB'); -%>

View File

@ -244,7 +244,7 @@
<div class="box has-background-light has-text-right p-3">
<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>Add Related <%= configFunctions.getConfigProperty("aliases.occupancy") %></span>
<span>Add Related Contract</span>
</button>
</div>
<div id="container--lotOccupancies"></div>

View File

@ -101,9 +101,9 @@
</div>
<div class="column">
<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">
<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">
<i class="fas fa-search" aria-hidden="true"></i>
</span>

View File

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