Compare commits
3 Commits
dependabot
...
main
| Author | SHA1 | Date |
|---|---|---|
|
|
118fc1959b | |
|
|
9830bede34 | |
|
|
302a9a4c48 |
|
|
@ -1,2 +1,2 @@
|
|||
theme: jekyll-theme-cayman
|
||||
title: Sunrise Cemetery Management System
|
||||
title: Sunrise Cemetery Management System (CMS)
|
||||
|
|
@ -15,10 +15,10 @@ export default function addContractTransaction(contractTransactionForm, user) {
|
|||
transactionIndex = maxIndexResult.transactionIndex + 1;
|
||||
}
|
||||
const rightNow = new Date();
|
||||
const transactionDate = contractTransactionForm.transactionDateString === ''
|
||||
const transactionDate = (contractTransactionForm.transactionDateString ?? '') === ''
|
||||
? dateToInteger(rightNow)
|
||||
: dateStringToInteger(contractTransactionForm.transactionDateString);
|
||||
const transactionTime = contractTransactionForm.transactionTimeString === ''
|
||||
const transactionTime = (contractTransactionForm.transactionTimeString ?? '') === ''
|
||||
? dateToTimeInteger(rightNow)
|
||||
: timeStringToInteger(contractTransactionForm.transactionTimeString);
|
||||
database
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@ export default function addContractTransaction(
|
|||
const rightNow = new Date()
|
||||
|
||||
const transactionDate =
|
||||
contractTransactionForm.transactionDateString === ''
|
||||
(contractTransactionForm.transactionDateString ?? '') === ''
|
||||
? dateToInteger(rightNow)
|
||||
: dateStringToInteger(
|
||||
contractTransactionForm.transactionDateString as DateString
|
||||
)
|
||||
|
||||
const transactionTime =
|
||||
contractTransactionForm.transactionTimeString === ''
|
||||
(contractTransactionForm.transactionTimeString ?? '') === ''
|
||||
? dateToTimeInteger(rightNow)
|
||||
: timeStringToInteger(
|
||||
contractTransactionForm.transactionTimeString as TimeString
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ export default function getBurialSites(filters, options, connectedDatabase) {
|
|||
group by burialSiteId
|
||||
) o on l.burialSiteId = o.burialSiteId
|
||||
${sqlWhereClause}`)
|
||||
.get(sqlParameters).recordCount;
|
||||
.pluck()
|
||||
.get(sqlParameters);
|
||||
}
|
||||
let burialSites = [];
|
||||
if (options.limit === -1 || count > 0) {
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ export default function getBurialSites(
|
|||
let count = 0
|
||||
|
||||
if (options.limit !== -1) {
|
||||
count = (
|
||||
database
|
||||
count = database
|
||||
.prepare(
|
||||
`select count(*) as recordCount
|
||||
from BurialSites l
|
||||
|
|
@ -53,8 +52,8 @@ export default function getBurialSites(
|
|||
) o on l.burialSiteId = o.burialSiteId
|
||||
${sqlWhereClause}`
|
||||
)
|
||||
.get(sqlParameters) as { recordCount: number }
|
||||
).recordCount
|
||||
.pluck()
|
||||
.get(sqlParameters) as number
|
||||
}
|
||||
|
||||
let burialSites: BurialSite[] = []
|
||||
|
|
|
|||
|
|
@ -24,10 +24,14 @@ export default async function getContracts(filters, options, connectedDatabase)
|
|||
left join BurialSites l on c.burialSiteId = l.burialSiteId
|
||||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||
${sqlWhereClause}`)
|
||||
.get(sqlParameters).recordCount;
|
||||
.pluck()
|
||||
.get(sqlParameters);
|
||||
}
|
||||
let contracts = [];
|
||||
if (count !== 0) {
|
||||
const sqlLimitClause = isLimited
|
||||
? ` limit ${options.limit} offset ${options.offset}`
|
||||
: '';
|
||||
contracts = database
|
||||
.prepare(`select c.contractId,
|
||||
c.contractTypeId, t.contractType, t.isPreneed,
|
||||
|
|
@ -57,14 +61,14 @@ export default async function getContracts(filters, options, connectedDatabase)
|
|||
${sqlWhereClause}
|
||||
${options.orderBy !== undefined && 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.burialSiteNameSegment2,
|
||||
l.burialSiteNameSegment3,
|
||||
l.burialSiteNameSegment4,
|
||||
l.burialSiteNameSegment5,
|
||||
c.burialSiteId, c.contractId desc`}
|
||||
${isLimited ? ` limit ${options.limit} offset ${options.offset}` : ''}`)
|
||||
${sqlLimitClause}`)
|
||||
.all(sqlParameters);
|
||||
if (!isLimited) {
|
||||
count = contracts.length;
|
||||
|
|
|
|||
|
|
@ -81,8 +81,7 @@ export default async function getContracts(
|
|||
const isLimited = options.limit !== -1
|
||||
|
||||
if (isLimited) {
|
||||
count = (
|
||||
database
|
||||
count = database
|
||||
.prepare(
|
||||
`select count(*) as recordCount
|
||||
from Contracts c
|
||||
|
|
@ -90,13 +89,17 @@ export default async function getContracts(
|
|||
left join Cemeteries m on l.cemeteryId = m.cemeteryId
|
||||
${sqlWhereClause}`
|
||||
)
|
||||
.get(sqlParameters) as { recordCount: number }
|
||||
).recordCount
|
||||
.pluck()
|
||||
.get(sqlParameters) as number
|
||||
}
|
||||
|
||||
let contracts: Contract[] = []
|
||||
|
||||
if (count !== 0) {
|
||||
const sqlLimitClause = isLimited
|
||||
? ` limit ${options.limit} offset ${options.offset}`
|
||||
: ''
|
||||
|
||||
contracts = database
|
||||
.prepare(
|
||||
`select c.contractId,
|
||||
|
|
@ -128,7 +131,7 @@ export default async function getContracts(
|
|||
${
|
||||
options.orderBy !== undefined && 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.burialSiteNameSegment2,
|
||||
l.burialSiteNameSegment3,
|
||||
|
|
@ -136,7 +139,7 @@ export default async function getContracts(
|
|||
l.burialSiteNameSegment5,
|
||||
c.burialSiteId, c.contractId desc`
|
||||
}
|
||||
${isLimited ? ` limit ${options.limit} offset ${options.offset}` : ''}`
|
||||
${sqlLimitClause}`
|
||||
)
|
||||
.all(sqlParameters) as Contract[]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export default function getNextWorkOrderNumber(connectedDatabase) {
|
|||
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true });
|
||||
const paddingLength = getConfigProperty('settings.workOrders.workOrderNumberLength');
|
||||
const currentYearString = new Date().getFullYear().toString();
|
||||
// eslint-disable-next-line security/detect-non-literal-regexp
|
||||
const regex = new RegExp(`^${currentYearString}-\\d+$`);
|
||||
database.function(
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export default function getNextWorkOrderNumber(
|
|||
)
|
||||
const currentYearString = new Date().getFullYear().toString()
|
||||
|
||||
// eslint-disable-next-line security/detect-non-literal-regexp
|
||||
const regex = new RegExp(`^${currentYearString}-\\d+$`)
|
||||
|
||||
database.function(
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ export async function getWorkOrders(filters, options, connectedDatabase) {
|
|||
.prepare(`select count(*) as recordCount
|
||||
from WorkOrders w
|
||||
${sqlWhereClause}`)
|
||||
.get(sqlParameters).recordCount;
|
||||
.pluck()
|
||||
.get(sqlParameters);
|
||||
let workOrders = [];
|
||||
if (count > 0) {
|
||||
workOrders = database
|
||||
|
|
|
|||
|
|
@ -48,15 +48,14 @@ export async function getWorkOrders(
|
|||
|
||||
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters)
|
||||
|
||||
const count: number = (
|
||||
database
|
||||
const count: number = database
|
||||
.prepare(
|
||||
`select count(*) as recordCount
|
||||
from WorkOrders w
|
||||
${sqlWhereClause}`
|
||||
)
|
||||
.get(sqlParameters) as { recordCount: number }
|
||||
).recordCount
|
||||
.pluck()
|
||||
.get(sqlParameters) as number
|
||||
|
||||
let workOrders: WorkOrder[] = []
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable max-lines, no-secrets/no-secrets */
|
||||
/* eslint-disable @typescript-eslint/no-magic-numbers, max-lines, no-secrets/no-secrets */
|
||||
import sqlite from 'better-sqlite3';
|
||||
import Debug from 'debug';
|
||||
import { DEBUG_NAMESPACE } from '../debug.config.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable max-lines, no-secrets/no-secrets */
|
||||
/* eslint-disable @typescript-eslint/no-magic-numbers, max-lines, no-secrets/no-secrets */
|
||||
|
||||
import sqlite from 'better-sqlite3'
|
||||
import Debug from 'debug'
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { clearCacheByTableName } from '../helpers/functions.cache.js'
|
|||
|
||||
export interface UpdateBurialSiteTypeFieldForm {
|
||||
burialSiteTypeFieldId: number | string
|
||||
|
||||
burialSiteTypeField: string
|
||||
isRequired: '0' | '1'
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,13 @@ export default async function handler(
|
|||
|
||||
response.json({
|
||||
success: true,
|
||||
|
||||
fileName
|
||||
})
|
||||
} else {
|
||||
response.json({
|
||||
success: false,
|
||||
|
||||
errorMessage: 'Unable to write backup file.'
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
import type { Request, Response } from 'express';
|
||||
export default function handler(request: Request, response: Response): Promise<void>;
|
||||
export default function handler(request: Request<{
|
||||
cemeteryId: string;
|
||||
}>, response: Response): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { getConfigProperty } from '../../helpers/config.helpers.js'
|
|||
import { getCemeterySVGs } from '../../helpers/images.helpers.js'
|
||||
|
||||
export default async function handler(
|
||||
request: Request,
|
||||
request: Request<{ cemeteryId: string }>,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const cemetery = getCemetery(request.params.cemeteryId)
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
import type { Request, Response } from 'express';
|
||||
export default function handler(request: Request, response: Response): void;
|
||||
export default function handler(request: Request<{
|
||||
cemeteryId: string;
|
||||
}>, response: Response): void;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ import type { Request, Response } from 'express'
|
|||
import getPreviousCemeteryId from '../../database/getPreviousCemeteryId.js'
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||
|
||||
export default function handler(request: Request, response: Response): void {
|
||||
export default function handler(
|
||||
request: Request<{ cemeteryId: string }>,
|
||||
response: Response
|
||||
): void {
|
||||
const cemeteryId = Number.parseInt(request.params.cemeteryId, 10)
|
||||
|
||||
const previousCemeteryId = getPreviousCemeteryId(cemeteryId)
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
import type { Request, Response } from 'express';
|
||||
export default function handler(request: Request, response: Response): void;
|
||||
export default function handler(request: Request<{
|
||||
cemeteryId: string;
|
||||
}>, response: Response): void;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ import getBurialSiteTypeSummary from '../../database/getBurialSiteTypeSummary.js
|
|||
import getCemetery from '../../database/getCemetery.js'
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||
|
||||
export default function handler(request: Request, response: Response): void {
|
||||
export default function handler(
|
||||
request: Request<{ cemeteryId: string }>,
|
||||
response: Response
|
||||
): void {
|
||||
const cemetery = getCemetery(request.params.cemeteryId)
|
||||
|
||||
if (cemetery === undefined) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default function handler(request, response) {
|
|||
});
|
||||
if (success) {
|
||||
response.on('finish', () => {
|
||||
clearNextPreviousBurialSiteIdCache(-1);
|
||||
clearNextPreviousBurialSiteIdCache();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default function handler(
|
|||
|
||||
if (success) {
|
||||
response.on('finish', () => {
|
||||
clearNextPreviousBurialSiteIdCache(-1)
|
||||
clearNextPreviousBurialSiteIdCache()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import getBurialSite from '../../database/getBurialSite.js'
|
||||
import getBurialSiteDirectionsOfArrival, { defaultDirectionsOfArrival } from '../../database/getBurialSiteDirectionsOfArrival.js'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { dateToString } from '@cityssm/utils-datetime'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import getWorkOrderMilestones from '../../database/getWorkOrderMilestones.js'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import type { NextFunction, Request, Response } from 'express'
|
||||
|
||||
import path from 'node:path'
|
||||
|
||||
import { convertHTMLToPDF } from '@cityssm/pdf-puppeteer'
|
||||
import camelcase from 'camelcase'
|
||||
import { renderFile as renderEjsFile } from 'ejs'
|
||||
import type { NextFunction, Request, Response } from 'express'
|
||||
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import papaParse from 'papaparse'
|
||||
|
||||
import getReportData, {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { dateToString } from '@cityssm/utils-datetime'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import getCemeteries from '../../database/getCemeteries.js'
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import { getWorkOrderTypes } from '../../helpers/functions.cache.js'
|
||||
import type { WorkOrder } from '../../types/record.types.js'
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const birthDate = new Date(birthDateStringElement.value);
|
||||
const deathDate = new Date(deathDateStringElement.value);
|
||||
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);
|
||||
if (ageInYears > 0) {
|
||||
deathAgeElement.value = ageInYears.toString();
|
||||
|
|
@ -189,9 +190,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
});
|
||||
}
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Interment?',
|
||||
message: 'Are you sure you want to remove this interment from the contract?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
text: 'Yes, Remove Interment',
|
||||
callbackFunction: doDelete
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ declare const exports: Record<string, unknown>
|
|||
(deathDate.getTime() - birthDate.getTime()) / (1000 * 60 * 60 * 24)
|
||||
)
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
||||
const ageInYears = Math.floor(ageInDays / 365.25)
|
||||
|
||||
if (ageInYears > 0) {
|
||||
|
|
@ -314,12 +315,15 @@ declare const exports: Record<string, unknown>
|
|||
}
|
||||
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Interment?',
|
||||
|
||||
message:
|
||||
'Are you sure you want to remove this interment from the contract?',
|
||||
contextualColorName: 'warning',
|
||||
|
||||
okButton: {
|
||||
text: 'Yes, Remove Interment',
|
||||
|
||||
callbackFunction: doDelete
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
contextualColorName: 'danger',
|
||||
title: 'Error Creating Work Order',
|
||||
message: responseJSON.errorMessage,
|
||||
contextualColorName: 'danger'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -54,9 +54,10 @@ declare const exports: Record<string, unknown>
|
|||
})
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
contextualColorName: 'danger',
|
||||
title: 'Error Creating Work Order',
|
||||
|
||||
message: responseJSON.errorMessage as string,
|
||||
contextualColorName: 'danger'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
title: "Error Updating Contract Type",
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
contextualColorName: 'danger',
|
||||
title: 'Error Updating Contract Type',
|
||||
message: responseJSON.errorMessage ?? ''
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -53,12 +53,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}, contractTypeResponseHandler);
|
||||
}
|
||||
bulmaJS.confirm({
|
||||
title: "Delete Contract Type",
|
||||
message: "Are you sure you want to delete this contract type?",
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Contract Type',
|
||||
message: 'Are you sure you want to delete this contract type?',
|
||||
okButton: {
|
||||
text: "Yes, Delete Contract Type",
|
||||
callbackFunction: doDelete
|
||||
callbackFunction: doDelete,
|
||||
text: 'Yes, Delete Contract Type'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -206,12 +206,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
function confirmDoDelete() {
|
||||
bulmaJS.confirm({
|
||||
title: 'Delete 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.',
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete 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.`,
|
||||
okButton: {
|
||||
text: 'Yes, Delete Field',
|
||||
callbackFunction: doDelete
|
||||
callbackFunction: doDelete,
|
||||
text: 'Yes, Delete Field'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -372,12 +373,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}, contractTypeResponseHandler);
|
||||
}
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Print',
|
||||
message: 'Are you sure you want to remove this print option?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
text: 'Yes, Remove Print',
|
||||
callbackFunction: doDelete
|
||||
callbackFunction: doDelete,
|
||||
text: 'Yes, Remove Print'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -588,7 +589,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
title: "Error Adding Contract Type",
|
||||
title: 'Error Adding Contract Type',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -89,9 +89,10 @@ type ResponseJSON =
|
|||
renderContractTypes()
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
title: "Error Updating Contract Type",
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
contextualColorName: 'danger',
|
||||
title: 'Error Updating Contract Type',
|
||||
|
||||
message: responseJSON.errorMessage ?? ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -117,12 +118,13 @@ type ResponseJSON =
|
|||
}
|
||||
|
||||
bulmaJS.confirm({
|
||||
title: "Delete Contract Type",
|
||||
message: "Are you sure you want to delete this contract type?",
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Contract Type',
|
||||
|
||||
message: 'Are you sure you want to delete this contract type?',
|
||||
okButton: {
|
||||
text: "Yes, Delete Contract Type",
|
||||
callbackFunction: doDelete
|
||||
callbackFunction: doDelete,
|
||||
text: 'Yes, Delete Contract Type'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -195,6 +197,7 @@ type ResponseJSON =
|
|||
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
},
|
||||
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
}
|
||||
|
|
@ -260,6 +263,7 @@ type ResponseJSON =
|
|||
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
},
|
||||
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
}
|
||||
|
|
@ -385,13 +389,14 @@ type ResponseJSON =
|
|||
|
||||
function confirmDoDelete(): void {
|
||||
bulmaJS.confirm({
|
||||
title: 'Delete 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.',
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete 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.`,
|
||||
okButton: {
|
||||
text: 'Yes, Delete Field',
|
||||
callbackFunction: doDelete
|
||||
callbackFunction: doDelete,
|
||||
text: 'Yes, Delete Field'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -467,6 +472,7 @@ type ResponseJSON =
|
|||
.querySelector('#button--deleteContractTypeField')
|
||||
?.addEventListener('click', confirmDoDelete)
|
||||
},
|
||||
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
cityssm.disableNavBlocker()
|
||||
|
|
@ -706,12 +712,13 @@ type ResponseJSON =
|
|||
}
|
||||
|
||||
bulmaJS.confirm({
|
||||
title: 'Delete Print',
|
||||
message: 'Are you sure you want to remove this print option?',
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Print',
|
||||
|
||||
message: 'Are you sure you want to remove this print option?',
|
||||
okButton: {
|
||||
text: 'Yes, Remove Print',
|
||||
callbackFunction: doDelete
|
||||
callbackFunction: doDelete,
|
||||
text: 'Yes, Remove Print'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1017,7 +1024,7 @@ type ResponseJSON =
|
|||
renderContractTypes()
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
title: "Error Adding Contract Type",
|
||||
title: 'Error Adding Contract Type',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -31,16 +31,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
message: 'Work Order Updated Successfully',
|
||||
contextualColorName: 'success'
|
||||
contextualColorName: 'success',
|
||||
message: 'Work Order Updated Successfully'
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
contextualColorName: 'danger',
|
||||
title: 'Error Updating Work Order',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
message: responseJSON.errorMessage ?? ''
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -81,9 +81,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
contextualColorName: 'danger',
|
||||
title: 'Error Deleting Work Order',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
message: responseJSON.errorMessage ?? ''
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -95,10 +95,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const hasOpenMilestones = workOrderMilestones.some((milestone) => !milestone.workOrderMilestoneCompletionDate);
|
||||
if (hasOpenMilestones) {
|
||||
bulmaJS.alert({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Outstanding Milestones',
|
||||
message: `You cannot close a work order with outstanding milestones.
|
||||
Either complete the outstanding milestones, or remove them from the work order.`,
|
||||
contextualColorName: 'warning'
|
||||
Either complete the outstanding milestones, or remove them from the work order.`
|
||||
});
|
||||
/*
|
||||
// Disable closing work orders with open milestones
|
||||
|
|
@ -116,14 +116,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: sunrise.hasUnsavedChanges() ? 'warning' : 'info',
|
||||
title: 'Close Work Order',
|
||||
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?',
|
||||
contextualColorName: sunrise.hasUnsavedChanges() ? 'warning' : 'info',
|
||||
okButton: {
|
||||
text: 'Yes, Close Work Order',
|
||||
callbackFunction: doClose
|
||||
callbackFunction: doClose,
|
||||
text: 'Yes, Close Work Order'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -133,9 +133,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
?.addEventListener('click', (clickEvent) => {
|
||||
clickEvent.preventDefault();
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Work Order',
|
||||
message: 'Are you sure you want to delete this work order?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
text: 'Yes, Delete Work Order',
|
||||
callbackFunction: doDelete
|
||||
|
|
@ -243,12 +243,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}, processMilestoneResponse);
|
||||
}
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Reopen Milestone',
|
||||
message: 'Are you sure you want to remove the completion status from this milestone, and reopen it?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
callbackFunction: doReopen,
|
||||
text: 'Yes, Reopen Milestone',
|
||||
callbackFunction: doReopen
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -262,9 +262,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}, processMilestoneResponse);
|
||||
}
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Milestone',
|
||||
message: 'Are you sure you want to delete this milestone?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
text: 'Yes, Delete Milestone',
|
||||
callbackFunction: doDeleteMilestone
|
||||
|
|
@ -442,11 +442,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
let addFormElement;
|
||||
let workOrderMilestoneDateStringElement;
|
||||
let addCloseModalFunction;
|
||||
function doAdd(submitEvent) {
|
||||
if (submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
}
|
||||
const currentDateString = cityssm.dateToString(new Date());
|
||||
function _doAdd() {
|
||||
cityssm.postJSON(`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`, addFormElement, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
|
|
@ -456,13 +451,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
});
|
||||
}
|
||||
function doAddFormSubmit(submitEvent) {
|
||||
if (submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
}
|
||||
const currentDateString = cityssm.dateToString(new Date());
|
||||
const milestoneDateString = workOrderMilestoneDateStringElement.value;
|
||||
if (milestoneDateString !== '' &&
|
||||
milestoneDateString < currentDateString) {
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Milestone Date in the Past',
|
||||
message: 'Are you sure you want to create a milestone with a date in the past?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
text: 'Yes, Create a Past Milestone',
|
||||
callbackFunction: _doAdd
|
||||
|
|
@ -495,7 +495,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
bulmaJS.toggleHtmlClipped();
|
||||
modalElement.querySelector('#milestoneAdd--workOrderMilestoneTypeId').focus();
|
||||
addFormElement = modalElement.querySelector('form');
|
||||
addFormElement.addEventListener('submit', doAdd);
|
||||
addFormElement.addEventListener('submit', doAddFormSubmit);
|
||||
const conflictingMilestonePanelElement = document.querySelector('#milestoneAdd--conflictingMilestonesPanel');
|
||||
workOrderMilestoneDateStringElement.addEventListener('change', () => {
|
||||
refreshConflictingMilestones(workOrderMilestoneDateStringElement.value, conflictingMilestonePanelElement);
|
||||
|
|
|
|||
|
|
@ -67,15 +67,16 @@ declare const exports: Record<string, unknown>
|
|||
)
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
message: 'Work Order Updated Successfully',
|
||||
contextualColorName: 'success'
|
||||
contextualColorName: 'success',
|
||||
message: 'Work Order Updated Successfully'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
contextualColorName: 'danger',
|
||||
title: 'Error Updating Work Order',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
|
||||
message: responseJSON.errorMessage ?? ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -137,9 +138,10 @@ declare const exports: Record<string, unknown>
|
|||
globalThis.location.href = `${sunrise.urlPrefix}/workOrders`
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
contextualColorName: 'danger',
|
||||
title: 'Error Deleting Work Order',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
|
||||
message: responseJSON.errorMessage ?? ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -157,10 +159,11 @@ declare const exports: Record<string, unknown>
|
|||
|
||||
if (hasOpenMilestones) {
|
||||
bulmaJS.alert({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Outstanding Milestones',
|
||||
|
||||
message: `You cannot close a work order with outstanding milestones.
|
||||
Either complete the outstanding milestones, or remove them from the work order.`,
|
||||
contextualColorName: 'warning'
|
||||
Either complete the outstanding milestones, or remove them from the work order.`
|
||||
})
|
||||
|
||||
/*
|
||||
|
|
@ -178,14 +181,16 @@ declare const exports: Record<string, unknown>
|
|||
*/
|
||||
} else {
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: sunrise.hasUnsavedChanges() ? 'warning' : 'info',
|
||||
title: 'Close Work Order',
|
||||
|
||||
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?',
|
||||
contextualColorName: sunrise.hasUnsavedChanges() ? 'warning' : 'info',
|
||||
|
||||
okButton: {
|
||||
text: 'Yes, Close Work Order',
|
||||
callbackFunction: doClose
|
||||
callbackFunction: doClose,
|
||||
text: 'Yes, Close Work Order'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -197,9 +202,9 @@ declare const exports: Record<string, unknown>
|
|||
clickEvent.preventDefault()
|
||||
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Work Order',
|
||||
message: 'Are you sure you want to delete this work order?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
text: 'Yes, Delete Work Order',
|
||||
callbackFunction: doDelete
|
||||
|
|
@ -378,13 +383,15 @@ declare const exports: Record<string, unknown>
|
|||
}
|
||||
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Reopen Milestone',
|
||||
|
||||
message:
|
||||
'Are you sure you want to remove the completion status from this milestone, and reopen it?',
|
||||
contextualColorName: 'warning',
|
||||
|
||||
okButton: {
|
||||
callbackFunction: doReopen,
|
||||
text: 'Yes, Reopen Milestone',
|
||||
callbackFunction: doReopen
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -410,9 +417,9 @@ declare const exports: Record<string, unknown>
|
|||
}
|
||||
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Delete Milestone',
|
||||
message: 'Are you sure you want to delete this milestone?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
text: 'Yes, Delete Milestone',
|
||||
callbackFunction: doDeleteMilestone
|
||||
|
|
@ -659,6 +666,7 @@ declare const exports: Record<string, unknown>
|
|||
panelBlockElement
|
||||
.querySelector('.button--reopenMilestone')
|
||||
?.addEventListener('click', reopenMilestone)
|
||||
|
||||
panelBlockElement
|
||||
.querySelector('.button--editMilestone')
|
||||
?.addEventListener('click', editMilestone)
|
||||
|
|
@ -702,13 +710,6 @@ declare const exports: Record<string, unknown>
|
|||
let workOrderMilestoneDateStringElement: HTMLInputElement
|
||||
let addCloseModalFunction: () => void
|
||||
|
||||
function doAdd(submitEvent?: SubmitEvent): void {
|
||||
if (submitEvent) {
|
||||
submitEvent.preventDefault()
|
||||
}
|
||||
|
||||
const currentDateString = cityssm.dateToString(new Date())
|
||||
|
||||
function _doAdd(): void {
|
||||
cityssm.postJSON(
|
||||
`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`,
|
||||
|
|
@ -729,6 +730,13 @@ declare const exports: Record<string, unknown>
|
|||
)
|
||||
}
|
||||
|
||||
function doAddFormSubmit(submitEvent?: SubmitEvent): void {
|
||||
if (submitEvent) {
|
||||
submitEvent.preventDefault()
|
||||
}
|
||||
|
||||
const currentDateString = cityssm.dateToString(new Date())
|
||||
|
||||
const milestoneDateString = workOrderMilestoneDateStringElement.value
|
||||
|
||||
if (
|
||||
|
|
@ -736,10 +744,12 @@ declare const exports: Record<string, unknown>
|
|||
milestoneDateString < currentDateString
|
||||
) {
|
||||
bulmaJS.confirm({
|
||||
contextualColorName: 'warning',
|
||||
title: 'Milestone Date in the Past',
|
||||
|
||||
message:
|
||||
'Are you sure you want to create a milestone with a date in the past?',
|
||||
contextualColorName: 'warning',
|
||||
|
||||
okButton: {
|
||||
text: 'Yes, Create a Past Milestone',
|
||||
callbackFunction: _doAdd
|
||||
|
|
@ -792,7 +802,7 @@ declare const exports: Record<string, unknown>
|
|||
).focus()
|
||||
|
||||
addFormElement = modalElement.querySelector('form') as HTMLFormElement
|
||||
addFormElement.addEventListener('submit', doAdd)
|
||||
addFormElement.addEventListener('submit', doAddFormSubmit)
|
||||
|
||||
const conflictingMilestonePanelElement = document.querySelector(
|
||||
'#milestoneAdd--conflictingMilestonesPanel'
|
||||
|
|
|
|||
|
|
@ -495,6 +495,7 @@ async function importFromPrepaidCSV() {
|
|||
externalReceiptNumber: '',
|
||||
transactionAmount,
|
||||
transactionDateString: contractStartDateString,
|
||||
transactionTimeString: '00:00',
|
||||
transactionNote: `Order Number: ${prepaidRow.CMPP_ORDER_NO}`
|
||||
}, user);
|
||||
if (prepaidRow.CMPP_REMARK1 !== '') {
|
||||
|
|
|
|||
|
|
@ -794,6 +794,8 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
externalReceiptNumber: '',
|
||||
transactionAmount,
|
||||
transactionDateString: contractStartDateString,
|
||||
transactionTimeString: '00:00',
|
||||
|
||||
transactionNote: `Order Number: ${prepaidRow.CMPP_ORDER_NO}`
|
||||
},
|
||||
user
|
||||
|
|
|
|||
|
|
@ -26,11 +26,14 @@
|
|||
Database Maintenance
|
||||
</h1>
|
||||
|
||||
<h2 class="title is-3">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="panel is-primary">
|
||||
<h2 class="panel-heading">
|
||||
Database Backup
|
||||
</h2>
|
||||
|
||||
<div class="message is-info">
|
||||
<div class="panel-block is-block">
|
||||
<div class="message is-primary">
|
||||
<div class="message-body">
|
||||
<p>
|
||||
Before making significant changes to the records in the database,
|
||||
|
|
@ -38,22 +41,22 @@
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="has-text-right">
|
||||
<button class="button is-success" id="button--backupDatabase" data-cy="backup" type="button">
|
||||
</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>
|
||||
</p>
|
||||
|
||||
<h2 class="title is-3">
|
||||
</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-header">
|
||||
Important Note about Cleanup
|
||||
</div>
|
||||
<div class="message-body">
|
||||
<p>
|
||||
When records are deleted in this application, they are not removed entirely.
|
||||
|
|
@ -67,13 +70,16 @@
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="has-text-right">
|
||||
<button class="button is-success" id="button--cleanupDatabase" data-cy="cleanup" type="button">
|
||||
</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>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue