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
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,7 @@ export default function getBurialSites(filters, options, connectedDatabase) {
|
||||||
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,7 +38,8 @@ export default function getBurialSites(
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
count = database
|
count = (
|
||||||
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select count(*) as recordCount
|
`select count(*) as recordCount
|
||||||
from BurialSites l
|
from BurialSites l
|
||||||
|
|
@ -52,8 +53,8 @@ export default function getBurialSites(
|
||||||
) o on l.burialSiteId = o.burialSiteId
|
) o on l.burialSiteId = o.burialSiteId
|
||||||
${sqlWhereClause}`
|
${sqlWhereClause}`
|
||||||
)
|
)
|
||||||
.pluck()
|
.get(sqlParameters) as { recordCount: number }
|
||||||
.get(sqlParameters) as number
|
).recordCount
|
||||||
}
|
}
|
||||||
|
|
||||||
let burialSites: BurialSite[] = []
|
let burialSites: BurialSite[] = []
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,10 @@ 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,
|
||||||
|
|
@ -61,14 +57,14 @@ export default async function getContracts(filters, options, connectedDatabase)
|
||||||
${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,7 +81,8 @@ export default async function getContracts(
|
||||||
const isLimited = options.limit !== -1
|
const isLimited = options.limit !== -1
|
||||||
|
|
||||||
if (isLimited) {
|
if (isLimited) {
|
||||||
count = database
|
count = (
|
||||||
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select count(*) as recordCount
|
`select count(*) as recordCount
|
||||||
from Contracts c
|
from Contracts c
|
||||||
|
|
@ -89,17 +90,13 @@ export default async function getContracts(
|
||||||
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,
|
||||||
|
|
@ -131,7 +128,7 @@ export default async function getContracts(
|
||||||
${
|
${
|
||||||
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,
|
||||||
|
|
@ -139,7 +136,7 @@ export default async function getContracts(
|
||||||
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(
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@ export async function getWorkOrders(filters, options, connectedDatabase) {
|
||||||
.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 = (
|
||||||
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select count(*) as recordCount
|
`select count(*) as recordCount
|
||||||
from WorkOrders w
|
from WorkOrders w
|
||||||
${sqlWhereClause}`
|
${sqlWhereClause}`
|
||||||
)
|
)
|
||||||
.pluck()
|
.get(sqlParameters) as { recordCount: number }
|
||||||
.get(sqlParameters) as 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,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'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,6 +442,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let addFormElement;
|
let addFormElement;
|
||||||
let workOrderMilestoneDateStringElement;
|
let workOrderMilestoneDateStringElement;
|
||||||
let addCloseModalFunction;
|
let addCloseModalFunction;
|
||||||
|
function doAdd(submitEvent) {
|
||||||
|
if (submitEvent) {
|
||||||
|
submitEvent.preventDefault();
|
||||||
|
}
|
||||||
|
const currentDateString = cityssm.dateToString(new Date());
|
||||||
function _doAdd() {
|
function _doAdd() {
|
||||||
cityssm.postJSON(`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`, addFormElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`, addFormElement, (rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
|
|
@ -451,18 +456,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function doAddFormSubmit(submitEvent) {
|
|
||||||
if (submitEvent) {
|
|
||||||
submitEvent.preventDefault();
|
|
||||||
}
|
|
||||||
const currentDateString = cityssm.dateToString(new Date());
|
|
||||||
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,6 +702,13 @@ declare const exports: Record<string, unknown>
|
||||||
let workOrderMilestoneDateStringElement: HTMLInputElement
|
let workOrderMilestoneDateStringElement: HTMLInputElement
|
||||||
let addCloseModalFunction: () => void
|
let addCloseModalFunction: () => void
|
||||||
|
|
||||||
|
function doAdd(submitEvent?: SubmitEvent): void {
|
||||||
|
if (submitEvent) {
|
||||||
|
submitEvent.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentDateString = cityssm.dateToString(new Date())
|
||||||
|
|
||||||
function _doAdd(): void {
|
function _doAdd(): void {
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`,
|
`${sunrise.urlPrefix}/workOrders/doAddWorkOrderMilestone`,
|
||||||
|
|
@ -730,13 +729,6 @@ 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
|
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,14 +26,11 @@
|
||||||
Database Maintenance
|
Database Maintenance
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="columns">
|
<h2 class="title is-3">
|
||||||
<div class="column">
|
|
||||||
<div class="panel is-primary">
|
|
||||||
<h2 class="panel-heading">
|
|
||||||
Database Backup
|
Database Backup
|
||||||
</h2>
|
</h2>
|
||||||
<div class="panel-block is-block">
|
|
||||||
<div class="message is-primary">
|
<div class="message is-info">
|
||||||
<div class="message-body">
|
<div class="message-body">
|
||||||
<p>
|
<p>
|
||||||
Before making significant changes to the records in the database,
|
Before making significant changes to the records in the database,
|
||||||
|
|
@ -41,22 +38,22 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="panel-block is-block has-text-right">
|
<p class="has-text-right">
|
||||||
<button class="button is-primary" id="button--backupDatabase" data-cy="backup" type="button">
|
<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 class="icon"><i class="fas fa-save" aria-hidden="true"></i></span>
|
||||||
<span>Backup Database</span>
|
<span>Backup Database</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</p>
|
||||||
</div>
|
|
||||||
</div>
|
<h2 class="title is-3">
|
||||||
<div class="column">
|
|
||||||
<div class="panel is-warning">
|
|
||||||
<h2 class="panel-heading">
|
|
||||||
Database Cleanup
|
Database Cleanup
|
||||||
</h2>
|
</h2>
|
||||||
<div class="panel-block is-block">
|
|
||||||
<div class="message is-warning">
|
<div class="message is-warning">
|
||||||
|
<div class="message-header">
|
||||||
|
Important Note about Cleanup
|
||||||
|
</div>
|
||||||
<div class="message-body">
|
<div class="message-body">
|
||||||
<p>
|
<p>
|
||||||
When records are deleted in this application, they are not removed entirely.
|
When records are deleted in this application, they are not removed entirely.
|
||||||
|
|
@ -70,16 +67,13 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="panel-block is-block has-text-right">
|
<p class="has-text-right">
|
||||||
<button class="button is-warning" id="button--cleanupDatabase" data-cy="cleanup" type="button">
|
<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 class="icon"><i class="fas fa-broom" aria-hidden="true"></i></span>
|
||||||
<span>Cleanup Database</span>
|
<span>Cleanup Database</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</p>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue