refactoring contracts
parent
44119638c2
commit
48262b2d92
|
|
@ -1,21 +1,35 @@
|
|||
import { type DateString } from '@cityssm/utils-datetime';
|
||||
import type { PoolConnection } from 'better-sqlite-pool';
|
||||
export interface AddContractForm {
|
||||
contractTypeId: string | number;
|
||||
burialSiteId: string | number;
|
||||
contractStartDateString: string;
|
||||
contractEndDateString: string;
|
||||
contractStartDateString: DateString | '';
|
||||
contractEndDateString: DateString | '';
|
||||
contractTypeFieldIds?: string;
|
||||
[fieldValue_contractTypeFieldId: string]: unknown;
|
||||
lotOccupantTypeId?: string;
|
||||
occupantName?: string;
|
||||
occupantFamilyName?: string;
|
||||
occupantAddress1?: string;
|
||||
occupantAddress2?: string;
|
||||
occupantCity?: string;
|
||||
occupantProvince?: string;
|
||||
occupantPostalCode?: string;
|
||||
occupantPhoneNumber?: string;
|
||||
occupantEmailAddress?: string;
|
||||
occupantComment?: string;
|
||||
[fieldValue_contractTypeFieldId: `fieldValue_${string}`]: unknown;
|
||||
purchaserName?: string;
|
||||
purchaserAddress1?: string;
|
||||
purchaserAddress2?: string;
|
||||
purchaserCity?: string;
|
||||
purchaserProvince?: string;
|
||||
purchaserPostalCode?: string;
|
||||
purchaserPhoneNumber?: string;
|
||||
purchaserEmail?: string;
|
||||
purchaserRelationship?: string;
|
||||
funeralHomeId?: string | number;
|
||||
funeralDirectorName?: string;
|
||||
deceasedName?: string;
|
||||
deceasedAddress1?: string;
|
||||
deceasedAddress2?: string;
|
||||
deceasedCity?: string;
|
||||
deceasedProvince?: string;
|
||||
deceasedPostalCode?: string;
|
||||
birthDateString?: DateString | '';
|
||||
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>;
|
||||
|
|
|
|||
|
|
@ -1,21 +1,29 @@
|
|||
import { dateStringToInteger } from '@cityssm/utils-datetime';
|
||||
import addOrUpdateContractField from './addOrUpdateContractField.js';
|
||||
import { acquireConnection } from './pool.js';
|
||||
// eslint-disable-next-line complexity
|
||||
export default async function addContract(addForm, user, connectedDatabase) {
|
||||
const database = connectedDatabase ?? (await acquireConnection());
|
||||
const rightNowMillis = Date.now();
|
||||
const contractStartDate = dateStringToInteger(addForm.contractStartDateString);
|
||||
const result = database
|
||||
.prepare(`insert into Contracts (
|
||||
contractTypeId, lotId,
|
||||
contractTypeId, burialSiteId,
|
||||
contractStartDate, contractEndDate,
|
||||
purchaserName, purchaserAddress1, purchaserAddress2,
|
||||
purchaserCity, purchaserProvince, purchaserPostalCode,
|
||||
purchaserPhoneNumber, purchaserEmail, purchaserRelationship,
|
||||
funeralHomeId, funeralDirectorName,
|
||||
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), 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 ?? '', user.userName, rightNowMillis, user.userName, rightNowMillis);
|
||||
const contractId = result.lastInsertRowid;
|
||||
/*
|
||||
* Add contract fields
|
||||
*/
|
||||
const contractTypeFieldIds = (addForm.contractTypeFieldIds ?? '').split(',');
|
||||
for (const contractTypeFieldId of contractTypeFieldIds) {
|
||||
const fieldValue = addForm[`fieldValue_${contractTypeFieldId}`];
|
||||
|
|
@ -27,6 +35,34 @@ export default async function addContract(addForm, user, connectedDatabase) {
|
|||
}, user, database);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Add deceased information
|
||||
*/
|
||||
if ((addForm.deceasedName ?? '') !== '') {
|
||||
database
|
||||
.prepare(`insert into ContractInterments (
|
||||
contractId, intermentNumber,
|
||||
deceasedName, deceasedAddress1, deceasedAddress2,
|
||||
deceasedCity, deceasedProvince, deceasedPostalCode,
|
||||
birthDate, deathDate,
|
||||
birthPlace, deathPlace,
|
||||
intermentDate,
|
||||
intermentContainerTypeId, intermentCommittalTypeId,
|
||||
recordCreate_userName, recordCreate_timeMillis,
|
||||
recordUpdate_userName, recordUpdate_timeMillis)
|
||||
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 === ''
|
||||
? undefined
|
||||
: dateStringToInteger(addForm.intermentDateString), addForm.intermentContainerTypeId === ''
|
||||
? undefined
|
||||
: addForm.intermentContainerTypeId, addForm.intermentCommittalTypeId === ''
|
||||
? undefined
|
||||
: addForm.intermentCommittalTypeId, user.userName, rightNowMillis, user.userName, rightNowMillis);
|
||||
}
|
||||
if (connectedDatabase === undefined) {
|
||||
database.release();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import { type DateString, dateStringToInteger } from '@cityssm/utils-datetime'
|
||||
import {
|
||||
type DateString,
|
||||
dateStringToInteger
|
||||
} from '@cityssm/utils-datetime'
|
||||
import type { PoolConnection } from 'better-sqlite-pool'
|
||||
|
||||
import addOrUpdateContractField from './addOrUpdateContractField.js'
|
||||
|
|
@ -8,25 +11,42 @@ export interface AddContractForm {
|
|||
contractTypeId: string | number
|
||||
burialSiteId: string | number
|
||||
|
||||
contractStartDateString: string
|
||||
contractEndDateString: string
|
||||
contractStartDateString: DateString | ''
|
||||
contractEndDateString: DateString | ''
|
||||
|
||||
contractTypeFieldIds?: string
|
||||
[fieldValue_contractTypeFieldId: string]: unknown
|
||||
[fieldValue_contractTypeFieldId: `fieldValue_${string}`]: unknown
|
||||
|
||||
lotOccupantTypeId?: string
|
||||
occupantName?: string
|
||||
occupantFamilyName?: string
|
||||
occupantAddress1?: string
|
||||
occupantAddress2?: string
|
||||
occupantCity?: string
|
||||
occupantProvince?: string
|
||||
occupantPostalCode?: string
|
||||
occupantPhoneNumber?: string
|
||||
occupantEmailAddress?: string
|
||||
occupantComment?: string
|
||||
purchaserName?: string
|
||||
purchaserAddress1?: string
|
||||
purchaserAddress2?: string
|
||||
purchaserCity?: string
|
||||
purchaserProvince?: string
|
||||
purchaserPostalCode?: string
|
||||
purchaserPhoneNumber?: string
|
||||
purchaserEmail?: string
|
||||
purchaserRelationship?: string
|
||||
|
||||
funeralHomeId?: string | number
|
||||
funeralDirectorName?: string
|
||||
|
||||
deceasedName?: string
|
||||
deceasedAddress1?: string
|
||||
deceasedAddress2?: string
|
||||
deceasedCity?: string
|
||||
deceasedProvince?: string
|
||||
deceasedPostalCode?: string
|
||||
|
||||
birthDateString?: DateString | ''
|
||||
birthPlace?: string
|
||||
deathDateString?: DateString | ''
|
||||
deathPlace?: string
|
||||
intermentDateString?: DateString | ''
|
||||
intermentContainerTypeId?: string | number
|
||||
intermentCommittalTypeId?: string | number
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
export default async function addContract(
|
||||
addForm: AddContractForm,
|
||||
user: User,
|
||||
|
|
@ -43,11 +63,15 @@ export default async function addContract(
|
|||
const result = database
|
||||
.prepare(
|
||||
`insert into Contracts (
|
||||
contractTypeId, lotId,
|
||||
contractTypeId, burialSiteId,
|
||||
contractStartDate, contractEndDate,
|
||||
purchaserName, purchaserAddress1, purchaserAddress2,
|
||||
purchaserCity, purchaserProvince, purchaserPostalCode,
|
||||
purchaserPhoneNumber, purchaserEmail, purchaserRelationship,
|
||||
funeralHomeId, funeralDirectorName,
|
||||
recordCreate_userName, recordCreate_timeMillis,
|
||||
recordUpdate_userName, recordUpdate_timeMillis)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
addForm.contractTypeId,
|
||||
|
|
@ -56,6 +80,17 @@ export default async function addContract(
|
|||
addForm.contractEndDateString === ''
|
||||
? undefined
|
||||
: dateStringToInteger(addForm.contractEndDateString as DateString),
|
||||
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,
|
||||
|
|
@ -64,6 +99,10 @@ export default async function addContract(
|
|||
|
||||
const contractId = result.lastInsertRowid as number
|
||||
|
||||
/*
|
||||
* Add contract fields
|
||||
*/
|
||||
|
||||
const contractTypeFieldIds = (addForm.contractTypeFieldIds ?? '').split(',')
|
||||
|
||||
for (const contractTypeFieldId of contractTypeFieldIds) {
|
||||
|
|
@ -84,6 +123,59 @@ export default async function addContract(
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add deceased information
|
||||
*/
|
||||
|
||||
if ((addForm.deceasedName ?? '') !== '') {
|
||||
database
|
||||
.prepare(
|
||||
`insert into ContractInterments (
|
||||
contractId, intermentNumber,
|
||||
deceasedName, deceasedAddress1, deceasedAddress2,
|
||||
deceasedCity, deceasedProvince, deceasedPostalCode,
|
||||
birthDate, deathDate,
|
||||
birthPlace, deathPlace,
|
||||
intermentDate,
|
||||
intermentContainerTypeId, intermentCommittalTypeId,
|
||||
recordCreate_userName, recordCreate_timeMillis,
|
||||
recordUpdate_userName, recordUpdate_timeMillis)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
|
||||
.run(
|
||||
contractId,
|
||||
1,
|
||||
addForm.deceasedName ?? '',
|
||||
addForm.deceasedAddress1 ?? '',
|
||||
addForm.deceasedAddress2 ?? '',
|
||||
addForm.deceasedCity ?? '',
|
||||
addForm.deceasedProvince ?? '',
|
||||
addForm.deceasedPostalCode ?? '',
|
||||
addForm.birthDateString === ''
|
||||
? undefined
|
||||
: dateStringToInteger(addForm.birthDateString as DateString),
|
||||
addForm.deathDateString === ''
|
||||
? undefined
|
||||
: 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,
|
||||
rightNowMillis
|
||||
)
|
||||
}
|
||||
|
||||
if (connectedDatabase === undefined) {
|
||||
database.release()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
export interface AddForm {
|
||||
contractType: string;
|
||||
isPreneed?: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export default function addContractType(addForm: AddForm, user: User): Promise<number>;
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { clearCacheByTableName } from '../helpers/functions.cache.js';
|
||||
import { acquireConnection } from './pool.js';
|
||||
export default async function addContractType(addForm, user) {
|
||||
const database = await acquireConnection();
|
||||
const rightNowMillis = Date.now();
|
||||
const result = database
|
||||
.prepare(`insert into ContractTypes (
|
||||
contractType, isPreneed, orderNumber,
|
||||
recordCreate_userName, recordCreate_timeMillis,
|
||||
recordUpdate_userName, recordUpdate_timeMillis)
|
||||
values (?, ?, ?, ?, ?, ?, ?)`)
|
||||
.run(addForm.contractType, addForm.isPreneed === undefined ? 0 : 1, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
|
||||
database.release();
|
||||
clearCacheByTableName('ContractTypes');
|
||||
return result.lastInsertRowid;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
import { clearCacheByTableName } from '../helpers/functions.cache.js'
|
||||
import { acquireConnection } from './pool.js'
|
||||
|
||||
export interface AddForm {
|
||||
contractType: string
|
||||
isPreneed?: string
|
||||
orderNumber?: number
|
||||
}
|
||||
|
||||
export default async function addContractType(
|
||||
addForm: AddForm,
|
||||
user: User
|
||||
): Promise<number> {
|
||||
const database = await acquireConnection()
|
||||
|
||||
const rightNowMillis = Date.now()
|
||||
|
||||
const result = database
|
||||
.prepare(
|
||||
`insert into ContractTypes (
|
||||
contractType, isPreneed, orderNumber,
|
||||
recordCreate_userName, recordCreate_timeMillis,
|
||||
recordUpdate_userName, recordUpdate_timeMillis)
|
||||
values (?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
addForm.contractType,
|
||||
addForm.isPreneed === undefined ? 0 : 1,
|
||||
addForm.orderNumber ?? -1,
|
||||
user.userName,
|
||||
rightNowMillis,
|
||||
user.userName,
|
||||
rightNowMillis
|
||||
)
|
||||
|
||||
database.release()
|
||||
|
||||
clearCacheByTableName('ContractTypes')
|
||||
|
||||
return result.lastInsertRowid as number
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
type RecordTable = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'ContractTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes';
|
||||
type RecordTable = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'IntermentContainerTypes' | 'IntermentCommittalTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes';
|
||||
export default function addRecord(recordTable: RecordTable, recordName: string, orderNumber: number | string, user: User): Promise<number>;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ import { acquireConnection } from './pool.js';
|
|||
const recordNameColumns = new Map();
|
||||
recordNameColumns.set('BurialSiteStatuses', 'burialSiteStatus');
|
||||
recordNameColumns.set('BurialSiteTypes', 'burialSiteType');
|
||||
recordNameColumns.set('ContractTypes', 'contractType');
|
||||
recordNameColumns.set('IntermentContainerTypes', 'intermentContainerType');
|
||||
recordNameColumns.set('IntermentCommittalTypes', 'intermentCommittalType');
|
||||
recordNameColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneType');
|
||||
recordNameColumns.set('WorkOrderTypes', 'workOrderType');
|
||||
export default async function addRecord(recordTable, recordName, orderNumber, user) {
|
||||
|
|
|
|||
|
|
@ -5,14 +5,16 @@ import { acquireConnection } from './pool.js'
|
|||
type RecordTable =
|
||||
| 'BurialSiteStatuses'
|
||||
| 'BurialSiteTypes'
|
||||
| 'ContractTypes'
|
||||
| 'IntermentContainerTypes'
|
||||
| 'IntermentCommittalTypes'
|
||||
| 'WorkOrderMilestoneTypes'
|
||||
| 'WorkOrderTypes'
|
||||
|
||||
const recordNameColumns = new Map<RecordTable, string>()
|
||||
recordNameColumns.set('BurialSiteStatuses', 'burialSiteStatus')
|
||||
recordNameColumns.set('BurialSiteTypes', 'burialSiteType')
|
||||
recordNameColumns.set('ContractTypes', 'contractType')
|
||||
recordNameColumns.set('IntermentContainerTypes', 'intermentContainerType')
|
||||
recordNameColumns.set('IntermentCommittalTypes', 'intermentCommittalType')
|
||||
recordNameColumns.set('WorkOrderMilestoneTypes', 'workOrderMilestoneType')
|
||||
recordNameColumns.set('WorkOrderTypes', 'workOrderType')
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { dateIntegerToString } from '@cityssm/utils-datetime';
|
|||
import getContractComments from './getContractComments.js';
|
||||
import getContractFees from './getContractFees.js';
|
||||
import getContractFields from './getContractFields.js';
|
||||
// import getContractOccupants from './getContractOccupants.js'
|
||||
import getContractInterments from './getContractInterments.js';
|
||||
import getContractTransactions from './getContractTransactions.js';
|
||||
import { getWorkOrders } from './getWorkOrders.js';
|
||||
import { acquireConnection } from './pool.js';
|
||||
|
|
@ -11,29 +11,26 @@ export default async function getContract(contractId, connectedDatabase) {
|
|||
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
||||
const contract = database
|
||||
.prepare(`select o.contractId,
|
||||
o.contractTypeId, t.contractType,
|
||||
o.burialSiteId,
|
||||
l.burialSiteName,
|
||||
l.burialSiteTypeId,
|
||||
o.contractTypeId, t.contractType, t.isPreneed,
|
||||
o.burialSiteId, l.burialSiteName, l.burialSiteTypeId,
|
||||
l.cemeteryId, m.cemeteryName,
|
||||
o.contractStartDate, userFn_dateIntegerToString(o.contractStartDate) as contractStartDateString,
|
||||
o.contractEndDate, userFn_dateIntegerToString(o.contractEndDate) as contractEndDateString,
|
||||
o.purchaserName, o.purchaserAddress1, o.purchaserAddress2,
|
||||
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
|
||||
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
|
||||
o.funeralHomeId, o.funeralDirectorName,
|
||||
o.recordUpdate_timeMillis
|
||||
from Contracts o
|
||||
left join ContractTypes t on o.contractTypeId = t.contractTypeId
|
||||
left join BurialSites l on o.burialSiteId = l.burialSiteId
|
||||
left join Maps m on l.cemeteryId = m.cemeteryId
|
||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||
where o.recordDelete_timeMillis is null
|
||||
and o.contractId = ?`)
|
||||
.get(contractId);
|
||||
if (contract !== undefined) {
|
||||
contract.contractFields = await getContractFields(contractId, database);
|
||||
/*
|
||||
contract.contractInterments = await getContractOccupants(
|
||||
contractId,
|
||||
database
|
||||
)
|
||||
*/
|
||||
contract.contractInterments = await getContractInterments(contractId, database);
|
||||
contract.contractComments = await getContractComments(contractId, database);
|
||||
contract.contractFees = await getContractFees(contractId, database);
|
||||
contract.contractTransactions = await getContractTransactions(contractId, { includeIntegrations: true }, database);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import type { Contract } from '../types/recordTypes.js'
|
|||
import getContractComments from './getContractComments.js'
|
||||
import getContractFees from './getContractFees.js'
|
||||
import getContractFields from './getContractFields.js'
|
||||
// import getContractOccupants from './getContractOccupants.js'
|
||||
import getContractInterments from './getContractInterments.js'
|
||||
import getContractTransactions from './getContractTransactions.js'
|
||||
import { getWorkOrders } from './getWorkOrders.js'
|
||||
import { acquireConnection } from './pool.js'
|
||||
|
|
@ -22,42 +22,35 @@ export default async function getContract(
|
|||
const contract = database
|
||||
.prepare(
|
||||
`select o.contractId,
|
||||
o.contractTypeId, t.contractType,
|
||||
o.burialSiteId,
|
||||
l.burialSiteName,
|
||||
l.burialSiteTypeId,
|
||||
o.contractTypeId, t.contractType, t.isPreneed,
|
||||
o.burialSiteId, l.burialSiteName, l.burialSiteTypeId,
|
||||
l.cemeteryId, m.cemeteryName,
|
||||
o.contractStartDate, userFn_dateIntegerToString(o.contractStartDate) as contractStartDateString,
|
||||
o.contractEndDate, userFn_dateIntegerToString(o.contractEndDate) as contractEndDateString,
|
||||
o.purchaserName, o.purchaserAddress1, o.purchaserAddress2,
|
||||
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
|
||||
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
|
||||
o.funeralHomeId, o.funeralDirectorName,
|
||||
o.recordUpdate_timeMillis
|
||||
from Contracts o
|
||||
left join ContractTypes t on o.contractTypeId = t.contractTypeId
|
||||
left join BurialSites l on o.burialSiteId = l.burialSiteId
|
||||
left join Maps m on l.cemeteryId = m.cemeteryId
|
||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||
where o.recordDelete_timeMillis is null
|
||||
and o.contractId = ?`
|
||||
)
|
||||
.get(contractId) as Contract | undefined
|
||||
|
||||
if (contract !== undefined) {
|
||||
contract.contractFields = await getContractFields(
|
||||
contractId,
|
||||
database
|
||||
)
|
||||
/*
|
||||
contract.contractInterments = await getContractOccupants(
|
||||
contractId,
|
||||
database
|
||||
)
|
||||
*/
|
||||
contract.contractComments = await getContractComments(
|
||||
contractId,
|
||||
database
|
||||
)
|
||||
contract.contractFees = await getContractFees(
|
||||
contract.contractFields = await getContractFields(contractId, database)
|
||||
|
||||
contract.contractInterments = await getContractInterments(
|
||||
contractId,
|
||||
database
|
||||
)
|
||||
|
||||
contract.contractComments = await getContractComments(contractId, database)
|
||||
contract.contractFees = await getContractFees(contractId, database)
|
||||
contract.contractTransactions = await getContractTransactions(
|
||||
contractId,
|
||||
{ includeIntegrations: true },
|
||||
|
|
|
|||
|
|
@ -1,23 +1,21 @@
|
|||
import { dateIntegerToString, timeIntegerToString } from '@cityssm/utils-datetime';
|
||||
import { dateIntegerToString } from '@cityssm/utils-datetime';
|
||||
import { acquireConnection } from './pool.js';
|
||||
export default async function getContractInterments(contractId, connectedDatabase) {
|
||||
const database = connectedDatabase ?? (await acquireConnection());
|
||||
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
||||
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
||||
const interments = database
|
||||
.prepare(`select o.contractId, o.intermentNumber,
|
||||
o.isCremated,
|
||||
o.deceasedName,
|
||||
birthDate, userFn_dateIntegerToString(birthDate) as birthDateString,
|
||||
birthPlace,
|
||||
deathDate, userFn_dateIntegerToString(deathDate) as deathDateString,
|
||||
deathPlace,
|
||||
o.birthDate, userFn_dateIntegerToString(o.birthDate) as birthDateString,
|
||||
o.birthPlace,
|
||||
o.deathDate, userFn_dateIntegerToString(o.deathDate) as deathDateString,
|
||||
o.deathPlace,
|
||||
|
||||
intermentDate, userFn_dateIntegerToString(intermentDate) as intermentDateString,
|
||||
intermentTime, userFn_timeIntegerToString(intermentTime) as intermentTimeString,
|
||||
o.intermentDate, userFn_dateIntegerToString(o.intermentDate) as intermentDateString,
|
||||
|
||||
intermentContainerTypeId, t.intermentContainerType,
|
||||
intermentCommittalTypeId, c.intermentCommittalType
|
||||
o.intermentContainerTypeId, t.intermentContainerType,
|
||||
o.intermentCommittalTypeId, c.intermentCommittalType
|
||||
|
||||
from ContractInterments o
|
||||
left join IntermentContainerTypes t on o.intermentContainerTypeId = t.intermentContainerTypeId
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import {
|
||||
dateIntegerToString,
|
||||
timeIntegerToString
|
||||
dateIntegerToString
|
||||
} from '@cityssm/utils-datetime'
|
||||
import type { PoolConnection } from 'better-sqlite-pool'
|
||||
|
||||
|
|
@ -15,23 +14,21 @@ export default async function getContractInterments(
|
|||
const database = connectedDatabase ?? (await acquireConnection())
|
||||
|
||||
database.function('userFn_dateIntegerToString', dateIntegerToString)
|
||||
database.function('userFn_timeIntegerToString', timeIntegerToString)
|
||||
|
||||
const interments = database
|
||||
.prepare(
|
||||
`select o.contractId, o.intermentNumber,
|
||||
o.isCremated,
|
||||
o.deceasedName,
|
||||
birthDate, userFn_dateIntegerToString(birthDate) as birthDateString,
|
||||
birthPlace,
|
||||
deathDate, userFn_dateIntegerToString(deathDate) as deathDateString,
|
||||
deathPlace,
|
||||
o.birthDate, userFn_dateIntegerToString(o.birthDate) as birthDateString,
|
||||
o.birthPlace,
|
||||
o.deathDate, userFn_dateIntegerToString(o.deathDate) as deathDateString,
|
||||
o.deathPlace,
|
||||
|
||||
intermentDate, userFn_dateIntegerToString(intermentDate) as intermentDateString,
|
||||
intermentTime, userFn_timeIntegerToString(intermentTime) as intermentTimeString,
|
||||
o.intermentDate, userFn_dateIntegerToString(o.intermentDate) as intermentDateString,
|
||||
|
||||
intermentContainerTypeId, t.intermentContainerType,
|
||||
intermentCommittalTypeId, c.intermentCommittalType
|
||||
o.intermentContainerTypeId, t.intermentContainerType,
|
||||
o.intermentCommittalTypeId, c.intermentCommittalType
|
||||
|
||||
from ContractInterments o
|
||||
left join IntermentContainerTypes t on o.intermentContainerTypeId = t.intermentContainerTypeId
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
|||
export default async function getContractTypes() {
|
||||
const database = await acquireConnection();
|
||||
const contractTypes = database
|
||||
.prepare(`select contractTypeId, contractType, orderNumber
|
||||
.prepare(`select contractTypeId, contractType, isPreneed, orderNumber
|
||||
from ContractTypes
|
||||
where recordDelete_timeMillis is null
|
||||
order by orderNumber, contractType`)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default async function getContractTypes(): Promise<ContractType[]> {
|
|||
|
||||
const contractTypes = database
|
||||
.prepare(
|
||||
`select contractTypeId, contractType, orderNumber
|
||||
`select contractTypeId, contractType, isPreneed, orderNumber
|
||||
from ContractTypes
|
||||
where recordDelete_timeMillis is null
|
||||
order by orderNumber, contractType`
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { getConfigProperty } from '../helpers/config.helpers.js';
|
|||
import { getContractTypeById } from '../helpers/functions.cache.js';
|
||||
import { getBurialSiteNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWhereClause } from '../helpers/functions.sqlFilters.js';
|
||||
import getContractFees from './getContractFees.js';
|
||||
// import getContractOccupants from './getContractOccupants.js'
|
||||
import getContractInterments from './getContractInterments.js';
|
||||
import getContractTransactions from './getContractTransactions.js';
|
||||
import { acquireConnection } from './pool.js';
|
||||
function buildWhereClause(filters) {
|
||||
|
|
@ -70,18 +70,11 @@ async function addInclusions(contract, options, database) {
|
|||
contract.contractFees = await getContractFees(contract.contractId, database);
|
||||
}
|
||||
if (options.includeTransactions) {
|
||||
contract.contractTransactions =
|
||||
await getContractTransactions(contract.contractId, { includeIntegrations: false }, database);
|
||||
contract.contractTransactions = await getContractTransactions(contract.contractId, { includeIntegrations: false }, database);
|
||||
}
|
||||
/*
|
||||
if (options.includeInterments) {
|
||||
contract.contractInterments =
|
||||
await getContractOccupants(
|
||||
contract.contractId,
|
||||
database
|
||||
)
|
||||
contract.contractInterments = await getContractInterments(contract.contractId, database);
|
||||
}
|
||||
*/
|
||||
return contract;
|
||||
}
|
||||
export default async function getContracts(filters, options, connectedDatabase) {
|
||||
|
|
@ -95,21 +88,24 @@ export default async function getContracts(filters, options, connectedDatabase)
|
|||
if (isLimited) {
|
||||
count = database
|
||||
.prepare(`select count(*) as recordCount
|
||||
from Contracts o
|
||||
left join BurialSites l on o.burialSiteId = l.burialSiteId
|
||||
${sqlWhereClause}`)
|
||||
from Contracts o
|
||||
left join BurialSites l on o.burialSiteId = l.burialSiteId
|
||||
${sqlWhereClause}`)
|
||||
.get(sqlParameters).recordCount;
|
||||
}
|
||||
let contracts = [];
|
||||
if (count !== 0) {
|
||||
contracts = database
|
||||
.prepare(`select o.contractId,
|
||||
o.contractTypeId, t.contractType,
|
||||
o.burialSiteId, lt.burialSiteType,
|
||||
l.burialSiteName,
|
||||
o.contractTypeId, t.contractType, t.isPreneed,
|
||||
o.burialSiteId, lt.burialSiteType, l.burialSiteName,
|
||||
l.cemeteryId, m.cemeteryName,
|
||||
o.contractStartDate, userFn_dateIntegerToString(o.contractStartDate) as contractStartDateString,
|
||||
o.contractEndDate, userFn_dateIntegerToString(o.contractEndDate) as contractEndDateString
|
||||
o.contractEndDate, userFn_dateIntegerToString(o.contractEndDate) as contractEndDateString,
|
||||
o.purchaserName, o.purchaserAddress1, o.purchaserAddress2,
|
||||
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
|
||||
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
|
||||
o.funeralHomeId, o.funeralDirectorName
|
||||
from Contracts o
|
||||
left join ContractTypes t on o.contractTypeId = t.contractTypeId
|
||||
left join BurialSites l on o.burialSiteId = l.burialSiteId
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
import type { Contract } from '../types/recordTypes.js'
|
||||
|
||||
import getContractFees from './getContractFees.js'
|
||||
// import getContractOccupants from './getContractOccupants.js'
|
||||
import getContractInterments from './getContractInterments.js'
|
||||
import getContractTransactions from './getContractTransactions.js'
|
||||
import { acquireConnection } from './pool.js'
|
||||
|
||||
|
|
@ -139,30 +139,23 @@ async function addInclusions(
|
|||
database: PoolConnection
|
||||
): Promise<Contract> {
|
||||
if (options.includeFees) {
|
||||
contract.contractFees = await getContractFees(
|
||||
contract.contractFees = await getContractFees(contract.contractId, database)
|
||||
}
|
||||
|
||||
if (options.includeTransactions) {
|
||||
contract.contractTransactions = await getContractTransactions(
|
||||
contract.contractId,
|
||||
{ includeIntegrations: false },
|
||||
database
|
||||
)
|
||||
}
|
||||
|
||||
if (options.includeTransactions) {
|
||||
contract.contractTransactions =
|
||||
await getContractTransactions(
|
||||
contract.contractId,
|
||||
{ includeIntegrations: false },
|
||||
database
|
||||
)
|
||||
}
|
||||
|
||||
/*
|
||||
if (options.includeInterments) {
|
||||
contract.contractInterments =
|
||||
await getContractOccupants(
|
||||
contract.contractId,
|
||||
database
|
||||
)
|
||||
contract.contractInterments = await getContractInterments(
|
||||
contract.contractId,
|
||||
database
|
||||
)
|
||||
}
|
||||
*/
|
||||
|
||||
return contract
|
||||
}
|
||||
|
|
@ -190,9 +183,9 @@ export default async function getContracts(
|
|||
database
|
||||
.prepare(
|
||||
`select count(*) as recordCount
|
||||
from Contracts o
|
||||
left join BurialSites l on o.burialSiteId = l.burialSiteId
|
||||
${sqlWhereClause}`
|
||||
from Contracts o
|
||||
left join BurialSites l on o.burialSiteId = l.burialSiteId
|
||||
${sqlWhereClause}`
|
||||
)
|
||||
.get(sqlParameters) as { recordCount: number }
|
||||
).recordCount
|
||||
|
|
@ -204,12 +197,15 @@ export default async function getContracts(
|
|||
contracts = database
|
||||
.prepare(
|
||||
`select o.contractId,
|
||||
o.contractTypeId, t.contractType,
|
||||
o.burialSiteId, lt.burialSiteType,
|
||||
l.burialSiteName,
|
||||
o.contractTypeId, t.contractType, t.isPreneed,
|
||||
o.burialSiteId, lt.burialSiteType, l.burialSiteName,
|
||||
l.cemeteryId, m.cemeteryName,
|
||||
o.contractStartDate, userFn_dateIntegerToString(o.contractStartDate) as contractStartDateString,
|
||||
o.contractEndDate, userFn_dateIntegerToString(o.contractEndDate) as contractEndDateString
|
||||
o.contractEndDate, userFn_dateIntegerToString(o.contractEndDate) as contractEndDateString,
|
||||
o.purchaserName, o.purchaserAddress1, o.purchaserAddress2,
|
||||
o.purchaserCity, o.purchaserProvince, o.purchaserPostalCode,
|
||||
o.purchaserPhoneNumber, o.purchaserEmail, o.purchaserRelationship,
|
||||
o.funeralHomeId, o.funeralDirectorName
|
||||
from Contracts o
|
||||
left join ContractTypes t on o.contractTypeId = t.contractTypeId
|
||||
left join BurialSites l on o.burialSiteId = l.burialSiteId
|
||||
|
|
@ -234,14 +230,12 @@ export default async function getContracts(
|
|||
}
|
||||
|
||||
for (const contract of contracts) {
|
||||
const contractType = await getContractTypeById(
|
||||
contract.contractTypeId
|
||||
)
|
||||
const contractType = await getContractTypeById(contract.contractTypeId)
|
||||
|
||||
if (contractType !== undefined) {
|
||||
contract.printEJS = (
|
||||
contractType.contractTypePrints ?? []
|
||||
).includes('*')
|
||||
contract.printEJS = (contractType.contractTypePrints ?? []).includes(
|
||||
'*'
|
||||
)
|
||||
? getConfigProperty('settings.contracts.prints')[0]
|
||||
: (contractType.contractTypePrints ?? [])[0]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
import type { IntermentCommittalType } from '../types/recordTypes.js';
|
||||
export default function getIntermentCommittalTypes(): Promise<IntermentCommittalType[]>;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
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
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import type { IntermentContainerType } from '../types/recordTypes.js';
|
||||
export default function getIntermentContainerTypes(): Promise<IntermentContainerType[]>;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { acquireConnection } from './pool.js';
|
||||
export default async function getIntermentContainerTypes() {
|
||||
const database = await acquireConnection();
|
||||
const containerTypes = database
|
||||
.prepare(`select intermentContainerTypeId, intermentContainerType, orderNumber
|
||||
from IntermentContainerTypes
|
||||
where recordDelete_timeMillis is null
|
||||
order by orderNumber, intermentContainerType, intermentContainerTypeId`)
|
||||
.all();
|
||||
database.release();
|
||||
return containerTypes;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import type { IntermentContainerType } from '../types/recordTypes.js'
|
||||
|
||||
import { acquireConnection } from './pool.js'
|
||||
|
||||
export default async function getIntermentContainerTypes(): Promise<
|
||||
IntermentContainerType[]
|
||||
> {
|
||||
const database = await acquireConnection()
|
||||
|
||||
const containerTypes = database
|
||||
.prepare(
|
||||
`select intermentContainerTypeId, intermentContainerType, orderNumber
|
||||
from IntermentContainerTypes
|
||||
where recordDelete_timeMillis is null
|
||||
order by orderNumber, intermentContainerType, intermentContainerTypeId`
|
||||
)
|
||||
.all() as IntermentContainerType[]
|
||||
|
||||
database.release()
|
||||
|
||||
return containerTypes
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ 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 addRecord from './addRecord.js';
|
||||
const debug = Debug(`${DEBUG_NAMESPACE}:database/initializeDatabase`);
|
||||
|
|
@ -132,6 +133,7 @@ const createStatements = [
|
|||
`create table if not exists ContractTypes (
|
||||
contractTypeId integer not null primary key autoincrement,
|
||||
contractType varchar(100) not null,
|
||||
isPreneed bit not null default 0,
|
||||
orderNumber smallint not null default 0,
|
||||
${recordColumns})`,
|
||||
`create index if not exists idx_ContractTypes_orderNumber
|
||||
|
|
@ -175,6 +177,7 @@ const createStatements = [
|
|||
purchaserPostalCode varchar(7),
|
||||
purchaserPhoneNumber varchar(30),
|
||||
purchaserEmail varchar(100),
|
||||
purchaserRelationship varchar(50),
|
||||
|
||||
funeralHomeId integer,
|
||||
funeralDirectorName varchar(100),
|
||||
|
|
@ -225,6 +228,12 @@ const createStatements = [
|
|||
deceasedName varchar(50) not null,
|
||||
isCremated bit not null default 0,
|
||||
|
||||
deceasedAddress1 varchar(50),
|
||||
deceasedAddress2 varchar(50),
|
||||
deceasedCity varchar(20),
|
||||
deceasedProvince varchar(2),
|
||||
deceasedPostalCode varchar(7),
|
||||
|
||||
birthDate integer,
|
||||
birthPlace varchar(100),
|
||||
|
||||
|
|
@ -393,9 +402,30 @@ async function initializeData() {
|
|||
await addRecord('BurialSiteStatuses', 'Available', 1, initializingUser);
|
||||
await addRecord('BurialSiteStatuses', 'Reserved', 2, initializingUser);
|
||||
await addRecord('BurialSiteStatuses', 'Taken', 3, initializingUser);
|
||||
await addRecord('ContractTypes', 'Preneed', 1, initializingUser);
|
||||
await addRecord('ContractTypes', 'Interment', 2, initializingUser);
|
||||
await addRecord('ContractTypes', 'Cremation', 3, initializingUser);
|
||||
await addContractType({
|
||||
contractType: 'Preneed',
|
||||
isPreneed: '1',
|
||||
orderNumber: 1
|
||||
}, 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);
|
||||
/*
|
||||
* Fee Categories
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ 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 addRecord from './addRecord.js'
|
||||
|
||||
|
|
@ -156,6 +157,7 @@ const createStatements = [
|
|||
`create table if not exists ContractTypes (
|
||||
contractTypeId integer not null primary key autoincrement,
|
||||
contractType varchar(100) not null,
|
||||
isPreneed bit not null default 0,
|
||||
orderNumber smallint not null default 0,
|
||||
${recordColumns})`,
|
||||
|
||||
|
|
@ -205,6 +207,7 @@ const createStatements = [
|
|||
purchaserPostalCode varchar(7),
|
||||
purchaserPhoneNumber varchar(30),
|
||||
purchaserEmail varchar(100),
|
||||
purchaserRelationship varchar(50),
|
||||
|
||||
funeralHomeId integer,
|
||||
funeralDirectorName varchar(100),
|
||||
|
|
@ -264,6 +267,12 @@ const createStatements = [
|
|||
deceasedName varchar(50) not null,
|
||||
isCremated bit not null default 0,
|
||||
|
||||
deceasedAddress1 varchar(50),
|
||||
deceasedAddress2 varchar(50),
|
||||
deceasedCity varchar(20),
|
||||
deceasedProvince varchar(2),
|
||||
deceasedPostalCode varchar(7),
|
||||
|
||||
birthDate integer,
|
||||
birthPlace varchar(100),
|
||||
|
||||
|
|
@ -464,9 +473,43 @@ async function initializeData(): Promise<void> {
|
|||
await addRecord('BurialSiteStatuses', 'Reserved', 2, initializingUser)
|
||||
await addRecord('BurialSiteStatuses', 'Taken', 3, initializingUser)
|
||||
|
||||
await addRecord('ContractTypes', 'Preneed', 1, initializingUser)
|
||||
await addRecord('ContractTypes', 'Interment', 2, initializingUser)
|
||||
await addRecord('ContractTypes', 'Cremation', 3, initializingUser)
|
||||
await addContractType(
|
||||
{
|
||||
contractType: 'Preneed',
|
||||
isPreneed: '1',
|
||||
orderNumber: 1
|
||||
},
|
||||
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)
|
||||
|
||||
/*
|
||||
* Fee Categories
|
||||
|
|
|
|||
|
|
@ -5,7 +5,18 @@ export interface UpdateContractForm {
|
|||
burialSiteId: string | number;
|
||||
contractStartDateString: DateString;
|
||||
contractEndDateString: DateString | '';
|
||||
funeralHomeId?: string | number;
|
||||
funeralDirectorName?: string;
|
||||
purchaserName?: string;
|
||||
purchaserAddress1?: string;
|
||||
purchaserAddress2?: string;
|
||||
purchaserCity?: string;
|
||||
purchaserProvince?: string;
|
||||
purchaserPostalCode?: string;
|
||||
purchaserPhoneNumber?: string;
|
||||
purchaserEmail?: string;
|
||||
purchaserRelationship?: string;
|
||||
contractTypeFieldIds?: string;
|
||||
[fieldValue_contractTypeFieldId: string]: unknown;
|
||||
[fieldValue_contractTypeFieldId: `fieldValue_${string}`]: unknown;
|
||||
}
|
||||
export default function updateContract(updateForm: UpdateContractForm, user: User): Promise<boolean>;
|
||||
|
|
|
|||
|
|
@ -10,13 +10,24 @@ export default async function updateContract(updateForm, user) {
|
|||
burialSiteId = ?,
|
||||
contractStartDate = ?,
|
||||
contractEndDate = ?,
|
||||
funeralHomeId = ?,
|
||||
funeralDirectorName = ?,
|
||||
purchaserName = ?,
|
||||
purchaserAddress1 = ?,
|
||||
purchaserAddress2 = ?,
|
||||
purchaserCity = ?,
|
||||
purchaserProvince = ?,
|
||||
purchaserPostalCode = ?,
|
||||
purchaserPhoneNumber = ?,
|
||||
purchaserEmail = ?,
|
||||
purchaserRelationship = ?,
|
||||
recordUpdate_userName = ?,
|
||||
recordUpdate_timeMillis = ?
|
||||
where contractId = ?
|
||||
and recordDelete_timeMillis is null`)
|
||||
.run(updateForm.contractTypeId, updateForm.burialSiteId === '' ? undefined : updateForm.burialSiteId, dateStringToInteger(updateForm.contractStartDateString), updateForm.contractEndDateString === ''
|
||||
? undefined
|
||||
: dateStringToInteger(updateForm.contractEndDateString), user.userName, Date.now(), updateForm.contractId);
|
||||
: dateStringToInteger(updateForm.contractEndDateString), updateForm.funeralHomeId === '' ? undefined : updateForm.funeralHomeId, updateForm.funeralDirectorName ?? '', updateForm.purchaserName ?? '', updateForm.purchaserAddress1 ?? '', updateForm.purchaserAddress2 ?? '', updateForm.purchaserCity ?? '', updateForm.purchaserProvince ?? '', updateForm.purchaserPostalCode ?? '', updateForm.purchaserPhoneNumber ?? '', updateForm.purchaserEmail ?? '', updateForm.purchaserRelationship ?? '', user.userName, Date.now(), updateForm.contractId);
|
||||
if (result.changes > 0) {
|
||||
const contractTypeFieldIds = (updateForm.contractTypeFieldIds ?? '').split(',');
|
||||
for (const contractTypeFieldId of contractTypeFieldIds) {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,21 @@ export interface UpdateContractForm {
|
|||
contractStartDateString: DateString
|
||||
contractEndDateString: DateString | ''
|
||||
|
||||
funeralHomeId?: string | number
|
||||
funeralDirectorName?: string
|
||||
|
||||
purchaserName?: string
|
||||
purchaserAddress1?: string
|
||||
purchaserAddress2?: string
|
||||
purchaserCity?: string
|
||||
purchaserProvince?: string
|
||||
purchaserPostalCode?: string
|
||||
purchaserPhoneNumber?: string
|
||||
purchaserEmail?: string
|
||||
purchaserRelationship?: string
|
||||
|
||||
contractTypeFieldIds?: string
|
||||
[fieldValue_contractTypeFieldId: string]: unknown
|
||||
[fieldValue_contractTypeFieldId: `fieldValue_${string}`]: unknown
|
||||
}
|
||||
|
||||
export default async function updateContract(
|
||||
|
|
@ -29,6 +42,17 @@ export default async function updateContract(
|
|||
burialSiteId = ?,
|
||||
contractStartDate = ?,
|
||||
contractEndDate = ?,
|
||||
funeralHomeId = ?,
|
||||
funeralDirectorName = ?,
|
||||
purchaserName = ?,
|
||||
purchaserAddress1 = ?,
|
||||
purchaserAddress2 = ?,
|
||||
purchaserCity = ?,
|
||||
purchaserProvince = ?,
|
||||
purchaserPostalCode = ?,
|
||||
purchaserPhoneNumber = ?,
|
||||
purchaserEmail = ?,
|
||||
purchaserRelationship = ?,
|
||||
recordUpdate_userName = ?,
|
||||
recordUpdate_timeMillis = ?
|
||||
where contractId = ?
|
||||
|
|
@ -41,6 +65,17 @@ export default async function updateContract(
|
|||
updateForm.contractEndDateString === ''
|
||||
? undefined
|
||||
: dateStringToInteger(updateForm.contractEndDateString),
|
||||
updateForm.funeralHomeId === '' ? undefined : updateForm.funeralHomeId,
|
||||
updateForm.funeralDirectorName ?? '',
|
||||
updateForm.purchaserName ?? '',
|
||||
updateForm.purchaserAddress1 ?? '',
|
||||
updateForm.purchaserAddress2 ?? '',
|
||||
updateForm.purchaserCity ?? '',
|
||||
updateForm.purchaserProvince ?? '',
|
||||
updateForm.purchaserPostalCode ?? '',
|
||||
updateForm.purchaserPhoneNumber ?? '',
|
||||
updateForm.purchaserEmail ?? '',
|
||||
updateForm.purchaserRelationship ?? '',
|
||||
user.userName,
|
||||
Date.now(),
|
||||
updateForm.contractId
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
export interface UpdateForm {
|
||||
contractTypeId: number | string;
|
||||
contractType: string;
|
||||
isPreneed?: string;
|
||||
}
|
||||
export default function updateContractType(updateForm: UpdateForm, user: User): Promise<boolean>;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import { clearCacheByTableName } from '../helpers/functions.cache.js';
|
||||
import { acquireConnection } from './pool.js';
|
||||
export default async function updateContractType(updateForm, user) {
|
||||
const database = await acquireConnection();
|
||||
const rightNowMillis = Date.now();
|
||||
const result = database
|
||||
.prepare(`update ContractTypes
|
||||
set contractType = ?,
|
||||
isPreneed = ?,
|
||||
recordUpdate_userName = ?,
|
||||
recordUpdate_timeMillis = ?
|
||||
where recordDelete_timeMillis is null
|
||||
and contractTypeId = ?`)
|
||||
.run(updateForm.contractType, updateForm.isPreneed === undefined ? 0 : 1, user.userName, rightNowMillis, updateForm.contractTypeId);
|
||||
database.release();
|
||||
clearCacheByTableName('ContractTypes');
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
import { clearCacheByTableName } from '../helpers/functions.cache.js'
|
||||
|
||||
import { acquireConnection } from './pool.js'
|
||||
|
||||
export interface UpdateForm {
|
||||
contractTypeId: number | string
|
||||
contractType: string
|
||||
isPreneed?: string
|
||||
}
|
||||
|
||||
export default async function updateContractType(
|
||||
updateForm: UpdateForm,
|
||||
user: User
|
||||
): Promise<boolean> {
|
||||
const database = await acquireConnection()
|
||||
|
||||
const rightNowMillis = Date.now()
|
||||
|
||||
const result = database
|
||||
.prepare(
|
||||
`update ContractTypes
|
||||
set contractType = ?,
|
||||
isPreneed = ?,
|
||||
recordUpdate_userName = ?,
|
||||
recordUpdate_timeMillis = ?
|
||||
where recordDelete_timeMillis is null
|
||||
and contractTypeId = ?`
|
||||
)
|
||||
.run(
|
||||
updateForm.contractType,
|
||||
updateForm.isPreneed === undefined ? 0 : 1,
|
||||
user.userName,
|
||||
rightNowMillis,
|
||||
updateForm.contractTypeId
|
||||
)
|
||||
|
||||
database.release()
|
||||
|
||||
clearCacheByTableName('ContractTypes')
|
||||
|
||||
return result.changes > 0
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
type RecordTable = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'ContractTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes';
|
||||
type RecordTable = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes';
|
||||
export declare function updateRecord(recordTable: RecordTable, recordId: number | string, recordName: string, user: User): Promise<boolean>;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import { clearCacheByTableName } from '../helpers/functions.cache.js';
|
||||
import { acquireConnection } from './pool.js';
|
||||
const recordNameIdColumns = new Map();
|
||||
recordNameIdColumns.set('BurialSiteStatuses', ['burialSiteStatus', 'burialSiteStatusId']);
|
||||
recordNameIdColumns.set('BurialSiteTypes', ['burialSiteType', 'burialSiteTypeId']);
|
||||
recordNameIdColumns.set('ContractTypes', ['contractType', 'contractTypeId']);
|
||||
recordNameIdColumns.set('BurialSiteStatuses', [
|
||||
'burialSiteStatus',
|
||||
'burialSiteStatusId'
|
||||
]);
|
||||
recordNameIdColumns.set('BurialSiteTypes', [
|
||||
'burialSiteType',
|
||||
'burialSiteTypeId'
|
||||
]);
|
||||
recordNameIdColumns.set('WorkOrderMilestoneTypes', [
|
||||
'workOrderMilestoneType',
|
||||
'workOrderMilestoneTypeId'
|
||||
|
|
|
|||
|
|
@ -5,14 +5,18 @@ import { acquireConnection } from './pool.js'
|
|||
type RecordTable =
|
||||
| 'BurialSiteStatuses'
|
||||
| 'BurialSiteTypes'
|
||||
| 'ContractTypes'
|
||||
| 'WorkOrderMilestoneTypes'
|
||||
| 'WorkOrderTypes'
|
||||
|
||||
const recordNameIdColumns = new Map<RecordTable, string[]>()
|
||||
recordNameIdColumns.set('BurialSiteStatuses', ['burialSiteStatus', 'burialSiteStatusId'])
|
||||
recordNameIdColumns.set('BurialSiteTypes', ['burialSiteType', 'burialSiteTypeId'])
|
||||
recordNameIdColumns.set('ContractTypes', ['contractType', 'contractTypeId'])
|
||||
recordNameIdColumns.set('BurialSiteStatuses', [
|
||||
'burialSiteStatus',
|
||||
'burialSiteStatusId'
|
||||
])
|
||||
recordNameIdColumns.set('BurialSiteTypes', [
|
||||
'burialSiteType',
|
||||
'burialSiteTypeId'
|
||||
])
|
||||
recordNameIdColumns.set('WorkOrderMilestoneTypes', [
|
||||
'workOrderMilestoneType',
|
||||
'workOrderMilestoneTypeId'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import type { Request, Response } from 'express';
|
||||
export default function handler(request: Request<unknown, unknown, {
|
||||
contractType: string;
|
||||
orderNumber?: number | string;
|
||||
}>, response: Response): Promise<void>;
|
||||
import { type AddForm } from '../../database/addContractType.js';
|
||||
export default function handler(request: Request<unknown, unknown, AddForm>, response: Response): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import addRecord from '../../database/addRecord.js';
|
||||
import addContractType from '../../database/addContractType.js';
|
||||
import { getAllContractTypeFields, getContractTypes } from '../../helpers/functions.cache.js';
|
||||
export default async function handler(request, response) {
|
||||
const contractTypeId = await addRecord('ContractTypes', request.body.contractType, request.body.orderNumber ?? -1, request.session.user);
|
||||
const contractTypeId = await addContractType(request.body, request.session.user);
|
||||
const contractTypes = await getContractTypes();
|
||||
const allContractTypeFields = await getAllContractTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,23 +1,19 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import addRecord from '../../database/addRecord.js'
|
||||
import addContractType, {
|
||||
type AddForm
|
||||
} from '../../database/addContractType.js'
|
||||
import {
|
||||
getAllContractTypeFields,
|
||||
getContractTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
|
||||
export default async function handler(
|
||||
request: Request<
|
||||
unknown,
|
||||
unknown,
|
||||
{ contractType: string; orderNumber?: number | string }
|
||||
>,
|
||||
request: Request<unknown, unknown, AddForm>,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const contractTypeId = await addRecord(
|
||||
'ContractTypes',
|
||||
request.body.contractType,
|
||||
request.body.orderNumber ?? -1,
|
||||
const contractTypeId = await addContractType(
|
||||
request.body,
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import type { Request, Response } from 'express';
|
||||
export default function handler(request: Request<unknown, unknown, {
|
||||
contractTypeId: string;
|
||||
contractType: string;
|
||||
}>, response: Response): Promise<void>;
|
||||
import { type UpdateForm } from '../../database/updateContractType.js';
|
||||
export default function handler(request: Request<unknown, unknown, UpdateForm>, response: Response): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateRecord } from '../../database/updateRecord.js';
|
||||
import updateContractType from '../../database/updateContractType.js';
|
||||
import { getAllContractTypeFields, getContractTypes } from '../../helpers/functions.cache.js';
|
||||
export default async function handler(request, response) {
|
||||
const success = await updateRecord('ContractTypes', request.body.contractTypeId, request.body.contractType, request.session.user);
|
||||
const success = await updateContractType(request.body, request.session.user);
|
||||
const contractTypes = await getContractTypes();
|
||||
const allContractTypeFields = await getAllContractTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,23 +1,19 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateRecord } from '../../database/updateRecord.js'
|
||||
import updateContractType, {
|
||||
type UpdateForm
|
||||
} from '../../database/updateContractType.js'
|
||||
import {
|
||||
getAllContractTypeFields,
|
||||
getContractTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
|
||||
export default async function handler(
|
||||
request: Request<
|
||||
unknown,
|
||||
unknown,
|
||||
{ contractTypeId: string; contractType: string }
|
||||
>,
|
||||
request: Request<unknown, unknown, UpdateForm>,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const success = await updateRecord(
|
||||
'ContractTypes',
|
||||
request.body.contractTypeId,
|
||||
request.body.contractType,
|
||||
const success = await updateContractType(
|
||||
request.body,
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import getCemeteries from '../../database/getCemeteries.js';
|
||||
import getContract from '../../database/getContract.js';
|
||||
import getFuneralHomes from '../../database/getFuneralHomes.js';
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js';
|
||||
import { getBurialSiteStatuses, getBurialSiteTypes, getContractTypePrintsById, getContractTypes, getWorkOrderTypes } from '../../helpers/functions.cache.js';
|
||||
import { getContractTypePrintsById, getContractTypes, getWorkOrderTypes } from '../../helpers/functions.cache.js';
|
||||
export default async function handler(request, response) {
|
||||
const contract = await getContract(request.params.contractId);
|
||||
if (contract === undefined) {
|
||||
|
|
@ -10,18 +10,14 @@ export default async function handler(request, response) {
|
|||
}
|
||||
const contractTypePrints = await getContractTypePrintsById(contract.contractTypeId);
|
||||
const contractTypes = await getContractTypes();
|
||||
const burialSiteTypes = await getBurialSiteTypes();
|
||||
const burialSiteStatuses = await getBurialSiteStatuses();
|
||||
const cemeteries = await getCemeteries();
|
||||
const funeralHomes = await getFuneralHomes();
|
||||
const workOrderTypes = await getWorkOrderTypes();
|
||||
response.render('contract-edit', {
|
||||
headTitle: 'Contract Update',
|
||||
contract,
|
||||
contractTypePrints,
|
||||
contractTypes,
|
||||
burialSiteTypes,
|
||||
burialSiteStatuses,
|
||||
cemeteries,
|
||||
funeralHomes,
|
||||
workOrderTypes,
|
||||
isCreate: false
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import getCemeteries from '../../database/getCemeteries.js'
|
||||
import getContract from '../../database/getContract.js'
|
||||
import getFuneralHomes from '../../database/getFuneralHomes.js'
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||
import {
|
||||
getBurialSiteStatuses,
|
||||
getBurialSiteTypes,
|
||||
getContractTypePrintsById,
|
||||
getContractTypes,
|
||||
getWorkOrderTypes
|
||||
|
|
@ -33,9 +31,7 @@ export default async function handler(
|
|||
)
|
||||
|
||||
const contractTypes = await getContractTypes()
|
||||
const burialSiteTypes = await getBurialSiteTypes()
|
||||
const burialSiteStatuses = await getBurialSiteStatuses()
|
||||
const cemeteries = await getCemeteries()
|
||||
const funeralHomes = await getFuneralHomes()
|
||||
const workOrderTypes = await getWorkOrderTypes()
|
||||
|
||||
response.render('contract-edit', {
|
||||
|
|
@ -44,9 +40,7 @@ export default async function handler(
|
|||
contractTypePrints,
|
||||
|
||||
contractTypes,
|
||||
burialSiteTypes,
|
||||
burialSiteStatuses,
|
||||
cemeteries,
|
||||
funeralHomes,
|
||||
workOrderTypes,
|
||||
|
||||
isCreate: false
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
import { dateToInteger, dateToString } from '@cityssm/utils-datetime';
|
||||
import getBurialSite from '../../database/getBurialSite.js';
|
||||
import getCemeteries from '../../database/getCemeteries.js';
|
||||
import { getBurialSiteStatuses, getBurialSiteTypes, getContractTypes } from '../../helpers/functions.cache.js';
|
||||
import getFuneralHomes from '../../database/getFuneralHomes.js';
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js';
|
||||
import { getContractTypes } from '../../helpers/functions.cache.js';
|
||||
export default async function handler(request, response) {
|
||||
const startDate = new Date();
|
||||
const contract = {
|
||||
isPreneed: false,
|
||||
contractStartDate: dateToInteger(startDate),
|
||||
contractStartDateString: dateToString(startDate)
|
||||
contractStartDateString: dateToString(startDate),
|
||||
purchaserCity: getConfigProperty('settings.cityDefault'),
|
||||
purchaserProvince: getConfigProperty('settings.provinceDefault')
|
||||
};
|
||||
if (request.query.burialSiteId !== undefined) {
|
||||
const burialSite = await getBurialSite(request.query.burialSiteId);
|
||||
|
|
@ -18,16 +22,12 @@ export default async function handler(request, response) {
|
|||
}
|
||||
}
|
||||
const contractTypes = await getContractTypes();
|
||||
const burialSiteTypes = await getBurialSiteTypes();
|
||||
const burialSiteStatuses = await getBurialSiteStatuses();
|
||||
const cemeteries = await getCemeteries();
|
||||
const funeralHomes = await getFuneralHomes();
|
||||
response.render('contract-edit', {
|
||||
headTitle: 'Create a New Contract',
|
||||
contract,
|
||||
contractTypes,
|
||||
burialSiteTypes,
|
||||
burialSiteStatuses,
|
||||
cemeteries,
|
||||
funeralHomes,
|
||||
isCreate: true
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,9 @@ import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import getBurialSite from '../../database/getBurialSite.js'
|
||||
import getCemeteries from '../../database/getCemeteries.js'
|
||||
import {
|
||||
getBurialSiteStatuses,
|
||||
getBurialSiteTypes,
|
||||
getContractTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import getFuneralHomes from '../../database/getFuneralHomes.js'
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||
import { getContractTypes } from '../../helpers/functions.cache.js'
|
||||
import type { Contract } from '../../types/recordTypes.js'
|
||||
|
||||
export default async function handler(
|
||||
|
|
@ -17,8 +14,11 @@ export default async function handler(
|
|||
const startDate = new Date()
|
||||
|
||||
const contract: Partial<Contract> = {
|
||||
isPreneed: false,
|
||||
contractStartDate: dateToInteger(startDate),
|
||||
contractStartDateString: dateToString(startDate)
|
||||
contractStartDateString: dateToString(startDate),
|
||||
purchaserCity: getConfigProperty('settings.cityDefault'),
|
||||
purchaserProvince: getConfigProperty('settings.provinceDefault')
|
||||
}
|
||||
|
||||
if (request.query.burialSiteId !== undefined) {
|
||||
|
|
@ -33,18 +33,14 @@ export default async function handler(
|
|||
}
|
||||
|
||||
const contractTypes = await getContractTypes()
|
||||
const burialSiteTypes = await getBurialSiteTypes()
|
||||
const burialSiteStatuses = await getBurialSiteStatuses()
|
||||
const cemeteries = await getCemeteries()
|
||||
const funeralHomes = await getFuneralHomes()
|
||||
|
||||
response.render('contract-edit', {
|
||||
headTitle: 'Create a New Contract',
|
||||
contract,
|
||||
|
||||
contractTypes,
|
||||
burialSiteTypes,
|
||||
burialSiteStatuses,
|
||||
cemeteries,
|
||||
funeralHomes,
|
||||
|
||||
isCreate: true
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { BurialSiteStatus, BurialSiteType, ContractType, ContractTypeField, WorkOrderMilestoneType, WorkOrderType } from '../types/recordTypes.js';
|
||||
import type { BurialSiteStatus, BurialSiteType, ContractType, ContractTypeField, IntermentCommittalType, 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>;
|
||||
|
|
@ -10,6 +10,10 @@ export declare function getAllContractTypeFields(): Promise<ContractTypeField[]>
|
|||
export declare function getContractTypeById(contractTypeId: number): Promise<ContractType | undefined>;
|
||||
export declare function getContractTypeByContractType(contractTypeString: string): Promise<ContractType | undefined>;
|
||||
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 getWorkOrderTypes(): Promise<WorkOrderType[]>;
|
||||
export declare function getWorkOrderTypeById(workOrderTypeId: number): Promise<WorkOrderType | undefined>;
|
||||
export declare function getWorkOrderMilestoneTypes(): Promise<WorkOrderMilestoneType[]>;
|
||||
|
|
@ -17,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' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes' | 'FeeCategories' | 'Fees';
|
||||
type CacheTableNames = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'ContractTypes' | 'ContractTypeFields' | 'ContractTypePrints' | 'IntermentContainerTypes' | 'IntermentCommittalTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes' | 'FeeCategories' | 'Fees';
|
||||
export declare function clearCacheByTableName(tableName: CacheTableNames, relayMessage?: boolean): void;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import getBurialSiteStatusesFromDatabase from '../database/getBurialSiteStatuses
|
|||
import getBurialSiteTypesFromDatabase from '../database/getBurialSiteTypes.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';
|
||||
import { DEBUG_NAMESPACE } from '../debug.config.js';
|
||||
|
|
@ -96,6 +98,40 @@ function clearContractTypesCache() {
|
|||
contractTypes = undefined;
|
||||
allContractTypeFields = undefined;
|
||||
}
|
||||
/*
|
||||
* Interment Container Types
|
||||
*/
|
||||
let intermentContainerTypes;
|
||||
export async function getIntermentContainerTypes() {
|
||||
if (intermentContainerTypes === undefined) {
|
||||
intermentContainerTypes = await getIntermentContainerTypesFromDatabase();
|
||||
}
|
||||
return intermentContainerTypes;
|
||||
}
|
||||
export async function getIntermentContainerTypeById(intermentContainerTypeId) {
|
||||
const cachedContainerTypes = await getIntermentContainerTypes();
|
||||
return cachedContainerTypes.find((currentContainerType) => currentContainerType.intermentContainerTypeId === intermentContainerTypeId);
|
||||
}
|
||||
function clearIntermentContainerTypesCache() {
|
||||
intermentContainerTypes = undefined;
|
||||
}
|
||||
/*
|
||||
* Interment Committal Types
|
||||
*/
|
||||
let intermentCommittalTypes;
|
||||
export async function getIntermentCommittalTypes() {
|
||||
if (intermentCommittalTypes === undefined) {
|
||||
intermentCommittalTypes = await getIntermentCommittalTypesFromDatabase();
|
||||
}
|
||||
return intermentCommittalTypes;
|
||||
}
|
||||
export async function getIntermentCommittalTypeById(intermentCommittalTypeId) {
|
||||
const cachedCommittalTypes = await getIntermentCommittalTypes();
|
||||
return cachedCommittalTypes.find((currentCommittalType) => currentCommittalType.intermentCommittalTypeId === intermentCommittalTypeId);
|
||||
}
|
||||
function clearIntermentCommittalTypesCache() {
|
||||
intermentCommittalTypes = undefined;
|
||||
}
|
||||
/*
|
||||
* Work Order Types
|
||||
*/
|
||||
|
|
@ -169,6 +205,14 @@ export function clearCacheByTableName(tableName, relayMessage = true) {
|
|||
clearContractTypesCache();
|
||||
break;
|
||||
}
|
||||
case 'IntermentContainerTypes': {
|
||||
clearIntermentContainerTypesCache();
|
||||
break;
|
||||
}
|
||||
case 'IntermentCommittalTypes': {
|
||||
clearIntermentCommittalTypesCache();
|
||||
break;
|
||||
}
|
||||
case 'WorkOrderMilestoneTypes': {
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import getBurialSiteStatusesFromDatabase from '../database/getBurialSiteStatuses
|
|||
import getBurialSiteTypesFromDatabase from '../database/getBurialSiteTypes.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'
|
||||
import { DEBUG_NAMESPACE } from '../debug.config.js'
|
||||
|
|
@ -21,6 +23,8 @@ import type {
|
|||
BurialSiteType,
|
||||
ContractType,
|
||||
ContractTypeField,
|
||||
IntermentCommittalType,
|
||||
IntermentContainerType,
|
||||
WorkOrderMilestoneType,
|
||||
WorkOrderType
|
||||
} from '../types/recordTypes.js'
|
||||
|
|
@ -178,6 +182,68 @@ function clearContractTypesCache(): void {
|
|||
allContractTypeFields = undefined
|
||||
}
|
||||
|
||||
/*
|
||||
* Interment Container Types
|
||||
*/
|
||||
|
||||
let intermentContainerTypes: IntermentContainerType[] | undefined
|
||||
|
||||
export async function getIntermentContainerTypes(): Promise<
|
||||
IntermentContainerType[]
|
||||
> {
|
||||
if (intermentContainerTypes === undefined) {
|
||||
intermentContainerTypes = await getIntermentContainerTypesFromDatabase()
|
||||
}
|
||||
|
||||
return intermentContainerTypes
|
||||
}
|
||||
|
||||
export async function getIntermentContainerTypeById(
|
||||
intermentContainerTypeId: number
|
||||
): Promise<IntermentContainerType | undefined> {
|
||||
const cachedContainerTypes = await getIntermentContainerTypes()
|
||||
|
||||
return cachedContainerTypes.find(
|
||||
(currentContainerType) =>
|
||||
currentContainerType.intermentContainerTypeId === intermentContainerTypeId
|
||||
)
|
||||
}
|
||||
|
||||
function clearIntermentContainerTypesCache(): void {
|
||||
intermentContainerTypes = undefined
|
||||
}
|
||||
|
||||
/*
|
||||
* Interment Committal Types
|
||||
*/
|
||||
|
||||
let intermentCommittalTypes: IntermentCommittalType[] | undefined
|
||||
|
||||
export async function getIntermentCommittalTypes(): Promise<
|
||||
IntermentCommittalType[]
|
||||
> {
|
||||
if (intermentCommittalTypes === undefined) {
|
||||
intermentCommittalTypes = await getIntermentCommittalTypesFromDatabase()
|
||||
}
|
||||
|
||||
return intermentCommittalTypes
|
||||
}
|
||||
|
||||
export async function getIntermentCommittalTypeById(
|
||||
intermentCommittalTypeId: number
|
||||
): Promise<IntermentCommittalType | undefined> {
|
||||
const cachedCommittalTypes = await getIntermentCommittalTypes()
|
||||
|
||||
return cachedCommittalTypes.find(
|
||||
(currentCommittalType) =>
|
||||
currentCommittalType.intermentCommittalTypeId === intermentCommittalTypeId
|
||||
)
|
||||
}
|
||||
|
||||
function clearIntermentCommittalTypesCache(): void {
|
||||
intermentCommittalTypes = undefined
|
||||
}
|
||||
|
||||
/*
|
||||
* Work Order Types
|
||||
*/
|
||||
|
|
@ -278,6 +344,8 @@ type CacheTableNames =
|
|||
| 'ContractTypes'
|
||||
| 'ContractTypeFields'
|
||||
| 'ContractTypePrints'
|
||||
| 'IntermentContainerTypes'
|
||||
| 'IntermentCommittalTypes'
|
||||
| 'WorkOrderMilestoneTypes'
|
||||
| 'WorkOrderTypes'
|
||||
| 'FeeCategories'
|
||||
|
|
@ -306,6 +374,16 @@ export function clearCacheByTableName(
|
|||
break
|
||||
}
|
||||
|
||||
case 'IntermentContainerTypes': {
|
||||
clearIntermentContainerTypesCache()
|
||||
break
|
||||
}
|
||||
|
||||
case 'IntermentCommittalTypes': {
|
||||
clearIntermentCommittalTypesCache()
|
||||
break
|
||||
}
|
||||
|
||||
case 'WorkOrderMilestoneTypes': {
|
||||
clearWorkOrderMilestoneTypesCache()
|
||||
break
|
||||
|
|
|
|||
|
|
@ -13,19 +13,37 @@
|
|||
</header>
|
||||
<section class="modal-card-body">
|
||||
<form id="form--contractTypeAdd">
|
||||
<div class="field">
|
||||
<label class="label" for="contractTypeAdd--contractType"
|
||||
>Contract Type</label
|
||||
>
|
||||
<div class="control">
|
||||
<input
|
||||
class="input"
|
||||
id="contractTypeAdd--contractType"
|
||||
name="contractType"
|
||||
type="text"
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contractTypeAdd--contractType"
|
||||
>Contract Type</label
|
||||
>
|
||||
<div class="control">
|
||||
<input
|
||||
class="input"
|
||||
id="contractTypeAdd--contractType"
|
||||
name="contractType"
|
||||
type="text"
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<label class="checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="contractTypeAdd--isPreneed"
|
||||
name="isPreneed"
|
||||
/>
|
||||
Contract Type is Preneed
|
||||
</label>
|
||||
<p class="help">
|
||||
When checked, interments associated with the contract
|
||||
will be considered reserved, not occupied.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
<div class="modal-background"></div>
|
||||
<div class="modal-card has-width-900">
|
||||
<header class="modal-card-head">
|
||||
<h3 class="modal-card-title">
|
||||
Update Contract Type
|
||||
</h3>
|
||||
<h3 class="modal-card-title">Update Contract Type</h3>
|
||||
<button
|
||||
class="delete is-close-modal-button"
|
||||
aria-label="close"
|
||||
|
|
@ -19,19 +17,37 @@
|
|||
name="contractTypeId"
|
||||
type="hidden"
|
||||
/>
|
||||
<div class="field">
|
||||
<label class="label" for="contractTypeEdit--contractType"
|
||||
>Contract Type</label
|
||||
>
|
||||
<div class="control">
|
||||
<input
|
||||
class="input"
|
||||
id="contractTypeEdit--contractType"
|
||||
name="contractType"
|
||||
type="text"
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contractTypeEdit--contractType"
|
||||
>Contract Type</label
|
||||
>
|
||||
<div class="control">
|
||||
<input
|
||||
class="input"
|
||||
id="contractTypeEdit--contractType"
|
||||
name="contractType"
|
||||
type="text"
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<label class="checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="contractTypeEdit--isPreneed"
|
||||
name="isPreneed"
|
||||
/>
|
||||
Contract Type is Preneed
|
||||
</label>
|
||||
<p class="help">
|
||||
When checked, interments associated with the contract will be
|
||||
considered reserved, not occupied.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -43,9 +59,7 @@
|
|||
form="form--contractTypeEdit"
|
||||
>
|
||||
<span class="icon"><i class="fas fa-save" aria-hidden="true"></i></span>
|
||||
<span
|
||||
>Update Contract Type</span
|
||||
>
|
||||
<span>Update Contract Type</span>
|
||||
</button>
|
||||
<button class="button is-close-modal-button" type="button">Cancel</button>
|
||||
</footer>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<h3 class="modal-card-title">
|
||||
Select a <span class="alias" data-alias="Lot"></span>
|
||||
Select a Burial Site
|
||||
</h3>
|
||||
<button
|
||||
class="delete is-close-modal-button"
|
||||
|
|
@ -12,143 +12,45 @@
|
|||
></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<div class="tabs is-boxed">
|
||||
<ul>
|
||||
<li class="is-active">
|
||||
<a href="#tab--lotSelect">From Existing</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab--lotCreate">Create New</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-container">
|
||||
<div id="tab--lotSelect">
|
||||
<div class="box">
|
||||
<form id="form--lotSelect">
|
||||
<input name="limit" type="hidden" value="100" />
|
||||
<input name="offset" type="hidden" value="0" />
|
||||
<div class="field">
|
||||
<div class="control has-icons-left">
|
||||
<input
|
||||
class="input"
|
||||
id="lotSelect--lotName"
|
||||
name="lotName"
|
||||
type="text"
|
||||
/>
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-search" aria-hidden="true"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="control has-icons-left">
|
||||
<div class="select is-fullwidth">
|
||||
<select
|
||||
id="lotSelect--occupancyStatus"
|
||||
name="occupancyStatus"
|
||||
>
|
||||
<option value="">(All Statuses)</option>
|
||||
<option value="unoccupied" selected>
|
||||
Currently Unoccupied
|
||||
</option>
|
||||
<option value="occupied">Currently Occupied</option>
|
||||
</select>
|
||||
</div>
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-filter" aria-hidden="true"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="box">
|
||||
<form id="form--burialSiteSelect">
|
||||
<input name="limit" type="hidden" value="100" />
|
||||
<input name="offset" type="hidden" value="0" />
|
||||
<div class="field">
|
||||
<div class="control has-icons-left">
|
||||
<input
|
||||
class="input"
|
||||
id="burialSiteSelect--burialSiteName"
|
||||
name="burialSiteName"
|
||||
type="text"
|
||||
/>
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-search" aria-hidden="true"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="resultsContainer--lotSelect"></div>
|
||||
</div>
|
||||
<div class="is-hidden" id="tab--lotCreate">
|
||||
<div class="message is-info is-small">
|
||||
<p class="message-body">
|
||||
Be sure to confirm if the
|
||||
<span class="alias" data-alias="lot"></span> exists before
|
||||
creating a new one.
|
||||
</p>
|
||||
<div class="field">
|
||||
<div class="control has-icons-left">
|
||||
<div class="select is-fullwidth">
|
||||
<select
|
||||
id="burialSiteSelect--occupancyStatus"
|
||||
name="occupancyStatus"
|
||||
>
|
||||
<option value="">(All Statuses)</option>
|
||||
<option value="unoccupied" selected>
|
||||
Currently Unoccupied
|
||||
</option>
|
||||
<option value="occupied">Currently Occupied</option>
|
||||
</select>
|
||||
</div>
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-filter" aria-hidden="true"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<form id="form--lotCreate">
|
||||
<input name="mapKey" type="hidden" value="" />
|
||||
<input name="lotLatitude" type="hidden" value="" />
|
||||
<input name="lotLongitude" type="hidden" value="" />
|
||||
<div class="field">
|
||||
<label class="label" for="lotCreate--lotName"
|
||||
>New <span class="alias" data-alias="Lot"></span> Name</label
|
||||
>
|
||||
<div class="control">
|
||||
<input
|
||||
class="input"
|
||||
id="lotCreate--lotName"
|
||||
name="lotName"
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="lotCreate--burialSiteTypeId"
|
||||
><span class="alias" data-alias="Lot"></span> Type</label
|
||||
>
|
||||
<div class="control">
|
||||
<div class="select is-fullwidth">
|
||||
<select
|
||||
id="lotCreate--burialSiteTypeId"
|
||||
name="burialSiteTypeId"
|
||||
required
|
||||
>
|
||||
<option value="">(No Type)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="lotCreate--burialSiteStatusId"
|
||||
><span class="alias" data-alias="Lot"></span> Status</label
|
||||
>
|
||||
<div class="control">
|
||||
<div class="select is-fullwidth">
|
||||
<select id="lotCreate--burialSiteStatusId" name="burialSiteStatusId">
|
||||
<option value="">(No Status)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="lotCreate--mapId"
|
||||
><span class="alias" data-alias="Map"></span
|
||||
></label>
|
||||
<div class="control">
|
||||
<div class="select is-fullwidth">
|
||||
<select id="lotCreate--mapId" name="mapId">
|
||||
<option value="">(None Selected)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="has-text-right">
|
||||
<button class="button is-success" type="submit">
|
||||
<span class="icon"
|
||||
><i class="fas fa-plus" aria-hidden="true"></i
|
||||
></span>
|
||||
<span
|
||||
>Create New <span class="alias" data-alias="Lot"></span
|
||||
></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="resultsContainer--burialSiteSelect"></div>
|
||||
</section>
|
||||
<footer class="modal-card-foot justify-right">
|
||||
<button class="button is-close-modal-button" type="button">Cancel</button>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,9 @@
|
|||
"use strict";
|
||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable max-lines */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
(() => {
|
||||
const los = exports.sunrise;
|
||||
const sunrise = exports.sunrise;
|
||||
const contractTypesContainerElement = document.querySelector('#container--contractTypes');
|
||||
const contractTypePrintsContainerElement = document.querySelector('#container--contractTypePrints');
|
||||
let contractTypes = exports.contractTypes;
|
||||
|
|
@ -46,7 +48,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
function deleteContractType(clickEvent) {
|
||||
const contractTypeId = Number.parseInt(clickEvent.currentTarget.closest('.container--contractType').dataset.contractTypeId ?? '', 10);
|
||||
function doDelete() {
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteContractType`, {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/doDeleteContractType`, {
|
||||
contractTypeId
|
||||
}, contractTypeResponseHandler);
|
||||
}
|
||||
|
|
@ -66,7 +68,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
let editCloseModalFunction;
|
||||
function doEdit(submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateContractType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/doUpdateContractType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
contractTypeResponseHandler(responseJSON);
|
||||
if (responseJSON.success) {
|
||||
|
|
@ -76,9 +78,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
cityssm.openHtmlModal('adminContractTypes-edit', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement);
|
||||
sunrise.populateAliases(modalElement);
|
||||
modalElement.querySelector('#contractTypeEdit--contractTypeId').value = contractTypeId.toString();
|
||||
modalElement.querySelector('#contractTypeEdit--contractType').value = contractType.contractType;
|
||||
if (contractType.isPreneed) {
|
||||
;
|
||||
modalElement.querySelector('#contractTypeEdit--isPreneed').checked = true;
|
||||
}
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
editCloseModalFunction = closeModalFunction;
|
||||
|
|
@ -96,7 +102,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
let addCloseModalFunction;
|
||||
function doAdd(submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/doAddContractTypeField`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/doAddContractTypeField`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
expandedContractTypes.add(contractTypeId);
|
||||
contractTypeResponseHandler(responseJSON);
|
||||
|
|
@ -108,7 +114,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
cityssm.openHtmlModal('adminContractTypes-addField', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement);
|
||||
sunrise.populateAliases(modalElement);
|
||||
if (contractTypeId) {
|
||||
;
|
||||
modalElement.querySelector('#contractTypeFieldAdd--contractTypeId').value = contractTypeId.toString();
|
||||
|
|
@ -128,7 +134,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
function moveContractType(clickEvent) {
|
||||
const buttonElement = clickEvent.currentTarget;
|
||||
const contractTypeId = clickEvent.currentTarget.closest('.container--contractType').dataset.contractTypeId;
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||
? 'doMoveContractTypeUp'
|
||||
: 'doMoveContractTypeDown'}`, {
|
||||
contractTypeId,
|
||||
|
|
@ -179,7 +185,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
function doUpdate(submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateContractTypeField`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/doUpdateContractTypeField`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
contractTypeResponseHandler(responseJSON);
|
||||
if (responseJSON.success) {
|
||||
|
|
@ -188,7 +194,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
});
|
||||
}
|
||||
function doDelete() {
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteContractTypeField`, {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/doDeleteContractTypeField`, {
|
||||
contractTypeFieldId
|
||||
}, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
|
|
@ -211,7 +217,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
cityssm.openHtmlModal('adminContractTypes-editField', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement);
|
||||
sunrise.populateAliases(modalElement);
|
||||
modalElement.querySelector('#contractTypeFieldEdit--contractTypeFieldId').value = contractTypeField.contractTypeFieldId.toString();
|
||||
modalElement.querySelector('#contractTypeFieldEdit--contractTypeField').value = contractTypeField.contractTypeField ?? '';
|
||||
modalElement.querySelector('#contractTypeFieldEdit--isRequired').value = contractTypeField.isRequired ?? false ? '1' : '0';
|
||||
|
|
@ -257,7 +263,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
function moveContractTypeField(clickEvent) {
|
||||
const buttonElement = clickEvent.currentTarget;
|
||||
const contractTypeFieldId = clickEvent.currentTarget.closest('.container--contractTypeField').dataset.contractTypeFieldId;
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||
? // eslint-disable-next-line no-secrets/no-secrets
|
||||
'doMoveContractTypeFieldUp'
|
||||
: // eslint-disable-next-line no-secrets/no-secrets
|
||||
|
|
@ -296,7 +302,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
${los.getMoveUpDownButtonFieldHTML('button--moveContractTypeFieldUp', 'button--moveContractTypeFieldDown')}
|
||||
${sunrise.getMoveUpDownButtonFieldHTML('button--moveContractTypeFieldUp', 'button--moveContractTypeFieldDown')}
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
|
@ -314,7 +320,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
let closeAddModalFunction;
|
||||
function doAdd(formEvent) {
|
||||
formEvent.preventDefault();
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/doAddContractTypePrint`, formEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/doAddContractTypePrint`, formEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
closeAddModalFunction();
|
||||
|
|
@ -324,7 +330,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
cityssm.openHtmlModal('adminContractTypes-addPrint', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement);
|
||||
sunrise.populateAliases(modalElement);
|
||||
modalElement.querySelector('#contractTypePrintAdd--contractTypeId').value = contractTypeId;
|
||||
const printSelectElement = modalElement.querySelector('#contractTypePrintAdd--printEJS');
|
||||
for (const [printEJS, printTitle] of Object.entries(exports.contractTypePrintTitles)) {
|
||||
|
|
@ -344,7 +350,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const buttonElement = clickEvent.currentTarget;
|
||||
const printEJS = buttonElement.closest('.container--contractTypePrint').dataset.printEJS;
|
||||
const contractTypeId = buttonElement.closest('.container--contractTypePrintList').dataset.contractTypeId;
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||
? 'doMoveContractTypePrintUp'
|
||||
: 'doMoveContractTypePrintDown'}`, {
|
||||
contractTypeId,
|
||||
|
|
@ -357,7 +363,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const printEJS = clickEvent.currentTarget.closest('.container--contractTypePrint').dataset.printEJS;
|
||||
const contractTypeId = clickEvent.currentTarget.closest('.container--contractTypePrintList').dataset.contractTypeId;
|
||||
function doDelete() {
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteContractTypePrint`, {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/doDeleteContractTypePrint`, {
|
||||
contractTypeId,
|
||||
printEJS
|
||||
}, contractTypeResponseHandler);
|
||||
|
|
@ -408,7 +414,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
${los.getMoveUpDownButtonFieldHTML('button--moveContractTypePrintUp', 'button--moveContractTypePrintDown')}
|
||||
${sunrise.getMoveUpDownButtonFieldHTML('button--moveContractTypePrintUp', 'button--moveContractTypePrintDown')}
|
||||
</div>
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-danger button--deleteContractTypePrint" data-tooltip="Delete" type="button" aria-label="Delete Print">
|
||||
|
|
@ -482,6 +488,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
<div class="level-item">
|
||||
<h2 class="title is-4">${cityssm.escapeHTML(contractType.contractType)}</h2>
|
||||
</div>
|
||||
${contractType.isPreneed
|
||||
? `<div class="level-item">
|
||||
<span class="tag is-info">Preneed</span>
|
||||
</div>`
|
||||
: ''}
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
|
|
@ -503,7 +514,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
</button>
|
||||
</div>
|
||||
<div class="level-item">
|
||||
${los.getMoveUpDownButtonFieldHTML('button--moveContractTypeUp', 'button--moveContractTypeDown')}
|
||||
${sunrise.getMoveUpDownButtonFieldHTML('button--moveContractTypeUp', 'button--moveContractTypeDown')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -562,7 +573,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
let addCloseModalFunction;
|
||||
function doAdd(submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/doAddContractType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/admin/doAddContractType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
addCloseModalFunction();
|
||||
|
|
@ -580,7 +591,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
cityssm.openHtmlModal('adminContractTypes-add', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement);
|
||||
sunrise.populateAliases(modalElement);
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
addCloseModalFunction = closeModalFunction;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
|
||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||
|
||||
|
|
@ -26,7 +28,7 @@ type ResponseJSON =
|
|||
errorMessage?: string
|
||||
}
|
||||
;(() => {
|
||||
const los = exports.sunrise as Sunrise
|
||||
const sunrise = exports.sunrise as Sunrise
|
||||
|
||||
const contractTypesContainerElement = document.querySelector(
|
||||
'#container--contractTypes'
|
||||
|
|
@ -104,7 +106,7 @@ type ResponseJSON =
|
|||
|
||||
function doDelete(): void {
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/doDeleteContractType`,
|
||||
`${sunrise.urlPrefix}/admin/doDeleteContractType`,
|
||||
{
|
||||
contractTypeId
|
||||
},
|
||||
|
|
@ -144,7 +146,7 @@ type ResponseJSON =
|
|||
submitEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/doUpdateContractType`,
|
||||
`${sunrise.urlPrefix}/admin/doUpdateContractType`,
|
||||
submitEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as ResponseJSON
|
||||
|
|
@ -159,7 +161,7 @@ type ResponseJSON =
|
|||
|
||||
cityssm.openHtmlModal('adminContractTypes-edit', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement)
|
||||
sunrise.populateAliases(modalElement)
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#contractTypeEdit--contractTypeId'
|
||||
|
|
@ -170,6 +172,14 @@ type ResponseJSON =
|
|||
'#contractTypeEdit--contractType'
|
||||
) as HTMLInputElement
|
||||
).value = contractType.contractType
|
||||
|
||||
if (contractType.isPreneed) {
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#contractTypeEdit--isPreneed'
|
||||
) as HTMLInputElement
|
||||
).checked = true
|
||||
}
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
editCloseModalFunction = closeModalFunction
|
||||
|
|
@ -205,7 +215,7 @@ type ResponseJSON =
|
|||
submitEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/doAddContractTypeField`,
|
||||
`${sunrise.urlPrefix}/admin/doAddContractTypeField`,
|
||||
submitEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as ResponseJSON
|
||||
|
|
@ -226,7 +236,7 @@ type ResponseJSON =
|
|||
|
||||
cityssm.openHtmlModal('adminContractTypes-addField', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement)
|
||||
sunrise.populateAliases(modalElement)
|
||||
|
||||
if (contractTypeId) {
|
||||
;(
|
||||
|
|
@ -264,7 +274,7 @@ type ResponseJSON =
|
|||
).dataset.contractTypeId
|
||||
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/${
|
||||
`${sunrise.urlPrefix}/admin/${
|
||||
buttonElement.dataset.direction === 'up'
|
||||
? 'doMoveContractTypeUp'
|
||||
: 'doMoveContractTypeDown'
|
||||
|
|
@ -341,7 +351,7 @@ type ResponseJSON =
|
|||
submitEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/doUpdateContractTypeField`,
|
||||
`${sunrise.urlPrefix}/admin/doUpdateContractTypeField`,
|
||||
submitEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as ResponseJSON
|
||||
|
|
@ -356,7 +366,7 @@ type ResponseJSON =
|
|||
|
||||
function doDelete(): void {
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/doDeleteContractTypeField`,
|
||||
`${sunrise.urlPrefix}/admin/doDeleteContractTypeField`,
|
||||
{
|
||||
contractTypeFieldId
|
||||
},
|
||||
|
|
@ -386,7 +396,7 @@ type ResponseJSON =
|
|||
|
||||
cityssm.openHtmlModal('adminContractTypes-editField', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement)
|
||||
sunrise.populateAliases(modalElement)
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#contractTypeFieldEdit--contractTypeFieldId'
|
||||
|
|
@ -496,7 +506,7 @@ type ResponseJSON =
|
|||
).dataset.contractTypeFieldId
|
||||
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/${
|
||||
`${sunrise.urlPrefix}/admin/${
|
||||
buttonElement.dataset.direction === 'up'
|
||||
? // eslint-disable-next-line no-secrets/no-secrets
|
||||
'doMoveContractTypeFieldUp'
|
||||
|
|
@ -552,7 +562,7 @@ type ResponseJSON =
|
|||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
${los.getMoveUpDownButtonFieldHTML(
|
||||
${sunrise.getMoveUpDownButtonFieldHTML(
|
||||
'button--moveContractTypeFieldUp',
|
||||
'button--moveContractTypeFieldDown'
|
||||
)}
|
||||
|
|
@ -593,7 +603,7 @@ type ResponseJSON =
|
|||
formEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/doAddContractTypePrint`,
|
||||
`${sunrise.urlPrefix}/admin/doAddContractTypePrint`,
|
||||
formEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as ResponseJSON
|
||||
|
|
@ -609,7 +619,7 @@ type ResponseJSON =
|
|||
|
||||
cityssm.openHtmlModal('adminContractTypes-addPrint', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement)
|
||||
sunrise.populateAliases(modalElement)
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#contractTypePrintAdd--contractTypeId'
|
||||
|
|
@ -649,7 +659,7 @@ type ResponseJSON =
|
|||
).dataset.contractTypeId
|
||||
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/${
|
||||
`${sunrise.urlPrefix}/admin/${
|
||||
buttonElement.dataset.direction === 'up'
|
||||
? 'doMoveContractTypePrintUp'
|
||||
: 'doMoveContractTypePrintDown'
|
||||
|
|
@ -680,7 +690,7 @@ type ResponseJSON =
|
|||
|
||||
function doDelete(): void {
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/doDeleteContractTypePrint`,
|
||||
`${sunrise.urlPrefix}/admin/doDeleteContractTypePrint`,
|
||||
{
|
||||
contractTypeId,
|
||||
printEJS
|
||||
|
|
@ -749,7 +759,7 @@ type ResponseJSON =
|
|||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
${los.getMoveUpDownButtonFieldHTML(
|
||||
${sunrise.getMoveUpDownButtonFieldHTML(
|
||||
'button--moveContractTypePrintUp',
|
||||
'button--moveContractTypePrintDown'
|
||||
)}
|
||||
|
|
@ -862,6 +872,13 @@ type ResponseJSON =
|
|||
<div class="level-item">
|
||||
<h2 class="title is-4">${cityssm.escapeHTML(contractType.contractType)}</h2>
|
||||
</div>
|
||||
${
|
||||
contractType.isPreneed
|
||||
? `<div class="level-item">
|
||||
<span class="tag is-info">Preneed</span>
|
||||
</div>`
|
||||
: ''
|
||||
}
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
|
|
@ -883,7 +900,7 @@ type ResponseJSON =
|
|||
</button>
|
||||
</div>
|
||||
<div class="level-item">
|
||||
${los.getMoveUpDownButtonFieldHTML(
|
||||
${sunrise.getMoveUpDownButtonFieldHTML(
|
||||
'button--moveContractTypeUp',
|
||||
'button--moveContractTypeDown'
|
||||
)}
|
||||
|
|
@ -979,7 +996,7 @@ type ResponseJSON =
|
|||
submitEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
`${los.urlPrefix}/admin/doAddContractType`,
|
||||
`${sunrise.urlPrefix}/admin/doAddContractType`,
|
||||
submitEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as ResponseJSON
|
||||
|
|
@ -1001,7 +1018,7 @@ type ResponseJSON =
|
|||
|
||||
cityssm.openHtmlModal('adminContractTypes-add', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement)
|
||||
sunrise.populateAliases(modalElement)
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
addCloseModalFunction = closeModalFunction
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ function formatTimeString(hour, minute) {
|
|||
const formattedMinute = `00${minute}`.slice(-2);
|
||||
return `${formattedHour}:${formattedMinute}`;
|
||||
}
|
||||
const cemeteryTocemeteryName = {
|
||||
const cemeteryToCemeteryName = {
|
||||
'00': 'Crematorium',
|
||||
GC: 'New Greenwood - Columbarium',
|
||||
HC: 'Holy Sepulchre - Columbarium',
|
||||
|
|
@ -119,7 +119,7 @@ async function getCemetery(dataRow) {
|
|||
if (cemetery === undefined) {
|
||||
console.log(`Creating cemetery: ${dataRow.cemetery}`);
|
||||
const cemeteryId = await addCemetery({
|
||||
cemeteryName: cemeteryTocemeteryName[dataRow.cemetery] ?? dataRow.cemetery,
|
||||
cemeteryName: cemeteryToCemeteryName[dataRow.cemetery] ?? dataRow.cemetery,
|
||||
cemeteryDescription: dataRow.cemetery,
|
||||
cemeterySvg: '',
|
||||
cemeteryLatitude: '',
|
||||
|
|
@ -352,7 +352,7 @@ async function importFromMasterCSV() {
|
|||
if (masterRow.CM_CONTAINER_TYPE !== '') {
|
||||
await addOrUpdateContractField({
|
||||
contractId: deceasedcontractId,
|
||||
contractTypeFieldId: contractType.ContractTypeFields.find((contractTypeField) => contractTypeField.contractTypeField === 'Container Type').contractTypeFieldId,
|
||||
contractTypeFieldId: contractType.contractTypeFields.find((contractTypeField) => contractTypeField.contractTypeField === 'Container Type').contractTypeFieldId,
|
||||
contractFieldValue: masterRow.CM_CONTAINER_TYPE
|
||||
}, user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ function formatTimeString(hour: string, minute: string): TimeString {
|
|||
return `${formattedHour}:${formattedMinute}` as TimeString
|
||||
}
|
||||
|
||||
const cemeteryTocemeteryName = {
|
||||
const cemeteryToCemeteryName = {
|
||||
'00': 'Crematorium',
|
||||
GC: 'New Greenwood - Columbarium',
|
||||
HC: 'Holy Sepulchre - Columbarium',
|
||||
|
|
@ -312,7 +312,7 @@ async function getCemetery(dataRow: {
|
|||
const cemeteryId = await addCemetery(
|
||||
{
|
||||
cemeteryName:
|
||||
cemeteryTocemeteryName[dataRow.cemetery] ?? dataRow.cemetery,
|
||||
cemeteryToCemeteryName[dataRow.cemetery] ?? dataRow.cemetery,
|
||||
cemeteryDescription: dataRow.cemetery,
|
||||
cemeterySvg: '',
|
||||
cemeteryLatitude: '',
|
||||
|
|
@ -702,7 +702,7 @@ async function importFromMasterCSV(): Promise<void> {
|
|||
await addOrUpdateContractField(
|
||||
{
|
||||
contractId: deceasedcontractId,
|
||||
contractTypeFieldId: contractType.ContractTypeFields!.find(
|
||||
contractTypeFieldId: contractType.contractTypeFields!.find(
|
||||
(contractTypeField) =>
|
||||
contractTypeField.contractTypeField === 'Container Type'
|
||||
)!.contractTypeFieldId!,
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ export interface BurialSiteField extends BurialSiteTypeField, Record {
|
|||
export interface ContractType extends Record {
|
||||
contractTypeId: number;
|
||||
contractType: string;
|
||||
isPreneed: boolean;
|
||||
orderNumber?: number;
|
||||
contractTypeFields?: ContractTypeField[];
|
||||
contractTypePrints?: string[];
|
||||
|
|
@ -168,11 +169,26 @@ export interface DynamicsGPDocument {
|
|||
documentDescription: string[];
|
||||
documentTotal: number;
|
||||
}
|
||||
export interface IntermentContainerType extends Record {
|
||||
intermentContainerTypeId: number;
|
||||
intermentContainerType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export interface IntermentCommittalType extends Record {
|
||||
intermentCommittalTypeId: number;
|
||||
intermentCommittalType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export interface ContractInterment extends Record {
|
||||
contractId?: number;
|
||||
intermentNumber?: number;
|
||||
isCremated?: boolean;
|
||||
deceasedName?: string;
|
||||
isCremated?: boolean;
|
||||
deceasedAddress1?: string;
|
||||
deceasedAddress2?: string;
|
||||
deceasedCity?: string;
|
||||
deceasedProvince?: string;
|
||||
deceasedPostalCode?: string;
|
||||
birthDate?: number;
|
||||
birthDateString?: string;
|
||||
birthPlace?: string;
|
||||
|
|
@ -181,8 +197,6 @@ export interface ContractInterment extends Record {
|
|||
deathPlace?: string;
|
||||
intermentDate?: number;
|
||||
intermentDateString?: string;
|
||||
intermentTime?: number;
|
||||
intermentTimeString?: string;
|
||||
intermentContainerTypeId?: number;
|
||||
intermentContainerType?: string;
|
||||
intermentCommittalTypeId?: number;
|
||||
|
|
@ -209,6 +223,7 @@ export interface Contract extends Record {
|
|||
contractId: number;
|
||||
contractTypeId: number;
|
||||
contractType?: string;
|
||||
isPreneed?: boolean;
|
||||
printEJS?: string;
|
||||
burialSiteId?: number;
|
||||
burialSiteTypeId?: number;
|
||||
|
|
@ -228,9 +243,10 @@ export interface Contract extends Record {
|
|||
purchaserPostalCode?: string;
|
||||
purchaserPhoneNumber?: string;
|
||||
purchaserEmail?: string;
|
||||
purchaserRelationship?: string;
|
||||
funeralHomeId?: number;
|
||||
funeralHomeDirectorName?: string;
|
||||
funeralHomeName?: string;
|
||||
funeralDirectorName?: string;
|
||||
contractFields?: ContractField[];
|
||||
contractComments?: ContractComment[];
|
||||
contractInterments?: ContractInterment[];
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ export interface BurialSiteField extends BurialSiteTypeField, Record {
|
|||
export interface ContractType extends Record {
|
||||
contractTypeId: number
|
||||
contractType: string
|
||||
isPreneed: boolean
|
||||
orderNumber?: number
|
||||
contractTypeFields?: ContractTypeField[]
|
||||
contractTypePrints?: string[]
|
||||
|
|
@ -218,12 +219,30 @@ export interface DynamicsGPDocument {
|
|||
documentTotal: number
|
||||
}
|
||||
|
||||
export interface IntermentContainerType extends Record {
|
||||
intermentContainerTypeId: number
|
||||
intermentContainerType: string
|
||||
orderNumber?: number
|
||||
}
|
||||
|
||||
export interface IntermentCommittalType extends Record {
|
||||
intermentCommittalTypeId: number
|
||||
intermentCommittalType: string
|
||||
orderNumber?: number
|
||||
}
|
||||
|
||||
export interface ContractInterment extends Record {
|
||||
contractId?: number
|
||||
intermentNumber?: number
|
||||
|
||||
deceasedName?: string
|
||||
isCremated?: boolean
|
||||
|
||||
deceasedName?: string
|
||||
deceasedAddress1?: string
|
||||
deceasedAddress2?: string
|
||||
deceasedCity?: string
|
||||
deceasedProvince?: string
|
||||
deceasedPostalCode?: string
|
||||
|
||||
birthDate?: number
|
||||
birthDateString?: string
|
||||
|
|
@ -236,9 +255,6 @@ export interface ContractInterment extends Record {
|
|||
intermentDate?: number
|
||||
intermentDateString?: string
|
||||
|
||||
intermentTime?: number
|
||||
intermentTimeString?: string
|
||||
|
||||
intermentContainerTypeId?: number
|
||||
intermentContainerType?: string
|
||||
|
||||
|
|
@ -274,6 +290,8 @@ export interface Contract extends Record {
|
|||
|
||||
contractTypeId: number
|
||||
contractType?: string
|
||||
isPreneed?: boolean
|
||||
|
||||
printEJS?: string
|
||||
|
||||
burialSiteId?: number
|
||||
|
|
@ -298,10 +316,11 @@ export interface Contract extends Record {
|
|||
purchaserPostalCode?: string
|
||||
purchaserPhoneNumber?: string
|
||||
purchaserEmail?: string
|
||||
purchaserRelationship?: string
|
||||
|
||||
funeralHomeId?: number
|
||||
funeralHomeDirectorName?: string
|
||||
funeralHomeName?: string
|
||||
funeralDirectorName?: string
|
||||
|
||||
contractFields?: ContractField[]
|
||||
contractComments?: ContractComment[]
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
<span>
|
||||
<%= (isCreate ? "Create" : "Update") %>
|
||||
<span class="is-hidden-touch">
|
||||
Contract Record
|
||||
Contract
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
|
|
@ -158,7 +158,7 @@
|
|||
required accesskey="f"
|
||||
<%= (isCreate ? " autofocus" : "") %>>
|
||||
<% if (isCreate) { %>
|
||||
<option value="">(No Type)</option>
|
||||
<option value="" data-is-preneed="false">(No Type)</option>
|
||||
<% } %>
|
||||
<% let typeIsFound = false; %>
|
||||
<% for (const contractType of contractTypes) { %>
|
||||
|
|
@ -168,13 +168,16 @@
|
|||
}
|
||||
%>
|
||||
<option value="<%= contractType.contractTypeId %>"
|
||||
<%= (contract.contractTypeId === contractType.contractTypeId ? " selected" : "") %>
|
||||
<%- (contractType.isPreneed ? ' data-is-preneed="true"' : ' data-is-preneed="false"') %>
|
||||
<%= (contract.contractTypeId === contractType.contractTypeId ? ' selected' : '') %>
|
||||
<%= (!isCreate && contract.contractTypeId !== contractType.contractTypeId ? " disabled" : "") %>>
|
||||
<%= contractType.contractType %>
|
||||
</option>
|
||||
<% } %>
|
||||
<% if (contract.contractTypeId && !typeIsFound) { %>
|
||||
<option value="<%= contract.contractTypeId %>" selected>
|
||||
<option value="<%= contract.contractTypeId %>"
|
||||
<%- (contract.isPreneed ? ' data-is-preneed="true"' : ' data-is-preneed="false"') %>
|
||||
selected>
|
||||
<%= contract.contractType %>
|
||||
</option>
|
||||
<% } %>
|
||||
|
|
@ -201,7 +204,7 @@
|
|||
<%= (isCreate ? "" : " disabled readonly") %> />
|
||||
</div>
|
||||
<div class="control is-hidden-print">
|
||||
<button class="button is-clear-lot-button" data-tooltip="Clear" type="button" aria-label="Clear Burial Site Field">
|
||||
<button class="button is-clear-burial-site-button" data-tooltip="Clear" type="button" aria-label="Clear Burial Site Field">
|
||||
<i class="fas fa-eraser" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -211,7 +214,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="control is-hidden-print">
|
||||
<button class="button is-lot-view-button" data-tooltip="Open Burial Site" type="button" aria-label="Open Burial Site">
|
||||
<button class="button is-burial-site-view-button" data-tooltip="Open Burial Site" type="button" aria-label="Open Burial Site">
|
||||
<i class="fas fa-external-link-alt" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -304,7 +307,8 @@
|
|||
<% } %>
|
||||
minlength="<%= contractField.minLength %>"
|
||||
maxlength="<%= contractField.maxLength %>"
|
||||
<%= contractField.isRequired ? " required" : "" %> />
|
||||
<%= contractField.isRequired ? " required" : "" %>
|
||||
/>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -317,6 +321,44 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h2 class="panel-heading">Funeral Home</h2>
|
||||
<div class="panel-block is-block">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--funeralHomeId">
|
||||
Funeral Home
|
||||
</label>
|
||||
<div class="control">
|
||||
<div class="select is-fullwidth">
|
||||
<select id="contract--funeralHomeId" name="funeralHomeId">
|
||||
<option value="">(No Funeral Home)</option>
|
||||
<% for (const funeralHome of funeralHomes) { %>
|
||||
<option value="<%= funeralHome.funeralHomeId %>"
|
||||
<%= (contract.funeralHomeId === funeralHome.funeralHomeId ? " selected" : "") %>>
|
||||
<%= funeralHome.funeralHomeName %>
|
||||
</option>
|
||||
<% } %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--funeralDirectorName">
|
||||
Funeral Director's Name
|
||||
</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--funeralDirectorName" name="funeralDirectorName" type="text" maxlength="100" autocomplete="off" value="<%= contract.funeralDirectorName %>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="panel">
|
||||
|
|
@ -330,7 +372,6 @@
|
|||
<input class="input" id="contract--purchaserName" name="purchaserName" type="text" maxlength="100" autocomplete="off" required value="<%= contract.purchaserName %>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label" for="contract--purchaserAddress1">Address</label>
|
||||
<div class="control">
|
||||
|
|
@ -373,174 +414,324 @@
|
|||
<div class="field">
|
||||
<label class="label" for="contract--purchaserPhoneNumber">Phone Number</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--purchaserPhoneNumber" name="purchaserPhoneNumber" type="text" maxlength="30" autocomplete="off" />
|
||||
<input class="input" id="contract--purchaserPhoneNumber" name="purchaserPhoneNumber" type="text" maxlength="30" autocomplete="off" value="<%= contract.purchaserPhoneNumber %>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--purchaserEmailAddress">Email Address</label>
|
||||
<label class="label" for="contract--purchaserEmail">Email Address</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--purchaserEmailAddress" name="purchaserEmailAddress" type="email" maxlength="100" autocomplete="off" />
|
||||
<input class="input" id="contract--purchaserEmail" name="purchaserEmail" type="email" maxlength="100" autocomplete="off" value="<%= contract.purchaserEmail %>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="contract--purchaserRelationship">
|
||||
Relationship to Deceased
|
||||
</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--purchaserRelationship" name="purchaserRelationship" type="text" maxlength="100" autocomplete="off" value="<%= contract.purchaserRelationship %>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="panel">
|
||||
<h2 class="panel-heading">Deceased</h2>
|
||||
|
||||
</div>
|
||||
<div class="panel">
|
||||
<h2 class="panel-heading">Funeral Home</h2>
|
||||
|
||||
</div>
|
||||
<% if (isCreate) { %>
|
||||
<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 is-recipient-or-deceased">
|
||||
<%= (contract.isPreneed ? "Recipient" : "Deceased") %>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-hidden-print" id="button--copyFromPurchaser" type="button">
|
||||
<span class="icon is-small"><i class="far fa-copy" aria-hidden="true"></i></span>
|
||||
<span>Copy from Purchaser</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block is-block">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--deceasedName">
|
||||
<span class="is-recipient-or-deceased"><%= (contract.isPreneed ? "Recipient" : "Deceased") %></span>
|
||||
Name
|
||||
</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--deceasedName" name="deceasedName" type="text" maxlength="100" autocomplete="off" required value="<%= contract.deceasedName %>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="contract--deceasedAddress1">Address</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--deceasedAddress1" name="deceasedAddress1" type="text" maxlength="50" placeholder="Line 1" autocomplete="off" value="<%= contract.deceasedAddress1 %>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input" id="contract--deceasedAddress2" name="deceasedAddress2" type="text" maxlength="50" placeholder="Line 2" autocomplete="off" aria-label="Address Line 2" value="<%= contract.deceasedAddress2 %>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--deceasedCity">City</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--deceasedCity" name="deceasedCity" type="text" maxlength="20" value="<%= contract.deceasedCity %>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--deceasedProvince">Province</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--deceasedProvince" name="deceasedProvince" type="text" maxlength="2" value="<%= contract.deceasedProvince %>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--deceasedPostalCode">Postal Code</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--deceasedPostalCode" name="deceasedPostalCode" type="text" maxlength="7" autocomplete="off" value="<%= contract.deceasedPostalCode %>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--birthDateString">
|
||||
Date of Birth
|
||||
</label>
|
||||
<div class="control has-icons-left">
|
||||
<input class="input" id="contract--birthDateString" name="birthDateString" type="date" value="<%= contract.birthDateString %>" />
|
||||
<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--birthPlace">
|
||||
Place of Birth
|
||||
</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--birthPlace" name="birthPlace" type="text" maxlength="100" autocomplete="off" value="<%= contract.deceasedPlaceOfBirth %>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="contract--deathDateString">
|
||||
Date of Death
|
||||
</label>
|
||||
<div class="control has-icons-left">
|
||||
<input class="input" id="contract--deathDateString" name="deathDateString" type="date" value="<%= contract.deceasedDateOfDeathString %>" />
|
||||
<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--deathPlace">
|
||||
Place of Death
|
||||
</label>
|
||||
<div class="control">
|
||||
<input class="input" id="contract--deathPlace" name="deathPlace" type="text" maxlength="100" autocomplete="off" value="<%= contract.deceasedPlaceOfDeath %>" />
|
||||
</div>
|
||||
</div>
|
||||
</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.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<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">
|
||||
<%= (contract.isPreneed ? "Recipient" : "Deceased") %>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--addInterment" type="button">
|
||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Add Additional <%= (contract.isPreneed ? "Recipient" : "Deceased") %></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block is-block">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<% if (!isCreate) { %>
|
||||
<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">Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--addComment" type="button">
|
||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Add Comment</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block is-block" id="container--contractComments"></div>
|
||||
</div>
|
||||
|
||||
<%
|
||||
const workOrderOpenDateAlias = configFunctions.getConfigProperty("aliases.workOrderOpenDate");
|
||||
const workOrderCloseDateAlias = configFunctions.getConfigProperty("aliases.workOrderCloseDate");
|
||||
%>
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<div class="level is-mobile">
|
||||
<div class="columns is-desktop mt-4">
|
||||
<div class="column is-7-desktop">
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<div class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<h2 class="has-text-weight-bold is-size-5">Work Orders</h2>
|
||||
<div class="level-item">
|
||||
<h2 class="has-text-weight-bold is-size-5">Fees</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--createWorkOrder" type="button">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--addFee" type="button">
|
||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Create a Work Order</span>
|
||||
<span>Add Fee</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block is-block">
|
||||
<% if (contract.workOrders.length === 0) { %>
|
||||
<div class="message is-info">
|
||||
<p class="message-body">
|
||||
There are no work orders associated with this record.
|
||||
</p>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<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 class="panel-block is-block" id="container--contractFees"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<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">Transactions</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--addTransaction" type="button">
|
||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Add Transaction</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block is-block" id="container--contractTransactions"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="columns is-desktop">
|
||||
<div class="column is-7-desktop">
|
||||
<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">Fees</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--addFee" type="button">
|
||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Add Fee</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
const workOrderOpenDateAlias = configFunctions.getConfigProperty("aliases.workOrderOpenDate");
|
||||
const workOrderCloseDateAlias = configFunctions.getConfigProperty("aliases.workOrderCloseDate");
|
||||
%>
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<div class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<h2 class="has-text-weight-bold is-size-5">Work Orders</h2>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--createWorkOrder" type="button">
|
||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Create a Work Order</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block is-block" id="container--contractFees"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<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">Transactions</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--addTransaction" type="button">
|
||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Add Transaction</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block is-block">
|
||||
<% if (contract.workOrders.length === 0) { %>
|
||||
<div class="message is-info">
|
||||
<p class="message-body">
|
||||
There are no work orders associated with this record.
|
||||
</p>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<table class="table is-fullwidth is-striped is-hoverable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Work Order Number</th>
|
||||
<th>Description</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for (const workOrder of contract.workOrders) { %>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="has-text-weight-bold" href="<%= urlPrefix %>/workOrders/<%= workOrder.workOrderId %>">
|
||||
<%= workOrder.workOrderNumber %>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<%= workOrder.workOrderType %><br />
|
||||
<span class="is-size-7"><%= workOrder.workOrderDescription %></span>
|
||||
</td>
|
||||
<td class="is-nowrap">
|
||||
<span class="has-tooltip-left" data-tooltip="<%= workOrderOpenDateAlias %>">
|
||||
<i class="fas fa-fw fa-play" aria-label="<%= workOrderOpenDateAlias %>"></i>
|
||||
<%= workOrder.workOrderOpenDateString %>
|
||||
</span><br />
|
||||
<span class="has-tooltip-left" data-tooltip="<%= workOrderCloseDateAlias %>">
|
||||
<i class="fas fa-fw fa-stop" aria-label="<%= workOrderCloseDateAlias %>"></i>
|
||||
<% if (workOrder.workOrderCloseDate) { %>
|
||||
<%= workOrder.workOrderCloseDateString %>
|
||||
<% } else { %>
|
||||
<span class="has-text-grey">(No <%= workOrderCloseDateAlias %>)</span>
|
||||
<% } %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="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">Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<button class="button is-small is-success is-hidden-print" id="button--addComment" type="button">
|
||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Add Comment</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="panel-block is-block" id="container--contractTransactions"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block is-block" id="container--contractComments"></div>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<%- include('_footerA'); -%>
|
||||
|
|
@ -557,10 +748,6 @@
|
|||
|
||||
exports.workOrderTypes = <%- JSON.stringify(workOrderTypes) %>;
|
||||
<% } %>
|
||||
|
||||
exports.burialSiteTypes = <%- JSON.stringify(burialSiteTypes) %>;
|
||||
exports.burialSiteStatuses = <%- JSON.stringify(burialSiteStatuses) %>;
|
||||
exports.cemeteries = <%- JSON.stringify(cemeteries) %>;
|
||||
</script>
|
||||
|
||||
<script src="<%= urlPrefix %>/javascripts/contract.edit.js"></script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue