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

View File

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

View File

@ -9,11 +9,11 @@ describe('Update - Lots', () => {
it('Has a "Create" link on the Lot Search', () => { it('Has a "Create" link on the Lot Search', () => {
cy.visit('/lots'); cy.visit('/lots');
cy.location('pathname').should('equal', '/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', () => { describe('Update a New Lot', () => {
it('Has no detectable accessibility issues', () => { it('Has no detectable accessibility issues', () => {
cy.visit('/lots/new'); cy.visit('/burialSites/new');
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
}); });

View File

@ -12,12 +12,12 @@ describe('Update - Lots', () => {
it('Has a "Create" link on the Lot Search', () => { it('Has a "Create" link on the Lot Search', () => {
cy.visit('/lots') cy.visit('/lots')
cy.location('pathname').should('equal', '/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', () => { describe('Update a New Lot', () => {
it('Has no detectable accessibility issues', () => { it('Has no detectable accessibility issues', () => {
cy.visit('/lots/new') cy.visit('/burialSites/new')
cy.injectAxe() cy.injectAxe()
cy.checkA11y() cy.checkA11y()
}) })

View File

@ -16,16 +16,16 @@ describe('Read Only User', () => {
cy.log('Has no links to admin areas'); cy.log('Has no links to admin areas');
cy.get("a[href*='/admin']").should('not.exist'); cy.get("a[href*='/admin']").should('not.exist');
}); });
it('Has no link to create maps on Map Search', () => { it('Has no link to create cemeteries on Cemetery Search', () => {
cy.visit('/maps'); cy.visit('/cemeteries');
cy.get("a[href*='/new']").should('not.exist'); cy.get("a[href*='/new']").should('not.exist');
}); });
it('Has no link to create lots on Lot Search', () => { it('Has no link to create burial sites on Burial Site Search', () => {
cy.visit('/lots'); cy.visit('/burialSites');
cy.get("a[href*='/new']").should('not.exist'); cy.get("a[href*='/new']").should('not.exist');
}); });
it('Has no link to create occupancies on Occupancy Search', () => { it('Has no link to create contracts on Contract Search', () => {
cy.visit('/lotOccupancies'); cy.visit('/contracts');
cy.get("a[href*='/new']").should('not.exist'); cy.get("a[href*='/new']").should('not.exist');
}); });
it('Has no link to create work orders on Work Order Search', () => { 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') cy.get("a[href*='/admin']").should('not.exist')
}) })
it('Has no link to create maps on Map Search', () => { it('Has no link to create cemeteries on Cemetery Search', () => {
cy.visit('/maps') cy.visit('/cemeteries')
cy.get("a[href*='/new']").should('not.exist') cy.get("a[href*='/new']").should('not.exist')
}) })
it('Has no link to create lots on Lot Search', () => { it('Has no link to create burial sites on Burial Site Search', () => {
cy.visit('/lots') cy.visit('/burialSites')
cy.get("a[href*='/new']").should('not.exist') cy.get("a[href*='/new']").should('not.exist')
}) })
it('Has no link to create occupancies on Occupancy Search', () => { it('Has no link to create contracts on Contract Search', () => {
cy.visit('/lotOccupancies') cy.visit('/contracts')
cy.get("a[href*='/new']").should('not.exist') 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.aliases.externalReceiptNumber = 'GP Receipt Number';
config.settings.burialSites.burialSiteNameSegments = { config.settings.burialSites.burialSiteNameSegments = {
separator: '-', separator: '-',
includeCemeteryKey: true,
segments: { segments: {
1: { 1: {
isRequired: true, isRequired: false,
isAvailable: true, isAvailable: true,
label: 'Block', label: 'Block',
minLength: 1, minLength: 1,
maxLength: 3 maxLength: 1
}, },
2: { 2: {
isRequired: true, isRequired: true,
@ -23,7 +24,7 @@ config.settings.burialSites.burialSiteNameSegments = {
isAvailable: true, isAvailable: true,
label: 'Lot', label: 'Lot',
minLength: 1, minLength: 1,
maxLength: 3 maxLength: 4
}, },
4: { 4: {
isRequired: true, isRequired: true,

View File

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

View File

@ -1,10 +1,12 @@
import { buildBurialSiteName } from '../helpers/burialSites.helpers.js'; import { buildBurialSiteName } from '../helpers/burialSites.helpers.js';
import addOrUpdateBurialSiteField from './addOrUpdateBurialSiteField.js'; import addOrUpdateBurialSiteField from './addOrUpdateBurialSiteField.js';
import getCemetery from './getCemetery.js';
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
export default async function addBurialSite(burialSiteForm, user) { export default async function addBurialSite(burialSiteForm, user) {
const database = await acquireConnection(); const database = await acquireConnection();
const rightNowMillis = Date.now(); 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 const result = database
.prepare(`insert into BurialSites ( .prepare(`insert into BurialSites (
burialSiteNameSegment1, burialSiteNameSegment1,

View File

@ -1,6 +1,7 @@
import { buildBurialSiteName } from '../helpers/burialSites.helpers.js' import { buildBurialSiteName } from '../helpers/burialSites.helpers.js'
import addOrUpdateBurialSiteField from './addOrUpdateBurialSiteField.js' import addOrUpdateBurialSiteField from './addOrUpdateBurialSiteField.js'
import getCemetery from './getCemetery.js'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export interface AddBurialSiteForm { export interface AddBurialSiteForm {
@ -31,7 +32,11 @@ export default async function addBurialSite(
const rightNowMillis = Date.now() 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 const result = database
.prepare( .prepare(

View File

@ -5,8 +5,8 @@ export interface AddBurialSiteTypeFieldForm {
fieldValues?: string; fieldValues?: string;
isRequired?: string; isRequired?: string;
pattern?: string; pattern?: string;
minimumLength?: string | number; minLength?: string | number;
maximumLength?: string | number; maxLength?: string | number;
orderNumber?: number; orderNumber?: number;
} }
export default function addBurialSiteTypeField(addForm: AddBurialSiteTypeFieldForm, user: User): Promise<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, burialSiteTypeId, burialSiteTypeField,
fieldType, fieldValues, fieldType, fieldValues,
isRequired, pattern, isRequired, pattern,
minimumLength, maximumLength, minLength, maxLength,
orderNumber, orderNumber,
recordCreate_userName, recordCreate_timeMillis, recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis) recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) 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(); database.release();
clearCacheByTableName('BurialSiteTypeFields'); clearCacheByTableName('BurialSiteTypeFields');
return result.lastInsertRowid; return result.lastInsertRowid;

View File

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

View File

@ -5,8 +5,8 @@ export interface AddContractTypeFieldForm {
fieldType?: string; fieldType?: string;
isRequired?: string; isRequired?: string;
pattern?: string; pattern?: string;
minimumLength?: string | number; minLength?: string | number;
maximumLength?: string | number; maxLength?: string | number;
orderNumber?: number; orderNumber?: number;
} }
export default function addContractTypeField(addForm: AddContractTypeFieldForm, user: User): Promise<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 ( .prepare(`insert into ContractTypeFields (
contractTypeId, contractTypeField, fieldType, contractTypeId, contractTypeField, fieldType,
fieldValues, isRequired, pattern, fieldValues, isRequired, pattern,
minimumLength, maximumLength, minLength, maxLength,
orderNumber, orderNumber,
recordCreate_userName, recordCreate_timeMillis, recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis) recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) 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(); database.release();
clearCacheByTableName('ContractTypeFields'); clearCacheByTableName('ContractTypeFields');
return result.lastInsertRowid; return result.lastInsertRowid;

View File

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

View File

@ -13,7 +13,7 @@ const baseSQL = `select l.burialSiteId,
l.burialSiteStatusId, s.burialSiteStatus, l.burialSiteStatusId, s.burialSiteStatus,
l.cemeteryId, m.cemeteryName, l.cemeteryId, m.cemeteryName,
m.cemeterySvg, l.cemeterySvgId, m.cemeterySvg, l.cemeterySvgId,
l.burialSiteLatitude, l.burialSiteLongitude, l.burialSiteLatitude, l.burialSiteLongitude
from BurialSites l from BurialSites l
left join BurialSiteTypes t on l.burialSiteTypeId = t.burialSiteTypeId 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.burialSiteStatusId, s.burialSiteStatus,
l.cemeteryId, m.cemeteryName, l.cemeteryId, m.cemeteryName,
m.cemeterySvg, l.cemeterySvgId, m.cemeterySvg, l.cemeterySvgId,
l.burialSiteLatitude, l.burialSiteLongitude, l.burialSiteLatitude, l.burialSiteLongitude
from BurialSites l from BurialSites l
left join BurialSiteTypes t on l.burialSiteTypeId = t.burialSiteTypeId 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 const fields = database
.prepare(`select o.burialSiteContractId, o.contractTypeFieldId, .prepare(`select o.burialSiteContractId, o.contractTypeFieldId,
o.fieldValue, f.contractTypeField, f.fieldType, f.fieldValues, 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 f.orderNumber, t.orderNumber as contractTypeOrderNumber
from BurialSiteContractFields o from BurialSiteContractFields o
left join ContractTypeFields f on o.contractTypeFieldId = f.contractTypeFieldId 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, select ? as burialSiteContractId, f.contractTypeFieldId,
'' as fieldValue, f.contractTypeField, f.fieldType, f.fieldValues, '' 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 f.orderNumber, t.orderNumber as contractTypeOrderNumber
from ContractTypeFields f from ContractTypeFields f
left join ContractTypes t on f.contractTypeId = t.contractTypeId left join ContractTypes t on f.contractTypeId = t.contractTypeId

View File

@ -14,7 +14,7 @@ export default async function getBurialSiteContractField(
.prepare( .prepare(
`select o.burialSiteContractId, o.contractTypeFieldId, `select o.burialSiteContractId, o.contractTypeFieldId,
o.fieldValue, f.contractTypeField, f.fieldType, f.fieldValues, 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 f.orderNumber, t.orderNumber as contractTypeOrderNumber
from BurialSiteContractFields o from BurialSiteContractFields o
left join ContractTypeFields f on o.contractTypeFieldId = f.contractTypeFieldId left join ContractTypeFields f on o.contractTypeFieldId = f.contractTypeFieldId
@ -26,7 +26,7 @@ export default async function getBurialSiteContractField(
select ? as burialSiteContractId, f.contractTypeFieldId, select ? as burialSiteContractId, f.contractTypeFieldId,
'' as fieldValue, f.contractTypeField, f.fieldType, f.fieldValues, '' 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 f.orderNumber, t.orderNumber as contractTypeOrderNumber
from ContractTypeFields f from ContractTypeFields f
left join ContractTypes t on f.contractTypeId = t.contractTypeId 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'; let sqlWhereClause = ' where o.recordDelete_timeMillis is null';
const sqlParameters = []; const sqlParameters = [];
if ((filters.burialSiteId ?? '') !== '') { if ((filters.burialSiteId ?? '') !== '') {
sqlWhereClause += ' and o.lotId = ?'; sqlWhereClause += ' and o.burialSiteId = ?';
sqlParameters.push(filters.burialSiteId); sqlParameters.push(filters.burialSiteId);
} }
const lotNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, filters.burialSiteNameSearchType ?? '', 'l'); const lotNameFilters = getBurialSiteNameWhereClause(filters.burialSiteName, filters.burialSiteNameSearchType ?? '', 'l');

View File

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

View File

@ -5,7 +5,7 @@ export default async function getBurialSiteFields(burialSiteId, connectedDatabas
.prepare(`select l.burialSiteId, l.burialSiteTypeFieldId, .prepare(`select l.burialSiteId, l.burialSiteTypeFieldId,
l.fieldValue, l.fieldValue,
f.burialSiteTypeField, f.fieldType, f.fieldValues, 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 f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber
from BurialSiteFields l from BurialSiteFields l
left join BurialSiteTypeFields f on l.burialSiteTypeFieldId = f.burialSiteTypeFieldId 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, select ? as burialSiteId, f.burialSiteTypeFieldId,
'' as fieldValue, '' as fieldValue,
f.burialSiteTypeField, f.fieldType, f.fieldValues, 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 f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber
from BurialSiteTypeFields f from BurialSiteTypeFields f
left join BurialSiteTypes t on f.burialSiteTypeId = t.burialSiteTypeId 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, `select l.burialSiteId, l.burialSiteTypeFieldId,
l.fieldValue, l.fieldValue,
f.burialSiteTypeField, f.fieldType, f.fieldValues, 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 f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber
from BurialSiteFields l from BurialSiteFields l
left join BurialSiteTypeFields f on l.burialSiteTypeFieldId = f.burialSiteTypeFieldId left join BurialSiteTypeFields f on l.burialSiteTypeFieldId = f.burialSiteTypeFieldId
@ -28,7 +28,7 @@ export default async function getBurialSiteFields(
select ? as burialSiteId, f.burialSiteTypeFieldId, select ? as burialSiteId, f.burialSiteTypeFieldId,
'' as fieldValue, '' as fieldValue,
f.burialSiteTypeField, f.fieldType, f.fieldValues, 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 f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber
from BurialSiteTypeFields f from BurialSiteTypeFields f
left join BurialSiteTypes t on f.burialSiteTypeId = t.burialSiteTypeId 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 const typeFields = database
.prepare(`select burialSiteTypeFieldId, .prepare(`select burialSiteTypeFieldId,
burialSiteTypeField, fieldType, fieldValues, burialSiteTypeField, fieldType, fieldValues,
isRequired, pattern, minimumLength, maximumLength, orderNumber isRequired, pattern, minLength, maxLength, orderNumber
from BurialSiteTypeFields from BurialSiteTypeFields
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
and burialSiteTypeId = ? and burialSiteTypeId = ?

View File

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

View File

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

View File

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

View File

@ -1,2 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { Cemetery } from '../types/recordTypes.js'; 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'; import { acquireConnection } from './pool.js';
export default async function getCemetery(cemeteryId) { export default async function getCemetery(cemeteryId, connectedDatabase) {
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, .prepare(`select m.cemeteryId, m.cemeteryName, m.cemeteryKey, m.cemeteryDescription,
m.cemeteryLatitude, m.cemeteryLongitude, m.cemeterySvg, m.cemeteryLatitude, m.cemeteryLongitude, m.cemeterySvg,
m.cemeteryAddress1, m.cemeteryAddress2, m.cemeteryCity, m.cemeteryProvince, m.cemeteryPostalCode, 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.recordUpdate_userName, m.recordUpdate_timeMillis,
m.recordDelete_userName, m.recordDelete_timeMillis`) m.recordDelete_userName, m.recordDelete_timeMillis`)
.get(cemeteryId); .get(cemeteryId);
if (connectedDatabase === undefined) {
database.release(); 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 type { Cemetery } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export default async function getCemetery( export default async function getCemetery(
cemeteryId: number | string cemeteryId: number | string,
connectedDatabase?: PoolConnection
): Promise<Cemetery | undefined> { ): Promise<Cemetery | undefined> {
const database = await acquireConnection() const database = connectedDatabase ?? (await acquireConnection())
const map = database const cemetery = database
.prepare( .prepare(
`select m.cemeteryId, m.cemeteryName, m.cemeteryKey, m.cemeteryDescription, `select m.cemeteryId, m.cemeteryName, m.cemeteryKey, m.cemeteryDescription,
m.cemeteryLatitude, m.cemeteryLongitude, m.cemeterySvg, m.cemeteryLatitude, m.cemeteryLongitude, m.cemeterySvg,
@ -31,7 +34,9 @@ export default async function getCemetery(
) )
.get(cemeteryId) as Cemetery | undefined .get(cemeteryId) as Cemetery | undefined
if (connectedDatabase === undefined) {
database.release() database.release()
}
return map return cemetery
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,15 +7,15 @@ export default async function updateBurialSiteTypeField(updateForm, user) {
set burialSiteTypeField = ?, set burialSiteTypeField = ?,
isRequired = ?, isRequired = ?,
fieldType = ?, fieldType = ?,
minimumLength = ?, minLength = ?,
maximumLength = ?, maxLength = ?,
pattern = ?, pattern = ?,
fieldValues = ?, fieldValues = ?,
recordUpdate_userName = ?, recordUpdate_userName = ?,
recordUpdate_timeMillis = ? recordUpdate_timeMillis = ?
where burialSiteTypeFieldId = ? where burialSiteTypeFieldId = ?
and recordDelete_timeMillis is null`) 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(); database.release();
clearCacheByTableName('BurialSiteTypeFields'); clearCacheByTableName('BurialSiteTypeFields');
return result.changes > 0; return result.changes > 0;

View File

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

View File

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

View File

@ -7,15 +7,15 @@ export default async function updateContractTypeField(updateForm, user) {
set contractTypeField = ?, set contractTypeField = ?,
isRequired = ?, isRequired = ?,
fieldType = ?, fieldType = ?,
minimumLength = ?, minLength = ?,
maximumLength = ?, maxLength = ?,
pattern = ?, pattern = ?,
fieldValues = ?, fieldValues = ?,
recordUpdate_userName = ?, recordUpdate_userName = ?,
recordUpdate_timeMillis = ? recordUpdate_timeMillis = ?
where contractTypeFieldId = ? where contractTypeFieldId = ?
and recordDelete_timeMillis is null`) 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(); database.release();
clearCacheByTableName('ContractTypeFields'); clearCacheByTableName('ContractTypeFields');
return result.changes > 0; return result.changes > 0;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
import type { BurialSiteContract, BurialSiteContractFee } from '../types/recordTypes.js'; 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 getFeesByFeeCategory(burialSiteContract: BurialSiteContract, feeCategory: string, feeCategoryContains?: boolean): BurialSiteContractFee[];
export declare function getTransactionTotal(burialSiteContract: BurialSiteContract): number; export declare function getTransactionTotal(burialSiteContract: BurialSiteContract): number;

View File

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

View File

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

View File

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

View File

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

View File

@ -138,7 +138,7 @@ const segmentConfig = getConfigProperty(
'settings.burialSites.burialSiteNameSegments' 'settings.burialSites.burialSiteNameSegments'
) )
export function buildBurialSiteName(segments: { export function buildBurialSiteName(cemeteryKey: string | undefined, segments: {
burialSiteNameSegment1?: string burialSiteNameSegment1?: string
burialSiteNameSegment2?: string burialSiteNameSegment2?: string
burialSiteNameSegment3?: string burialSiteNameSegment3?: string
@ -147,6 +147,10 @@ export function buildBurialSiteName(segments: {
}): string { }): string {
const segmentPieces: string[] = [] const segmentPieces: string[] = []
if (segmentConfig.includeCemeteryKey && cemeteryKey !== undefined) {
segmentPieces.push(cemeteryKey)
}
// eslint-disable-next-line @typescript-eslint/no-magic-numbers // eslint-disable-next-line @typescript-eslint/no-magic-numbers
for (let segmentIndex = 1; segmentIndex <= 5; segmentIndex++) { for (let segmentIndex = 1; segmentIndex <= 5; segmentIndex++) {
const segmentIndexString = segmentIndex.toString() 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 getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneTypeString: string): Promise<WorkOrderMilestoneType | undefined>;
export declare function preloadCaches(): Promise<void>; export declare function preloadCaches(): Promise<void>;
export declare function clearCaches(): void; export declare function clearCaches(): void;
type CacheTableNames = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'ContractTypes' | 'ContractTypeFields' | 'ContractTypePrints' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes' | 'FeeCategories'; type CacheTableNames = 'BurialSiteStatuses' | 'BurialSiteTypes' | 'BurialSiteTypeFields' | 'ContractTypes' | 'ContractTypeFields' | 'ContractTypePrints' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes' | 'FeeCategories' | 'Fees';
export declare function clearCacheByTableName(tableName: CacheTableNames, relayMessage?: boolean): void; export declare function clearCacheByTableName(tableName: CacheTableNames, relayMessage?: boolean): void;
export {}; export {};

View File

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

18
package-lock.json generated
View File

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

View File

@ -103,13 +103,13 @@
"bulma-steps": "^2.2.1", "bulma-steps": "^2.2.1",
"bulma-switch": "^2.0.4", "bulma-switch": "^2.0.4",
"bulma-tooltip": "^3.0.2", "bulma-tooltip": "^3.0.2",
"cypress": "^14.0.3", "cypress": "^14.1.0",
"cypress-axe": "^1.6.0", "cypress-axe": "^1.6.0",
"eslint-config-cityssm": "^20.0.0", "eslint-config-cityssm": "^20.0.0",
"gulp": "^5.0.0", "gulp": "^5.0.0",
"gulp-sass": "^6.0.0", "gulp-sass": "^6.0.0",
"nodemon": "^3.1.9", "nodemon": "^3.1.9",
"prettier-config-cityssm": "^1.0.0", "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="columns">
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label class="label" for="lotTypeFieldEdit--minimumLength" <label class="label" for="lotTypeFieldEdit--minLength"
>Minimum Length</label >Minimum Length</label
> >
<div class="control"> <div class="control">
<input <input
class="input" class="input"
id="lotTypeFieldEdit--minimumLength" id="lotTypeFieldEdit--minLength"
name="minimumLength" name="minLength"
type="number" type="number"
min="0" min="0"
max="32767" max="32767"
@ -95,14 +95,14 @@
</div> </div>
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label class="label" for="lotTypeFieldEdit--maximumLength" <label class="label" for="lotTypeFieldEdit--maxLength"
>Maximum Length</label >Maximum Length</label
> >
<div class="control"> <div class="control">
<input <input
class="input" class="input"
id="lotTypeFieldEdit--maximumLength" id="lotTypeFieldEdit--maxLength"
name="maximumLength" name="maxLength"
type="number" type="number"
min="0" min="0"
max="32767" max="32767"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
const mapContainerElement = document.querySelector('#lot--map'); const mapContainerElement = document.querySelector('#burialSite--cemeterySvg');
if (mapContainerElement !== null) { 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> declare const exports: Record<string, unknown>
;(() => { ;(() => {
const mapContainerElement: HTMLElement | null = const mapContainerElement: HTMLElement | null =
document.querySelector('#lot--map') document.querySelector('#burialSite--cemeterySvg')
if (mapContainerElement !== null) { if (mapContainerElement !== null) {
;(exports.los as LOS).highlightMap( ;(exports.los as LOS).highlightMap(
mapContainerElement, mapContainerElement,
mapContainerElement.dataset.mapKey ?? '', mapContainerElement.dataset.cemeterySvgId ?? '',
'success' 'success'
) )
} }

View File

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

View File

@ -399,10 +399,10 @@ declare const exports: Record<string, unknown>
inputElement.required = occupancyTypeField.isRequired as boolean inputElement.required = occupancyTypeField.isRequired as boolean
inputElement.minLength = inputElement.minLength =
occupancyTypeField.minimumLength as number occupancyTypeField.minLength as number
inputElement.maxLength = inputElement.maxLength =
occupancyTypeField.maximumLength as number occupancyTypeField.maxLength as number
if ((occupancyTypeField.pattern ?? '') !== '') { if ((occupancyTypeField.pattern ?? '') !== '') {
inputElement.pattern = occupancyTypeField.pattern as string inputElement.pattern = occupancyTypeField.pattern as string
@ -501,7 +501,7 @@ declare const exports: Record<string, unknown>
los.getLoadingParagraphHTML('Searching...') los.getLoadingParagraphHTML('Searching...')
cityssm.postJSON( cityssm.postJSON(
`${los.urlPrefix}/lots/doSearchBurialSites`, `${los.urlPrefix}/burialSites/doSearchBurialSites`,
lotSelectFormElement, lotSelectFormElement,
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
@ -563,7 +563,7 @@ declare const exports: Record<string, unknown>
).value ).value
cityssm.postJSON( cityssm.postJSON(
`${los.urlPrefix}/lots/doCreateBurialSite`, `${los.urlPrefix}/burialSites/doCreateBurialSite`,
submitEvent.currentTarget, submitEvent.currentTarget,
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
@ -704,7 +704,7 @@ declare const exports: Record<string, unknown>
contextualColorName: 'info' contextualColorName: 'info'
}) })
} else { } 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 searchResultsContainerElement = document.querySelector('#container--searchResults');
const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10); const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10);
const offsetElement = document.querySelector('#searchFilter--offset'); const offsetElement = document.querySelector('#searchFilter--offset');
function renderLotOccupancies(rawResponseJSON) { // eslint-disable-next-line complexity
function renderContracts(rawResponseJSON) {
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.lotOccupancies.length === 0) { if (responseJSON.burialSiteContracts.length === 0) {
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = `<div class="message is-info"> searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body"> <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> </p>
</div>`; </div>`;
return; return;
} }
const resultsTbodyElement = document.createElement('tbody'); const resultsTbodyElement = document.createElement('tbody');
const nowDateString = cityssm.dateToString(new Date()); const nowDateString = cityssm.dateToString(new Date());
for (const burialSiteContract of responseJSON.lotOccupancies) { for (const burialSiteContract of responseJSON.burialSiteContracts) {
let occupancyTimeHTML = ''; let contractTimeHTML = '';
if (burialSiteContract.contractStartDateString <= nowDateString && if (burialSiteContract.contractStartDateString <= nowDateString &&
(burialSiteContract.contractEndDateString === '' || (burialSiteContract.contractEndDateString === '' ||
burialSiteContract.contractEndDateString >= nowDateString)) { burialSiteContract.contractEndDateString >= nowDateString)) {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Current ${los.escapedAliases.Occupancy}"> contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Current Contract">
<i class="fas fa-play" aria-label="Current ${los.escapedAliases.Occupancy}"></i> <i class="fas fa-play" aria-label="Current Contract"></i>
</span>`; </span>`;
} }
else if (burialSiteContract.contractStartDateString > nowDateString) { else if (burialSiteContract.contractStartDateString > nowDateString) {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Future ${los.escapedAliases.Occupancy}"> contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Future Contract">
<i class="fas fa-fast-forward" aria-label="Future ${los.escapedAliases.Occupancy}"></i> <i class="fas fa-fast-forward" aria-label="Future Contract"></i>
</span>`; </span>`;
} }
else { else {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Past ${los.escapedAliases.Occupancy}"> contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Past Contract">
<i class="fas fa-stop" aria-label="Past ${los.escapedAliases.Occupancy}"></i> <i class="fas fa-stop" aria-label="Past Contract"></i>
</span>`; </span>`;
} }
let occupantsHTML = ''; let deceasedHTML = '';
for (const occupant of burialSiteContract.burialSiteContractOccupants ?? []) { for (const interment of burialSiteContract.burialSiteContractInterments ?? []) {
occupantsHTML += `<li class="has-tooltip-left" data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType ?? '')}"> deceasedHTML += `<li class="has-tooltip-left">
<span class="fa-li"> ${cityssm.escapeHTML(interment.deceasedName ?? '')}
<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 ?? '')}
</li>`; </li>`;
} }
const feeTotal = (burialSiteContract.burialSiteContractFees?.reduce((soFar, currentFee) => soFar + 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 // eslint-disable-next-line no-unsanitized/method
resultsTbodyElement.insertAdjacentHTML('beforeend', `<tr> resultsTbodyElement.insertAdjacentHTML('beforeend', `<tr>
<td class="has-width-1"> <td class="has-width-1">
${occupancyTimeHTML} ${contractTimeHTML}
</td><td> </td><td>
<a class="has-text-weight-bold" <a class="has-text-weight-bold"
href="${los.getBurialSiteContractURL(burialSiteContract.burialSiteContractId)}"> href="${los.getBurialSiteContractURL(burialSiteContract.burialSiteContractId)}">
${cityssm.escapeHTML(burialSiteContract.occupancyType ?? '')} ${cityssm.escapeHTML(burialSiteContract.contractType ?? '')}
</a><br /> </a><br />
<span class="is-size-7">#${burialSiteContract.burialSiteContractId}</span> <span class="is-size-7">#${burialSiteContract.burialSiteContractId}</span>
</td><td> </td><td>
${(burialSiteContract.lotId ?? -1) === -1 ${(burialSiteContract.burialSiteId ?? -1) === -1
? `<span class="has-text-grey">(No ${los.escapedAliases.Lot})</span>` ? `<span class="has-text-grey">(No Burial Site)</span>`
: `<a class="has-tooltip-right" data-tooltip="${cityssm.escapeHTML(burialSiteContract.lotType ?? '')}" href="${los.getBurialSiteURL(burialSiteContract.lotId)}">${cityssm.escapeHTML(burialSiteContract.lotName ?? '')}</a>`}<br /> : `<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> <span class="is-size-7">${cityssm.escapeHTML(burialSiteContract.cemeteryName ?? '')}</span>
</td><td> </td><td>
${burialSiteContract.contractStartDateString} ${burialSiteContract.contractStartDateString}
@ -86,9 +83,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
? burialSiteContract.contractEndDateString ? burialSiteContract.contractEndDateString
: '<span class="has-text-grey">(No End Date)</span>'} : '<span class="has-text-grey">(No End Date)</span>'}
</td><td> </td><td>
${occupantsHTML === '' ${deceasedHTML === ''
? '' ? ''
: `<ul class="fa-ul ml-5">${occupantsHTML}</ul>`} : `<ul class="fa-ul ml-5">${deceasedHTML}</ul>`}
</td><td> </td><td>
${feeIconHTML} ${feeIconHTML}
</td><td> </td><td>
@ -99,15 +96,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
</a>` </a>`
: ''}</td></tr>`); : ''}</td></tr>`);
} }
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable has-sticky-header"> searchResultsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable has-sticky-header">
<thead><tr> <thead><tr>
<th class="has-width-1"></th> <th class="has-width-1"></th>
<th>${los.escapedAliases.Occupancy} Type</th> <th>Contract Type</th>
<th>${los.escapedAliases.Lot}</th> <th>Burial Site</th>
<th>${los.escapedAliases.contractStartDate}</th> <th>Contract Date</th>
<th>End 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">Fees and Transactions</span></th>
<th class="has-width-1"><span class="is-sr-only">Print</span></th> <th class="has-width-1"><span class="is-sr-only">Print</span></th>
</tr></thead> </tr></thead>
@ -119,31 +115,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
searchResultsContainerElement.insertAdjacentHTML('beforeend', los.getSearchResultsPagerHTML(limit, responseJSON.offset, responseJSON.count)); searchResultsContainerElement.insertAdjacentHTML('beforeend', los.getSearchResultsPagerHTML(limit, responseJSON.offset, responseJSON.count));
searchResultsContainerElement searchResultsContainerElement
.querySelector("button[data-page='previous']") .querySelector("button[data-page='previous']")
?.addEventListener('click', previousAndGetLotOccupancies); ?.addEventListener('click', previousAndGetContracts);
searchResultsContainerElement searchResultsContainerElement
.querySelector("button[data-page='next']") .querySelector("button[data-page='next']")
?.addEventListener('click', nextAndGetLotOccupancies); ?.addEventListener('click', nextAndGetContracts);
} }
function getBurialSiteContracts() { function getBurialSiteContracts() {
// eslint-disable-next-line no-unsanitized/property // eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Occupancies}...`); searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading Contracts...`);
cityssm.postJSON(`${los.urlPrefix}/contracts/doSearchLotOccupancies`, searchFilterFormElement, renderLotOccupancies); cityssm.postJSON(`${los.urlPrefix}/contracts/doSearchBurialSiteContracts`, searchFilterFormElement, renderContracts);
} }
function resetOffsetAndGetLotOccupancies() { function resetOffsetAndGetContracts() {
offsetElement.value = '0'; offsetElement.value = '0';
getBurialSiteContracts(); getBurialSiteContracts();
} }
function previousAndGetLotOccupancies() { function previousAndGetContracts() {
offsetElement.value = Math.max(Number.parseInt(offsetElement.value, 10) - limit, 0).toString(); offsetElement.value = Math.max(Number.parseInt(offsetElement.value, 10) - limit, 0).toString();
getBurialSiteContracts(); getBurialSiteContracts();
} }
function nextAndGetLotOccupancies() { function nextAndGetContracts() {
offsetElement.value = (Number.parseInt(offsetElement.value, 10) + limit).toString(); offsetElement.value = (Number.parseInt(offsetElement.value, 10) + limit).toString();
getBurialSiteContracts(); getBurialSiteContracts();
} }
const filterElements = searchFilterFormElement.querySelectorAll('input, select'); const filterElements = searchFilterFormElement.querySelectorAll('input, select');
for (const filterElement of filterElements) { for (const filterElement of filterElements) {
filterElement.addEventListener('change', resetOffsetAndGetLotOccupancies); filterElement.addEventListener('change', resetOffsetAndGetContracts);
} }
searchFilterFormElement.addEventListener('submit', (formEvent) => { searchFilterFormElement.addEventListener('submit', (formEvent) => {
formEvent.preventDefault(); formEvent.preventDefault();

View File

@ -1,7 +1,8 @@
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { LOS } from '../../types/globalTypes.js' import type { BurialSiteContract } from '../../types/recordTypes.js'
import type { LotOccupancy } from '../../types/recordTypes.js'
import type { LOS } from './types.js'
declare const cityssm: cityssmGlobal declare const cityssm: cityssmGlobal
@ -26,18 +27,18 @@ declare const exports: Record<string, unknown>
'#searchFilter--offset' '#searchFilter--offset'
) as HTMLInputElement ) as HTMLInputElement
function renderLotOccupancies(rawResponseJSON: unknown): void { // eslint-disable-next-line complexity
function renderContracts(rawResponseJSON: unknown): void {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
count: number count: number
offset: number offset: number
lotOccupancies: LotOccupancy[] burialSiteContracts: BurialSiteContract[]
} }
if (responseJSON.lotOccupancies.length === 0) { if (responseJSON.burialSiteContracts.length === 0) {
// eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = `<div class="message is-info"> searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body"> <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> </p>
</div>` </div>`
@ -48,40 +49,32 @@ declare const exports: Record<string, unknown>
const nowDateString = cityssm.dateToString(new Date()) const nowDateString = cityssm.dateToString(new Date())
for (const burialSiteContract of responseJSON.lotOccupancies) { for (const burialSiteContract of responseJSON.burialSiteContracts) {
let occupancyTimeHTML = '' let contractTimeHTML = ''
if ( if (
burialSiteContract.contractStartDateString! <= nowDateString && burialSiteContract.contractStartDateString! <= nowDateString &&
(burialSiteContract.contractEndDateString === '' || (burialSiteContract.contractEndDateString === '' ||
burialSiteContract.contractEndDateString! >= nowDateString) burialSiteContract.contractEndDateString! >= nowDateString)
) { ) {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Current ${los.escapedAliases.Occupancy}"> contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Current Contract">
<i class="fas fa-play" aria-label="Current ${los.escapedAliases.Occupancy}"></i> <i class="fas fa-play" aria-label="Current Contract"></i>
</span>` </span>`
} else if (burialSiteContract.contractStartDateString! > nowDateString) { } else if (burialSiteContract.contractStartDateString! > nowDateString) {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Future ${los.escapedAliases.Occupancy}"> contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Future Contract">
<i class="fas fa-fast-forward" aria-label="Future ${los.escapedAliases.Occupancy}"></i> <i class="fas fa-fast-forward" aria-label="Future Contract"></i>
</span>` </span>`
} else { } else {
occupancyTimeHTML = `<span class="has-tooltip-right" data-tooltip="Past ${los.escapedAliases.Occupancy}"> contractTimeHTML = `<span class="has-tooltip-right" data-tooltip="Past Contract">
<i class="fas fa-stop" aria-label="Past ${los.escapedAliases.Occupancy}"></i> <i class="fas fa-stop" aria-label="Past Contract"></i>
</span>` </span>`
} }
let occupantsHTML = '' let deceasedHTML = ''
for (const occupant of burialSiteContract.burialSiteContractOccupants ?? []) { for (const interment of burialSiteContract.burialSiteContractInterments ?? []) {
occupantsHTML += `<li class="has-tooltip-left" data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType ?? '')}"> deceasedHTML += `<li class="has-tooltip-left">
<span class="fa-li"> ${cityssm.escapeHTML(interment.deceasedName ?? '')}
<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 ?? '')}
</li>` </li>`
} }
@ -122,18 +115,21 @@ declare const exports: Record<string, unknown>
'beforeend', 'beforeend',
`<tr> `<tr>
<td class="has-width-1"> <td class="has-width-1">
${occupancyTimeHTML} ${contractTimeHTML}
</td><td> </td><td>
<a class="has-text-weight-bold" <a class="has-text-weight-bold"
href="${los.getBurialSiteContractURL(burialSiteContract.burialSiteContractId)}"> href="${los.getBurialSiteContractURL(burialSiteContract.burialSiteContractId)}">
${cityssm.escapeHTML(burialSiteContract.occupancyType ?? '')} ${cityssm.escapeHTML(burialSiteContract.contractType ?? '')}
</a><br /> </a><br />
<span class="is-size-7">#${burialSiteContract.burialSiteContractId}</span> <span class="is-size-7">#${burialSiteContract.burialSiteContractId}</span>
</td><td> </td><td>
${ ${
(burialSiteContract.lotId ?? -1) === -1 (burialSiteContract.burialSiteId ?? -1) === -1
? `<span class="has-text-grey">(No ${los.escapedAliases.Lot})</span>` ? `<span class="has-text-grey">(No Burial Site)</span>`
: `<a class="has-tooltip-right" data-tooltip="${cityssm.escapeHTML(burialSiteContract.lotType ?? '')}" href="${los.getBurialSiteURL(burialSiteContract.lotId)}">${cityssm.escapeHTML(burialSiteContract.lotName ?? '')}</a>` : `<a class="has-tooltip-right" data-tooltip="${cityssm.escapeHTML(burialSiteContract.burialSiteType ?? '')}"
href="${los.getBurialSiteURL(burialSiteContract.burialSiteId)}">
${cityssm.escapeHTML(burialSiteContract.burialSiteName ?? '')}
</a>`
}<br /> }<br />
<span class="is-size-7">${cityssm.escapeHTML(burialSiteContract.cemeteryName ?? '')}</span> <span class="is-size-7">${cityssm.escapeHTML(burialSiteContract.cemeteryName ?? '')}</span>
</td><td> </td><td>
@ -146,9 +142,9 @@ declare const exports: Record<string, unknown>
} }
</td><td> </td><td>
${ ${
occupantsHTML === '' deceasedHTML === ''
? '' ? ''
: `<ul class="fa-ul ml-5">${occupantsHTML}</ul>` : `<ul class="fa-ul ml-5">${deceasedHTML}</ul>`
} }
</td><td> </td><td>
${feeIconHTML} ${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"> searchResultsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable has-sticky-header">
<thead><tr> <thead><tr>
<th class="has-width-1"></th> <th class="has-width-1"></th>
<th>${los.escapedAliases.Occupancy} Type</th> <th>Contract Type</th>
<th>${los.escapedAliases.Lot}</th> <th>Burial Site</th>
<th>${los.escapedAliases.contractStartDate}</th> <th>Contract Date</th>
<th>End 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">Fees and Transactions</span></th>
<th class="has-width-1"><span class="is-sr-only">Print</span></th> <th class="has-width-1"><span class="is-sr-only">Print</span></th>
</tr></thead> </tr></thead>
@ -194,32 +189,32 @@ declare const exports: Record<string, unknown>
searchResultsContainerElement searchResultsContainerElement
.querySelector("button[data-page='previous']") .querySelector("button[data-page='previous']")
?.addEventListener('click', previousAndGetLotOccupancies) ?.addEventListener('click', previousAndGetContracts)
searchResultsContainerElement searchResultsContainerElement
.querySelector("button[data-page='next']") .querySelector("button[data-page='next']")
?.addEventListener('click', nextAndGetLotOccupancies) ?.addEventListener('click', nextAndGetContracts)
} }
function getBurialSiteContracts(): void { function getBurialSiteContracts(): void {
// eslint-disable-next-line no-unsanitized/property // eslint-disable-next-line no-unsanitized/property
searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML( searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(
`Loading ${los.escapedAliases.Occupancies}...` `Loading Contracts...`
) )
cityssm.postJSON( cityssm.postJSON(
`${los.urlPrefix}/contracts/doSearchLotOccupancies`, `${los.urlPrefix}/contracts/doSearchBurialSiteContracts`,
searchFilterFormElement, searchFilterFormElement,
renderLotOccupancies renderContracts
) )
} }
function resetOffsetAndGetLotOccupancies(): void { function resetOffsetAndGetContracts(): void {
offsetElement.value = '0' offsetElement.value = '0'
getBurialSiteContracts() getBurialSiteContracts()
} }
function previousAndGetLotOccupancies(): void { function previousAndGetContracts(): void {
offsetElement.value = Math.max( offsetElement.value = Math.max(
Number.parseInt(offsetElement.value, 10) - limit, Number.parseInt(offsetElement.value, 10) - limit,
0 0
@ -227,7 +222,7 @@ declare const exports: Record<string, unknown>
getBurialSiteContracts() getBurialSiteContracts()
} }
function nextAndGetLotOccupancies(): void { function nextAndGetContracts(): void {
offsetElement.value = ( offsetElement.value = (
Number.parseInt(offsetElement.value, 10) + limit Number.parseInt(offsetElement.value, 10) + limit
).toString() ).toString()
@ -238,7 +233,7 @@ declare const exports: Record<string, unknown>
searchFilterFormElement.querySelectorAll('input, select') searchFilterFormElement.querySelectorAll('input, select')
for (const filterElement of filterElements) { for (const filterElement of filterElements) {
filterElement.addEventListener('change', resetOffsetAndGetLotOccupancies) filterElement.addEventListener('change', resetOffsetAndGetContracts)
} }
searchFilterFormElement.addEventListener('submit', (formEvent) => { 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 lotType = lotTypes.find((currentLotType) => currentLotType.burialSiteTypeId === burialSiteTypeId);
const lotTypeField = (lotType.BurialSiteTypeFields ?? []).find((currentLotTypeField) => currentLotTypeField.lotTypeFieldId === lotTypeFieldId); const lotTypeField = (lotType.BurialSiteTypeFields ?? []).find((currentLotTypeField) => currentLotTypeField.lotTypeFieldId === lotTypeFieldId);
let fieldTypeElement; let fieldTypeElement;
let minimumLengthElement; let minLengthInputElement;
let maximumLengthElement; let maxLengthInputElement;
let patternElement; let patternElement;
let lotTypeFieldValuesElement; let lotTypeFieldValuesElement;
let editCloseModalFunction; let editCloseModalFunction;
function updateMaximumLengthMin() { function updateMaximumLengthMin() {
maximumLengthElement.min = minimumLengthElement.value; maxLengthInputElement.min = minLengthInputElement.value;
} }
function toggleInputFields() { function toggleInputFields() {
switch (fieldTypeElement.value) { switch (fieldTypeElement.value) {
case 'date': { case 'date': {
minimumLengthElement.disabled = true; minLengthInputElement.disabled = true;
maximumLengthElement.disabled = true; maxLengthInputElement.disabled = true;
patternElement.disabled = true; patternElement.disabled = true;
lotTypeFieldValuesElement.disabled = true; lotTypeFieldValuesElement.disabled = true;
break; break;
} }
case 'select': { case 'select': {
minimumLengthElement.disabled = true; minLengthInputElement.disabled = true;
maximumLengthElement.disabled = true; maxLengthInputElement.disabled = true;
patternElement.disabled = true; patternElement.disabled = true;
lotTypeFieldValuesElement.disabled = false; lotTypeFieldValuesElement.disabled = false;
break; break;
} }
default: { default: {
minimumLengthElement.disabled = false; minLengthInputElement.disabled = false;
maximumLengthElement.disabled = false; maxLengthInputElement.disabled = false;
patternElement.disabled = false; patternElement.disabled = false;
lotTypeFieldValuesElement.disabled = true; lotTypeFieldValuesElement.disabled = true;
break; break;
@ -208,12 +208,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector('#lotTypeFieldEdit--isRequired').value = lotTypeField.isRequired ? '1' : '0'; modalElement.querySelector('#lotTypeFieldEdit--isRequired').value = lotTypeField.isRequired ? '1' : '0';
fieldTypeElement = modalElement.querySelector('#lotTypeFieldEdit--fieldType'); fieldTypeElement = modalElement.querySelector('#lotTypeFieldEdit--fieldType');
fieldTypeElement.value = lotTypeField.fieldType; fieldTypeElement.value = lotTypeField.fieldType;
minimumLengthElement = modalElement.querySelector('#lotTypeFieldEdit--minimumLength'); minLengthInputElement = modalElement.querySelector('#lotTypeFieldEdit--minLength');
minimumLengthElement.value = minLengthInputElement.value =
lotTypeField.minimumLength?.toString() ?? ''; lotTypeField.minLength?.toString() ?? '';
maximumLengthElement = modalElement.querySelector('#lotTypeFieldEdit--maximumLength'); maxLengthInputElement = modalElement.querySelector('#lotTypeFieldEdit--maxLength');
maximumLengthElement.value = maxLengthInputElement.value =
lotTypeField.maximumLength?.toString() ?? ''; lotTypeField.maxLength?.toString() ?? '';
patternElement = modalElement.querySelector('#lotTypeFieldEdit--pattern'); patternElement = modalElement.querySelector('#lotTypeFieldEdit--pattern');
patternElement.value = lotTypeField.pattern ?? ''; patternElement.value = lotTypeField.pattern ?? '';
lotTypeFieldValuesElement = modalElement.querySelector('#lotTypeFieldEdit--lotTypeFieldValues'); lotTypeFieldValuesElement = modalElement.querySelector('#lotTypeFieldEdit--lotTypeFieldValues');
@ -226,7 +226,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
bulmaJS.toggleHtmlClipped(); bulmaJS.toggleHtmlClipped();
cityssm.enableNavBlocker(); cityssm.enableNavBlocker();
modalElement.querySelector('form')?.addEventListener('submit', doUpdate); modalElement.querySelector('form')?.addEventListener('submit', doUpdate);
minimumLengthElement.addEventListener('keyup', updateMaximumLengthMin); minLengthInputElement.addEventListener('keyup', updateMaximumLengthMin);
updateMaximumLengthMin(); updateMaximumLengthMin();
fieldTypeElement.addEventListener('change', toggleInputFields); fieldTypeElement.addEventListener('change', toggleInputFields);
modalElement modalElement

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,10 +24,10 @@ router.post('/doSearchBurialSites', handler_doSearchBurialSites);
* Lot View / Edit * Lot View / Edit
*/ */
router.get('/new', updateGetHandler, handler_new); 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', updatePostHandler, handler_doGetBurialSiteTypeFields); router.post('/doGetBurialSiteTypeFields', updatePostHandler, handler_doGetBurialSiteTypeFields);
router.post('/doCreateBurialSite', updatePostHandler, handler_doCreateBurialSite); router.post('/doCreateBurialSite', updatePostHandler, handler_doCreateBurialSite);
router.post('/doUpdateBurialSite', updatePostHandler, handler_doUpdateBurialSite); 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('/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( router.post(
'/doGetBurialSiteTypeFields', '/doGetBurialSiteTypeFields',

View File

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

View File

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

View File

@ -22,9 +22,9 @@
<li> <li>
<a class="<%= (headTitle === configFunctions.getConfigProperty("aliases.lot") + " Type Management" ? "is-active" : "") %>" <a class="<%= (headTitle === configFunctions.getConfigProperty("aliases.lot") + " Type Management" ? "is-active" : "") %>"
href="<%= urlPrefix %>/admin/lotTypes" 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="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> </a>
</li> </li>
<li> <li>

View File

@ -16,7 +16,7 @@
</li> </li>
<li class="is-active"> <li class="is-active">
<a href="#" aria-current="page"> <a href="#" aria-current="page">
<%= configFunctions.getConfigProperty("aliases.lot") %> Type Management Burial Site Type Management
</a> </a>
</li> </li>
</ul> </ul>
@ -25,13 +25,13 @@
<div class="columns is-vcentered"> <div class="columns is-vcentered">
<div class="column"> <div class="column">
<h1 class="title is-1"> <h1 class="title is-1">
<%= configFunctions.getConfigProperty("aliases.lot") %> Type Management Burial Site Type Management
</h1> </h1>
</div> </div>
<div class="column has-text-right is-narrow"> <div class="column has-text-right is-narrow">
<button class="button is-success" id="button--addLotType" type="button" accesskey="n"> <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 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> </button>
</div> </div>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,9 +25,9 @@
</a> </a>
</li> </li>
<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="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> </a>
</li> </li>
<li> <li>
@ -182,7 +182,7 @@
</div> </div>
</div> </div>
<div class="is-hidden" id="tab--lots"> <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"> <div class="panel">
<form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/lots-byMapId"> <form class="panel-block align-items-flex-start" method="get" action="<%= urlPrefix %>/reports/lots-byMapId">
@ -194,7 +194,7 @@
</div> </div>
<div> <div>
<h2 class="title is-5 is-marginless"> <h2 class="title is-5 is-marginless">
<%= configFunctions.getConfigProperty("aliases.lots") %> By <%= configFunctions.getConfigProperty("aliases.map") %> Burial Sites By <%= configFunctions.getConfigProperty("aliases.map") %>
</h2> </h2>
<div class="field has-addons mt-2"> <div class="field has-addons mt-2">
<div class="control"> <div class="control">
@ -229,11 +229,11 @@
<span class="tag is-info">CSV</span> <span class="tag is-info">CSV</span>
</div> </div>
<div> <div>
<h2 class="title is-5 is-marginless"><%= 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="field has-addons mt-2">
<div class="control"> <div class="control">
<label class="button is-small is-static" for="lots-byburialSiteTypeId--burialSiteTypeId"> <label class="button is-small is-static" for="lots-byburialSiteTypeId--burialSiteTypeId">
<%= configFunctions.getConfigProperty("aliases.lot") %> Type Burial Site Type
</label> </label>
</div> </div>
<div class="control is-expanded"> <div class="control is-expanded">
@ -263,11 +263,11 @@
<span class="tag is-info">CSV</span> <span class="tag is-info">CSV</span>
</div> </div>
<div> <div>
<h2 class="title is-5 is-marginless"><%= 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="field has-addons mt-2">
<div class="control"> <div class="control">
<label class="button is-small is-static" for="lots-byburialSiteStatusId--burialSiteStatusId"> <label class="button is-small is-static" for="lots-byburialSiteStatusId--burialSiteStatusId">
<%= configFunctions.getConfigProperty("aliases.lot") %> Status Burial Site Status
</label> </label>
</div> </div>
<div class="control is-expanded"> <div class="control is-expanded">
@ -440,7 +440,7 @@
</a> </a>
</div> </div>
<div class="panel"> <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> <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"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">
@ -525,7 +525,7 @@
</a> </a>
</div> </div>
<div class="panel"> <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> <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"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">

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