Compare commits
No commits in common. "main" and "v1.0.0-alpha.10" have entirely different histories.
main
...
v1.0.0-alp
|
|
@ -1,2 +1,2 @@
|
||||||
theme: jekyll-theme-cayman
|
theme: jekyll-theme-cayman
|
||||||
title: Sunrise Cemetery Management System (CMS)
|
title: Sunrise Cemetery Management System
|
||||||
|
|
@ -15,10 +15,10 @@ export default function addContractTransaction(contractTransactionForm, user) {
|
||||||
transactionIndex = maxIndexResult.transactionIndex + 1;
|
transactionIndex = maxIndexResult.transactionIndex + 1;
|
||||||
}
|
}
|
||||||
const rightNow = new Date();
|
const rightNow = new Date();
|
||||||
const transactionDate = (contractTransactionForm.transactionDateString ?? '') === ''
|
const transactionDate = contractTransactionForm.transactionDateString === ''
|
||||||
? dateToInteger(rightNow)
|
? dateToInteger(rightNow)
|
||||||
: dateStringToInteger(contractTransactionForm.transactionDateString);
|
: dateStringToInteger(contractTransactionForm.transactionDateString);
|
||||||
const transactionTime = (contractTransactionForm.transactionTimeString ?? '') === ''
|
const transactionTime = contractTransactionForm.transactionTimeString === ''
|
||||||
? dateToTimeInteger(rightNow)
|
? dateToTimeInteger(rightNow)
|
||||||
: timeStringToInteger(contractTransactionForm.transactionTimeString);
|
: timeStringToInteger(contractTransactionForm.transactionTimeString);
|
||||||
database
|
database
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,14 @@ export default function addContractTransaction(
|
||||||
const rightNow = new Date()
|
const rightNow = new Date()
|
||||||
|
|
||||||
const transactionDate =
|
const transactionDate =
|
||||||
(contractTransactionForm.transactionDateString ?? '') === ''
|
contractTransactionForm.transactionDateString === ''
|
||||||
? dateToInteger(rightNow)
|
? dateToInteger(rightNow)
|
||||||
: dateStringToInteger(
|
: dateStringToInteger(
|
||||||
contractTransactionForm.transactionDateString as DateString
|
contractTransactionForm.transactionDateString as DateString
|
||||||
)
|
)
|
||||||
|
|
||||||
const transactionTime =
|
const transactionTime =
|
||||||
(contractTransactionForm.transactionTimeString ?? '') === ''
|
contractTransactionForm.transactionTimeString === ''
|
||||||
? dateToTimeInteger(rightNow)
|
? dateToTimeInteger(rightNow)
|
||||||
: timeStringToInteger(
|
: timeStringToInteger(
|
||||||
contractTransactionForm.transactionTimeString as TimeString
|
contractTransactionForm.transactionTimeString as TimeString
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,17 @@ export default function getBurialSites(filters, options, connectedDatabase) {
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
count = database
|
count = database
|
||||||
.prepare(`select count(*) as recordCount
|
.prepare(`select count(*) as recordCount
|
||||||
from BurialSites l
|
from BurialSites l
|
||||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||||
left join (
|
left join (
|
||||||
select burialSiteId, count(contractId) as contractCount from Contracts
|
select burialSiteId, count(contractId) as contractCount from Contracts
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractStartDate <= ${currentDate.toString()}
|
and contractStartDate <= ${currentDate.toString()}
|
||||||
and (contractEndDate is null or contractEndDate >= ${currentDate.toString()})
|
and (contractEndDate is null or contractEndDate >= ${currentDate.toString()})
|
||||||
group by burialSiteId
|
group by burialSiteId
|
||||||
) o on l.burialSiteId = o.burialSiteId
|
) o on l.burialSiteId = o.burialSiteId
|
||||||
${sqlWhereClause}`)
|
${sqlWhereClause}`)
|
||||||
.pluck()
|
.get(sqlParameters).recordCount;
|
||||||
.get(sqlParameters);
|
|
||||||
}
|
}
|
||||||
let burialSites = [];
|
let burialSites = [];
|
||||||
if (options.limit === -1 || count > 0) {
|
if (options.limit === -1 || count > 0) {
|
||||||
|
|
|
||||||
|
|
@ -38,22 +38,23 @@ export default function getBurialSites(
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
count = database
|
count = (
|
||||||
.prepare(
|
database
|
||||||
`select count(*) as recordCount
|
.prepare(
|
||||||
from BurialSites l
|
`select count(*) as recordCount
|
||||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
from BurialSites l
|
||||||
left join (
|
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||||
select burialSiteId, count(contractId) as contractCount from Contracts
|
left join (
|
||||||
where recordDelete_timeMillis is null
|
select burialSiteId, count(contractId) as contractCount from Contracts
|
||||||
and contractStartDate <= ${currentDate.toString()}
|
where recordDelete_timeMillis is null
|
||||||
and (contractEndDate is null or contractEndDate >= ${currentDate.toString()})
|
and contractStartDate <= ${currentDate.toString()}
|
||||||
group by burialSiteId
|
and (contractEndDate is null or contractEndDate >= ${currentDate.toString()})
|
||||||
) o on l.burialSiteId = o.burialSiteId
|
group by burialSiteId
|
||||||
${sqlWhereClause}`
|
) o on l.burialSiteId = o.burialSiteId
|
||||||
)
|
${sqlWhereClause}`
|
||||||
.pluck()
|
)
|
||||||
.get(sqlParameters) as number
|
.get(sqlParameters) as { recordCount: number }
|
||||||
|
).recordCount
|
||||||
}
|
}
|
||||||
|
|
||||||
let burialSites: BurialSite[] = []
|
let burialSites: BurialSite[] = []
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ export default async function GetContractTransactions(contractId, options, conne
|
||||||
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
||||||
const contractTransactions = database
|
const contractTransactions = database
|
||||||
.prepare(`select contractId, transactionIndex,
|
.prepare(`select contractId, transactionIndex,
|
||||||
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
|
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
|
||||||
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
|
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
|
||||||
transactionAmount, externalReceiptNumber, transactionNote
|
transactionAmount, externalReceiptNumber, transactionNote
|
||||||
from ContractTransactions
|
from ContractTransactions
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId = ?
|
and contractId = ?
|
||||||
order by transactionDate, transactionTime, transactionIndex`)
|
order by transactionDate, transactionTime, transactionIndex`)
|
||||||
.all(contractId);
|
.all(contractId);
|
||||||
if (connectedDatabase === undefined) {
|
if (connectedDatabase === undefined) {
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ export default async function GetContractTransactions(
|
||||||
const contractTransactions = database
|
const contractTransactions = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select contractId, transactionIndex,
|
`select contractId, transactionIndex,
|
||||||
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
|
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
|
||||||
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
|
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
|
||||||
transactionAmount, externalReceiptNumber, transactionNote
|
transactionAmount, externalReceiptNumber, transactionNote
|
||||||
from ContractTransactions
|
from ContractTransactions
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId = ?
|
and contractId = ?
|
||||||
order by transactionDate, transactionTime, transactionIndex`
|
order by transactionDate, transactionTime, transactionIndex`
|
||||||
)
|
)
|
||||||
.all(contractId) as ContractTransaction[]
|
.all(contractId) as ContractTransaction[]
|
||||||
|
|
|
||||||
|
|
@ -24,51 +24,47 @@ export default async function getContracts(filters, options, connectedDatabase)
|
||||||
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
||||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||||
${sqlWhereClause}`)
|
${sqlWhereClause}`)
|
||||||
.pluck()
|
.get(sqlParameters).recordCount;
|
||||||
.get(sqlParameters);
|
|
||||||
}
|
}
|
||||||
let contracts = [];
|
let contracts = [];
|
||||||
if (count !== 0) {
|
if (count !== 0) {
|
||||||
const sqlLimitClause = isLimited
|
|
||||||
? ` limit ${options.limit} offset ${options.offset}`
|
|
||||||
: '';
|
|
||||||
contracts = database
|
contracts = database
|
||||||
.prepare(`select c.contractId,
|
.prepare(`select c.contractId,
|
||||||
c.contractTypeId, t.contractType, t.isPreneed,
|
c.contractTypeId, t.contractType, t.isPreneed,
|
||||||
c.burialSiteId, lt.burialSiteType, l.burialSiteName,
|
c.burialSiteId, lt.burialSiteType, l.burialSiteName,
|
||||||
case when l.recordDelete_timeMillis is null then 1 else 0 end as burialSiteIsActive,
|
case when l.recordDelete_timeMillis is null then 1 else 0 end as burialSiteIsActive,
|
||||||
l.cemeteryId, m.cemeteryName,
|
l.cemeteryId, m.cemeteryName,
|
||||||
c.contractStartDate, userFn_dateIntegerToString(c.contractStartDate) as contractStartDateString,
|
c.contractStartDate, userFn_dateIntegerToString(c.contractStartDate) as contractStartDateString,
|
||||||
c.contractEndDate, userFn_dateIntegerToString(c.contractEndDate) as contractEndDateString,
|
c.contractEndDate, userFn_dateIntegerToString(c.contractEndDate) as contractEndDateString,
|
||||||
c.purchaserName, c.purchaserAddress1, c.purchaserAddress2,
|
c.purchaserName, c.purchaserAddress1, c.purchaserAddress2,
|
||||||
c.purchaserCity, c.purchaserProvince, c.purchaserPostalCode,
|
c.purchaserCity, c.purchaserProvince, c.purchaserPostalCode,
|
||||||
c.purchaserPhoneNumber, c.purchaserEmail, c.purchaserRelationship,
|
c.purchaserPhoneNumber, c.purchaserEmail, c.purchaserRelationship,
|
||||||
c.funeralHomeId, c.funeralDirectorName, f.funeralHomeName,
|
c.funeralHomeId, c.funeralDirectorName, f.funeralHomeName,
|
||||||
|
|
||||||
c.funeralDate, userFn_dateIntegerToString(c.funeralDate) as funeralDateString,
|
c.funeralDate, userFn_dateIntegerToString(c.funeralDate) as funeralDateString,
|
||||||
c.funeralTime,
|
c.funeralTime,
|
||||||
userFn_timeIntegerToString(c.funeralTime) as funeralTimeString,
|
userFn_timeIntegerToString(c.funeralTime) as funeralTimeString,
|
||||||
userFn_timeIntegerToPeriodString(c.funeralTime) as funeralTimePeriodString,
|
userFn_timeIntegerToPeriodString(c.funeralTime) as funeralTimePeriodString,
|
||||||
c.directionOfArrival,
|
c.directionOfArrival,
|
||||||
c.committalTypeId, cm.committalType
|
c.committalTypeId, cm.committalType
|
||||||
from Contracts c
|
from Contracts c
|
||||||
left join ContractTypes t on c.contractTypeId = t.contractTypeId
|
left join ContractTypes t on c.contractTypeId = t.contractTypeId
|
||||||
left join CommittalTypes cm on c.committalTypeId = cm.committalTypeId
|
left join CommittalTypes cm on c.committalTypeId = cm.committalTypeId
|
||||||
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
||||||
left join BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId
|
left join BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId
|
||||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||||
left join FuneralHomes f on c.funeralHomeId = f.funeralHomeId
|
left join FuneralHomes f on c.funeralHomeId = f.funeralHomeId
|
||||||
${sqlWhereClause}
|
${sqlWhereClause}
|
||||||
${options.orderBy !== undefined && options.orderBy !== ''
|
${options.orderBy !== undefined && options.orderBy !== ''
|
||||||
? ` order by ${options.orderBy}`
|
? ` order by ${options.orderBy}`
|
||||||
: ` order by c.contractStartDate desc, ifnull(c.contractEndDate, 99999999) desc,
|
: `order by c.contractStartDate desc, ifnull(c.contractEndDate, 99999999) desc,
|
||||||
l.burialSiteNameSegment1,
|
l.burialSiteNameSegment1,
|
||||||
l.burialSiteNameSegment2,
|
l.burialSiteNameSegment2,
|
||||||
l.burialSiteNameSegment3,
|
l.burialSiteNameSegment3,
|
||||||
l.burialSiteNameSegment4,
|
l.burialSiteNameSegment4,
|
||||||
l.burialSiteNameSegment5,
|
l.burialSiteNameSegment5,
|
||||||
c.burialSiteId, c.contractId desc`}
|
c.burialSiteId, c.contractId desc`}
|
||||||
${sqlLimitClause}`)
|
${isLimited ? ` limit ${options.limit} offset ${options.offset}` : ''}`)
|
||||||
.all(sqlParameters);
|
.all(sqlParameters);
|
||||||
if (!isLimited) {
|
if (!isLimited) {
|
||||||
count = contracts.length;
|
count = contracts.length;
|
||||||
|
|
|
||||||
|
|
@ -81,65 +81,62 @@ export default async function getContracts(
|
||||||
const isLimited = options.limit !== -1
|
const isLimited = options.limit !== -1
|
||||||
|
|
||||||
if (isLimited) {
|
if (isLimited) {
|
||||||
count = database
|
count = (
|
||||||
.prepare(
|
database
|
||||||
`select count(*) as recordCount
|
.prepare(
|
||||||
|
`select count(*) as recordCount
|
||||||
from Contracts c
|
from Contracts c
|
||||||
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
||||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||||
${sqlWhereClause}`
|
${sqlWhereClause}`
|
||||||
)
|
)
|
||||||
.pluck()
|
.get(sqlParameters) as { recordCount: number }
|
||||||
.get(sqlParameters) as number
|
).recordCount
|
||||||
}
|
}
|
||||||
|
|
||||||
let contracts: Contract[] = []
|
let contracts: Contract[] = []
|
||||||
|
|
||||||
if (count !== 0) {
|
if (count !== 0) {
|
||||||
const sqlLimitClause = isLimited
|
|
||||||
? ` limit ${options.limit} offset ${options.offset}`
|
|
||||||
: ''
|
|
||||||
|
|
||||||
contracts = database
|
contracts = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select c.contractId,
|
`select c.contractId,
|
||||||
c.contractTypeId, t.contractType, t.isPreneed,
|
c.contractTypeId, t.contractType, t.isPreneed,
|
||||||
c.burialSiteId, lt.burialSiteType, l.burialSiteName,
|
c.burialSiteId, lt.burialSiteType, l.burialSiteName,
|
||||||
case when l.recordDelete_timeMillis is null then 1 else 0 end as burialSiteIsActive,
|
case when l.recordDelete_timeMillis is null then 1 else 0 end as burialSiteIsActive,
|
||||||
l.cemeteryId, m.cemeteryName,
|
l.cemeteryId, m.cemeteryName,
|
||||||
c.contractStartDate, userFn_dateIntegerToString(c.contractStartDate) as contractStartDateString,
|
c.contractStartDate, userFn_dateIntegerToString(c.contractStartDate) as contractStartDateString,
|
||||||
c.contractEndDate, userFn_dateIntegerToString(c.contractEndDate) as contractEndDateString,
|
c.contractEndDate, userFn_dateIntegerToString(c.contractEndDate) as contractEndDateString,
|
||||||
c.purchaserName, c.purchaserAddress1, c.purchaserAddress2,
|
c.purchaserName, c.purchaserAddress1, c.purchaserAddress2,
|
||||||
c.purchaserCity, c.purchaserProvince, c.purchaserPostalCode,
|
c.purchaserCity, c.purchaserProvince, c.purchaserPostalCode,
|
||||||
c.purchaserPhoneNumber, c.purchaserEmail, c.purchaserRelationship,
|
c.purchaserPhoneNumber, c.purchaserEmail, c.purchaserRelationship,
|
||||||
c.funeralHomeId, c.funeralDirectorName, f.funeralHomeName,
|
c.funeralHomeId, c.funeralDirectorName, f.funeralHomeName,
|
||||||
|
|
||||||
c.funeralDate, userFn_dateIntegerToString(c.funeralDate) as funeralDateString,
|
c.funeralDate, userFn_dateIntegerToString(c.funeralDate) as funeralDateString,
|
||||||
c.funeralTime,
|
c.funeralTime,
|
||||||
userFn_timeIntegerToString(c.funeralTime) as funeralTimeString,
|
userFn_timeIntegerToString(c.funeralTime) as funeralTimeString,
|
||||||
userFn_timeIntegerToPeriodString(c.funeralTime) as funeralTimePeriodString,
|
userFn_timeIntegerToPeriodString(c.funeralTime) as funeralTimePeriodString,
|
||||||
c.directionOfArrival,
|
c.directionOfArrival,
|
||||||
c.committalTypeId, cm.committalType
|
c.committalTypeId, cm.committalType
|
||||||
from Contracts c
|
from Contracts c
|
||||||
left join ContractTypes t on c.contractTypeId = t.contractTypeId
|
left join ContractTypes t on c.contractTypeId = t.contractTypeId
|
||||||
left join CommittalTypes cm on c.committalTypeId = cm.committalTypeId
|
left join CommittalTypes cm on c.committalTypeId = cm.committalTypeId
|
||||||
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
||||||
left join BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId
|
left join BurialSiteTypes lt on l.burialSiteTypeId = lt.burialSiteTypeId
|
||||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||||
left join FuneralHomes f on c.funeralHomeId = f.funeralHomeId
|
left join FuneralHomes f on c.funeralHomeId = f.funeralHomeId
|
||||||
${sqlWhereClause}
|
${sqlWhereClause}
|
||||||
${
|
${
|
||||||
options.orderBy !== undefined && options.orderBy !== ''
|
options.orderBy !== undefined && options.orderBy !== ''
|
||||||
? ` order by ${options.orderBy}`
|
? ` order by ${options.orderBy}`
|
||||||
: ` order by c.contractStartDate desc, ifnull(c.contractEndDate, 99999999) desc,
|
: `order by c.contractStartDate desc, ifnull(c.contractEndDate, 99999999) desc,
|
||||||
l.burialSiteNameSegment1,
|
l.burialSiteNameSegment1,
|
||||||
l.burialSiteNameSegment2,
|
l.burialSiteNameSegment2,
|
||||||
l.burialSiteNameSegment3,
|
l.burialSiteNameSegment3,
|
||||||
l.burialSiteNameSegment4,
|
l.burialSiteNameSegment4,
|
||||||
l.burialSiteNameSegment5,
|
l.burialSiteNameSegment5,
|
||||||
c.burialSiteId, c.contractId desc`
|
c.burialSiteId, c.contractId desc`
|
||||||
}
|
}
|
||||||
${sqlLimitClause}`
|
${isLimited ? ` limit ${options.limit} offset ${options.offset}` : ''}`
|
||||||
)
|
)
|
||||||
.all(sqlParameters) as Contract[]
|
.all(sqlParameters) as Contract[]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ export default function getNextWorkOrderNumber(connectedDatabase) {
|
||||||
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true });
|
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true });
|
||||||
const paddingLength = getConfigProperty('settings.workOrders.workOrderNumberLength');
|
const paddingLength = getConfigProperty('settings.workOrders.workOrderNumberLength');
|
||||||
const currentYearString = new Date().getFullYear().toString();
|
const currentYearString = new Date().getFullYear().toString();
|
||||||
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
||||||
const regex = new RegExp(`^${currentYearString}-\\d+$`);
|
const regex = new RegExp(`^${currentYearString}-\\d+$`);
|
||||||
database.function(
|
database.function(
|
||||||
// eslint-disable-next-line no-secrets/no-secrets
|
// eslint-disable-next-line no-secrets/no-secrets
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ export default function getNextWorkOrderNumber(
|
||||||
)
|
)
|
||||||
const currentYearString = new Date().getFullYear().toString()
|
const currentYearString = new Date().getFullYear().toString()
|
||||||
|
|
||||||
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
||||||
const regex = new RegExp(`^${currentYearString}-\\d+$`)
|
const regex = new RegExp(`^${currentYearString}-\\d+$`)
|
||||||
|
|
||||||
database.function(
|
database.function(
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,9 @@ export async function getWorkOrders(filters, options, connectedDatabase) {
|
||||||
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters);
|
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters);
|
||||||
const count = database
|
const count = database
|
||||||
.prepare(`select count(*) as recordCount
|
.prepare(`select count(*) as recordCount
|
||||||
from WorkOrders w
|
from WorkOrders w
|
||||||
${sqlWhereClause}`)
|
${sqlWhereClause}`)
|
||||||
.pluck()
|
.get(sqlParameters).recordCount;
|
||||||
.get(sqlParameters);
|
|
||||||
let workOrders = [];
|
let workOrders = [];
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
workOrders = database
|
workOrders = database
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,15 @@ export async function getWorkOrders(
|
||||||
|
|
||||||
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters)
|
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters)
|
||||||
|
|
||||||
const count: number = database
|
const count: number = (
|
||||||
.prepare(
|
database
|
||||||
`select count(*) as recordCount
|
.prepare(
|
||||||
from WorkOrders w
|
`select count(*) as recordCount
|
||||||
${sqlWhereClause}`
|
from WorkOrders w
|
||||||
)
|
${sqlWhereClause}`
|
||||||
.pluck()
|
)
|
||||||
.get(sqlParameters) as number
|
.get(sqlParameters) as { recordCount: number }
|
||||||
|
).recordCount
|
||||||
|
|
||||||
let workOrders: WorkOrder[] = []
|
let workOrders: WorkOrder[] = []
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||||
/* eslint-disable @typescript-eslint/no-magic-numbers, max-lines, no-secrets/no-secrets */
|
/* eslint-disable max-lines, no-secrets/no-secrets */
|
||||||
import sqlite from 'better-sqlite3';
|
import sqlite from 'better-sqlite3';
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import { DEBUG_NAMESPACE } from '../debug.config.js';
|
import { DEBUG_NAMESPACE } from '../debug.config.js';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||||
/* eslint-disable @typescript-eslint/no-magic-numbers, max-lines, no-secrets/no-secrets */
|
/* eslint-disable max-lines, no-secrets/no-secrets */
|
||||||
|
|
||||||
import sqlite from 'better-sqlite3'
|
import sqlite from 'better-sqlite3'
|
||||||
import Debug from 'debug'
|
import Debug from 'debug'
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ export default function reopenWorkOrder(workOrderId, user) {
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`update WorkOrders
|
.prepare(`update WorkOrders
|
||||||
set workOrderCloseDate = null,
|
set workOrderCloseDate = null,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where workOrderId = ?
|
where workOrderId = ?
|
||||||
and workOrderCloseDate is not null`)
|
and workOrderCloseDate is not null`)
|
||||||
.run(user.userName, Date.now(), workOrderId);
|
.run(user.userName, Date.now(), workOrderId);
|
||||||
database.close();
|
database.close();
|
||||||
return result.changes > 0;
|
return result.changes > 0;
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ export default function reopenWorkOrder(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update WorkOrders
|
`update WorkOrders
|
||||||
set workOrderCloseDate = null,
|
set workOrderCloseDate = null,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where workOrderId = ?
|
where workOrderId = ?
|
||||||
and workOrderCloseDate is not null`
|
and workOrderCloseDate is not null`
|
||||||
)
|
)
|
||||||
.run(user.userName, Date.now(), workOrderId)
|
.run(user.userName, Date.now(), workOrderId)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,24 +34,24 @@ export default function updateBurialSite(updateForm, user) {
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`update BurialSites
|
.prepare(`update BurialSites
|
||||||
set burialSiteNameSegment1 = ?,
|
set burialSiteNameSegment1 = ?,
|
||||||
burialSiteNameSegment2 = ?,
|
burialSiteNameSegment2 = ?,
|
||||||
burialSiteNameSegment3 = ?,
|
burialSiteNameSegment3 = ?,
|
||||||
burialSiteNameSegment4 = ?,
|
burialSiteNameSegment4 = ?,
|
||||||
burialSiteNameSegment5 = ?,
|
burialSiteNameSegment5 = ?,
|
||||||
burialSiteName = ?,
|
burialSiteName = ?,
|
||||||
burialSiteTypeId = ?,
|
burialSiteTypeId = ?,
|
||||||
burialSiteStatusId = ?,
|
burialSiteStatusId = ?,
|
||||||
bodyCapacity = ?,
|
bodyCapacity = ?,
|
||||||
crematedCapacity = ?,
|
crematedCapacity = ?,
|
||||||
cemeteryId = ?,
|
cemeteryId = ?,
|
||||||
cemeterySvgId = ?,
|
cemeterySvgId = ?,
|
||||||
burialSiteImage = ?,
|
burialSiteImage = ?,
|
||||||
burialSiteLatitude = ?,
|
burialSiteLatitude = ?,
|
||||||
burialSiteLongitude = ?,
|
burialSiteLongitude = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`)
|
and recordDelete_timeMillis is null`)
|
||||||
.run(updateForm.burialSiteNameSegment1 ?? '', updateForm.burialSiteNameSegment2 ?? '', updateForm.burialSiteNameSegment3 ?? '', updateForm.burialSiteNameSegment4 ?? '', updateForm.burialSiteNameSegment5 ?? '', burialSiteName, 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.bodyCapacity === '' ? undefined : updateForm.bodyCapacity, updateForm.crematedCapacity === ''
|
: updateForm.burialSiteStatusId, updateForm.bodyCapacity === '' ? undefined : updateForm.bodyCapacity, updateForm.crematedCapacity === ''
|
||||||
|
|
@ -83,10 +83,10 @@ export function updateBurialSiteStatus(burialSiteId, burialSiteStatusId, user) {
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`update BurialSites
|
.prepare(`update BurialSites
|
||||||
set burialSiteStatusId = ?,
|
set burialSiteStatusId = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`)
|
and recordDelete_timeMillis is null`)
|
||||||
.run(burialSiteStatusId === '' ? undefined : burialSiteStatusId, user.userName, rightNowMillis, burialSiteId);
|
.run(burialSiteStatusId === '' ? undefined : burialSiteStatusId, user.userName, rightNowMillis, burialSiteId);
|
||||||
database.close();
|
database.close();
|
||||||
return result.changes > 0;
|
return result.changes > 0;
|
||||||
|
|
|
||||||
|
|
@ -76,24 +76,24 @@ export default function updateBurialSite(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSites
|
`update BurialSites
|
||||||
set burialSiteNameSegment1 = ?,
|
set burialSiteNameSegment1 = ?,
|
||||||
burialSiteNameSegment2 = ?,
|
burialSiteNameSegment2 = ?,
|
||||||
burialSiteNameSegment3 = ?,
|
burialSiteNameSegment3 = ?,
|
||||||
burialSiteNameSegment4 = ?,
|
burialSiteNameSegment4 = ?,
|
||||||
burialSiteNameSegment5 = ?,
|
burialSiteNameSegment5 = ?,
|
||||||
burialSiteName = ?,
|
burialSiteName = ?,
|
||||||
burialSiteTypeId = ?,
|
burialSiteTypeId = ?,
|
||||||
burialSiteStatusId = ?,
|
burialSiteStatusId = ?,
|
||||||
bodyCapacity = ?,
|
bodyCapacity = ?,
|
||||||
crematedCapacity = ?,
|
crematedCapacity = ?,
|
||||||
cemeteryId = ?,
|
cemeteryId = ?,
|
||||||
cemeterySvgId = ?,
|
cemeterySvgId = ?,
|
||||||
burialSiteImage = ?,
|
burialSiteImage = ?,
|
||||||
burialSiteLatitude = ?,
|
burialSiteLatitude = ?,
|
||||||
burialSiteLongitude = ?,
|
burialSiteLongitude = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`
|
and recordDelete_timeMillis is null`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
updateForm.burialSiteNameSegment1 ?? '',
|
updateForm.burialSiteNameSegment1 ?? '',
|
||||||
|
|
@ -174,10 +174,10 @@ export function updateBurialSiteStatus(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSites
|
`update BurialSites
|
||||||
set burialSiteStatusId = ?,
|
set burialSiteStatusId = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`
|
and recordDelete_timeMillis is null`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
burialSiteStatusId === '' ? undefined : burialSiteStatusId,
|
burialSiteStatusId === '' ? undefined : burialSiteStatusId,
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@ export default function updateBurialSiteTypeField(updateForm, user) {
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`update BurialSiteTypeFields
|
.prepare(`update BurialSiteTypeFields
|
||||||
set burialSiteTypeField = ?,
|
set burialSiteTypeField = ?,
|
||||||
isRequired = ?,
|
isRequired = ?,
|
||||||
fieldType = ?,
|
fieldType = ?,
|
||||||
minLength = ?,
|
minLength = ?,
|
||||||
maxLength = ?,
|
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.minLength ?? 0, updateForm.maxLength ?? 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.close();
|
database.close();
|
||||||
clearCacheByTableName('BurialSiteTypeFields');
|
clearCacheByTableName('BurialSiteTypeFields');
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { clearCacheByTableName } from '../helpers/functions.cache.js'
|
||||||
|
|
||||||
export interface UpdateBurialSiteTypeFieldForm {
|
export interface UpdateBurialSiteTypeFieldForm {
|
||||||
burialSiteTypeFieldId: number | string
|
burialSiteTypeFieldId: number | string
|
||||||
|
|
||||||
burialSiteTypeField: string
|
burialSiteTypeField: string
|
||||||
isRequired: '0' | '1'
|
isRequired: '0' | '1'
|
||||||
|
|
||||||
|
|
@ -27,16 +26,16 @@ export default function updateBurialSiteTypeField(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSiteTypeFields
|
`update BurialSiteTypeFields
|
||||||
set burialSiteTypeField = ?,
|
set burialSiteTypeField = ?,
|
||||||
isRequired = ?,
|
isRequired = ?,
|
||||||
fieldType = ?,
|
fieldType = ?,
|
||||||
minLength = ?,
|
minLength = ?,
|
||||||
maxLength = ?,
|
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(
|
.run(
|
||||||
updateForm.burialSiteTypeField,
|
updateForm.burialSiteTypeField,
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ export default function updateContractFeeQuantity(feeQuantityForm, user) {
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`update ContractFees
|
.prepare(`update ContractFees
|
||||||
set quantity = ?,
|
set quantity = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId = ?
|
and contractId = ?
|
||||||
and feeId = ?`)
|
and feeId = ?`)
|
||||||
.run(feeQuantityForm.quantity, user.userName, Date.now(), feeQuantityForm.contractId, feeQuantityForm.feeId);
|
.run(feeQuantityForm.quantity, user.userName, Date.now(), feeQuantityForm.contractId, feeQuantityForm.feeId);
|
||||||
database.close();
|
database.close();
|
||||||
return result.changes > 0;
|
return result.changes > 0;
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ export default function updateContractFeeQuantity(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ContractFees
|
`update ContractFees
|
||||||
set quantity = ?,
|
set quantity = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId = ?
|
and contractId = ?
|
||||||
and feeId = ?`
|
and feeId = ?`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
feeQuantityForm.quantity,
|
feeQuantityForm.quantity,
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,23 @@ export default function updateContractInterment(contractForm, user) {
|
||||||
const results = database
|
const results = database
|
||||||
.prepare(`update ContractInterments
|
.prepare(`update ContractInterments
|
||||||
set deceasedName = ?,
|
set deceasedName = ?,
|
||||||
deceasedAddress1 = ?,
|
deceasedAddress1 = ?,
|
||||||
deceasedAddress2 = ?,
|
deceasedAddress2 = ?,
|
||||||
deceasedCity = ?,
|
deceasedCity = ?,
|
||||||
deceasedProvince = ?,
|
deceasedProvince = ?,
|
||||||
deceasedPostalCode = ?,
|
deceasedPostalCode = ?,
|
||||||
birthDate = ?,
|
birthDate = ?,
|
||||||
birthPlace = ?,
|
birthPlace = ?,
|
||||||
deathDate = ?,
|
deathDate = ?,
|
||||||
deathPlace = ?,
|
deathPlace = ?,
|
||||||
deathAge = ?,
|
deathAge = ?,
|
||||||
deathAgePeriod = ?,
|
deathAgePeriod = ?,
|
||||||
intermentContainerTypeId = ?,
|
intermentContainerTypeId = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId = ?
|
and contractId = ?
|
||||||
and intermentNumber = ?`)
|
and intermentNumber = ?`)
|
||||||
.run(contractForm.deceasedName, contractForm.deceasedAddress1, contractForm.deceasedAddress2, contractForm.deceasedCity, contractForm.deceasedProvince, contractForm.deceasedPostalCode, contractForm.birthDateString === ''
|
.run(contractForm.deceasedName, contractForm.deceasedAddress1, contractForm.deceasedAddress2, contractForm.deceasedCity, contractForm.deceasedProvince, contractForm.deceasedPostalCode, contractForm.birthDateString === ''
|
||||||
? undefined
|
? undefined
|
||||||
: dateStringToInteger(contractForm.birthDateString), contractForm.birthPlace, contractForm.deathDateString === ''
|
: dateStringToInteger(contractForm.birthDateString), contractForm.birthPlace, contractForm.deathDateString === ''
|
||||||
|
|
|
||||||
|
|
@ -36,23 +36,23 @@ export default function updateContractInterment(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ContractInterments
|
`update ContractInterments
|
||||||
set deceasedName = ?,
|
set deceasedName = ?,
|
||||||
deceasedAddress1 = ?,
|
deceasedAddress1 = ?,
|
||||||
deceasedAddress2 = ?,
|
deceasedAddress2 = ?,
|
||||||
deceasedCity = ?,
|
deceasedCity = ?,
|
||||||
deceasedProvince = ?,
|
deceasedProvince = ?,
|
||||||
deceasedPostalCode = ?,
|
deceasedPostalCode = ?,
|
||||||
birthDate = ?,
|
birthDate = ?,
|
||||||
birthPlace = ?,
|
birthPlace = ?,
|
||||||
deathDate = ?,
|
deathDate = ?,
|
||||||
deathPlace = ?,
|
deathPlace = ?,
|
||||||
deathAge = ?,
|
deathAge = ?,
|
||||||
deathAgePeriod = ?,
|
deathAgePeriod = ?,
|
||||||
intermentContainerTypeId = ?,
|
intermentContainerTypeId = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?
|
recordUpdate_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId = ?
|
and contractId = ?
|
||||||
and intermentNumber = ?`
|
and intermentNumber = ?`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
contractForm.deceasedName,
|
contractForm.deceasedName,
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,11 @@ export default async function handler(
|
||||||
|
|
||||||
response.json({
|
response.json({
|
||||||
success: true,
|
success: true,
|
||||||
|
|
||||||
fileName
|
fileName
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
response.json({
|
response.json({
|
||||||
success: false,
|
success: false,
|
||||||
|
|
||||||
errorMessage: 'Unable to write backup file.'
|
errorMessage: 'Unable to write backup file.'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,2 @@
|
||||||
import type { Request, Response } from 'express';
|
import type { Request, Response } from 'express';
|
||||||
export default function handler(request: Request<{
|
export default function handler(request: Request, response: Response): Promise<void>;
|
||||||
cemeteryId: string;
|
|
||||||
}>, response: Response): Promise<void>;
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||||
import { getCemeterySVGs } from '../../helpers/images.helpers.js'
|
import { getCemeterySVGs } from '../../helpers/images.helpers.js'
|
||||||
|
|
||||||
export default async function handler(
|
export default async function handler(
|
||||||
request: Request<{ cemeteryId: string }>,
|
request: Request,
|
||||||
response: Response
|
response: Response
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const cemetery = getCemetery(request.params.cemeteryId)
|
const cemetery = getCemetery(request.params.cemeteryId)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,2 @@
|
||||||
import type { Request, Response } from 'express';
|
import type { Request, Response } from 'express';
|
||||||
export default function handler(request: Request<{
|
export default function handler(request: Request, response: Response): void;
|
||||||
cemeteryId: string;
|
|
||||||
}>, response: Response): void;
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,7 @@ import type { Request, Response } from 'express'
|
||||||
import getPreviousCemeteryId from '../../database/getPreviousCemeteryId.js'
|
import getPreviousCemeteryId from '../../database/getPreviousCemeteryId.js'
|
||||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||||
|
|
||||||
export default function handler(
|
export default function handler(request: Request, response: Response): void {
|
||||||
request: Request<{ cemeteryId: string }>,
|
|
||||||
response: Response
|
|
||||||
): void {
|
|
||||||
const cemeteryId = Number.parseInt(request.params.cemeteryId, 10)
|
const cemeteryId = Number.parseInt(request.params.cemeteryId, 10)
|
||||||
|
|
||||||
const previousCemeteryId = getPreviousCemeteryId(cemeteryId)
|
const previousCemeteryId = getPreviousCemeteryId(cemeteryId)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,2 @@
|
||||||
import type { Request, Response } from 'express';
|
import type { Request, Response } from 'express';
|
||||||
export default function handler(request: Request<{
|
export default function handler(request: Request, response: Response): void;
|
||||||
cemeteryId: string;
|
|
||||||
}>, response: Response): void;
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,7 @@ import getBurialSiteTypeSummary from '../../database/getBurialSiteTypeSummary.js
|
||||||
import getCemetery from '../../database/getCemetery.js'
|
import getCemetery from '../../database/getCemetery.js'
|
||||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||||
|
|
||||||
export default function handler(
|
export default function handler(request: Request, response: Response): void {
|
||||||
request: Request<{ cemeteryId: string }>,
|
|
||||||
response: Response
|
|
||||||
): void {
|
|
||||||
const cemetery = getCemetery(request.params.cemeteryId)
|
const cemetery = getCemetery(request.params.cemeteryId)
|
||||||
|
|
||||||
if (cemetery === undefined) {
|
if (cemetery === undefined) {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export default function handler(request, response) {
|
||||||
});
|
});
|
||||||
if (success) {
|
if (success) {
|
||||||
response.on('finish', () => {
|
response.on('finish', () => {
|
||||||
clearNextPreviousBurialSiteIdCache();
|
clearNextPreviousBurialSiteIdCache(-1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export default function handler(
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
response.on('finish', () => {
|
response.on('finish', () => {
|
||||||
clearNextPreviousBurialSiteIdCache()
|
clearNextPreviousBurialSiteIdCache(-1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
|
|
||||||
import type { Request, Response } from 'express'
|
import type { Request, Response } from 'express'
|
||||||
|
|
||||||
|
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
|
||||||
|
|
||||||
import getBurialSite from '../../database/getBurialSite.js'
|
import getBurialSite from '../../database/getBurialSite.js'
|
||||||
import getBurialSiteDirectionsOfArrival, { defaultDirectionsOfArrival } from '../../database/getBurialSiteDirectionsOfArrival.js'
|
import getBurialSiteDirectionsOfArrival, { defaultDirectionsOfArrival } from '../../database/getBurialSiteDirectionsOfArrival.js'
|
||||||
import getCemeteries from '../../database/getCemeteries.js'
|
import getCemeteries from '../../database/getCemeteries.js'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { dateToString } from '@cityssm/utils-datetime'
|
|
||||||
import type { Request, Response } from 'express'
|
import type { Request, Response } from 'express'
|
||||||
|
|
||||||
|
import { dateToString } from '@cityssm/utils-datetime'
|
||||||
|
|
||||||
import getWorkOrderMilestones from '../../database/getWorkOrderMilestones.js'
|
import getWorkOrderMilestones from '../../database/getWorkOrderMilestones.js'
|
||||||
|
|
||||||
export default async function handler(
|
export default async function handler(
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
|
import type { NextFunction, Request, Response } from 'express'
|
||||||
|
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
|
||||||
import { convertHTMLToPDF } from '@cityssm/pdf-puppeteer'
|
import { convertHTMLToPDF } from '@cityssm/pdf-puppeteer'
|
||||||
import camelcase from 'camelcase'
|
import camelcase from 'camelcase'
|
||||||
import { renderFile as renderEjsFile } from 'ejs'
|
import { renderFile as renderEjsFile } from 'ejs'
|
||||||
import type { NextFunction, Request, Response } from 'express'
|
|
||||||
|
|
||||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import type { Request, Response } from 'express'
|
import type { Request, Response } from 'express'
|
||||||
|
|
||||||
import papaParse from 'papaparse'
|
import papaParse from 'papaparse'
|
||||||
|
|
||||||
import getReportData, {
|
import getReportData, {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { dateToString } from '@cityssm/utils-datetime'
|
|
||||||
import type { Request, Response } from 'express'
|
import type { Request, Response } from 'express'
|
||||||
|
|
||||||
|
import { dateToString } from '@cityssm/utils-datetime'
|
||||||
|
|
||||||
import getCemeteries from '../../database/getCemeteries.js'
|
import getCemeteries from '../../database/getCemeteries.js'
|
||||||
import {
|
import {
|
||||||
getBurialSiteStatuses,
|
getBurialSiteStatuses,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
|
|
||||||
import type { Request, Response } from 'express'
|
import type { Request, Response } from 'express'
|
||||||
|
|
||||||
|
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
|
||||||
|
|
||||||
import { getWorkOrderTypes } from '../../helpers/functions.cache.js'
|
import { getWorkOrderTypes } from '../../helpers/functions.cache.js'
|
||||||
import type { WorkOrder } from '../../types/record.types.js'
|
import type { WorkOrder } from '../../types/record.types.js'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const birthDate = new Date(birthDateStringElement.value);
|
const birthDate = new Date(birthDateStringElement.value);
|
||||||
const deathDate = new Date(deathDateStringElement.value);
|
const deathDate = new Date(deathDateStringElement.value);
|
||||||
const ageInDays = Math.floor((deathDate.getTime() - birthDate.getTime()) / (1000 * 60 * 60 * 24));
|
const ageInDays = Math.floor((deathDate.getTime() - birthDate.getTime()) / (1000 * 60 * 60 * 24));
|
||||||
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
||||||
const ageInYears = Math.floor(ageInDays / 365.25);
|
const ageInYears = Math.floor(ageInDays / 365.25);
|
||||||
if (ageInYears > 0) {
|
if (ageInYears > 0) {
|
||||||
deathAgeElement.value = ageInYears.toString();
|
deathAgeElement.value = ageInYears.toString();
|
||||||
|
|
@ -190,9 +189,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Interment?',
|
title: 'Delete Interment?',
|
||||||
message: 'Are you sure you want to remove this interment from the contract?',
|
message: 'Are you sure you want to remove this interment from the contract?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
text: 'Yes, Remove Interment',
|
text: 'Yes, Remove Interment',
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ declare const exports: Record<string, unknown>
|
||||||
(deathDate.getTime() - birthDate.getTime()) / (1000 * 60 * 60 * 24)
|
(deathDate.getTime() - birthDate.getTime()) / (1000 * 60 * 60 * 24)
|
||||||
)
|
)
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
||||||
const ageInYears = Math.floor(ageInDays / 365.25)
|
const ageInYears = Math.floor(ageInDays / 365.25)
|
||||||
|
|
||||||
if (ageInYears > 0) {
|
if (ageInYears > 0) {
|
||||||
|
|
@ -315,15 +314,12 @@ declare const exports: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Interment?',
|
title: 'Delete Interment?',
|
||||||
|
|
||||||
message:
|
message:
|
||||||
'Are you sure you want to remove this interment from the contract?',
|
'Are you sure you want to remove this interment from the contract?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
text: 'Yes, Remove Interment',
|
text: 'Yes, Remove Interment',
|
||||||
|
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'danger',
|
|
||||||
title: 'Error Creating Work Order',
|
title: 'Error Creating Work Order',
|
||||||
message: responseJSON.errorMessage,
|
message: responseJSON.errorMessage,
|
||||||
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,9 @@ declare const exports: Record<string, unknown>
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'danger',
|
|
||||||
title: 'Error Creating Work Order',
|
title: 'Error Creating Work Order',
|
||||||
|
|
||||||
message: responseJSON.errorMessage as string,
|
message: responseJSON.errorMessage as string,
|
||||||
|
contextualColorName: 'danger'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'danger',
|
title: "Error Updating Contract Type",
|
||||||
title: 'Error Updating Contract Type',
|
message: responseJSON.errorMessage ?? '',
|
||||||
message: responseJSON.errorMessage ?? ''
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -53,12 +53,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}, contractTypeResponseHandler);
|
}, contractTypeResponseHandler);
|
||||||
}
|
}
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
|
title: "Delete Contract Type",
|
||||||
|
message: "Are you sure you want to delete this contract type?",
|
||||||
contextualColorName: 'warning',
|
contextualColorName: 'warning',
|
||||||
title: 'Delete Contract Type',
|
|
||||||
message: 'Are you sure you want to delete this contract type?',
|
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doDelete,
|
text: "Yes, Delete Contract Type",
|
||||||
text: 'Yes, Delete Contract Type'
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -206,13 +206,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
function confirmDoDelete() {
|
function confirmDoDelete() {
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Field',
|
title: 'Delete Field',
|
||||||
message: `Are you sure you want to delete this field?
|
message: 'Are you sure you want to delete this field? Note that historical records that make use of this field will not be affected.',
|
||||||
Note that historical records that make use of this field will not be affected.`,
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doDelete,
|
text: 'Yes, Delete Field',
|
||||||
text: 'Yes, Delete Field'
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -373,12 +372,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}, contractTypeResponseHandler);
|
}, contractTypeResponseHandler);
|
||||||
}
|
}
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Print',
|
title: 'Delete Print',
|
||||||
message: 'Are you sure you want to remove this print option?',
|
message: 'Are you sure you want to remove this print option?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doDelete,
|
text: 'Yes, Remove Print',
|
||||||
text: 'Yes, Remove Print'
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -589,7 +588,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Adding Contract Type',
|
title: "Error Adding Contract Type",
|
||||||
message: responseJSON.errorMessage ?? '',
|
message: responseJSON.errorMessage ?? '',
|
||||||
contextualColorName: 'danger'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,9 @@ type ResponseJSON =
|
||||||
renderContractTypes()
|
renderContractTypes()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'danger',
|
title: "Error Updating Contract Type",
|
||||||
title: 'Error Updating Contract Type',
|
message: responseJSON.errorMessage ?? '',
|
||||||
|
contextualColorName: 'danger'
|
||||||
message: responseJSON.errorMessage ?? ''
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -118,13 +117,12 @@ type ResponseJSON =
|
||||||
}
|
}
|
||||||
|
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
|
title: "Delete Contract Type",
|
||||||
|
message: "Are you sure you want to delete this contract type?",
|
||||||
contextualColorName: 'warning',
|
contextualColorName: 'warning',
|
||||||
title: 'Delete Contract Type',
|
|
||||||
|
|
||||||
message: 'Are you sure you want to delete this contract type?',
|
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doDelete,
|
text: "Yes, Delete Contract Type",
|
||||||
text: 'Yes, Delete Contract Type'
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +195,6 @@ type ResponseJSON =
|
||||||
|
|
||||||
bulmaJS.toggleHtmlClipped()
|
bulmaJS.toggleHtmlClipped()
|
||||||
},
|
},
|
||||||
|
|
||||||
onremoved() {
|
onremoved() {
|
||||||
bulmaJS.toggleHtmlClipped()
|
bulmaJS.toggleHtmlClipped()
|
||||||
}
|
}
|
||||||
|
|
@ -263,7 +260,6 @@ type ResponseJSON =
|
||||||
|
|
||||||
bulmaJS.toggleHtmlClipped()
|
bulmaJS.toggleHtmlClipped()
|
||||||
},
|
},
|
||||||
|
|
||||||
onremoved() {
|
onremoved() {
|
||||||
bulmaJS.toggleHtmlClipped()
|
bulmaJS.toggleHtmlClipped()
|
||||||
}
|
}
|
||||||
|
|
@ -389,14 +385,13 @@ type ResponseJSON =
|
||||||
|
|
||||||
function confirmDoDelete(): void {
|
function confirmDoDelete(): void {
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Field',
|
title: 'Delete Field',
|
||||||
|
message:
|
||||||
message: `Are you sure you want to delete this field?
|
'Are you sure you want to delete this field? Note that historical records that make use of this field will not be affected.',
|
||||||
Note that historical records that make use of this field will not be affected.`,
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doDelete,
|
text: 'Yes, Delete Field',
|
||||||
text: 'Yes, Delete Field'
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -472,7 +467,6 @@ type ResponseJSON =
|
||||||
.querySelector('#button--deleteContractTypeField')
|
.querySelector('#button--deleteContractTypeField')
|
||||||
?.addEventListener('click', confirmDoDelete)
|
?.addEventListener('click', confirmDoDelete)
|
||||||
},
|
},
|
||||||
|
|
||||||
onremoved() {
|
onremoved() {
|
||||||
bulmaJS.toggleHtmlClipped()
|
bulmaJS.toggleHtmlClipped()
|
||||||
cityssm.disableNavBlocker()
|
cityssm.disableNavBlocker()
|
||||||
|
|
@ -712,13 +706,12 @@ type ResponseJSON =
|
||||||
}
|
}
|
||||||
|
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Print',
|
title: 'Delete Print',
|
||||||
|
|
||||||
message: 'Are you sure you want to remove this print option?',
|
message: 'Are you sure you want to remove this print option?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doDelete,
|
text: 'Yes, Remove Print',
|
||||||
text: 'Yes, Remove Print'
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -1024,7 +1017,7 @@ type ResponseJSON =
|
||||||
renderContractTypes()
|
renderContractTypes()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Adding Contract Type',
|
title: "Error Adding Contract Type",
|
||||||
message: responseJSON.errorMessage ?? '',
|
message: responseJSON.errorMessage ?? '',
|
||||||
contextualColorName: 'danger'
|
contextualColorName: 'danger'
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -31,16 +31,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'success',
|
message: 'Work Order Updated Successfully',
|
||||||
message: 'Work Order Updated Successfully'
|
contextualColorName: 'success'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'danger',
|
|
||||||
title: 'Error Updating Work Order',
|
title: 'Error Updating Work Order',
|
||||||
message: responseJSON.errorMessage ?? ''
|
message: responseJSON.errorMessage ?? '',
|
||||||
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -81,9 +81,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'danger',
|
|
||||||
title: 'Error Deleting Work Order',
|
title: 'Error Deleting Work Order',
|
||||||
message: responseJSON.errorMessage ?? ''
|
message: responseJSON.errorMessage ?? '',
|
||||||
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -95,10 +95,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const hasOpenMilestones = workOrderMilestones.some((milestone) => !milestone.workOrderMilestoneCompletionDate);
|
const hasOpenMilestones = workOrderMilestones.some((milestone) => !milestone.workOrderMilestoneCompletionDate);
|
||||||
if (hasOpenMilestones) {
|
if (hasOpenMilestones) {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Outstanding Milestones',
|
title: 'Outstanding Milestones',
|
||||||
message: `You cannot close a work order with outstanding milestones.
|
message: `You cannot close a work order with outstanding milestones.
|
||||||
Either complete the outstanding milestones, or remove them from the work order.`
|
Either complete the outstanding milestones, or remove them from the work order.`,
|
||||||
|
contextualColorName: 'warning'
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
// Disable closing work orders with open milestones
|
// Disable closing work orders with open milestones
|
||||||
|
|
@ -116,14 +116,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: sunrise.hasUnsavedChanges() ? 'warning' : 'info',
|
|
||||||
title: 'Close Work Order',
|
title: 'Close Work Order',
|
||||||
message: sunrise.hasUnsavedChanges()
|
message: sunrise.hasUnsavedChanges()
|
||||||
? 'Are you sure you want to close this work order with unsaved changes?'
|
? 'Are you sure you want to close this work order with unsaved changes?'
|
||||||
: 'Are you sure you want to close this work order?',
|
: 'Are you sure you want to close this work order?',
|
||||||
|
contextualColorName: sunrise.hasUnsavedChanges() ? 'warning' : 'info',
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doClose,
|
text: 'Yes, Close Work Order',
|
||||||
text: 'Yes, Close Work Order'
|
callbackFunction: doClose
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -133,9 +133,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
?.addEventListener('click', (clickEvent) => {
|
?.addEventListener('click', (clickEvent) => {
|
||||||
clickEvent.preventDefault();
|
clickEvent.preventDefault();
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Work Order',
|
title: 'Delete Work Order',
|
||||||
message: 'Are you sure you want to delete this work order?',
|
message: 'Are you sure you want to delete this work order?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
text: 'Yes, Delete Work Order',
|
text: 'Yes, Delete Work Order',
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
|
|
@ -243,12 +243,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}, processMilestoneResponse);
|
}, processMilestoneResponse);
|
||||||
}
|
}
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Reopen Milestone',
|
title: 'Reopen Milestone',
|
||||||
message: 'Are you sure you want to remove the completion status from this milestone, and reopen it?',
|
message: 'Are you sure you want to remove the completion status from this milestone, and reopen it?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doReopen,
|
|
||||||
text: 'Yes, Reopen Milestone',
|
text: 'Yes, Reopen Milestone',
|
||||||
|
callbackFunction: doReopen
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -262,9 +262,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}, processMilestoneResponse);
|
}, processMilestoneResponse);
|
||||||
}
|
}
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Milestone',
|
title: 'Delete Milestone',
|
||||||
message: 'Are you sure you want to delete this milestone?',
|
message: 'Are you sure you want to delete this milestone?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
text: 'Yes, Delete Milestone',
|
text: 'Yes, Delete Milestone',
|
||||||
callbackFunction: doDeleteMilestone
|
callbackFunction: doDeleteMilestone
|
||||||
|
|
@ -442,27 +442,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let addFormElement;
|
let addFormElement;
|
||||||
let workOrderMilestoneDateStringElement;
|
let workOrderMilestoneDateStringElement;
|
||||||
let addCloseModalFunction;
|
let addCloseModalFunction;
|
||||||
function _doAdd() {
|
function doAdd(submitEvent) {
|
||||||
cityssm.postJSON(`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`, addFormElement, (rawResponseJSON) => {
|
|
||||||
const responseJSON = rawResponseJSON;
|
|
||||||
processMilestoneResponse(responseJSON);
|
|
||||||
if (responseJSON.success) {
|
|
||||||
addCloseModalFunction();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function doAddFormSubmit(submitEvent) {
|
|
||||||
if (submitEvent) {
|
if (submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
}
|
}
|
||||||
const currentDateString = cityssm.dateToString(new Date());
|
const currentDateString = cityssm.dateToString(new Date());
|
||||||
|
function _doAdd() {
|
||||||
|
cityssm.postJSON(`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`, addFormElement, (rawResponseJSON) => {
|
||||||
|
const responseJSON = rawResponseJSON;
|
||||||
|
processMilestoneResponse(responseJSON);
|
||||||
|
if (responseJSON.success) {
|
||||||
|
addCloseModalFunction();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
const milestoneDateString = workOrderMilestoneDateStringElement.value;
|
const milestoneDateString = workOrderMilestoneDateStringElement.value;
|
||||||
if (milestoneDateString !== '' &&
|
if (milestoneDateString !== '' &&
|
||||||
milestoneDateString < currentDateString) {
|
milestoneDateString < currentDateString) {
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Milestone Date in the Past',
|
title: 'Milestone Date in the Past',
|
||||||
message: 'Are you sure you want to create a milestone with a date in the past?',
|
message: 'Are you sure you want to create a milestone with a date in the past?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
text: 'Yes, Create a Past Milestone',
|
text: 'Yes, Create a Past Milestone',
|
||||||
callbackFunction: _doAdd
|
callbackFunction: _doAdd
|
||||||
|
|
@ -495,7 +495,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
modalElement.querySelector('#milestoneAdd--workOrderMilestoneTypeId').focus();
|
modalElement.querySelector('#milestoneAdd--workOrderMilestoneTypeId').focus();
|
||||||
addFormElement = modalElement.querySelector('form');
|
addFormElement = modalElement.querySelector('form');
|
||||||
addFormElement.addEventListener('submit', doAddFormSubmit);
|
addFormElement.addEventListener('submit', doAdd);
|
||||||
const conflictingMilestonePanelElement = document.querySelector('#milestoneAdd--conflictingMilestonesPanel');
|
const conflictingMilestonePanelElement = document.querySelector('#milestoneAdd--conflictingMilestonesPanel');
|
||||||
workOrderMilestoneDateStringElement.addEventListener('change', () => {
|
workOrderMilestoneDateStringElement.addEventListener('change', () => {
|
||||||
refreshConflictingMilestones(workOrderMilestoneDateStringElement.value, conflictingMilestonePanelElement);
|
refreshConflictingMilestones(workOrderMilestoneDateStringElement.value, conflictingMilestonePanelElement);
|
||||||
|
|
|
||||||
|
|
@ -67,16 +67,15 @@ declare const exports: Record<string, unknown>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'success',
|
message: 'Work Order Updated Successfully',
|
||||||
message: 'Work Order Updated Successfully'
|
contextualColorName: 'success'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'danger',
|
|
||||||
title: 'Error Updating Work Order',
|
title: 'Error Updating Work Order',
|
||||||
|
message: responseJSON.errorMessage ?? '',
|
||||||
message: responseJSON.errorMessage ?? ''
|
contextualColorName: 'danger'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -138,10 +137,9 @@ declare const exports: Record<string, unknown>
|
||||||
globalThis.location.href = `${sunrise.urlPrefix}/workOrders`
|
globalThis.location.href = `${sunrise.urlPrefix}/workOrders`
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'danger',
|
|
||||||
title: 'Error Deleting Work Order',
|
title: 'Error Deleting Work Order',
|
||||||
|
message: responseJSON.errorMessage ?? '',
|
||||||
message: responseJSON.errorMessage ?? ''
|
contextualColorName: 'danger'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -159,11 +157,10 @@ declare const exports: Record<string, unknown>
|
||||||
|
|
||||||
if (hasOpenMilestones) {
|
if (hasOpenMilestones) {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Outstanding Milestones',
|
title: 'Outstanding Milestones',
|
||||||
|
|
||||||
message: `You cannot close a work order with outstanding milestones.
|
message: `You cannot close a work order with outstanding milestones.
|
||||||
Either complete the outstanding milestones, or remove them from the work order.`
|
Either complete the outstanding milestones, or remove them from the work order.`,
|
||||||
|
contextualColorName: 'warning'
|
||||||
})
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -181,16 +178,14 @@ declare const exports: Record<string, unknown>
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: sunrise.hasUnsavedChanges() ? 'warning' : 'info',
|
|
||||||
title: 'Close Work Order',
|
title: 'Close Work Order',
|
||||||
|
|
||||||
message: sunrise.hasUnsavedChanges()
|
message: sunrise.hasUnsavedChanges()
|
||||||
? 'Are you sure you want to close this work order with unsaved changes?'
|
? 'Are you sure you want to close this work order with unsaved changes?'
|
||||||
: 'Are you sure you want to close this work order?',
|
: 'Are you sure you want to close this work order?',
|
||||||
|
contextualColorName: sunrise.hasUnsavedChanges() ? 'warning' : 'info',
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doClose,
|
text: 'Yes, Close Work Order',
|
||||||
text: 'Yes, Close Work Order'
|
callbackFunction: doClose
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -202,9 +197,9 @@ declare const exports: Record<string, unknown>
|
||||||
clickEvent.preventDefault()
|
clickEvent.preventDefault()
|
||||||
|
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Work Order',
|
title: 'Delete Work Order',
|
||||||
message: 'Are you sure you want to delete this work order?',
|
message: 'Are you sure you want to delete this work order?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
text: 'Yes, Delete Work Order',
|
text: 'Yes, Delete Work Order',
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
|
|
@ -383,15 +378,13 @@ declare const exports: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Reopen Milestone',
|
title: 'Reopen Milestone',
|
||||||
|
|
||||||
message:
|
message:
|
||||||
'Are you sure you want to remove the completion status from this milestone, and reopen it?',
|
'Are you sure you want to remove the completion status from this milestone, and reopen it?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
callbackFunction: doReopen,
|
|
||||||
text: 'Yes, Reopen Milestone',
|
text: 'Yes, Reopen Milestone',
|
||||||
|
callbackFunction: doReopen
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -417,9 +410,9 @@ declare const exports: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Delete Milestone',
|
title: 'Delete Milestone',
|
||||||
message: 'Are you sure you want to delete this milestone?',
|
message: 'Are you sure you want to delete this milestone?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
text: 'Yes, Delete Milestone',
|
text: 'Yes, Delete Milestone',
|
||||||
callbackFunction: doDeleteMilestone
|
callbackFunction: doDeleteMilestone
|
||||||
|
|
@ -666,7 +659,6 @@ declare const exports: Record<string, unknown>
|
||||||
panelBlockElement
|
panelBlockElement
|
||||||
.querySelector('.button--reopenMilestone')
|
.querySelector('.button--reopenMilestone')
|
||||||
?.addEventListener('click', reopenMilestone)
|
?.addEventListener('click', reopenMilestone)
|
||||||
|
|
||||||
panelBlockElement
|
panelBlockElement
|
||||||
.querySelector('.button--editMilestone')
|
.querySelector('.button--editMilestone')
|
||||||
?.addEventListener('click', editMilestone)
|
?.addEventListener('click', editMilestone)
|
||||||
|
|
@ -710,33 +702,33 @@ declare const exports: Record<string, unknown>
|
||||||
let workOrderMilestoneDateStringElement: HTMLInputElement
|
let workOrderMilestoneDateStringElement: HTMLInputElement
|
||||||
let addCloseModalFunction: () => void
|
let addCloseModalFunction: () => void
|
||||||
|
|
||||||
function _doAdd(): void {
|
function doAdd(submitEvent?: SubmitEvent): void {
|
||||||
cityssm.postJSON(
|
|
||||||
`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`,
|
|
||||||
addFormElement,
|
|
||||||
(rawResponseJSON) => {
|
|
||||||
const responseJSON = rawResponseJSON as {
|
|
||||||
success: boolean
|
|
||||||
errorMessage?: string
|
|
||||||
workOrderMilestones?: WorkOrderMilestone[]
|
|
||||||
}
|
|
||||||
|
|
||||||
processMilestoneResponse(responseJSON)
|
|
||||||
|
|
||||||
if (responseJSON.success) {
|
|
||||||
addCloseModalFunction()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function doAddFormSubmit(submitEvent?: SubmitEvent): void {
|
|
||||||
if (submitEvent) {
|
if (submitEvent) {
|
||||||
submitEvent.preventDefault()
|
submitEvent.preventDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentDateString = cityssm.dateToString(new Date())
|
const currentDateString = cityssm.dateToString(new Date())
|
||||||
|
|
||||||
|
function _doAdd(): void {
|
||||||
|
cityssm.postJSON(
|
||||||
|
`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`,
|
||||||
|
addFormElement,
|
||||||
|
(rawResponseJSON) => {
|
||||||
|
const responseJSON = rawResponseJSON as {
|
||||||
|
success: boolean
|
||||||
|
errorMessage?: string
|
||||||
|
workOrderMilestones?: WorkOrderMilestone[]
|
||||||
|
}
|
||||||
|
|
||||||
|
processMilestoneResponse(responseJSON)
|
||||||
|
|
||||||
|
if (responseJSON.success) {
|
||||||
|
addCloseModalFunction()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const milestoneDateString = workOrderMilestoneDateStringElement.value
|
const milestoneDateString = workOrderMilestoneDateStringElement.value
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
@ -744,12 +736,10 @@ declare const exports: Record<string, unknown>
|
||||||
milestoneDateString < currentDateString
|
milestoneDateString < currentDateString
|
||||||
) {
|
) {
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
contextualColorName: 'warning',
|
|
||||||
title: 'Milestone Date in the Past',
|
title: 'Milestone Date in the Past',
|
||||||
|
|
||||||
message:
|
message:
|
||||||
'Are you sure you want to create a milestone with a date in the past?',
|
'Are you sure you want to create a milestone with a date in the past?',
|
||||||
|
contextualColorName: 'warning',
|
||||||
okButton: {
|
okButton: {
|
||||||
text: 'Yes, Create a Past Milestone',
|
text: 'Yes, Create a Past Milestone',
|
||||||
callbackFunction: _doAdd
|
callbackFunction: _doAdd
|
||||||
|
|
@ -802,7 +792,7 @@ declare const exports: Record<string, unknown>
|
||||||
).focus()
|
).focus()
|
||||||
|
|
||||||
addFormElement = modalElement.querySelector('form') as HTMLFormElement
|
addFormElement = modalElement.querySelector('form') as HTMLFormElement
|
||||||
addFormElement.addEventListener('submit', doAddFormSubmit)
|
addFormElement.addEventListener('submit', doAdd)
|
||||||
|
|
||||||
const conflictingMilestonePanelElement = document.querySelector(
|
const conflictingMilestonePanelElement = document.querySelector(
|
||||||
'#milestoneAdd--conflictingMilestonesPanel'
|
'#milestoneAdd--conflictingMilestonesPanel'
|
||||||
|
|
|
||||||
|
|
@ -495,7 +495,6 @@ async function importFromPrepaidCSV() {
|
||||||
externalReceiptNumber: '',
|
externalReceiptNumber: '',
|
||||||
transactionAmount,
|
transactionAmount,
|
||||||
transactionDateString: contractStartDateString,
|
transactionDateString: contractStartDateString,
|
||||||
transactionTimeString: '00:00',
|
|
||||||
transactionNote: `Order Number: ${prepaidRow.CMPP_ORDER_NO}`
|
transactionNote: `Order Number: ${prepaidRow.CMPP_ORDER_NO}`
|
||||||
}, user);
|
}, user);
|
||||||
if (prepaidRow.CMPP_REMARK1 !== '') {
|
if (prepaidRow.CMPP_REMARK1 !== '') {
|
||||||
|
|
|
||||||
|
|
@ -794,8 +794,6 @@ async function importFromPrepaidCSV(): Promise<void> {
|
||||||
externalReceiptNumber: '',
|
externalReceiptNumber: '',
|
||||||
transactionAmount,
|
transactionAmount,
|
||||||
transactionDateString: contractStartDateString,
|
transactionDateString: contractStartDateString,
|
||||||
transactionTimeString: '00:00',
|
|
||||||
|
|
||||||
transactionNote: `Order Number: ${prepaidRow.CMPP_ORDER_NO}`
|
transactionNote: `Order Number: ${prepaidRow.CMPP_ORDER_NO}`
|
||||||
},
|
},
|
||||||
user
|
user
|
||||||
|
|
|
||||||
|
|
@ -26,60 +26,54 @@
|
||||||
Database Maintenance
|
Database Maintenance
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="columns">
|
<h2 class="title is-3">
|
||||||
<div class="column">
|
Database Backup
|
||||||
<div class="panel is-primary">
|
</h2>
|
||||||
<h2 class="panel-heading">
|
|
||||||
Database Backup
|
<div class="message is-info">
|
||||||
</h2>
|
<div class="message-body">
|
||||||
<div class="panel-block is-block">
|
<p>
|
||||||
<div class="message is-primary">
|
Before making significant changes to the records in the database,
|
||||||
<div class="message-body">
|
it is a good idea to back up first!
|
||||||
<p>
|
</p>
|
||||||
Before making significant changes to the records in the database,
|
|
||||||
it is a good idea to back up first!
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel-block is-block has-text-right">
|
|
||||||
<button class="button is-primary" id="button--backupDatabase" data-cy="backup" type="button">
|
|
||||||
<span class="icon"><i class="fas fa-save" aria-hidden="true"></i></span>
|
|
||||||
<span>Backup Database</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
<div class="panel is-warning">
|
|
||||||
<h2 class="panel-heading">
|
|
||||||
Database Cleanup
|
|
||||||
</h2>
|
|
||||||
<div class="panel-block is-block">
|
|
||||||
<div class="message is-warning">
|
|
||||||
<div class="message-body">
|
|
||||||
<p>
|
|
||||||
When records are deleted in this application, they are not removed entirely.
|
|
||||||
This gives systems administrators the ability to recover deleted records.
|
|
||||||
This also can leave a small amount of garbage behind in the database.
|
|
||||||
</p>
|
|
||||||
<p class="mt-2">
|
|
||||||
This process permanently deletes records that have already been deleted over
|
|
||||||
<%= configFunctions.getConfigProperty("settings.adminCleanup.recordDeleteAgeDays") %> days ago.
|
|
||||||
Note that no active records will be affected by the cleanup process.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel-block is-block has-text-right">
|
|
||||||
<button class="button is-warning" id="button--cleanupDatabase" data-cy="cleanup" type="button">
|
|
||||||
<span class="icon"><i class="fas fa-broom" aria-hidden="true"></i></span>
|
|
||||||
<span>Cleanup Database</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p class="has-text-right">
|
||||||
|
<button class="button is-success" id="button--backupDatabase" data-cy="backup" type="button">
|
||||||
|
<span class="icon"><i class="fas fa-save" aria-hidden="true"></i></span>
|
||||||
|
<span>Backup Database</span>
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 class="title is-3">
|
||||||
|
Database Cleanup
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div class="message is-warning">
|
||||||
|
<div class="message-header">
|
||||||
|
Important Note about Cleanup
|
||||||
|
</div>
|
||||||
|
<div class="message-body">
|
||||||
|
<p>
|
||||||
|
When records are deleted in this application, they are not removed entirely.
|
||||||
|
This gives systems administrators the ability to recover deleted records.
|
||||||
|
This also can leave a small amount of garbage behind in the database.
|
||||||
|
</p>
|
||||||
|
<p class="mt-2">
|
||||||
|
This process permanently deletes records that have already been deleted over
|
||||||
|
<%= configFunctions.getConfigProperty("settings.adminCleanup.recordDeleteAgeDays") %> days ago.
|
||||||
|
Note that no active records will be affected by the cleanup process.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="has-text-right">
|
||||||
|
<button class="button is-success" id="button--cleanupDatabase" data-cy="cleanup" type="button">
|
||||||
|
<span class="icon"><i class="fas fa-broom" aria-hidden="true"></i></span>
|
||||||
|
<span>Cleanup Database</span>
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue