diff --git a/app.js b/app.js index 30b2dd0f..48c8d46e 100644 --- a/app.js +++ b/app.js @@ -10,6 +10,7 @@ import rateLimit from 'express-rate-limit'; import session from 'express-session'; import createError from 'http-errors'; import FileStore from 'session-file-store'; +import dataLists from './data/dataLists.js'; import { DEBUG_NAMESPACE } from './debug.config.js'; import * as permissionHandlers from './handlers/permissions.js'; import { getSafeRedirectURL } from './helpers/authentication.helpers.js'; @@ -141,6 +142,7 @@ app.use((request, response, next) => { response.locals.configFunctions = configFunctions; response.locals.printFunctions = printFunctions; response.locals.dateTimeFunctions = dateTimeFunctions; + response.locals.dataLists = dataLists; response.locals.urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix'); next(); }); diff --git a/app.ts b/app.ts index 32fae2e4..dd2e6450 100644 --- a/app.ts +++ b/app.ts @@ -12,6 +12,7 @@ import session from 'express-session' import createError from 'http-errors' import FileStore from 'session-file-store' +import dataLists from './data/dataLists.js' import { DEBUG_NAMESPACE } from './debug.config.js' import * as permissionHandlers from './handlers/permissions.js' import { getSafeRedirectURL } from './helpers/authentication.helpers.js' @@ -244,6 +245,8 @@ app.use((request, response, next) => { response.locals.printFunctions = printFunctions response.locals.dateTimeFunctions = dateTimeFunctions + response.locals.dataLists = dataLists + response.locals.urlPrefix = configFunctions.getConfigProperty( 'reverseProxy.urlPrefix' ) diff --git a/data/configDefaults.d.ts b/data/configDefaults.d.ts index 9f87da96..6aa27d20 100644 --- a/data/configDefaults.d.ts +++ b/data/configDefaults.d.ts @@ -38,9 +38,7 @@ export declare const configDefaultValues: { 'settings.burialSites.refreshImageChanges': boolean; 'settings.contracts.burialSiteIdIsRequired': boolean; 'settings.contracts.contractEndDateIsRequired': boolean; - 'settings.contracts.deathAgePeriods': string[]; 'settings.contracts.prints': string[]; - 'settings.contracts.purchaserRelationships': string[]; 'settings.fees.taxPercentageDefault': number; 'settings.workOrders.workOrderNumberLength': number; 'settings.workOrders.calendarEmailAddress': string; diff --git a/data/configDefaults.js b/data/configDefaults.js index 4e3ad746..6dc9c7af 100644 --- a/data/configDefaults.js +++ b/data/configDefaults.js @@ -49,21 +49,7 @@ export const configDefaultValues = { 'settings.burialSites.refreshImageChanges': false, 'settings.contracts.burialSiteIdIsRequired': true, 'settings.contracts.contractEndDateIsRequired': false, - 'settings.contracts.deathAgePeriods': [ - 'Years', - 'Months', - 'Days', - 'Stillborn' - ], 'settings.contracts.prints': ['screen/contract'], - 'settings.contracts.purchaserRelationships': [ - 'Spouse', - 'Child', - 'Parent', - 'Sibling', - 'Friend', - 'Self' - ], 'settings.fees.taxPercentageDefault': 0, 'settings.workOrders.workOrderNumberLength': 6, 'settings.workOrders.calendarEmailAddress': 'no-reply@127.0.0.1', diff --git a/data/configDefaults.ts b/data/configDefaults.ts index 811e37ad..b4011751 100644 --- a/data/configDefaults.ts +++ b/data/configDefaults.ts @@ -73,21 +73,8 @@ export const configDefaultValues = { 'settings.contracts.burialSiteIdIsRequired': true, 'settings.contracts.contractEndDateIsRequired': false, - 'settings.contracts.deathAgePeriods': [ - 'Years', - 'Months', - 'Days', - 'Stillborn' - ], + 'settings.contracts.prints': ['screen/contract'], - 'settings.contracts.purchaserRelationships': [ - 'Spouse', - 'Child', - 'Parent', - 'Sibling', - 'Friend', - 'Self' - ], 'settings.fees.taxPercentageDefault': 0, diff --git a/data/dataLists.d.ts b/data/dataLists.d.ts new file mode 100644 index 00000000..dc79ac64 --- /dev/null +++ b/data/dataLists.d.ts @@ -0,0 +1,7 @@ +export declare const deathAgePeriods: readonly ["Years", "Months", "Days", "Stillborn"]; +export declare const purchaserRelationships: readonly ["Spouse", "Husband", "Wife", "Child", "Parent", "Sibling", "Friend", "Self"]; +declare const _default: { + deathAgePeriods: readonly ["Years", "Months", "Days", "Stillborn"]; + purchaserRelationships: readonly ["Spouse", "Husband", "Wife", "Child", "Parent", "Sibling", "Friend", "Self"]; +}; +export default _default; diff --git a/data/dataLists.js b/data/dataLists.js new file mode 100644 index 00000000..460e281b --- /dev/null +++ b/data/dataLists.js @@ -0,0 +1,20 @@ +export const deathAgePeriods = [ + 'Years', + 'Months', + 'Days', + 'Stillborn' +]; +export const purchaserRelationships = [ + 'Spouse', + 'Husband', + 'Wife', + 'Child', + 'Parent', + 'Sibling', + 'Friend', + 'Self' +]; +export default { + deathAgePeriods, + purchaserRelationships +}; diff --git a/data/dataLists.ts b/data/dataLists.ts new file mode 100644 index 00000000..6ed8b1c9 --- /dev/null +++ b/data/dataLists.ts @@ -0,0 +1,22 @@ +export const deathAgePeriods = [ + 'Years', + 'Months', + 'Days', + 'Stillborn' +] as const + +export const purchaserRelationships = [ + 'Spouse', + 'Husband', + 'Wife', + 'Child', + 'Parent', + 'Sibling', + 'Friend', + 'Self' +] as const + +export default { + deathAgePeriods, + purchaserRelationships +} \ No newline at end of file diff --git a/types/config.types.d.ts b/types/config.types.d.ts index 32b29002..cf9dcb83 100644 --- a/types/config.types.d.ts +++ b/types/config.types.d.ts @@ -41,9 +41,7 @@ export interface Config { contracts: { burialSiteIdIsRequired?: boolean; contractEndDateIsRequired?: boolean; - deathAgePeriods?: string[]; prints?: string[]; - purchaserRelationships?: string[]; }; workOrders: { calendarEmailAddress?: string; diff --git a/types/config.types.ts b/types/config.types.ts index 5d91eeab..3569e532 100644 --- a/types/config.types.ts +++ b/types/config.types.ts @@ -55,9 +55,7 @@ export interface Config { contracts: { burialSiteIdIsRequired?: boolean contractEndDateIsRequired?: boolean - deathAgePeriods?: string[] prints?: string[] - purchaserRelationships?: string[] } workOrders: { diff --git a/views/contract-edit.ejs b/views/contract-edit.ejs index e7983aa3..f03e0ffc 100644 --- a/views/contract-edit.ejs +++ b/views/contract-edit.ejs @@ -535,7 +535,7 @@ @@ -695,7 +695,7 @@