diff --git a/handlers/api-get/milestoneICS.js b/handlers/api-get/milestoneICS.js index bb67517f..3b3ef407 100644 --- a/handlers/api-get/milestoneICS.js +++ b/handlers/api-get/milestoneICS.js @@ -21,9 +21,9 @@ function getWorkOrderUrl(request, milestone) { } function buildEventSummary(milestone) { let summary = (milestone.workOrderMilestoneCompletionDate ? '✔ ' : '') + - (milestone.workOrderMilestoneTypeId - ? milestone.workOrderMilestoneType - : milestone.workOrderMilestoneDescription).trim(); + ((milestone.workOrderMilestoneTypeId ?? -1) === -1 + ? (milestone.workOrderMilestoneDescription ?? '') + : (milestone.workOrderMilestoneType ?? '')).trim(); let occupantCount = 0; for (const lotOccupancy of milestone.workOrderLotOccupancies) { for (const occupant of lotOccupancy.lotOccupancyOccupants) { @@ -32,7 +32,7 @@ function buildEventSummary(milestone) { if (summary !== '') { summary += ': '; } - summary += occupant.occupantName ?? ''; + summary += (occupant.occupantName ?? '') + ' ' + (occupant.occupantFamilyName ?? ''); } } } @@ -81,6 +81,8 @@ function buildEventDescriptionHTML_occupancies(request, milestone) { escapeHTML(occupant.lotOccupantType) + ': ' + escapeHTML(occupant.occupantName) + + ' ' + + escapeHTML(occupant.occupantFamilyName) + '
'; } descriptionHTML += ''; @@ -257,13 +259,13 @@ export async function handler(request, response) { for (const occupant of lotOccupancy.lotOccupancyOccupants) { if (organizerSet) { calendarEvent.createAttendee({ - name: occupant.occupantName, + name: occupant.occupantName + ' ' + occupant.occupantFamilyName, email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress') }); } else { calendarEvent.organizer({ - name: occupant.occupantName, + name: occupant.occupantName + ' ' + occupant.occupantFamilyName, email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress') }); organizerSet = true; diff --git a/handlers/api-get/milestoneICS.ts b/handlers/api-get/milestoneICS.ts index e8488325..108da080 100644 --- a/handlers/api-get/milestoneICS.ts +++ b/handlers/api-get/milestoneICS.ts @@ -49,9 +49,9 @@ function getWorkOrderUrl( function buildEventSummary(milestone: recordTypes.WorkOrderMilestone): string { let summary = (milestone.workOrderMilestoneCompletionDate ? '✔ ' : '') + - (milestone.workOrderMilestoneTypeId - ? milestone.workOrderMilestoneType - : milestone.workOrderMilestoneDescription + ((milestone.workOrderMilestoneTypeId ?? -1) === -1 + ? (milestone.workOrderMilestoneDescription ?? '') + : (milestone.workOrderMilestoneType ?? '') ).trim() let occupantCount = 0 @@ -65,7 +65,7 @@ function buildEventSummary(milestone: recordTypes.WorkOrderMilestone): string { summary += ': ' } - summary += occupant.occupantName ?? '' + summary += (occupant.occupantName ?? '') + ' ' + (occupant.occupantFamilyName ?? '') } } } @@ -129,6 +129,8 @@ function buildEventDescriptionHTML_occupancies( escapeHTML(occupant.lotOccupantType!) + ': ' + escapeHTML(occupant.occupantName!) + + ' ' + + escapeHTML(occupant.occupantFamilyName!) + '
' } @@ -403,14 +405,14 @@ export async function handler( for (const occupant of lotOccupancy.lotOccupancyOccupants!) { if (organizerSet) { calendarEvent.createAttendee({ - name: occupant.occupantName, + name: occupant.occupantName + ' ' + occupant.occupantFamilyName, email: configFunctions.getProperty( 'settings.workOrders.calendarEmailAddress' ) }) } else { calendarEvent.organizer({ - name: occupant.occupantName, + name: occupant.occupantName + ' ' + occupant.occupantFamilyName, email: configFunctions.getProperty( 'settings.workOrders.calendarEmailAddress' ) diff --git a/handlers/print-get/pdf.js b/handlers/print-get/pdf.js index 24bd3783..dae52bd4 100644 --- a/handlers/print-get/pdf.js +++ b/handlers/print-get/pdf.js @@ -26,6 +26,7 @@ export async function handler(request, response, next) { return; } const reportData = await getReportData(printConfig, request.query); + console.log(reportData); const reportPath = path.join('views', 'print', 'pdf', printName + '.ejs'); function pdfCallbackFunction(pdf) { response.setHeader('Content-Disposition', `${attachmentOrInline}; filename=${camelcase(printConfig.title)}.pdf`); diff --git a/handlers/print-get/pdf.ts b/handlers/print-get/pdf.ts index a4e708e7..a63a4b66 100644 --- a/handlers/print-get/pdf.ts +++ b/handlers/print-get/pdf.ts @@ -53,6 +53,8 @@ export async function handler( const reportData = await getReportData(printConfig, request.query) + console.log(reportData) + const reportPath = path.join('views', 'print', 'pdf', printName + '.ejs') function pdfCallbackFunction(pdf: Buffer): void { diff --git a/handlers/reports-get/reportName.ts b/handlers/reports-get/reportName.ts index 808f9041..b00fa486 100644 --- a/handlers/reports-get/reportName.ts +++ b/handlers/reports-get/reportName.ts @@ -2,7 +2,7 @@ import type { Request, Response } from 'express' import { getReportData, - ReportParameters + type ReportParameters } from '../../helpers/lotOccupancyDB/getReportData.js' import papaparse from 'papaparse' diff --git a/helpers/functions.print.js b/helpers/functions.print.js index 80a74a6a..fd4b5ea5 100644 --- a/helpers/functions.print.js +++ b/helpers/functions.print.js @@ -58,7 +58,7 @@ export async function getReportData(printConfig, requestQuery) { } if (printConfig.params.includes('workOrderId') && typeof requestQuery.workOrderId === 'string') { - reportData.workOrder = getWorkOrder(requestQuery.workOrderId, { + reportData.workOrder = await getWorkOrder(requestQuery.workOrderId, { includeLotsAndLotOccupancies: true, includeComments: true, includeMilestones: true diff --git a/helpers/functions.print.ts b/helpers/functions.print.ts index 9cf0b827..ca8556b4 100644 --- a/helpers/functions.print.ts +++ b/helpers/functions.print.ts @@ -91,7 +91,7 @@ export async function getReportData( printConfig.params.includes('workOrderId') && typeof requestQuery.workOrderId === 'string' ) { - reportData.workOrder = getWorkOrder(requestQuery.workOrderId, { + reportData.workOrder = await getWorkOrder(requestQuery.workOrderId, { includeLotsAndLotOccupancies: true, includeComments: true, includeMilestones: true diff --git a/helpers/functions.sqlFilters.js b/helpers/functions.sqlFilters.js index b14b4126..56f91264 100644 --- a/helpers/functions.sqlFilters.js +++ b/helpers/functions.sqlFilters.js @@ -76,8 +76,9 @@ export function getOccupantNameWhereClause(occupantName = '', tableAlias = 'o') if (occupantNamePiece === '') { continue; } - sqlWhereClause += ` and instr(lower(${tableAlias}.occupantName), ?)`; - sqlParameters.push(occupantNamePiece); + sqlWhereClause += ` and (instr(lower(${tableAlias}.occupantName), ?) + or instr(lower(${tableAlias}.occupantFamilyName), ?))`; + sqlParameters.push(occupantNamePiece, occupantNamePiece); } } return { diff --git a/helpers/functions.sqlFilters.ts b/helpers/functions.sqlFilters.ts index 6aa7145e..8c96caed 100644 --- a/helpers/functions.sqlFilters.ts +++ b/helpers/functions.sqlFilters.ts @@ -108,8 +108,9 @@ export function getOccupantNameWhereClause( continue } - sqlWhereClause += ` and instr(lower(${tableAlias}.occupantName), ?)` - sqlParameters.push(occupantNamePiece) + sqlWhereClause += ` and (instr(lower(${tableAlias}.occupantName), ?) + or instr(lower(${tableAlias}.occupantFamilyName), ?))` + sqlParameters.push(occupantNamePiece, occupantNamePiece) } } diff --git a/helpers/lotOccupancyDB/addLotOccupancy.d.ts b/helpers/lotOccupancyDB/addLotOccupancy.d.ts index 5ec92532..9053fa4f 100644 --- a/helpers/lotOccupancyDB/addLotOccupancy.d.ts +++ b/helpers/lotOccupancyDB/addLotOccupancy.d.ts @@ -9,6 +9,7 @@ interface AddLotOccupancyForm { [lotOccupancyFieldValue_occupancyTypeFieldId: string]: unknown; lotOccupantTypeId?: string; occupantName?: string; + occupantFamilyName?: string; occupantAddress1?: string; occupantAddress2?: string; occupantCity?: string; diff --git a/helpers/lotOccupancyDB/addLotOccupancy.js b/helpers/lotOccupancyDB/addLotOccupancy.js index 2547a817..fb43e7dc 100644 --- a/helpers/lotOccupancyDB/addLotOccupancy.js +++ b/helpers/lotOccupancyDB/addLotOccupancy.js @@ -36,6 +36,7 @@ export async function addLotOccupancy(lotOccupancyForm, requestSession, connecte lotOccupancyId, lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId, occupantName: lotOccupancyForm.occupantName, + occupantFamilyName: lotOccupancyForm.occupantFamilyName, occupantAddress1: lotOccupancyForm.occupantAddress1, occupantAddress2: lotOccupancyForm.occupantAddress2, occupantCity: lotOccupancyForm.occupantCity, diff --git a/helpers/lotOccupancyDB/addLotOccupancy.ts b/helpers/lotOccupancyDB/addLotOccupancy.ts index 99116af5..b736844a 100644 --- a/helpers/lotOccupancyDB/addLotOccupancy.ts +++ b/helpers/lotOccupancyDB/addLotOccupancy.ts @@ -20,6 +20,7 @@ interface AddLotOccupancyForm { lotOccupantTypeId?: string occupantName?: string + occupantFamilyName?: string occupantAddress1?: string occupantAddress2?: string occupantCity?: string @@ -102,6 +103,7 @@ export async function addLotOccupancy( lotOccupancyId, lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId!, occupantName: lotOccupancyForm.occupantName!, + occupantFamilyName: lotOccupancyForm.occupantFamilyName!, occupantAddress1: lotOccupancyForm.occupantAddress1!, occupantAddress2: lotOccupancyForm.occupantAddress2!, occupantCity: lotOccupancyForm.occupantCity!, diff --git a/helpers/lotOccupancyDB/addLotOccupancyOccupant.d.ts b/helpers/lotOccupancyDB/addLotOccupancyOccupant.d.ts index 2d1ab1eb..32c09566 100644 --- a/helpers/lotOccupancyDB/addLotOccupancyOccupant.d.ts +++ b/helpers/lotOccupancyDB/addLotOccupancyOccupant.d.ts @@ -4,6 +4,7 @@ interface AddLotOccupancyOccupantForm { lotOccupancyId: string | number; lotOccupantTypeId: string | number; occupantName: string; + occupantFamilyName: string; occupantAddress1: string; occupantAddress2: string; occupantCity: string; diff --git a/helpers/lotOccupancyDB/addLotOccupancyOccupant.js b/helpers/lotOccupancyDB/addLotOccupancyOccupant.js index 06503b1a..42f80cb3 100644 --- a/helpers/lotOccupancyDB/addLotOccupancyOccupant.js +++ b/helpers/lotOccupancyDB/addLotOccupancyOccupant.js @@ -16,7 +16,7 @@ export async function addLotOccupancyOccupant(lotOccupancyOccupantForm, requestS database .prepare(`insert into LotOccupancyOccupants ( lotOccupancyId, lotOccupantIndex, - occupantName, + occupantName, occupantFamilyName, occupantAddress1, occupantAddress2, occupantCity, occupantProvince, occupantPostalCode, occupantPhoneNumber, occupantEmailAddress, @@ -24,8 +24,8 @@ export async function addLotOccupancyOccupant(lotOccupancyOccupantForm, requestS lotOccupantTypeId, recordCreate_userName, recordCreate_timeMillis, recordUpdate_userName, recordUpdate_timeMillis) - values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) - .run(lotOccupancyOccupantForm.lotOccupancyId, lotOccupantIndex, lotOccupancyOccupantForm.occupantName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, lotOccupancyOccupantForm.occupantProvince, lotOccupancyOccupantForm.occupantPostalCode, lotOccupancyOccupantForm.occupantPhoneNumber, lotOccupancyOccupantForm.occupantEmailAddress, lotOccupancyOccupantForm.occupantComment ?? '', lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis); + values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) + .run(lotOccupancyOccupantForm.lotOccupancyId, lotOccupantIndex, lotOccupancyOccupantForm.occupantName, lotOccupancyOccupantForm.occupantFamilyName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, lotOccupancyOccupantForm.occupantProvince, lotOccupancyOccupantForm.occupantPostalCode, lotOccupancyOccupantForm.occupantPhoneNumber, lotOccupancyOccupantForm.occupantEmailAddress, lotOccupancyOccupantForm.occupantComment ?? '', lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis); if (connectedDatabase === undefined) { database.release(); } diff --git a/helpers/lotOccupancyDB/addLotOccupancyOccupant.ts b/helpers/lotOccupancyDB/addLotOccupancyOccupant.ts index 56ff03e9..bea702d9 100644 --- a/helpers/lotOccupancyDB/addLotOccupancyOccupant.ts +++ b/helpers/lotOccupancyDB/addLotOccupancyOccupant.ts @@ -7,6 +7,7 @@ interface AddLotOccupancyOccupantForm { lotOccupancyId: string | number lotOccupantTypeId: string | number occupantName: string + occupantFamilyName: string occupantAddress1: string occupantAddress2: string occupantCity: string @@ -46,7 +47,7 @@ export async function addLotOccupancyOccupant( .prepare( `insert into LotOccupancyOccupants ( lotOccupancyId, lotOccupantIndex, - occupantName, + occupantName, occupantFamilyName, occupantAddress1, occupantAddress2, occupantCity, occupantProvince, occupantPostalCode, occupantPhoneNumber, occupantEmailAddress, @@ -54,12 +55,13 @@ export async function addLotOccupancyOccupant( lotOccupantTypeId, recordCreate_userName, recordCreate_timeMillis, recordUpdate_userName, recordUpdate_timeMillis) - values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` + values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` ) .run( lotOccupancyOccupantForm.lotOccupancyId, lotOccupantIndex, lotOccupancyOccupantForm.occupantName, + lotOccupancyOccupantForm.occupantFamilyName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, diff --git a/helpers/lotOccupancyDB/copyLotOccupancy.js b/helpers/lotOccupancyDB/copyLotOccupancy.js index 3e99fb73..2c4f6349 100644 --- a/helpers/lotOccupancyDB/copyLotOccupancy.js +++ b/helpers/lotOccupancyDB/copyLotOccupancy.js @@ -27,6 +27,7 @@ export async function copyLotOccupancy(oldLotOccupancyId, requestSession) { lotOccupancyId: newLotOccupancyId, lotOccupantTypeId: occupant.lotOccupantTypeId, occupantName: occupant.occupantName, + occupantFamilyName: occupant.occupantFamilyName, occupantAddress1: occupant.occupantAddress1, occupantAddress2: occupant.occupantAddress2, occupantCity: occupant.occupantCity, diff --git a/helpers/lotOccupancyDB/copyLotOccupancy.ts b/helpers/lotOccupancyDB/copyLotOccupancy.ts index cbb47c8e..c020939d 100644 --- a/helpers/lotOccupancyDB/copyLotOccupancy.ts +++ b/helpers/lotOccupancyDB/copyLotOccupancy.ts @@ -63,6 +63,7 @@ export async function copyLotOccupancy( lotOccupancyId: newLotOccupancyId, lotOccupantTypeId: occupant.lotOccupantTypeId!, occupantName: occupant.occupantName!, + occupantFamilyName: occupant.occupantFamilyName!, occupantAddress1: occupant.occupantAddress1!, occupantAddress2: occupant.occupantAddress2!, occupantCity: occupant.occupantCity!, diff --git a/helpers/lotOccupancyDB/getLotOccupancyOccupants.js b/helpers/lotOccupancyDB/getLotOccupancyOccupants.js index 34db4de1..37291aa8 100644 --- a/helpers/lotOccupancyDB/getLotOccupancyOccupants.js +++ b/helpers/lotOccupancyDB/getLotOccupancyOccupants.js @@ -3,7 +3,7 @@ export async function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase const database = connectedDatabase ?? (await acquireConnection()); const lotOccupancyOccupants = database .prepare(`select o.lotOccupancyId, o.lotOccupantIndex, - o.occupantName, + o.occupantName, o.occupantFamilyName, o.occupantAddress1, o.occupantAddress2, o.occupantCity, o.occupantProvince, o.occupantPostalCode, o.occupantPhoneNumber, o.occupantEmailAddress, diff --git a/helpers/lotOccupancyDB/getLotOccupancyOccupants.ts b/helpers/lotOccupancyDB/getLotOccupancyOccupants.ts index aa3aae7f..7119b566 100644 --- a/helpers/lotOccupancyDB/getLotOccupancyOccupants.ts +++ b/helpers/lotOccupancyDB/getLotOccupancyOccupants.ts @@ -12,7 +12,7 @@ export async function getLotOccupancyOccupants( const lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] = database .prepare( `select o.lotOccupancyId, o.lotOccupantIndex, - o.occupantName, + o.occupantName, o.occupantFamilyName, o.occupantAddress1, o.occupantAddress2, o.occupantCity, o.occupantProvince, o.occupantPostalCode, o.occupantPhoneNumber, o.occupantEmailAddress, diff --git a/helpers/lotOccupancyDB/getPastLotOccupancyOccupants.js b/helpers/lotOccupancyDB/getPastLotOccupancyOccupants.js index b8213f40..7783bb3d 100644 --- a/helpers/lotOccupancyDB/getPastLotOccupancyOccupants.js +++ b/helpers/lotOccupancyDB/getPastLotOccupancyOccupants.js @@ -11,13 +11,14 @@ export async function getPastLotOccupancyOccupants(filters, options) { } sqlWhereClause += " and (o.occupantName like '%' || ? || '%'" + + " or o.occupantFamilyName like '%' || ? || '%'" + " or o.occupantAddress1 like '%' || ? || '%'" + " or o.occupantAddress2 like '%' || ? || '%'" + " or o.occupantCity like '%' || ? || '%')"; - sqlParameters.push(searchFilterPiece, searchFilterPiece, searchFilterPiece, searchFilterPiece); + sqlParameters.push(searchFilterPiece, searchFilterPiece, searchFilterPiece, searchFilterPiece, searchFilterPiece); } } - const sql = `select o.occupantName, + const sql = `select o.occupantName, o.occupantFamilyName, o.occupantAddress1, o.occupantAddress2, o.occupantCity, o.occupantProvince, o.occupantPostalCode, o.occupantPhoneNumber, o.occupantEmailAddress, diff --git a/helpers/lotOccupancyDB/getPastLotOccupancyOccupants.ts b/helpers/lotOccupancyDB/getPastLotOccupancyOccupants.ts index a33bd0ba..b0484d73 100644 --- a/helpers/lotOccupancyDB/getPastLotOccupancyOccupants.ts +++ b/helpers/lotOccupancyDB/getPastLotOccupancyOccupants.ts @@ -31,6 +31,7 @@ export async function getPastLotOccupancyOccupants( sqlWhereClause += " and (o.occupantName like '%' || ? || '%'" + + " or o.occupantFamilyName like '%' || ? || '%'" + " or o.occupantAddress1 like '%' || ? || '%'" + " or o.occupantAddress2 like '%' || ? || '%'" + " or o.occupantCity like '%' || ? || '%')" @@ -39,12 +40,13 @@ export async function getPastLotOccupancyOccupants( searchFilterPiece, searchFilterPiece, searchFilterPiece, + searchFilterPiece, searchFilterPiece ) } } - const sql = `select o.occupantName, + const sql = `select o.occupantName, o.occupantFamilyName, o.occupantAddress1, o.occupantAddress2, o.occupantCity, o.occupantProvince, o.occupantPostalCode, o.occupantPhoneNumber, o.occupantEmailAddress, diff --git a/helpers/lotOccupancyDB/getReportData.js b/helpers/lotOccupancyDB/getReportData.js index 96c0e068..cae23cec 100644 --- a/helpers/lotOccupancyDB/getReportData.js +++ b/helpers/lotOccupancyDB/getReportData.js @@ -25,6 +25,7 @@ const occupantCamelCase = camelCase(configFunctions.getProperty('aliases.occupan const lotOccupantIndexAlias = occupantCamelCase + 'Index'; const lotOccupantTypeAlias = occupantCamelCase + 'Type'; const occupantNameAlias = occupantCamelCase + 'Name'; +const occupantFamilyNameAlias = occupantCamelCase + 'FamilyName'; const occupantAddress1Alias = occupantCamelCase + 'Address1'; const occupantAddress2Alias = occupantCamelCase + 'Address2'; const occupantCityAlias = occupantCamelCase + 'City'; @@ -154,6 +155,7 @@ export async function getReportData(reportName, reportParameters = {}) { sql = `select o.lotOccupantIndex as ${lotOccupantIndexAlias}, t.lotOccupantType as ${lotOccupantTypeAlias}, o.occupantName as ${occupantNameAlias}, + o.occupantFamilyName as ${occupantFamilyNameAlias}, o.occupantAddress1 as ${occupantAddress1Alias}, o.occupantAddress2 as ${occupantAddress2Alias}, o.occupantCity as ${occupantCityAlias}, diff --git a/helpers/lotOccupancyDB/getReportData.ts b/helpers/lotOccupancyDB/getReportData.ts index 3e51aa6c..26572a4e 100644 --- a/helpers/lotOccupancyDB/getReportData.ts +++ b/helpers/lotOccupancyDB/getReportData.ts @@ -39,6 +39,7 @@ const occupantCamelCase = camelCase( const lotOccupantIndexAlias = occupantCamelCase + 'Index' const lotOccupantTypeAlias = occupantCamelCase + 'Type' const occupantNameAlias = occupantCamelCase + 'Name' +const occupantFamilyNameAlias = occupantCamelCase + 'FamilyName' const occupantAddress1Alias = occupantCamelCase + 'Address1' const occupantAddress2Alias = occupantCamelCase + 'Address2' const occupantCityAlias = occupantCamelCase + 'City' @@ -199,6 +200,7 @@ export async function getReportData( sql = `select o.lotOccupantIndex as ${lotOccupantIndexAlias}, t.lotOccupantType as ${lotOccupantTypeAlias}, o.occupantName as ${occupantNameAlias}, + o.occupantFamilyName as ${occupantFamilyNameAlias}, o.occupantAddress1 as ${occupantAddress1Alias}, o.occupantAddress2 as ${occupantAddress2Alias}, o.occupantCity as ${occupantCityAlias}, diff --git a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.d.ts b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.d.ts index 35c81527..652843b2 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.d.ts +++ b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.d.ts @@ -4,6 +4,7 @@ interface UpdateLotOccupancyOccupantForm { lotOccupantIndex: string | number; lotOccupantTypeId: string | number; occupantName: string; + occupantFamilyName: string; occupantAddress1: string; occupantAddress2: string; occupantCity: string; diff --git a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.js b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.js index 7e6e371f..60ac3e14 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.js +++ b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.js @@ -5,6 +5,7 @@ export async function updateLotOccupancyOccupant(lotOccupancyOccupantForm, reque const results = database .prepare(`update LotOccupancyOccupants set occupantName = ?, + occupantFamilyName = ?, occupantAddress1 = ?, occupantAddress2 = ?, occupantCity = ?, @@ -19,7 +20,7 @@ export async function updateLotOccupancyOccupant(lotOccupancyOccupantForm, reque where recordDelete_timeMillis is null and lotOccupancyId = ? and lotOccupantIndex = ?`) - .run(lotOccupancyOccupantForm.occupantName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, lotOccupancyOccupantForm.occupantProvince, lotOccupancyOccupantForm.occupantPostalCode, lotOccupancyOccupantForm.occupantPhoneNumber, lotOccupancyOccupantForm.occupantEmailAddress, lotOccupancyOccupantForm.occupantComment, lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user.userName, rightNowMillis, lotOccupancyOccupantForm.lotOccupancyId, lotOccupancyOccupantForm.lotOccupantIndex); + .run(lotOccupancyOccupantForm.occupantName, lotOccupancyOccupantForm.occupantFamilyName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, lotOccupancyOccupantForm.occupantProvince, lotOccupancyOccupantForm.occupantPostalCode, lotOccupancyOccupantForm.occupantPhoneNumber, lotOccupancyOccupantForm.occupantEmailAddress, lotOccupancyOccupantForm.occupantComment, lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user.userName, rightNowMillis, lotOccupancyOccupantForm.lotOccupancyId, lotOccupancyOccupantForm.lotOccupantIndex); database.release(); return results.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.ts b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.ts index badd4d52..46346dfa 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.ts +++ b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.ts @@ -7,6 +7,7 @@ interface UpdateLotOccupancyOccupantForm { lotOccupantIndex: string | number lotOccupantTypeId: string | number occupantName: string + occupantFamilyName: string occupantAddress1: string occupantAddress2: string occupantCity: string @@ -29,6 +30,7 @@ export async function updateLotOccupancyOccupant( .prepare( `update LotOccupancyOccupants set occupantName = ?, + occupantFamilyName = ?, occupantAddress1 = ?, occupantAddress2 = ?, occupantCity = ?, @@ -46,6 +48,7 @@ export async function updateLotOccupancyOccupant( ) .run( lotOccupancyOccupantForm.occupantName, + lotOccupancyOccupantForm.occupantFamilyName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js index 99c10d2d..35c960c8 100644 --- a/public-typescript/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit.js @@ -526,6 +526,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); } modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = ``; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName; + modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = lotOccupancyOccupant.occupantAddress2; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = lotOccupancyOccupant.occupantCity; @@ -598,7 +599,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function renderLotOccupancyOccupants() { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; const occupantsContainer = document.querySelector('#container--lotOccupancyOccupants'); cityssm.clearElement(occupantsContainer); if (lotOccupancyOccupants.length === 0) { @@ -623,9 +624,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotOccupancyOccupant.lotOccupantIndex.toString(); tableRowElement.innerHTML = '' + - cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' + cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === '' ? '(No Name)' - : lotOccupancyOccupant.occupantName) + + : lotOccupancyOccupant.occupantName + ' ' + lotOccupancyOccupant.occupantFamilyName) + '
' + ('' + '') + '' + ('' + - (((_b = lotOccupancyOccupant.occupantAddress1) !== null && _b !== void 0 ? _b : '') === '' + (((_c = lotOccupancyOccupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') === '' ? '' : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1) + '
') + - (((_c = lotOccupancyOccupant.occupantAddress2) !== null && _c !== void 0 ? _c : '') === '' + (((_d = lotOccupancyOccupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === '' ? '' : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress2) + '
') + - (((_d = lotOccupancyOccupant.occupantCity) !== null && _d !== void 0 ? _d : '') === '' + (((_e = lotOccupancyOccupant.occupantCity) !== null && _e !== void 0 ? _e : '') === '' ? '' : cityssm.escapeHTML(lotOccupancyOccupant.occupantCity) + ', ') + - cityssm.escapeHTML((_e = lotOccupancyOccupant.occupantProvince) !== null && _e !== void 0 ? _e : '') + + cityssm.escapeHTML((_f = lotOccupancyOccupant.occupantProvince) !== null && _f !== void 0 ? _f : '') + '
' + - cityssm.escapeHTML((_f = lotOccupancyOccupant.occupantPostalCode) !== null && _f !== void 0 ? _f : '') + + cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') + '') + ('' + - (((_g = lotOccupancyOccupant.occupantPhoneNumber) !== null && _g !== void 0 ? _g : '') === '' + (((_h = lotOccupancyOccupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === '' ? '' : cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) + '
') + - (((_h = lotOccupancyOccupant.occupantEmailAddress) !== null && _h !== void 0 ? _h : '') === '' + (((_j = lotOccupancyOccupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') === '' ? '' : cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)) + '') + ('' + '' + - cityssm.escapeHTML((_k = lotOccupancyOccupant.occupantComment) !== null && _k !== void 0 ? _k : '') + + cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantComment) !== null && _l !== void 0 ? _l : '') + '' + '') + ('' + @@ -773,7 +774,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); searchResultsElement.innerHTML = los.getLoadingParagraphHTML('Searching...'); cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (rawResponseJSON) => { - var _a, _b, _c, _d, _e, _f, _g, _h; + var _a, _b, _c, _d, _e, _f, _g, _h, _j; const responseJSON = rawResponseJSON; pastOccupantSearchResults = responseJSON.occupants; const panelElement = document.createElement('div'); @@ -785,27 +786,29 @@ Object.defineProperty(exports, "__esModule", { value: true }); panelBlockElement.innerHTML = '' + cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '') + + ' ' + + cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') + '' + '
' + '
' + ('
' + - cityssm.escapeHTML((_b = occupant.occupantAddress1) !== null && _b !== void 0 ? _b : '') + + cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') + '
' + - (((_c = occupant.occupantAddress2) !== null && _c !== void 0 ? _c : '') === '' + (((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === '' ? '' : cityssm.escapeHTML(occupant.occupantAddress2) + '
') + - cityssm.escapeHTML((_d = occupant.occupantCity) !== null && _d !== void 0 ? _d : '') + + cityssm.escapeHTML((_e = occupant.occupantCity) !== null && _e !== void 0 ? _e : '') + ', ' + - cityssm.escapeHTML((_e = occupant.occupantProvince) !== null && _e !== void 0 ? _e : '') + + cityssm.escapeHTML((_f = occupant.occupantProvince) !== null && _f !== void 0 ? _f : '') + '
' + - cityssm.escapeHTML((_f = occupant.occupantPostalCode) !== null && _f !== void 0 ? _f : '') + + cityssm.escapeHTML((_g = occupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') + '
') + ('
' + - (((_g = occupant.occupantPhoneNumber) !== null && _g !== void 0 ? _g : '') === '' + (((_h = occupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === '' ? '' : cityssm.escapeHTML(occupant.occupantPhoneNumber) + '
') + - cityssm.escapeHTML((_h = occupant.occupantEmailAddress) !== null && _h !== void 0 ? _h : '') + + cityssm.escapeHTML((_j = occupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') + '
' + '
') + '
'; diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js index 6f46332b..c44b7ed6 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js @@ -67,6 +67,7 @@ function openEditLotOccupancyOccupant(clickEvent) { } modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = ``; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName; + modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = lotOccupancyOccupant.occupantAddress2; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = lotOccupancyOccupant.occupantCity; @@ -139,7 +140,7 @@ function deleteLotOccupancyOccupant(clickEvent) { }); } function renderLotOccupancyOccupants() { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; const occupantsContainer = document.querySelector('#container--lotOccupancyOccupants'); cityssm.clearElement(occupantsContainer); if (lotOccupancyOccupants.length === 0) { @@ -164,9 +165,9 @@ function renderLotOccupancyOccupants() { lotOccupancyOccupant.lotOccupantIndex.toString(); tableRowElement.innerHTML = '' + - cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' + cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === '' ? '(No Name)' - : lotOccupancyOccupant.occupantName) + + : lotOccupancyOccupant.occupantName + ' ' + lotOccupancyOccupant.occupantFamilyName) + '
' + ('' + '' + - cityssm.escapeHTML((_k = lotOccupancyOccupant.occupantComment) !== null && _k !== void 0 ? _k : '') + + cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantComment) !== null && _l !== void 0 ? _l : '') + '' + '') + ('' + @@ -314,7 +315,7 @@ else { searchResultsElement.innerHTML = los.getLoadingParagraphHTML('Searching...'); cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (rawResponseJSON) => { - var _a, _b, _c, _d, _e, _f, _g, _h; + var _a, _b, _c, _d, _e, _f, _g, _h, _j; const responseJSON = rawResponseJSON; pastOccupantSearchResults = responseJSON.occupants; const panelElement = document.createElement('div'); @@ -326,27 +327,29 @@ else { panelBlockElement.innerHTML = '' + cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '') + + ' ' + + cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') + '' + '
' + '
' + ('
' + - cityssm.escapeHTML((_b = occupant.occupantAddress1) !== null && _b !== void 0 ? _b : '') + + cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') + '
' + - (((_c = occupant.occupantAddress2) !== null && _c !== void 0 ? _c : '') === '' + (((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === '' ? '' : cityssm.escapeHTML(occupant.occupantAddress2) + '
') + - cityssm.escapeHTML((_d = occupant.occupantCity) !== null && _d !== void 0 ? _d : '') + + cityssm.escapeHTML((_e = occupant.occupantCity) !== null && _e !== void 0 ? _e : '') + ', ' + - cityssm.escapeHTML((_e = occupant.occupantProvince) !== null && _e !== void 0 ? _e : '') + + cityssm.escapeHTML((_f = occupant.occupantProvince) !== null && _f !== void 0 ? _f : '') + '
' + - cityssm.escapeHTML((_f = occupant.occupantPostalCode) !== null && _f !== void 0 ? _f : '') + + cityssm.escapeHTML((_g = occupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') + '
') + ('
' + - (((_g = occupant.occupantPhoneNumber) !== null && _g !== void 0 ? _g : '') === '' + (((_h = occupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === '' ? '' : cityssm.escapeHTML(occupant.occupantPhoneNumber) + '
') + - cityssm.escapeHTML((_h = occupant.occupantEmailAddress) !== null && _h !== void 0 ? _h : '') + + cityssm.escapeHTML((_j = occupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') + '
' + '
') + '
'; diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts index 52c7a2f8..a8030eeb 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts @@ -131,6 +131,11 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { '#lotOccupancyOccupantEdit--occupantName' ) as HTMLInputElement ).value = lotOccupancyOccupant.occupantName! + ;( + modalElement.querySelector( + '#lotOccupancyOccupantEdit--occupantFamilyName' + ) as HTMLInputElement + ).value = lotOccupancyOccupant.occupantFamilyName! ;( modalElement.querySelector( '#lotOccupancyOccupantEdit--occupantAddress1' @@ -302,9 +307,9 @@ function renderLotOccupancyOccupants(): void { tableRowElement.innerHTML = '' + cityssm.escapeHTML( - (lotOccupancyOccupant.occupantName ?? '') === '' + (lotOccupancyOccupant.occupantName ?? '') === '' && (lotOccupancyOccupant.occupantFamilyName ?? '') === '' ? '(No Name)' - : lotOccupancyOccupant.occupantName! + : lotOccupancyOccupant.occupantName! + ' ' + lotOccupancyOccupant.occupantFamilyName! ) + '
' + ('' + @@ -526,6 +531,8 @@ document panelBlockElement.innerHTML = '' + cityssm.escapeHTML(occupant.occupantName ?? '') + + ' ' + + cityssm.escapeHTML(occupant.occupantFamilyName ?? '') + '' + '
' + '
' + diff --git a/public-typescript/lotOccupancySearch.js b/public-typescript/lotOccupancySearch.js index 054ed93c..39bbb835 100644 --- a/public-typescript/lotOccupancySearch.js +++ b/public-typescript/lotOccupancySearch.js @@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10); const offsetElement = document.querySelector('#searchFilter--offset'); function renderLotOccupancies(responseJSON) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; if (responseJSON.lotOccupancies.length === 0) { searchResultsContainerElement.innerHTML = `

@@ -50,23 +50,27 @@ Object.defineProperty(exports, "__esModule", { value: true }); : occupant.fontAwesomeIconClass) + '" aria-hidden="true"> ') + cityssm.escapeHTML((_c = occupant.occupantName) !== null && _c !== void 0 ? _c : '') + + ' ' + + cityssm.escapeHTML((_d = occupant.occupantFamilyName) !== null && _d !== void 0 ? _d : '') + '
'; } - const feeTotal = ((_e = (_d = lotOccupancy.lotOccupancyFees) === null || _d === void 0 ? void 0 : _d.reduce((soFar, currentFee) => { + const feeTotal = ((_f = (_e = lotOccupancy.lotOccupancyFees) === null || _e === void 0 ? void 0 : _e.reduce((soFar, currentFee) => { var _a, _b, _c; return (soFar + (((_a = currentFee.feeAmount) !== null && _a !== void 0 ? _a : 0) + ((_b = currentFee.taxAmount) !== null && _b !== void 0 ? _b : 0)) * ((_c = currentFee.quantity) !== null && _c !== void 0 ? _c : 0)); - }, 0)) !== null && _e !== void 0 ? _e : 0).toFixed(2); - const transactionTotal = ((_g = (_f = lotOccupancy.lotOccupancyTransactions) === null || _f === void 0 ? void 0 : _f.reduce((soFar, currentTransaction) => { + }, 0)) !== null && _f !== void 0 ? _f : 0).toFixed(2); + const transactionTotal = ((_h = (_g = lotOccupancy.lotOccupancyTransactions) === null || _g === void 0 ? void 0 : _g.reduce((soFar, currentTransaction) => { return soFar + currentTransaction.transactionAmount; - }, 0)) !== null && _g !== void 0 ? _g : 0).toFixed(2); + }, 0)) !== null && _h !== void 0 ? _h : 0).toFixed(2); let feeIconHTML = ''; if (feeTotal !== '0.00' || transactionTotal !== '0.00') { feeIconHTML = ` - + `; } resultsTbodyElement.insertAdjacentHTML('beforeend', '' + @@ -79,12 +83,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); '' + '') + ('' + - (((_h = lotOccupancy.lotId) !== null && _h !== void 0 ? _h : -1) === -1 + (((_j = lotOccupancy.lotId) !== null && _j !== void 0 ? _j : -1) === -1 ? '(No ' + los.escapedAliases.Lot + ')' : '' + @@ -92,7 +96,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); '') + '
' + ('' + - cityssm.escapeHTML((_k = lotOccupancy.mapName) !== null && _k !== void 0 ? _k : '') + + cityssm.escapeHTML((_l = lotOccupancy.mapName) !== null && _l !== void 0 ? _l : '') + '') + '') + ('' + lotOccupancy.occupancyStartDateString + '') + @@ -134,10 +138,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); .querySelector('table') .append(resultsTbodyElement); searchResultsContainerElement.insertAdjacentHTML('beforeend', los.getSearchResultsPagerHTML(limit, responseJSON.offset, responseJSON.count)); - (_l = searchResultsContainerElement - .querySelector("button[data-page='previous']")) === null || _l === void 0 ? void 0 : _l.addEventListener('click', previousAndGetLotOccupancies); (_m = searchResultsContainerElement - .querySelector("button[data-page='next']")) === null || _m === void 0 ? void 0 : _m.addEventListener('click', nextAndGetLotOccupancies); + .querySelector("button[data-page='previous']")) === null || _m === void 0 ? void 0 : _m.addEventListener('click', previousAndGetLotOccupancies); + (_o = searchResultsContainerElement + .querySelector("button[data-page='next']")) === null || _o === void 0 ? void 0 : _o.addEventListener('click', nextAndGetLotOccupancies); } function getLotOccupancies() { searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Occupancies}...`); diff --git a/public-typescript/lotOccupancySearch.ts b/public-typescript/lotOccupancySearch.ts index 3fcb221c..477a4790 100644 --- a/public-typescript/lotOccupancySearch.ts +++ b/public-typescript/lotOccupancySearch.ts @@ -81,25 +81,29 @@ declare const cityssm: cityssmGlobal ) + '" aria-hidden="true">
') + cityssm.escapeHTML(occupant.occupantName ?? '') + + ' ' + + cityssm.escapeHTML(occupant.occupantFamilyName ?? '') + '
' } - const feeTotal = - (lotOccupancy.lotOccupancyFees?.reduce((soFar, currentFee): number => { + const feeTotal = ( + lotOccupancy.lotOccupancyFees?.reduce((soFar, currentFee): number => { return ( soFar + ((currentFee.feeAmount ?? 0) + (currentFee.taxAmount ?? 0)) * (currentFee.quantity ?? 0) ) - }, 0) ?? 0).toFixed(2) + }, 0) ?? 0 + ).toFixed(2) - const transactionTotal = - (lotOccupancy.lotOccupancyTransactions?.reduce( + const transactionTotal = ( + lotOccupancy.lotOccupancyTransactions?.reduce( (soFar, currentTransaction): number => { return soFar + currentTransaction.transactionAmount }, 0 - ) ?? 0).toFixed(2) + ) ?? 0 + ).toFixed(2) let feeIconHTML = '' @@ -108,7 +112,9 @@ declare const cityssm: cityssmGlobal data-tooltip="Total Fees: $${feeTotal}" aria-label="Total Fees: $${feeTotal}"> ` } diff --git a/public-typescript/workOrderEdit.js b/public-typescript/workOrderEdit.js index 2c59ac6c..2db20a7d 100644 --- a/public-typescript/workOrderEdit.js +++ b/public-typescript/workOrderEdit.js @@ -322,6 +322,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); los.escapedAliases.Occupant + '"> ' + cityssm.escapeHTML(occupant.occupantName) + + ' ' + + cityssm.escapeHTML(occupant.occupantFamilyName) + '
'); }, '')) + '') + @@ -568,7 +570,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); ? '(No ' + cityssm.escapeHTML(los.escapedAliases.Occupants) + ')' - : cityssm.escapeHTML(lotOccupancy.lotOccupancyOccupants[0].occupantName) + + : cityssm.escapeHTML(lotOccupancy.lotOccupancyOccupants[0].occupantName + + ' ' + + lotOccupancy.lotOccupancyOccupants[0] + .occupantFamilyName) + (lotOccupancy.lotOccupancyOccupants.length > 1 ? ' plus ' + (lotOccupancy.lotOccupancyOccupants.length - 1) diff --git a/public-typescript/workOrderEdit/workOrderEditLots.js b/public-typescript/workOrderEdit/workOrderEditLots.js index cbcac1f7..608fd3cb 100644 --- a/public-typescript/workOrderEdit/workOrderEditLots.js +++ b/public-typescript/workOrderEdit/workOrderEditLots.js @@ -185,6 +185,8 @@ function renderRelatedOccupancies() { los.escapedAliases.Occupant + '"> ' + cityssm.escapeHTML(occupant.occupantName) + + ' ' + + cityssm.escapeHTML(occupant.occupantFamilyName) + '
'); }, '')) + '') + @@ -431,7 +433,10 @@ function doAddLotOccupancy(clickEvent) { ? '(No ' + cityssm.escapeHTML(los.escapedAliases.Occupants) + ')' - : cityssm.escapeHTML(lotOccupancy.lotOccupancyOccupants[0].occupantName) + + : cityssm.escapeHTML(lotOccupancy.lotOccupancyOccupants[0].occupantName + + ' ' + + lotOccupancy.lotOccupancyOccupants[0] + .occupantFamilyName) + (lotOccupancy.lotOccupancyOccupants.length > 1 ? ' plus ' + (lotOccupancy.lotOccupancyOccupants.length - 1) diff --git a/public-typescript/workOrderEdit/workOrderEditLots.ts b/public-typescript/workOrderEdit/workOrderEditLots.ts index 79b5c4d4..c9bc468c 100644 --- a/public-typescript/workOrderEdit/workOrderEditLots.ts +++ b/public-typescript/workOrderEdit/workOrderEditLots.ts @@ -263,6 +263,8 @@ function renderRelatedOccupancies(): void { los.escapedAliases.Occupant + '"> ' + cityssm.escapeHTML(occupant.occupantName!) + + ' ' + + cityssm.escapeHTML(occupant.occupantFamilyName!) + '
' ) }, '')) + @@ -610,7 +612,10 @@ document cityssm.escapeHTML(los.escapedAliases.Occupants) + ')' : cityssm.escapeHTML( - lotOccupancy.lotOccupancyOccupants![0].occupantName! + lotOccupancy.lotOccupancyOccupants![0].occupantName! + + ' ' + + lotOccupancy.lotOccupancyOccupants![0] + .occupantFamilyName! ) + (lotOccupancy.lotOccupancyOccupants!.length > 1 ? ' plus ' + @@ -811,7 +816,6 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => { }, onremoved() { bulmaJS.toggleHtmlClipped() - ;(document.querySelector('#button--addLot') as HTMLButtonElement).focus() } }) diff --git a/public-typescript/workOrderMilestoneCalendar.js b/public-typescript/workOrderMilestoneCalendar.js index 8bf13ade..c99e8252 100644 --- a/public-typescript/workOrderMilestoneCalendar.js +++ b/public-typescript/workOrderMilestoneCalendar.js @@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const workOrderMilestoneDateStringElement = workOrderSearchFiltersFormElement.querySelector('#searchFilter--workOrderMilestoneDateString'); const milestoneCalendarContainerElement = document.querySelector('#container--milestoneCalendar'); function renderMilestones(workOrderMilestones) { - var _a, _b, _c, _d, _e, _f, _g; + var _a, _b, _c, _d, _e, _f, _g, _h; if (workOrderMilestones.length === 0) { milestoneCalendarContainerElement.innerHTML = `

There are no milestones that meet the search criteria.

@@ -58,6 +58,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); los.escapedAliases.Occupancy + '"> ' + cityssm.escapeHTML((_d = occupant.occupantName) !== null && _d !== void 0 ? _d : '') + + ' ' + + cityssm.escapeHTML((_e = occupant.occupantFamilyName) !== null && _e !== void 0 ? _e : '') + '' + '
'; } @@ -86,15 +88,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); '
') + ('
' + '' + ' ' + - cityssm.escapeHTML((_f = milestone.workOrderNumber) !== null && _f !== void 0 ? _f : '') + + cityssm.escapeHTML((_g = milestone.workOrderNumber) !== null && _g !== void 0 ? _g : '') + '
' + '' + - cityssm.escapeHTML((_g = milestone.workOrderDescription) !== null && _g !== void 0 ? _g : '') + + cityssm.escapeHTML((_h = milestone.workOrderDescription) !== null && _h !== void 0 ? _h : '') + '' + '
') + ('
' + lotOccupancyHTML + '
') + diff --git a/public-typescript/workOrderMilestoneCalendar.ts b/public-typescript/workOrderMilestoneCalendar.ts index 9d528202..eacaf112 100644 --- a/public-typescript/workOrderMilestoneCalendar.ts +++ b/public-typescript/workOrderMilestoneCalendar.ts @@ -93,6 +93,8 @@ declare const cityssm: cityssmGlobal los.escapedAliases.Occupancy + '"> ' + cityssm.escapeHTML(occupant.occupantName ?? '') + + ' ' + + cityssm.escapeHTML(occupant.occupantFamilyName ?? '') + '' + '
' } diff --git a/public-typescript/workOrderSearch.js b/public-typescript/workOrderSearch.js index 3941fd6b..6b61bb65 100644 --- a/public-typescript/workOrderSearch.js +++ b/public-typescript/workOrderSearch.js @@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10); const offsetElement = document.querySelector('#searchFilter--offset'); function renderWorkOrders(responseJSON) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; if (responseJSON.workOrders.length === 0) { searchResultsContainerElement.innerHTML = '
' + @@ -47,9 +47,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); '" aria-label="' + los.escapedAliases.occupant + '"> ' + - cityssm.escapeHTML(((_e = occupant.occupantName) !== null && _e !== void 0 ? _e : '') === '' + cityssm.escapeHTML(((_e = occupant.occupantName) !== null && _e !== void 0 ? _e : '') === '' && ((_f = occupant.occupantFamilyName) !== null && _f !== void 0 ? _f : '') === '' ? '(No Name)' - : occupant.occupantName) + + : occupant.occupantName + ' ' + occupant.occupantFamilyName) + '
'; } } @@ -59,15 +59,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); los.getWorkOrderURL(workOrder.workOrderId) + '">' + (workOrder.workOrderNumber.trim() - ? cityssm.escapeHTML((_f = workOrder.workOrderNumber) !== null && _f !== void 0 ? _f : '') + ? cityssm.escapeHTML((_g = workOrder.workOrderNumber) !== null && _g !== void 0 ? _g : '') : '(No Number)') + '' + '') + ('' + - cityssm.escapeHTML((_g = workOrder.workOrderType) !== null && _g !== void 0 ? _g : '') + + cityssm.escapeHTML((_h = workOrder.workOrderType) !== null && _h !== void 0 ? _h : '') + '
' + '' + - cityssm.escapeHTML((_h = workOrder.workOrderDescription) !== null && _h !== void 0 ? _h : '') + + cityssm.escapeHTML((_j = workOrder.workOrderDescription) !== null && _j !== void 0 ? _j : '') + '' + '') + ('' + @@ -132,10 +132,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); searchResultsContainerElement .querySelector('table') .append(resultsTbodyElement); - (_j = searchResultsContainerElement - .querySelector("button[data-page='previous']")) === null || _j === void 0 ? void 0 : _j.addEventListener('click', previousAndGetWorkOrders); (_k = searchResultsContainerElement - .querySelector("button[data-page='next']")) === null || _k === void 0 ? void 0 : _k.addEventListener('click', nextAndGetWorkOrders); + .querySelector("button[data-page='previous']")) === null || _k === void 0 ? void 0 : _k.addEventListener('click', previousAndGetWorkOrders); + (_l = searchResultsContainerElement + .querySelector("button[data-page='next']")) === null || _l === void 0 ? void 0 : _l.addEventListener('click', nextAndGetWorkOrders); } function getWorkOrders() { searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML('Loading Work Orders...'); diff --git a/public-typescript/workOrderSearch.ts b/public-typescript/workOrderSearch.ts index 782dc8fd..a02e8be3 100644 --- a/public-typescript/workOrderSearch.ts +++ b/public-typescript/workOrderSearch.ts @@ -80,9 +80,9 @@ declare const cityssm: cityssmGlobal los.escapedAliases.occupant + '"> ' + cityssm.escapeHTML( - (occupant.occupantName ?? '') === '' + (occupant.occupantName ?? '') === '' && (occupant.occupantFamilyName ?? '') === '' ? '(No Name)' - : occupant.occupantName! + : occupant.occupantName! + ' ' + occupant.occupantFamilyName! ) + '
' } diff --git a/public/html/lotOccupancy-addOccupant.html b/public/html/lotOccupancy-addOccupant.html index ab29c518..47e95b00 100644 --- a/public/html/lotOccupancy-addOccupant.html +++ b/public/html/lotOccupancy-addOccupant.html @@ -64,22 +64,44 @@
-
- -
- +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
-
- -
- +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js index d3846d1e..dde0f03b 100644 --- a/public/javascripts/lotOccupancyEdit.min.js +++ b/public/javascripts/lotOccupancyEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,c,n,o;const a=exports.los,s=document.querySelector("#lotOccupancy--lotOccupancyId").value,l=""===s;let r=l;const u=document.querySelector("#form--lotOccupancy");u.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/"+(l?"doCreateLotOccupancy":"doUpdateLotOccupancy"),u,e=>{var t;e.success?(a.clearUnsavedChanges(),l||r?window.location.href=a.getLotOccupancyURL(e.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:"Error Saving "+a.escapedAliases.Occupancy,message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const i=u.querySelectorAll("input, select");for(const e of i)e.addEventListener("change",a.setUnsavedChanges);function d(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doCopyLotOccupancy",{lotOccupancyId:s},e=>{var t;e.success?(cityssm.disableNavBlocker(),window.location.href=a.getLotOccupancyURL(e.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(b=document.querySelector("#button--copyLotOccupancy"))||void 0===b||b.addEventListener("click",e=>{e.preventDefault(),a.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${a.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:d}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${a.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancy",{lotOccupancyId:s},e=>{var t;e.success?(cityssm.disableNavBlocker(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function c(e){e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/workOrders/doCreateWorkOrder",e.currentTarget,e=>{e.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(e.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:e.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=s,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const c=e.querySelector("#workOrderCreate--workOrderTypeId"),n=exports.workOrderTypes;1===n.length&&(c.innerHTML="");for(const e of n){const n=document.createElement("option");n.value=e.workOrderTypeId.toString(),n.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",c.append(n)}},onshown(e,n){var o;t=n,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const p=document.querySelector("#lotOccupancy--occupancyTypeId");if(l){const e=document.querySelector("#container--lotOccupancyFields");p.addEventListener("change",()=>{""!==p.value?cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetOccupancyTypeFields",{occupancyTypeId:p.value},t=>{var c,n;if(0===t.occupancyTypeFields.length)return void(e.innerHTML=`
\n

There are no additional fields for this ${a.escapedAliases.occupancy} type.

\n
`);e.innerHTML="";let o="";for(const a of t.occupancyTypeFields){o+=","+a.occupancyTypeFieldId.toString();const t="lotOccupancyFieldValue_"+a.occupancyTypeFieldId.toString(),s="lotOccupancy--"+t,l=document.createElement("div");if(l.className="field",l.innerHTML=`
`,l.querySelector("label").textContent=a.occupancyTypeField,""===(null!==(c=a.occupancyTypeFieldValues)&&void 0!==c?c:"")){const e=document.createElement("input");e.className="input",e.id=s,e.name=t,e.type="text",e.required=a.isRequired,e.minLength=a.minimumLength,e.maxLength=a.maximumLength,""!==(null!==(n=a.pattern)&&void 0!==n?n:"")&&(e.pattern=a.pattern),l.querySelector(".control").append(e)}else{l.querySelector(".control").innerHTML=`
\n \n
`;const e=l.querySelector("select");e.required=a.isRequired;const c=a.occupancyTypeFieldValues.split("\n");for(const t of c){const c=document.createElement("option");c.value=t,c.textContent=t,e.append(c)}}console.log(l),e.append(l)}e.insertAdjacentHTML("beforeend",``)}):e.innerHTML=`
\n

Select the ${a.escapedAliases.occupancy} type to load the available fields.

\n
`})}else{const e=p.value;p.addEventListener("change",()=>{p.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${a.escapedAliases.occupancy} type?\n\n This change affects the additional fields associated with this record, and may also affect the available fees.`,contextualColorName:"warning",okButton:{text:"Yes, Keep the Change",callbackFunction:()=>{r=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{p.value=e}}})})}const m=document.querySelector("#lotOccupancy--lotName");m.addEventListener("click",e=>{const t=e.currentTarget.value;let c,n,o,s;function l(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,a.setUnsavedChanges(),c()}function r(e){e.preventDefault();const t=e.currentTarget;l(t.dataset.lotId,t.dataset.lotName)}function u(){s.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(a.urlPrefix+"/lots/doSearchLots",o,e=>{var t,c;if(0===e.count)return void(s.innerHTML='
\n

No results.

\n
');const n=document.createElement("div");n.className="panel";for(const o of e.lots){const e=document.createElement("a");e.className="panel-block is-block",e.href="#",e.dataset.lotId=o.lotId.toString(),e.dataset.lotName=o.lotName,e.innerHTML='
'+cityssm.escapeHTML(null!==(t=o.lotName)&&void 0!==t?t:"")+'
'+cityssm.escapeHTML(null!==(c=o.mapName)&&void 0!==c?c:"")+'
'+cityssm.escapeHTML(o.lotStatus)+'
'+(o.lotOccupancyCount>0?"Currently Occupied":"")+"
",e.addEventListener("click",r),n.append(e)}s.innerHTML="",s.append(n)})}function i(e){e.preventDefault();const t=n.querySelector("#lotCreate--lotName").value;cityssm.postJSON(a.urlPrefix+"/lots/doCreateLot",e.currentTarget,e=>{var c;e.success?l(e.lotId,t):bulmaJS.alert({title:`Error Creating ${a.escapedAliases.Lot}`,message:null!==(c=e.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-selectLot",{onshow(e){a.populateAliases(e)},onshown(e,a){var l;bulmaJS.toggleHtmlClipped(),n=e,c=a,bulmaJS.init(e);const r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const d=e.querySelector("#lotSelect--occupancyStatus");if(d.addEventListener("change",u),""!==t&&(d.value=""),o=e.querySelector("#form--lotSelect"),s=e.querySelector("#resultsContainer--lotSelect"),o.addEventListener("submit",e=>{e.preventDefault()}),u(),exports.lotNamePattern){const t=exports.lotNamePattern;e.querySelector("#lotCreate--lotName").pattern=t.source}const p=e.querySelector("#lotCreate--lotTypeId");for(const e of exports.lotTypes){const t=document.createElement("option");t.value=e.lotTypeId.toString(),t.textContent=e.lotType,p.append(t)}const m=e.querySelector("#lotCreate--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,m.append(t)}const y=e.querySelector("#lotCreate--mapId");for(const e of exports.maps){const t=document.createElement("option");t.value=e.mapId.toString(),t.textContent=""===(null!==(l=e.mapName)&&void 0!==l?l:"")?"(No Name)":e.mapName,y.append(t)}e.querySelector("#form--lotCreate").addEventListener("submit",i)},onremoved(){bulmaJS.toggleHtmlClipped()}})}),null===(c=document.querySelector(".is-lot-view-button"))||void 0===c||c.addEventListener("click",()=>{const e=document.querySelector("#lotOccupancy--lotId").value;""===e?bulmaJS.alert({message:`No ${a.escapedAliases.lot} selected.`,contextualColorName:"info"}):window.open(a.urlPrefix+"/lots/"+e)}),null===(n=document.querySelector(".is-clear-lot-button"))||void 0===n||n.addEventListener("click",()=>{m.disabled?bulmaJS.alert({message:"You need to unlock the field before clearing it.",contextualColorName:"info"}):(m.value=`(No ${a.escapedAliases.Lot})`,document.querySelector("#lotOccupancy--lotId").value="",a.setUnsavedChanges())}),a.initializeDatePickers(u),null===(o=document.querySelector("#lotOccupancy--occupancyStartDateString"))||void 0===o||o.addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),a.initializeUnlockFieldButtons(u),Object.defineProperty(exports,"__esModule",{value:!0});let y=exports.lotOccupancyOccupants;function v(e){const t=Number.parseInt(e.currentTarget.closest("tr").dataset.lotOccupantIndex,10),c=y.find(e=>e.lotOccupantIndex===t);let n,o;function l(e){e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyOccupant",n,e=>{var t;const c=e;c.success?(y=c.lotOccupancyOccupants,o(),f()):bulmaJS.alert({title:"Error Updating "+a.escapedAliases.Occupant,message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow(e){var n;a.populateAliases(e),e.querySelector("#lotOccupancyOccupantEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyOccupantEdit--lotOccupantIndex").value=t.toString();const o=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");let l=!1;for(const e of exports.lotOccupantTypes){const t=document.createElement("option");t.value=e.lotOccupantTypeId.toString(),t.textContent=e.lotOccupantType,t.dataset.occupantCommentTitle=e.occupantCommentTitle,t.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,e.lotOccupantTypeId===c.lotOccupantTypeId&&(t.selected=!0,l=!0),o.append(t)}if(!l){const e=document.createElement("option");e.value=c.lotOccupantTypeId.toString(),e.textContent=c.lotOccupantType,e.dataset.occupantCommentTitle=c.occupantCommentTitle,e.dataset.fontAwesomeIconClass=c.fontAwesomeIconClass,e.selected=!0,o.append(e)}e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=``,e.querySelector("#lotOccupancyOccupantEdit--occupantName").value=c.occupantName,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress1").value=c.occupantAddress1,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress2").value=c.occupantAddress2,e.querySelector("#lotOccupancyOccupantEdit--occupantCity").value=c.occupantCity,e.querySelector("#lotOccupancyOccupantEdit--occupantProvince").value=c.occupantProvince,e.querySelector("#lotOccupancyOccupantEdit--occupantPostalCode").value=c.occupantPostalCode,e.querySelector("#lotOccupancyOccupantEdit--occupantPhoneNumber").value=c.occupantPhoneNumber,e.querySelector("#lotOccupancyOccupantEdit--occupantEmailAddress").value=c.occupantEmailAddress,e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=""===(null!==(n=c.occupantCommentTitle)&&void 0!==n?n:"")?"Comment":c.occupantCommentTitle,e.querySelector("#lotOccupancyOccupantEdit--occupantComment").value=c.occupantComment},onshown(e,t){bulmaJS.toggleHtmlClipped();const c=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");c.focus(),c.addEventListener("change",()=>{var t,n;const o=null!==(t=c.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==t?t:"user";e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=``;let a=null!==(n=c.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==n?n:"";""===a&&(a="Comment"),e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=a}),(n=e.querySelector("form")).addEventListener("submit",l),o=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function O(e){const t=e.currentTarget.closest("tr").dataset.lotOccupantIndex;bulmaJS.confirm({title:`Remove ${a.escapedAliases.Occupant}?`,message:`Are you sure you want to remove this ${a.escapedAliases.occupant}?`,okButton:{text:"Yes, Remove "+a.escapedAliases.Occupant,callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyOccupant",{lotOccupancyId:s,lotOccupantIndex:t},e=>{var t;const c=e;c.success?(y=c.lotOccupancyOccupants,f()):bulmaJS.alert({title:"Error Removing "+a.escapedAliases.Occupant,message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function f(){var e,t,c,n,o,s,l,r,u,i;const d=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(d),0===y.length)return void(d.innerHTML=`
\n

There are no ${a.escapedAliases.occupants} associated with this record.

\n
`);const p=document.createElement("table");p.className="table is-fullwidth is-striped is-hoverable",p.innerHTML=`\n ${a.escapedAliases.Occupant}\n Address\n Other Contact\n Comment\n Options\n \n `;for(const a of y){const d=document.createElement("tr");d.dataset.lotOccupantIndex=a.lotOccupantIndex.toString(),d.innerHTML=""+cityssm.escapeHTML(""===(null!==(e=a.occupantName)&&void 0!==e?e:"")?"(No Name)":a.occupantName)+'
'+cityssm.escapeHTML(a.lotOccupantType)+""+(""===(null!==(t=a.occupantAddress1)&&void 0!==t?t:"")?"":cityssm.escapeHTML(a.occupantAddress1)+"
")+(""===(null!==(c=a.occupantAddress2)&&void 0!==c?c:"")?"":cityssm.escapeHTML(a.occupantAddress2)+"
")+(""===(null!==(n=a.occupantCity)&&void 0!==n?n:"")?"":cityssm.escapeHTML(a.occupantCity)+", ")+cityssm.escapeHTML(null!==(o=a.occupantProvince)&&void 0!==o?o:"")+"
"+cityssm.escapeHTML(null!==(s=a.occupantPostalCode)&&void 0!==s?s:"")+""+(""===(null!==(l=a.occupantPhoneNumber)&&void 0!==l?l:"")?"":cityssm.escapeHTML(a.occupantPhoneNumber)+"
")+(""===(null!==(r=a.occupantEmailAddress)&&void 0!==r?r:"")?"":cityssm.escapeHTML(a.occupantEmailAddress))+''+cityssm.escapeHTML(null!==(i=a.occupantComment)&&void 0!==i?i:"")+'
',d.querySelector(".button--edit").addEventListener("click",v),d.querySelector(".button--delete").addEventListener("click",O),p.querySelector("tbody").append(d)}d.append(p)}if(delete exports.lotOccupancyOccupants,l){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{var t;const c=u.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const t of c)t.disabled=""===e.value;let n=null!==(t=e.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===n&&(n="Comment"),u.querySelector("#lotOccupancy--occupantCommentTitle").textContent=n})}else f();if(null===(b=document.querySelector("#button--addOccupant"))||void 0===b||b.addEventListener("click",()=>{let e,t,c,n;function o(t){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyOccupant",t,t=>{var c;const n=t;n.success?(y=n.lotOccupancyOccupants,e(),f()):bulmaJS.alert({title:`Error Adding ${a.escapedAliases.Occupant}`,message:null!==(c=n.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}function l(e){e.preventDefault(),o(t)}let r=[];function u(e){e.preventDefault();const t=e.currentTarget,c=r[Number.parseInt(t.dataset.index,10)],n=t.closest(".modal").querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId").value;""===n?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(c.lotOccupantTypeId=Number.parseInt(n,10),c.lotOccupancyId=Number.parseInt(s,10),o(c))}function i(e){e.preventDefault(),""!==c.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(n.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doSearchPastOccupants",c,e=>{var t,c,o,a,s,l,i,d;r=e.occupants;const p=document.createElement("div");p.className="panel";for(const[e,n]of r.entries()){const r=document.createElement("a");r.className="panel-block is-block",r.dataset.index=e.toString(),r.innerHTML=""+cityssm.escapeHTML(null!==(t=n.occupantName)&&void 0!==t?t:"")+'
'+cityssm.escapeHTML(null!==(c=n.occupantAddress1)&&void 0!==c?c:"")+"
"+(""===(null!==(o=n.occupantAddress2)&&void 0!==o?o:"")?"":cityssm.escapeHTML(n.occupantAddress2)+"
")+cityssm.escapeHTML(null!==(a=n.occupantCity)&&void 0!==a?a:"")+", "+cityssm.escapeHTML(null!==(s=n.occupantProvince)&&void 0!==s?s:"")+"
"+cityssm.escapeHTML(null!==(l=n.occupantPostalCode)&&void 0!==l?l:"")+'
'+(""===(null!==(i=n.occupantPhoneNumber)&&void 0!==i?i:"")?"":cityssm.escapeHTML(n.occupantPhoneNumber)+"
")+cityssm.escapeHTML(null!==(d=n.occupantEmailAddress)&&void 0!==d?d:"")+"
",r.addEventListener("click",u),p.append(r)}n.innerHTML="",n.append(p)})):n.innerHTML='

Enter a partial name or address in the search field above.

'}cityssm.openHtmlModal("lotOccupancy-addOccupant",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyOccupantAdd--lotOccupancyId").value=s;const t=e.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId"),c=e.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId");for(const e of exports.lotOccupantTypes){const n=document.createElement("option");n.value=e.lotOccupantTypeId.toString(),n.textContent=e.lotOccupantType,n.dataset.occupantCommentTitle=e.occupantCommentTitle,n.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,t.append(n),c.append(n.cloneNode(!0))}e.querySelector("#lotOccupancyOccupantAdd--occupantCity").value=exports.occupantCityDefault,e.querySelector("#lotOccupancyOccupantAdd--occupantProvince").value=exports.occupantProvinceDefault},onshown(o,a){bulmaJS.toggleHtmlClipped(),bulmaJS.init(o);const s=o.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId");s.focus(),s.addEventListener("change",()=>{var e,t;const c=null!==(e=s.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==e?e:"user";o.querySelector("#lotOccupancyOccupantAdd--fontAwesomeIconClass").innerHTML=``;let n=null!==(t=s.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===n&&(n="Comment"),o.querySelector("#lotOccupancyOccupantAdd--occupantCommentTitle").textContent=n}),(t=o.querySelector("#form--lotOccupancyOccupantAdd")).addEventListener("submit",l),n=o.querySelector("#lotOccupancyOccupantCopy--searchResults"),(c=o.querySelector("#form--lotOccupancyOccupantCopy")).addEventListener("submit",e=>{e.preventDefault()}),o.querySelector("#lotOccupancyOccupantCopy--searchFilter").addEventListener("change",i),e=a},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addOccupant").focus()}})}),!l){Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.lotOccupancyComments;function g(t){const c=Number.parseInt(t.currentTarget.closest("tr").dataset.lotOccupancyCommentId,10),n=e.find(e=>e.lotOccupancyCommentId===c);let o,l;function r(t){t.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyComment",o,t=>{var c;t.success?(e=t.lotOccupancyComments,l(),S()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editComment",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value=c.toString(),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value=n.lotOccupancyComment;const t=e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");t.value=n.lotOccupancyCommentDateString;const o=cityssm.dateToString(new Date);t.max=n.lotOccupancyCommentDateString<=o?o:n.lotOccupancyCommentDateString,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value=n.lotOccupancyCommentTimeString},onshown(e,t){bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus(),(o=e.querySelector("form")).addEventListener("submit",r),l=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function h(t){const c=Number.parseInt(t.currentTarget.closest("tr").dataset.lotOccupancyCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyComment",{lotOccupancyId:s,lotOccupancyCommentId:c},t=>{var c;t.success?(e=t.lotOccupancyComments,S()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function S(){var t,c,n;const o=document.querySelector("#container--lotOccupancyComments");if(0===e.length)return void(o.innerHTML='

There are no comments associated with this record.

');const a=document.createElement("table");a.className="table is-fullwidth is-striped is-hoverable",a.innerHTML='CommentorComment DateCommentOptions';for(const o of e){const e=document.createElement("tr");e.dataset.lotOccupancyCommentId=o.lotOccupancyCommentId.toString(),e.innerHTML=""+cityssm.escapeHTML(null!==(t=o.recordCreate_userName)&&void 0!==t?t:"")+""+(null!==(c=o.lotOccupancyCommentDateString)&&void 0!==c?c:"")+(0===o.lotOccupancyCommentTime?"":" "+o.lotOccupancyCommentTimeString)+""+cityssm.escapeHTML(null!==(n=o.lotOccupancyComment)&&void 0!==n?n:"")+'
',e.querySelector(".button--edit").addEventListener("click",g),e.querySelector(".button--delete").addEventListener("click",h),a.querySelector("tbody").append(e)}o.innerHTML="",o.append(a)}var b;delete exports.lotOccupancyComments,null===(b=document.querySelector("#button--addComment"))||void 0===b||b.addEventListener("click",()=>{let t,c;function n(n){n.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyComment",t,t=>{var n;t.success?(e=t.lotOccupancyComments,c(),S()):bulmaJS.alert({title:"Error Adding Comment",message:null!==(n=t.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addComment",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyId").value=s},onshown(e,o){bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyComment").focus(),(t=e.querySelector("form")).addEventListener("submit",n),c=o},onremoved:()=>{bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addComment").focus()}})}),S(),Object.defineProperty(exports,"__esModule",{value:!0});let t=exports.lotOccupancyFees;delete exports.lotOccupancyFees;const c=document.querySelector("#container--lotOccupancyFees");function C(){let e=0;for(const c of t)e+=(c.feeAmount+c.taxAmount)*c.quantity;return e}function T(e){const c=e.currentTarget.closest(".container--lotOccupancyFee").dataset.feeId;bulmaJS.confirm({title:"Delete Fee",message:"Are you sure you want to delete this fee?",contextualColorName:"warning",okButton:{text:"Yes, Delete Fee",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyFee",{lotOccupancyId:s,feeId:c},e=>{var c;e.success?(t=e.lotOccupancyFees,x()):bulmaJS.alert({title:"Error Deleting Fee",message:null!==(c=e.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}}})}function x(){var e,n,o;if(0===t.length)return c.innerHTML='
\n

There are no fees associated with this record.

\n
',void q();c.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
';let a=0,s=0;for(const l of t){const t=document.createElement("tr");t.className="container--lotOccupancyFee",t.dataset.feeId=l.feeId.toString(),t.dataset.includeQuantity=null!==(e=l.includeQuantity)&&void 0!==e&&e?"1":"0",t.innerHTML=''+cityssm.escapeHTML(null!==(n=l.feeName)&&void 0!==n?n:"")+'
'+cityssm.escapeHTML(null!==(o=l.feeCategory)&&void 0!==o?o:"")+""+(1===l.quantity?"":'$'+l.feeAmount.toFixed(2)+'×'+l.quantity+"=")+'$'+(l.feeAmount*l.quantity).toFixed(2)+'',t.querySelector("button").addEventListener("click",T),c.querySelector("tbody").append(t),a+=l.feeAmount*l.quantity,s+=l.taxAmount*l.quantity}c.querySelector("#lotOccupancyFees--feeAmountTotal").textContent="$"+a.toFixed(2),c.querySelector("#lotOccupancyFees--taxAmountTotal").textContent="$"+s.toFixed(2),c.querySelector("#lotOccupancyFees--grandTotal").textContent="$"+(a+s).toFixed(2),q()}null===(b=document.querySelector("#button--addFee"))||void 0===b||b.addEventListener("click",()=>{if(a.hasUnsavedChanges())return void bulmaJS.alert({message:"Please save all unsaved changes before adding fees.",contextualColorName:"warning"});let e,n,o;function l(e,c=1){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyFee",{lotOccupancyId:s,feeId:e,quantity:c},e=>{var c;e.success?(t=e.lotOccupancyFees,x(),u()):bulmaJS.alert({title:"Error Adding Fee",message:null!==(c=e.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}function r(t){var c;t.preventDefault();const n=Number.parseInt(t.currentTarget.dataset.feeId,10),o=Number.parseInt(t.currentTarget.dataset.feeCategoryId,10),a=e.find(e=>e.feeCategoryId===o).fees.find(e=>e.feeId===n);null!==(c=a.includeQuantity)&&void 0!==c&&c?function(e){let t,c;function n(n){n.preventDefault(),l(e.feeId,t.value),c()}cityssm.openHtmlModal("lotOccupancy-setFeeQuantity",{onshow(t){t.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=e.quantityUnit},onshown(e,o){c=o,t=e.querySelector("#lotOccupancyFeeQuantity--quantity"),e.querySelector("form").addEventListener("submit",n)}})}(a):l(n)}function u(){var t,a,s,l,u;const i=n.value.trim().toLowerCase().split(" ");o.innerHTML="";for(const n of e){const e=document.createElement("div");e.className="container--feeCategory",e.dataset.feeCategoryId=n.feeCategoryId.toString(),e.innerHTML='

'+cityssm.escapeHTML(null!==(t=n.feeCategory)&&void 0!==t?t:"")+'

';let d=!1;for(const t of n.fees){if(null!==c.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let o=!0;const p=((null!==(a=t.feeName)&&void 0!==a?a:"")+" "+(null!==(s=t.feeDescription)&&void 0!==s?s:"")).toLowerCase();for(const e of i)if(!p.includes(e)){o=!1;break}if(!o)continue;d=!0;const m=document.createElement("a");m.className="panel-block is-block container--fee",m.dataset.feeId=t.feeId.toString(),m.dataset.feeCategoryId=n.feeCategoryId.toString(),m.href="#",m.innerHTML=""+cityssm.escapeHTML(null!==(l=t.feeName)&&void 0!==l?l:"")+"
"+cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replace(/\n/g,"
")+"
",m.addEventListener("click",r),e.querySelector(".panel").append(m)}d&&o.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){n=t.querySelector("#feeSelect--feeName"),o=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetFees",{lotOccupancyId:s},t=>{e=t.feeCategories,n.disabled=!1,n.addEventListener("keyup",u),n.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){x()},onremoved(){bulmaJS.toggleHtmlClipped()}})});let n=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const o=document.querySelector("#container--lotOccupancyTransactions");function L(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyTransaction",{lotOccupancyId:s,transactionIndex:t},e=>{var t;e.success?(n=e.lotOccupancyTransactions,q()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function q(){var e,c,s;if(0===n.length)return void(o.innerHTML='

There are no transactions associated with this record.

');o.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n \n \n
Date${a.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`;let l=0;for(const t of n){l+=t.transactionAmount;const n=document.createElement("tr");n.className="container--lotOccupancyTransaction",n.dataset.transactionIndex=t.transactionIndex.toString(),n.innerHTML=""+(null!==(e=t.transactionDateString)&&void 0!==e?e:"")+""+(""===t.externalReceiptNumber?"":cityssm.escapeHTML(null!==(c=t.externalReceiptNumber)&&void 0!==c?c:"")+"
")+""+cityssm.escapeHTML(null!==(s=t.transactionNote)&&void 0!==s?s:"")+'$'+t.transactionAmount.toFixed(2)+'',n.querySelector("button").addEventListener("click",L),o.querySelector("tbody").append(n)}o.querySelector("#lotOccupancyTransactions--grandTotal").textContent="$"+l.toFixed(2);const r=C();r>l&&o.insertAdjacentHTML("afterbegin",'
Outstanding Balance
$'+(r-l).toFixed(2)+"
")}document.querySelector("#button--addTransaction").addEventListener("click",()=>{let e;function t(t){t.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyTransaction",t.currentTarget,t=>{var c;t.success?(n=t.lotOccupancyTransactions,e(),q()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=s.toString();const t=C(),c=function(){let e=0;for(const t of n)e+=t.transactionAmount;return e}(),o=e.querySelector("#lotOccupancyTransactionAdd--transactionAmount");o.min=(-1*c).toFixed(2),o.max=Math.max(t-c,0).toFixed(2),o.value=Math.max(t-c,0).toFixed(2)},onshown(c,n){bulmaJS.toggleHtmlClipped(),e=n,c.querySelector("form").addEventListener("submit",t)},onremoved(){bulmaJS.toggleHtmlClipped()}})}),x()}})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,c,n,o;const a=exports.los,s=document.querySelector("#lotOccupancy--lotOccupancyId").value,l=""===s;let r=l;const u=document.querySelector("#form--lotOccupancy");u.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/"+(l?"doCreateLotOccupancy":"doUpdateLotOccupancy"),u,e=>{var t;e.success?(a.clearUnsavedChanges(),l||r?window.location.href=a.getLotOccupancyURL(e.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:"Error Saving "+a.escapedAliases.Occupancy,message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const i=u.querySelectorAll("input, select");for(const e of i)e.addEventListener("change",a.setUnsavedChanges);function d(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doCopyLotOccupancy",{lotOccupancyId:s},e=>{var t;e.success?(cityssm.disableNavBlocker(),window.location.href=a.getLotOccupancyURL(e.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(b=document.querySelector("#button--copyLotOccupancy"))||void 0===b||b.addEventListener("click",e=>{e.preventDefault(),a.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${a.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:d}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${a.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancy",{lotOccupancyId:s},e=>{var t;e.success?(cityssm.disableNavBlocker(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function c(e){e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/workOrders/doCreateWorkOrder",e.currentTarget,e=>{e.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(e.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:e.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=s,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const c=e.querySelector("#workOrderCreate--workOrderTypeId"),n=exports.workOrderTypes;1===n.length&&(c.innerHTML="");for(const e of n){const n=document.createElement("option");n.value=e.workOrderTypeId.toString(),n.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",c.append(n)}},onshown(e,n){var o;t=n,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const p=document.querySelector("#lotOccupancy--occupancyTypeId");if(l){const e=document.querySelector("#container--lotOccupancyFields");p.addEventListener("change",()=>{""!==p.value?cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetOccupancyTypeFields",{occupancyTypeId:p.value},t=>{var c,n;if(0===t.occupancyTypeFields.length)return void(e.innerHTML=`
\n

There are no additional fields for this ${a.escapedAliases.occupancy} type.

\n
`);e.innerHTML="";let o="";for(const a of t.occupancyTypeFields){o+=","+a.occupancyTypeFieldId.toString();const t="lotOccupancyFieldValue_"+a.occupancyTypeFieldId.toString(),s="lotOccupancy--"+t,l=document.createElement("div");if(l.className="field",l.innerHTML=`
`,l.querySelector("label").textContent=a.occupancyTypeField,""===(null!==(c=a.occupancyTypeFieldValues)&&void 0!==c?c:"")){const e=document.createElement("input");e.className="input",e.id=s,e.name=t,e.type="text",e.required=a.isRequired,e.minLength=a.minimumLength,e.maxLength=a.maximumLength,""!==(null!==(n=a.pattern)&&void 0!==n?n:"")&&(e.pattern=a.pattern),l.querySelector(".control").append(e)}else{l.querySelector(".control").innerHTML=`
\n \n
`;const e=l.querySelector("select");e.required=a.isRequired;const c=a.occupancyTypeFieldValues.split("\n");for(const t of c){const c=document.createElement("option");c.value=t,c.textContent=t,e.append(c)}}console.log(l),e.append(l)}e.insertAdjacentHTML("beforeend",``)}):e.innerHTML=`
\n

Select the ${a.escapedAliases.occupancy} type to load the available fields.

\n
`})}else{const e=p.value;p.addEventListener("change",()=>{p.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${a.escapedAliases.occupancy} type?\n\n This change affects the additional fields associated with this record, and may also affect the available fees.`,contextualColorName:"warning",okButton:{text:"Yes, Keep the Change",callbackFunction:()=>{r=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{p.value=e}}})})}const m=document.querySelector("#lotOccupancy--lotName");m.addEventListener("click",e=>{const t=e.currentTarget.value;let c,n,o,s;function l(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,a.setUnsavedChanges(),c()}function r(e){e.preventDefault();const t=e.currentTarget;l(t.dataset.lotId,t.dataset.lotName)}function u(){s.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(a.urlPrefix+"/lots/doSearchLots",o,e=>{var t,c;if(0===e.count)return void(s.innerHTML='
\n

No results.

\n
');const n=document.createElement("div");n.className="panel";for(const o of e.lots){const e=document.createElement("a");e.className="panel-block is-block",e.href="#",e.dataset.lotId=o.lotId.toString(),e.dataset.lotName=o.lotName,e.innerHTML='
'+cityssm.escapeHTML(null!==(t=o.lotName)&&void 0!==t?t:"")+'
'+cityssm.escapeHTML(null!==(c=o.mapName)&&void 0!==c?c:"")+'
'+cityssm.escapeHTML(o.lotStatus)+'
'+(o.lotOccupancyCount>0?"Currently Occupied":"")+"
",e.addEventListener("click",r),n.append(e)}s.innerHTML="",s.append(n)})}function i(e){e.preventDefault();const t=n.querySelector("#lotCreate--lotName").value;cityssm.postJSON(a.urlPrefix+"/lots/doCreateLot",e.currentTarget,e=>{var c;e.success?l(e.lotId,t):bulmaJS.alert({title:`Error Creating ${a.escapedAliases.Lot}`,message:null!==(c=e.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-selectLot",{onshow(e){a.populateAliases(e)},onshown(e,a){var l;bulmaJS.toggleHtmlClipped(),n=e,c=a,bulmaJS.init(e);const r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const d=e.querySelector("#lotSelect--occupancyStatus");if(d.addEventListener("change",u),""!==t&&(d.value=""),o=e.querySelector("#form--lotSelect"),s=e.querySelector("#resultsContainer--lotSelect"),o.addEventListener("submit",e=>{e.preventDefault()}),u(),exports.lotNamePattern){const t=exports.lotNamePattern;e.querySelector("#lotCreate--lotName").pattern=t.source}const p=e.querySelector("#lotCreate--lotTypeId");for(const e of exports.lotTypes){const t=document.createElement("option");t.value=e.lotTypeId.toString(),t.textContent=e.lotType,p.append(t)}const m=e.querySelector("#lotCreate--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,m.append(t)}const y=e.querySelector("#lotCreate--mapId");for(const e of exports.maps){const t=document.createElement("option");t.value=e.mapId.toString(),t.textContent=""===(null!==(l=e.mapName)&&void 0!==l?l:"")?"(No Name)":e.mapName,y.append(t)}e.querySelector("#form--lotCreate").addEventListener("submit",i)},onremoved(){bulmaJS.toggleHtmlClipped()}})}),null===(c=document.querySelector(".is-lot-view-button"))||void 0===c||c.addEventListener("click",()=>{const e=document.querySelector("#lotOccupancy--lotId").value;""===e?bulmaJS.alert({message:`No ${a.escapedAliases.lot} selected.`,contextualColorName:"info"}):window.open(a.urlPrefix+"/lots/"+e)}),null===(n=document.querySelector(".is-clear-lot-button"))||void 0===n||n.addEventListener("click",()=>{m.disabled?bulmaJS.alert({message:"You need to unlock the field before clearing it.",contextualColorName:"info"}):(m.value=`(No ${a.escapedAliases.Lot})`,document.querySelector("#lotOccupancy--lotId").value="",a.setUnsavedChanges())}),a.initializeDatePickers(u),null===(o=document.querySelector("#lotOccupancy--occupancyStartDateString"))||void 0===o||o.addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),a.initializeUnlockFieldButtons(u),Object.defineProperty(exports,"__esModule",{value:!0});let y=exports.lotOccupancyOccupants;function v(e){const t=Number.parseInt(e.currentTarget.closest("tr").dataset.lotOccupantIndex,10),c=y.find(e=>e.lotOccupantIndex===t);let n,o;function l(e){e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyOccupant",n,e=>{var t;const c=e;c.success?(y=c.lotOccupancyOccupants,o(),f()):bulmaJS.alert({title:"Error Updating "+a.escapedAliases.Occupant,message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow(e){var n;a.populateAliases(e),e.querySelector("#lotOccupancyOccupantEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyOccupantEdit--lotOccupantIndex").value=t.toString();const o=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");let l=!1;for(const e of exports.lotOccupantTypes){const t=document.createElement("option");t.value=e.lotOccupantTypeId.toString(),t.textContent=e.lotOccupantType,t.dataset.occupantCommentTitle=e.occupantCommentTitle,t.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,e.lotOccupantTypeId===c.lotOccupantTypeId&&(t.selected=!0,l=!0),o.append(t)}if(!l){const e=document.createElement("option");e.value=c.lotOccupantTypeId.toString(),e.textContent=c.lotOccupantType,e.dataset.occupantCommentTitle=c.occupantCommentTitle,e.dataset.fontAwesomeIconClass=c.fontAwesomeIconClass,e.selected=!0,o.append(e)}e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=``,e.querySelector("#lotOccupancyOccupantEdit--occupantName").value=c.occupantName,e.querySelector("#lotOccupancyOccupantEdit--occupantFamilyName").value=c.occupantFamilyName,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress1").value=c.occupantAddress1,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress2").value=c.occupantAddress2,e.querySelector("#lotOccupancyOccupantEdit--occupantCity").value=c.occupantCity,e.querySelector("#lotOccupancyOccupantEdit--occupantProvince").value=c.occupantProvince,e.querySelector("#lotOccupancyOccupantEdit--occupantPostalCode").value=c.occupantPostalCode,e.querySelector("#lotOccupancyOccupantEdit--occupantPhoneNumber").value=c.occupantPhoneNumber,e.querySelector("#lotOccupancyOccupantEdit--occupantEmailAddress").value=c.occupantEmailAddress,e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=""===(null!==(n=c.occupantCommentTitle)&&void 0!==n?n:"")?"Comment":c.occupantCommentTitle,e.querySelector("#lotOccupancyOccupantEdit--occupantComment").value=c.occupantComment},onshown(e,t){bulmaJS.toggleHtmlClipped();const c=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");c.focus(),c.addEventListener("change",()=>{var t,n;const o=null!==(t=c.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==t?t:"user";e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=``;let a=null!==(n=c.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==n?n:"";""===a&&(a="Comment"),e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=a}),(n=e.querySelector("form")).addEventListener("submit",l),o=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function O(e){const t=e.currentTarget.closest("tr").dataset.lotOccupantIndex;bulmaJS.confirm({title:`Remove ${a.escapedAliases.Occupant}?`,message:`Are you sure you want to remove this ${a.escapedAliases.occupant}?`,okButton:{text:"Yes, Remove "+a.escapedAliases.Occupant,callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyOccupant",{lotOccupancyId:s,lotOccupantIndex:t},e=>{var t;const c=e;c.success?(y=c.lotOccupancyOccupants,f()):bulmaJS.alert({title:"Error Removing "+a.escapedAliases.Occupant,message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function f(){var e,t,c,n,o,s,l,r,u,i,d;const p=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(p),0===y.length)return void(p.innerHTML=`
\n

There are no ${a.escapedAliases.occupants} associated with this record.

\n
`);const m=document.createElement("table");m.className="table is-fullwidth is-striped is-hoverable",m.innerHTML=`\n ${a.escapedAliases.Occupant}\n Address\n Other Contact\n Comment\n Options\n \n `;for(const a of y){const p=document.createElement("tr");p.dataset.lotOccupantIndex=a.lotOccupantIndex.toString(),p.innerHTML=""+cityssm.escapeHTML(""===(null!==(e=a.occupantName)&&void 0!==e?e:"")&&""===(null!==(t=a.occupantFamilyName)&&void 0!==t?t:"")?"(No Name)":a.occupantName+" "+a.occupantFamilyName)+'
'+cityssm.escapeHTML(a.lotOccupantType)+""+(""===(null!==(c=a.occupantAddress1)&&void 0!==c?c:"")?"":cityssm.escapeHTML(a.occupantAddress1)+"
")+(""===(null!==(n=a.occupantAddress2)&&void 0!==n?n:"")?"":cityssm.escapeHTML(a.occupantAddress2)+"
")+(""===(null!==(o=a.occupantCity)&&void 0!==o?o:"")?"":cityssm.escapeHTML(a.occupantCity)+", ")+cityssm.escapeHTML(null!==(s=a.occupantProvince)&&void 0!==s?s:"")+"
"+cityssm.escapeHTML(null!==(l=a.occupantPostalCode)&&void 0!==l?l:"")+""+(""===(null!==(r=a.occupantPhoneNumber)&&void 0!==r?r:"")?"":cityssm.escapeHTML(a.occupantPhoneNumber)+"
")+(""===(null!==(u=a.occupantEmailAddress)&&void 0!==u?u:"")?"":cityssm.escapeHTML(a.occupantEmailAddress))+''+cityssm.escapeHTML(null!==(d=a.occupantComment)&&void 0!==d?d:"")+'
',p.querySelector(".button--edit").addEventListener("click",v),p.querySelector(".button--delete").addEventListener("click",O),m.querySelector("tbody").append(p)}p.append(m)}if(delete exports.lotOccupancyOccupants,l){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{var t;const c=u.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const t of c)t.disabled=""===e.value;let n=null!==(t=e.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===n&&(n="Comment"),u.querySelector("#lotOccupancy--occupantCommentTitle").textContent=n})}else f();if(null===(b=document.querySelector("#button--addOccupant"))||void 0===b||b.addEventListener("click",()=>{let e,t,c,n;function o(t){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyOccupant",t,t=>{var c;const n=t;n.success?(y=n.lotOccupancyOccupants,e(),f()):bulmaJS.alert({title:`Error Adding ${a.escapedAliases.Occupant}`,message:null!==(c=n.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}function l(e){e.preventDefault(),o(t)}let r=[];function u(e){e.preventDefault();const t=e.currentTarget,c=r[Number.parseInt(t.dataset.index,10)],n=t.closest(".modal").querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId").value;""===n?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(c.lotOccupantTypeId=Number.parseInt(n,10),c.lotOccupancyId=Number.parseInt(s,10),o(c))}function i(e){e.preventDefault(),""!==c.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(n.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doSearchPastOccupants",c,e=>{var t,c,o,a,s,l,i,d,p;r=e.occupants;const m=document.createElement("div");m.className="panel";for(const[e,n]of r.entries()){const r=document.createElement("a");r.className="panel-block is-block",r.dataset.index=e.toString(),r.innerHTML=""+cityssm.escapeHTML(null!==(t=n.occupantName)&&void 0!==t?t:"")+" "+cityssm.escapeHTML(null!==(c=n.occupantFamilyName)&&void 0!==c?c:"")+'
'+cityssm.escapeHTML(null!==(o=n.occupantAddress1)&&void 0!==o?o:"")+"
"+(""===(null!==(a=n.occupantAddress2)&&void 0!==a?a:"")?"":cityssm.escapeHTML(n.occupantAddress2)+"
")+cityssm.escapeHTML(null!==(s=n.occupantCity)&&void 0!==s?s:"")+", "+cityssm.escapeHTML(null!==(l=n.occupantProvince)&&void 0!==l?l:"")+"
"+cityssm.escapeHTML(null!==(i=n.occupantPostalCode)&&void 0!==i?i:"")+'
'+(""===(null!==(d=n.occupantPhoneNumber)&&void 0!==d?d:"")?"":cityssm.escapeHTML(n.occupantPhoneNumber)+"
")+cityssm.escapeHTML(null!==(p=n.occupantEmailAddress)&&void 0!==p?p:"")+"
",r.addEventListener("click",u),m.append(r)}n.innerHTML="",n.append(m)})):n.innerHTML='

Enter a partial name or address in the search field above.

'}cityssm.openHtmlModal("lotOccupancy-addOccupant",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyOccupantAdd--lotOccupancyId").value=s;const t=e.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId"),c=e.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId");for(const e of exports.lotOccupantTypes){const n=document.createElement("option");n.value=e.lotOccupantTypeId.toString(),n.textContent=e.lotOccupantType,n.dataset.occupantCommentTitle=e.occupantCommentTitle,n.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,t.append(n),c.append(n.cloneNode(!0))}e.querySelector("#lotOccupancyOccupantAdd--occupantCity").value=exports.occupantCityDefault,e.querySelector("#lotOccupancyOccupantAdd--occupantProvince").value=exports.occupantProvinceDefault},onshown(o,a){bulmaJS.toggleHtmlClipped(),bulmaJS.init(o);const s=o.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId");s.focus(),s.addEventListener("change",()=>{var e,t;const c=null!==(e=s.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==e?e:"user";o.querySelector("#lotOccupancyOccupantAdd--fontAwesomeIconClass").innerHTML=``;let n=null!==(t=s.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===n&&(n="Comment"),o.querySelector("#lotOccupancyOccupantAdd--occupantCommentTitle").textContent=n}),(t=o.querySelector("#form--lotOccupancyOccupantAdd")).addEventListener("submit",l),n=o.querySelector("#lotOccupancyOccupantCopy--searchResults"),(c=o.querySelector("#form--lotOccupancyOccupantCopy")).addEventListener("submit",e=>{e.preventDefault()}),o.querySelector("#lotOccupancyOccupantCopy--searchFilter").addEventListener("change",i),e=a},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addOccupant").focus()}})}),!l){Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.lotOccupancyComments;function g(t){const c=Number.parseInt(t.currentTarget.closest("tr").dataset.lotOccupancyCommentId,10),n=e.find(e=>e.lotOccupancyCommentId===c);let o,l;function r(t){t.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyComment",o,t=>{var c;t.success?(e=t.lotOccupancyComments,l(),S()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editComment",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value=c.toString(),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value=n.lotOccupancyComment;const t=e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");t.value=n.lotOccupancyCommentDateString;const o=cityssm.dateToString(new Date);t.max=n.lotOccupancyCommentDateString<=o?o:n.lotOccupancyCommentDateString,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value=n.lotOccupancyCommentTimeString},onshown(e,t){bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus(),(o=e.querySelector("form")).addEventListener("submit",r),l=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function h(t){const c=Number.parseInt(t.currentTarget.closest("tr").dataset.lotOccupancyCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyComment",{lotOccupancyId:s,lotOccupancyCommentId:c},t=>{var c;t.success?(e=t.lotOccupancyComments,S()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function S(){var t,c,n;const o=document.querySelector("#container--lotOccupancyComments");if(0===e.length)return void(o.innerHTML='

There are no comments associated with this record.

');const a=document.createElement("table");a.className="table is-fullwidth is-striped is-hoverable",a.innerHTML='CommentorComment DateCommentOptions';for(const o of e){const e=document.createElement("tr");e.dataset.lotOccupancyCommentId=o.lotOccupancyCommentId.toString(),e.innerHTML=""+cityssm.escapeHTML(null!==(t=o.recordCreate_userName)&&void 0!==t?t:"")+""+(null!==(c=o.lotOccupancyCommentDateString)&&void 0!==c?c:"")+(0===o.lotOccupancyCommentTime?"":" "+o.lotOccupancyCommentTimeString)+""+cityssm.escapeHTML(null!==(n=o.lotOccupancyComment)&&void 0!==n?n:"")+'
',e.querySelector(".button--edit").addEventListener("click",g),e.querySelector(".button--delete").addEventListener("click",h),a.querySelector("tbody").append(e)}o.innerHTML="",o.append(a)}var b;delete exports.lotOccupancyComments,null===(b=document.querySelector("#button--addComment"))||void 0===b||b.addEventListener("click",()=>{let t,c;function n(n){n.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyComment",t,t=>{var n;t.success?(e=t.lotOccupancyComments,c(),S()):bulmaJS.alert({title:"Error Adding Comment",message:null!==(n=t.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addComment",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyId").value=s},onshown(e,o){bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyComment").focus(),(t=e.querySelector("form")).addEventListener("submit",n),c=o},onremoved:()=>{bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addComment").focus()}})}),S(),Object.defineProperty(exports,"__esModule",{value:!0});let t=exports.lotOccupancyFees;delete exports.lotOccupancyFees;const c=document.querySelector("#container--lotOccupancyFees");function C(){let e=0;for(const c of t)e+=(c.feeAmount+c.taxAmount)*c.quantity;return e}function T(e){const c=e.currentTarget.closest(".container--lotOccupancyFee").dataset.feeId;bulmaJS.confirm({title:"Delete Fee",message:"Are you sure you want to delete this fee?",contextualColorName:"warning",okButton:{text:"Yes, Delete Fee",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyFee",{lotOccupancyId:s,feeId:c},e=>{var c;e.success?(t=e.lotOccupancyFees,x()):bulmaJS.alert({title:"Error Deleting Fee",message:null!==(c=e.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}}})}function x(){var e,n,o;if(0===t.length)return c.innerHTML='
\n

There are no fees associated with this record.

\n
',void q();c.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
';let a=0,s=0;for(const l of t){const t=document.createElement("tr");t.className="container--lotOccupancyFee",t.dataset.feeId=l.feeId.toString(),t.dataset.includeQuantity=null!==(e=l.includeQuantity)&&void 0!==e&&e?"1":"0",t.innerHTML=''+cityssm.escapeHTML(null!==(n=l.feeName)&&void 0!==n?n:"")+'
'+cityssm.escapeHTML(null!==(o=l.feeCategory)&&void 0!==o?o:"")+""+(1===l.quantity?"":'$'+l.feeAmount.toFixed(2)+'×'+l.quantity+"=")+'$'+(l.feeAmount*l.quantity).toFixed(2)+'',t.querySelector("button").addEventListener("click",T),c.querySelector("tbody").append(t),a+=l.feeAmount*l.quantity,s+=l.taxAmount*l.quantity}c.querySelector("#lotOccupancyFees--feeAmountTotal").textContent="$"+a.toFixed(2),c.querySelector("#lotOccupancyFees--taxAmountTotal").textContent="$"+s.toFixed(2),c.querySelector("#lotOccupancyFees--grandTotal").textContent="$"+(a+s).toFixed(2),q()}null===(b=document.querySelector("#button--addFee"))||void 0===b||b.addEventListener("click",()=>{if(a.hasUnsavedChanges())return void bulmaJS.alert({message:"Please save all unsaved changes before adding fees.",contextualColorName:"warning"});let e,n,o;function l(e,c=1){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyFee",{lotOccupancyId:s,feeId:e,quantity:c},e=>{var c;e.success?(t=e.lotOccupancyFees,x(),u()):bulmaJS.alert({title:"Error Adding Fee",message:null!==(c=e.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}function r(t){var c;t.preventDefault();const n=Number.parseInt(t.currentTarget.dataset.feeId,10),o=Number.parseInt(t.currentTarget.dataset.feeCategoryId,10),a=e.find(e=>e.feeCategoryId===o).fees.find(e=>e.feeId===n);null!==(c=a.includeQuantity)&&void 0!==c&&c?function(e){let t,c;function n(n){n.preventDefault(),l(e.feeId,t.value),c()}cityssm.openHtmlModal("lotOccupancy-setFeeQuantity",{onshow(t){t.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=e.quantityUnit},onshown(e,o){c=o,t=e.querySelector("#lotOccupancyFeeQuantity--quantity"),e.querySelector("form").addEventListener("submit",n)}})}(a):l(n)}function u(){var t,a,s,l,u;const i=n.value.trim().toLowerCase().split(" ");o.innerHTML="";for(const n of e){const e=document.createElement("div");e.className="container--feeCategory",e.dataset.feeCategoryId=n.feeCategoryId.toString(),e.innerHTML='

'+cityssm.escapeHTML(null!==(t=n.feeCategory)&&void 0!==t?t:"")+'

';let d=!1;for(const t of n.fees){if(null!==c.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let o=!0;const p=((null!==(a=t.feeName)&&void 0!==a?a:"")+" "+(null!==(s=t.feeDescription)&&void 0!==s?s:"")).toLowerCase();for(const e of i)if(!p.includes(e)){o=!1;break}if(!o)continue;d=!0;const m=document.createElement("a");m.className="panel-block is-block container--fee",m.dataset.feeId=t.feeId.toString(),m.dataset.feeCategoryId=n.feeCategoryId.toString(),m.href="#",m.innerHTML=""+cityssm.escapeHTML(null!==(l=t.feeName)&&void 0!==l?l:"")+"
"+cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replace(/\n/g,"
")+"
",m.addEventListener("click",r),e.querySelector(".panel").append(m)}d&&o.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){n=t.querySelector("#feeSelect--feeName"),o=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetFees",{lotOccupancyId:s},t=>{e=t.feeCategories,n.disabled=!1,n.addEventListener("keyup",u),n.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){x()},onremoved(){bulmaJS.toggleHtmlClipped()}})});let n=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const o=document.querySelector("#container--lotOccupancyTransactions");function L(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyTransaction",{lotOccupancyId:s,transactionIndex:t},e=>{var t;e.success?(n=e.lotOccupancyTransactions,q()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function q(){var e,c,s;if(0===n.length)return void(o.innerHTML='

There are no transactions associated with this record.

');o.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n \n \n
Date${a.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`;let l=0;for(const t of n){l+=t.transactionAmount;const n=document.createElement("tr");n.className="container--lotOccupancyTransaction",n.dataset.transactionIndex=t.transactionIndex.toString(),n.innerHTML=""+(null!==(e=t.transactionDateString)&&void 0!==e?e:"")+""+(""===t.externalReceiptNumber?"":cityssm.escapeHTML(null!==(c=t.externalReceiptNumber)&&void 0!==c?c:"")+"
")+""+cityssm.escapeHTML(null!==(s=t.transactionNote)&&void 0!==s?s:"")+'$'+t.transactionAmount.toFixed(2)+'',n.querySelector("button").addEventListener("click",L),o.querySelector("tbody").append(n)}o.querySelector("#lotOccupancyTransactions--grandTotal").textContent="$"+l.toFixed(2);const r=C();r>l&&o.insertAdjacentHTML("afterbegin",'
Outstanding Balance
$'+(r-l).toFixed(2)+"
")}document.querySelector("#button--addTransaction").addEventListener("click",()=>{let e;function t(t){t.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyTransaction",t.currentTarget,t=>{var c;t.success?(n=t.lotOccupancyTransactions,e(),q()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=s.toString();const t=C(),c=function(){let e=0;for(const t of n)e+=t.transactionAmount;return e}(),o=e.querySelector("#lotOccupancyTransactionAdd--transactionAmount");o.min=(-1*c).toFixed(2),o.max=Math.max(t-c,0).toFixed(2),o.value=Math.max(t-c,0).toFixed(2)},onshown(c,n){bulmaJS.toggleHtmlClipped(),e=n,c.querySelector("form").addEventListener("submit",t)},onremoved(){bulmaJS.toggleHtmlClipped()}})}),x()}})(); \ No newline at end of file diff --git a/public/javascripts/lotOccupancySearch.min.js b/public/javascripts/lotOccupancySearch.min.js index 98ddaef8..e73f9a97 100644 --- a/public/javascripts/lotOccupancySearch.min.js +++ b/public/javascripts/lotOccupancySearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,a=document.querySelector("#form--searchFilters"),e=document.querySelector("#container--searchResults"),s=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),c=document.querySelector("#searchFilter--offset");function n(a){var c,n,l,i,d,p,u,h,y,f,v,m;if(0===a.lotOccupancies.length)return void(e.innerHTML=`
\n

\n There are no ${t.escapedAliases.occupancy} records that meet the search criteria.\n

\n
`);const g=document.createElement("tbody"),L=cityssm.dateToString(new Date);for(const e of a.lotOccupancies){let a="";a=e.occupancyStartDateString<=L&&(""===e.occupancyEndDateString||e.occupancyEndDateString>=L)?`\n \n `:e.occupancyStartDateString>L?`\n \n `:`\n \n `;let s="";for(const t of e.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(null!==(l=t.occupantName)&&void 0!==l?l:"")+"
";const o=(null!==(d=null===(i=e.lotOccupancyFees)||void 0===i?void 0:i.reduce((t,a)=>{var e,s,c;return t+((null!==(e=a.feeAmount)&&void 0!==e?e:0)+(null!==(s=a.taxAmount)&&void 0!==s?s:0))*(null!==(c=a.quantity)&&void 0!==c?c:0)},0))&&void 0!==d?d:0).toFixed(2),r=(null!==(u=null===(p=e.lotOccupancyTransactions)||void 0===p?void 0:p.reduce((t,a)=>t+a.transactionAmount,0))&&void 0!==u?u:0).toFixed(2);let v="";"0.00"===o&&"0.00"===r||(v=`\n \n `),g.insertAdjacentHTML("beforeend",''+a+''+cityssm.escapeHTML(e.occupancyType)+""+(-1===(null!==(h=e.lotId)&&void 0!==h?h:-1)?'(No '+t.escapedAliases.Lot+")":''+cityssm.escapeHTML(e.lotName)+"")+'
'+cityssm.escapeHTML(null!==(f=e.mapName)&&void 0!==f?f:"")+""+e.occupancyStartDateString+""+(e.occupancyEndDate?e.occupancyEndDateString:'(No End Date)')+""+s+""+v+""+(e.printEJS?'':"")+"")}e.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n
${t.escapedAliases.Occupancy} Type${t.escapedAliases.Lot}${t.escapedAliases.OccupancyStartDate}End Date${t.escapedAliases.Occupants}Fees and TransactionsPrint
`,e.querySelector("table").append(g),e.insertAdjacentHTML("beforeend",t.getSearchResultsPagerHTML(s,a.offset,a.count)),null===(v=e.querySelector("button[data-page='previous']"))||void 0===v||v.addEventListener("click",o),null===(m=e.querySelector("button[data-page='next']"))||void 0===m||m.addEventListener("click",r)}function l(){e.innerHTML=t.getLoadingParagraphHTML(`Loading ${t.escapedAliases.Occupancies}...`),cityssm.postJSON(t.urlPrefix+"/lotOccupancies/doSearchLotOccupancies",a,n)}function i(){c.value="0",l()}function o(){c.value=Math.max(Number.parseInt(c.value,10)-s,0).toString(),l()}function r(){c.value=(Number.parseInt(c.value,10)+s).toString(),l()}const d=a.querySelectorAll("input, select");for(const t of d)t.addEventListener("change",i);a.addEventListener("submit",t=>{t.preventDefault()}),l()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,a=document.querySelector("#form--searchFilters"),e=document.querySelector("#container--searchResults"),s=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),c=document.querySelector("#searchFilter--offset");function n(a){var c,n,l,i,d,p,u,h,y,f,m,v,g;if(0===a.lotOccupancies.length)return void(e.innerHTML=`
\n

\n There are no ${t.escapedAliases.occupancy} records that meet the search criteria.\n

\n
`);const L=document.createElement("tbody"),b=cityssm.dateToString(new Date);for(const e of a.lotOccupancies){let a="";a=e.occupancyStartDateString<=b&&(""===e.occupancyEndDateString||e.occupancyEndDateString>=b)?`\n \n `:e.occupancyStartDateString>b?`\n \n `:`\n \n `;let s="";for(const t of e.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(null!==(l=t.occupantName)&&void 0!==l?l:"")+" "+cityssm.escapeHTML(null!==(i=t.occupantFamilyName)&&void 0!==i?i:"")+"
";const o=(null!==(p=null===(d=e.lotOccupancyFees)||void 0===d?void 0:d.reduce((t,a)=>{var e,s,c;return t+((null!==(e=a.feeAmount)&&void 0!==e?e:0)+(null!==(s=a.taxAmount)&&void 0!==s?s:0))*(null!==(c=a.quantity)&&void 0!==c?c:0)},0))&&void 0!==p?p:0).toFixed(2),r=(null!==(h=null===(u=e.lotOccupancyTransactions)||void 0===u?void 0:u.reduce((t,a)=>t+a.transactionAmount,0))&&void 0!==h?h:0).toFixed(2);let v="";"0.00"===o&&"0.00"===r||(v=`\n \n `),L.insertAdjacentHTML("beforeend",'")}e.innerHTML=`
'+a+''+cityssm.escapeHTML(e.occupancyType)+""+(-1===(null!==(y=e.lotId)&&void 0!==y?y:-1)?'(No '+t.escapedAliases.Lot+")":''+cityssm.escapeHTML(e.lotName)+"")+'
'+cityssm.escapeHTML(null!==(m=e.mapName)&&void 0!==m?m:"")+"
"+e.occupancyStartDateString+""+(e.occupancyEndDate?e.occupancyEndDateString:'(No End Date)')+""+s+""+v+""+(e.printEJS?'':"")+"
\n \n \n \n \n \n \n \n \n \n \n
${t.escapedAliases.Occupancy} Type${t.escapedAliases.Lot}${t.escapedAliases.OccupancyStartDate}End Date${t.escapedAliases.Occupants}Fees and TransactionsPrint
`,e.querySelector("table").append(L),e.insertAdjacentHTML("beforeend",t.getSearchResultsPagerHTML(s,a.offset,a.count)),null===(v=e.querySelector("button[data-page='previous']"))||void 0===v||v.addEventListener("click",o),null===(g=e.querySelector("button[data-page='next']"))||void 0===g||g.addEventListener("click",r)}function l(){e.innerHTML=t.getLoadingParagraphHTML(`Loading ${t.escapedAliases.Occupancies}...`),cityssm.postJSON(t.urlPrefix+"/lotOccupancies/doSearchLotOccupancies",a,n)}function i(){c.value="0",l()}function o(){c.value=Math.max(Number.parseInt(c.value,10)-s,0).toString(),l()}function r(){c.value=(Number.parseInt(c.value,10)+s).toString(),l()}const d=a.querySelectorAll("input, select");for(const t of d)t.addEventListener("change",i);a.addEventListener("submit",t=>{t.preventDefault()}),l()})(); \ No newline at end of file diff --git a/public/javascripts/workOrderEdit.min.js b/public/javascripts/workOrderEdit.min.js index bfd47e9c..30b3a5e1 100644 --- a/public/javascripts/workOrderEdit.min.js +++ b/public/javascripts/workOrderEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const t=exports.los,o=document.querySelector("#workOrderEdit--workOrderId").value,r=""===o,s=document.querySelector("#form--workOrderEdit");t.initializeDatePickers(s.querySelector("#workOrderEdit--workOrderOpenDateString").closest(".field")),t.initializeUnlockFieldButtons(s),s.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/"+(r?"doCreateWorkOrder":"doUpdateWorkOrder"),e.currentTarget,e=>{var o;e.success?(cityssm.disableNavBlocker(),r?window.location.href=t.getWorkOrderURL(e.workOrderId,!0):bulmaJS.alert({message:"Work Order Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating Work Order",message:null!==(o=e.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})});const n=s.querySelectorAll("input, select");for(const e of n)e.addEventListener("change",cityssm.enableNavBlocker);function a(){cityssm.postJSON(t.urlPrefix+"/workOrders/doCloseWorkOrder",{workOrderId:o},e=>{var r;e.success?window.location.href=t.urlPrefix+"/workOrders/"+o:bulmaJS.alert({title:"Error Closing Work Order",message:null!==(r=e.errorMessage)&&void 0!==r?r:"",contextualColorName:"danger"})})}function l(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrder",{workOrderId:o},e=>{var o;e.success?window.location.href=t.urlPrefix+"/workOrders":bulmaJS.alert({title:"Error Deleting Work Order",message:null!==(o=e.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}let d;if(null===(S=document.querySelector("#button--closeWorkOrder"))||void 0===S||S.addEventListener("click",()=>{d.some(e=>!e.workOrderMilestoneCompletionDate)?bulmaJS.alert({title:"Outstanding Milestones",message:"You cannot close a work order with outstanding milestones.\n Either complete the outstanding milestones, or remove them from the work order.",contextualColorName:"warning"}):bulmaJS.confirm({title:"Close Work Order",message:"Are you sure you want to close this work order?",contextualColorName:"info",okButton:{text:"Yes, Close Work Order",callbackFunction:a}})}),null===(i=document.querySelector("#button--deleteWorkOrder"))||void 0===i||i.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete Work Order",message:"Are you sure you want to delete this work order?",contextualColorName:"warning",okButton:{text:"Yes, Delete Work Order",callbackFunction:l}})}),!r){var i;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.workOrderLots;delete exports.workOrderLots;let r=exports.workOrderLotOccupancies;function c(e){const s=e.currentTarget.closest(".container--lotOccupancy").dataset.lotOccupancyId;bulmaJS.confirm({title:`Delete ${t.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${t.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrderLotOccupancy",{workOrderId:o,lotOccupancyId:s},e=>{var t;e.success?(r=e.workOrderLotOccupancies,O()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function u(r,s){cityssm.postJSON(t.urlPrefix+"/workOrders/doAddWorkOrderLot",{workOrderId:o,lotId:r},o=>{var r;o.success?(e=o.workOrderLots,O()):bulmaJS.alert({title:`Error Adding ${t.escapedAliases.Lot}`,message:null!==(r=o.errorMessage)&&void 0!==r?r:"",contextualColorName:"danger"}),s&&s(o.success)})}function m(e){u(e.currentTarget.dataset.lotId)}function p(r){const s=Number.parseInt(r.currentTarget.closest(".container--lot").dataset.lotId,10),n=e.find(e=>e.lotId===s);let a;function l(o){o.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/doUpdateLotStatus",o.currentTarget,t=>{var o;t.success?(e=t.workOrderLots,O(),a()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=t.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lot-editLotStatus",{onshow(e){t.populateAliases(e),e.querySelector("#lotStatusEdit--lotId").value=s.toString(),e.querySelector("#lotStatusEdit--lotName").value=n.lotName;const r=e.querySelector("#lotStatusEdit--lotStatusId");let a=!1;for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,e.lotStatusId===n.lotStatusId&&(a=!0),r.append(t)}if(!a&&n.lotStatusId){const e=document.createElement("option");e.value=n.lotStatusId.toString(),e.textContent=n.lotStatus,r.append(e)}n.lotStatusId&&(r.value=n.lotStatusId.toString()),e.querySelector("form").insertAdjacentHTML("beforeend",``)},onshown(e,t){a=t,bulmaJS.toggleHtmlClipped(),e.querySelector("form").addEventListener("submit",l)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function y(r){const s=r.currentTarget.closest(".container--lot").dataset.lotId;bulmaJS.confirm({title:`Delete ${t.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${t.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrderLot",{workOrderId:o,lotId:s},t=>{var o;t.success?(e=t.workOrderLots,O()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=t.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})}function O(){!function(){var o,s,n,a;const l=document.querySelector("#container--lotOccupancies");if(document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent=r.length.toString(),0===r.length)return void(l.innerHTML=`
\n

There are no ${t.escapedAliases.occupancies} associated with this work order.

\n
`);l.innerHTML=`
\n \n \n \n \n \n \n \n \n \n \n
${t.escapedAliases.Occupancy} Type${t.escapedAliases.Lot}${t.escapedAliases.OccupancyStartDate}End Date${t.escapedAliases.Occupants}
`;const d=cityssm.dateToString(new Date);for(const i of r){const r=document.createElement("tr");r.className="container--lotOccupancy",r.dataset.lotOccupancyId=i.lotOccupancyId.toString();const u=!(i.occupancyEndDate&&i.occupancyEndDateStringi.lotId===e.lotId);r.innerHTML=''+(u?'':'')+''+cityssm.escapeHTML(null!==(o=i.occupancyType)&&void 0!==o?o:"")+"",i.lotId?r.insertAdjacentHTML("beforeend",""+cityssm.escapeHTML(null!==(s=i.lotName)&&void 0!==s?s:"")+(p?"":' ')+""):r.insertAdjacentHTML("beforeend",`(No ${t.escapedAliases.Lot})`),r.insertAdjacentHTML("beforeend",""+i.occupancyStartDateString+""+(i.occupancyEndDate?i.occupancyEndDateString:'(No End Date)')+""+(0===i.lotOccupancyOccupants.length?'(No '+t.escapedAliases.Occupants+")":null===(n=i.lotOccupancyOccupants)||void 0===n?void 0:n.reduce((e,o)=>{var r;return e+' '+cityssm.escapeHTML(o.occupantName)+"
"},""))+''),null===(a=r.querySelector(".button--addLot"))||void 0===a||a.addEventListener("click",m),r.querySelector(".button--deleteLotOccupancy").addEventListener("click",c),l.querySelector("tbody").append(r)}}(),function(){var o,r,s,n;const a=document.querySelector("#container--lots");if(document.querySelector(".tabs a[href='#relatedTab--lots'] .tag").textContent=e.length.toString(),0!==e.length){a.innerHTML=`\n \n \n \n \n \n \n \n \n
${t.escapedAliases.Lot}${t.escapedAliases.Map}${t.escapedAliases.Lot} TypeStatus
`;for(const l of e){const e=document.createElement("tr");e.className="container--lot",e.dataset.lotId=l.lotId.toString(),e.innerHTML=''+cityssm.escapeHTML(null!==(o=l.lotName)&&void 0!==o?o:"")+""+cityssm.escapeHTML(null!==(r=l.mapName)&&void 0!==r?r:"")+""+cityssm.escapeHTML(null!==(s=l.lotType)&&void 0!==s?s:"")+""+(l.lotStatusId?cityssm.escapeHTML(null!==(n=l.lotStatus)&&void 0!==n?n:""):'(No Status)')+' ',e.querySelector(".button--editLotStatus").addEventListener("click",p),e.querySelector(".button--deleteLot").addEventListener("click",y),a.querySelector("tbody").append(e)}}else a.innerHTML=`
\n

There are no ${t.escapedAliases.lots} associated with this work order.

\n
`}()}function h(e){const s=e.currentTarget.closest("tr");!function(e,s){cityssm.postJSON(t.urlPrefix+"/workOrders/doAddWorkOrderLotOccupancy",{workOrderId:o,lotOccupancyId:e},e=>{var o;e.success?(r=e.workOrderLotOccupancies,O()):bulmaJS.alert({title:"Error Adding "+t.escapedAliases.Occupancy,message:null!==(o=e.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"}),s&&s(e.success)})}(s.dataset.lotOccupancyId,e=>{e&&s.remove()})}function w(e){const t=e.currentTarget.closest("tr");u(t.dataset.lotId,e=>{e&&t.remove()})}delete exports.workOrderLotOccupancies,O(),null===(S=document.querySelector("#button--addLotOccupancy"))||void 0===S||S.addEventListener("click",()=>{let e,r;function s(o){o&&o.preventDefault(),r.innerHTML=t.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(t.urlPrefix+"/lotOccupancies/doSearchLotOccupancies",e,e=>{var o,s;if(0!==e.lotOccupancies.length){r.innerHTML=`\n \n \n \n \n \n \n \n \n \n
${t.escapedAliases.Occupancy} Type${t.escapedAliases.Lot}${t.escapedAliases.OccupancyStartDate}End Date${t.escapedAliases.Occupants}
`;for(const n of e.lotOccupancies){const e=document.createElement("tr");e.className="container--lotOccupancy",e.dataset.lotOccupancyId=n.lotOccupancyId.toString(),e.innerHTML=''+cityssm.escapeHTML(null!==(o=n.occupancyType)&&void 0!==o?o:"")+"",n.lotId?e.insertAdjacentHTML("beforeend",""+cityssm.escapeHTML(null!==(s=n.lotName)&&void 0!==s?s:"")+""):e.insertAdjacentHTML("beforeend",`(No ${t.escapedAliases.Lot})`),e.insertAdjacentHTML("beforeend",""+n.occupancyStartDateString+""+(n.occupancyEndDate?n.occupancyEndDateString:'(No End Date)')+""+(0===n.lotOccupancyOccupants.length?'(No '+cityssm.escapeHTML(t.escapedAliases.Occupants)+")":cityssm.escapeHTML(n.lotOccupancyOccupants[0].occupantName)+(n.lotOccupancyOccupants.length>1?" plus "+(n.lotOccupancyOccupants.length-1):""))+""),e.querySelector(".button--addLotOccupancy").addEventListener("click",h),r.querySelector("tbody").append(e)}}else r.innerHTML='
\n

There are no records that meet the search criteria.

\n
'})}cityssm.openHtmlModal("workOrder-addLotOccupancy",{onshow(n){t.populateAliases(n),e=n.querySelector("form"),r=n.querySelector("#resultsContainer--lotOccupancyAdd"),n.querySelector("#lotOccupancySearch--notWorkOrderId").value=o,n.querySelector("#lotOccupancySearch--occupancyEffectiveDateString").value=document.querySelector("#workOrderEdit--workOrderOpenDateString").value,s()},onshown(t){bulmaJS.toggleHtmlClipped();const o=t.querySelector("#lotOccupancySearch--occupantName");o.addEventListener("change",s),o.focus(),t.querySelector("#lotOccupancySearch--lotName").addEventListener("change",s),e.addEventListener("submit",s)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addLotOccupancy").focus()}})}),null===(i=document.querySelector("#button--addLot"))||void 0===i||i.addEventListener("click",()=>{let e,r;function s(o){o&&o.preventDefault(),r.innerHTML=t.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(t.urlPrefix+"/lots/doSearchLots",e,e=>{var o,s,n,a;if(0!==e.lots.length){r.innerHTML=`\n \n \n \n \n \n \n \n \n
${t.escapedAliases.Lot}${t.escapedAliases.Map}${t.escapedAliases.Lot} TypeStatus
`;for(const t of e.lots){const e=document.createElement("tr");e.className="container--lot",e.dataset.lotId=t.lotId.toString(),e.innerHTML=''+cityssm.escapeHTML(null!==(o=t.lotName)&&void 0!==o?o:"")+""+cityssm.escapeHTML(null!==(s=t.mapName)&&void 0!==s?s:"")+""+cityssm.escapeHTML(null!==(n=t.lotType)&&void 0!==n?n:"")+""+cityssm.escapeHTML(null!==(a=t.lotStatus)&&void 0!==a?a:"")+"",e.querySelector(".button--addLot").addEventListener("click",w),r.querySelector("tbody").append(e)}}else r.innerHTML='

There are no records that meet the search criteria.

'})}cityssm.openHtmlModal("workOrder-addLot",{onshow(n){t.populateAliases(n),e=n.querySelector("form"),r=n.querySelector("#resultsContainer--lotAdd"),n.querySelector("#lotSearch--notWorkOrderId").value=o;const a=n.querySelector("#lotSearch--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,a.append(t)}s()},onshown(t){bulmaJS.toggleHtmlClipped();const o=t.querySelector("#lotSearch--lotName");o.addEventListener("change",s),o.focus(),t.querySelector("#lotSearch--lotStatusId").addEventListener("change",s),e.addEventListener("submit",s)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addLot").focus()}})})}var S;Object.defineProperty(exports,"__esModule",{value:!0});let k=exports.workOrderComments;function g(e){const r=Number.parseInt(e.currentTarget.closest("tr").dataset.workOrderCommentId,10),s=k.find(e=>e.workOrderCommentId===r);let n,a;function l(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/doUpdateWorkOrderComment",n,e=>{var t;e.success?(k=e.workOrderComments,a(),b()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("workOrder-editComment",{onshow(e){e.querySelector("#workOrderCommentEdit--workOrderId").value=o,e.querySelector("#workOrderCommentEdit--workOrderCommentId").value=r.toString(),e.querySelector("#workOrderCommentEdit--workOrderComment").value=s.workOrderComment;const t=e.querySelector("#workOrderCommentEdit--workOrderCommentDateString");t.value=s.workOrderCommentDateString;const n=cityssm.dateToString(new Date);t.max=s.workOrderCommentDateString<=n?n:s.workOrderCommentDateString,e.querySelector("#workOrderCommentEdit--workOrderCommentTimeString").value=s.workOrderCommentTimeString},onshown(e,o){bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),e.querySelector("#workOrderCommentEdit--workOrderComment").focus(),(n=e.querySelector("form")).addEventListener("submit",l),a=o},onremoved(){bulmaJS.toggleHtmlClipped()}})}function f(e){const r=Number.parseInt(e.currentTarget.closest("tr").dataset.workOrderCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrderComment",{workOrderId:o,workOrderCommentId:r},e=>{var t;e.success?(k=e.workOrderComments,b()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function b(){var e,t;const o=document.querySelector("#container--workOrderComments");if(0===k.length)return void(o.innerHTML='
\n

There are no comments to display.

\n
');const r=document.createElement("table");r.className="table is-fullwidth is-striped is-hoverable",r.innerHTML='\n Commentor\n Comment Date\n Comment\n Options';for(const o of k){const s=document.createElement("tr");s.dataset.workOrderCommentId=o.workOrderCommentId.toString(),s.innerHTML=""+cityssm.escapeHTML(null!==(e=o.recordCreate_userName)&&void 0!==e?e:"")+""+o.workOrderCommentDateString+(0===o.workOrderCommentTime?"":" "+o.workOrderCommentTimeString)+""+cityssm.escapeHTML(null!==(t=o.workOrderComment)&&void 0!==t?t:"")+'
',s.querySelector(".button--edit").addEventListener("click",g),s.querySelector(".button--delete").addEventListener("click",f),r.querySelector("tbody").append(s)}o.innerHTML="",o.append(r)}function v(e){var t;e.success?(d=e.workOrderMilestones,I()):bulmaJS.alert({title:"Error Reopening Milestone",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})}function M(e){e.preventDefault();const r=cityssm.dateToString(new Date),s=Number.parseInt(e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId,10),n=d.find(e=>e.workOrderMilestoneId===s);bulmaJS.confirm({title:"Complete Milestone",message:"Are you sure you want to complete this milestone?"+(n.workOrderMilestoneDateString>r?"
Note that this milestone is expected to be completed in the future.":""),messageIsHtml:!0,contextualColorName:"warning",okButton:{text:"Yes, Complete Milestone",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doCompleteWorkOrderMilestone",{workOrderId:o,workOrderMilestoneId:s},v)}}})}function L(e){e.preventDefault();const r=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Reopen Milestone",message:"Are you sure you want to remove the completion status from this milestone, and reopen it?",contextualColorName:"warning",okButton:{text:"Yes, Reopen Milestone",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doReopenWorkOrderMilestone",{workOrderId:o,workOrderMilestoneId:r},v)}}})}function C(e){e.preventDefault();const r=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Delete Milestone",message:"Are you sure you want to delete this milestone?",contextualColorName:"warning",okButton:{text:"Yes, Delete Milestone",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrderMilestone",{workOrderMilestoneId:r,workOrderId:o},v)}}})}function T(e){e.preventDefault();const r=Number.parseInt(e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId,10),s=d.find(e=>e.workOrderMilestoneId===r);let n;function a(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/doUpdateWorkOrderMilestone",e.currentTarget,e=>{v(e),e.success&&n()})}cityssm.openHtmlModal("workOrder-editMilestone",{onshow(e){e.querySelector("#milestoneEdit--workOrderId").value=o,e.querySelector("#milestoneEdit--workOrderMilestoneId").value=s.workOrderMilestoneId.toString();const t=e.querySelector("#milestoneEdit--workOrderMilestoneTypeId");let r=!1;for(const e of exports.workOrderMilestoneTypes){const o=document.createElement("option");o.value=e.workOrderMilestoneTypeId.toString(),o.textContent=e.workOrderMilestoneType,e.workOrderMilestoneTypeId===s.workOrderMilestoneTypeId&&(o.selected=!0,r=!0),t.append(o)}if(!r&&s.workOrderMilestoneTypeId){const e=document.createElement("option");e.value=s.workOrderMilestoneTypeId.toString(),e.textContent=s.workOrderMilestoneType,e.selected=!0,t.append(e)}e.querySelector("#milestoneEdit--workOrderMilestoneDateString").value=s.workOrderMilestoneDateString,s.workOrderMilestoneTime&&(e.querySelector("#milestoneEdit--workOrderMilestoneTimeString").value=s.workOrderMilestoneTimeString),e.querySelector("#milestoneEdit--workOrderMilestoneDescription").value=s.workOrderMilestoneDescription},onshown(e,o){n=o,bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),e.querySelector("form").addEventListener("submit",a)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function I(){var e,t,o,r,s;const n=document.querySelector("#panel--milestones"),a=n.querySelectorAll(".panel-block");for(const e of a)e.remove();for(const a of d){const l=document.createElement("div");l.className="panel-block is-block container--milestone",l.dataset.workOrderMilestoneId=a.workOrderMilestoneId.toString(),l.innerHTML='
'+(a.workOrderMilestoneCompletionDate?'':'')+'
'+(a.workOrderMilestoneTypeId?""+cityssm.escapeHTML(null!==(e=a.workOrderMilestoneType)&&void 0!==e?e:"")+"
":"")+a.workOrderMilestoneDateString+(a.workOrderMilestoneTime?" "+a.workOrderMilestoneTimeString:"")+'
'+cityssm.escapeHTML(null!==(t=a.workOrderMilestoneDescription)&&void 0!==t?t:"")+'
',null===(o=l.querySelector(".button--reopenMilestone"))||void 0===o||o.addEventListener("click",L),null===(r=l.querySelector(".button--editMilestone"))||void 0===r||r.addEventListener("click",T),null===(s=l.querySelector(".button--completeMilestone"))||void 0===s||s.addEventListener("click",M),l.querySelector(".button--deleteMilestone").addEventListener("click",C),n.append(l)}bulmaJS.init(n)}delete exports.workOrderComments,null===(S=document.querySelector("#workOrderComments--add"))||void 0===S||S.addEventListener("click",function(){let e;function r(o){o.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/doAddWorkOrderComment",o.currentTarget,t=>{t.success&&(k=t.workOrderComments,b(),e())})}cityssm.openHtmlModal("workOrder-addComment",{onshow(e){t.populateAliases(e),e.querySelector("#workOrderCommentAdd--workOrderId").value=o,e.querySelector("form").addEventListener("submit",r)},onshown(t,o){bulmaJS.toggleHtmlClipped(),e=o,t.querySelector("#workOrderCommentAdd--workOrderComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#workOrderComments--add").focus()}})}),r||b(),r||(d=exports.workOrderMilestones,delete exports.workOrderMilestones,I(),null===(e=document.querySelector("#button--addMilestone"))||void 0===e||e.addEventListener("click",()=>{let e,r,s;function n(o){o&&o.preventDefault();const n=cityssm.dateToString(new Date);function a(){cityssm.postJSON(t.urlPrefix+"/workOrders/doAddWorkOrderMilestone",r,e=>{v(e),e.success&&s()})}e.querySelector("#milestoneAdd--workOrderMilestoneDateString").value{var e;const t=exports.los,o=document.querySelector("#workOrderEdit--workOrderId").value,r=""===o,s=document.querySelector("#form--workOrderEdit");t.initializeDatePickers(s.querySelector("#workOrderEdit--workOrderOpenDateString").closest(".field")),t.initializeUnlockFieldButtons(s),s.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/"+(r?"doCreateWorkOrder":"doUpdateWorkOrder"),e.currentTarget,e=>{var o;e.success?(cityssm.disableNavBlocker(),r?window.location.href=t.getWorkOrderURL(e.workOrderId,!0):bulmaJS.alert({message:"Work Order Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating Work Order",message:null!==(o=e.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})});const n=s.querySelectorAll("input, select");for(const e of n)e.addEventListener("change",cityssm.enableNavBlocker);function a(){cityssm.postJSON(t.urlPrefix+"/workOrders/doCloseWorkOrder",{workOrderId:o},e=>{var r;e.success?window.location.href=t.urlPrefix+"/workOrders/"+o:bulmaJS.alert({title:"Error Closing Work Order",message:null!==(r=e.errorMessage)&&void 0!==r?r:"",contextualColorName:"danger"})})}function l(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrder",{workOrderId:o},e=>{var o;e.success?window.location.href=t.urlPrefix+"/workOrders":bulmaJS.alert({title:"Error Deleting Work Order",message:null!==(o=e.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}let i;if(null===(S=document.querySelector("#button--closeWorkOrder"))||void 0===S||S.addEventListener("click",()=>{i.some(e=>!e.workOrderMilestoneCompletionDate)?bulmaJS.alert({title:"Outstanding Milestones",message:"You cannot close a work order with outstanding milestones.\n Either complete the outstanding milestones, or remove them from the work order.",contextualColorName:"warning"}):bulmaJS.confirm({title:"Close Work Order",message:"Are you sure you want to close this work order?",contextualColorName:"info",okButton:{text:"Yes, Close Work Order",callbackFunction:a}})}),null===(c=document.querySelector("#button--deleteWorkOrder"))||void 0===c||c.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete Work Order",message:"Are you sure you want to delete this work order?",contextualColorName:"warning",okButton:{text:"Yes, Delete Work Order",callbackFunction:l}})}),!r){var c;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.workOrderLots;delete exports.workOrderLots;let r=exports.workOrderLotOccupancies;function d(e){const s=e.currentTarget.closest(".container--lotOccupancy").dataset.lotOccupancyId;bulmaJS.confirm({title:`Delete ${t.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${t.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrderLotOccupancy",{workOrderId:o,lotOccupancyId:s},e=>{var t;e.success?(r=e.workOrderLotOccupancies,O()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function u(r,s){cityssm.postJSON(t.urlPrefix+"/workOrders/doAddWorkOrderLot",{workOrderId:o,lotId:r},o=>{var r;o.success?(e=o.workOrderLots,O()):bulmaJS.alert({title:`Error Adding ${t.escapedAliases.Lot}`,message:null!==(r=o.errorMessage)&&void 0!==r?r:"",contextualColorName:"danger"}),s&&s(o.success)})}function m(e){u(e.currentTarget.dataset.lotId)}function p(r){const s=Number.parseInt(r.currentTarget.closest(".container--lot").dataset.lotId,10),n=e.find(e=>e.lotId===s);let a;function l(o){o.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/doUpdateLotStatus",o.currentTarget,t=>{var o;t.success?(e=t.workOrderLots,O(),a()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=t.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lot-editLotStatus",{onshow(e){t.populateAliases(e),e.querySelector("#lotStatusEdit--lotId").value=s.toString(),e.querySelector("#lotStatusEdit--lotName").value=n.lotName;const r=e.querySelector("#lotStatusEdit--lotStatusId");let a=!1;for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,e.lotStatusId===n.lotStatusId&&(a=!0),r.append(t)}if(!a&&n.lotStatusId){const e=document.createElement("option");e.value=n.lotStatusId.toString(),e.textContent=n.lotStatus,r.append(e)}n.lotStatusId&&(r.value=n.lotStatusId.toString()),e.querySelector("form").insertAdjacentHTML("beforeend",``)},onshown(e,t){a=t,bulmaJS.toggleHtmlClipped(),e.querySelector("form").addEventListener("submit",l)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function y(r){const s=r.currentTarget.closest(".container--lot").dataset.lotId;bulmaJS.confirm({title:`Delete ${t.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${t.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrderLot",{workOrderId:o,lotId:s},t=>{var o;t.success?(e=t.workOrderLots,O()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=t.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})}function O(){!function(){var o,s,n,a;const l=document.querySelector("#container--lotOccupancies");if(document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent=r.length.toString(),0===r.length)return void(l.innerHTML=`
\n

There are no ${t.escapedAliases.occupancies} associated with this work order.

\n
`);l.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n
${t.escapedAliases.Occupancy} Type${t.escapedAliases.Lot}${t.escapedAliases.OccupancyStartDate}End Date${t.escapedAliases.Occupants}
`;const i=cityssm.dateToString(new Date);for(const c of r){const r=document.createElement("tr");r.className="container--lotOccupancy",r.dataset.lotOccupancyId=c.lotOccupancyId.toString();const u=!(c.occupancyEndDate&&c.occupancyEndDateStringc.lotId===e.lotId);r.innerHTML=''+(u?'':'')+''+cityssm.escapeHTML(null!==(o=c.occupancyType)&&void 0!==o?o:"")+"",c.lotId?r.insertAdjacentHTML("beforeend",""+cityssm.escapeHTML(null!==(s=c.lotName)&&void 0!==s?s:"")+(p?"":' ')+""):r.insertAdjacentHTML("beforeend",`(No ${t.escapedAliases.Lot})`),r.insertAdjacentHTML("beforeend",""+c.occupancyStartDateString+""+(c.occupancyEndDate?c.occupancyEndDateString:'(No End Date)')+""+(0===c.lotOccupancyOccupants.length?'(No '+t.escapedAliases.Occupants+")":null===(n=c.lotOccupancyOccupants)||void 0===n?void 0:n.reduce((e,o)=>{var r;return e+' '+cityssm.escapeHTML(o.occupantName)+" "+cityssm.escapeHTML(o.occupantFamilyName)+"
"},""))+''),null===(a=r.querySelector(".button--addLot"))||void 0===a||a.addEventListener("click",m),r.querySelector(".button--deleteLotOccupancy").addEventListener("click",d),l.querySelector("tbody").append(r)}}(),function(){var o,r,s,n;const a=document.querySelector("#container--lots");if(document.querySelector(".tabs a[href='#relatedTab--lots'] .tag").textContent=e.length.toString(),0!==e.length){a.innerHTML=`\n \n \n \n \n \n \n \n \n
${t.escapedAliases.Lot}${t.escapedAliases.Map}${t.escapedAliases.Lot} TypeStatus
`;for(const l of e){const e=document.createElement("tr");e.className="container--lot",e.dataset.lotId=l.lotId.toString(),e.innerHTML=''+cityssm.escapeHTML(null!==(o=l.lotName)&&void 0!==o?o:"")+""+cityssm.escapeHTML(null!==(r=l.mapName)&&void 0!==r?r:"")+""+cityssm.escapeHTML(null!==(s=l.lotType)&&void 0!==s?s:"")+""+(l.lotStatusId?cityssm.escapeHTML(null!==(n=l.lotStatus)&&void 0!==n?n:""):'(No Status)')+' ',e.querySelector(".button--editLotStatus").addEventListener("click",p),e.querySelector(".button--deleteLot").addEventListener("click",y),a.querySelector("tbody").append(e)}}else a.innerHTML=`
\n

There are no ${t.escapedAliases.lots} associated with this work order.

\n
`}()}function h(e){const s=e.currentTarget.closest("tr");!function(e,s){cityssm.postJSON(t.urlPrefix+"/workOrders/doAddWorkOrderLotOccupancy",{workOrderId:o,lotOccupancyId:e},e=>{var o;e.success?(r=e.workOrderLotOccupancies,O()):bulmaJS.alert({title:"Error Adding "+t.escapedAliases.Occupancy,message:null!==(o=e.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"}),s&&s(e.success)})}(s.dataset.lotOccupancyId,e=>{e&&s.remove()})}function w(e){const t=e.currentTarget.closest("tr");u(t.dataset.lotId,e=>{e&&t.remove()})}delete exports.workOrderLotOccupancies,O(),null===(S=document.querySelector("#button--addLotOccupancy"))||void 0===S||S.addEventListener("click",()=>{let e,r;function s(o){o&&o.preventDefault(),r.innerHTML=t.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(t.urlPrefix+"/lotOccupancies/doSearchLotOccupancies",e,e=>{var o,s;if(0!==e.lotOccupancies.length){r.innerHTML=`\n \n \n \n \n \n \n \n \n \n
${t.escapedAliases.Occupancy} Type${t.escapedAliases.Lot}${t.escapedAliases.OccupancyStartDate}End Date${t.escapedAliases.Occupants}
`;for(const n of e.lotOccupancies){const e=document.createElement("tr");e.className="container--lotOccupancy",e.dataset.lotOccupancyId=n.lotOccupancyId.toString(),e.innerHTML=''+cityssm.escapeHTML(null!==(o=n.occupancyType)&&void 0!==o?o:"")+"",n.lotId?e.insertAdjacentHTML("beforeend",""+cityssm.escapeHTML(null!==(s=n.lotName)&&void 0!==s?s:"")+""):e.insertAdjacentHTML("beforeend",`(No ${t.escapedAliases.Lot})`),e.insertAdjacentHTML("beforeend",""+n.occupancyStartDateString+""+(n.occupancyEndDate?n.occupancyEndDateString:'(No End Date)')+""+(0===n.lotOccupancyOccupants.length?'(No '+cityssm.escapeHTML(t.escapedAliases.Occupants)+")":cityssm.escapeHTML(n.lotOccupancyOccupants[0].occupantName+" "+n.lotOccupancyOccupants[0].occupantFamilyName)+(n.lotOccupancyOccupants.length>1?" plus "+(n.lotOccupancyOccupants.length-1):""))+""),e.querySelector(".button--addLotOccupancy").addEventListener("click",h),r.querySelector("tbody").append(e)}}else r.innerHTML='
\n

There are no records that meet the search criteria.

\n
'})}cityssm.openHtmlModal("workOrder-addLotOccupancy",{onshow(n){t.populateAliases(n),e=n.querySelector("form"),r=n.querySelector("#resultsContainer--lotOccupancyAdd"),n.querySelector("#lotOccupancySearch--notWorkOrderId").value=o,n.querySelector("#lotOccupancySearch--occupancyEffectiveDateString").value=document.querySelector("#workOrderEdit--workOrderOpenDateString").value,s()},onshown(t){bulmaJS.toggleHtmlClipped();const o=t.querySelector("#lotOccupancySearch--occupantName");o.addEventListener("change",s),o.focus(),t.querySelector("#lotOccupancySearch--lotName").addEventListener("change",s),e.addEventListener("submit",s)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addLotOccupancy").focus()}})}),null===(c=document.querySelector("#button--addLot"))||void 0===c||c.addEventListener("click",()=>{let e,r;function s(o){o&&o.preventDefault(),r.innerHTML=t.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(t.urlPrefix+"/lots/doSearchLots",e,e=>{var o,s,n,a;if(0!==e.lots.length){r.innerHTML=`\n \n \n \n \n \n \n \n \n
${t.escapedAliases.Lot}${t.escapedAliases.Map}${t.escapedAliases.Lot} TypeStatus
`;for(const t of e.lots){const e=document.createElement("tr");e.className="container--lot",e.dataset.lotId=t.lotId.toString(),e.innerHTML=''+cityssm.escapeHTML(null!==(o=t.lotName)&&void 0!==o?o:"")+""+cityssm.escapeHTML(null!==(s=t.mapName)&&void 0!==s?s:"")+""+cityssm.escapeHTML(null!==(n=t.lotType)&&void 0!==n?n:"")+""+cityssm.escapeHTML(null!==(a=t.lotStatus)&&void 0!==a?a:"")+"",e.querySelector(".button--addLot").addEventListener("click",w),r.querySelector("tbody").append(e)}}else r.innerHTML='

There are no records that meet the search criteria.

'})}cityssm.openHtmlModal("workOrder-addLot",{onshow(n){t.populateAliases(n),e=n.querySelector("form"),r=n.querySelector("#resultsContainer--lotAdd"),n.querySelector("#lotSearch--notWorkOrderId").value=o;const a=n.querySelector("#lotSearch--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,a.append(t)}s()},onshown(t){bulmaJS.toggleHtmlClipped();const o=t.querySelector("#lotSearch--lotName");o.addEventListener("change",s),o.focus(),t.querySelector("#lotSearch--lotStatusId").addEventListener("change",s),e.addEventListener("submit",s)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addLot").focus()}})})}var S;Object.defineProperty(exports,"__esModule",{value:!0});let k=exports.workOrderComments;function g(e){const r=Number.parseInt(e.currentTarget.closest("tr").dataset.workOrderCommentId,10),s=k.find(e=>e.workOrderCommentId===r);let n,a;function l(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/doUpdateWorkOrderComment",n,e=>{var t;e.success?(k=e.workOrderComments,a(),b()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("workOrder-editComment",{onshow(e){e.querySelector("#workOrderCommentEdit--workOrderId").value=o,e.querySelector("#workOrderCommentEdit--workOrderCommentId").value=r.toString(),e.querySelector("#workOrderCommentEdit--workOrderComment").value=s.workOrderComment;const t=e.querySelector("#workOrderCommentEdit--workOrderCommentDateString");t.value=s.workOrderCommentDateString;const n=cityssm.dateToString(new Date);t.max=s.workOrderCommentDateString<=n?n:s.workOrderCommentDateString,e.querySelector("#workOrderCommentEdit--workOrderCommentTimeString").value=s.workOrderCommentTimeString},onshown(e,o){bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),e.querySelector("#workOrderCommentEdit--workOrderComment").focus(),(n=e.querySelector("form")).addEventListener("submit",l),a=o},onremoved(){bulmaJS.toggleHtmlClipped()}})}function f(e){const r=Number.parseInt(e.currentTarget.closest("tr").dataset.workOrderCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrderComment",{workOrderId:o,workOrderCommentId:r},e=>{var t;e.success?(k=e.workOrderComments,b()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function b(){var e,t;const o=document.querySelector("#container--workOrderComments");if(0===k.length)return void(o.innerHTML='
\n

There are no comments to display.

\n
');const r=document.createElement("table");r.className="table is-fullwidth is-striped is-hoverable",r.innerHTML='\n Commentor\n Comment Date\n Comment\n Options';for(const o of k){const s=document.createElement("tr");s.dataset.workOrderCommentId=o.workOrderCommentId.toString(),s.innerHTML=""+cityssm.escapeHTML(null!==(e=o.recordCreate_userName)&&void 0!==e?e:"")+""+o.workOrderCommentDateString+(0===o.workOrderCommentTime?"":" "+o.workOrderCommentTimeString)+""+cityssm.escapeHTML(null!==(t=o.workOrderComment)&&void 0!==t?t:"")+'
',s.querySelector(".button--edit").addEventListener("click",g),s.querySelector(".button--delete").addEventListener("click",f),r.querySelector("tbody").append(s)}o.innerHTML="",o.append(r)}function v(e){var t;e.success?(i=e.workOrderMilestones,I()):bulmaJS.alert({title:"Error Reopening Milestone",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})}function M(e){e.preventDefault();const r=cityssm.dateToString(new Date),s=Number.parseInt(e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId,10),n=i.find(e=>e.workOrderMilestoneId===s);bulmaJS.confirm({title:"Complete Milestone",message:"Are you sure you want to complete this milestone?"+(n.workOrderMilestoneDateString>r?"
Note that this milestone is expected to be completed in the future.":""),messageIsHtml:!0,contextualColorName:"warning",okButton:{text:"Yes, Complete Milestone",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doCompleteWorkOrderMilestone",{workOrderId:o,workOrderMilestoneId:s},v)}}})}function L(e){e.preventDefault();const r=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Reopen Milestone",message:"Are you sure you want to remove the completion status from this milestone, and reopen it?",contextualColorName:"warning",okButton:{text:"Yes, Reopen Milestone",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doReopenWorkOrderMilestone",{workOrderId:o,workOrderMilestoneId:r},v)}}})}function C(e){e.preventDefault();const r=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Delete Milestone",message:"Are you sure you want to delete this milestone?",contextualColorName:"warning",okButton:{text:"Yes, Delete Milestone",callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/workOrders/doDeleteWorkOrderMilestone",{workOrderMilestoneId:r,workOrderId:o},v)}}})}function T(e){e.preventDefault();const r=Number.parseInt(e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId,10),s=i.find(e=>e.workOrderMilestoneId===r);let n;function a(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/doUpdateWorkOrderMilestone",e.currentTarget,e=>{v(e),e.success&&n()})}cityssm.openHtmlModal("workOrder-editMilestone",{onshow(e){e.querySelector("#milestoneEdit--workOrderId").value=o,e.querySelector("#milestoneEdit--workOrderMilestoneId").value=s.workOrderMilestoneId.toString();const t=e.querySelector("#milestoneEdit--workOrderMilestoneTypeId");let r=!1;for(const e of exports.workOrderMilestoneTypes){const o=document.createElement("option");o.value=e.workOrderMilestoneTypeId.toString(),o.textContent=e.workOrderMilestoneType,e.workOrderMilestoneTypeId===s.workOrderMilestoneTypeId&&(o.selected=!0,r=!0),t.append(o)}if(!r&&s.workOrderMilestoneTypeId){const e=document.createElement("option");e.value=s.workOrderMilestoneTypeId.toString(),e.textContent=s.workOrderMilestoneType,e.selected=!0,t.append(e)}e.querySelector("#milestoneEdit--workOrderMilestoneDateString").value=s.workOrderMilestoneDateString,s.workOrderMilestoneTime&&(e.querySelector("#milestoneEdit--workOrderMilestoneTimeString").value=s.workOrderMilestoneTimeString),e.querySelector("#milestoneEdit--workOrderMilestoneDescription").value=s.workOrderMilestoneDescription},onshown(e,o){n=o,bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),e.querySelector("form").addEventListener("submit",a)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function I(){var e,t,o,r,s;const n=document.querySelector("#panel--milestones"),a=n.querySelectorAll(".panel-block");for(const e of a)e.remove();for(const a of i){const l=document.createElement("div");l.className="panel-block is-block container--milestone",l.dataset.workOrderMilestoneId=a.workOrderMilestoneId.toString(),l.innerHTML='
'+(a.workOrderMilestoneCompletionDate?'':'')+'
'+(a.workOrderMilestoneTypeId?""+cityssm.escapeHTML(null!==(e=a.workOrderMilestoneType)&&void 0!==e?e:"")+"
":"")+a.workOrderMilestoneDateString+(a.workOrderMilestoneTime?" "+a.workOrderMilestoneTimeString:"")+'
'+cityssm.escapeHTML(null!==(t=a.workOrderMilestoneDescription)&&void 0!==t?t:"")+'
',null===(o=l.querySelector(".button--reopenMilestone"))||void 0===o||o.addEventListener("click",L),null===(r=l.querySelector(".button--editMilestone"))||void 0===r||r.addEventListener("click",T),null===(s=l.querySelector(".button--completeMilestone"))||void 0===s||s.addEventListener("click",M),l.querySelector(".button--deleteMilestone").addEventListener("click",C),n.append(l)}bulmaJS.init(n)}delete exports.workOrderComments,null===(S=document.querySelector("#workOrderComments--add"))||void 0===S||S.addEventListener("click",function(){let e;function r(o){o.preventDefault(),cityssm.postJSON(t.urlPrefix+"/workOrders/doAddWorkOrderComment",o.currentTarget,t=>{t.success&&(k=t.workOrderComments,b(),e())})}cityssm.openHtmlModal("workOrder-addComment",{onshow(e){t.populateAliases(e),e.querySelector("#workOrderCommentAdd--workOrderId").value=o,e.querySelector("form").addEventListener("submit",r)},onshown(t,o){bulmaJS.toggleHtmlClipped(),e=o,t.querySelector("#workOrderCommentAdd--workOrderComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#workOrderComments--add").focus()}})}),r||b(),r||(i=exports.workOrderMilestones,delete exports.workOrderMilestones,I(),null===(e=document.querySelector("#button--addMilestone"))||void 0===e||e.addEventListener("click",()=>{let e,r,s;function n(o){o&&o.preventDefault();const n=cityssm.dateToString(new Date);function a(){cityssm.postJSON(t.urlPrefix+"/workOrders/doAddWorkOrderMilestone",r,e=>{v(e),e.success&&s()})}e.querySelector("#milestoneAdd--workOrderMilestoneDateString").value{const e=exports.los,s=document.querySelector("#form--searchFilters"),r=s.querySelector("#searchFilter--workOrderMilestoneDateFilter"),a=s.querySelector("#searchFilter--workOrderMilestoneDateString"),t=document.querySelector("#container--milestoneCalendar");function i(r){r&&r.preventDefault(),t.innerHTML=e.getLoadingParagraphHTML("Loading Milestones..."),cityssm.postJSON(e.urlPrefix+"/workOrders/doGetWorkOrderMilestones",s,s=>{!function(s){var r,a,i,o,n,l,c;if(0===s.length)return void(t.innerHTML='
\n

There are no milestones that meet the search criteria.

\n
');t.innerHTML="";const d=cityssm.dateToString(new Date);let p,m="";for(const u of s){m!==u.workOrderMilestoneDateString&&(p&&t.append(p),(p=document.createElement("div")).className="panel",p.innerHTML=`

${u.workOrderMilestoneDateString}

`,m=u.workOrderMilestoneDateString);const s=document.createElement("div");s.className="panel-block is-block",!u.workOrderMilestoneCompletionDate&&u.workOrderMilestoneDateString '+cityssm.escapeHTML(null!==(a=s.lotName)&&void 0!==a?a:"")+"
";for(const s of u.workOrderLotOccupancies)for(const r of s.lotOccupancyOccupants)M+=' '+cityssm.escapeHTML(null!==(o=r.occupantName)&&void 0!==o?o:"")+"
";s.innerHTML='
'+(u.workOrderMilestoneCompletionDate?'':'')+'
'+(0===u.workOrderMilestoneTime?"":u.workOrderMilestoneTimeString+"
")+(u.workOrderMilestoneTypeId?""+cityssm.escapeHTML(u.workOrderMilestoneType)+"
":"")+''+cityssm.escapeHTML(u.workOrderMilestoneDescription)+'
'+cityssm.escapeHTML(null!==(l=u.workOrderNumber)&&void 0!==l?l:"")+'
'+cityssm.escapeHTML(null!==(c=u.workOrderDescription)&&void 0!==c?c:"")+'
'+M+"
",p.append(s)}t.append(p)}(s.workOrderMilestones)})}r.addEventListener("change",()=>{a.closest("fieldset").disabled="date"!==r.value,i()}),e.initializeDatePickers(s),a.addEventListener("change",i),s.addEventListener("submit",i),i()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,s=document.querySelector("#form--searchFilters"),r=s.querySelector("#searchFilter--workOrderMilestoneDateFilter"),a=s.querySelector("#searchFilter--workOrderMilestoneDateString"),t=document.querySelector("#container--milestoneCalendar");function i(r){r&&r.preventDefault(),t.innerHTML=e.getLoadingParagraphHTML("Loading Milestones..."),cityssm.postJSON(e.urlPrefix+"/workOrders/doGetWorkOrderMilestones",s,s=>{!function(s){var r,a,i,o,n,l,c,d;if(0===s.length)return void(t.innerHTML='
\n

There are no milestones that meet the search criteria.

\n
');t.innerHTML="";const p=cityssm.dateToString(new Date);let m,u="";for(const M of s){u!==M.workOrderMilestoneDateString&&(m&&t.append(m),(m=document.createElement("div")).className="panel",m.innerHTML=`

${M.workOrderMilestoneDateString}

`,u=M.workOrderMilestoneDateString);const s=document.createElement("div");s.className="panel-block is-block",!M.workOrderMilestoneCompletionDate&&M.workOrderMilestoneDateString '+cityssm.escapeHTML(null!==(a=s.lotName)&&void 0!==a?a:"")+"
";for(const s of M.workOrderLotOccupancies)for(const r of s.lotOccupancyOccupants)v+=' '+cityssm.escapeHTML(null!==(o=r.occupantName)&&void 0!==o?o:"")+" "+cityssm.escapeHTML(null!==(n=r.occupantFamilyName)&&void 0!==n?n:"")+"
";s.innerHTML='
'+(M.workOrderMilestoneCompletionDate?'':'')+'
'+(0===M.workOrderMilestoneTime?"":M.workOrderMilestoneTimeString+"
")+(M.workOrderMilestoneTypeId?""+cityssm.escapeHTML(M.workOrderMilestoneType)+"
":"")+''+cityssm.escapeHTML(M.workOrderMilestoneDescription)+'
'+cityssm.escapeHTML(null!==(c=M.workOrderNumber)&&void 0!==c?c:"")+'
'+cityssm.escapeHTML(null!==(d=M.workOrderDescription)&&void 0!==d?d:"")+'
'+v+"
",m.append(s)}t.append(m)}(s.workOrderMilestones)})}r.addEventListener("change",()=>{a.closest("fieldset").disabled="date"!==r.value,i()}),e.initializeDatePickers(s),a.addEventListener("change",i),s.addEventListener("submit",i),i()})(); \ No newline at end of file diff --git a/public/javascripts/workOrderSearch.min.js b/public/javascripts/workOrderSearch.min.js index 7d341370..b4588b5b 100644 --- a/public/javascripts/workOrderSearch.min.js +++ b/public/javascripts/workOrderSearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=exports.workOrderPrints,s=document.querySelector("#form--searchFilters");e.initializeDatePickers(s);const a=document.querySelector("#container--searchResults"),r=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),o=document.querySelector("#searchFilter--offset");function l(s){var o,l,i,n,p,u,f,h,m,O;if(0===s.workOrders.length)return void(a.innerHTML='

There are no work orders that meet the search criteria.

');const k=document.createElement("tbody");for(const a of s.workOrders){let s="";for(const t of a.workOrderLots)s+=' '+cityssm.escapeHTML(""===(null!==(l=t.lotName)&&void 0!==l?l:"")?"(No "+e.escapedAliases.Lot+" Name)":t.lotName)+"
";for(const t of a.workOrderLotOccupancies)for(const a of t.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(""===(null!==(p=a.occupantName)&&void 0!==p?p:"")?"(No Name)":a.occupantName)+"
";k.insertAdjacentHTML("beforeend",''+(a.workOrderNumber.trim()?cityssm.escapeHTML(null!==(u=a.workOrderNumber)&&void 0!==u?u:""):"(No Number)")+""+cityssm.escapeHTML(null!==(f=a.workOrderType)&&void 0!==f?f:"")+'
'+cityssm.escapeHTML(null!==(h=a.workOrderDescription)&&void 0!==h?h:"")+''+s+' '+a.workOrderOpenDateString+'
'+(a.workOrderCloseDate?a.workOrderCloseDateString:'(No '+e.escapedAliases.WorkOrderCloseDate+")")+""+(0===a.workOrderMilestoneCount?"-":a.workOrderMilestoneCompletionCount+" / "+a.workOrderMilestoneCount)+""+(t.length>0?'':"")+"")}a.innerHTML=''+(t.length>0?'':"")+"
Work Order NumberDescriptionRelatedDateProgress
",a.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(r,s.offset,s.count)),a.querySelector("table").append(k),null===(m=a.querySelector("button[data-page='previous']"))||void 0===m||m.addEventListener("click",c),null===(O=a.querySelector("button[data-page='next']"))||void 0===O||O.addEventListener("click",d)}function i(){a.innerHTML=e.getLoadingParagraphHTML("Loading Work Orders..."),cityssm.postJSON(e.urlPrefix+"/workOrders/doSearchWorkOrders",s,l)}function n(){o.value="0",i()}function c(){o.value=Math.max(Number.parseInt(o.value,10)-r,0).toString(),i()}function d(){o.value=(Number.parseInt(o.value,10)+r).toString(),i()}const p=s.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",n);s.addEventListener("submit",e=>{e.preventDefault()}),i()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=exports.workOrderPrints,s=document.querySelector("#form--searchFilters");e.initializeDatePickers(s);const a=document.querySelector("#container--searchResults"),r=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),o=document.querySelector("#searchFilter--offset");function l(s){var o,l,i,n,p,u,f,m,h,O,k;if(0===s.workOrders.length)return void(a.innerHTML='

There are no work orders that meet the search criteria.

');const b=document.createElement("tbody");for(const a of s.workOrders){let s="";for(const t of a.workOrderLots)s+=' '+cityssm.escapeHTML(""===(null!==(l=t.lotName)&&void 0!==l?l:"")?"(No "+e.escapedAliases.Lot+" Name)":t.lotName)+"
";for(const t of a.workOrderLotOccupancies)for(const a of t.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(""===(null!==(p=a.occupantName)&&void 0!==p?p:"")&&""===(null!==(u=a.occupantFamilyName)&&void 0!==u?u:"")?"(No Name)":a.occupantName+" "+a.occupantFamilyName)+"
";b.insertAdjacentHTML("beforeend",'"+(t.length>0?'':"")+"")}a.innerHTML='
'+(a.workOrderNumber.trim()?cityssm.escapeHTML(null!==(f=a.workOrderNumber)&&void 0!==f?f:""):"(No Number)")+""+cityssm.escapeHTML(null!==(m=a.workOrderType)&&void 0!==m?m:"")+'
'+cityssm.escapeHTML(null!==(h=a.workOrderDescription)&&void 0!==h?h:"")+'
'+s+' '+a.workOrderOpenDateString+'
'+(a.workOrderCloseDate?a.workOrderCloseDateString:'(No '+e.escapedAliases.WorkOrderCloseDate+")")+"
"+(0===a.workOrderMilestoneCount?"-":a.workOrderMilestoneCompletionCount+" / "+a.workOrderMilestoneCount)+"
'+(t.length>0?'':"")+"
Work Order NumberDescriptionRelatedDateProgress
",a.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(r,s.offset,s.count)),a.querySelector("table").append(b),null===(O=a.querySelector("button[data-page='previous']"))||void 0===O||O.addEventListener("click",c),null===(k=a.querySelector("button[data-page='next']"))||void 0===k||k.addEventListener("click",d)}function i(){a.innerHTML=e.getLoadingParagraphHTML("Loading Work Orders..."),cityssm.postJSON(e.urlPrefix+"/workOrders/doSearchWorkOrders",s,l)}function n(){o.value="0",i()}function c(){o.value=Math.max(Number.parseInt(o.value,10)-r,0).toString(),i()}function d(){o.value=(Number.parseInt(o.value,10)+r).toString(),i()}const p=s.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",n);s.addEventListener("submit",e=>{e.preventDefault()}),i()})(); \ No newline at end of file diff --git a/temp/legacy.importFromCSV.js b/temp/legacy.importFromCSV.js index 13b81694..32e8c1a2 100644 --- a/temp/legacy.importFromCSV.js +++ b/temp/legacy.importFromCSV.js @@ -206,6 +206,7 @@ async function importFromMasterCSV() { lotOccupancyId: preneedLotOccupancyId, lotOccupantTypeId: importIds.preneedOwnerLotOccupantTypeId, occupantName: masterRow.CM_PRENEED_OWNER, + occupantFamilyName: '', occupantAddress1: masterRow.CM_ADDRESS, occupantAddress2: '', occupantCity: masterRow.CM_CITY, @@ -265,6 +266,7 @@ async function importFromMasterCSV() { lotOccupancyId: deceasedLotOccupancyId, lotOccupantTypeId: importIds.deceasedLotOccupantTypeId, occupantName: masterRow.CM_DECEASED_NAME, + occupantFamilyName: '', occupantAddress1: masterRow.CM_ADDRESS, occupantAddress2: '', occupantCity: masterRow.CM_CITY, @@ -307,6 +309,7 @@ async function importFromMasterCSV() { lotOccupancyId: deceasedLotOccupancyId, lotOccupantTypeId: funeralHomeOccupant.lotOccupantTypeId, occupantName: funeralHomeOccupant.occupantName, + occupantFamilyName: '', occupantAddress1: funeralHomeOccupant.occupantAddress1, occupantAddress2: funeralHomeOccupant.occupantAddress2, occupantCity: funeralHomeOccupant.occupantCity, @@ -372,6 +375,7 @@ async function importFromMasterCSV() { lotOccupancyId: deceasedLotOccupancyId, lotOccupantTypeId: importIds.preneedOwnerLotOccupantTypeId, occupantName: masterRow.CM_PRENEED_OWNER, + occupantFamilyName: '', occupantAddress1: '', occupantAddress2: '', occupantCity: '', @@ -479,6 +483,7 @@ async function importFromPrepaidCSV() { lotOccupancyId, lotOccupantTypeId: importIds.preneedOwnerLotOccupantTypeId, occupantName: prepaidRow.CMPP_PREPAID_FOR_NAME, + occupantFamilyName: '', occupantAddress1: prepaidRow.CMPP_ADDRESS, occupantAddress2: '', occupantCity: prepaidRow.CMPP_CITY, @@ -492,6 +497,7 @@ async function importFromPrepaidCSV() { lotOccupancyId, lotOccupantTypeId: importIds.purchaserLotOccupantTypeId, occupantName: prepaidRow.CMPP_ARRANGED_BY_NAME, + occupantFamilyName: '', occupantAddress1: '', occupantAddress2: '', occupantCity: '', @@ -726,6 +732,7 @@ async function importFromWorkOrderCSV() { lotOccupancyId, lotOccupantTypeId: importIds.deceasedLotOccupantTypeId, occupantName: workOrderRow.WO_DECEASED_NAME, + occupantFamilyName: '', occupantAddress1: workOrderRow.WO_ADDRESS, occupantAddress2: '', occupantCity: workOrderRow.WO_CITY, @@ -777,6 +784,7 @@ async function importFromWorkOrderCSV() { lotOccupancyId, lotOccupantTypeId: funeralHomeOccupant.lotOccupantTypeId, occupantName: funeralHomeOccupant.occupantName, + occupantFamilyName: '', occupantAddress1: funeralHomeOccupant.occupantAddress1, occupantAddress2: funeralHomeOccupant.occupantAddress2, occupantCity: funeralHomeOccupant.occupantCity, diff --git a/temp/legacy.importFromCSV.ts b/temp/legacy.importFromCSV.ts index 7c95a702..4785e9b5 100644 --- a/temp/legacy.importFromCSV.ts +++ b/temp/legacy.importFromCSV.ts @@ -471,6 +471,7 @@ async function importFromMasterCSV(): Promise { lotOccupancyId: preneedLotOccupancyId, lotOccupantTypeId: importIds.preneedOwnerLotOccupantTypeId, occupantName: masterRow.CM_PRENEED_OWNER, + occupantFamilyName: '', occupantAddress1: masterRow.CM_ADDRESS, occupantAddress2: '', occupantCity: masterRow.CM_CITY, @@ -568,6 +569,7 @@ async function importFromMasterCSV(): Promise { lotOccupancyId: deceasedLotOccupancyId, lotOccupantTypeId: importIds.deceasedLotOccupantTypeId, occupantName: masterRow.CM_DECEASED_NAME, + occupantFamilyName: '', occupantAddress1: masterRow.CM_ADDRESS, occupantAddress2: '', occupantCity: masterRow.CM_CITY, @@ -643,6 +645,7 @@ async function importFromMasterCSV(): Promise { lotOccupancyId: deceasedLotOccupancyId, lotOccupantTypeId: funeralHomeOccupant.lotOccupantTypeId!, occupantName: funeralHomeOccupant.occupantName!, + occupantFamilyName: '', occupantAddress1: funeralHomeOccupant.occupantAddress1!, occupantAddress2: funeralHomeOccupant.occupantAddress2!, occupantCity: funeralHomeOccupant.occupantCity!, @@ -767,6 +770,7 @@ async function importFromMasterCSV(): Promise { lotOccupancyId: deceasedLotOccupancyId, lotOccupantTypeId: importIds.preneedOwnerLotOccupantTypeId, occupantName: masterRow.CM_PRENEED_OWNER, + occupantFamilyName: '', occupantAddress1: '', occupantAddress2: '', occupantCity: '', @@ -912,6 +916,7 @@ async function importFromPrepaidCSV(): Promise { lotOccupancyId, lotOccupantTypeId: importIds.preneedOwnerLotOccupantTypeId, occupantName: prepaidRow.CMPP_PREPAID_FOR_NAME, + occupantFamilyName: '', occupantAddress1: prepaidRow.CMPP_ADDRESS, occupantAddress2: '', occupantCity: prepaidRow.CMPP_CITY, @@ -930,6 +935,7 @@ async function importFromPrepaidCSV(): Promise { lotOccupancyId, lotOccupantTypeId: importIds.purchaserLotOccupantTypeId, occupantName: prepaidRow.CMPP_ARRANGED_BY_NAME, + occupantFamilyName: '', occupantAddress1: '', occupantAddress2: '', occupantCity: '', @@ -1265,6 +1271,7 @@ async function importFromWorkOrderCSV(): Promise { lotOccupancyId, lotOccupantTypeId: importIds.deceasedLotOccupantTypeId, occupantName: workOrderRow.WO_DECEASED_NAME, + occupantFamilyName: '', occupantAddress1: workOrderRow.WO_ADDRESS, occupantAddress2: '', occupantCity: workOrderRow.WO_CITY, @@ -1356,6 +1363,7 @@ async function importFromWorkOrderCSV(): Promise { lotOccupancyId, lotOccupantTypeId: funeralHomeOccupant.lotOccupantTypeId!, occupantName: funeralHomeOccupant.occupantName!, + occupantFamilyName: '', occupantAddress1: funeralHomeOccupant.occupantAddress1!, occupantAddress2: funeralHomeOccupant.occupantAddress2!, occupantCity: funeralHomeOccupant.occupantCity!, @@ -1460,7 +1468,7 @@ async function importFromWorkOrderCSV(): Promise { if (importIds.acknowledgedWorkOrderMilestoneTypeId) { await addWorkOrderMilestone( { - workOrderId: workOrder.workOrderId, + workOrderId: workOrder.workOrderId!, workOrderMilestoneTypeId: importIds.acknowledgedWorkOrderMilestoneTypeId, workOrderMilestoneDateString: workOrderOpenDateString, diff --git a/types/recordTypes.d.ts b/types/recordTypes.d.ts index d4e10cea..9f881a61 100644 --- a/types/recordTypes.d.ts +++ b/types/recordTypes.d.ts @@ -154,6 +154,7 @@ export interface LotOccupancyOccupant extends Record { fontAwesomeIconClass?: string; occupantCommentTitle?: string; occupantName?: string; + occupantFamilyName?: string; occupantAddress1?: string; occupantAddress2?: string; occupantCity?: string; diff --git a/types/recordTypes.ts b/types/recordTypes.ts index 21d0f0ca..172697ff 100644 --- a/types/recordTypes.ts +++ b/types/recordTypes.ts @@ -203,6 +203,7 @@ export interface LotOccupancyOccupant extends Record { occupantCommentTitle?: string occupantName?: string + occupantFamilyName?: string occupantAddress1?: string occupantAddress2?: string occupantCity?: string diff --git a/views/dashboard.ejs b/views/dashboard.ejs index 2730ab2a..5379ea5f 100644 --- a/views/dashboard.ejs +++ b/views/dashboard.ejs @@ -77,6 +77,7 @@ "> <%= occupant.occupantName %> + <%= occupant.occupantFamilyName %>
<% } diff --git a/views/lot-edit.ejs b/views/lot-edit.ejs index 983f49a4..b3357999 100644 --- a/views/lot-edit.ejs +++ b/views/lot-edit.ejs @@ -257,97 +257,97 @@
-
-
-

Geographic Location

-
-
- -
- -
-
-
- -
- -
-
-
-
-
-
-
-

Image

-
- -
-
-
- -
-
-
- -
-
- -
- -
- -
-

- - - What is the SVG ID? - -

-
-
-
-
+
+
+

Geographic Location

+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+

Image

+
+ +
+
+
+ +
+
+
+ +
+
+ +
+ +
+ +
+

+ + + What is the SVG ID? + +

+
+
+
+
<% if (isCreate) { %> -
-

- Additional options will be available after the record has been created. -

-
+
+

+ Additional options will be available after the record has been created. +

+
<% } else { %>
@@ -374,24 +374,24 @@
-
-
-
-

- <%= configFunctions.getProperty("aliases.occupancies") %> - <%= lot.lotOccupancies.length %> -

-
-
- +
+
+
+

+ <%= configFunctions.getProperty("aliases.occupancies") %> + <%= lot.lotOccupancies.length %> +

+
+ +
<% if (lot.lotOccupancies.length === 0) { %> @@ -435,16 +435,16 @@ <% } %>
<% } %> diff --git a/views/lot-view.ejs b/views/lot-view.ejs index ee5fef9d..b5955d90 100644 --- a/views/lot-view.ejs +++ b/views/lot-view.ejs @@ -4,10 +4,10 @@ @@ -183,45 +187,45 @@

- This Contract for Purchase of Interment Rights or Cemetery Services - is between the Purchaser and The Corporation of the City of Sault Ste. Marie (Corporation) - concerning interment rights or cemetery services for the Recipient(s) - as identified in this Contract. + This Contract for Purchase of Interment Rights or Cemetery Services + is between the Purchaser and The Corporation of the City of Sault Ste. Marie (Corporation) + concerning interment rights or cemetery services for the Recipient(s) + as identified in this Contract.

- The Purchaser (if different than the Recipient) - represents being legally authorized or charged with the responsibility for - the Recipient's interment rights and prepaid cemetery services - specified in this Contract. This Contract will be enforceable to - the benefit of and be binding upon the parties hereto - and their respective heirs, executors, administrators, successors, and assigns. + The Purchaser (if different than the Recipient) + represents being legally authorized or charged with the responsibility for + the Recipient's interment rights and prepaid cemetery services + specified in this Contract. This Contract will be enforceable to + the benefit of and be binding upon the parties hereto + and their respective heirs, executors, administrators, successors, and assigns.

- <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> - (No <%= configFunctions.getProperty("aliases.occupants") %>) - <% } else { %> - <% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %> - - - <%= occupant.occupantName %> -
- <% } %> + <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> + (No <%= configFunctions.getProperty("aliases.occupants") %>) + <% } else { %> + <% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %> + + + <%= occupant.occupantName + ' ' + occupant.occupantFamilyName %> +
<% } %> + <% } %>
- <%= lotOccupancyOccupant.occupantName %>
+ <%= lotOccupancyOccupant.occupantName %> <%= lotOccupancyOccupant.occupantFamilyName %>
<%= lotOccupancyOccupant.lotOccupantType %> diff --git a/views/print/pdf/ssm.cemetery.burialPermit.ejs b/views/print/pdf/ssm.cemetery.burialPermit.ejs index c3f0b08c..eb721815 100644 --- a/views/print/pdf/ssm.cemetery.burialPermit.ejs +++ b/views/print/pdf/ssm.cemetery.burialPermit.ejs @@ -27,25 +27,25 @@

- <% if (funeralDirectorOccupants.length > 0) { %> - <% const funeralDirector = funeralDirectorOccupants[0]; %> - <%= funeralDirector.occupantName %>
- <%= funeralDirector.occupantAddress1 %>
- <% if (funeralDirector.occupantAddress2) { %><%= funeralDirector.occupantAddress2 %>
<% } %> - <%= funeralDirector.occupantCity %>, <%= funeralDirector.occupantProvince %>
- <%= funeralDirector.occupantPostalCode %> - <% } %> + <% if (funeralDirectorOccupants.length > 0) { %> + <% const funeralDirector = funeralDirectorOccupants[0]; %> + <%= funeralDirector.occupantName %> <%= funeralDirector.occupantFamilyName %>
+ <%= funeralDirector.occupantAddress1 %>
+ <% if (funeralDirector.occupantAddress2) { %><%= funeralDirector.occupantAddress2 %>
<% } %> + <%= funeralDirector.occupantCity %>, <%= funeralDirector.occupantProvince %>
+ <%= funeralDirector.occupantPostalCode %> + <% } %>

- for the purpose of the burial or other disposition of the body of: + for the purpose of the burial or other disposition of the body of:

- <% if (deceasedOccupants.length > 0) { %> - <% const deceased = deceasedOccupants[0]; %> - <%= deceased.occupantName %> - <% } %> + <% if (deceasedOccupants.length > 0) { %> + <% const deceased = deceasedOccupants[0]; %> + <%= deceased.occupantName %> <%= deceased.occupantFamilyName %> + <% } %>

@@ -65,16 +65,16 @@

-  
- (Signature of Division Registrar) +  
+ (Signature of Division Registrar)

- Sault Ste. Marie -   -   -   - 5724 + Sault Ste. Marie +   +   +   + 5724

diff --git a/views/print/pdf/ssm.cemetery.contract.ejs b/views/print/pdf/ssm.cemetery.contract.ejs index cafd266e..4cdd7e8e 100644 --- a/views/print/pdf/ssm.cemetery.contract.ejs +++ b/views/print/pdf/ssm.cemetery.contract.ejs @@ -3,10 +3,10 @@ let purchaserOccupants = []; for (const purchaserLotOccupantType of purchaserLotOccupantTypes) { - purchaserOccupants = lotOccupancyFunctions.filterOccupantsByLotOccupantType(lotOccupancy, purchaserLotOccupantType); - if (purchaserOccupants.length > 0) { - break; - } + purchaserOccupants = lotOccupancyFunctions.filterOccupantsByLotOccupantType(lotOccupancy, purchaserLotOccupantType); + if (purchaserOccupants.length > 0) { + break; + } } const purchaser = purchaserOccupants.length > 0 ? purchaserOccupants[0] : undefined; @@ -15,10 +15,10 @@ let recipientOccupants = []; for (const recipientLotOccupantType of recipientLotOccupantTypes) { - recipientOccupants = lotOccupancyFunctions.filterOccupantsByLotOccupantType(lotOccupancy, recipientLotOccupantType); - if (recipientOccupants.length > 0) { - break; - } + recipientOccupants = lotOccupancyFunctions.filterOccupantsByLotOccupantType(lotOccupancy, recipientLotOccupantType); + if (recipientOccupants.length > 0) { + break; + } } const recipient = recipientOccupants.length > 0 ? recipientOccupants[0] : undefined; @@ -73,18 +73,18 @@

- Contract for the Purchase of Interment Rights or
- Cemetery Services + Contract for the Purchase of Interment Rights or
+ Cemetery Services

- in - - <%= lotOccupancy.mapName %> - - cemetery
- operated by
- The Corporation of the City of Sault Ste. Marie, 99 Foster Drive
- Sault Ste. Marie Ontario   P6A 5X6 + in + + <%= lotOccupancy.mapName %> + + cemetery
+ operated by
+ The Corporation of the City of Sault Ste. Marie, 99 Foster Drive
+ Sault Ste. Marie Ontario   P6A 5X6

Contract No. @@ -105,71 +105,75 @@

-

Purchaser

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name:<%= purchaser ? purchaser.occupantName : "" %>
Address:<%= purchaser ? purchaser.occupantAddress1 : "" %> 
<%= purchaser ? purchaser.occupantAddress2 : "" %> 
City:<%= purchaser ? purchaser.occupantCity : "" %> 
Province:<%= purchaser ? purchaser.occupantProvince : "" %> 
Postal Code:<%= purchaser ? purchaser.occupantPostalCode : "" %> 
Telephone:<%= purchaser ? purchaser.occupantPhoneNumber : "" %> 
E-mail:<%= purchaser ? purchaser.occupantEmailAddress : "" %> 
+

Purchaser

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name: + <%= purchaser ? purchaser.occupantName + ' ' + purchaser.occupantFamilyName : "" %> +
Address:<%= purchaser ? purchaser.occupantAddress1 : "" %> 
<%= purchaser ? purchaser.occupantAddress2 : "" %> 
City:<%= purchaser ? purchaser.occupantCity : "" %> 
Province:<%= purchaser ? purchaser.occupantProvince : "" %> 
Postal Code:<%= purchaser ? purchaser.occupantPostalCode : "" %> 
Telephone:<%= purchaser ? purchaser.occupantPhoneNumber : "" %> 
E-mail:<%= purchaser ? purchaser.occupantEmailAddress : "" %> 

Recipient

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:<%= recipient ? recipient.occupantName : "" %>
Address:<%= recipient ? recipient.occupantAddress1 : "" %> 
<%= recipient ? recipient.occupantAddress2 : "" %> 
City:<%= recipient ? recipient.occupantCity : "" %> 
Province:<%= recipient ? recipient.occupantProvince : "" %> 
Postal Code:<%= recipient ? recipient.occupantPostalCode : "" %> 
Telephone:<%= recipient ? recipient.occupantPhoneNumber : "" %> 
E-mail:<%= recipient ? recipient.occupantEmailAddress : "" %> 
Date of birth: 
Place of birth: 
Name: + <%= recipient ? recipient.occupantName + ' ' + recipient.occupantFamilyName : "" %> +
Address:<%= recipient ? recipient.occupantAddress1 : "" %> 
<%= recipient ? recipient.occupantAddress2 : "" %> 
City:<%= recipient ? recipient.occupantCity : "" %> 
Province:<%= recipient ? recipient.occupantProvince : "" %> 
Postal Code:<%= recipient ? recipient.occupantPostalCode : "" %> 
Telephone:<%= recipient ? recipient.occupantPhoneNumber : "" %> 
E-mail:<%= recipient ? recipient.occupantEmailAddress : "" %> 
Date of birth: 
Place of birth: 
-

Details

- +

Details

+
+ + + + + + + + + <% + for (const field of lotOccupancy.lotOccupancyFields) { + if (field.lotOccupancyFieldValue) { + %> - - + + - - - - - <% - for (const field of lotOccupancy.lotOccupancyFields) { - if (field.lotOccupancyFieldValue) { - %> - - - - - <% - } + <% } - %> -
<%= configFunctions.getProperty("aliases.map") %><%= lotOccupancy.mapName %>
<%= configFunctions.getProperty("aliases.lot") %><%= lotOccupancy.lotName %>
<%= configFunctions.getProperty("aliases.map") %><%= lotOccupancy.mapName %><%= field.occupancyTypeField %><%= field.lotOccupancyFieldValue %>
<%= configFunctions.getProperty("aliases.lot") %><%= lotOccupancy.lotName %>
<%= field.occupancyTypeField %><%= field.lotOccupancyFieldValue %>
+ } + %> +

Interment Rights and Services

diff --git a/views/print/pdf/workOrder.ejs b/views/print/pdf/workOrder.ejs index 5ded34fc..3c91b612 100644 --- a/views/print/pdf/workOrder.ejs +++ b/views/print/pdf/workOrder.ejs @@ -54,7 +54,10 @@ <%= occupancy.occupancyStartEndString %> <% for (const occupant of occupancy.lotOccupancyOccupants) { %> - <%= occupant.lotOccupantType %>: <%= occupant.occupantName %>
+ <%= occupant.lotOccupantType %>: + <%= occupant.occupantName %> + <%= occupant.occupantFamilyName %> +
<% } %> diff --git a/views/print/screen/lotOccupancy.ejs b/views/print/screen/lotOccupancy.ejs index bf6c6c8f..57f45def 100644 --- a/views/print/screen/lotOccupancy.ejs +++ b/views/print/screen/lotOccupancy.ejs @@ -76,7 +76,7 @@ <% for (const lotOccupancyOccupant of lotOccupancy.lotOccupancyOccupants) { %> <%= lotOccupancyOccupant.lotOccupantType %> - <%= lotOccupancyOccupant.occupantName %> + <%= lotOccupancyOccupant.occupantName %> <%= lotOccupancyOccupant.occupantFamilyName %> <%= lotOccupancyOccupant.occupantAddress1 %>
<% if (lotOccupancyOccupant.occupantAddress2 && lotOccupancyOccupant.occupantAddress2 !== "") { %> diff --git a/views/workOrder-view.ejs b/views/workOrder-view.ejs index cd6df345..72692431 100644 --- a/views/workOrder-view.ejs +++ b/views/workOrder-view.ejs @@ -87,172 +87,173 @@
-
-
-
-

- Work Order Type
- <%= workOrder.workOrderType %> -

-

- Description
- <% if (workOrder.workOrderDescription) { %> - <%= workOrder.workOrderDescription %> - <% } else { %> - (No Description) - <% } %> -

-
-
-

- <%= configFunctions.getProperty("aliases.workOrderOpenDate") %>
- <%= workOrder.workOrderOpenDateString %> -

-

- <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>
- <% if (workOrder.workOrderCloseDate) { %> - <%= workOrder.workOrderCloseDateString %> - <% } else { %> - (No <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>) - <% } %> -

-
-
-
+
+
+
+

+ Work Order Type
+ <%= workOrder.workOrderType %> +

+

+ Description
+ <% if (workOrder.workOrderDescription) { %> + <%= workOrder.workOrderDescription %> + <% } else { %> + (No Description) + <% } %> +

+
+
+

+ <%= configFunctions.getProperty("aliases.workOrderOpenDate") %>
+ <%= workOrder.workOrderOpenDateString %> +

+

+ <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>
+ <% if (workOrder.workOrderCloseDate) { %> + <%= workOrder.workOrderCloseDateString %> + <% } else { %> + (No <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>) + <% } %> +

+
+
+
-

Related <%= configFunctions.getProperty("aliases.lots") %>

-
- <% - const tabToSelect = (workOrder.workOrderLotOccupancies.length > 0 || workOrder.workOrderLots.length === 0 ? "lotOccupancies" : "lots"); - %> - -
-
" id="relatedTab--lotOccupancies"> - <% if (workOrder.workOrderLotOccupancies.length === 0) { %> -
-

- There are no - <%= configFunctions.getProperty("aliases.lot").toLowerCase() %> - <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> - records associated with this work order. -

-
- <% } else { %> - <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> - - - - - - - - - - - - - <% for (const lotOccupancy of workOrder.workOrderLotOccupancies) { %> - <% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %> - - - - - - - - - <% } %> - -
<%= configFunctions.getProperty("aliases.occupancy") %> Type<%= configFunctions.getProperty("aliases.lot") %><%= configFunctions.getProperty("aliases.occupancyStartDate") %>End Date<%= configFunctions.getProperty("aliases.occupants") %>
- <% if (isActive) { %> - "> - <% } else { %> - "> - <% } %> - - - <%= lotOccupancy.occupancyType %> - - - <% if (lotOccupancy.lotId) { %> - <%= lotOccupancy.lotName %> - <% } else { %> - (No <%= configFunctions.getProperty("aliases.lot") %>) - <% } %> - <%= lotOccupancy.occupancyStartDateString %> - <% if (lotOccupancy.occupancyEndDate) { %> - <%= lotOccupancy.occupancyEndDateString %> - <% } else { %> - (No End Date) - <% } %> - - <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> - (No <%= configFunctions.getProperty("aliases.occupants") %>) - <% } else { %> - <% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %> - - - <%= occupant.occupantName %> -
- <% } %> - <% } %> -
- <% } %> -
-
" id="relatedTab--lots"> - <% if (workOrder.workOrderLots.length === 0) { %> -
-

- There are no - <%= configFunctions.getProperty("aliases.lots").toLowerCase() %> - records associated with this work order. -

-
- <% } else { %> - - - - - - - - - - - <% for (const lot of workOrder.workOrderLots) { %> - - - - - - - <% } %> - -
<%= configFunctions.getProperty("aliases.lot") %><%= configFunctions.getProperty("aliases.map") %><%= configFunctions.getProperty("aliases.lot") %> TypeStatus
- <%= lot.lotName %> - <%= lot.mapName %><%= lot.lotType %><%= lot.lotStatus %>
- <% } %> -
-
-
+

Related <%= configFunctions.getProperty("aliases.lots") %>

+
+ <% + const tabToSelect = (workOrder.workOrderLotOccupancies.length > 0 || workOrder.workOrderLots.length === 0 ? "lotOccupancies" : "lots"); + %> + +
+
" id="relatedTab--lotOccupancies"> + <% if (workOrder.workOrderLotOccupancies.length === 0) { %> +
+

+ There are no + <%= configFunctions.getProperty("aliases.lot").toLowerCase() %> + <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> + records associated with this work order. +

+
+ <% } else { %> + <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> + + + + + + + + + + + + + <% for (const lotOccupancy of workOrder.workOrderLotOccupancies) { %> + <% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %> + + + + + + + + + <% } %> + +
<%= configFunctions.getProperty("aliases.occupancy") %> Type<%= configFunctions.getProperty("aliases.lot") %><%= configFunctions.getProperty("aliases.occupancyStartDate") %>End Date<%= configFunctions.getProperty("aliases.occupants") %>
+ <% if (isActive) { %> + "> + <% } else { %> + "> + <% } %> + + + <%= lotOccupancy.occupancyType %> + + + <% if (lotOccupancy.lotId) { %> + <%= lotOccupancy.lotName %> + <% } else { %> + (No <%= configFunctions.getProperty("aliases.lot") %>) + <% } %> + <%= lotOccupancy.occupancyStartDateString %> + <% if (lotOccupancy.occupancyEndDate) { %> + <%= lotOccupancy.occupancyEndDateString %> + <% } else { %> + (No End Date) + <% } %> + + <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> + (No <%= configFunctions.getProperty("aliases.occupants") %>) + <% } else { %> + <% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %> + + + <%= occupant.occupantName %> + <%= occupant.occupantFamilyName %> +
+ <% } %> + <% } %> +
+ <% } %> +
+
" id="relatedTab--lots"> + <% if (workOrder.workOrderLots.length === 0) { %> +
+

+ There are no + <%= configFunctions.getProperty("aliases.lots").toLowerCase() %> + records associated with this work order. +

+
+ <% } else { %> + + + + + + + + + + + <% for (const lot of workOrder.workOrderLots) { %> + + + + + + + <% } %> + +
<%= configFunctions.getProperty("aliases.lot") %><%= configFunctions.getProperty("aliases.map") %><%= configFunctions.getProperty("aliases.lot") %> TypeStatus
+ <%= lot.lotName %> + <%= lot.mapName %><%= lot.lotType %><%= lot.lotStatus %>
+ <% } %> +
+
+
<% if (workOrder.workOrderComments.length > 0) { %>