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