major refactoring

cemeteries and burial sites working again
deepsource-autofix-76c6eb20
Dan Gowans 2025-02-26 15:45:33 -05:00
parent 0bdc76247f
commit a6524635c0
103 changed files with 1269 additions and 1199 deletions

View File

@ -1,11 +1,11 @@
import { testAdmin } from '../../../test/_globals.js';
import { login, logout } from '../../support/index.js';
describe('Admin - Occupancy Type Management', () => {
describe('Admin - Contract Type Management', () => {
beforeEach('Loads page', () => {
logout();
login(testAdmin);
cy.visit('/admin/occupancyTypes');
cy.location('pathname').should('equal', '/admin/occupancyTypes');
cy.visit('/admin/contractTypes');
cy.location('pathname').should('equal', '/admin/contractTypes');
});
afterEach(logout);
it('Has no detectable accessibility issues', () => {

View File

@ -1,12 +1,12 @@
import { testAdmin } from '../../../test/_globals.js'
import { login, logout } from '../../support/index.js'
describe('Admin - Occupancy Type Management', () => {
describe('Admin - Contract Type Management', () => {
beforeEach('Loads page', () => {
logout()
login(testAdmin)
cy.visit('/admin/occupancyTypes')
cy.location('pathname').should('equal', '/admin/occupancyTypes')
cy.visit('/admin/contractTypes')
cy.location('pathname').should('equal', '/admin/contractTypes')
})
afterEach(logout)

View File

@ -9,11 +9,11 @@ describe('Update - Lots', () => {
it('Has a "Create" link on the Lot Search', () => {
cy.visit('/lots');
cy.location('pathname').should('equal', '/lots');
cy.get("a[href$='/lots/new']").should('exist');
cy.get("a[href$='/burialSites/new']").should('exist');
});
describe('Update a New Lot', () => {
it('Has no detectable accessibility issues', () => {
cy.visit('/lots/new');
cy.visit('/burialSites/new');
cy.injectAxe();
cy.checkA11y();
});

View File

@ -12,12 +12,12 @@ describe('Update - Lots', () => {
it('Has a "Create" link on the Lot Search', () => {
cy.visit('/lots')
cy.location('pathname').should('equal', '/lots')
cy.get("a[href$='/lots/new']").should('exist')
cy.get("a[href$='/burialSites/new']").should('exist')
})
describe('Update a New Lot', () => {
it('Has no detectable accessibility issues', () => {
cy.visit('/lots/new')
cy.visit('/burialSites/new')
cy.injectAxe()
cy.checkA11y()
})

View File

@ -16,16 +16,16 @@ describe('Read Only User', () => {
cy.log('Has no links to admin areas');
cy.get("a[href*='/admin']").should('not.exist');
});
it('Has no link to create maps on Map Search', () => {
cy.visit('/maps');
it('Has no link to create cemeteries on Cemetery Search', () => {
cy.visit('/cemeteries');
cy.get("a[href*='/new']").should('not.exist');
});
it('Has no link to create lots on Lot Search', () => {
cy.visit('/lots');
it('Has no link to create burial sites on Burial Site Search', () => {
cy.visit('/burialSites');
cy.get("a[href*='/new']").should('not.exist');
});
it('Has no link to create occupancies on Occupancy Search', () => {
cy.visit('/lotOccupancies');
it('Has no link to create contracts on Contract Search', () => {
cy.visit('/contracts');
cy.get("a[href*='/new']").should('not.exist');
});
it('Has no link to create work orders on Work Order Search', () => {

View File

@ -25,18 +25,18 @@ describe('Read Only User', () => {
cy.get("a[href*='/admin']").should('not.exist')
})
it('Has no link to create maps on Map Search', () => {
cy.visit('/maps')
it('Has no link to create cemeteries on Cemetery Search', () => {
cy.visit('/cemeteries')
cy.get("a[href*='/new']").should('not.exist')
})
it('Has no link to create lots on Lot Search', () => {
cy.visit('/lots')
it('Has no link to create burial sites on Burial Site Search', () => {
cy.visit('/burialSites')
cy.get("a[href*='/new']").should('not.exist')
})
it('Has no link to create occupancies on Occupancy Search', () => {
cy.visit('/lotOccupancies')
it('Has no link to create contracts on Contract Search', () => {
cy.visit('/contracts')
cy.get("a[href*='/new']").should('not.exist')
})

View File

@ -3,13 +3,14 @@ export const config = { ...cemeteryConfig };
config.aliases.externalReceiptNumber = 'GP Receipt Number';
config.settings.burialSites.burialSiteNameSegments = {
separator: '-',
includeCemeteryKey: true,
segments: {
1: {
isRequired: true,
isRequired: false,
isAvailable: true,
label: 'Block',
minLength: 1,
maxLength: 3
maxLength: 1
},
2: {
isRequired: true,
@ -23,7 +24,7 @@ config.settings.burialSites.burialSiteNameSegments = {
isAvailable: true,
label: 'Lot',
minLength: 1,
maxLength: 3
maxLength: 4
},
4: {
isRequired: true,

View File

@ -8,13 +8,14 @@ config.aliases.externalReceiptNumber = 'GP Receipt Number'
config.settings.burialSites.burialSiteNameSegments = {
separator: '-',
includeCemeteryKey: true,
segments: {
1: {
isRequired: true,
isRequired: false,
isAvailable: true,
label: 'Block',
minLength: 1,
maxLength: 3
maxLength: 1
},
2: {
isRequired: true,
@ -28,7 +29,7 @@ config.settings.burialSites.burialSiteNameSegments = {
isAvailable: true,
label: 'Lot',
minLength: 1,
maxLength: 3
maxLength: 4
},
4: {
isRequired: true,

View File

@ -1,10 +1,12 @@
import { buildBurialSiteName } from '../helpers/burialSites.helpers.js';
import addOrUpdateBurialSiteField from './addOrUpdateBurialSiteField.js';
import getCemetery from './getCemetery.js';
import { acquireConnection } from './pool.js';
export default async function addBurialSite(burialSiteForm, user) {
const database = await acquireConnection();
const rightNowMillis = Date.now();
const burialSiteName = buildBurialSiteName(burialSiteForm);
const cemetery = burialSiteForm.cemeteryId === '' ? undefined : await getCemetery(burialSiteForm.cemeteryId, database);
const burialSiteName = buildBurialSiteName(cemetery?.cemeteryKey, burialSiteForm);
const result = database
.prepare(`insert into BurialSites (
burialSiteNameSegment1,

View File

@ -1,6 +1,7 @@
import { buildBurialSiteName } from '../helpers/burialSites.helpers.js'
import addOrUpdateBurialSiteField from './addOrUpdateBurialSiteField.js'
import getCemetery from './getCemetery.js'
import { acquireConnection } from './pool.js'
export interface AddBurialSiteForm {
@ -31,7 +32,11 @@ export default async function addBurialSite(
const rightNowMillis = Date.now()
const burialSiteName = buildBurialSiteName(burialSiteForm)
const cemetery = burialSiteForm.cemeteryId === '' ? undefined : await getCemetery(burialSiteForm.cemeteryId, database)
const burialSiteName = buildBurialSiteName(
cemetery?.cemeteryKey,
burialSiteForm)
const result = database
.prepare(

View File

@ -5,8 +5,8 @@ export interface AddBurialSiteTypeFieldForm {
fieldValues?: string;
isRequired?: string;
pattern?: string;
minimumLength?: string | number;
maximumLength?: string | number;
minLength?: string | number;
maxLength?: string | number;
orderNumber?: number;
}
export default function addBurialSiteTypeField(addForm: AddBurialSiteTypeFieldForm, user: User): Promise<number>;

View File

@ -8,12 +8,12 @@ export default async function addBurialSiteTypeField(addForm, user) {
burialSiteTypeId, burialSiteTypeField,
fieldType, fieldValues,
isRequired, pattern,
minimumLength, maximumLength,
minLength, maxLength,
orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(addForm.burialSiteTypeId, addForm.burialSiteTypeField, addForm.fieldType ?? 'text', addForm.fieldValues ?? '', addForm.isRequired === '' ? 0 : 1, addForm.pattern ?? '', addForm.minimumLength ?? 0, addForm.maximumLength ?? 100, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
.run(addForm.burialSiteTypeId, addForm.burialSiteTypeField, addForm.fieldType ?? 'text', addForm.fieldValues ?? '', addForm.isRequired === '' ? 0 : 1, addForm.pattern ?? '', addForm.minLength ?? 0, addForm.maxLength ?? 100, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
database.release();
clearCacheByTableName('BurialSiteTypeFields');
return result.lastInsertRowid;

View File

@ -9,8 +9,8 @@ export interface AddBurialSiteTypeFieldForm {
fieldValues?: string
isRequired?: string
pattern?: string
minimumLength?: string | number
maximumLength?: string | number
minLength?: string | number
maxLength?: string | number
orderNumber?: number
}
@ -28,7 +28,7 @@ export default async function addBurialSiteTypeField(
burialSiteTypeId, burialSiteTypeField,
fieldType, fieldValues,
isRequired, pattern,
minimumLength, maximumLength,
minLength, maxLength,
orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
@ -41,8 +41,8 @@ export default async function addBurialSiteTypeField(
addForm.fieldValues ?? '',
addForm.isRequired === '' ? 0 : 1,
addForm.pattern ?? '',
addForm.minimumLength ?? 0,
addForm.maximumLength ?? 100,
addForm.minLength ?? 0,
addForm.maxLength ?? 100,
addForm.orderNumber ?? -1,
user.userName,
rightNowMillis,

View File

@ -5,8 +5,8 @@ export interface AddContractTypeFieldForm {
fieldType?: string;
isRequired?: string;
pattern?: string;
minimumLength?: string | number;
maximumLength?: string | number;
minLength?: string | number;
maxLength?: string | number;
orderNumber?: number;
}
export default function addContractTypeField(addForm: AddContractTypeFieldForm, user: User): Promise<number>;

View File

@ -7,12 +7,12 @@ export default async function addContractTypeField(addForm, user) {
.prepare(`insert into ContractTypeFields (
contractTypeId, contractTypeField, fieldType,
fieldValues, isRequired, pattern,
minimumLength, maximumLength,
minLength, maxLength,
orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(addForm.contractTypeId ?? undefined, addForm.contractTypeField, addForm.fieldType ?? 'text', addForm.fieldValues ?? '', addForm.isRequired === '' ? 0 : 1, addForm.pattern ?? '', addForm.minimumLength ?? 0, addForm.maximumLength ?? 100, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
.run(addForm.contractTypeId ?? undefined, addForm.contractTypeField, addForm.fieldType ?? 'text', addForm.fieldValues ?? '', addForm.isRequired === '' ? 0 : 1, addForm.pattern ?? '', addForm.minLength ?? 0, addForm.maxLength ?? 100, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
database.release();
clearCacheByTableName('ContractTypeFields');
return result.lastInsertRowid;

View File

@ -9,8 +9,8 @@ export interface AddContractTypeFieldForm {
fieldType?: string
isRequired?: string
pattern?: string
minimumLength?: string | number
maximumLength?: string | number
minLength?: string | number
maxLength?: string | number
orderNumber?: number
}
@ -27,7 +27,7 @@ export default async function addContractTypeField(
`insert into ContractTypeFields (
contractTypeId, contractTypeField, fieldType,
fieldValues, isRequired, pattern,
minimumLength, maximumLength,
minLength, maxLength,
orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
@ -40,8 +40,8 @@ export default async function addContractTypeField(
addForm.fieldValues ?? '',
addForm.isRequired === '' ? 0 : 1,
addForm.pattern ?? '',
addForm.minimumLength ?? 0,
addForm.maximumLength ?? 100,
addForm.minLength ?? 0,
addForm.maxLength ?? 100,
addForm.orderNumber ?? -1,
user.userName,
rightNowMillis,

View File

@ -13,7 +13,7 @@ const baseSQL = `select l.burialSiteId,
l.burialSiteStatusId, s.burialSiteStatus,
l.cemeteryId, m.cemeteryName,
m.cemeterySvg, l.cemeterySvgId,
l.burialSiteLatitude, l.burialSiteLongitude,
l.burialSiteLatitude, l.burialSiteLongitude
from BurialSites l
left join BurialSiteTypes t on l.burialSiteTypeId = t.burialSiteTypeId

View File

@ -16,7 +16,7 @@ const baseSQL = `select l.burialSiteId,
l.burialSiteStatusId, s.burialSiteStatus,
l.cemeteryId, m.cemeteryName,
m.cemeterySvg, l.cemeterySvgId,
l.burialSiteLatitude, l.burialSiteLongitude,
l.burialSiteLatitude, l.burialSiteLongitude
from BurialSites l
left join BurialSiteTypes t on l.burialSiteTypeId = t.burialSiteTypeId

View File

@ -4,7 +4,7 @@ export default async function getBurialSiteContractField(burialSiteContractId, c
const fields = database
.prepare(`select o.burialSiteContractId, o.contractTypeFieldId,
o.fieldValue, f.contractTypeField, f.fieldType, f.fieldValues,
f.isRequired, f.pattern, f.minimumLength, f.maximumLength,
f.isRequired, f.pattern, f.minLength, f.maxLength,
f.orderNumber, t.orderNumber as contractTypeOrderNumber
from BurialSiteContractFields o
left join ContractTypeFields f on o.contractTypeFieldId = f.contractTypeFieldId
@ -16,7 +16,7 @@ export default async function getBurialSiteContractField(burialSiteContractId, c
select ? as burialSiteContractId, f.contractTypeFieldId,
'' as fieldValue, f.contractTypeField, f.fieldType, f.fieldValues,
f.isRequired, f.pattern, f.minimumLength, f.maximumLength,
f.isRequired, f.pattern, f.minLength, f.maxLength,
f.orderNumber, t.orderNumber as contractTypeOrderNumber
from ContractTypeFields f
left join ContractTypes t on f.contractTypeId = t.contractTypeId

View File

@ -14,7 +14,7 @@ export default async function getBurialSiteContractField(
.prepare(
`select o.burialSiteContractId, o.contractTypeFieldId,
o.fieldValue, f.contractTypeField, f.fieldType, f.fieldValues,
f.isRequired, f.pattern, f.minimumLength, f.maximumLength,
f.isRequired, f.pattern, f.minLength, f.maxLength,
f.orderNumber, t.orderNumber as contractTypeOrderNumber
from BurialSiteContractFields o
left join ContractTypeFields f on o.contractTypeFieldId = f.contractTypeFieldId
@ -26,7 +26,7 @@ export default async function getBurialSiteContractField(
select ? as burialSiteContractId, f.contractTypeFieldId,
'' as fieldValue, f.contractTypeField, f.fieldType, f.fieldValues,
f.isRequired, f.pattern, f.minimumLength, f.maximumLength,
f.isRequired, f.pattern, f.minLength, f.maxLength,
f.orderNumber, t.orderNumber as contractTypeOrderNumber
from ContractTypeFields f
left join ContractTypes t on f.contractTypeId = t.contractTypeId

View File

@ -10,7 +10,7 @@ function buildWhereClause(filters) {
let sqlWhereClause = ' where o.recordDelete_timeMillis is null';
const sqlParameters = [];
if ((filters.burialSiteId ?? '') !== '') {
sqlWhereClause += ' and o.lotId = ?';
sqlWhereClause += ' and o.burialSiteId = ?';
sqlParameters.push(filters.burialSiteId);
}
const lotNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, filters.burialSiteNameSearchType ?? '', 'l');

View File

@ -51,7 +51,7 @@ function buildWhereClause(filters: GetBurialSiteContractsFilters): {
const sqlParameters: unknown[] = []
if ((filters.burialSiteId ?? '') !== '') {
sqlWhereClause += ' and o.lotId = ?'
sqlWhereClause += ' and o.burialSiteId = ?'
sqlParameters.push(filters.burialSiteId)
}

View File

@ -5,7 +5,7 @@ export default async function getBurialSiteFields(burialSiteId, connectedDatabas
.prepare(`select l.burialSiteId, l.burialSiteTypeFieldId,
l.fieldValue,
f.burialSiteTypeField, f.fieldType, f.fieldValues,
f.isRequired, f.pattern, f.minimumLength, f.maximumLength,
f.isRequired, f.pattern, f.minLength, f.maxLength,
f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber
from BurialSiteFields l
left join BurialSiteTypeFields f on l.burialSiteTypeFieldId = f.burialSiteTypeFieldId
@ -18,7 +18,7 @@ export default async function getBurialSiteFields(burialSiteId, connectedDatabas
select ? as burialSiteId, f.burialSiteTypeFieldId,
'' as fieldValue,
f.burialSiteTypeField, f.fieldType, f.fieldValues,
f.isRequired, f.pattern, f.minimumLength, f.maximumLength,
f.isRequired, f.pattern, f.minLength, f.maxLength,
f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber
from BurialSiteTypeFields f
left join BurialSiteTypes t on f.burialSiteTypeId = t.burialSiteTypeId

View File

@ -15,7 +15,7 @@ export default async function getBurialSiteFields(
`select l.burialSiteId, l.burialSiteTypeFieldId,
l.fieldValue,
f.burialSiteTypeField, f.fieldType, f.fieldValues,
f.isRequired, f.pattern, f.minimumLength, f.maximumLength,
f.isRequired, f.pattern, f.minLength, f.maxLength,
f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber
from BurialSiteFields l
left join BurialSiteTypeFields f on l.burialSiteTypeFieldId = f.burialSiteTypeFieldId
@ -28,7 +28,7 @@ export default async function getBurialSiteFields(
select ? as burialSiteId, f.burialSiteTypeFieldId,
'' as fieldValue,
f.burialSiteTypeField, f.fieldType, f.fieldValues,
f.isRequired, f.pattern, f.minimumLength, f.maximumLength,
f.isRequired, f.pattern, f.minLength, f.maxLength,
f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber
from BurialSiteTypeFields f
left join BurialSiteTypes t on f.burialSiteTypeId = t.burialSiteTypeId

View File

@ -5,7 +5,7 @@ export default async function getBurialSiteTypeFields(burialSiteTypeId, connecte
const typeFields = database
.prepare(`select burialSiteTypeFieldId,
burialSiteTypeField, fieldType, fieldValues,
isRequired, pattern, minimumLength, maximumLength, orderNumber
isRequired, pattern, minLength, maxLength, orderNumber
from BurialSiteTypeFields
where recordDelete_timeMillis is null
and burialSiteTypeId = ?

View File

@ -15,7 +15,7 @@ export default async function getBurialSiteTypeFields(
.prepare(
`select burialSiteTypeFieldId,
burialSiteTypeField, fieldType, fieldValues,
isRequired, pattern, minimumLength, maximumLength, orderNumber
isRequired, pattern, minLength, maxLength, orderNumber
from BurialSiteTypeFields
where recordDelete_timeMillis is null
and burialSiteTypeId = ?

View File

@ -70,6 +70,7 @@ export default async function getBurialSites(filters, options, connectedDatabase
l.burialSiteNameSegment3,
l.burialSiteNameSegment4,
l.burialSiteNameSegment5,
l.burialSiteName,
t.burialSiteType,
l.cemeteryId, m.cemeteryName, l.cemeterySvgId,
l.burialSiteStatusId, s.burialSiteStatus

View File

@ -123,6 +123,7 @@ export default async function getBurialSites(
l.burialSiteNameSegment3,
l.burialSiteNameSegment4,
l.burialSiteNameSegment5,
l.burialSiteName,
t.burialSiteType,
l.cemeteryId, m.cemeteryName, l.cemeterySvgId,
l.burialSiteStatusId, s.burialSiteStatus

View File

@ -1,2 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { Cemetery } from '../types/recordTypes.js';
export default function getCemetery(cemeteryId: number | string): Promise<Cemetery | undefined>;
export default function getCemetery(cemeteryId: number | string, connectedDatabase?: PoolConnection): Promise<Cemetery | undefined>;

View File

@ -1,7 +1,7 @@
import { acquireConnection } from './pool.js';
export default async function getCemetery(cemeteryId) {
const database = await acquireConnection();
const map = database
export default async function getCemetery(cemeteryId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const cemetery = database
.prepare(`select m.cemeteryId, m.cemeteryName, m.cemeteryKey, m.cemeteryDescription,
m.cemeteryLatitude, m.cemeteryLongitude, m.cemeterySvg,
m.cemeteryAddress1, m.cemeteryAddress2, m.cemeteryCity, m.cemeteryProvince, m.cemeteryPostalCode,
@ -22,6 +22,8 @@ export default async function getCemetery(cemeteryId) {
m.recordUpdate_userName, m.recordUpdate_timeMillis,
m.recordDelete_userName, m.recordDelete_timeMillis`)
.get(cemeteryId);
if (connectedDatabase === undefined) {
database.release();
return map;
}
return cemetery;
}

View File

@ -1,13 +1,16 @@
import type { PoolConnection } from 'better-sqlite-pool'
import type { Cemetery } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export default async function getCemetery(
cemeteryId: number | string
cemeteryId: number | string,
connectedDatabase?: PoolConnection
): Promise<Cemetery | undefined> {
const database = await acquireConnection()
const database = connectedDatabase ?? (await acquireConnection())
const map = database
const cemetery = database
.prepare(
`select m.cemeteryId, m.cemeteryName, m.cemeteryKey, m.cemeteryDescription,
m.cemeteryLatitude, m.cemeteryLongitude, m.cemeterySvg,
@ -31,7 +34,9 @@ export default async function getCemetery(
)
.get(cemeteryId) as Cemetery | undefined
if (connectedDatabase === undefined) {
database.release()
return map
}
return cemetery
}

View File

@ -8,7 +8,7 @@ export default async function getContractTypeFields(contractTypeId, connectedDat
}
const contractTypeFields = database
.prepare(`select contractTypeFieldId, contractTypeField, fieldType,
fieldValues, isRequired, pattern, minimumLength, maximumLength, orderNumber
fieldValues, isRequired, pattern, minLength, maxLength, orderNumber
from ContractTypeFields
where recordDelete_timeMillis is null
${(contractTypeId ?? -1) === -1

View File

@ -20,7 +20,7 @@ export default async function getContractTypeFields(
const contractTypeFields = database
.prepare(
`select contractTypeFieldId, contractTypeField, fieldType,
fieldValues, isRequired, pattern, minimumLength, maximumLength, orderNumber
fieldValues, isRequired, pattern, minLength, maxLength, orderNumber
from ContractTypeFields
where recordDelete_timeMillis is null
${

View File

@ -28,9 +28,9 @@ export async function moveContractTypeFieldDown(contractTypeFieldId) {
export async function moveContractTypeFieldDownToBottom(contractTypeFieldId) {
const database = await acquireConnection();
const currentField = getCurrentField(contractTypeFieldId, database);
const occupancyTypeParameters = [];
const contractTypeParameters = [];
if (currentField.contractTypeId) {
occupancyTypeParameters.push(currentField.contractTypeId);
contractTypeParameters.push(currentField.contractTypeId);
}
const maxOrderNumber = database
.prepare(`select max(orderNumber) as maxOrderNumber
@ -39,10 +39,10 @@ export async function moveContractTypeFieldDownToBottom(contractTypeFieldId) {
${currentField.contractTypeId === undefined
? ' and contractTypeId is null'
: ' and contractTypeId = ?'}`)
.get(occupancyTypeParameters).maxOrderNumber;
.get(contractTypeParameters).maxOrderNumber;
if (currentField.orderNumber !== maxOrderNumber) {
updateRecordOrderNumber('ContractTypeFields', contractTypeFieldId, maxOrderNumber + 1, database);
occupancyTypeParameters.push(currentField.orderNumber);
contractTypeParameters.push(currentField.orderNumber);
database
.prepare(`update ContractTypeFields set orderNumber = orderNumber - 1
where recordDelete_timeMillis is null
@ -50,7 +50,7 @@ export async function moveContractTypeFieldDownToBottom(contractTypeFieldId) {
? ' and contractTypeId is null'
: ' and contractTypeId = ?'}
and orderNumber > ?`)
.run(occupancyTypeParameters);
.run(contractTypeParameters);
}
database.release();
clearCacheByTableName('ContractTypeFields');
@ -82,11 +82,11 @@ export async function moveContractTypeFieldUpToTop(contractTypeFieldId) {
const currentField = getCurrentField(contractTypeFieldId, database);
if (currentField.orderNumber > 0) {
updateRecordOrderNumber('ContractTypeFields', contractTypeFieldId, -1, database);
const occupancyTypeParameters = [];
const contractTypeParameters = [];
if (currentField.contractTypeId) {
occupancyTypeParameters.push(currentField.contractTypeId);
contractTypeParameters.push(currentField.contractTypeId);
}
occupancyTypeParameters.push(currentField.orderNumber);
contractTypeParameters.push(currentField.orderNumber);
database
.prepare(`update ContractTypeFields
set orderNumber = orderNumber + 1
@ -94,7 +94,7 @@ export async function moveContractTypeFieldUpToTop(contractTypeFieldId) {
${currentField.contractTypeId
? ' and contractTypeId = ?'
: ' and contractTypeId is null'} and orderNumber < ?`)
.run(occupancyTypeParameters);
.run(contractTypeParameters);
}
database.release();
clearCacheByTableName('ContractTypeFields');

View File

@ -63,10 +63,10 @@ export async function moveContractTypeFieldDownToBottom(
const currentField = getCurrentField(contractTypeFieldId, database)
const occupancyTypeParameters: unknown[] = []
const contractTypeParameters: unknown[] = []
if (currentField.contractTypeId) {
occupancyTypeParameters.push(currentField.contractTypeId)
contractTypeParameters.push(currentField.contractTypeId)
}
const maxOrderNumber: number = (
@ -81,7 +81,7 @@ export async function moveContractTypeFieldDownToBottom(
: ' and contractTypeId = ?'
}`
)
.get(occupancyTypeParameters) as { maxOrderNumber: number }
.get(contractTypeParameters) as { maxOrderNumber: number }
).maxOrderNumber
if (currentField.orderNumber !== maxOrderNumber) {
@ -92,7 +92,7 @@ export async function moveContractTypeFieldDownToBottom(
database
)
occupancyTypeParameters.push(currentField.orderNumber)
contractTypeParameters.push(currentField.orderNumber)
database
.prepare(
@ -105,7 +105,7 @@ export async function moveContractTypeFieldDownToBottom(
}
and orderNumber > ?`
)
.run(occupancyTypeParameters)
.run(contractTypeParameters)
}
database.release()
@ -170,13 +170,13 @@ export async function moveContractTypeFieldUpToTop(
database
)
const occupancyTypeParameters: unknown[] = []
const contractTypeParameters: unknown[] = []
if (currentField.contractTypeId) {
occupancyTypeParameters.push(currentField.contractTypeId)
contractTypeParameters.push(currentField.contractTypeId)
}
occupancyTypeParameters.push(currentField.orderNumber)
contractTypeParameters.push(currentField.orderNumber)
database
.prepare(
@ -189,7 +189,7 @@ export async function moveContractTypeFieldUpToTop(
: ' and contractTypeId is null'
} and orderNumber < ?`
)
.run(occupancyTypeParameters)
.run(contractTypeParameters)
}
database.release()

View File

@ -1,6 +1,6 @@
export interface UpdateBurialSiteForm {
burialSiteId: string | number;
burialSiteNameSegment1: string;
burialSiteNameSegment1?: string;
burialSiteNameSegment2?: string;
burialSiteNameSegment3?: string;
burialSiteNameSegment4?: string;

View File

@ -1,8 +1,14 @@
import { buildBurialSiteName } from '../helpers/burialSites.helpers.js';
import addOrUpdateBurialSiteField from './addOrUpdateBurialSiteField.js';
import deleteBurialSiteField from './deleteBurialSiteField.js';
import getCemetery from './getCemetery.js';
import { acquireConnection } from './pool.js';
export default async function updateBurialSite(updateForm, user) {
const database = await acquireConnection();
const cemetery = updateForm.cemeteryId === ''
? undefined
: await getCemetery(updateForm.cemeteryId, database);
const burialSiteName = buildBurialSiteName(cemetery?.cemeteryKey, updateForm);
const result = database
.prepare(`update BurialSites
set burialSiteNameSegment1 = ?,
@ -10,6 +16,7 @@ export default async function updateBurialSite(updateForm, user) {
burialSiteNameSegment3 = ?,
burialSiteNameSegment4 = ?,
burialSiteNameSegment5 = ?,
burialSiteName = ?,
burialSiteTypeId = ?,
burialSiteStatusId = ?,
cemeteryId = ?,
@ -18,9 +25,9 @@ export default async function updateBurialSite(updateForm, user) {
burialSiteLongitude = ?,
recordUpdate_userName = ?,
recordUpdate_timeMillis = ?
where lotId = ?
where burialSiteId = ?
and recordDelete_timeMillis is null`)
.run(updateForm.burialSiteNameSegment1, updateForm.burialSiteNameSegment2 ?? '', updateForm.burialSiteNameSegment3 ?? '', updateForm.burialSiteNameSegment4 ?? '', updateForm.burialSiteNameSegment5 ?? '', updateForm.burialSiteTypeId, updateForm.burialSiteStatusId === ''
.run(updateForm.burialSiteNameSegment1 ?? '', updateForm.burialSiteNameSegment2 ?? '', updateForm.burialSiteNameSegment3 ?? '', updateForm.burialSiteNameSegment4 ?? '', updateForm.burialSiteNameSegment5 ?? '', burialSiteName, updateForm.burialSiteTypeId, updateForm.burialSiteStatusId === ''
? undefined
: updateForm.burialSiteStatusId, updateForm.cemeteryId === '' ? undefined : updateForm.cemeteryId, updateForm.cemeterySvgId, updateForm.burialSiteLatitude === ''
? undefined

View File

@ -1,11 +1,14 @@
import { buildBurialSiteName } from '../helpers/burialSites.helpers.js'
import addOrUpdateBurialSiteField from './addOrUpdateBurialSiteField.js'
import deleteBurialSiteField from './deleteBurialSiteField.js'
import getCemetery from './getCemetery.js'
import { acquireConnection } from './pool.js'
export interface UpdateBurialSiteForm {
burialSiteId: string | number
burialSiteNameSegment1: string
burialSiteNameSegment1?: string
burialSiteNameSegment2?: string
burialSiteNameSegment3?: string
burialSiteNameSegment4?: string
@ -30,6 +33,16 @@ export default async function updateBurialSite(
): Promise<boolean> {
const database = await acquireConnection()
const cemetery =
updateForm.cemeteryId === ''
? undefined
: await getCemetery(updateForm.cemeteryId, database)
const burialSiteName = buildBurialSiteName(
cemetery?.cemeteryKey,
updateForm
)
const result = database
.prepare(
`update BurialSites
@ -38,6 +51,7 @@ export default async function updateBurialSite(
burialSiteNameSegment3 = ?,
burialSiteNameSegment4 = ?,
burialSiteNameSegment5 = ?,
burialSiteName = ?,
burialSiteTypeId = ?,
burialSiteStatusId = ?,
cemeteryId = ?,
@ -46,15 +60,16 @@ export default async function updateBurialSite(
burialSiteLongitude = ?,
recordUpdate_userName = ?,
recordUpdate_timeMillis = ?
where lotId = ?
where burialSiteId = ?
and recordDelete_timeMillis is null`
)
.run(
updateForm.burialSiteNameSegment1,
updateForm.burialSiteNameSegment1 ?? '',
updateForm.burialSiteNameSegment2 ?? '',
updateForm.burialSiteNameSegment3 ?? '',
updateForm.burialSiteNameSegment4 ?? '',
updateForm.burialSiteNameSegment5 ?? '',
burialSiteName,
updateForm.burialSiteTypeId,
updateForm.burialSiteStatusId === ''
? undefined

View File

@ -3,8 +3,8 @@ export interface UpdateBurialSiteTypeFieldForm {
burialSiteTypeField: string;
isRequired: '0' | '1';
fieldType?: string;
minimumLength?: string;
maximumLength?: string;
minLength?: string;
maxLength?: string;
pattern?: string;
fieldValues: string;
}

View File

@ -7,15 +7,15 @@ export default async function updateBurialSiteTypeField(updateForm, user) {
set burialSiteTypeField = ?,
isRequired = ?,
fieldType = ?,
minimumLength = ?,
maximumLength = ?,
minLength = ?,
maxLength = ?,
pattern = ?,
fieldValues = ?,
recordUpdate_userName = ?,
recordUpdate_timeMillis = ?
where burialSiteTypeFieldId = ?
and recordDelete_timeMillis is null`)
.run(updateForm.burialSiteTypeField, Number.parseInt(updateForm.isRequired, 10), updateForm.fieldType ?? 'text', updateForm.minimumLength ?? 0, updateForm.maximumLength ?? 100, updateForm.pattern ?? '', updateForm.fieldValues, user.userName, Date.now(), updateForm.burialSiteTypeFieldId);
.run(updateForm.burialSiteTypeField, Number.parseInt(updateForm.isRequired, 10), updateForm.fieldType ?? 'text', updateForm.minLength ?? 0, updateForm.maxLength ?? 100, updateForm.pattern ?? '', updateForm.fieldValues, user.userName, Date.now(), updateForm.burialSiteTypeFieldId);
database.release();
clearCacheByTableName('BurialSiteTypeFields');
return result.changes > 0;

View File

@ -7,8 +7,8 @@ export interface UpdateBurialSiteTypeFieldForm {
burialSiteTypeField: string
isRequired: '0' | '1'
fieldType?: string
minimumLength?: string
maximumLength?: string
minLength?: string
maxLength?: string
pattern?: string
fieldValues: string
}
@ -25,8 +25,8 @@ export default async function updateBurialSiteTypeField(
set burialSiteTypeField = ?,
isRequired = ?,
fieldType = ?,
minimumLength = ?,
maximumLength = ?,
minLength = ?,
maxLength = ?,
pattern = ?,
fieldValues = ?,
recordUpdate_userName = ?,
@ -38,8 +38,8 @@ export default async function updateBurialSiteTypeField(
updateForm.burialSiteTypeField,
Number.parseInt(updateForm.isRequired, 10),
updateForm.fieldType ?? 'text',
updateForm.minimumLength ?? 0,
updateForm.maximumLength ?? 100,
updateForm.minLength ?? 0,
updateForm.maxLength ?? 100,
updateForm.pattern ?? '',
updateForm.fieldValues,
user.userName,

View File

@ -3,8 +3,8 @@ export interface UpdateContractTypeFieldForm {
contractTypeField: string;
isRequired: '0' | '1';
fieldType?: string;
minimumLength?: string;
maximumLength?: string;
minLength?: string;
maxLength?: string;
pattern?: string;
fieldValues: string;
}

View File

@ -7,15 +7,15 @@ export default async function updateContractTypeField(updateForm, user) {
set contractTypeField = ?,
isRequired = ?,
fieldType = ?,
minimumLength = ?,
maximumLength = ?,
minLength = ?,
maxLength = ?,
pattern = ?,
fieldValues = ?,
recordUpdate_userName = ?,
recordUpdate_timeMillis = ?
where contractTypeFieldId = ?
and recordDelete_timeMillis is null`)
.run(updateForm.contractTypeField, Number.parseInt(updateForm.isRequired, 10), updateForm.fieldType ?? 'text', updateForm.minimumLength ?? 0, updateForm.maximumLength ?? 100, updateForm.pattern ?? '', updateForm.fieldValues, user.userName, Date.now(), updateForm.contractTypeFieldId);
.run(updateForm.contractTypeField, Number.parseInt(updateForm.isRequired, 10), updateForm.fieldType ?? 'text', updateForm.minLength ?? 0, updateForm.maxLength ?? 100, updateForm.pattern ?? '', updateForm.fieldValues, user.userName, Date.now(), updateForm.contractTypeFieldId);
database.release();
clearCacheByTableName('ContractTypeFields');
return result.changes > 0;

View File

@ -7,8 +7,8 @@ export interface UpdateContractTypeFieldForm {
contractTypeField: string
isRequired: '0' | '1'
fieldType?: string
minimumLength?: string
maximumLength?: string
minLength?: string
maxLength?: string
pattern?: string
fieldValues: string
}
@ -25,8 +25,8 @@ export default async function updateContractTypeField(
set contractTypeField = ?,
isRequired = ?,
fieldType = ?,
minimumLength = ?,
maximumLength = ?,
minLength = ?,
maxLength = ?,
pattern = ?,
fieldValues = ?,
recordUpdate_userName = ?,
@ -38,8 +38,8 @@ export default async function updateContractTypeField(
updateForm.contractTypeField,
Number.parseInt(updateForm.isRequired, 10),
updateForm.fieldType ?? 'text',
updateForm.minimumLength ?? 0,
updateForm.maximumLength ?? 100,
updateForm.minLength ?? 0,
updateForm.maxLength ?? 100,
updateForm.pattern ?? '',
updateForm.fieldValues,
user.userName,

View File

@ -5,17 +5,17 @@ export default async function handler(_request, response) {
const contractTypes = await getContractTypes();
const allContractTypeFields = await getAllContractTypeFields();
const contractTypePrints = getConfigProperty('settings.contracts.prints');
const occupancyTypePrintTitles = {};
const contractTypePrintTitles = {};
for (const printEJS of contractTypePrints) {
const printConfig = getPrintConfig(printEJS);
if (printConfig !== undefined) {
occupancyTypePrintTitles[printEJS] = printConfig.title;
contractTypePrintTitles[printEJS] = printConfig.title;
}
}
response.render('admin-contractTypes', {
headTitle: `Contract Type Management`,
occupancyTypes: contractTypes,
contractTypes,
allContractTypeFields,
occupancyTypePrintTitles
contractTypePrintTitles
});
}

View File

@ -16,20 +16,20 @@ export default async function handler(
const contractTypePrints = getConfigProperty('settings.contracts.prints')
const occupancyTypePrintTitles = {}
const contractTypePrintTitles = {}
for (const printEJS of contractTypePrints) {
const printConfig = getPrintConfig(printEJS)
if (printConfig !== undefined) {
occupancyTypePrintTitles[printEJS] = printConfig.title
contractTypePrintTitles[printEJS] = printConfig.title
}
}
response.render('admin-contractTypes', {
headTitle: `Contract Type Management`,
occupancyTypes: contractTypes,
contractTypes,
allContractTypeFields,
occupancyTypePrintTitles
contractTypePrintTitles
})
}

View File

@ -9,7 +9,7 @@ export default async function handler(request, response) {
}
response.render('burialSite-view', {
headTitle: burialSite.burialSiteName,
lot: burialSite
burialSite
});
response.on('finish', () => {
void getNextBurialSiteId(burialSite.burialSiteId);

View File

@ -22,7 +22,7 @@ export default async function handler(
response.render('burialSite-view', {
headTitle: burialSite.burialSiteName,
lot: burialSite
burialSite
})
response.on('finish', () => {

View File

@ -1,4 +1,4 @@
import type { BurialSiteContract, BurialSiteContractFee } from '../types/recordTypes.js';
export declare function getFieldValueByContractTypeField(burialSiteContract: BurialSiteContract, occupancyTypeField: string): string | undefined;
export declare function getFieldValueByContractTypeField(burialSiteContract: BurialSiteContract, contractTypeField: string): string | undefined;
export declare function getFeesByFeeCategory(burialSiteContract: BurialSiteContract, feeCategory: string, feeCategoryContains?: boolean): BurialSiteContractFee[];
export declare function getTransactionTotal(burialSiteContract: BurialSiteContract): number;

View File

@ -1,7 +1,7 @@
export function getFieldValueByContractTypeField(burialSiteContract, occupancyTypeField) {
const occupancyTypeFieldLowerCase = occupancyTypeField.toLowerCase();
export function getFieldValueByContractTypeField(burialSiteContract, contractTypeField) {
const contractTypeFieldLowerCase = contractTypeField.toLowerCase();
const field = (burialSiteContract.burialSiteContractFields ?? []).find((possibleField) => possibleField.contractTypeField.toLowerCase() ===
occupancyTypeFieldLowerCase);
contractTypeFieldLowerCase);
if (field === undefined) {
return undefined;
}

View File

@ -5,14 +5,14 @@ import type {
export function getFieldValueByContractTypeField(
burialSiteContract: BurialSiteContract,
occupancyTypeField: string
contractTypeField: string
): string | undefined {
const occupancyTypeFieldLowerCase = occupancyTypeField.toLowerCase()
const contractTypeFieldLowerCase = contractTypeField.toLowerCase()
const field = (burialSiteContract.burialSiteContractFields ?? []).find(
(possibleField) =>
(possibleField.contractTypeField as string).toLowerCase() ===
occupancyTypeFieldLowerCase
contractTypeFieldLowerCase
)
if (field === undefined) {

View File

@ -1,7 +1,7 @@
export declare function getNextBurialSiteId(burialSiteId: number): Promise<number | undefined>;
export declare function getPreviousBurialSiteId(burialSiteId: number): Promise<number | undefined>;
export declare function clearNextPreviousBurialSiteIdCache(burialSiteId?: number, relayMessage?: boolean): void;
export declare function buildBurialSiteName(segments: {
export declare function buildBurialSiteName(cemeteryKey: string | undefined, segments: {
burialSiteNameSegment1?: string;
burialSiteNameSegment2?: string;
burialSiteNameSegment3?: string;

View File

@ -85,8 +85,11 @@ export function clearNextPreviousBurialSiteIdCache(burialSiteId = -1, relayMessa
catch { }
}
const segmentConfig = getConfigProperty('settings.burialSites.burialSiteNameSegments');
export function buildBurialSiteName(segments) {
export function buildBurialSiteName(cemeteryKey, segments) {
const segmentPieces = [];
if (segmentConfig.includeCemeteryKey && cemeteryKey !== undefined) {
segmentPieces.push(cemeteryKey);
}
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
for (let segmentIndex = 1; segmentIndex <= 5; segmentIndex++) {
const segmentIndexString = segmentIndex.toString();

View File

@ -138,7 +138,7 @@ const segmentConfig = getConfigProperty(
'settings.burialSites.burialSiteNameSegments'
)
export function buildBurialSiteName(segments: {
export function buildBurialSiteName(cemeteryKey: string | undefined, segments: {
burialSiteNameSegment1?: string
burialSiteNameSegment2?: string
burialSiteNameSegment3?: string
@ -147,6 +147,10 @@ export function buildBurialSiteName(segments: {
}): string {
const segmentPieces: string[] = []
if (segmentConfig.includeCemeteryKey && cemeteryKey !== undefined) {
segmentPieces.push(cemeteryKey)
}
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
for (let segmentIndex = 1; segmentIndex <= 5; segmentIndex++) {
const segmentIndexString = segmentIndex.toString()

View File

@ -17,6 +17,6 @@ export declare function getWorkOrderMilestoneTypeById(workOrderMilestoneTypeId:
export declare function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneTypeString: string): Promise<WorkOrderMilestoneType | undefined>;
export declare function preloadCaches(): Promise<void>;
export declare function clearCaches(): void;
type CacheTableNames = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'ContractTypes' | 'ContractTypeFields' | 'ContractTypePrints' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes' | 'FeeCategories';
type CacheTableNames = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'ContractTypes' | 'ContractTypeFields' | 'ContractTypePrints' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes' | 'FeeCategories' | 'Fees';
export declare function clearCacheByTableName(tableName: CacheTableNames, relayMessage?: boolean): void;
export {};

View File

@ -281,6 +281,7 @@ type CacheTableNames =
| 'WorkOrderMilestoneTypes'
| 'WorkOrderTypes'
| 'FeeCategories'
| 'Fees'
export function clearCacheByTableName(
tableName: CacheTableNames,

18
package-lock.json generated
View File

@ -79,14 +79,14 @@
"bulma-steps": "^2.2.1",
"bulma-switch": "^2.0.4",
"bulma-tooltip": "^3.0.2",
"cypress": "^14.0.3",
"cypress": "^14.1.0",
"cypress-axe": "^1.6.0",
"eslint-config-cityssm": "^20.0.0",
"gulp": "^5.0.0",
"gulp-sass": "^6.0.0",
"nodemon": "^3.1.9",
"prettier-config-cityssm": "^1.0.0",
"sass": "^1.85.0"
"sass": "^1.85.1"
},
"engines": {
"node": ">=18.0.0"
@ -4728,9 +4728,9 @@
"license": "ISC"
},
"node_modules/cypress": {
"version": "14.0.3",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-14.0.3.tgz",
"integrity": "sha512-yIdvobANw3kS+KF/t5vwjjPNufBA8ux7iQHaWxPTkUw2yCKI72m9mKM24eOwE84Wk4ALPsSvEcGbDrwgmhr4RA==",
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-14.1.0.tgz",
"integrity": "sha512-pPPj8Uu9NwjaaiXAEcjYZZmgsq6v9Zs1Nw6a+zRF+ANgYSNhH4S32SjFRsvMcuOHR/8dp4GBJhBPqIPSs+TxaA==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
@ -4746,7 +4746,7 @@
"cachedir": "^2.3.0",
"chalk": "^4.1.0",
"check-more-types": "^2.24.0",
"ci-info": "^4.0.0",
"ci-info": "^4.1.0",
"cli-cursor": "^3.1.0",
"cli-table3": "~0.6.1",
"commander": "^6.2.1",
@ -11317,9 +11317,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/sass": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.85.0.tgz",
"integrity": "sha512-3ToiC1xZ1Y8aU7+CkgCI/tqyuPXEmYGJXO7H4uqp0xkLXUqp88rQQ4j1HmP37xSJLbCJPaIiv+cT1y+grssrww==",
"version": "1.85.1",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.85.1.tgz",
"integrity": "sha512-Uk8WpxM5v+0cMR0XjX9KfRIacmSG86RH4DCCZjLU2rFh5tyutt9siAXJ7G+YfxQ99Q6wrRMbMlVl6KqUms71ag==",
"dev": true,
"license": "MIT",
"dependencies": {

View File

@ -103,13 +103,13 @@
"bulma-steps": "^2.2.1",
"bulma-switch": "^2.0.4",
"bulma-tooltip": "^3.0.2",
"cypress": "^14.0.3",
"cypress": "^14.1.0",
"cypress-axe": "^1.6.0",
"eslint-config-cityssm": "^20.0.0",
"gulp": "^5.0.0",
"gulp-sass": "^6.0.0",
"nodemon": "^3.1.9",
"prettier-config-cityssm": "^1.0.0",
"sass": "^1.85.0"
"sass": "^1.85.1"
}
}

View File

@ -76,14 +76,14 @@
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="lotTypeFieldEdit--minimumLength"
<label class="label" for="lotTypeFieldEdit--minLength"
>Minimum Length</label
>
<div class="control">
<input
class="input"
id="lotTypeFieldEdit--minimumLength"
name="minimumLength"
id="lotTypeFieldEdit--minLength"
name="minLength"
type="number"
min="0"
max="32767"
@ -95,14 +95,14 @@
</div>
<div class="column">
<div class="field">
<label class="label" for="lotTypeFieldEdit--maximumLength"
<label class="label" for="lotTypeFieldEdit--maxLength"
>Maximum Length</label
>
<div class="control">
<input
class="input"
id="lotTypeFieldEdit--maximumLength"
name="maximumLength"
id="lotTypeFieldEdit--maxLength"
name="maxLength"
type="number"
min="0"
max="32767"

View File

@ -83,14 +83,14 @@
<div class="field">
<label
class="label"
for="occupancyTypeFieldEdit--minimumLength"
for="occupancyTypeFieldEdit--minLength"
>Minimum Length</label
>
<div class="control">
<input
class="input"
id="occupancyTypeFieldEdit--minimumLength"
name="minimumLength"
id="occupancyTypeFieldEdit--minLength"
name="minLength"
type="number"
min="0"
max="32767"
@ -104,14 +104,14 @@
<div class="field">
<label
class="label"
for="occupancyTypeFieldEdit--maximumLength"
for="occupancyTypeFieldEdit--maxLength"
>Maximum Length</label
>
<div class="control">
<input
class="input"
id="occupancyTypeFieldEdit--maximumLength"
name="maximumLength"
id="occupancyTypeFieldEdit--maxLength"
name="maxLength"
type="number"
min="0"
max="32767"

View File

@ -3,7 +3,7 @@
<div class="modal-card">
<header class="modal-card-head">
<h3 class="modal-card-title">
Add <span class="alias" data-alias="Lot"></span> Comment
Add Comment
</h3>
<button
class="delete is-close-modal-button"
@ -12,15 +12,15 @@
></button>
</header>
<section class="modal-card-body">
<form id="form--lotCommentAdd">
<input id="lotCommentAdd--lotId" name="lotId" type="hidden" value="" />
<form id="form--burialSiteCommentAdd">
<input id="burialSiteCommentAdd--burialSiteId" name="burialSiteId" type="hidden" value="" />
<div class="field">
<label class="label" for="lotCommentAdd--lotComment">Comment</label>
<label class="label" for="burialSiteCommentAdd--comment">Comment</label>
<div class="control">
<textarea
class="textarea"
id="lotCommentAdd--lotComment"
name="lotComment"
id="burialSiteCommentAdd--comment"
name="comment"
required
></textarea>
</div>
@ -31,7 +31,7 @@
<button
class="button is-success"
type="submit"
form="form--lotCommentAdd"
form="form--burialSiteCommentAdd"
>
<span class="icon"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add Comment</span>

View File

@ -10,21 +10,21 @@
></button>
</header>
<section class="modal-card-body">
<form id="form--lotCommentEdit">
<input id="lotCommentEdit--lotId" name="lotId" type="hidden" value="" />
<form id="form--burialSiteCommentEdit">
<input id="burialSiteCommentEdit--burialSiteId" name="burialSiteId" type="hidden" value="" />
<input
id="lotCommentEdit--lotCommentId"
name="lotCommentId"
id="burialSiteCommentEdit--burialSiteCommentId"
name="burialSiteCommentId"
type="hidden"
value=""
/>
<div class="field">
<label class="label" for="lotCommentEdit--lotComment">Comment</label>
<label class="label" for="burialSiteCommentEdit--comment">Comment</label>
<div class="control">
<textarea
class="textarea"
id="lotCommentEdit--lotComment"
name="lotComment"
id="burialSiteCommentEdit--comment"
name="comment"
required
></textarea>
</div>
@ -32,14 +32,14 @@
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="lotCommentEdit--lotCommentDateString"
<label class="label" for="burialSiteCommentEdit--commentDateString"
>Comment Date</label
>
<div class="control has-icons-left">
<input
class="input"
id="lotCommentEdit--lotCommentDateString"
name="lotCommentDateString"
id="burialSiteCommentEdit--commentDateString"
name="commentDateString"
type="date"
required
/>
@ -51,14 +51,14 @@
</div>
<div class="column">
<div class="field">
<label class="label" for="lotCommentEdit--lotCommentTimeString"
<label class="label" for="burialSiteCommentEdit--commentTimeString"
>Comment Time</label
>
<div class="control has-icons-left">
<input
class="input"
id="lotCommentEdit--lotCommentTimeString"
name="lotCommentTimeString"
id="burialSiteCommentEdit--commentTimeString"
name="commentTimeString"
type="time"
required
/>
@ -75,7 +75,7 @@
<button
class="button is-success"
type="submit"
form="form--lotCommentEdit"
form="form--burialSiteCommentEdit"
>
<span class="icon"><i class="fas fa-save" aria-hidden="true"></i></span>
<span>Update Comment</span>

View File

@ -1,46 +1,43 @@
"use strict";
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
(() => {
const los = exports.los;
const lotId = document.querySelector('#lot--lotId')
.value;
const isCreate = lotId === '';
const burialSiteId = document.querySelector('#burialSite--burialSiteId').value;
const isCreate = burialSiteId === '';
// Main form
let refreshAfterSave = isCreate;
function setUnsavedChanges() {
los.setUnsavedChanges();
document
.querySelector("button[type='submit'][form='form--lot']")
.querySelector("button[type='submit'][form='form--burialSite']")
?.classList.remove('is-light');
}
function clearUnsavedChanges() {
los.clearUnsavedChanges();
document
.querySelector("button[type='submit'][form='form--lot']")
.querySelector("button[type='submit'][form='form--burialSite']")
?.classList.add('is-light');
}
const formElement = document.querySelector('#form--lot');
const formElement = document.querySelector('#form--burialSite');
function updateBurialSite(formEvent) {
formEvent.preventDefault();
cityssm.postJSON(`${los.urlPrefix}/lots/${isCreate ? 'doCreateBurialSite' : 'doUpdateBurialSite'}`, formElement, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/burialSites/${isCreate ? 'doCreateBurialSite' : 'doUpdateBurialSite'}`, formElement, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
clearUnsavedChanges();
if (isCreate || refreshAfterSave) {
window.location.href = los.getBurialSiteURL(responseJSON.lotId, true, true);
globalThis.location.href = los.getBurialSiteURL(responseJSON.burialSiteId, true, true);
}
else {
bulmaJS.alert({
message: `${los.escapedAliases.Lot} Updated Successfully`,
message: `Burial Site Updated Successfully`,
contextualColorName: 'success'
});
}
}
else {
bulmaJS.alert({
title: `Error Updating ${los.escapedAliases.Lot}`,
title: `Error Updating Burial Site`,
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
});
@ -54,21 +51,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
los.initializeUnlockFieldButtons(formElement);
document
.querySelector('#button--deleteLot')
.querySelector('#button--deleteBurialSite')
?.addEventListener('click', (clickEvent) => {
clickEvent.preventDefault();
function doDelete() {
cityssm.postJSON(`${los.urlPrefix}/lots/doDeleteBurialSite`, {
lotId
cityssm.postJSON(`${los.urlPrefix}/burialSites/doDeleteBurialSite`, {
burialSiteId
}, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
clearUnsavedChanges();
window.location.href = los.getBurialSiteURL();
globalThis.location.href = los.getBurialSiteURL();
}
else {
bulmaJS.alert({
title: `Error Deleting ${los.escapedAliases.Lot}`,
title: `Error Deleting Burial Site`,
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
});
@ -76,63 +73,61 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
bulmaJS.confirm({
title: `Delete ${los.escapedAliases.Lot}`,
message: `Are you sure you want to delete this ${los.escapedAliases.lot}?`,
title: `Delete Burial Site`,
message: `Are you sure you want to delete this burial site?`,
contextualColorName: 'warning',
okButton: {
text: `Yes, Delete ${los.escapedAliases.Lot}`,
text: `Yes, Delete Burial Site`,
callbackFunction: doDelete
}
});
});
// Lot Type
const burialSiteTypeIdElement = document.querySelector('#lot--burialSiteTypeId');
// Burial Site Type
const burialSiteTypeIdElement = document.querySelector('#burialSite--burialSiteTypeId');
if (isCreate) {
const lotFieldsContainerElement = document.querySelector('#container--lotFields');
const burialSiteFieldsContainerElement = document.querySelector('#container--burialSiteFields');
burialSiteTypeIdElement.addEventListener('change', () => {
if (burialSiteTypeIdElement.value === '') {
// eslint-disable-next-line no-unsanitized/property
lotFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.lot} type to load the available fields.</p>
burialSiteFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the burial site type to load the available fields.</p>
</div>`;
return;
}
cityssm.postJSON(`${los.urlPrefix}/lots/doGetBurialSiteTypeFields`, {
cityssm.postJSON(`${los.urlPrefix}/burialSites/doGetBurialSiteTypeFields`, {
burialSiteTypeId: burialSiteTypeIdElement.value
}, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.BurialSiteTypeFields.length === 0) {
// eslint-disable-next-line no-unsanitized/property
lotFieldsContainerElement.innerHTML = `<div class="message is-info">
if (responseJSON.burialSiteTypeFields.length === 0) {
burialSiteFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">
There are no additional fields for this ${los.escapedAliases.lot} type.
There are no additional fields for this burial site type.
</p>
</div>`;
return;
}
lotFieldsContainerElement.innerHTML = '';
let lotTypeFieldIds = '';
for (const lotTypeField of responseJSON.BurialSiteTypeFields) {
lotTypeFieldIds += `,${lotTypeField.lotTypeFieldId.toString()}`;
const fieldName = `lotFieldValue_${lotTypeField.lotTypeFieldId.toString()}`;
const fieldId = `lot--${fieldName}`;
burialSiteFieldsContainerElement.innerHTML = '';
let burialSiteTypeFieldIds = '';
for (const burialSiteTypeField of responseJSON.burialSiteTypeFields) {
burialSiteTypeFieldIds += `,${burialSiteTypeField.burialSiteTypeFieldId.toString()}`;
const fieldName = `fieldValue_${burialSiteTypeField.burialSiteTypeFieldId.toString()}`;
const fieldId = `burialSite--${fieldName}`;
const fieldElement = document.createElement('div');
fieldElement.className = 'field';
// eslint-disable-next-line no-unsanitized/property
fieldElement.innerHTML = `<label class="label" for="${fieldId}"></label>
<div class="control"></div>`;
fieldElement.querySelector('label').textContent = lotTypeField.lotTypeField;
if (lotTypeField.lotTypeFieldValues === '') {
fieldElement.querySelector('label').textContent = burialSiteTypeField.burialSiteTypeField;
if (burialSiteTypeField.fieldValues === '') {
const inputElement = document.createElement('input');
inputElement.className = 'input';
inputElement.id = fieldId;
inputElement.name = fieldName;
inputElement.type = 'text';
inputElement.required = lotTypeField.isRequired;
inputElement.minLength = lotTypeField.minimumLength;
inputElement.maxLength = lotTypeField.maximumLength;
if ((lotTypeField.pattern ?? '') !== '') {
inputElement.pattern = lotTypeField.pattern ?? '';
inputElement.required = burialSiteTypeField.isRequired;
inputElement.minLength = burialSiteTypeField.minLength;
inputElement.maxLength = burialSiteTypeField.maxLength;
if ((burialSiteTypeField.pattern ?? '') !== '') {
inputElement.pattern = burialSiteTypeField.pattern ?? '';
}
fieldElement.querySelector('.control')?.append(inputElement);
}
@ -143,8 +138,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
<select id="${fieldId}" name="${fieldName}"><option value="">(Not Set)</option></select>
</div>`;
const selectElement = fieldElement.querySelector('select');
selectElement.required = lotTypeField.isRequired;
const optionValues = lotTypeField.lotTypeFieldValues.split('\n');
selectElement.required = burialSiteTypeField.isRequired;
const optionValues = burialSiteTypeField.fieldValues.split('\n');
for (const optionValue of optionValues) {
const optionElement = document.createElement('option');
optionElement.value = optionValue;
@ -152,20 +147,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
selectElement.append(optionElement);
}
}
lotFieldsContainerElement.append(fieldElement);
burialSiteFieldsContainerElement.append(fieldElement);
}
lotFieldsContainerElement.insertAdjacentHTML('beforeend', `<input name="lotTypeFieldIds" type="hidden"
value="${cityssm.escapeHTML(lotTypeFieldIds.slice(1))}" />`);
burialSiteFieldsContainerElement.insertAdjacentHTML('beforeend', `<input name="burialSiteTypeFieldIds" type="hidden"
value="${cityssm.escapeHTML(burialSiteTypeFieldIds.slice(1))}" />`);
});
});
}
else {
const originalburialSiteTypeId = burialSiteTypeIdElement.value;
const originalBurialSiteTypeId = burialSiteTypeIdElement.value;
burialSiteTypeIdElement.addEventListener('change', () => {
if (burialSiteTypeIdElement.value !== originalburialSiteTypeId) {
if (burialSiteTypeIdElement.value !== originalBurialSiteTypeId) {
bulmaJS.confirm({
title: 'Confirm Change',
message: `Are you sure you want to change the ${los.escapedAliases.lot} type?\n
message: `Are you sure you want to change the burial site type?\n
This change affects the additional fields associated with this record.`,
contextualColorName: 'warning',
okButton: {
@ -177,7 +172,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
cancelButton: {
text: 'Revert the Change',
callbackFunction() {
burialSiteTypeIdElement.value = originalburialSiteTypeId;
burialSiteTypeIdElement.value = originalBurialSiteTypeId;
}
}
});
@ -185,24 +180,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
// Comments
let lotComments = exports.lotComments;
delete exports.lotComments;
function openEditLotComment(clickEvent) {
const lotCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr')?.dataset
.lotCommentId ?? '', 10);
const lotComment = lotComments.find((currentLotComment) => {
return currentLotComment.lotCommentId === lotCommentId;
});
let burialSiteComments = exports.burialSiteComments;
delete exports.burialSiteComments;
function openEditBurialSiteComment(clickEvent) {
const burialSiteCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr')?.dataset
.burialSiteCommentId ?? '', 10);
const burialSiteComment = burialSiteComments.find((currentComment) => currentComment.burialSiteCommentId === burialSiteCommentId);
let editFormElement;
let editCloseModalFunction;
function editComment(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(`${los.urlPrefix}/lots/doUpdateBurialSiteComment`, editFormElement, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/burialSites/doUpdateBurialSiteComment`, editFormElement, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotComments = responseJSON.lotComments;
burialSiteComments = responseJSON.burialSiteComments;
editCloseModalFunction();
renderLotComments();
renderBurialSiteComments();
}
else {
bulmaJS.alert({
@ -213,26 +206,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
});
}
cityssm.openHtmlModal('lot-editComment', {
cityssm.openHtmlModal('burialSite-editComment', {
onshow(modalElement) {
los.populateAliases(modalElement);
modalElement.querySelector('#lotCommentEdit--lotId').value = lotId;
modalElement.querySelector('#lotCommentEdit--lotCommentId').value = lotCommentId.toString();
modalElement.querySelector('#lotCommentEdit--lotComment').value = lotComment.lotComment ?? '';
const lotCommentDateStringElement = modalElement.querySelector('#lotCommentEdit--lotCommentDateString');
lotCommentDateStringElement.value =
lotComment.lotCommentDateString ?? '';
modalElement.querySelector('#burialSiteCommentEdit--burialSiteId').value = burialSiteId;
modalElement.querySelector('#burialSiteCommentEdit--burialSiteCommentId').value = burialSiteCommentId.toString();
modalElement.querySelector('#burialSiteCommentEdit--comment').value = burialSiteComment.comment ?? '';
const commentDateStringElement = modalElement.querySelector('#burialSiteCommentEdit--commentDateString');
commentDateStringElement.value =
burialSiteComment.commentDateString ?? '';
const currentDateString = cityssm.dateToString(new Date());
lotCommentDateStringElement.max =
lotComment.lotCommentDateString <= currentDateString
commentDateStringElement.max =
burialSiteComment.commentDateString <= currentDateString
? currentDateString
: lotComment.lotCommentDateString ?? '';
modalElement.querySelector('#lotCommentEdit--lotCommentTimeString').value = lotComment.lotCommentTimeString ?? '';
: burialSiteComment.commentDateString ?? '';
modalElement.querySelector('#burialSiteCommentEdit--commentTimeString').value = burialSiteComment.commentTimeString ?? '';
},
onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped();
los.initializeDatePickers(modalElement);
modalElement.querySelector('#lotCommentEdit--lotComment').focus();
modalElement.querySelector('#burialSiteCommentEdit--comment').focus();
editFormElement = modalElement.querySelector('form');
editFormElement.addEventListener('submit', editComment);
editCloseModalFunction = closeModalFunction;
@ -242,18 +235,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
});
}
function deleteLotComment(clickEvent) {
const lotCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr')?.dataset
.lotCommentId ?? '', 10);
function deleteBurialSiteComment(clickEvent) {
const burialSiteCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr')?.dataset
.burialSiteCommentId ?? '', 10);
function doDelete() {
cityssm.postJSON(`${los.urlPrefix}/lots/doDeleteBurialSiteComment`, {
lotId,
lotCommentId
cityssm.postJSON(`${los.urlPrefix}/burialSites/doDeleteBurialSiteComment`, {
burialSiteId,
burialSiteCommentId
}, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotComments = responseJSON.lotComments;
renderLotComments();
burialSiteComments = responseJSON.burialSiteComments;
renderBurialSiteComments();
}
else {
bulmaJS.alert({
@ -274,9 +267,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
contextualColorName: 'warning'
});
}
function renderLotComments() {
const containerElement = document.querySelector('#container--lotComments');
if (lotComments.length === 0) {
function renderBurialSiteComments() {
const containerElement = document.querySelector('#container--burialSiteComments');
if (burialSiteComments.length === 0) {
containerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no comments to display.</p>
</div>`;
@ -291,19 +284,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
<th class="is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>`;
for (const lotComment of lotComments) {
for (const burialSiteComment of burialSiteComments) {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotCommentId = lotComment.lotCommentId?.toString();
tableRowElement.dataset.burialSiteCommentId =
burialSiteComment.burialSiteCommentId?.toString();
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
${cityssm.escapeHTML(lotComment.recordCreate_userName ?? '')}
${cityssm.escapeHTML(burialSiteComment.recordCreate_userName ?? '')}
</td><td>
${lotComment.lotCommentDateString}
${lotComment.lotCommentTime === 0
${burialSiteComment.commentDateString}
${burialSiteComment.commentTime === 0
? ''
: ` ${lotComment.lotCommentTimePeriodString}`}
: ` ${burialSiteComment.commentTimePeriodString}`}
</td><td>
${cityssm.escapeHTML(lotComment.lotComment ?? '')}
${cityssm.escapeHTML(burialSiteComment.comment ?? '')}
</td><td class="is-hidden-print">
<div class="buttons are-small is-justify-content-end">
<button class="button is-primary button--edit" type="button">
@ -317,10 +311,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
</td>`;
tableRowElement
.querySelector('.button--edit')
?.addEventListener('click', openEditLotComment);
?.addEventListener('click', openEditBurialSiteComment);
tableRowElement
.querySelector('.button--delete')
?.addEventListener('click', deleteLotComment);
?.addEventListener('click', deleteBurialSiteComment);
tableElement.querySelector('tbody')?.append(tableRowElement);
}
containerElement.innerHTML = '';
@ -330,19 +324,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
let addCommentCloseModalFunction;
function doAddComment(formEvent) {
formEvent.preventDefault();
cityssm.postJSON(`${los.urlPrefix}/lots/doAddBurialSiteComment`, formEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/burialSites/doAddBurialSiteComment`, formEvent.currentTarget, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotComments = responseJSON.lotComments;
renderLotComments();
burialSiteComments = responseJSON.burialSiteComments;
renderBurialSiteComments();
addCommentCloseModalFunction();
}
});
}
cityssm.openHtmlModal('lot-addComment', {
cityssm.openHtmlModal('burialSite-addComment', {
onshow(modalElement) {
los.populateAliases(modalElement);
modalElement.querySelector('#lotCommentAdd--lotId').value = lotId;
modalElement.querySelector('#burialSiteCommentAdd--burialSiteId').value = burialSiteId;
modalElement
.querySelector('form')
?.addEventListener('submit', doAddComment);
@ -350,18 +344,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped();
addCommentCloseModalFunction = closeModalFunction;
modalElement.querySelector('#lotCommentAdd--lotComment').focus();
modalElement.querySelector('#burialSiteCommentAdd--comment').focus();
},
onremoved() {
bulmaJS.toggleHtmlClipped();
document.querySelector('#lotComments--add').focus();
document.querySelector('#burialSiteComments--add').focus();
}
});
}
if (!isCreate) {
document
.querySelector('#lotComments--add')
.querySelector('#burialSiteComments--add')
?.addEventListener('click', openAddCommentModal);
renderLotComments();
renderBurialSiteComments();
}
})();

View File

@ -1,11 +1,12 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { LOS } from '../../types/globalTypes.js'
import type { LotComment, LotTypeField } from '../../types/recordTypes.js'
import type {
BurialSiteComment,
BurialSiteTypeField
} from '../../types/recordTypes.js'
import type { LOS } from './types.js'
declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
@ -14,9 +15,10 @@ declare const exports: Record<string, unknown>
;(() => {
const los = exports.los as LOS
const lotId = (document.querySelector('#lot--lotId') as HTMLInputElement)
.value
const isCreate = lotId === ''
const burialSiteId = (
document.querySelector('#burialSite--burialSiteId') as HTMLInputElement
).value
const isCreate = burialSiteId === ''
// Main form
@ -25,29 +27,31 @@ declare const exports: Record<string, unknown>
function setUnsavedChanges(): void {
los.setUnsavedChanges()
document
.querySelector("button[type='submit'][form='form--lot']")
.querySelector("button[type='submit'][form='form--burialSite']")
?.classList.remove('is-light')
}
function clearUnsavedChanges(): void {
los.clearUnsavedChanges()
document
.querySelector("button[type='submit'][form='form--lot']")
.querySelector("button[type='submit'][form='form--burialSite']")
?.classList.add('is-light')
}
const formElement = document.querySelector('#form--lot') as HTMLFormElement
const formElement = document.querySelector(
'#form--burialSite'
) as HTMLFormElement
function updateBurialSite(formEvent: SubmitEvent): void {
formEvent.preventDefault()
cityssm.postJSON(
`${los.urlPrefix}/lots/${isCreate ? 'doCreateBurialSite' : 'doUpdateBurialSite'}`,
`${los.urlPrefix}/burialSites/${isCreate ? 'doCreateBurialSite' : 'doUpdateBurialSite'}`,
formElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean
lotId?: number
burialSiteId?: number
errorMessage?: string
}
@ -55,16 +59,20 @@ declare const exports: Record<string, unknown>
clearUnsavedChanges()
if (isCreate || refreshAfterSave) {
window.location.href = los.getBurialSiteURL(responseJSON.lotId, true, true)
globalThis.location.href = los.getBurialSiteURL(
responseJSON.burialSiteId,
true,
true
)
} else {
bulmaJS.alert({
message: `${los.escapedAliases.Lot} Updated Successfully`,
message: `Burial Site Updated Successfully`,
contextualColorName: 'success'
})
}
} else {
bulmaJS.alert({
title: `Error Updating ${los.escapedAliases.Lot}`,
title: `Error Updating Burial Site`,
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
@ -84,15 +92,15 @@ declare const exports: Record<string, unknown>
los.initializeUnlockFieldButtons(formElement)
document
.querySelector('#button--deleteLot')
.querySelector('#button--deleteBurialSite')
?.addEventListener('click', (clickEvent) => {
clickEvent.preventDefault()
function doDelete(): void {
cityssm.postJSON(
`${los.urlPrefix}/lots/doDeleteBurialSite`,
`${los.urlPrefix}/burialSites/doDeleteBurialSite`,
{
lotId
burialSiteId
},
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
@ -102,10 +110,10 @@ declare const exports: Record<string, unknown>
if (responseJSON.success) {
clearUnsavedChanges()
window.location.href = los.getBurialSiteURL()
globalThis.location.href = los.getBurialSiteURL()
} else {
bulmaJS.alert({
title: `Error Deleting ${los.escapedAliases.Lot}`,
title: `Error Deleting Burial Site`,
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
@ -115,68 +123,66 @@ declare const exports: Record<string, unknown>
}
bulmaJS.confirm({
title: `Delete ${los.escapedAliases.Lot}`,
message: `Are you sure you want to delete this ${los.escapedAliases.lot}?`,
title: `Delete Burial Site`,
message: `Are you sure you want to delete this burial site?`,
contextualColorName: 'warning',
okButton: {
text: `Yes, Delete ${los.escapedAliases.Lot}`,
text: `Yes, Delete Burial Site`,
callbackFunction: doDelete
}
})
})
// Lot Type
// Burial Site Type
const burialSiteTypeIdElement = document.querySelector(
'#lot--burialSiteTypeId'
'#burialSite--burialSiteTypeId'
) as HTMLSelectElement
if (isCreate) {
const lotFieldsContainerElement = document.querySelector(
'#container--lotFields'
const burialSiteFieldsContainerElement = document.querySelector(
'#container--burialSiteFields'
) as HTMLElement
burialSiteTypeIdElement.addEventListener('change', () => {
if (burialSiteTypeIdElement.value === '') {
// eslint-disable-next-line no-unsanitized/property
lotFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.lot} type to load the available fields.</p>
burialSiteFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the burial site type to load the available fields.</p>
</div>`
return
}
cityssm.postJSON(
`${los.urlPrefix}/lots/doGetBurialSiteTypeFields`,
`${los.urlPrefix}/burialSites/doGetBurialSiteTypeFields`,
{
burialSiteTypeId: burialSiteTypeIdElement.value
},
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
BurialSiteTypeFields: LotTypeField[]
burialSiteTypeFields: BurialSiteTypeField[]
}
if (responseJSON.BurialSiteTypeFields.length === 0) {
// eslint-disable-next-line no-unsanitized/property
lotFieldsContainerElement.innerHTML = `<div class="message is-info">
if (responseJSON.burialSiteTypeFields.length === 0) {
burialSiteFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">
There are no additional fields for this ${los.escapedAliases.lot} type.
There are no additional fields for this burial site type.
</p>
</div>`
return
}
lotFieldsContainerElement.innerHTML = ''
burialSiteFieldsContainerElement.innerHTML = ''
let lotTypeFieldIds = ''
let burialSiteTypeFieldIds = ''
for (const lotTypeField of responseJSON.BurialSiteTypeFields) {
lotTypeFieldIds += `,${lotTypeField.lotTypeFieldId.toString()}`
for (const burialSiteTypeField of responseJSON.burialSiteTypeFields) {
burialSiteTypeFieldIds += `,${burialSiteTypeField.burialSiteTypeFieldId.toString()}`
const fieldName = `lotFieldValue_${lotTypeField.lotTypeFieldId.toString()}`
const fieldName = `fieldValue_${burialSiteTypeField.burialSiteTypeFieldId.toString()}`
const fieldId = `lot--${fieldName}`
const fieldId = `burialSite--${fieldName}`
const fieldElement = document.createElement('div')
fieldElement.className = 'field'
@ -186,9 +192,9 @@ declare const exports: Record<string, unknown>
<div class="control"></div>`
;(
fieldElement.querySelector('label') as HTMLLabelElement
).textContent = lotTypeField.lotTypeField as string
).textContent = burialSiteTypeField.burialSiteTypeField as string
if (lotTypeField.lotTypeFieldValues === '') {
if (burialSiteTypeField.fieldValues === '') {
const inputElement = document.createElement('input')
inputElement.className = 'input'
@ -199,12 +205,12 @@ declare const exports: Record<string, unknown>
inputElement.type = 'text'
inputElement.required = lotTypeField.isRequired as boolean
inputElement.minLength = lotTypeField.minimumLength as number
inputElement.maxLength = lotTypeField.maximumLength as number
inputElement.required = burialSiteTypeField.isRequired as boolean
inputElement.minLength = burialSiteTypeField.minLength as number
inputElement.maxLength = burialSiteTypeField.maxLength as number
if ((lotTypeField.pattern ?? '') !== '') {
inputElement.pattern = lotTypeField.pattern ?? ''
if ((burialSiteTypeField.pattern ?? '') !== '') {
inputElement.pattern = burialSiteTypeField.pattern ?? ''
}
fieldElement.querySelector('.control')?.append(inputElement)
@ -220,10 +226,10 @@ declare const exports: Record<string, unknown>
'select'
) as HTMLSelectElement
selectElement.required = lotTypeField.isRequired as boolean
selectElement.required = burialSiteTypeField.isRequired as boolean
const optionValues = (
lotTypeField.lotTypeFieldValues as string
burialSiteTypeField.fieldValues as string
).split('\n')
for (const optionValue of optionValues) {
@ -234,25 +240,25 @@ declare const exports: Record<string, unknown>
}
}
lotFieldsContainerElement.append(fieldElement)
burialSiteFieldsContainerElement.append(fieldElement)
}
lotFieldsContainerElement.insertAdjacentHTML(
burialSiteFieldsContainerElement.insertAdjacentHTML(
'beforeend',
`<input name="lotTypeFieldIds" type="hidden"
value="${cityssm.escapeHTML(lotTypeFieldIds.slice(1))}" />`
`<input name="burialSiteTypeFieldIds" type="hidden"
value="${cityssm.escapeHTML(burialSiteTypeFieldIds.slice(1))}" />`
)
}
)
})
} else {
const originalburialSiteTypeId = burialSiteTypeIdElement.value
const originalBurialSiteTypeId = burialSiteTypeIdElement.value
burialSiteTypeIdElement.addEventListener('change', () => {
if (burialSiteTypeIdElement.value !== originalburialSiteTypeId) {
if (burialSiteTypeIdElement.value !== originalBurialSiteTypeId) {
bulmaJS.confirm({
title: 'Confirm Change',
message: `Are you sure you want to change the ${los.escapedAliases.lot} type?\n
message: `Are you sure you want to change the burial site type?\n
This change affects the additional fields associated with this record.`,
contextualColorName: 'warning',
okButton: {
@ -264,7 +270,7 @@ declare const exports: Record<string, unknown>
cancelButton: {
text: 'Revert the Change',
callbackFunction() {
burialSiteTypeIdElement.value = originalburialSiteTypeId
burialSiteTypeIdElement.value = originalBurialSiteTypeId
}
}
})
@ -274,19 +280,20 @@ declare const exports: Record<string, unknown>
// Comments
let lotComments = exports.lotComments as LotComment[]
delete exports.lotComments
let burialSiteComments = exports.burialSiteComments as BurialSiteComment[]
delete exports.burialSiteComments
function openEditLotComment(clickEvent: Event): void {
const lotCommentId = Number.parseInt(
function openEditBurialSiteComment(clickEvent: Event): void {
const burialSiteCommentId = Number.parseInt(
(clickEvent.currentTarget as HTMLElement).closest('tr')?.dataset
.lotCommentId ?? '',
.burialSiteCommentId ?? '',
10
)
const lotComment = lotComments.find((currentLotComment) => {
return currentLotComment.lotCommentId === lotCommentId
}) as LotComment
const burialSiteComment = burialSiteComments.find(
(currentComment) =>
currentComment.burialSiteCommentId === burialSiteCommentId
) as BurialSiteComment
let editFormElement: HTMLFormElement
let editCloseModalFunction: () => void
@ -295,19 +302,19 @@ declare const exports: Record<string, unknown>
submitEvent.preventDefault()
cityssm.postJSON(
`${los.urlPrefix}/lots/doUpdateBurialSiteComment`,
`${los.urlPrefix}/burialSites/doUpdateBurialSiteComment`,
editFormElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
lotComments: LotComment[]
burialSiteComments: BurialSiteComment[]
}
if (responseJSON.success) {
lotComments = responseJSON.lotComments
burialSiteComments = responseJSON.burialSiteComments
editCloseModalFunction()
renderLotComments()
renderBurialSiteComments()
} else {
bulmaJS.alert({
title: 'Error Updating Comment',
@ -319,43 +326,43 @@ declare const exports: Record<string, unknown>
)
}
cityssm.openHtmlModal('lot-editComment', {
cityssm.openHtmlModal('burialSite-editComment', {
onshow(modalElement) {
los.populateAliases(modalElement)
;(
modalElement.querySelector(
'#lotCommentEdit--lotId'
'#burialSiteCommentEdit--burialSiteId'
) as HTMLInputElement
).value = lotId
).value = burialSiteId
;(
modalElement.querySelector(
'#lotCommentEdit--lotCommentId'
'#burialSiteCommentEdit--burialSiteCommentId'
) as HTMLInputElement
).value = lotCommentId.toString()
).value = burialSiteCommentId.toString()
;(
modalElement.querySelector(
'#lotCommentEdit--lotComment'
'#burialSiteCommentEdit--comment'
) as HTMLInputElement
).value = lotComment.lotComment ?? ''
).value = burialSiteComment.comment ?? ''
const lotCommentDateStringElement = modalElement.querySelector(
'#lotCommentEdit--lotCommentDateString'
const commentDateStringElement = modalElement.querySelector(
'#burialSiteCommentEdit--commentDateString'
) as HTMLInputElement
lotCommentDateStringElement.value =
lotComment.lotCommentDateString ?? ''
commentDateStringElement.value =
burialSiteComment.commentDateString ?? ''
const currentDateString = cityssm.dateToString(new Date())
lotCommentDateStringElement.max =
lotComment.lotCommentDateString! <= currentDateString
commentDateStringElement.max =
burialSiteComment.commentDateString! <= currentDateString
? currentDateString
: lotComment.lotCommentDateString ?? ''
: burialSiteComment.commentDateString ?? ''
;(
modalElement.querySelector(
'#lotCommentEdit--lotCommentTimeString'
'#burialSiteCommentEdit--commentTimeString'
) as HTMLInputElement
).value = lotComment.lotCommentTimeString ?? ''
).value = burialSiteComment.commentTimeString ?? ''
},
onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped()
@ -364,7 +371,7 @@ declare const exports: Record<string, unknown>
// los.initializeTimePickers(modalElement);
;(
modalElement.querySelector(
'#lotCommentEdit--lotComment'
'#burialSiteCommentEdit--comment'
) as HTMLTextAreaElement
).focus()
@ -379,30 +386,30 @@ declare const exports: Record<string, unknown>
})
}
function deleteLotComment(clickEvent: Event): void {
const lotCommentId = Number.parseInt(
function deleteBurialSiteComment(clickEvent: Event): void {
const burialSiteCommentId = Number.parseInt(
(clickEvent.currentTarget as HTMLElement).closest('tr')?.dataset
.lotCommentId ?? '',
.burialSiteCommentId ?? '',
10
)
function doDelete(): void {
cityssm.postJSON(
`${los.urlPrefix}/lots/doDeleteBurialSiteComment`,
`${los.urlPrefix}/burialSites/doDeleteBurialSiteComment`,
{
lotId,
lotCommentId
burialSiteId,
burialSiteCommentId
},
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
lotComments: LotComment[]
burialSiteComments: BurialSiteComment[]
}
if (responseJSON.success) {
lotComments = responseJSON.lotComments
renderLotComments()
burialSiteComments = responseJSON.burialSiteComments
renderBurialSiteComments()
} else {
bulmaJS.alert({
title: 'Error Removing Comment',
@ -425,12 +432,12 @@ declare const exports: Record<string, unknown>
})
}
function renderLotComments(): void {
function renderBurialSiteComments(): void {
const containerElement = document.querySelector(
'#container--lotComments'
'#container--burialSiteComments'
) as HTMLElement
if (lotComments.length === 0) {
if (burialSiteComments.length === 0) {
containerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no comments to display.</p>
</div>`
@ -447,22 +454,23 @@ declare const exports: Record<string, unknown>
</tr></thead>
<tbody></tbody>`
for (const lotComment of lotComments) {
for (const burialSiteComment of burialSiteComments) {
const tableRowElement = document.createElement('tr')
tableRowElement.dataset.lotCommentId = lotComment.lotCommentId?.toString()
tableRowElement.dataset.burialSiteCommentId =
burialSiteComment.burialSiteCommentId?.toString()
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
${cityssm.escapeHTML(lotComment.recordCreate_userName ?? '')}
${cityssm.escapeHTML(burialSiteComment.recordCreate_userName ?? '')}
</td><td>
${lotComment.lotCommentDateString}
${burialSiteComment.commentDateString}
${
lotComment.lotCommentTime === 0
burialSiteComment.commentTime === 0
? ''
: ` ${lotComment.lotCommentTimePeriodString}`
: ` ${burialSiteComment.commentTimePeriodString}`
}
</td><td>
${cityssm.escapeHTML(lotComment.lotComment ?? '')}
${cityssm.escapeHTML(burialSiteComment.comment ?? '')}
</td><td class="is-hidden-print">
<div class="buttons are-small is-justify-content-end">
<button class="button is-primary button--edit" type="button">
@ -477,11 +485,11 @@ declare const exports: Record<string, unknown>
tableRowElement
.querySelector('.button--edit')
?.addEventListener('click', openEditLotComment)
?.addEventListener('click', openEditBurialSiteComment)
tableRowElement
.querySelector('.button--delete')
?.addEventListener('click', deleteLotComment)
?.addEventListener('click', deleteBurialSiteComment)
tableElement.querySelector('tbody')?.append(tableRowElement)
}
@ -497,31 +505,31 @@ declare const exports: Record<string, unknown>
formEvent.preventDefault()
cityssm.postJSON(
`${los.urlPrefix}/lots/doAddBurialSiteComment`,
`${los.urlPrefix}/burialSites/doAddBurialSiteComment`,
formEvent.currentTarget,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean
lotComments: LotComment[]
burialSiteComments: BurialSiteComment[]
}
if (responseJSON.success) {
lotComments = responseJSON.lotComments
renderLotComments()
burialSiteComments = responseJSON.burialSiteComments
renderBurialSiteComments()
addCommentCloseModalFunction()
}
}
)
}
cityssm.openHtmlModal('lot-addComment', {
cityssm.openHtmlModal('burialSite-addComment', {
onshow(modalElement) {
los.populateAliases(modalElement)
;(
modalElement.querySelector(
'#lotCommentAdd--lotId'
'#burialSiteCommentAdd--burialSiteId'
) as HTMLInputElement
).value = lotId
).value = burialSiteId
modalElement
.querySelector('form')
?.addEventListener('submit', doAddComment)
@ -531,14 +539,16 @@ declare const exports: Record<string, unknown>
addCommentCloseModalFunction = closeModalFunction
;(
modalElement.querySelector(
'#lotCommentAdd--lotComment'
'#burialSiteCommentAdd--comment'
) as HTMLTextAreaElement
).focus()
},
onremoved() {
bulmaJS.toggleHtmlClipped()
;(
document.querySelector('#lotComments--add') as HTMLButtonElement
document.querySelector(
'#burialSiteComments--add'
) as HTMLButtonElement
).focus()
}
})
@ -546,8 +556,8 @@ declare const exports: Record<string, unknown>
if (!isCreate) {
document
.querySelector('#lotComments--add')
.querySelector('#burialSiteComments--add')
?.addEventListener('click', openAddCommentModal)
renderLotComments()
renderBurialSiteComments()
}
})()

View File

@ -6,47 +6,45 @@ Object.defineProperty(exports, "__esModule", { value: true });
const searchResultsContainerElement = document.querySelector('#container--searchResults');
const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10);
const offsetElement = document.querySelector('#searchFilter--offset');
function renderLots(rawResponseJSON) {
function renderBurialSites(rawResponseJSON) {
const responseJSON = rawResponseJSON;
if (responseJSON.lots.length === 0) {
// eslint-disable-next-line no-unsanitized/property
if (responseJSON.burialSites.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no ${los.escapedAliases.lots} that meet the search criteria.</p>
<p class="message-body">There are no burial sites that meet the search criteria.</p>
</div>`;
return;
}
const resultsTbodyElement = document.createElement('tbody');
for (const lot of responseJSON.lots) {
for (const burialSite of responseJSON.burialSites) {
// eslint-disable-next-line no-unsanitized/method
resultsTbodyElement.insertAdjacentHTML('beforeend', `<tr>
<td>
<a class="has-text-weight-bold" href="${los.getBurialSiteURL(lot.lotId)}">
${cityssm.escapeHTML(lot.lotName ?? '')}
<a class="has-text-weight-bold" href="${los.getBurialSiteURL(burialSite.burialSiteId)}">
${cityssm.escapeHTML(burialSite.burialSiteName ?? '')}
</a>
</td><td>
<a href="${los.getCemeteryURL(lot.cemeteryId)}">
${lot.cemeteryName
? cityssm.escapeHTML(lot.cemeteryName)
<a href="${los.getCemeteryURL(burialSite.cemeteryId)}">
${burialSite.cemeteryName
? cityssm.escapeHTML(burialSite.cemeteryName)
: '<span class="has-text-grey">(No Name)</span>'}
</a>
</td><td>
${cityssm.escapeHTML(lot.lotType ?? '')}
${cityssm.escapeHTML(burialSite.burialSiteType ?? '')}
</td><td>
${lot.burialSiteStatusId
? cityssm.escapeHTML(lot.lotStatus ?? '')
${burialSite.burialSiteStatusId
? cityssm.escapeHTML(burialSite.burialSiteStatus ?? '')
: '<span class="has-text-grey">(No Status)</span>'}<br />
${(lot.burialSiteContractCount ?? 0) > 0
${(burialSite.burialSiteContractCount ?? 0) > 0
? '<span class="is-size-7">Currently Occupied</span>'
: ''}
</td>
</tr>`);
}
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable has-sticky-header">
<thead><tr>
<th>${los.escapedAliases.Lot}</th>
<th>${los.escapedAliases.Map}</th>
<th>${los.escapedAliases.Lot} Type</th>
<th>Burial Site</th>
<th>Cemetery</th>
<th>Burial Site Type</th>
<th>Status</th>
</tr></thead>
<table>`;
@ -57,31 +55,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
?.append(resultsTbodyElement);
searchResultsContainerElement
.querySelector("button[data-page='previous']")
?.addEventListener('click', previousAndGetLots);
?.addEventListener('click', previousAndGetBurialSites);
searchResultsContainerElement
.querySelector("button[data-page='next']")
?.addEventListener('click', nextAndGetLots);
?.addEventListener('click', nextAndGetBurialSites);
}
function getBurialSites() {
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Lots}...`);
cityssm.postJSON(`${los.urlPrefix}/lots/doSearchBurialSites`, searchFilterFormElement, renderLots);
searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading Burial Sites...`);
cityssm.postJSON(`${los.urlPrefix}/burialSites/doSearchBurialSites`, searchFilterFormElement, renderBurialSites);
}
function resetOffsetAndGetLots() {
function resetOffsetAndGetBurialSites() {
offsetElement.value = '0';
getBurialSites();
}
function previousAndGetLots() {
function previousAndGetBurialSites() {
offsetElement.value = Math.max(Number.parseInt(offsetElement.value, 10) - limit, 0).toString();
getBurialSites();
}
function nextAndGetLots() {
function nextAndGetBurialSites() {
offsetElement.value = (Number.parseInt(offsetElement.value, 10) + limit).toString();
getBurialSites();
}
const filterElements = searchFilterFormElement.querySelectorAll('input, select');
for (const filterElement of filterElements) {
filterElement.addEventListener('change', resetOffsetAndGetLots);
filterElement.addEventListener('change', resetOffsetAndGetBurialSites);
}
searchFilterFormElement.addEventListener('submit', (formEvent) => {
formEvent.preventDefault();

View File

@ -1,7 +1,8 @@
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { LOS } from '../../types/globalTypes.js'
import type { Lot } from '../../types/recordTypes.js'
import type { BurialSite } from '../../types/recordTypes.js'
import type { LOS } from './types.js'
declare const cityssm: cityssmGlobal
@ -25,17 +26,16 @@ declare const exports: Record<string, unknown>
'#searchFilter--offset'
) as HTMLInputElement
function renderLots(rawResponseJSON: unknown): void {
function renderBurialSites(rawResponseJSON: unknown): void {
const responseJSON = rawResponseJSON as {
count: number
offset: number
lots: Lot[]
burialSites: BurialSite[]
}
if (responseJSON.lots.length === 0) {
// eslint-disable-next-line no-unsanitized/property
if (responseJSON.burialSites.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no ${los.escapedAliases.lots} that meet the search criteria.</p>
<p class="message-body">There are no burial sites that meet the search criteria.</p>
</div>`
return
@ -43,33 +43,33 @@ declare const exports: Record<string, unknown>
const resultsTbodyElement = document.createElement('tbody')
for (const lot of responseJSON.lots) {
for (const burialSite of responseJSON.burialSites) {
// eslint-disable-next-line no-unsanitized/method
resultsTbodyElement.insertAdjacentHTML(
'beforeend',
`<tr>
<td>
<a class="has-text-weight-bold" href="${los.getBurialSiteURL(lot.lotId)}">
${cityssm.escapeHTML(lot.lotName ?? '')}
<a class="has-text-weight-bold" href="${los.getBurialSiteURL(burialSite.burialSiteId)}">
${cityssm.escapeHTML(burialSite.burialSiteName ?? '')}
</a>
</td><td>
<a href="${los.getCemeteryURL(lot.cemeteryId)}">
<a href="${los.getCemeteryURL(burialSite.cemeteryId)}">
${
lot.cemeteryName
? cityssm.escapeHTML(lot.cemeteryName)
burialSite.cemeteryName
? cityssm.escapeHTML(burialSite.cemeteryName)
: '<span class="has-text-grey">(No Name)</span>'
}
</a>
</td><td>
${cityssm.escapeHTML(lot.lotType ?? '')}
${cityssm.escapeHTML(burialSite.burialSiteType ?? '')}
</td><td>
${
lot.burialSiteStatusId
? cityssm.escapeHTML(lot.lotStatus ?? '')
burialSite.burialSiteStatusId
? cityssm.escapeHTML(burialSite.burialSiteStatus ?? '')
: '<span class="has-text-grey">(No Status)</span>'
}<br />
${
(lot.burialSiteContractCount ?? 0) > 0
(burialSite.burialSiteContractCount ?? 0) > 0
? '<span class="is-size-7">Currently Occupied</span>'
: ''
}
@ -78,12 +78,11 @@ declare const exports: Record<string, unknown>
)
}
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable has-sticky-header">
<thead><tr>
<th>${los.escapedAliases.Lot}</th>
<th>${los.escapedAliases.Map}</th>
<th>${los.escapedAliases.Lot} Type</th>
<th>Burial Site</th>
<th>Cemetery</th>
<th>Burial Site Type</th>
<th>Status</th>
</tr></thead>
<table>`
@ -104,32 +103,32 @@ declare const exports: Record<string, unknown>
searchResultsContainerElement
.querySelector("button[data-page='previous']")
?.addEventListener('click', previousAndGetLots)
?.addEventListener('click', previousAndGetBurialSites)
searchResultsContainerElement
.querySelector("button[data-page='next']")
?.addEventListener('click', nextAndGetLots)
?.addEventListener('click', nextAndGetBurialSites)
}
function getBurialSites(): void {
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(
`Loading ${los.escapedAliases.Lots}...`
`Loading Burial Sites...`
)
cityssm.postJSON(
`${los.urlPrefix}/lots/doSearchBurialSites`,
`${los.urlPrefix}/burialSites/doSearchBurialSites`,
searchFilterFormElement,
renderLots
renderBurialSites
)
}
function resetOffsetAndGetLots(): void {
function resetOffsetAndGetBurialSites(): void {
offsetElement.value = '0'
getBurialSites()
}
function previousAndGetLots(): void {
function previousAndGetBurialSites(): void {
offsetElement.value = Math.max(
Number.parseInt(offsetElement.value, 10) - limit,
0
@ -137,7 +136,7 @@ declare const exports: Record<string, unknown>
getBurialSites()
}
function nextAndGetLots(): void {
function nextAndGetBurialSites(): void {
offsetElement.value = (
Number.parseInt(offsetElement.value, 10) + limit
).toString()
@ -148,7 +147,7 @@ declare const exports: Record<string, unknown>
searchFilterFormElement.querySelectorAll('input, select')
for (const filterElement of filterElements) {
filterElement.addEventListener('change', resetOffsetAndGetLots)
filterElement.addEventListener('change', resetOffsetAndGetBurialSites)
}
searchFilterFormElement.addEventListener('submit', (formEvent) => {

View File

@ -1,9 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
(() => {
const mapContainerElement = document.querySelector('#lot--map');
const mapContainerElement = document.querySelector('#burialSite--cemeterySvg');
if (mapContainerElement !== null) {
;
exports.los.highlightMap(mapContainerElement, mapContainerElement.dataset.mapKey ?? '', 'success');
exports.los.highlightMap(mapContainerElement, mapContainerElement.dataset.cemeterySvgId ?? '', 'success');
}
})();

View File

@ -1,14 +1,14 @@
import type { LOS } from '../../types/globalTypes.js'
import type { LOS } from './types.js'
declare const exports: Record<string, unknown>
;(() => {
const mapContainerElement: HTMLElement | null =
document.querySelector('#lot--map')
document.querySelector('#burialSite--cemeterySvg')
if (mapContainerElement !== null) {
;(exports.los as LOS).highlightMap(
mapContainerElement,
mapContainerElement.dataset.mapKey ?? '',
mapContainerElement.dataset.cemeterySvgId ?? '',
'success'
)
}

View File

@ -246,9 +246,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
inputElement.type = occupancyTypeField.fieldType;
inputElement.required = occupancyTypeField.isRequired;
inputElement.minLength =
occupancyTypeField.minimumLength;
occupancyTypeField.minLength;
inputElement.maxLength =
occupancyTypeField.maximumLength;
occupancyTypeField.maxLength;
if ((occupancyTypeField.pattern ?? '') !== '') {
inputElement.pattern = occupancyTypeField.pattern;
}
@ -314,7 +314,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
// eslint-disable-next-line no-unsanitized/property
lotSelectResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(`${los.urlPrefix}/lots/doSearchBurialSites`, lotSelectFormElement, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/burialSites/doSearchBurialSites`, lotSelectFormElement, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.count === 0) {
lotSelectResultsElement.innerHTML = `<div class="message is-info">
@ -353,7 +353,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
function createLotAndSelect(submitEvent) {
submitEvent.preventDefault();
const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value;
cityssm.postJSON(`${los.urlPrefix}/lots/doCreateBurialSite`, submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/burialSites/doCreateBurialSite`, submitEvent.currentTarget, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
renderSelectedLotAndClose(responseJSON.lotId ?? '', lotName);
@ -441,7 +441,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
else {
window.open(`${los.urlPrefix}/lots/${lotId}`);
window.open(`${los.urlPrefix}/burialSites/${lotId}`);
}
});
document

View File

@ -399,10 +399,10 @@ declare const exports: Record<string, unknown>
inputElement.required = occupancyTypeField.isRequired as boolean
inputElement.minLength =
occupancyTypeField.minimumLength as number
occupancyTypeField.minLength as number
inputElement.maxLength =
occupancyTypeField.maximumLength as number
occupancyTypeField.maxLength as number
if ((occupancyTypeField.pattern ?? '') !== '') {
inputElement.pattern = occupancyTypeField.pattern as string
@ -501,7 +501,7 @@ declare const exports: Record<string, unknown>
los.getLoadingParagraphHTML('Searching...')
cityssm.postJSON(
`${los.urlPrefix}/lots/doSearchBurialSites`,
`${los.urlPrefix}/burialSites/doSearchBurialSites`,
lotSelectFormElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
@ -563,7 +563,7 @@ declare const exports: Record<string, unknown>
).value
cityssm.postJSON(
`${los.urlPrefix}/lots/doCreateBurialSite`,
`${los.urlPrefix}/burialSites/doCreateBurialSite`,
submitEvent.currentTarget,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
@ -704,7 +704,7 @@ declare const exports: Record<string, unknown>
contextualColorName: 'info'
})
} else {
window.open(`${los.urlPrefix}/lots/${lotId}`)
window.open(`${los.urlPrefix}/burialSites/${lotId}`)
}
})

View File

@ -6,48 +6,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
const searchResultsContainerElement = document.querySelector('#container--searchResults');
const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10);
const offsetElement = document.querySelector('#searchFilter--offset');
function renderLotOccupancies(rawResponseJSON) {
// eslint-disable-next-line complexity
function renderContracts(rawResponseJSON) {
const responseJSON = rawResponseJSON;
if (responseJSON.lotOccupancies.length === 0) {
// eslint-disable-next-line no-unsanitized/property
if (responseJSON.burialSiteContracts.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">
There are no ${los.escapedAliases.occupancy} records that meet the search criteria.
There are no contracts that meet the search criteria.
</p>
</div>`;
return;
}
const resultsTbodyElement = document.createElement('tbody');
const nowDateString = cityssm.dateToString(new Date());
for (const burialSiteContract of responseJSON.lotOccupancies) {
let occupancyTimeHTML = '';
for (const burialSiteContract of responseJSON.burialSiteContracts) {
let contractTimeHTML = '';
if (burialSiteContract.contractStartDateString <= nowDateString &&
(burialSiteContract.contractEndDateString === '' ||
burialSiteContract.contractEndDateString >= nowDateString)) {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Current ${los.escapedAliases.Occupancy}">
<i class="fas fa-play" aria-label="Current ${los.escapedAliases.Occupancy}"></i>
contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Current Contract">
<i class="fas fa-play" aria-label="Current Contract"></i>
</span>`;
}
else if (burialSiteContract.contractStartDateString > nowDateString) {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Future ${los.escapedAliases.Occupancy}">
<i class="fas fa-fast-forward" aria-label="Future ${los.escapedAliases.Occupancy}"></i>
contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Future Contract">
<i class="fas fa-fast-forward" aria-label="Future Contract"></i>
</span>`;
}
else {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Past ${los.escapedAliases.Occupancy}">
<i class="fas fa-stop" aria-label="Past ${los.escapedAliases.Occupancy}"></i>
contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Past Contract">
<i class="fas fa-stop" aria-label="Past Contract"></i>
</span>`;
}
let occupantsHTML = '';
for (const occupant of burialSiteContract.burialSiteContractOccupants ?? []) {
occupantsHTML += `<li class="has-tooltip-left" data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType ?? '')}">
<span class="fa-li">
<i class="fas fa-fw fa-${cityssm.escapeHTML((occupant.fontAwesomeIconClass ?? '') === ''
? 'user'
: occupant.fontAwesomeIconClass ?? '')}" aria-hidden="true"></i>
</span>
${cityssm.escapeHTML(occupant.occupantName ?? '')}
${cityssm.escapeHTML(occupant.occupantFamilyName ?? '')}
let deceasedHTML = '';
for (const interment of burialSiteContract.burialSiteContractInterments ?? []) {
deceasedHTML += `<li class="has-tooltip-left">
${cityssm.escapeHTML(interment.deceasedName ?? '')}
</li>`;
}
const feeTotal = (burialSiteContract.burialSiteContractFees?.reduce((soFar, currentFee) => soFar +
@ -67,17 +61,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
// eslint-disable-next-line no-unsanitized/method
resultsTbodyElement.insertAdjacentHTML('beforeend', `<tr>
<td class="has-width-1">
${occupancyTimeHTML}
${contractTimeHTML}
</td><td>
<a class="has-text-weight-bold"
href="${los.getBurialSiteContractURL(burialSiteContract.burialSiteContractId)}">
${cityssm.escapeHTML(burialSiteContract.occupancyType ?? '')}
${cityssm.escapeHTML(burialSiteContract.contractType ?? '')}
</a><br />
<span class="is-size-7">#${burialSiteContract.burialSiteContractId}</span>
</td><td>
${(burialSiteContract.lotId ?? -1) === -1
? `<span class="has-text-grey">(No ${los.escapedAliases.Lot})</span>`
: `<a class="has-tooltip-right" data-tooltip="${cityssm.escapeHTML(burialSiteContract.lotType ?? '')}" href="${los.getBurialSiteURL(burialSiteContract.lotId)}">${cityssm.escapeHTML(burialSiteContract.lotName ?? '')}</a>`}<br />
${(burialSiteContract.burialSiteId ?? -1) === -1
? `<span class="has-text-grey">(No Burial Site)</span>`
: `<a class="has-tooltip-right" data-tooltip="${cityssm.escapeHTML(burialSiteContract.burialSiteType ?? '')}"
href="${los.getBurialSiteURL(burialSiteContract.burialSiteId)}">
${cityssm.escapeHTML(burialSiteContract.burialSiteName ?? '')}
</a>`}<br />
<span class="is-size-7">${cityssm.escapeHTML(burialSiteContract.cemeteryName ?? '')}</span>
</td><td>
${burialSiteContract.contractStartDateString}
@ -86,9 +83,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
? burialSiteContract.contractEndDateString
: '<span class="has-text-grey">(No End Date)</span>'}
</td><td>
${occupantsHTML === ''
${deceasedHTML === ''
? ''
: `<ul class="fa-ul ml-5">${occupantsHTML}</ul>`}
: `<ul class="fa-ul ml-5">${deceasedHTML}</ul>`}
</td><td>
${feeIconHTML}
</td><td>
@ -99,15 +96,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
</a>`
: ''}</td></tr>`);
}
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable has-sticky-header">
<thead><tr>
<th class="has-width-1"></th>
<th>${los.escapedAliases.Occupancy} Type</th>
<th>${los.escapedAliases.Lot}</th>
<th>${los.escapedAliases.contractStartDate}</th>
<th>Contract Type</th>
<th>Burial Site</th>
<th>Contract Date</th>
<th>End Date</th>
<th>${los.escapedAliases.Occupants}</th>
<th>Deceased</th>
<th class="has-width-1"><span class="is-sr-only">Fees and Transactions</span></th>
<th class="has-width-1"><span class="is-sr-only">Print</span></th>
</tr></thead>
@ -119,31 +115,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
searchResultsContainerElement.insertAdjacentHTML('beforeend', los.getSearchResultsPagerHTML(limit, responseJSON.offset, responseJSON.count));
searchResultsContainerElement
.querySelector("button[data-page='previous']")
?.addEventListener('click', previousAndGetLotOccupancies);
?.addEventListener('click', previousAndGetContracts);
searchResultsContainerElement
.querySelector("button[data-page='next']")
?.addEventListener('click', nextAndGetLotOccupancies);
?.addEventListener('click', nextAndGetContracts);
}
function getBurialSiteContracts() {
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Occupancies}...`);
cityssm.postJSON(`${los.urlPrefix}/contracts/doSearchLotOccupancies`, searchFilterFormElement, renderLotOccupancies);
searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading Contracts...`);
cityssm.postJSON(`${los.urlPrefix}/contracts/doSearchBurialSiteContracts`, searchFilterFormElement, renderContracts);
}
function resetOffsetAndGetLotOccupancies() {
function resetOffsetAndGetContracts() {
offsetElement.value = '0';
getBurialSiteContracts();
}
function previousAndGetLotOccupancies() {
function previousAndGetContracts() {
offsetElement.value = Math.max(Number.parseInt(offsetElement.value, 10) - limit, 0).toString();
getBurialSiteContracts();
}
function nextAndGetLotOccupancies() {
function nextAndGetContracts() {
offsetElement.value = (Number.parseInt(offsetElement.value, 10) + limit).toString();
getBurialSiteContracts();
}
const filterElements = searchFilterFormElement.querySelectorAll('input, select');
for (const filterElement of filterElements) {
filterElement.addEventListener('change', resetOffsetAndGetLotOccupancies);
filterElement.addEventListener('change', resetOffsetAndGetContracts);
}
searchFilterFormElement.addEventListener('submit', (formEvent) => {
formEvent.preventDefault();

View File

@ -1,7 +1,8 @@
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { LOS } from '../../types/globalTypes.js'
import type { LotOccupancy } from '../../types/recordTypes.js'
import type { BurialSiteContract } from '../../types/recordTypes.js'
import type { LOS } from './types.js'
declare const cityssm: cityssmGlobal
@ -26,18 +27,18 @@ declare const exports: Record<string, unknown>
'#searchFilter--offset'
) as HTMLInputElement
function renderLotOccupancies(rawResponseJSON: unknown): void {
// eslint-disable-next-line complexity
function renderContracts(rawResponseJSON: unknown): void {
const responseJSON = rawResponseJSON as {
count: number
offset: number
lotOccupancies: LotOccupancy[]
burialSiteContracts: BurialSiteContract[]
}
if (responseJSON.lotOccupancies.length === 0) {
// eslint-disable-next-line no-unsanitized/property
if (responseJSON.burialSiteContracts.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">
There are no ${los.escapedAliases.occupancy} records that meet the search criteria.
There are no contracts that meet the search criteria.
</p>
</div>`
@ -48,40 +49,32 @@ declare const exports: Record<string, unknown>
const nowDateString = cityssm.dateToString(new Date())
for (const burialSiteContract of responseJSON.lotOccupancies) {
let occupancyTimeHTML = ''
for (const burialSiteContract of responseJSON.burialSiteContracts) {
let contractTimeHTML = ''
if (
burialSiteContract.contractStartDateString! <= nowDateString &&
(burialSiteContract.contractEndDateString === '' ||
burialSiteContract.contractEndDateString! >= nowDateString)
) {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Current ${los.escapedAliases.Occupancy}">
<i class="fas fa-play" aria-label="Current ${los.escapedAliases.Occupancy}"></i>
contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Current Contract">
<i class="fas fa-play" aria-label="Current Contract"></i>
</span>`
} else if (burialSiteContract.contractStartDateString! > nowDateString) {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Future ${los.escapedAliases.Occupancy}">
<i class="fas fa-fast-forward" aria-label="Future ${los.escapedAliases.Occupancy}"></i>
contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Future Contract">
<i class="fas fa-fast-forward" aria-label="Future Contract"></i>
</span>`
} else {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Past ${los.escapedAliases.Occupancy}">
<i class="fas fa-stop" aria-label="Past ${los.escapedAliases.Occupancy}"></i>
contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Past Contract">
<i class="fas fa-stop" aria-label="Past Contract"></i>
</span>`
}
let occupantsHTML = ''
let deceasedHTML = ''
for (const occupant of burialSiteContract.burialSiteContractOccupants ?? []) {
occupantsHTML += `<li class="has-tooltip-left" data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType ?? '')}">
<span class="fa-li">
<i class="fas fa-fw fa-${cityssm.escapeHTML(
(occupant.fontAwesomeIconClass ?? '') === ''
? 'user'
: occupant.fontAwesomeIconClass ?? ''
)}" aria-hidden="true"></i>
</span>
${cityssm.escapeHTML(occupant.occupantName ?? '')}
${cityssm.escapeHTML(occupant.occupantFamilyName ?? '')}
for (const interment of burialSiteContract.burialSiteContractInterments ?? []) {
deceasedHTML += `<li class="has-tooltip-left">
${cityssm.escapeHTML(interment.deceasedName ?? '')}
</li>`
}
@ -122,18 +115,21 @@ declare const exports: Record<string, unknown>
'beforeend',
`<tr>
<td class="has-width-1">
${occupancyTimeHTML}
${contractTimeHTML}
</td><td>
<a class="has-text-weight-bold"
href="${los.getBurialSiteContractURL(burialSiteContract.burialSiteContractId)}">
${cityssm.escapeHTML(burialSiteContract.occupancyType ?? '')}
${cityssm.escapeHTML(burialSiteContract.contractType ?? '')}
</a><br />
<span class="is-size-7">#${burialSiteContract.burialSiteContractId}</span>
</td><td>
${
(burialSiteContract.lotId ?? -1) === -1
? `<span class="has-text-grey">(No ${los.escapedAliases.Lot})</span>`
: `<a class="has-tooltip-right" data-tooltip="${cityssm.escapeHTML(burialSiteContract.lotType ?? '')}" href="${los.getBurialSiteURL(burialSiteContract.lotId)}">${cityssm.escapeHTML(burialSiteContract.lotName ?? '')}</a>`
(burialSiteContract.burialSiteId ?? -1) === -1
? `<span class="has-text-grey">(No Burial Site)</span>`
: `<a class="has-tooltip-right" data-tooltip="${cityssm.escapeHTML(burialSiteContract.burialSiteType ?? '')}"
href="${los.getBurialSiteURL(burialSiteContract.burialSiteId)}">
${cityssm.escapeHTML(burialSiteContract.burialSiteName ?? '')}
</a>`
}<br />
<span class="is-size-7">${cityssm.escapeHTML(burialSiteContract.cemeteryName ?? '')}</span>
</td><td>
@ -146,9 +142,9 @@ declare const exports: Record<string, unknown>
}
</td><td>
${
occupantsHTML === ''
deceasedHTML === ''
? ''
: `<ul class="fa-ul ml-5">${occupantsHTML}</ul>`
: `<ul class="fa-ul ml-5">${deceasedHTML}</ul>`
}
</td><td>
${feeIconHTML}
@ -164,15 +160,14 @@ declare const exports: Record<string, unknown>
)
}
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable has-sticky-header">
<thead><tr>
<th class="has-width-1"></th>
<th>${los.escapedAliases.Occupancy} Type</th>
<th>${los.escapedAliases.Lot}</th>
<th>${los.escapedAliases.contractStartDate}</th>
<th>Contract Type</th>
<th>Burial Site</th>
<th>Contract Date</th>
<th>End Date</th>
<th>${los.escapedAliases.Occupants}</th>
<th>Deceased</th>
<th class="has-width-1"><span class="is-sr-only">Fees and Transactions</span></th>
<th class="has-width-1"><span class="is-sr-only">Print</span></th>
</tr></thead>
@ -194,32 +189,32 @@ declare const exports: Record<string, unknown>
searchResultsContainerElement
.querySelector("button[data-page='previous']")
?.addEventListener('click', previousAndGetLotOccupancies)
?.addEventListener('click', previousAndGetContracts)
searchResultsContainerElement
.querySelector("button[data-page='next']")
?.addEventListener('click', nextAndGetLotOccupancies)
?.addEventListener('click', nextAndGetContracts)
}
function getBurialSiteContracts(): void {
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(
`Loading ${los.escapedAliases.Occupancies}...`
`Loading Contracts...`
)
cityssm.postJSON(
`${los.urlPrefix}/contracts/doSearchLotOccupancies`,
`${los.urlPrefix}/contracts/doSearchBurialSiteContracts`,
searchFilterFormElement,
renderLotOccupancies
renderContracts
)
}
function resetOffsetAndGetLotOccupancies(): void {
function resetOffsetAndGetContracts(): void {
offsetElement.value = '0'
getBurialSiteContracts()
}
function previousAndGetLotOccupancies(): void {
function previousAndGetContracts(): void {
offsetElement.value = Math.max(
Number.parseInt(offsetElement.value, 10) - limit,
0
@ -227,7 +222,7 @@ declare const exports: Record<string, unknown>
getBurialSiteContracts()
}
function nextAndGetLotOccupancies(): void {
function nextAndGetContracts(): void {
offsetElement.value = (
Number.parseInt(offsetElement.value, 10) + limit
).toString()
@ -238,7 +233,7 @@ declare const exports: Record<string, unknown>
searchFilterFormElement.querySelectorAll('input, select')
for (const filterElement of filterElements) {
filterElement.addEventListener('change', resetOffsetAndGetLotOccupancies)
filterElement.addEventListener('change', resetOffsetAndGetContracts)
}
searchFilterFormElement.addEventListener('submit', (formEvent) => {

View File

@ -135,33 +135,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
const lotType = lotTypes.find((currentLotType) => currentLotType.burialSiteTypeId === burialSiteTypeId);
const lotTypeField = (lotType.BurialSiteTypeFields ?? []).find((currentLotTypeField) => currentLotTypeField.lotTypeFieldId === lotTypeFieldId);
let fieldTypeElement;
let minimumLengthElement;
let maximumLengthElement;
let minLengthInputElement;
let maxLengthInputElement;
let patternElement;
let lotTypeFieldValuesElement;
let editCloseModalFunction;
function updateMaximumLengthMin() {
maximumLengthElement.min = minimumLengthElement.value;
maxLengthInputElement.min = minLengthInputElement.value;
}
function toggleInputFields() {
switch (fieldTypeElement.value) {
case 'date': {
minimumLengthElement.disabled = true;
maximumLengthElement.disabled = true;
minLengthInputElement.disabled = true;
maxLengthInputElement.disabled = true;
patternElement.disabled = true;
lotTypeFieldValuesElement.disabled = true;
break;
}
case 'select': {
minimumLengthElement.disabled = true;
maximumLengthElement.disabled = true;
minLengthInputElement.disabled = true;
maxLengthInputElement.disabled = true;
patternElement.disabled = true;
lotTypeFieldValuesElement.disabled = false;
break;
}
default: {
minimumLengthElement.disabled = false;
maximumLengthElement.disabled = false;
minLengthInputElement.disabled = false;
maxLengthInputElement.disabled = false;
patternElement.disabled = false;
lotTypeFieldValuesElement.disabled = true;
break;
@ -208,12 +208,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector('#lotTypeFieldEdit--isRequired').value = lotTypeField.isRequired ? '1' : '0';
fieldTypeElement = modalElement.querySelector('#lotTypeFieldEdit--fieldType');
fieldTypeElement.value = lotTypeField.fieldType;
minimumLengthElement = modalElement.querySelector('#lotTypeFieldEdit--minimumLength');
minimumLengthElement.value =
lotTypeField.minimumLength?.toString() ?? '';
maximumLengthElement = modalElement.querySelector('#lotTypeFieldEdit--maximumLength');
maximumLengthElement.value =
lotTypeField.maximumLength?.toString() ?? '';
minLengthInputElement = modalElement.querySelector('#lotTypeFieldEdit--minLength');
minLengthInputElement.value =
lotTypeField.minLength?.toString() ?? '';
maxLengthInputElement = modalElement.querySelector('#lotTypeFieldEdit--maxLength');
maxLengthInputElement.value =
lotTypeField.maxLength?.toString() ?? '';
patternElement = modalElement.querySelector('#lotTypeFieldEdit--pattern');
patternElement.value = lotTypeField.pattern ?? '';
lotTypeFieldValuesElement = modalElement.querySelector('#lotTypeFieldEdit--lotTypeFieldValues');
@ -226,7 +226,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
bulmaJS.toggleHtmlClipped();
cityssm.enableNavBlocker();
modalElement.querySelector('form')?.addEventListener('submit', doUpdate);
minimumLengthElement.addEventListener('keyup', updateMaximumLengthMin);
minLengthInputElement.addEventListener('keyup', updateMaximumLengthMin);
updateMaximumLengthMin();
fieldTypeElement.addEventListener('change', toggleInputFields);
modalElement

View File

@ -273,36 +273,36 @@ type ResponseJSON =
) as LotTypeField
let fieldTypeElement: HTMLSelectElement
let minimumLengthElement: HTMLInputElement
let maximumLengthElement: HTMLInputElement
let minLengthInputElement: HTMLInputElement
let maxLengthInputElement: HTMLInputElement
let patternElement: HTMLInputElement
let lotTypeFieldValuesElement: HTMLTextAreaElement
let editCloseModalFunction: () => void
function updateMaximumLengthMin(): void {
maximumLengthElement.min = minimumLengthElement.value
maxLengthInputElement.min = minLengthInputElement.value
}
function toggleInputFields(): void {
switch (fieldTypeElement.value) {
case 'date': {
minimumLengthElement.disabled = true
maximumLengthElement.disabled = true
minLengthInputElement.disabled = true
maxLengthInputElement.disabled = true
patternElement.disabled = true
lotTypeFieldValuesElement.disabled = true
break
}
case 'select': {
minimumLengthElement.disabled = true
maximumLengthElement.disabled = true
minLengthInputElement.disabled = true
maxLengthInputElement.disabled = true
patternElement.disabled = true
lotTypeFieldValuesElement.disabled = false
break
}
default: {
minimumLengthElement.disabled = false
maximumLengthElement.disabled = false
minLengthInputElement.disabled = false
maxLengthInputElement.disabled = false
patternElement.disabled = false
lotTypeFieldValuesElement.disabled = true
break
@ -382,19 +382,19 @@ type ResponseJSON =
fieldTypeElement.value = lotTypeField.fieldType
minimumLengthElement = modalElement.querySelector(
'#lotTypeFieldEdit--minimumLength'
minLengthInputElement = modalElement.querySelector(
'#lotTypeFieldEdit--minLength'
) as HTMLInputElement
minimumLengthElement.value =
lotTypeField.minimumLength?.toString() ?? ''
minLengthInputElement.value =
lotTypeField.minLength?.toString() ?? ''
maximumLengthElement = modalElement.querySelector(
'#lotTypeFieldEdit--maximumLength'
maxLengthInputElement = modalElement.querySelector(
'#lotTypeFieldEdit--maxLength'
) as HTMLInputElement
maximumLengthElement.value =
lotTypeField.maximumLength?.toString() ?? ''
maxLengthInputElement.value =
lotTypeField.maxLength?.toString() ?? ''
patternElement = modalElement.querySelector(
'#lotTypeFieldEdit--pattern'
@ -419,7 +419,7 @@ type ResponseJSON =
modalElement.querySelector('form')?.addEventListener('submit', doUpdate)
minimumLengthElement.addEventListener('keyup', updateMaximumLengthMin)
minLengthInputElement.addEventListener('keyup', updateMaximumLengthMin)
updateMaximumLengthMin()
fieldTypeElement.addEventListener('change', toggleInputFields)

View File

@ -144,33 +144,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
? occupancyType.ContractTypeFields ?? []
: allContractTypeFields).find((currentOccupancyTypeField) => currentOccupancyTypeField.contractTypeFieldId === contractTypeFieldId);
let fieldTypeElement;
let minimumLengthElement;
let maximumLengthElement;
let minLengthInputElement;
let maxLengthInputElement;
let patternElement;
let occupancyTypeFieldValuesElement;
let editCloseModalFunction;
function updateMaximumLengthMin() {
maximumLengthElement.min = minimumLengthElement.value;
maxLengthInputElement.min = minLengthInputElement.value;
}
function toggleInputFields() {
switch (fieldTypeElement.value) {
case 'date': {
minimumLengthElement.disabled = true;
maximumLengthElement.disabled = true;
minLengthInputElement.disabled = true;
maxLengthInputElement.disabled = true;
patternElement.disabled = true;
occupancyTypeFieldValuesElement.disabled = true;
break;
}
case 'select': {
minimumLengthElement.disabled = true;
maximumLengthElement.disabled = true;
minLengthInputElement.disabled = true;
maxLengthInputElement.disabled = true;
patternElement.disabled = true;
occupancyTypeFieldValuesElement.disabled = false;
break;
}
default: {
minimumLengthElement.disabled = false;
maximumLengthElement.disabled = false;
minLengthInputElement.disabled = false;
maxLengthInputElement.disabled = false;
patternElement.disabled = false;
occupancyTypeFieldValuesElement.disabled = true;
break;
@ -217,12 +217,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector('#occupancyTypeFieldEdit--isRequired').value = occupancyTypeField.isRequired ?? false ? '1' : '0';
fieldTypeElement = modalElement.querySelector('#occupancyTypeFieldEdit--fieldType');
fieldTypeElement.value = occupancyTypeField.fieldType;
minimumLengthElement = modalElement.querySelector('#occupancyTypeFieldEdit--minimumLength');
minimumLengthElement.value =
occupancyTypeField.minimumLength?.toString() ?? '';
maximumLengthElement = modalElement.querySelector('#occupancyTypeFieldEdit--maximumLength');
maximumLengthElement.value =
occupancyTypeField.maximumLength?.toString() ?? '';
minLengthInputElement = modalElement.querySelector('#occupancyTypeFieldEdit--minLength');
minLengthInputElement.value =
occupancyTypeField.minLength?.toString() ?? '';
maxLengthInputElement = modalElement.querySelector('#occupancyTypeFieldEdit--maxLength');
maxLengthInputElement.value =
occupancyTypeField.maxLength?.toString() ?? '';
patternElement = modalElement.querySelector('#occupancyTypeFieldEdit--pattern');
patternElement.value = occupancyTypeField.pattern ?? '';
occupancyTypeFieldValuesElement = modalElement.querySelector('#occupancyTypeFieldEdit--occupancyTypeFieldValues');
@ -236,7 +236,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
bulmaJS.toggleHtmlClipped();
cityssm.enableNavBlocker();
modalElement.querySelector('form')?.addEventListener('submit', doUpdate);
minimumLengthElement.addEventListener('keyup', updateMaximumLengthMin);
minLengthInputElement.addEventListener('keyup', updateMaximumLengthMin);
updateMaximumLengthMin();
fieldTypeElement.addEventListener('change', toggleInputFields);
modalElement

View File

@ -303,36 +303,36 @@ type ResponseJSON =
) as OccupancyTypeField
let fieldTypeElement: HTMLSelectElement
let minimumLengthElement: HTMLInputElement
let maximumLengthElement: HTMLInputElement
let minLengthInputElement: HTMLInputElement
let maxLengthInputElement: HTMLInputElement
let patternElement: HTMLInputElement
let occupancyTypeFieldValuesElement: HTMLTextAreaElement
let editCloseModalFunction: () => void
function updateMaximumLengthMin(): void {
maximumLengthElement.min = minimumLengthElement.value
maxLengthInputElement.min = minLengthInputElement.value
}
function toggleInputFields(): void {
switch (fieldTypeElement.value) {
case 'date': {
minimumLengthElement.disabled = true
maximumLengthElement.disabled = true
minLengthInputElement.disabled = true
maxLengthInputElement.disabled = true
patternElement.disabled = true
occupancyTypeFieldValuesElement.disabled = true
break
}
case 'select': {
minimumLengthElement.disabled = true
maximumLengthElement.disabled = true
minLengthInputElement.disabled = true
maxLengthInputElement.disabled = true
patternElement.disabled = true
occupancyTypeFieldValuesElement.disabled = false
break
}
default: {
minimumLengthElement.disabled = false
maximumLengthElement.disabled = false
minLengthInputElement.disabled = false
maxLengthInputElement.disabled = false
patternElement.disabled = false
occupancyTypeFieldValuesElement.disabled = true
break
@ -412,19 +412,19 @@ type ResponseJSON =
fieldTypeElement.value = occupancyTypeField.fieldType
minimumLengthElement = modalElement.querySelector(
'#occupancyTypeFieldEdit--minimumLength'
minLengthInputElement = modalElement.querySelector(
'#occupancyTypeFieldEdit--minLength'
) as HTMLInputElement
minimumLengthElement.value =
occupancyTypeField.minimumLength?.toString() ?? ''
minLengthInputElement.value =
occupancyTypeField.minLength?.toString() ?? ''
maximumLengthElement = modalElement.querySelector(
'#occupancyTypeFieldEdit--maximumLength'
maxLengthInputElement = modalElement.querySelector(
'#occupancyTypeFieldEdit--maxLength'
) as HTMLInputElement
maximumLengthElement.value =
occupancyTypeField.maximumLength?.toString() ?? ''
maxLengthInputElement.value =
occupancyTypeField.maxLength?.toString() ?? ''
patternElement = modalElement.querySelector(
'#occupancyTypeFieldEdit--pattern'
@ -450,7 +450,7 @@ type ResponseJSON =
modalElement.querySelector('form')?.addEventListener('submit', doUpdate)
minimumLengthElement.addEventListener('keyup', updateMaximumLengthMin)
minLengthInputElement.addEventListener('keyup', updateMaximumLengthMin)
updateMaximumLengthMin()
fieldTypeElement.addEventListener('change', toggleInputFields)

View File

@ -24,8 +24,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
function highlightMap(mapContainerElement, mapKey, contextualClass) {
// Search for ID
let svgId = mapKey;
let svgElementToHighlight;
while (true) {
let svgElementToHighlight = null;
while (svgId !== '') {
svgElementToHighlight = mapContainerElement.querySelector(`#${svgId}`);
if (svgElementToHighlight !== null || !svgId.includes('-')) {
break;

View File

@ -62,9 +62,9 @@ declare const exports: Record<string, unknown> & {
): void {
// Search for ID
let svgId = mapKey
let svgElementToHighlight: SVGElement | null
let svgElementToHighlight: SVGElement | null = null
while (true) {
while (svgId !== '') {
svgElementToHighlight = mapContainerElement.querySelector(`#${svgId}`)
if (svgElementToHighlight !== null || !svgId.includes('-')) {

View File

@ -620,7 +620,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML =
los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(`${los.urlPrefix}/lots/doSearchBurialSites`, searchFormElement, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/burialSites/doSearchBurialSites`, searchFormElement, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.lots.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info">

View File

@ -946,7 +946,7 @@ declare const exports: Record<string, unknown>
los.getLoadingParagraphHTML('Searching...')
cityssm.postJSON(
`${los.urlPrefix}/lots/doSearchBurialSites`,
`${los.urlPrefix}/burialSites/doSearchBurialSites`,
searchFormElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as { lots: Lot[] }

View File

@ -24,10 +24,10 @@ router.post('/doSearchBurialSites', handler_doSearchBurialSites);
* Lot View / Edit
*/
router.get('/new', updateGetHandler, handler_new);
router.get('/:lotId', handler_view);
router.get('/:lotId/next', handler_next);
router.get('/:lotId/previous', handler_previous);
router.get('/:lotId/edit', updateGetHandler, handler_edit);
router.get('/:burialSiteId', handler_view);
router.get('/:burialSiteId/next', handler_next);
router.get('/:burialSiteId/previous', handler_previous);
router.get('/:burialSiteId/edit', updateGetHandler, handler_edit);
router.post('/doGetBurialSiteTypeFields', updatePostHandler, handler_doGetBurialSiteTypeFields);
router.post('/doCreateBurialSite', updatePostHandler, handler_doCreateBurialSite);
router.post('/doUpdateBurialSite', updatePostHandler, handler_doUpdateBurialSite);

View File

@ -32,13 +32,13 @@ router.post('/doSearchBurialSites', handler_doSearchBurialSites)
router.get('/new', updateGetHandler, handler_new)
router.get('/:lotId', handler_view)
router.get('/:burialSiteId', handler_view)
router.get('/:lotId/next', handler_next)
router.get('/:burialSiteId/next', handler_next)
router.get('/:lotId/previous', handler_previous)
router.get('/:burialSiteId/previous', handler_previous)
router.get('/:lotId/edit', updateGetHandler, handler_edit)
router.get('/:burialSiteId/edit', updateGetHandler, handler_edit)
router.post(
'/doGetBurialSiteTypeFields',

View File

@ -88,6 +88,7 @@ export interface ConfigActiveDirectory {
}
export interface ConfigBurialSiteNameSegments {
separator?: string;
includeCemeteryKey?: boolean;
segments: Partial<Record<'1' | '2' | '3' | '4' | '5', {
isAvailable?: boolean;
isRequired?: boolean;

View File

@ -98,6 +98,7 @@ export interface ConfigActiveDirectory {
export interface ConfigBurialSiteNameSegments {
separator?: string
includeCemeteryKey?: boolean
segments: Partial<
Record<
'1' | '2' | '3' | '4' | '5',

View File

@ -22,9 +22,9 @@
<li>
<a class="<%= (headTitle === configFunctions.getConfigProperty("aliases.lot") + " Type Management" ? "is-active" : "") %>"
href="<%= urlPrefix %>/admin/lotTypes"
aria-label="<%= configFunctions.getConfigProperty("aliases.lot") %> Type Management">
aria-label="Burial Site Type Management">
<span class="icon"><i class="fas fa-fw fa-vector-square" aria-hidden="true"></i></span>
<span class="is-hidden-touch"><%= configFunctions.getConfigProperty("aliases.lot") %> Type Management</span>
<span class="is-hidden-touch">Burial Site Type Management</span>
</a>
</li>
<li>

View File

@ -16,7 +16,7 @@
</li>
<li class="is-active">
<a href="#" aria-current="page">
<%= configFunctions.getConfigProperty("aliases.lot") %> Type Management
Burial Site Type Management
</a>
</li>
</ul>
@ -25,13 +25,13 @@
<div class="columns is-vcentered">
<div class="column">
<h1 class="title is-1">
<%= configFunctions.getConfigProperty("aliases.lot") %> Type Management
Burial Site Type Management
</h1>
</div>
<div class="column has-text-right is-narrow">
<button class="button is-success" id="button--addLotType" type="button" accesskey="n">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add <%= configFunctions.getConfigProperty("aliases.lot") %> Type</span>
<span>Add Burial Site Type</span>
</button>
</div>
</div>

View File

@ -44,13 +44,13 @@
<li>
<a href="#tab--lotStatuses">
<span class="icon is-small"><i class="fas fa-table" aria-hidden="true"></i></span>
<span><%= configFunctions.getConfigProperty("aliases.lot") %> Statuses</span>
<span>Burial Site Statuses</span>
</a>
</li>
<li>
<a href="#tab--lotOccupantTypes">
<span class="icon is-small"><i class="fas fa-table" aria-hidden="true"></i></span>
<span><%= configFunctions.getConfigProperty("aliases.lot") %> <%= configFunctions.getConfigProperty("aliases.occupant") %> Types</span>
<span>Burial Site <%= configFunctions.getConfigProperty("aliases.occupant") %> Types</span>
</a>
</li>
</ul>
@ -117,11 +117,11 @@
</table>
</div>
<div class="is-hidden" id="tab--lotStatuses">
<h2 class="title is-4"><%= configFunctions.getConfigProperty("aliases.lot") %> Statuses</h2>
<h2 class="title is-4">Burial Site Statuses</h2>
<table class="table is-striped is-hoverable has-sticky-header">
<thead>
<tr>
<th><%= configFunctions.getConfigProperty("aliases.lot") %> Status</th>
<th>Burial Site Status</th>
<th class="has-text-centered has-width-1">Options</th>
</tr>
</thead>
@ -131,7 +131,7 @@
<form id="form--addLotStatus">
<div class="field has-addons">
<div class="control is-expanded">
<input class="input" name="lotStatus" type="text" maxlength="100" placeholder="New <%= configFunctions.getConfigProperty("aliases.lot") %> Status" required />
<input class="input" name="lotStatus" type="text" maxlength="100" placeholder="New Burial Site Status" required />
</div>
<div class="control">
<button class="button is-success has-tooltip-bottom" data-tooltip="Add Status" type="submit" aria-label="Add Status">
@ -147,11 +147,11 @@
</table>
</div>
<div class="is-hidden" id="tab--lotOccupantTypes">
<h2 class="title is-4"><%= configFunctions.getConfigProperty("aliases.lot") %> <%= configFunctions.getConfigProperty("aliases.occupant") %> Types</h2>
<h2 class="title is-4">Burial Site <%= configFunctions.getConfigProperty("aliases.occupant") %> Types</h2>
<table class="table is-striped is-hoverable has-sticky-header">
<thead>
<tr>
<th><%= configFunctions.getConfigProperty("aliases.lot") %> <%= configFunctions.getConfigProperty("aliases.occupant") %> Type</th>
<th>Burial Site <%= configFunctions.getConfigProperty("aliases.occupant") %> Type</th>
<th>
Icon Class
<a class="has-text-weight-normal has-tooltip-right" data-tooltip="View Available Icons" href="https://fontawesome.com/v5/search?o=r&m=free&s=solid" target="_blank" rel="noreferrer noopener" aria-label="Search and View Available Icons">
@ -174,7 +174,7 @@
<input name="occupantCommentTitle" type="hidden" value="Comment" />
<div class="field has-addons">
<div class="control is-expanded">
<input class="input" name="lotOccupantType" type="text" maxlength="100" placeholder="New <%= configFunctions.getConfigProperty("aliases.lot") %> <%= configFunctions.getConfigProperty("aliases.occupant") %> Type" required />
<input class="input" name="lotOccupantType" type="text" maxlength="100" placeholder="New Burial Site <%= configFunctions.getConfigProperty("aliases.occupant") %> Type" required />
</div>
<div class="control">
<button class="button is-success has-tooltip-bottom" data-tooltip="Add Type" type="submit" aria-label="Add Type">

View File

@ -4,24 +4,24 @@
<ul>
<li><a href="<%= urlPrefix %>/dashboard">Home</a></li>
<li>
<a href="<%= urlPrefix %>/lots">
<a href="<%= urlPrefix %>/burialSites">
<span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span>
<span><%= configFunctions.getConfigProperty("aliases.lots") %></span>
<span>Burial Sites</span>
</a>
</li>
<% if (!isCreate) { %>
<li>
<a href="<%= urlPrefix %>/lots/<%= lot.lotId %>" accesskey="v">
<%= lot.lotName %>
<a href="<%= urlPrefix %>/burialSites/<%= burialSite.burialSiteId %>" accesskey="v">
<%= burialSite.burialSiteName %>
</a>
</li>
<% } %>
<li class="is-active">
<a href="#" aria-current="page">
<% if (isCreate) { %>
Create a New <%= configFunctions.getConfigProperty("aliases.lot") %>
Create a New Burial Site
<% } else { %>
Update <%= configFunctions.getConfigProperty("aliases.lot") %>
Update Burial Site
<% } %>
</a>
</li>
@ -30,9 +30,9 @@
<h1 class="title is-1">
<% if (isCreate) { %>
Create a New <%= configFunctions.getConfigProperty("aliases.lot") %>
Create a New Burial Site
<% } else { %>
<%= lot.lotName %>
<%= burialSite.burialSiteName %>
<% } %>
</h1>
@ -40,14 +40,14 @@
<div class="level-left">
<% if (!isCreate) { %>
<span class="level-item has-text-weight-bold">
<%= lot.lotName %>
<%= burialSite.burialSiteName %>
</span>
<% } %>
</div>
<div class="level-right">
<% if (isCreate) { %>
<div class="level-item">
<a class="button is-danger is-inverted" href="<%= urlPrefix %>/lots">
<a class="button is-danger is-inverted" href="<%= urlPrefix %>/burialSites">
Cancel
</a>
</div>
@ -64,9 +64,9 @@
</div>
<div class="dropdown-menu">
<div class="dropdown-content">
<a class="dropdown-item" id="button--deleteLot" href="#">
<a class="dropdown-item" id="button--deleteBurialSite" href="#">
<span class="icon is-small"><i class="fas fa-trash has-text-danger" aria-hidden="true"></i></span>
<span>Delete <%= configFunctions.getConfigProperty("aliases.lot") %></span>
<span>Delete Burial Site</span>
</a>
</div>
</div>
@ -74,11 +74,11 @@
</div>
<% } %>
<div class="level-item">
<button class="button is-light is-primary" type="submit" form="form--lot">
<button class="button is-light is-primary" type="submit" form="form--burialSite">
<span class="icon is-small"><i class="fas fa-save" aria-hidden="true"></i></span>
<span>
<%= (isCreate ? "Create" : "Update") %>
<%= configFunctions.getConfigProperty("aliases.lot") %>
Burial Site
</span>
</button>
</div>
@ -86,38 +86,67 @@
</div>
<form class="mb-5" id="form--lot">
<input id="lot--lotId" name="lotId" type="hidden" value="<%= isCreate ? "" : lot.lotId %>" />
<form class="mb-5" id="form--burialSite">
<input id="burialSite--burialSiteId" name="burialSiteId" type="hidden" value="<%= isCreate ? "" : burialSite.burialSiteId %>" />
<div class="panel">
<div class="panel-block is-block">
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="lot--lotName">
<%= configFunctions.getConfigProperty("aliases.lot") %> Name
<%
const burialSiteNameSegments = configFunctions.getConfigProperty('settings.burialSites.burialSiteNameSegments')
%>
<label class="label" for="burialSite--burialSiteNameSegment1">
Burial Site Name
</label>
<div class="control">
<input class="input" id="lot--lotName" name="lotName" value="<%= lot.lotName %>"
<% if (configFunctions.getConfigProperty("settings.lot.lotNamePattern")) { %>
pattern="<%= configFunctions.getConfigProperty("settings.lot.lotNamePattern").source %>"
<% } %>
maxlength="100"
required
accesskey="f"
<%= (isCreate ? " autofocus" : "") %> />
</div>
<% if (configFunctions.getConfigProperty("settings.lot.lotNameHelpText")) { %>
<p class="help">
<%- configFunctions.getConfigProperty("settings.lot.lotNameHelpText").replace(/\n/g, "<br />") %>
<div class="field has-addons">
<% for (let segmentIndex = 1; segmentIndex <= 5; segmentIndex += 1) { %>
<%
const segmentIndexString = segmentIndex.toString();
const segment = burialSiteNameSegments.segments[segmentIndexString];
%>
<% if (segment?.isAvailable ?? false) { %>
<% if (segmentIndex !== 1 && (burialSiteNameSegments.separator ?? '') !== '') { %>
<p class="control">
<span class="button is-static">
<%= burialSiteNameSegments.separator %>
</span>
</p>
<% } %>
<% if ((segment.prefix ?? '') !== '') { %>
<p class="control">
<span class="button is-static">
<%= segment.prefix %>
</span>
</p>
<% } %>
<div class="control"
data-tooltip="<%= segment.label ?? '' %>">
<input class="input" id="burialSite--burialSiteNameSegment<%= segmentIndexString %>"
name="burialSiteNameSegment<%= segmentIndexString %>"
value="<%= burialSite[`burialSiteNameSegment${segmentIndex}`] %>"
type="text"
minlength="<%= Math.min(segment.minLength ?? 1, 20) %>"
maxlength="<%= Math.min(segment.maxLength ?? 20, 20) %>"
placeholder="<%= segment.label ?? '' %>"
aria-label="<%= segment.label ?? '' %>"
<%= (segment.isRequired ?? false) ? ' required' : '' %>
<%= segmentIndex === 1 ? ' accesskey="f"' : '' %>
<%= (isCreate && segmentIndex === 1 ? " autofocus" : "") %> />
</div>
<% if ((segment.suffix ?? '') !== '') { %>
<p class="control">
<span class="button is-static">
<%= segment.suffix %>
</span>
</p>
<% } %>
<% } %>
<% } %>
</div>
<div class="column">
<label class="label" for="lot--burialSiteTypeId">
<%= configFunctions.getConfigProperty("aliases.lot") %> Type
</label>
<label class="label" for="burialSite--cemeteryId">Cemetery</label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
@ -125,26 +154,26 @@
<% if (!isCreate) { %>
class="is-readonly"
<% } %>
id="lot--burialSiteTypeId" name="burialSiteTypeId" required>
<% if (isCreate) { %>
<option value="">(No Type)</option>
<% } %>
<% let typeIsFound = false; %>
<% for (const lotType of lotTypes) { %>
id="burialSite--cemeteryId" name="cemeteryId">
<option value="" <%= (!isCreate && burialSite.cemeteryId ? " disabled" : "") %>>
(No Cemetery Selected)
</option>
<% let cemeteryIsFound = false; %>
<% for (const cemetery of cemeteries) { %>
<%
if (lot.burialSiteTypeId === lotType.burialSiteTypeId) {
typeIsFound = true;
if (burialSite.cemeteryId === cemetery.cemeteryId) {
cemeteryIsFound = true;
}
%>
<option value="<%= lotType.burialSiteTypeId %>"
<%= (lot.burialSiteTypeId === lotType.burialSiteTypeId ? " selected" : "") %>
<%= (!isCreate && lot.burialSiteTypeId !== lotType.burialSiteTypeId ? " disabled" : "") %>>
<%= lotType.lotType %>
<option value="<%= cemetery.cemeteryId %>"
<%= (burialSite.cemeteryId === cemetery.cemeteryId ? " selected" : "") %>
<%= (!isCreate && burialSite.cemeteryId !== cemetery.cemeteryId ? " disabled" : "") %>>
<%= cemetery.cemeteryName || "(No Name)" %>
</option>
<% } %>
<% if (lot.burialSiteTypeId && !typeIsFound) { %>
<option value="<%= lot.burialSiteTypeId %>" selected>
<%= lot.lotType %>
<% if (burialSite.cemeteryId && !cemeteryIsFound) { %>
<option value="<%= burialSite.cemeteryId %>" selected>
<%= burialSite.cemeteryName %>
</option>
<% } %>
</select>
@ -156,29 +185,72 @@
</button>
</div>
</div>
<label class="label" for="lot--burialSiteStatusId">
<%= configFunctions.getConfigProperty("aliases.lot") %> Status
</div>
<div class="column">
<label class="label" for="burialSite--burialSiteTypeId">
Burial Site Type
</label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select
<% if (!isCreate) { %>
class="is-readonly"
<% } %>
id="burialSite--burialSiteTypeId" name="burialSiteTypeId" required>
<% if (isCreate) { %>
<option value="">(No Type)</option>
<% } %>
<% let typeIsFound = false; %>
<% for (const burialSiteType of burialSiteTypes) { %>
<%
if (burialSite.burialSiteTypeId === burialSiteType.burialSiteTypeId) {
typeIsFound = true;
}
%>
<option value="<%= burialSiteType.burialSiteTypeId %>"
<%= (burialSite.burialSiteTypeId === burialSiteType.burialSiteTypeId ? " selected" : "") %>
<%= (!isCreate && burialSite.burialSiteTypeId !== burialSiteType.burialSiteTypeId ? " disabled" : "") %>>
<%= burialSiteType.burialSiteType %>
</option>
<% } %>
<% if (burialSite.burialSiteTypeId && !typeIsFound) { %>
<option value="<%= burialSite.burialSiteTypeId %>" selected>
<%= burialSite.burialSiteType %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<label class="label" for="burialSite--burialSiteStatusId">
Burial Site Status
</label>
<div class="field">
<div class="control">
<div class="select is-fullwidth">
<select id="lot--burialSiteStatusId" name="burialSiteStatusId">
<select id="burialSite--burialSiteStatusId" name="burialSiteStatusId">
<option value="">(No Status)</option>
<% let statusIsFound = false; %>
<% for (const lotStatus of lotStatuses) { %>
<% for (const burialSiteStatus of burialSiteStatuses) { %>
<%
if (lot.burialSiteStatusId === lotStatus.burialSiteStatusId) {
if (burialSite.burialSiteStatusId === burialSiteStatus.burialSiteStatusId) {
statusIsFound = true;
}
%>
<option value="<%= lotStatus.burialSiteStatusId %>"
<%= (lot.burialSiteStatusId === lotStatus.burialSiteStatusId ? " selected" : "") %>>
<%= lotStatus.lotStatus %>
<option value="<%= burialSiteStatus.burialSiteStatusId %>"
<%= (burialSite.burialSiteStatusId === burialSiteStatus.burialSiteStatusId ? " selected" : "") %>>
<%= burialSiteStatus.burialSiteStatus %>
</option>
<% } %>
<% if (lot.burialSiteStatusId && !statusIsFound) { %>
<option value="<%= lot.burialSiteStatusId %>" selected>
<%= lot.lotStatus %>
<% if (burialSite.burialSiteStatusId && !statusIsFound) { %>
<option value="<%= burialSite.burialSiteStatusId %>" selected>
<%= burialSite.burialSiteStatus %>
</option>
<% } %>
</select>
@ -187,75 +259,75 @@
</div>
</div>
<div class="column">
<div id="container--lotFields">
<div id="container--burialSiteFields">
<% if (isCreate) { %>
<div class="message is-info">
<p class="message-body">
Select the <%= configFunctions.getConfigProperty("aliases.lot").toLowerCase() %> type to load the available fields.
Select the burial site type to load the available fields.
</p>
</div>
<% } else if (lot.lotFields.length === 0) { %>
<% } else if (burialSite.burialSiteFields.length === 0) { %>
<div class="message is-info">
<p class="message-body">
The current <%= configFunctions.getConfigProperty("aliases.lot").toLowerCase() %> type has no additional fields.
The current burial site type has no additional fields.
</p>
</div>
<% } else { %>
<% let lotTypeFieldIds = ""; %>
<% for (const lotField of lot.lotFields) { %>
<% lotTypeFieldIds += "," + lotField.lotTypeFieldId; %>
<% let burialSiteTypeFieldIds = ""; %>
<% for (const burialSiteField of burialSite.burialSiteFields) { %>
<% burialSiteTypeFieldIds += "," + burialSiteField.burialSiteTypeFieldId; %>
<div class="field">
<label class="label" for="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>">
<%= lotField.lotTypeField %>
<label class="label" for="burialSite--fieldValue_<%= burialSiteField.burialSiteTypeFieldId %>">
<%= burialSiteField.burialSiteTypeField %>
</label>
<div class="control">
<% if (lotField.fieldType === 'select' || (lotField.lotTypeFieldValues ?? '') !== "") { %>
<% if (burialSiteField.fieldType === 'select' || (burialSiteField.fieldValues ?? '') !== "") { %>
<%
const fieldValues = lotField.lotTypeFieldValues.split("\n");
const fieldValues = burialSiteField.fieldValues.split("\n");
let valueFound = false;
%>
<div class="select is-fullwidth">
<select id="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>"
name="lotFieldValue_<%= lotField.lotTypeFieldId %>">
<% if (!lotField.isRequired || lotField.lotFieldValue === "") { %>
<select id="burialSite--fieldValue_<%= burialSiteField.burialSiteTypeFieldId %>"
name="fieldValue_<%= burialSiteField.burialSiteTypeFieldId %>">
<% if (!burialSiteField.isRequired || burialSiteField.fieldValue === "") { %>
<option value="">(Not Set)</option>
<% } %>
<% for (const fieldValue of fieldValues) { %>
<%
if (fieldValue === lotField.lotFieldValue) {
if (fieldValue === burialSiteField.fieldValue) {
valueFound = true;
}
%>
<option value="<%= fieldValue %>"
<%= (fieldValue === lotField.lotFieldValue ? " selected" : "") %>>
<%= (fieldValue === burialSiteField.fieldValue ? " selected" : "") %>>
<%= fieldValue %>
</option>
<% } %>
<% if (!valueFound && lotField.lotFieldValue !== "") { %>
<option value="<%= lotField.lotFieldValue %>" selected>
<%= lotField.lotFieldValue %>
<% if (!valueFound && burialSiteField.fieldValue !== "") { %>
<option value="<%= burialSiteField.fieldValue %>" selected>
<%= burialSiteField.fieldValue %>
</option>
<% } %>
</select>
</div>
<% } else { %>
<input class="input"
id="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>"
name="lotFieldValue_<%= lotField.lotTypeFieldId %>"
type="<%= lotField.fieldType %>"
value="<%= lotField.lotFieldValue %>"
<% if (lotField.pattern !== "") { %>
pattern="<%= lotField.pattern %>"
id="burialSite--fieldValue_<%= burialSiteField.burialSiteTypeFieldId %>"
name="fieldValue_<%= burialSiteField.burialSiteTypeFieldId %>"
type="<%= burialSiteField.fieldType %>"
value="<%= burialSiteField.fieldValue %>"
<% if (burialSiteField.pattern !== "") { %>
pattern="<%= burialSiteField.pattern %>"
<% } %>
minlength="<%= lotField.minimumLength %>"
maxlength="<%= lotField.maximumLength %>"
<%= lotField.isRequired ? " required" : "" %> />
minlength="<%= burialSiteField.minLength %>"
maxlength="<%= burialSiteField.maxLength %>"
<%= burialSiteField.isRequired ? " required" : "" %> />
<% } %>
</div>
</div>
<% } %>
<input id="lot--lotTypeFieldIds" name="lotTypeFieldIds" type="hidden" value="<%= lotTypeFieldIds.slice(1) %>" />
<input id="burialSite--burialSiteTypeFieldIds" name="burialSiteTypeFieldIds" type="hidden" value="<%= burialSiteTypeFieldIds.slice(1) %>" />
<% } %>
</div>
</div>
@ -269,15 +341,15 @@
<h2 class="panel-heading">Geographic Location</h2>
<div class="panel-block is-block">
<div class="field">
<label class="label" for="lot--lotLatitude">Latitude</label>
<label class="label" for="burialSite--burialSiteLatitude">Latitude</label>
<div class="control">
<input class="input" id="lot--lotLatitude" name="lotLatitude" type="number" min="-90" max="90" step="0.00000001" value="<%= lot.lotLatitude %>" onwheel="return false" />
<input class="input" id="burialSite--burialSiteLatitude" name="burialSiteLatitude" type="number" min="-90" max="90" step="0.00000001" value="<%= burialSite.burialSiteLatitude %>" onwheel="return false" />
</div>
</div>
<div class="field">
<label class="label" for="lot--lotLongitude">Longitude</label>
<label class="label" for="burialSite--burialSiteLongitude">Longitude</label>
<div class="control">
<input class="input" id="lot--lotLongitude" name="lotLongitude" type="number" min="-180" max="180" step="0.00000001" value="<%= lot.lotLongitude %>" onwheel="return false" />
<input class="input" id="burialSite--burialSiteLongitude" name="burialSiteLongitude" type="number" min="-180" max="180" step="0.00000001" value="<%= burialSite.burialSiteLongitude %>" onwheel="return false" />
</div>
</div>
</div>
@ -287,52 +359,12 @@
<div class="panel">
<h2 class="panel-heading">Image</h2>
<div class="panel-block is-block">
<label class="label" for="lot--mapId"><%= configFunctions.getConfigProperty("aliases.map") %></label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select
<% if (!isCreate) { %>
class="is-readonly"
<% } %>
id="lot--mapId" name="mapId">
<option value="" <%= (!isCreate && lot.mapId ? " disabled" : "") %>>
(No <%= configFunctions.getConfigProperty("aliases.map") %> Selected)
</option>
<% let mapIsFound = false; %>
<% for (const map of maps) { %>
<%
if (lot.mapId === map.mapId) {
mapIsFound = true;
}
%>
<option value="<%= map.mapId %>"
<%= (lot.mapId === map.mapId ? " selected" : "") %>
<%= (!isCreate && lot.mapId !== map.mapId ? " disabled" : "") %>>
<%= map.mapName || "(No Name)" %>
</option>
<% } %>
<% if (lot.mapId && !mapIsFound) { %>
<option value="<%= lot.mapId %>" selected>
<%= lot.mapName %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="field">
<label class="label" for="lot--mapKey">
<%= configFunctions.getConfigProperty("aliases.map") %> SVG ID
<label class="label" for="burialSite--cemeterySvgId">
Cemetery SVG ID
</label>
<div class="control">
<input class="input" id="lot--mapKey" name="mapKey" value="<%= lot.mapKey %>" maxlength="100" pattern="^[\d\w-]*$" />
<input class="input" id="burialSite--cemeterySvgId" name="cemeterySvgId" value="<%= burialSite.cemeterySvgId %>" maxlength="100" pattern="^[\d\w-]*$" />
</div>
</div>
</div>
@ -360,7 +392,7 @@
</div>
<div class="level-right">
<div class="level-item">
<button class="button is-small is-success" id="lotComments--add" type="button">
<button class="button is-small is-success" id="burialSiteComments--add" type="button">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add a Comment</span>
</button>
@ -368,7 +400,7 @@
</div>
</div>
</div>
<div class="panel-block is-block" id="container--lotComments"></div>
<div class="panel-block is-block" id="container--burialSiteComments"></div>
</div>
<div class="panel">
@ -377,27 +409,26 @@
<div class="level-left">
<div class="level-item">
<h2 class="has-text-weight-bold is-size-5">
<%= configFunctions.getConfigProperty("aliases.occupancies") %>
<span class="tag"><%= lot.lotOccupancies.length %></span>
Contracts
<span class="tag"><%= burialSite.burialSiteContracts.length %></span>
</h2>
</div>
</div>
<div class="level-right">
<div class="level-item">
<a class="button is-success is-small has-text-weight-normal" href="<%= urlPrefix %>/lotOccupancies/new?lotId=<%= lot.lotId %>">
<a class="button is-success is-small has-text-weight-normal" href="<%= urlPrefix %>/contracts/new?burialSiteId=<%= burialSite.burialSiteId %>">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Create New <%= configFunctions.getConfigProperty("aliases.occupancy") %></span>
<span>Create New Contract</span>
</a>
</div>
</div>
</div>
</div>
<div class="panel-block is-block">
<% if (lot.lotOccupancies.length === 0) { %>
<% if (burialSite.burialSiteContracts.length === 0) { %>
<div class="message is-info">
<p class="message-body">
There are no <%= configFunctions.getConfigProperty("aliases.occupancy").toLowerCase() %> records
asscociated with this <%= configFunctions.getConfigProperty("aliases.lot") %>.
There are no contracts associated with this burial site.
</p>
</div>
<% } else { %>
@ -405,49 +436,46 @@
<thead>
<tr>
<th class="has-width-10">&nbsp;</th>
<th><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</th>
<th><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></th>
<th>Contract Type</th>
<th>Contract Date</th>
<th>End Date</th>
<th><%= configFunctions.getConfigProperty("aliases.occupants") %></th>
<th>Interments</th>
</tr>
</thead>
<tbody>
<% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %>
<% for (const lotOccupancy of lot.lotOccupancies) { %>
<% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %>
<% for (const burialSiteContract of burialSite.burialSiteContracts) { %>
<% const isActive = !(burialSiteContract.contractEndDate && burialSiteContract.contractEndDate < currentDate); %>
<tr>
<td class="has-text-centered">
<% if (isActive) { %>
<i class="fas fa-play" title="Current <%= configFunctions.getConfigProperty("aliases.occupancy") %>"></i>
<i class="fas fa-play" title="Current Contract"></i>
<% } else { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getConfigProperty("aliases.occupancy") %>"></i>
<i class="fas fa-stop" title="Previous Contract"></i>
<% } %>
</td>
<td>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/contracts/<%= burialSiteContract.burialSiteContractId %>">
<%= burialSiteContract.contractType %>
</a><br />
<span class="is-size-7">
#<%= lotOccupancy.lotOccupancyId %>
#<%= burialSiteContract.burialSiteContractId %>
</span>
</td>
<td><%= lotOccupancy.occupancyStartDateString %></td>
<td><%= burialSiteContract.contractStartDateString %></td>
<td>
<% if (lotOccupancy.occupancyEndDate) { %>
<%= lotOccupancy.occupancyEndDateString %>
<% if (burialSiteContract.contractEndDate) { %>
<%= burialSiteContract.contractEndDateString %>
<% } else { %>
<span class="has-text-grey">(No End Date)</span>
<% } %>
</td>
<td>
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
<span class="has-text-grey">(No <%= configFunctions.getConfigProperty("aliases.occupants") %>)</span>
<% if (burialSiteContract.burialSiteContractInterments.length === 0) { %>
<span class="has-text-grey">(No Interments)</span>
<% } else { %>
<% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %>
<span class="has-tooltip-left" data-tooltip="<%= occupant.lotOccupantType %>">
<i class="fas fa-fw fa-<%= occupant.fontAwesomeIconClass || 'user' %>" aria-hidden="true"></i>
<%= occupant.occupantName + ' ' + occupant.occupantFamilyName %>
</span><br />
<% for (const interment of burialSiteContract.burialSiteContractInterments) { %>
<%= interment.deceasedName %>
<% } %>
<% } %>
</td>
@ -464,9 +492,9 @@
<% if (!isCreate) { %>
<script>
exports.lotComments = <%- JSON.stringify(lot.lotComments) %>;
exports.burialSiteComments = <%- JSON.stringify(burialSite.burialSiteComments) %>;
</script>
<% } %>
<script src="<%= urlPrefix %>/javascripts/lotEdit.js"></script>
<script src="<%= urlPrefix %>/javascripts/burialSite.edit.js"></script>
<%- include('_footerB'); -%>

View File

@ -6,24 +6,24 @@
<li class="is-active">
<a href="#" aria-current="page">
<span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span>
<span><%= configFunctions.getConfigProperty("aliases.lots") %></span>
<span>Burial Sites</span>
</a>
</li>
</ul>
</nav>
<h1 class="title is-1">
Find a <%= configFunctions.getConfigProperty("aliases.lot") %>
Find a Burial Site
</h1>
<% if (user.userProperties.canUpdate) { %>
<div class="fixed-container is-fixed-bottom-right mx-4 my-4 has-text-right is-hidden-print">
<a class="button is-circle is-primary has-tooltip-left"
data-tooltip="Create a New <%= configFunctions.getConfigProperty("aliases.lot") %>"
href="<%= urlPrefix %>/lots/new"
data-tooltip="Create a New Burial Site"
href="<%= urlPrefix %>/burialSites/new"
accesskey="n">
<i class="fas fa-plus" aria-hidden="true"></i>
<span class="sr-only">Create a New <%= configFunctions.getConfigProperty("aliases.lot") %></span>
<span class="sr-only">Create a New Burial Site</span>
</a>
</div>
<% } %>
@ -34,11 +34,11 @@
<input id="searchFilter--offset" name="offset" type="hidden" value="0" />
<div class="columns">
<div class="column">
<label class="label" for="searchFilter--lotName"><%= configFunctions.getConfigProperty("aliases.lot") %></label>
<label class="label" for="searchFilter--burialSiteName">Burial Site</label>
<div class="field has-addons">
<div class="control has-icons-left">
<div class="select">
<select id="selectFilter--lotNameSearchType" name="lotNameSearchType" aria-label="<%= configFunctions.getConfigProperty("aliases.lot") %> Filter Type">
<select id="selectFilter--burialSiteNameSearchType" name="burialSiteNameSearchType" aria-label="Burial Site Filter Type">
<option value="">contains</option>
<option value="startsWith">starts with</option>
<option value="endsWith">ends with</option>
@ -49,20 +49,20 @@
</span>
</div>
<div class="control is-expanded">
<input class="input" id="searchFilter--lotName" name="lotName" />
<input class="input" id="searchFilter--burialSiteName" name="burialSiteName" />
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label" for="searchFilter--burialSiteTypeId"><%= configFunctions.getConfigProperty("aliases.lot") %> Type</label>
<label class="label" for="searchFilter--burialSiteTypeId">Burial Site Type</label>
<div class="control has-icons-left">
<div class="select is-fullwidth">
<select id="searchFilter--burialSiteTypeId" name="burialSiteTypeId">
<option value="">(All <%= configFunctions.getConfigProperty("aliases.lot") %> Types)</option>
<% for (const lotType of lotTypes) { %>
<option value="<%= lotType.burialSiteTypeId %>" <%= (lotType.burialSiteTypeId.toString() === burialSiteTypeId) ? " selected" : "" %>>
<%= lotType.lotType || "(No Name)" %>
<option value="">(All Burial Site Types)</option>
<% for (const burialSiteType of burialSiteTypes) { %>
<option value="<%= burialSiteType.burialSiteTypeId %>" <%= (burialSiteType.burialSiteTypeId.toString() === burialSiteTypeId) ? " selected" : "" %>>
<%= burialSiteType.burialSiteType || "(No Name)" %>
</option>
<% } %>
</select>
@ -77,14 +77,14 @@
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="searchFilter--mapId"><%= configFunctions.getConfigProperty("aliases.map") %></label>
<label class="label" for="searchFilter--cemeteryId">Cemetery</label>
<div class="control has-icons-left">
<div class="select is-fullwidth">
<select id="searchFilter--mapId" name="mapId">
<option value="">(All <%= configFunctions.getConfigProperty("aliases.maps") %>)</option>
<% for (const map of maps) { %>
<option value="<%= map.mapId %>" <%= (map.mapId.toString() === mapId) ? " selected" : "" %>>
<%= map.mapName || "(No Name)" %>
<select id="searchFilter--cemeteryId" name="cemeteryId">
<option value="">(All Cemeteries)</option>
<% for (const cemetery of cemeteries) { %>
<option value="<%= cemetery.cemeteryId %>" <%= (cemetery.cemeteryId.toString() === cemeteryId) ? " selected" : "" %>>
<%= cemetery.cemeteryName || "(No Name)" %>
</option>
<% } %>
</select>
@ -102,9 +102,9 @@
<div class="select is-fullwidth">
<select id="searchFilter--burialSiteStatusId" name="burialSiteStatusId">
<option value="">(All Statuses)</option>
<% for (const lotStatus of lotStatuses) { %>
<option value="<%= lotStatus.burialSiteStatusId %>" <%= (lotStatus.burialSiteStatusId.toString() === burialSiteStatusId) ? " selected" : "" %>>
<%= lotStatus.lotStatus %>
<% for (const burialSiteStatus of burialSiteStatuses) { %>
<option value="<%= burialSiteStatus.burialSiteStatusId %>" <%= (burialSiteStatus.burialSiteStatusId.toString() === burialSiteStatusId) ? " selected" : "" %>>
<%= burialSiteStatus.burialSiteStatus %>
</option>
<% } %>
</select>
@ -123,6 +123,6 @@
<%- include('_footerA'); -%>
<script src="<%= urlPrefix %>/javascripts/lotSearch.js"></script>
<script src="<%= urlPrefix %>/javascripts/burialSite.search.js"></script>
<%- include('_footerB'); -%>

View File

@ -4,43 +4,43 @@
<ul>
<li><a href="<%= urlPrefix %>/dashboard">Home</a></li>
<li>
<a href="<%= urlPrefix %>/lots">
<a href="<%= urlPrefix %>/burialSites">
<span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span>
<span><%= configFunctions.getConfigProperty("aliases.lots") %></span>
<span>Burial Sites</span>
</a>
</li>
<li class="is-active">
<a href="#" aria-current="page">
<%= lot.lotName %>
<%= burialSite.burialSiteName %>
</a>
</li>
</ul>
</nav>
<h1 class="title is-1">
<%= lot.lotName %>
<%= burialSite.burialSiteName %>
</h1>
<div class="level is-fixed-bottom is-mobile has-background-white has-shadow is-hidden-print">
<div class="level-left">
<span class="level-item has-text-weight-bold">
<%= lot.lotName %>
<%= burialSite.burialSiteName %>
</span>
</div>
<div class="level-right">
<div class="level-item">
<a class="button is-link is-outlined has-tooltip-left"
data-tooltip="Previous <%= configFunctions.getConfigProperty("aliases.lot") %>"
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/previous"
data-tooltip="Previous Burial Site"
href="<%= urlPrefix %>/burialSites/<%= burialSite.burialSiteId %>/previous"
accesskey=",">
<i class="fas fa-arrow-left" aria-hidden="true"></i>
<span class="sr-only">Previous <%= configFunctions.getConfigProperty("aliases.lot") %></span>
<span class="sr-only">Previous Burial Site</span>
</a>
</div>
<div class="level-item">
<a class="button is-link has-tooltip-left"
data-tooltip="Next <%= configFunctions.getConfigProperty("aliases.lot") %>"
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/next"
data-tooltip="Next Burial Site"
href="<%= urlPrefix %>/burialSites/<%= burialSite.burialSiteId %>/next"
accesskey=".">
<span>Next</span>
<span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>
@ -49,7 +49,7 @@
<% if (user.userProperties.canUpdate) { %>
<div class="level-item">
<a class="button is-primary"
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/edit"
href="<%= urlPrefix %>/burialSites/<%= burialSite.burialSiteId %>/edit"
accesskey="e">
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Switch to Edit Mode</span>
@ -66,27 +66,27 @@
<div class="columns">
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getConfigProperty("aliases.map") %></strong><br />
<a href="<%= urlPrefix %>/maps/<%= lot.mapId %>">
<%= lot.mapName || "(No Name)" %>
<strong>Cemetery</strong><br />
<a href="<%= urlPrefix %>/cemeteries/<%= burialSite.cemeteryId %>">
<%= burialSite.cemeteryName || "(No Name)" %>
</a>
</p>
<p class="mb-2">
<strong><%= configFunctions.getConfigProperty("aliases.lot") %> Type</strong><br />
<%= lot.lotType %>
<strong>Burial Site Type</strong><br />
<%= burialSite.burialSiteType %>
</p>
<p>
<strong>Status</strong><br />
<%= lot.lotStatus %>
<%= burialSite.burialSiteStatus %>
</p>
</div>
<% if (lot.lotFields.length > 0) { %>
<% if (burialSite.burialSiteFields.length > 0) { %>
<div class="column">
<% for (const lotField of lot.lotFields) { %>
<% for (const burialSiteField of burialSite.burialSiteFields) { %>
<p class="mb-2">
<strong><%= lotField.lotTypeField %></strong><br />
<% if (lotField.lotFieldValue) { %>
<%= lotField.lotFieldValue %>
<strong><%= burialSiteField.burialSiteTypeField %></strong><br />
<% if (burialSiteField.fieldValue) { %>
<%= burialSiteField.fieldValue %>
<% } else { %>
<span class="has-text-grey">(No Value)</span>
<% } %>
@ -98,14 +98,14 @@
</div>
</div>
</div>
<% if (lot.mapSVG) { %>
<% if (burialSite.cemeterySvg) { %>
<div class="column">
<div class="panel">
<h2 class="panel-heading">Image</h2>
<div class="panel-block is-block">
<% const imageURL = urlPrefix + "/images/maps/" + lot.mapSVG %>
<div class="image" id="lot--map" data-map-key="<%= lot.mapKey %>">
<%- include('../public/images/maps/' + lot.mapSVG); -%>
<% const imageURL = urlPrefix + "/images/cemeteries/" + burialSite.cemeterySvg %>
<div class="image" id="burialSite--cemeterySvg" data-map-key="<%= burialSite.cemeterySvgId %>">
<%- include('../public/images/cemeteries/' + burialSite.cemeterySvg); -%>
</div>
</div>
</div>
@ -114,7 +114,7 @@
</div>
<% if (lot.lotComments.length > 0) { %>
<% if (burialSite.burialSiteComments.length > 0) { %>
<div class="panel">
<h2 class="panel-heading">Comments</h2>
<div class="panel-block is-block">
@ -127,14 +127,14 @@
</tr>
</thead>
<tbody>
<% for (const lotComment of lot.lotComments) { %>
<% for (const burialSiteComment of burialSite.burialSiteComments) { %>
<tr>
<td><%= lotComment.recordCreate_userName %></td>
<td><%= burialSiteComment.recordCreate_userName %></td>
<td>
<%= lotComment.lotCommentDateString %>
<%= (lotComment.lotCommentTime === 0 ? "" : lotComment.lotCommentTimePeriodString) %>
<%= burialSiteComment.commentDateString %>
<%= (burialSiteComment.commentTime === 0 ? "" : burialSiteComment.commentTimePeriodString) %>
</td>
<td><%= lotComment.lotComment %></td>
<td><%= burialSiteComment.comment %></td>
</tr>
<% } %>
</tbody>
@ -145,15 +145,14 @@
<div class="panel">
<h2 class="panel-heading">
<%= configFunctions.getConfigProperty("aliases.occupancies") %>
<span class="tag"><%= lot.lotOccupancies.length %></span>
Contracts
<span class="tag"><%= burialSite.burialSiteContracts.length %></span>
</h2>
<div class="panel-block is-block">
<% if (lot.lotOccupancies.length === 0) { %>
<% if (burialSite.burialSiteContracts.length === 0) { %>
<div class="message is-info">
<p class="message-body">
There are no occupancy records asscociated with this
<%= configFunctions.getConfigProperty("aliases.lot") %>.
There are no contracts asscociated with this burial site.
</p>
</div>
<% } else { %>
@ -161,48 +160,45 @@
<thead>
<tr>
<th class="has-width-10">&nbsp;</th>
<th><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</th>
<th><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></th>
<th>Contract Type</th>
<th>Contract Date</th>
<th>End Date</th>
<th><%= configFunctions.getConfigProperty("aliases.occupants") %></th>
<th>Interments</th>
</tr>
</thead>
<tbody>
<% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %>
<% for (const lotOccupancy of lot.lotOccupancies) { %>
<% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %>
<% for (const burialSiteContract of burialSite.burialSiteContracts) { %>
<% const isActive = !(burialSiteContract.contractEndDate && burialSiteContract.contractEndDate < currentDate); %>
<tr>
<td class="has-text-centered">
<% if (isActive) { %>
<i class="fas fa-play" title="Current <%= configFunctions.getConfigProperty("aliases.occupancy") %>"></i>
<i class="fas fa-play" title="Current Contract"></i>
<% } else { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getConfigProperty("aliases.occupancy") %>"></i>
<i class="fas fa-stop" title="Previous Contract"></i>
<% } %>
</td>
<td>
<a class="has-text-weight-bold"
href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %>
href="<%= urlPrefix %>/contracts/<%= burialSiteContract.burialSiteContractId %>">
<%= burialSiteContract.contractType %>
</a><br />
<span class="is-size-7">#<%= lotOccupancy.lotOccupancyId %></span>
<span class="is-size-7">#<%= burialSiteContract.burialSiteContractId %></span>
</td>
<td><%= lotOccupancy.occupancyStartDateString %></td>
<td><%= burialSiteContract.contractStartDateString %></td>
<td>
<% if (lotOccupancy.occupancyEndDate) { %>
<%= lotOccupancy.occupancyEndDateString %>
<% if (burialSiteContract.contractEndDate) { %>
<%= burialSiteContract.contractEndDateString %>
<% } else { %>
<span class="has-text-grey">(No End Date)</span>
<% } %>
</td>
<td>
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
<span class="has-text-grey">(No <%= configFunctions.getConfigProperty("aliases.occupants") %>)</span>
<% if (burialSiteContract.burialSiteContractInterments.length === 0) { %>
<span class="has-text-grey">(No Interments)</span>
<% } else { %>
<% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %>
<span class="has-tooltip-left" data-tooltip="<%= occupant.lotOccupantType %>">
<i class="fas fa-fw fa-<%= occupant.fontAwesomeIconClass || 'user' %>" aria-hidden="true"></i>
<%= occupant.occupantName + ' ' + occupant.occupantFamilyName %>
</span><br />
<% for (const interment of burialSiteContract.burialSiteContractInterments) { %>
<%= interment.deceasedName %>
<% } %>
<% } %>
</td>
@ -216,6 +212,6 @@
<%- include('_footerA'); -%>
<script src="<%= urlPrefix %>/javascripts/lotView.js"></script>
<script src="<%= urlPrefix %>/javascripts/burialSite.view.js"></script>
<%- include('_footerB'); -%>

View File

@ -190,7 +190,7 @@
<input id="lotOccupancy--lotId" name="lotId" type="hidden" value="<%= lotOccupancy.lotId %>" />
<label class="label" for="lotOccupancy--lotName">
<%= configFunctions.getConfigProperty("aliases.lot") %>
Burial Site
</label>
<div class="field has-addons">
<div class="control is-expanded">
@ -199,17 +199,17 @@
<%= (isCreate ? "" : " disabled readonly") %> />
</div>
<div class="control is-hidden-print">
<button class="button is-clear-lot-button" data-tooltip="Clear" type="button" aria-label="Clear <%= configFunctions.getConfigProperty("aliases.lot") %></button> Field">
<button class="button is-clear-lot-button" data-tooltip="Clear" type="button" aria-label="Clear Burial Site</button> Field">
<i class="fas fa-eraser" aria-hidden="true"></i>
</button>
</div>
<div class="control is-hidden-print">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock <%= configFunctions.getConfigProperty("aliases.lot") %></button> Field">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Burial Site</button> Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
<div class="control is-hidden-print">
<button class="button is-lot-view-button" data-tooltip="Open <%= configFunctions.getConfigProperty("aliases.lot") %>" type="button" aria-label="Open <%= configFunctions.getConfigProperty("aliases.lot") %>">
<button class="button is-lot-view-button" data-tooltip="Open Burial Site" type="button" aria-label="Open Burial Site">
<i class="fas fa-external-link-alt" aria-hidden="true"></i>
</button>
</div>
@ -300,8 +300,8 @@
<% if (lotOccupancyField.pattern !== "") { %>
pattern="<%= lotOccupancyField.pattern %>"
<% } %>
minlength="<%= lotOccupancyField.minimumLength %>"
maxlength="<%= lotOccupancyField.maximumLength %>"
minlength="<%= lotOccupancyField.minLength %>"
maxlength="<%= lotOccupancyField.maxLength %>"
<%= lotOccupancyField.isRequired ? " required" : "" %> />
<% } %>
</div>

View File

@ -11,24 +11,24 @@
<i class="fas fa-user" data-fa-transform="shrink-10"></i>
</span>
</span>
<span><%= configFunctions.getConfigProperty("aliases.occupancies") %></span>
<span>Contracts</span>
</a>
</li>
</ul>
</nav>
<h1 class="title is-1">
Find an <%= configFunctions.getConfigProperty("aliases.occupancy") %> Record
Find a Contract
</h1>
<% if (user.userProperties.canUpdate) { %>
<div class="fixed-container is-fixed-bottom-right mx-4 my-4 has-text-right is-hidden-print">
<a class="button is-circle is-primary has-tooltip-left"
data-tooltip="Create a New <%= configFunctions.getConfigProperty("aliases.occupancy") %>"
href="<%= urlPrefix %>/lotOccupancies/new"
data-tooltip="Create a New Contract"
href="<%= urlPrefix %>/contracts/new"
accesskey="n">
<i class="fas fa-plus" aria-hidden="true"></i>
<span class="sr-only">Create a New <%= configFunctions.getConfigProperty("aliases.occupancy") %></span>
<span class="sr-only">Create a New Contract</span>
</a>
</div>
<% } %>
@ -40,9 +40,9 @@
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="searchFilter--occupantName"><%= configFunctions.getConfigProperty("aliases.occupant") %> Name</label>
<label class="label" for="searchFilter--deceasedName">Deceased Name</label>
<div class="control has-icons-left">
<input class="input" id="searchFilter--occupantName" name="occupantName" accesskey="f" />
<input class="input" id="searchFilter--deceasedName" name="deceasedName" accesskey="f" />
<span class="icon is-small is-left">
<i class="fas fa-search" aria-hidden="true"></i>
</span>
@ -51,13 +51,13 @@
</div>
<div class="column">
<div class="field">
<label class="label" for="searchFilter--occupancyTypeId"><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</label>
<label class="label" for="searchFilter--contractTypeId">Contract Type</label>
<div class="control has-icons-left">
<div class="select is-fullwidth">
<select id="searchFilter--occupancyTypeId" name="occupancyTypeId">
<option value="">(All <%= configFunctions.getConfigProperty("aliases.occupancy") %> Types)</option>
<% for (const occupancyType of occupancyTypes) { %>
<option value="<%= occupancyType.occupancyTypeId %>"><%= occupancyType.occupancyType %></option>
<select id="searchFilter--contractTypeId" name="contractTypeId">
<option value="">(All Contract Types)</option>
<% for (const contractType of contractTypes) { %>
<option value="<%= contractType.contractTypeId %>"><%= contractType.contractType %></option>
<% } %>
</select>
</div>
@ -69,10 +69,10 @@
</div>
<div class="column">
<div class="field">
<label class="label" for="searchFilter--occupancyTime"><%= configFunctions.getConfigProperty("aliases.occupancy") %> Time</label>
<label class="label" for="searchFilter--contractTime">Contract Time</label>
<div class="control has-icons-left">
<div class="select is-fullwidth">
<select id="searchFilter--occupancyTime" name="occupancyTime">
<select id="searchFilter--contractTime" name="contractTime">
<option value="">(All Times)</option>
<option value="current" selected>Current</option>
<option value="past">Past</option>
@ -89,14 +89,14 @@
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="searchFilter--mapId"><%= configFunctions.getConfigProperty("aliases.map") %></label>
<label class="label" for="searchFilter--cemeteryId">Cemetery</label>
<div class="control has-icons-left">
<div class="select is-fullwidth">
<select id="searchFilter--mapId" name="mapId">
<option value="">(All <%= configFunctions.getConfigProperty("aliases.maps") %>)</option>
<% for (const map of maps) { %>
<option value="<%= map.mapId %>" <%= (map.mapId.toString() === mapId) ? " selected" : "" %>>
<%= map.mapName || "(No Name)" %>
<select id="searchFilter--cemeteryId" name="cemeteryId">
<option value="">(All Cemeteries)</option>
<% for (const cemetery of cemeteries) { %>
<option value="<%= cemetery.cemeteryId %>" <%= (cemetery.cemeteryId.toString() === cemeteryId) ? " selected" : "" %>>
<%= cemetery.cemeteryName || "(No Name)" %>
</option>
<% } %>
</select>
@ -109,13 +109,13 @@
</div>
<div class="column">
<div class="field">
<label class="label" for="searchFilter--burialSiteTypeId"><%= configFunctions.getConfigProperty("aliases.lot") %> Type</label>
<label class="label" for="searchFilter--burialSiteTypeId">Burial Site Type</label>
<div class="control has-icons-left">
<div class="select is-fullwidth">
<select id="searchFilter--burialSiteTypeId" name="burialSiteTypeId">
<option value="">(All <%= configFunctions.getConfigProperty("aliases.lot") %> Types)</option>
<% for (const lotType of lotTypes) { %>
<option value="<%= lotType.burialSiteTypeId %>"><%= lotType.lotType %></option>
<option value="">(All Burial Site Types)</option>
<% for (const burialSiteType of burialSiteTypes) { %>
<option value="<%= burialSiteType.burialSiteTypeId %>"><%= burialSiteType.burialSiteType %></option>
<% } %>
</select>
</div>
@ -126,11 +126,11 @@
</div>
</div>
</div>
<label class="label" for="searchFilter--lotName"><%= configFunctions.getConfigProperty("aliases.lot") %></label>
<label class="label" for="searchFilter--burialSiteName">Burial Site</label>
<div class="field has-addons">
<div class="control has-icons-left">
<div class="select">
<select id="selectFilter--lotNameSearchType" name="lotNameSearchType" aria-label="<%= configFunctions.getConfigProperty("aliases.lot") %> Filter Type">
<select id="selectFilter--burialSiteNameSearchType" name="burialSiteNameSearchType" aria-label="Burial Site Filter Type">
<option value="">contains</option>
<option value="startsWith">starts with</option>
<option value="endsWith">ends with</option>
@ -141,7 +141,7 @@
</span>
</div>
<div class="control is-expanded">
<input class="input" id="searchFilter--lotName" name="lotName" />
<input class="input" id="searchFilter--burialSiteName" name="burialSiteName" />
</div>
</div>
</form>
@ -151,6 +151,6 @@
<%- include('_footerA'); -%>
<script src="<%= urlPrefix %>/javascripts/lotOccupancySearch.js"></script>
<script src="<%= urlPrefix %>/javascripts/burialSiteContract.search.js"></script>
<%- include('_footerB'); -%>

View File

@ -95,11 +95,11 @@
</div>
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getConfigProperty("aliases.lot") %></strong><br />
<strong>Burial Site</strong><br />
<% if (lotOccupancy.lotId) { %>
<a href="<%= urlPrefix %>/lots/<%= lotOccupancy.lotId %>"><%= lotOccupancy.lotName %></a>
<a href="<%= urlPrefix %>/burialSites/<%= lotOccupancy.lotId %>"><%= lotOccupancy.lotName %></a>
<% } else { %>
<span class="has-text-grey">(No <%= configFunctions.getConfigProperty("aliases.lot") %>)</span>
<span class="has-text-grey">(No Burial Site)</span>
<% } %>
</p>
<p>

View File

@ -4,7 +4,7 @@
<ul>
<li><a href="<%= urlPrefix %>/dashboard">Home</a></li>
<li>
<a href="<%= urlPrefix %>/maps">
<a href="<%= urlPrefix %>/cemeteries">
<span class="icon is-small"><i class="far fa-map" aria-hidden="true"></i></span>
<span>Cemeteries</span>
</a>
@ -19,6 +19,9 @@
<h1 class="title is-1">
<%= cemetery.cemeteryName || "(No Name)" %>
<% if (cemetery.cemeteryKey !== '') { %>
<span class="tag is-large"><%= cemetery.cemeteryKey %></span>
<% } %>
</h1>
@ -172,7 +175,7 @@
<% for (const burialSiteType of burialSiteTypeSummary) { %>
<tr>
<td>
<a class="has-text-weight-bold" href="<%= lotSearchUrl %>&burialSiteTypeId=<%= burialSiteType.burialSiteTypeId %>">
<a class="has-text-weight-bold" href="<%= burialSiteSearchUrl %>&burialSiteTypeId=<%= burialSiteType.burialSiteTypeId %>">
<%= burialSiteType.burialSiteType %>
</a>
</td>
@ -202,7 +205,7 @@
<% for (const burialSiteStatus of burialSiteStatusSummary) { %>
<tr>
<td>
<a class="has-text-weight-bold" href="<%= lotSearchUrl %>&burialSiteStatusId=<%= burialSiteStatus.burialSiteStatusId %>">
<a class="has-text-weight-bold" href="<%= burialSiteSearchUrl %>&burialSiteStatusId=<%= burialSiteStatus.burialSiteStatusId %>">
<%= burialSiteStatus.burialSiteStatus %>
</a>
</td>
@ -210,7 +213,7 @@
<%= burialSiteStatus.burialSiteCount %>
</td>
<td class="has-text-right">
<%= ((burialSiteStatus.burialSiteCount / map.burialSiteCount) * 100).toFixed(1) %>%
<%= ((burialSiteStatus.burialSiteCount / cemetery.burialSiteCount) * 100).toFixed(1) %>%
</td>
</tr>
<% } %>

View File

@ -219,7 +219,7 @@
<td><%= lotOccupancy.mapName ?? '(No ' + configFunctions.getConfigProperty("aliases.map") + ')' %></td>
</tr>
<tr>
<td><%= configFunctions.getConfigProperty("aliases.lot") %></td>
<td>Burial Site</td>
<td><%= lotOccupancy.lotName ?? '(No ' + configFunctions.getConfigProperty("aliases.lot") + ')' %></td>
</tr>
<%

View File

@ -9,14 +9,14 @@
<%- include('_workOrder-header.ejs'); %>
<% if (workOrder.workOrderLots.length > 0) { %>
<h2 class="mb-0"><%= configFunctions.getConfigProperty("aliases.lots") %></h2>
<h2 class="mb-0">Burial Sites</h2>
<table class="data-table">
<thead>
<tr>
<th><%= configFunctions.getConfigProperty("aliases.lot") %></th>
<th>Burial Site</th>
<th><%= configFunctions.getConfigProperty("aliases.map") %></th>
<th><%= configFunctions.getConfigProperty("aliases.lot") %> Type</th>
<th>Burial Site Type</th>
<th>Status</th>
</tr>
</thead>
@ -40,7 +40,7 @@
<thead>
<tr>
<th><%= configFunctions.getConfigProperty("aliases.occupancy") %> Type</th>
<th><%= configFunctions.getConfigProperty("aliases.lot") %></th>
<th>Burial Site</th>
<th><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></th>
<th>End Date</th>
<th><%= configFunctions.getConfigProperty("aliases.occupants") %></th>

View File

@ -1,7 +1,7 @@
<%- include('_header-print'); -%>
<h1 class="title is-2 has-text-centered">
<%= configFunctions.getConfigProperty("aliases.lot") %>
Burial Site
<%= configFunctions.getConfigProperty("aliases.occupancy") %>
</h1>
@ -14,11 +14,11 @@
</div>
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getConfigProperty("aliases.lot") %></strong><br />
<strong>Burial Site</strong><br />
<% if (lotOccupancy.lotId) { %>
<%= lotOccupancy.lotName %>
<% } else { %>
(No <%= configFunctions.getConfigProperty("aliases.lot") %>)
(No Burial Site)
<% } %>
</p>
<p>

View File

@ -25,9 +25,9 @@
</a>
</li>
<li>
<a href="#tab--lots" aria-label="<%= configFunctions.getConfigProperty("aliases.lots") %>">
<a href="#tab--lots" aria-label="Burial Sites">
<span class="icon"><i class="fas fa-fw fa-vector-square" aria-hidden="true"></i></span>
<span class="is-hidden-touch"><%= configFunctions.getConfigProperty("aliases.lots") %></span>
<span class="is-hidden-touch">Burial Sites</span>
</a>
</li>
<li>
@ -182,7 +182,7 @@
</div>
</div>
<div class="is-hidden" id="tab--lots">
<h1 class="title is-1"><%= configFunctions.getConfigProperty("aliases.lot") %> Reports</h1>
<h1 class="title is-1">Burial Site Reports</h1>
<div class="panel">
<form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/lots-byMapId">
@ -194,7 +194,7 @@
</div>
<div>
<h2 class="title is-5 is-marginless">
<%= configFunctions.getConfigProperty("aliases.lots") %> By <%= configFunctions.getConfigProperty("aliases.map") %>
Burial Sites By <%= configFunctions.getConfigProperty("aliases.map") %>
</h2>
<div class="field has-addons mt-2">
<div class="control">
@ -229,11 +229,11 @@
<span class="tag is-info">CSV</span>
</div>
<div>
<h2 class="title is-5 is-marginless"><%= configFunctions.getConfigProperty("aliases.lots") %> By Type</h2>
<h2 class="title is-5 is-marginless">Burial Sites By Type</h2>
<div class="field has-addons mt-2">
<div class="control">
<label class="button is-small is-static" for="lots-byburialSiteTypeId--burialSiteTypeId">
<%= configFunctions.getConfigProperty("aliases.lot") %> Type
Burial Site Type
</label>
</div>
<div class="control is-expanded">
@ -263,11 +263,11 @@
<span class="tag is-info">CSV</span>
</div>
<div>
<h2 class="title is-5 is-marginless"><%= configFunctions.getConfigProperty("aliases.lots") %> By Status</h2>
<h2 class="title is-5 is-marginless">Burial Sites By Status</h2>
<div class="field has-addons mt-2">
<div class="control">
<label class="button is-small is-static" for="lots-byburialSiteStatusId--burialSiteStatusId">
<%= configFunctions.getConfigProperty("aliases.lot") %> Status
Burial Site Status
</label>
</div>
<div class="control is-expanded">
@ -440,7 +440,7 @@
</a>
</div>
<div class="panel">
<h2 class="panel-heading">Lot (<%= configFunctions.getConfigProperty("aliases.lot") %>) Tables</h2>
<h2 class="panel-heading">Lot (Burial Site) Tables</h2>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/maps-all" download>
<div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info">
@ -525,7 +525,7 @@
</a>
</div>
<div class="panel">
<h2 class="panel-heading">Lot (<%= configFunctions.getConfigProperty("aliases.lot") %>) Tables</h2>
<h2 class="panel-heading">Lot (Burial Site) Tables</h2>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/lotTypes-all" download>
<div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info">

Some files were not shown because too many files have changed in this diff Show More