From cd400e0aa82f5f3028b072c10e2d7e3ab1282d46 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Thu, 27 Jun 2024 12:40:37 -0400 Subject: [PATCH] linting --- public-typescript/adminDatabase.ts | 4 +- public-typescript/adminFees.ts | 4 +- public-typescript/adminLotTypes.ts | 4 +- public-typescript/adminOccupancyTypes.ts | 4 +- public-typescript/dashboard.ts | 4 +- public-typescript/lotEdit.js | 164 +++++++-------- public-typescript/lotEdit.ts | 190 +++++++++--------- public-typescript/lotOccupancySearch.js | 143 ++++++------- public-typescript/lotOccupancySearch.ts | 142 ++++++------- public-typescript/lotSearch.js | 88 ++++---- public-typescript/lotSearch.ts | 106 +++++----- public-typescript/main.ts | 4 +- public-typescript/mapEdit.js | 15 +- public-typescript/mapEdit.ts | 25 ++- public-typescript/mapSearch.js | 93 +++++---- public-typescript/mapSearch.ts | 121 ++++++----- .../workOrderMilestoneCalendar.js | 103 +++++----- .../workOrderMilestoneCalendar.ts | 117 +++++------ public-typescript/workOrderOutlook.ts | 4 +- public-typescript/workOrderSearch.js | 166 +++++++-------- public-typescript/workOrderSearch.ts | 164 +++++++-------- public-typescript/workOrderView.js | 8 +- public-typescript/workOrderView.ts | 18 +- public/javascripts/lotEdit.min.js | 2 +- public/javascripts/lotOccupancySearch.min.js | 2 +- public/javascripts/lotSearch.min.js | 2 +- public/javascripts/mapEdit.min.js | 2 +- public/javascripts/mapSearch.min.js | 2 +- .../workOrderMilestoneCalendar.min.js | 2 +- public/javascripts/workOrderSearch.min.js | 2 +- public/javascripts/workOrderView.min.js | 2 +- 31 files changed, 852 insertions(+), 855 deletions(-) diff --git a/public-typescript/adminDatabase.ts b/public-typescript/adminDatabase.ts index df06b3a3..84e28514 100644 --- a/public-typescript/adminDatabase.ts +++ b/public-typescript/adminDatabase.ts @@ -3,14 +3,14 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../types/globalTypes.js' +import type { LOS } from '../types/globalTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS function doBackup(): void { cityssm.postJSON( diff --git a/public-typescript/adminFees.ts b/public-typescript/adminFees.ts index 30a96478..8aafb9af 100644 --- a/public-typescript/adminFees.ts +++ b/public-typescript/adminFees.ts @@ -4,7 +4,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../types/globalTypes.js' +import type { LOS } from '../types/globalTypes.js' import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal @@ -12,7 +12,7 @@ declare const bulmaJS: BulmaJS declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const feeCategoriesContainerElement = document.querySelector( '#container--feeCategories' diff --git a/public-typescript/adminLotTypes.ts b/public-typescript/adminLotTypes.ts index 1f08a12b..1775a610 100644 --- a/public-typescript/adminLotTypes.ts +++ b/public-typescript/adminLotTypes.ts @@ -4,7 +4,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../types/globalTypes.js' +import type { LOS } from '../types/globalTypes.js' import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal @@ -23,7 +23,7 @@ type ResponseJSON = errorMessage: string } ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const containerElement = document.querySelector( '#container--lotTypes' diff --git a/public-typescript/adminOccupancyTypes.ts b/public-typescript/adminOccupancyTypes.ts index 4b186c67..6c2dde4d 100644 --- a/public-typescript/adminOccupancyTypes.ts +++ b/public-typescript/adminOccupancyTypes.ts @@ -4,7 +4,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../types/globalTypes.js' +import type { LOS } from '../types/globalTypes.js' import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal @@ -24,7 +24,7 @@ type ResponseJSON = errorMessage: string } ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const occupancyTypesContainerElement = document.querySelector( '#container--occupancyTypes' diff --git a/public-typescript/dashboard.ts b/public-typescript/dashboard.ts index 256353e8..eaa8f232 100644 --- a/public-typescript/dashboard.ts +++ b/public-typescript/dashboard.ts @@ -1,11 +1,11 @@ // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair /* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes.js' +import type { LOS } from '../types/globalTypes.js' declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const workOrderNumberCircleElements: NodeListOf = document.querySelectorAll('.fa-circle[data-work-order-number]') diff --git a/public-typescript/lotEdit.js b/public-typescript/lotEdit.js index 5607226b..8a5936f5 100644 --- a/public-typescript/lotEdit.js +++ b/public-typescript/lotEdit.js @@ -1,8 +1,9 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { - var _a; + var _a, _b; const los = exports.los; const lotId = document.querySelector('#lot--lotId') .value; @@ -24,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const formElement = document.querySelector('#form--lot'); function updateLot(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lots/' + (isCreate ? 'doCreateLot' : 'doUpdateLot'), formElement, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lots/${isCreate ? 'doCreateLot' : 'doUpdateLot'}`, formElement, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -34,14 +35,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); } else { bulmaJS.alert({ - message: los.escapedAliases.Lot + ' Updated Successfully', + message: `${los.escapedAliases.Lot} Updated Successfully`, contextualColorName: 'success' }); } } else { bulmaJS.alert({ - title: 'Error Updating ' + los.escapedAliases.Lot, + title: `Error Updating ${los.escapedAliases.Lot}`, message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); @@ -58,7 +59,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); .querySelector('#button--deleteLot')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', (clickEvent) => { clickEvent.preventDefault(); function doDelete() { - cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLot', { + cityssm.postJSON(`${los.urlPrefix}/lots/doDeleteLot`, { lotId }, (rawResponseJSON) => { var _a; @@ -77,7 +78,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } bulmaJS.confirm({ - title: 'Delete ' + los.escapedAliases.Lot, + title: `Delete ${los.escapedAliases.Lot}`, message: `Are you sure you want to delete this ${los.escapedAliases.lot}?`, contextualColorName: 'warning', okButton: { @@ -92,19 +93,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); const lotFieldsContainerElement = document.querySelector('#container--lotFields'); lotTypeIdElement.addEventListener('change', () => { if (lotTypeIdElement.value === '') { + // eslint-disable-next-line no-unsanitized/property lotFieldsContainerElement.innerHTML = `

Select the ${los.escapedAliases.lot} type to load the available fields.

`; return; } - cityssm.postJSON(los.urlPrefix + '/lots/doGetLotTypeFields', { + cityssm.postJSON(`${los.urlPrefix}/lots/doGetLotTypeFields`, { lotTypeId: lotTypeIdElement.value }, (rawResponseJSON) => { - var _a; + var _a, _b; const responseJSON = rawResponseJSON; if (responseJSON.lotTypeFields.length === 0) { + // eslint-disable-next-line no-unsanitized/property lotFieldsContainerElement.innerHTML = `
-

There are no additional fields for this ${los.escapedAliases.lot} type.

+

+ There are no additional fields for this ${los.escapedAliases.lot} type. +

`; return; } @@ -112,10 +117,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); let lotTypeFieldIds = ''; for (const lotTypeField of responseJSON.lotTypeFields) { lotTypeFieldIds += ',' + lotTypeField.lotTypeFieldId.toString(); - const fieldName = 'lotFieldValue_' + lotTypeField.lotTypeFieldId.toString(); - const fieldId = 'lot--' + fieldName; + const fieldName = `lotFieldValue_${lotTypeField.lotTypeFieldId.toString()}`; + const fieldId = `lot--${fieldName}`; const fieldElement = document.createElement('div'); fieldElement.className = 'field'; + // eslint-disable-next-line no-unsanitized/property fieldElement.innerHTML = `
`; fieldElement.querySelector('label').textContent = lotTypeField.lotTypeField; @@ -131,12 +137,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); if (((_a = lotTypeField.pattern) !== null && _a !== void 0 ? _a : '') !== '') { inputElement.pattern = lotTypeField.pattern; } - fieldElement.querySelector('.control').append(inputElement); + (_b = fieldElement.querySelector('.control')) === null || _b === void 0 ? void 0 : _b.append(inputElement); } else { + // eslint-disable-next-line no-unsanitized/property + ; fieldElement.querySelector('.control').innerHTML = `
- -
`; + + `; const selectElement = fieldElement.querySelector('select'); selectElement.required = lotTypeField.isRequired; const optionValues = lotTypeField.lotTypeFieldValues.split('\n'); @@ -150,7 +158,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotFieldsContainerElement.append(fieldElement); } lotFieldsContainerElement.insertAdjacentHTML('beforeend', ``); + value="${cityssm.escapeHTML(lotTypeFieldIds.slice(1))}" />`); }); }); } @@ -161,17 +169,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); bulmaJS.confirm({ title: 'Confirm Change', message: `Are you sure you want to change the ${los.escapedAliases.lot} type?\n - This change affects the additional fields associated with this record.`, + This change affects the additional fields associated with this record.`, contextualColorName: 'warning', okButton: { text: 'Yes, Keep the Change', - callbackFunction: () => { + callbackFunction() { refreshAfterSave = true; } }, cancelButton: { text: 'Revert the Change', - callbackFunction: () => { + callbackFunction() { lotTypeIdElement.value = originalLotTypeId; } } @@ -183,8 +191,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); let lotComments = exports.lotComments; delete exports.lotComments; function openEditLotComment(clickEvent) { - const lotCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .lotCommentId, 10); + var _a, _b; + const lotCommentId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.lotCommentId) !== null && _b !== void 0 ? _b : '', 10); const lotComment = lotComments.find((currentLotComment) => { return currentLotComment.lotCommentId === lotCommentId; }); @@ -192,7 +200,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); let editCloseModalFunction; function editComment(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lots/doUpdateLotComment', editFormElement, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lots/doUpdateLotComment`, editFormElement, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -210,21 +218,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } cityssm.openHtmlModal('lot-editComment', { - onshow: (modalElement) => { + onshow(modalElement) { + var _a, _b, _c, _d; los.populateAliases(modalElement); modalElement.querySelector('#lotCommentEdit--lotId').value = lotId; modalElement.querySelector('#lotCommentEdit--lotCommentId').value = lotCommentId.toString(); - modalElement.querySelector('#lotCommentEdit--lotComment').value = lotComment.lotComment; + modalElement.querySelector('#lotCommentEdit--lotComment').value = (_a = lotComment.lotComment) !== null && _a !== void 0 ? _a : ''; const lotCommentDateStringElement = modalElement.querySelector('#lotCommentEdit--lotCommentDateString'); - lotCommentDateStringElement.value = lotComment.lotCommentDateString; + lotCommentDateStringElement.value = + (_b = lotComment.lotCommentDateString) !== null && _b !== void 0 ? _b : ''; const currentDateString = cityssm.dateToString(new Date()); lotCommentDateStringElement.max = lotComment.lotCommentDateString <= currentDateString ? currentDateString - : lotComment.lotCommentDateString; - modalElement.querySelector('#lotCommentEdit--lotCommentTimeString').value = lotComment.lotCommentTimeString; + : (_c = lotComment.lotCommentDateString) !== null && _c !== void 0 ? _c : ''; + modalElement.querySelector('#lotCommentEdit--lotCommentTimeString').value = (_d = lotComment.lotCommentTimeString) !== null && _d !== void 0 ? _d : ''; }, - onshown: (modalElement, closeModalFunction) => { + onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped(); los.initializeDatePickers(modalElement); modalElement.querySelector('#lotCommentEdit--lotComment').focus(); @@ -232,16 +242,16 @@ Object.defineProperty(exports, "__esModule", { value: true }); editFormElement.addEventListener('submit', editComment); editCloseModalFunction = closeModalFunction; }, - onremoved: () => { + onremoved() { bulmaJS.toggleHtmlClipped(); } }); } function deleteLotComment(clickEvent) { - const lotCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .lotCommentId, 10); + var _a, _b; + const lotCommentId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.lotCommentId) !== null && _b !== void 0 ? _b : '', 10); function doDelete() { - cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLotComment', { + cityssm.postJSON(`${los.urlPrefix}/lots/doDeleteLotComment`, { lotId, lotCommentId }, (rawResponseJSON) => { @@ -271,57 +281,52 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function renderLotComments() { - var _a, _b; + var _a, _b, _c, _d, _e, _f; const containerElement = document.querySelector('#container--lotComments'); if (lotComments.length === 0) { containerElement.innerHTML = `
-

There are no comments to display.

-
`; +

There are no comments to display.

+ `; return; } const tableElement = document.createElement('table'); tableElement.className = 'table is-fullwidth is-striped is-hoverable'; tableElement.innerHTML = ` - Commentor - Comment Date - Comment - Options - - `; + Commentor + Comment Date + Comment + Options + + `; for (const lotComment of lotComments) { const tableRowElement = document.createElement('tr'); - tableRowElement.dataset.lotCommentId = lotComment.lotCommentId.toString(); - tableRowElement.innerHTML = - '' + - cityssm.escapeHTML((_a = lotComment.recordCreate_userName) !== null && _a !== void 0 ? _a : '') + - '' + - '' + - lotComment.lotCommentDateString + - (lotComment.lotCommentTime === 0 - ? '' - : ' ' + lotComment.lotCommentTimePeriodString) + - '' + - '' + - cityssm.escapeHTML((_b = lotComment.lotComment) !== null && _b !== void 0 ? _b : '') + - '' + - ('' + - '
' + - ('') + - ('') + - '
' + - ''); - tableRowElement - .querySelector('.button--edit') - .addEventListener('click', openEditLotComment); - tableRowElement - .querySelector('.button--delete') - .addEventListener('click', deleteLotComment); - tableElement.querySelector('tbody').append(tableRowElement); + tableRowElement.dataset.lotCommentId = (_a = lotComment.lotCommentId) === null || _a === void 0 ? void 0 : _a.toString(); + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ` + ${cityssm.escapeHTML((_b = lotComment.recordCreate_userName) !== null && _b !== void 0 ? _b : '')} + + ${lotComment.lotCommentDateString} + ${lotComment.lotCommentTime === 0 + ? '' + : ' ' + lotComment.lotCommentTimePeriodString} + + ${cityssm.escapeHTML((_c = lotComment.lotComment) !== null && _c !== void 0 ? _c : '')} + +
+ + +
+ `; + (_d = tableRowElement + .querySelector('.button--edit')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', openEditLotComment); + (_e = tableRowElement + .querySelector('.button--delete')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotComment); + (_f = tableElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(tableRowElement); } containerElement.innerHTML = ''; containerElement.append(tableElement); @@ -330,7 +335,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); let addCommentCloseModalFunction; function doAddComment(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lots/doAddLotComment', formEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lots/doAddLotComment`, formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON; if (responseJSON.success) { lotComments = responseJSON.lotComments; @@ -341,11 +346,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); } cityssm.openHtmlModal('lot-addComment', { onshow(modalElement) { + var _a; los.populateAliases(modalElement); modalElement.querySelector('#lotCommentAdd--lotId').value = lotId; - modalElement - .querySelector('form') - .addEventListener('submit', doAddComment); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAddComment); }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped(); @@ -359,9 +364,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } if (!isCreate) { - document - .querySelector('#lotComments--add') - .addEventListener('click', openAddCommentModal); + (_b = document + .querySelector('#lotComments--add')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', openAddCommentModal); renderLotComments(); } })(); diff --git a/public-typescript/lotEdit.ts b/public-typescript/lotEdit.ts index ebec7a4e..36e2266b 100644 --- a/public-typescript/lotEdit.ts +++ b/public-typescript/lotEdit.ts @@ -1,16 +1,18 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes' -import type * as recordTypes from '../types/recordTypes' +import type { BulmaJS } from '@cityssm/bulma-js/types.js' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' - -import type { BulmaJS } from '@cityssm/bulma-js/types' +import type { LOS } from '../types/globalTypes.js' +import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS + +declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const lotId = (document.querySelector('#lot--lotId') as HTMLInputElement) .value @@ -40,7 +42,7 @@ declare const bulmaJS: BulmaJS formEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/lots/' + (isCreate ? 'doCreateLot' : 'doUpdateLot'), + `${los.urlPrefix}/lots/${isCreate ? 'doCreateLot' : 'doUpdateLot'}`, formElement, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { @@ -56,13 +58,13 @@ declare const bulmaJS: BulmaJS window.location.href = los.getLotURL(responseJSON.lotId, true, true) } else { bulmaJS.alert({ - message: los.escapedAliases.Lot + ' Updated Successfully', + message: `${los.escapedAliases.Lot} Updated Successfully`, contextualColorName: 'success' }) } } else { bulmaJS.alert({ - title: 'Error Updating ' + los.escapedAliases.Lot, + title: `Error Updating ${los.escapedAliases.Lot}`, message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) @@ -88,7 +90,7 @@ declare const bulmaJS: BulmaJS function doDelete(): void { cityssm.postJSON( - los.urlPrefix + '/lots/doDeleteLot', + `${los.urlPrefix}/lots/doDeleteLot`, { lotId }, @@ -113,7 +115,7 @@ declare const bulmaJS: BulmaJS } bulmaJS.confirm({ - title: 'Delete ' + los.escapedAliases.Lot, + title: `Delete ${los.escapedAliases.Lot}`, message: `Are you sure you want to delete this ${los.escapedAliases.lot}?`, contextualColorName: 'warning', okButton: { @@ -136,6 +138,7 @@ declare const bulmaJS: BulmaJS lotTypeIdElement.addEventListener('change', () => { if (lotTypeIdElement.value === '') { + // eslint-disable-next-line no-unsanitized/property lotFieldsContainerElement.innerHTML = `

Select the ${los.escapedAliases.lot} type to load the available fields.

` @@ -144,7 +147,7 @@ declare const bulmaJS: BulmaJS } cityssm.postJSON( - los.urlPrefix + '/lots/doGetLotTypeFields', + `${los.urlPrefix}/lots/doGetLotTypeFields`, { lotTypeId: lotTypeIdElement.value }, @@ -154,8 +157,11 @@ declare const bulmaJS: BulmaJS } if (responseJSON.lotTypeFields.length === 0) { + // eslint-disable-next-line no-unsanitized/property lotFieldsContainerElement.innerHTML = `
-

There are no additional fields for this ${los.escapedAliases.lot} type.

+

+ There are no additional fields for this ${los.escapedAliases.lot} type. +

` return @@ -168,13 +174,14 @@ declare const bulmaJS: BulmaJS for (const lotTypeField of responseJSON.lotTypeFields) { lotTypeFieldIds += ',' + lotTypeField.lotTypeFieldId.toString() - const fieldName = - 'lotFieldValue_' + lotTypeField.lotTypeFieldId.toString() + const fieldName = `lotFieldValue_${lotTypeField.lotTypeFieldId.toString()}` - const fieldId = 'lot--' + fieldName + const fieldId = `lot--${fieldName}` const fieldElement = document.createElement('div') fieldElement.className = 'field' + + // eslint-disable-next-line no-unsanitized/property fieldElement.innerHTML = `
` ;( @@ -200,13 +207,14 @@ declare const bulmaJS: BulmaJS inputElement.pattern = lotTypeField.pattern! } - fieldElement.querySelector('.control')!.append(inputElement) + fieldElement.querySelector('.control')?.append(inputElement) } else { - fieldElement.querySelector( - '.control' - )!.innerHTML = `
- -
` + // eslint-disable-next-line no-unsanitized/property + ;( + fieldElement.querySelector('.control') as HTMLElement + ).innerHTML = `
+ +
` const selectElement = fieldElement.querySelector( 'select' @@ -232,7 +240,7 @@ declare const bulmaJS: BulmaJS lotFieldsContainerElement.insertAdjacentHTML( 'beforeend', `` + value="${cityssm.escapeHTML(lotTypeFieldIds.slice(1))}" />` ) } ) @@ -245,17 +253,17 @@ declare const bulmaJS: BulmaJS bulmaJS.confirm({ title: 'Confirm Change', message: `Are you sure you want to change the ${los.escapedAliases.lot} type?\n - This change affects the additional fields associated with this record.`, + This change affects the additional fields associated with this record.`, contextualColorName: 'warning', okButton: { text: 'Yes, Keep the Change', - callbackFunction: () => { + callbackFunction() { refreshAfterSave = true } }, cancelButton: { text: 'Revert the Change', - callbackFunction: () => { + callbackFunction() { lotTypeIdElement.value = originalLotTypeId } } @@ -266,19 +274,19 @@ declare const bulmaJS: BulmaJS // Comments - let lotComments: recordTypes.LotComment[] = exports.lotComments + let lotComments = exports.lotComments as recordTypes.LotComment[] delete exports.lotComments function openEditLotComment(clickEvent: Event): void { const lotCommentId = Number.parseInt( - (clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset - .lotCommentId!, + (clickEvent.currentTarget as HTMLElement).closest('tr')?.dataset + .lotCommentId ?? '', 10 ) const lotComment = lotComments.find((currentLotComment) => { return currentLotComment.lotCommentId === lotCommentId - })! + }) as recordTypes.LotComment let editFormElement: HTMLFormElement let editCloseModalFunction: () => void @@ -287,17 +295,17 @@ declare const bulmaJS: BulmaJS submitEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/lots/doUpdateLotComment', + `${los.urlPrefix}/lots/doUpdateLotComment`, editFormElement, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotComments?: recordTypes.LotComment[] + lotComments: recordTypes.LotComment[] } if (responseJSON.success) { - lotComments = responseJSON.lotComments! + lotComments = responseJSON.lotComments editCloseModalFunction() renderLotComments() } else { @@ -312,7 +320,7 @@ declare const bulmaJS: BulmaJS } cityssm.openHtmlModal('lot-editComment', { - onshow: (modalElement) => { + onshow(modalElement) { los.populateAliases(modalElement) ;( modalElement.querySelector( @@ -328,27 +336,28 @@ declare const bulmaJS: BulmaJS modalElement.querySelector( '#lotCommentEdit--lotComment' ) as HTMLInputElement - ).value = lotComment.lotComment! + ).value = lotComment.lotComment ?? '' const lotCommentDateStringElement = modalElement.querySelector( '#lotCommentEdit--lotCommentDateString' ) as HTMLInputElement - lotCommentDateStringElement.value = lotComment.lotCommentDateString! + lotCommentDateStringElement.value = + lotComment.lotCommentDateString ?? '' const currentDateString = cityssm.dateToString(new Date()) lotCommentDateStringElement.max = lotComment.lotCommentDateString! <= currentDateString ? currentDateString - : lotComment.lotCommentDateString! + : lotComment.lotCommentDateString ?? '' ;( modalElement.querySelector( '#lotCommentEdit--lotCommentTimeString' ) as HTMLInputElement - ).value = lotComment.lotCommentTimeString! + ).value = lotComment.lotCommentTimeString ?? '' }, - onshown: (modalElement, closeModalFunction) => { + onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped() los.initializeDatePickers(modalElement) @@ -359,12 +368,12 @@ declare const bulmaJS: BulmaJS ) as HTMLTextAreaElement ).focus() - editFormElement = modalElement.querySelector('form')! + editFormElement = modalElement.querySelector('form') as HTMLFormElement editFormElement.addEventListener('submit', editComment) editCloseModalFunction = closeModalFunction }, - onremoved: () => { + onremoved() { bulmaJS.toggleHtmlClipped() } }) @@ -372,14 +381,14 @@ declare const bulmaJS: BulmaJS function deleteLotComment(clickEvent: Event): void { const lotCommentId = Number.parseInt( - (clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset - .lotCommentId!, + (clickEvent.currentTarget as HTMLElement).closest('tr')?.dataset + .lotCommentId ?? '', 10 ) function doDelete(): void { cityssm.postJSON( - los.urlPrefix + '/lots/doDeleteLotComment', + `${los.urlPrefix}/lots/doDeleteLotComment`, { lotId, lotCommentId @@ -423,59 +432,58 @@ declare const bulmaJS: BulmaJS if (lotComments.length === 0) { containerElement.innerHTML = `
-

There are no comments to display.

-
` +

There are no comments to display.

+ ` return } const tableElement = document.createElement('table') tableElement.className = 'table is-fullwidth is-striped is-hoverable' tableElement.innerHTML = ` - Commentor - Comment Date - Comment - Options - - ` + Commentor + Comment Date + Comment + Options + + ` for (const lotComment of lotComments) { const tableRowElement = document.createElement('tr') - tableRowElement.dataset.lotCommentId = lotComment.lotCommentId!.toString() - - tableRowElement.innerHTML = - '' + - cityssm.escapeHTML(lotComment.recordCreate_userName ?? '') + - '' + - '' + - lotComment.lotCommentDateString! + - (lotComment.lotCommentTime === 0 - ? '' - : ' ' + lotComment.lotCommentTimePeriodString!) + - '' + - '' + - cityssm.escapeHTML(lotComment.lotComment ?? '') + - '' + - ('' + - '
' + - ('') + - ('') + - '
' + - '') + tableRowElement.dataset.lotCommentId = lotComment.lotCommentId?.toString() + + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ` + ${cityssm.escapeHTML(lotComment.recordCreate_userName ?? '')} + + ${lotComment.lotCommentDateString} + ${ + lotComment.lotCommentTime === 0 + ? '' + : ' ' + lotComment.lotCommentTimePeriodString + } + + ${cityssm.escapeHTML(lotComment.lotComment ?? '')} + +
+ + +
+ ` tableRowElement - .querySelector('.button--edit')! - .addEventListener('click', openEditLotComment) + .querySelector('.button--edit') + ?.addEventListener('click', openEditLotComment) tableRowElement - .querySelector('.button--delete')! - .addEventListener('click', deleteLotComment) + .querySelector('.button--delete') + ?.addEventListener('click', deleteLotComment) - tableElement.querySelector('tbody')!.append(tableRowElement) + tableElement.querySelector('tbody')?.append(tableRowElement) } containerElement.innerHTML = '' @@ -489,16 +497,16 @@ declare const bulmaJS: BulmaJS formEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/lots/doAddLotComment', + `${los.urlPrefix}/lots/doAddLotComment`, formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean - lotComments?: recordTypes.LotComment[] + lotComments: recordTypes.LotComment[] } if (responseJSON.success) { - lotComments = responseJSON.lotComments! + lotComments = responseJSON.lotComments renderLotComments() addCommentCloseModalFunction() } @@ -515,8 +523,8 @@ declare const bulmaJS: BulmaJS ) as HTMLInputElement ).value = lotId modalElement - .querySelector('form')! - .addEventListener('submit', doAddComment) + .querySelector('form') + ?.addEventListener('submit', doAddComment) }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped() @@ -538,8 +546,8 @@ declare const bulmaJS: BulmaJS if (!isCreate) { document - .querySelector('#lotComments--add')! - .addEventListener('click', openAddCommentModal) + .querySelector('#lotComments--add') + ?.addEventListener('click', openAddCommentModal) renderLotComments() } })() diff --git a/public-typescript/lotOccupancySearch.js b/public-typescript/lotOccupancySearch.js index 9166d4c2..4a483b93 100644 --- a/public-typescript/lotOccupancySearch.js +++ b/public-typescript/lotOccupancySearch.js @@ -1,5 +1,6 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { const los = exports.los; @@ -8,9 +9,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10); const offsetElement = document.querySelector('#searchFilter--offset'); function renderLotOccupancies(rawResponseJSON) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; const responseJSON = rawResponseJSON; if (responseJSON.lotOccupancies.length === 0) { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `

There are no ${los.escapedAliases.occupancy} records that meet the search criteria. @@ -40,30 +42,26 @@ Object.defineProperty(exports, "__esModule", { value: true }); `; } let occupantsHTML = ''; - for (const occupant of lotOccupancy.lotOccupancyOccupants) { - occupantsHTML += - '

  • ' + - (' ') + - cityssm.escapeHTML((_c = occupant.occupantName) !== null && _c !== void 0 ? _c : '') + - ' ' + - cityssm.escapeHTML((_d = occupant.occupantFamilyName) !== null && _d !== void 0 ? _d : '') + - '
  • '; + for (const occupant of (_a = lotOccupancy.lotOccupancyOccupants) !== null && _a !== void 0 ? _a : []) { + occupantsHTML += `
  • + + + + ${cityssm.escapeHTML((_e = occupant.occupantName) !== null && _e !== void 0 ? _e : '')} + ${cityssm.escapeHTML((_f = occupant.occupantFamilyName) !== null && _f !== void 0 ? _f : '')} +
  • `; } - const feeTotal = ((_f = (_e = lotOccupancy.lotOccupancyFees) === null || _e === void 0 ? void 0 : _e.reduce((soFar, currentFee) => { + const feeTotal = ((_h = (_g = lotOccupancy.lotOccupancyFees) === null || _g === void 0 ? void 0 : _g.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 && _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 && _h !== void 0 ? _h : 0).toFixed(2); + const transactionTotal = ((_k = (_j = lotOccupancy.lotOccupancyTransactions) === null || _j === void 0 ? void 0 : _j.reduce((soFar, currentTransaction) => { + return soFar + currentTransaction.transactionAmount; + }, 0)) !== null && _k !== void 0 ? _k : 0).toFixed(2); let feeIconHTML = ''; if (feeTotal !== '0.00' || transactionTotal !== '0.00') { feeIconHTML = ``; } - resultsTbodyElement.insertAdjacentHTML('beforeend', '' + - ('' + occupancyTimeHTML + '') + - ('' + - '' + - cityssm.escapeHTML(lotOccupancy.occupancyType) + - '
    ' + - `#${lotOccupancy.lotOccupancyId}` + - '') + - ('' + - (((_j = lotOccupancy.lotId) !== null && _j !== void 0 ? _j : -1) === -1 - ? '(No ' + - los.escapedAliases.Lot + - ')' - : '' + - cityssm.escapeHTML(lotOccupancy.lotName) + - '') + - '
    ' + - ('' + - cityssm.escapeHTML((_l = lotOccupancy.mapName) !== null && _l !== void 0 ? _l : '') + - '') + - '') + - ('' + lotOccupancy.occupancyStartDateString + '') + - ('' + - (lotOccupancy.occupancyEndDate - ? lotOccupancy.occupancyEndDateString - : '(No End Date)') + - '') + - ('' + - (occupantsHTML === '' - ? '' - : '
      ' + occupantsHTML + '
    ') + - '') + - ('' + feeIconHTML + '') + - '' + - (lotOccupancy.printEJS - ? '' + - '' + - '' - : '') + - '' + - ''); + // eslint-disable-next-line no-unsanitized/method + resultsTbodyElement.insertAdjacentHTML('beforeend', ` + + ${occupancyTimeHTML} + + + ${cityssm.escapeHTML((_l = lotOccupancy.occupancyType) !== null && _l !== void 0 ? _l : '')} +
    + #${lotOccupancy.lotOccupancyId} + + ${((_m = lotOccupancy.lotId) !== null && _m !== void 0 ? _m : -1) === -1 + ? `(No ${los.escapedAliases.Lot})` + : `${cityssm.escapeHTML((_p = lotOccupancy.lotName) !== null && _p !== void 0 ? _p : '')}`}
    + ${cityssm.escapeHTML((_q = lotOccupancy.mapName) !== null && _q !== void 0 ? _q : '')} + + ${lotOccupancy.occupancyStartDateString} + + ${lotOccupancy.occupancyEndDate + ? lotOccupancy.occupancyEndDateString + : '(No End Date)'} + + ${occupantsHTML === '' + ? '' + : `
      ${occupantsHTML}
    `} + + ${feeIconHTML} + + ${lotOccupancy.printEJS + ? ` + + ` + : ''}`); } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = ` @@ -140,18 +120,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
    Print
    `; - searchResultsContainerElement - .querySelector('table') - .append(resultsTbodyElement); + (_r = searchResultsContainerElement + .querySelector('table')) === null || _r === void 0 ? void 0 : _r.append(resultsTbodyElement); + // eslint-disable-next-line no-unsanitized/method searchResultsContainerElement.insertAdjacentHTML('beforeend', los.getSearchResultsPagerHTML(limit, responseJSON.offset, responseJSON.count)); - (_m = searchResultsContainerElement - .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); + (_s = searchResultsContainerElement + .querySelector("button[data-page='previous']")) === null || _s === void 0 ? void 0 : _s.addEventListener('click', previousAndGetLotOccupancies); + (_t = searchResultsContainerElement + .querySelector("button[data-page='next']")) === null || _t === void 0 ? void 0 : _t.addEventListener('click', nextAndGetLotOccupancies); } function getLotOccupancies() { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Occupancies}...`); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFilterFormElement, renderLotOccupancies); + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doSearchLotOccupancies`, searchFilterFormElement, renderLotOccupancies); } function resetOffsetAndGetLotOccupancies() { offsetElement.value = '0'; diff --git a/public-typescript/lotOccupancySearch.ts b/public-typescript/lotOccupancySearch.ts index ee100c08..99fd35c7 100644 --- a/public-typescript/lotOccupancySearch.ts +++ b/public-typescript/lotOccupancySearch.ts @@ -1,13 +1,16 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes' -import type * as recordTypes from '../types/recordTypes' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' +import type { LOS } from '../types/globalTypes.js' +import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal + +declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const searchFilterFormElement = document.querySelector( '#form--searchFilters' @@ -34,6 +37,7 @@ declare const cityssm: cityssmGlobal } if (responseJSON.lotOccupancies.length === 0) { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `

    There are no ${los.escapedAliases.occupancy} records that meet the search criteria. @@ -70,22 +74,18 @@ declare const cityssm: cityssmGlobal let occupantsHTML = '' - for (const occupant of lotOccupancy.lotOccupancyOccupants!) { - occupantsHTML += - '

  • ' + - (' + + ') + - cityssm.escapeHTML(occupant.occupantName ?? '') + - ' ' + - cityssm.escapeHTML(occupant.occupantFamilyName ?? '') + - '
  • ' + : occupant.fontAwesomeIconClass ?? '' + )}" aria-hidden="true"> + + ${cityssm.escapeHTML(occupant.occupantName ?? '')} + ${cityssm.escapeHTML(occupant.occupantFamilyName ?? '')} + ` } const feeTotal = ( @@ -121,64 +121,54 @@ declare const cityssm: cityssmGlobal ` } + // eslint-disable-next-line no-unsanitized/method resultsTbodyElement.insertAdjacentHTML( 'beforeend', - '
    ' + - ('') + - ('') + - ('') + - ('') + - ('') + - ('') + - ('') + - '' + - '' + ` + ` ) } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `
    ' + occupancyTimeHTML + '' + - '' + - cityssm.escapeHTML(lotOccupancy.occupancyType as string) + - '
    ' + - `#${lotOccupancy.lotOccupancyId!}` + - '
    ' + - ((lotOccupancy.lotId ?? -1) === -1 - ? '(No ' + - los.escapedAliases.Lot + - ')' - : '' + - cityssm.escapeHTML(lotOccupancy.lotName!) + - '') + - '
    ' + - ('' + - cityssm.escapeHTML(lotOccupancy.mapName ?? '') + - '') + - '
    ' + lotOccupancy.occupancyStartDateString! + '' + - (lotOccupancy.occupancyEndDate - ? lotOccupancy.occupancyEndDateString! - : '(No End Date)') + - '' + - (occupantsHTML === '' - ? '' - : '
      ' + occupantsHTML + '
    ') + - '
    ' + feeIconHTML + '' + - (lotOccupancy.printEJS - ? '' + - '' + - '' - : '') + - '
    + ${occupancyTimeHTML} + + + ${cityssm.escapeHTML(lotOccupancy.occupancyType ?? '')} +
    + #${lotOccupancy.lotOccupancyId} +
    + ${ + (lotOccupancy.lotId ?? -1) === -1 + ? `(No ${los.escapedAliases.Lot})` + : `${cityssm.escapeHTML(lotOccupancy.lotName ?? '')}` + }
    + ${cityssm.escapeHTML(lotOccupancy.mapName ?? '')} +
    + ${lotOccupancy.occupancyStartDateString} + + ${ + lotOccupancy.occupancyEndDate + ? lotOccupancy.occupancyEndDateString + : '(No End Date)' + } + + ${ + occupantsHTML === '' + ? '' + : `
      ${occupantsHTML}
    ` + } +
    + ${feeIconHTML} + + ${ + lotOccupancy.printEJS + ? ` + + ` + : '' + }
    @@ -193,9 +183,10 @@ declare const cityssm: cityssmGlobal
    ` searchResultsContainerElement - .querySelector('table')! - .append(resultsTbodyElement) + .querySelector('table') + ?.append(resultsTbodyElement) + // eslint-disable-next-line no-unsanitized/method searchResultsContainerElement.insertAdjacentHTML( 'beforeend', los.getSearchResultsPagerHTML( @@ -215,12 +206,13 @@ declare const cityssm: cityssmGlobal } function getLotOccupancies(): void { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML( `Loading ${los.escapedAliases.Occupancies}...` ) cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', + `${los.urlPrefix}/lotOccupancies/doSearchLotOccupancies`, searchFilterFormElement, renderLotOccupancies ) diff --git a/public-typescript/lotSearch.js b/public-typescript/lotSearch.js index 3c7ef322..56ed5cb2 100644 --- a/public-typescript/lotSearch.js +++ b/public-typescript/lotSearch.js @@ -1,5 +1,6 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { const los = exports.los; @@ -7,9 +8,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); const searchResultsContainerElement = document.querySelector('#container--searchResults'); const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10); const offsetElement = document.querySelector('#searchFilter--offset'); - function renderLots(responseJSON) { - var _a, _b, _c, _d, _e; + function renderLots(rawResponseJSON) { + var _a, _b, _c, _d, _e, _f, _g; + const responseJSON = rawResponseJSON; if (responseJSON.lots.length === 0) { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `

    There are no ${los.escapedAliases.lots} that meet the search criteria.

    `; @@ -17,53 +20,50 @@ Object.defineProperty(exports, "__esModule", { value: true }); } const resultsTbodyElement = document.createElement('tbody'); for (const lot of responseJSON.lots) { - resultsTbodyElement.insertAdjacentHTML('beforeend', '' + - ('') + - ('') + - ('') + - ('') + - ''); + // eslint-disable-next-line no-unsanitized/method + resultsTbodyElement.insertAdjacentHTML('beforeend', ` + + `); } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `
    ' + - '' + - cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + - '' + - '' + - '' + - (lot.mapName - ? cityssm.escapeHTML(lot.mapName) - : '(No Name)') + - '' + - '' + cityssm.escapeHTML((_b = lot.lotType) !== null && _b !== void 0 ? _b : '') + '' + - (lot.lotStatusId - ? cityssm.escapeHTML(lot.lotStatus) - : '(No Status)') + - '
    ' + - (((_c = lot.lotOccupancyCount) !== null && _c !== void 0 ? _c : 0) > 0 - ? 'Currently Occupied' - : '') + - '
    + + ${cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '')} + + + + ${lot.mapName + ? cityssm.escapeHTML(lot.mapName) + : '(No Name)'} + + + ${cityssm.escapeHTML((_b = lot.lotType) !== null && _b !== void 0 ? _b : '')} + + ${lot.lotStatusId + ? cityssm.escapeHTML((_c = lot.lotStatus) !== null && _c !== void 0 ? _c : '') + : '(No Status)'}
    + ${((_d = lot.lotOccupancyCount) !== null && _d !== void 0 ? _d : 0) > 0 + ? 'Currently Occupied' + : ''} +
    - - - - - - -
    ${los.escapedAliases.Lot}${los.escapedAliases.Map}${los.escapedAliases.Lot} TypeStatus
    `; + + + + + + +
    ${los.escapedAliases.Lot}${los.escapedAliases.Map}${los.escapedAliases.Lot} TypeStatus
    `; + // eslint-disable-next-line no-unsanitized/method searchResultsContainerElement.insertAdjacentHTML('beforeend', los.getSearchResultsPagerHTML(limit, responseJSON.offset, responseJSON.count)); - searchResultsContainerElement - .querySelector('table') - .append(resultsTbodyElement); - (_d = searchResultsContainerElement - .querySelector("button[data-page='previous']")) === null || _d === void 0 ? void 0 : _d.addEventListener('click', previousAndGetLots); (_e = searchResultsContainerElement - .querySelector("button[data-page='next']")) === null || _e === void 0 ? void 0 : _e.addEventListener('click', nextAndGetLots); + .querySelector('table')) === null || _e === void 0 ? void 0 : _e.append(resultsTbodyElement); + (_f = searchResultsContainerElement + .querySelector("button[data-page='previous']")) === null || _f === void 0 ? void 0 : _f.addEventListener('click', previousAndGetLots); + (_g = searchResultsContainerElement + .querySelector("button[data-page='next']")) === null || _g === void 0 ? void 0 : _g.addEventListener('click', nextAndGetLots); } function getLots() { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Lots}...`); cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFilterFormElement, renderLots); } diff --git a/public-typescript/lotSearch.ts b/public-typescript/lotSearch.ts index 2363e5b0..05305a73 100644 --- a/public-typescript/lotSearch.ts +++ b/public-typescript/lotSearch.ts @@ -1,13 +1,16 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes' -import type * as recordTypes from '../types/recordTypes' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' +import type { LOS } from '../types/globalTypes.js' +import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal + +declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const searchFilterFormElement = document.querySelector( '#form--searchFilters' @@ -25,12 +28,15 @@ declare const cityssm: cityssmGlobal '#searchFilter--offset' ) as HTMLInputElement - function renderLots(responseJSON: { - count: number - offset: number - lots: recordTypes.Lot[] - }): void { + function renderLots(rawResponseJSON): void { + const responseJSON = rawResponseJSON as { + count: number + offset: number + lots: recordTypes.Lot[] + } + if (responseJSON.lots.length === 0) { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `

    There are no ${los.escapedAliases.lots} that meet the search criteria.

    ` @@ -41,48 +47,51 @@ declare const cityssm: cityssmGlobal const resultsTbodyElement = document.createElement('tbody') for (const lot of responseJSON.lots) { + // eslint-disable-next-line no-unsanitized/method resultsTbodyElement.insertAdjacentHTML( 'beforeend', - '
    ' + - ('') + - ('') + - ('') + - ('') + - '' + ` + + ` ) } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `
    ' + - '' + - cityssm.escapeHTML(lot.lotName ?? '') + - '' + - '' + - '' + - (lot.mapName - ? cityssm.escapeHTML(lot.mapName) - : '(No Name)') + - '' + - '' + cityssm.escapeHTML(lot.lotType ?? '') + '' + - (lot.lotStatusId - ? cityssm.escapeHTML(lot.lotStatus!) - : '(No Status)') + - '
    ' + - ((lot.lotOccupancyCount ?? 0) > 0 - ? 'Currently Occupied' - : '') + - '
    + + ${cityssm.escapeHTML(lot.lotName ?? '')} + + + + ${ + lot.mapName + ? cityssm.escapeHTML(lot.mapName) + : '(No Name)' + } + + + ${cityssm.escapeHTML(lot.lotType ?? '')} + + ${ + lot.lotStatusId + ? cityssm.escapeHTML(lot.lotStatus ?? '') + : '(No Status)' + }
    + ${ + (lot.lotOccupancyCount ?? 0) > 0 + ? 'Currently Occupied' + : '' + } +
    - - - - - - -
    ${los.escapedAliases.Lot}${los.escapedAliases.Map}${los.escapedAliases.Lot} TypeStatus
    ` - + + + + + + +
    ${los.escapedAliases.Lot}${los.escapedAliases.Map}${los.escapedAliases.Lot} TypeStatus
    ` + + // eslint-disable-next-line no-unsanitized/method searchResultsContainerElement.insertAdjacentHTML( 'beforeend', los.getSearchResultsPagerHTML( @@ -93,8 +102,8 @@ declare const cityssm: cityssmGlobal ) searchResultsContainerElement - .querySelector('table')! - .append(resultsTbodyElement) + .querySelector('table') + ?.append(resultsTbodyElement) searchResultsContainerElement .querySelector("button[data-page='previous']") @@ -106,6 +115,7 @@ declare const cityssm: cityssmGlobal } function getLots(): void { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML( `Loading ${los.escapedAliases.Lots}...` ) diff --git a/public-typescript/main.ts b/public-typescript/main.ts index 0705b356..266869b7 100644 --- a/public-typescript/main.ts +++ b/public-typescript/main.ts @@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { Options as BulmaCalendarOptions } from 'bulma-calendar' -import type * as globalTypes from '../types/globalTypes.js' +import type { LOS } from '../types/globalTypes.js' type RandomColorHue = | 'red' @@ -492,7 +492,7 @@ declare const exports: Record & { * Declare LOS */ - const los: globalTypes.LOS = { + const los: LOS = { urlPrefix, apiKey: document.querySelector('main')?.dataset.apiKey ?? '', dynamicsGPIntegrationIsEnabled, diff --git a/public-typescript/mapEdit.js b/public-typescript/mapEdit.js index 0a5cfaf0..6b1e18f6 100644 --- a/public-typescript/mapEdit.js +++ b/public-typescript/mapEdit.js @@ -1,5 +1,6 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { var _a; @@ -22,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); } function updateMap(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/maps/' + (isCreate ? 'doCreateMap' : 'doUpdateMap'), mapForm, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/maps/${isCreate ? 'doCreateMap' : 'doUpdateMap'}`, mapForm, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -32,14 +33,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); } else { bulmaJS.alert({ - message: los.escapedAliases.Map + ' Updated Successfully', + message: `${los.escapedAliases.Map} Updated Successfully`, contextualColorName: 'success' }); } } else { bulmaJS.alert({ - title: 'Error Updating ' + los.escapedAliases.Map, + title: `Error Updating ${los.escapedAliases.Map}`, message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); @@ -55,7 +56,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); .querySelector('#button--deleteMap')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', (clickEvent) => { clickEvent.preventDefault(); function doDelete() { - cityssm.postJSON(los.urlPrefix + '/maps/doDeleteMap', { + cityssm.postJSON(`${los.urlPrefix}/maps/doDeleteMap`, { mapId }, (rawResponseJSON) => { var _a; @@ -65,7 +66,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); } else { bulmaJS.alert({ - title: 'Error Deleting ' + los.escapedAliases.Map, + title: `Error Deleting ${los.escapedAliases.Map}`, message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); @@ -73,7 +74,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } bulmaJS.confirm({ - title: 'Delete ' + los.escapedAliases.Map, + title: `Delete ${los.escapedAliases.Map}`, message: `Are you sure you want to delete this ${los.escapedAliases.map} and all related ${los.escapedAliases.lots}?`, contextualColorName: 'warning', okButton: { diff --git a/public-typescript/mapEdit.ts b/public-typescript/mapEdit.ts index b96101bc..119069c4 100644 --- a/public-typescript/mapEdit.ts +++ b/public-typescript/mapEdit.ts @@ -1,14 +1,17 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes' +import type { BulmaJS } from '@cityssm/bulma-js/types.js' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' -import type { BulmaJS } from '@cityssm/bulma-js/types' +import type { LOS } from '../types/globalTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS + +declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const mapId = (document.querySelector('#map--mapId') as HTMLInputElement) .value @@ -34,7 +37,7 @@ declare const bulmaJS: BulmaJS formEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/maps/' + (isCreate ? 'doCreateMap' : 'doUpdateMap'), + `${los.urlPrefix}/maps/${isCreate ? 'doCreateMap' : 'doUpdateMap'}`, mapForm, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { @@ -50,13 +53,13 @@ declare const bulmaJS: BulmaJS window.location.href = los.getMapURL(responseJSON.mapId, true) } else { bulmaJS.alert({ - message: los.escapedAliases.Map + ' Updated Successfully', + message: `${los.escapedAliases.Map} Updated Successfully`, contextualColorName: 'success' }) } } else { bulmaJS.alert({ - title: 'Error Updating ' + los.escapedAliases.Map, + title: `Error Updating ${los.escapedAliases.Map}`, message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) @@ -81,7 +84,7 @@ declare const bulmaJS: BulmaJS function doDelete(): void { cityssm.postJSON( - los.urlPrefix + '/maps/doDeleteMap', + `${los.urlPrefix}/maps/doDeleteMap`, { mapId }, @@ -95,7 +98,7 @@ declare const bulmaJS: BulmaJS window.location.href = los.getMapURL() } else { bulmaJS.alert({ - title: 'Error Deleting ' + los.escapedAliases.Map, + title: `Error Deleting ${los.escapedAliases.Map}`, message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) @@ -105,7 +108,7 @@ declare const bulmaJS: BulmaJS } bulmaJS.confirm({ - title: 'Delete ' + los.escapedAliases.Map, + title: `Delete ${los.escapedAliases.Map}`, message: `Are you sure you want to delete this ${los.escapedAliases.map} and all related ${los.escapedAliases.lots}?`, contextualColorName: 'warning', okButton: { diff --git a/public-typescript/mapSearch.js b/public-typescript/mapSearch.js index 3a8822c7..2e4b7eca 100644 --- a/public-typescript/mapSearch.js +++ b/public-typescript/mapSearch.js @@ -1,13 +1,16 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { + var _a; const los = exports.los; const maps = exports.maps; const searchFilterElement = document.querySelector('#searchFilter--map'); const searchResultsContainerElement = document.querySelector('#container--searchResults'); function renderResults() { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Maps}...`); let searchResultCount = 0; const searchResultsTbodyElement = document.createElement('tbody'); @@ -28,52 +31,48 @@ Object.defineProperty(exports, "__esModule", { value: true }); continue; } searchResultCount += 1; - searchResultsTbodyElement.insertAdjacentHTML('beforeend', '' + - ('') + - ('') + - ('') + - '' + - '' + - ` + ` + - ''); + + `); } searchResultsContainerElement.innerHTML = ''; if (searchResultCount === 0) { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `

    There are no ${los.escapedAliases.maps} that meet the search criteria.

    `; @@ -82,6 +81,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const searchResultsTableElement = document.createElement('table'); searchResultsTableElement.className = 'table is-fullwidth is-striped is-hoverable has-sticky-header'; + // eslint-disable-next-line no-unsanitized/property searchResultsTableElement.innerHTML = ` @@ -95,9 +95,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); } } searchFilterElement.addEventListener('keyup', renderResults); - document - .querySelector('#form--searchFilters') - .addEventListener('submit', (formEvent) => { + (_a = document + .querySelector('#form--searchFilters')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', (formEvent) => { formEvent.preventDefault(); renderResults(); }); diff --git a/public-typescript/mapSearch.ts b/public-typescript/mapSearch.ts index 973d4a43..c06997eb 100644 --- a/public-typescript/mapSearch.ts +++ b/public-typescript/mapSearch.ts @@ -1,15 +1,18 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes' -import type * as recordTypes from '../types/recordTypes' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' +import type { LOS } from '../types/globalTypes.js' +import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal + +declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS - const maps: recordTypes.MapRecord[] = exports.maps + const maps = exports.maps as recordTypes.MapRecord[] const searchFilterElement = document.querySelector( '#searchFilter--map' @@ -20,6 +23,7 @@ declare const cityssm: cityssmGlobal ) as HTMLElement function renderResults(): void { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML( `Loading ${los.escapedAliases.Maps}...` ) @@ -52,61 +56,67 @@ declare const cityssm: cityssmGlobal searchResultCount += 1 + // eslint-disable-next-line no-unsanitized/method searchResultsTbodyElement.insertAdjacentHTML( 'beforeend', - '' + - ('') + - ('') + - ('') + - '' + - '' + - `` + - '' + ` + + ` ) } searchResultsContainerElement.innerHTML = '' if (searchResultCount === 0) { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `

    There are no ${los.escapedAliases.maps} that meet the search criteria.

    ` @@ -116,6 +126,7 @@ declare const cityssm: cityssmGlobal searchResultsTableElement.className = 'table is-fullwidth is-striped is-hoverable has-sticky-header' + // eslint-disable-next-line no-unsanitized/property searchResultsTableElement.innerHTML = ` @@ -134,8 +145,8 @@ declare const cityssm: cityssmGlobal searchFilterElement.addEventListener('keyup', renderResults) document - .querySelector('#form--searchFilters')! - .addEventListener('submit', (formEvent) => { + .querySelector('#form--searchFilters') + ?.addEventListener('submit', (formEvent) => { formEvent.preventDefault() renderResults() }) diff --git a/public-typescript/workOrderMilestoneCalendar.js b/public-typescript/workOrderMilestoneCalendar.js index 3ae22cda..e1f6a2b3 100644 --- a/public-typescript/workOrderMilestoneCalendar.js +++ b/public-typescript/workOrderMilestoneCalendar.js @@ -1,5 +1,6 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { const los = exports.los; @@ -8,7 +9,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, _h; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; if (workOrderMilestones.length === 0) { milestoneCalendarContainerElement.innerHTML = `

    There are no milestones that meet the search criteria.

    @@ -27,11 +28,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); currentPanelElement = document.createElement('div'); currentPanelElement.className = 'panel'; currentPanelElement.innerHTML = `

    - ${milestone.workOrderMilestoneDate === 0 + ${cityssm.escapeHTML(milestone.workOrderMilestoneDate === 0 ? 'No Set Date' - : milestone.workOrderMilestoneDateString} + : (_a = milestone.workOrderMilestoneDateString) !== null && _a !== void 0 ? _a : '')}

    `; - currentPanelDateString = milestone.workOrderMilestoneDateString; + currentPanelDateString = (_b = milestone.workOrderMilestoneDateString) !== null && _b !== void 0 ? _b : ''; } const panelBlockElement = document.createElement('div'); panelBlockElement.className = 'panel-block is-block'; @@ -41,70 +42,57 @@ Object.defineProperty(exports, "__esModule", { value: true }); panelBlockElement.classList.add('has-background-warning-light'); } let lotOccupancyHTML = ''; - for (const lot of milestone.workOrderLots) { + for (const lot of (_c = milestone.workOrderLots) !== null && _c !== void 0 ? _c : []) { lotOccupancyHTML += `
  • + data-tooltip="${cityssm.escapeHTML((_d = lot.mapName) !== null && _d !== void 0 ? _d : '')}"> - ${cityssm.escapeHTML((_b = lot.lotName) !== null && _b !== void 0 ? _b : '')} + ${cityssm.escapeHTML((_e = lot.lotName) !== null && _e !== void 0 ? _e : '')}
  • `; } - for (const lotOccupancy of milestone.workOrderLotOccupancies) { - for (const occupant of lotOccupancy.lotOccupancyOccupants) { + for (const lotOccupancy of (_f = milestone.workOrderLotOccupancies) !== null && _f !== void 0 ? _f : []) { + for (const occupant of (_g = lotOccupancy.lotOccupancyOccupants) !== null && _g !== void 0 ? _g : []) { lotOccupancyHTML += `
  • + data-tooltip="${cityssm.escapeHTML((_h = occupant.lotOccupantType) !== null && _h !== void 0 ? _h : '')}"> - ${cityssm.escapeHTML((_d = occupant.occupantName) !== null && _d !== void 0 ? _d : '')} - ${cityssm.escapeHTML((_e = occupant.occupantFamilyName) !== null && _e !== void 0 ? _e : '')} + ${cityssm.escapeHTML((_j = occupant.occupantName) !== null && _j !== void 0 ? _j : '')} + ${cityssm.escapeHTML((_k = occupant.occupantFamilyName) !== null && _k !== void 0 ? _k : '')}
  • `; } } - panelBlockElement.innerHTML = - '
    ' + - ('
    ' + - '' + - (milestone.workOrderMilestoneCompletionDate - ? '' - : '') + - '' + - '
    ') + - ('
    ' + - (milestone.workOrderMilestoneTime === 0 - ? '' - : milestone.workOrderMilestoneTimePeriodString + '
    ') + - (milestone.workOrderMilestoneTypeId - ? '' + - cityssm.escapeHTML(milestone.workOrderMilestoneType) + - '
    ' - : '') + - '' + - cityssm.escapeHTML(milestone.workOrderMilestoneDescription) + - '' + - '
    ') + - ('
    ' + - '' + - ' ' + - cityssm.escapeHTML((_g = milestone.workOrderNumber) !== null && _g !== void 0 ? _g : '') + - '
    ' + - '' + - cityssm.escapeHTML((_h = milestone.workOrderDescription) !== null && _h !== void 0 ? _h : '') + - '' + - '
    ') + - ('
    ' + - (lotOccupancyHTML === '' - ? '' - : '
      ' + lotOccupancyHTML + '
    ') + - '
    ') + - '
    '; + // eslint-disable-next-line no-unsanitized/property + panelBlockElement.innerHTML = `
    +
    + + ${milestone.workOrderMilestoneCompletionDate + ? '' + : ''} + +
    + ${milestone.workOrderMilestoneTime === 0 + ? '' + : `${milestone.workOrderMilestoneTimePeriodString}
    `} + ${milestone.workOrderMilestoneTypeId + ? `${cityssm.escapeHTML((_l = milestone.workOrderMilestoneType) !== null && _l !== void 0 ? _l : '')}
    ` + : ''} + + ${cityssm.escapeHTML((_m = milestone.workOrderMilestoneDescription) !== null && _m !== void 0 ? _m : '')} + +
    + + + ${cityssm.escapeHTML((_p = milestone.workOrderNumber) !== null && _p !== void 0 ? _p : '')} +
    + ${cityssm.escapeHTML((_q = milestone.workOrderDescription) !== null && _q !== void 0 ? _q : '')} +
    + ${lotOccupancyHTML === '' + ? '' + : '
      ' + lotOccupancyHTML + '
    '}
    `; currentPanelElement.append(panelBlockElement); } milestoneCalendarContainerElement.append(currentPanelElement); @@ -113,14 +101,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); if (event) { event.preventDefault(); } + // eslint-disable-next-line no-unsanitized/property milestoneCalendarContainerElement.innerHTML = los.getLoadingParagraphHTML('Loading Milestones...'); - cityssm.postJSON(los.urlPrefix + '/workOrders/doGetWorkOrderMilestones', workOrderSearchFiltersFormElement, (responseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doGetWorkOrderMilestones`, workOrderSearchFiltersFormElement, (responseJSON) => { renderMilestones(responseJSON.workOrderMilestones); }); } workOrderMilestoneDateFilterElement.addEventListener('change', () => { - workOrderMilestoneDateStringElement.closest('fieldset').disabled = - workOrderMilestoneDateFilterElement.value !== 'date'; + ; + workOrderMilestoneDateStringElement.closest('fieldset').disabled = workOrderMilestoneDateFilterElement.value !== 'date'; getMilestones(); }); los.initializeDatePickers(workOrderSearchFiltersFormElement); diff --git a/public-typescript/workOrderMilestoneCalendar.ts b/public-typescript/workOrderMilestoneCalendar.ts index 407e68a4..4b8bcd02 100644 --- a/public-typescript/workOrderMilestoneCalendar.ts +++ b/public-typescript/workOrderMilestoneCalendar.ts @@ -1,12 +1,16 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type * as recordTypes from '../types/recordTypes' -import type * as globalTypes from '../types/globalTypes' -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' + +import type { LOS } from '../types/globalTypes.js' +import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal + +declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const workOrderSearchFiltersFormElement = document.querySelector( '#form--searchFilters' @@ -53,14 +57,14 @@ declare const cityssm: cityssmGlobal currentPanelElement.className = 'panel' currentPanelElement.innerHTML = `

    - ${ + ${cityssm.escapeHTML( milestone.workOrderMilestoneDate === 0 ? 'No Set Date' - : milestone.workOrderMilestoneDateString! - } + : milestone.workOrderMilestoneDateString ?? '' + )}

    ` - currentPanelDateString = milestone.workOrderMilestoneDateString! + currentPanelDateString = milestone.workOrderMilestoneDateString ?? '' } const panelBlockElement = document.createElement('div') @@ -77,7 +81,7 @@ declare const cityssm: cityssmGlobal let lotOccupancyHTML = '' - for (const lot of milestone.workOrderLots!) { + for (const lot of milestone.workOrderLots ?? []) { lotOccupancyHTML += `
  • @@ -88,8 +92,8 @@ declare const cityssm: cityssmGlobal
  • ` } - for (const lotOccupancy of milestone.workOrderLotOccupancies!) { - for (const occupant of lotOccupancy.lotOccupancyOccupants!) { + for (const lotOccupancy of milestone.workOrderLotOccupancies ?? []) { + for (const occupant of lotOccupancy.lotOccupancyOccupants ?? []) { lotOccupancyHTML += `
  • ' + - ('
    ' + - '' + - (milestone.workOrderMilestoneCompletionDate - ? '' - : '') + - '' + - '
    ') + - ('
    ' + - (milestone.workOrderMilestoneTime === 0 - ? '' - : milestone.workOrderMilestoneTimePeriodString! + '
    ') + - (milestone.workOrderMilestoneTypeId - ? '' + - cityssm.escapeHTML(milestone.workOrderMilestoneType!) + - '
    ' - : '') + - '' + - cityssm.escapeHTML(milestone.workOrderMilestoneDescription!) + - '' + - '
    ') + - ('
    ' + - '' + - ' ' + - cityssm.escapeHTML(milestone.workOrderNumber ?? '') + - '
    ' + - '' + - cityssm.escapeHTML(milestone.workOrderDescription ?? '') + - '' + - '
    ') + - ('
    ' + - (lotOccupancyHTML === '' - ? '' - : '
      ' + lotOccupancyHTML + '
    ') + - '
    ') + - '
  • ' + // eslint-disable-next-line no-unsanitized/property + panelBlockElement.innerHTML = `
    +
    + + ${ + milestone.workOrderMilestoneCompletionDate + ? '' + : '' + } + +
    + ${ + milestone.workOrderMilestoneTime === 0 + ? '' + : `${milestone.workOrderMilestoneTimePeriodString}
    ` + } + ${ + milestone.workOrderMilestoneTypeId + ? `${cityssm.escapeHTML(milestone.workOrderMilestoneType ?? '')}
    ` + : '' + } + + ${cityssm.escapeHTML(milestone.workOrderMilestoneDescription ?? '')} + +
    + + + ${cityssm.escapeHTML(milestone.workOrderNumber ?? '')} +
    + ${cityssm.escapeHTML(milestone.workOrderDescription ?? '')} +
    + ${ + lotOccupancyHTML === '' + ? '' + : '
      ' + lotOccupancyHTML + '
    ' + }
    ` ;(currentPanelElement as HTMLElement).append(panelBlockElement) } - milestoneCalendarContainerElement.append(currentPanelElement!) + milestoneCalendarContainerElement.append(currentPanelElement as HTMLElement) } function getMilestones(event?: Event): void { @@ -156,12 +155,13 @@ declare const cityssm: cityssmGlobal event.preventDefault() } + // eslint-disable-next-line no-unsanitized/property milestoneCalendarContainerElement.innerHTML = los.getLoadingParagraphHTML( 'Loading Milestones...' ) cityssm.postJSON( - los.urlPrefix + '/workOrders/doGetWorkOrderMilestones', + `${los.urlPrefix}/workOrders/doGetWorkOrderMilestones`, workOrderSearchFiltersFormElement, (responseJSON) => { renderMilestones( @@ -176,8 +176,11 @@ declare const cityssm: cityssmGlobal } workOrderMilestoneDateFilterElement.addEventListener('change', () => { - workOrderMilestoneDateStringElement.closest('fieldset')!.disabled = - workOrderMilestoneDateFilterElement.value !== 'date' + ;( + workOrderMilestoneDateStringElement.closest( + 'fieldset' + ) as HTMLFieldSetElement + ).disabled = workOrderMilestoneDateFilterElement.value !== 'date' getMilestones() }) diff --git a/public-typescript/workOrderOutlook.ts b/public-typescript/workOrderOutlook.ts index e5934a5a..08fbe1fd 100644 --- a/public-typescript/workOrderOutlook.ts +++ b/public-typescript/workOrderOutlook.ts @@ -1,11 +1,11 @@ // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair /* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes.js' +import type { LOS } from '../types/globalTypes.js' declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const workOrderTypeIdsElement = document.querySelector( '#icsFilters--workOrderTypeIds' diff --git a/public-typescript/workOrderSearch.js b/public-typescript/workOrderSearch.js index f29334d8..cc9729ca 100644 --- a/public-typescript/workOrderSearch.js +++ b/public-typescript/workOrderSearch.js @@ -1,5 +1,6 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { const los = exports.los; @@ -10,7 +11,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(rawResponseJSON) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; const responseJSON = rawResponseJSON; if (responseJSON.workOrders.length === 0) { searchResultsContainerElement.innerHTML = `
    @@ -21,101 +22,86 @@ Object.defineProperty(exports, "__esModule", { value: true }); const resultsTbodyElement = document.createElement('tbody'); for (const workOrder of responseJSON.workOrders) { let relatedHTML = ''; - for (const lot of workOrder.workOrderLots) { + for (const lot of (_a = workOrder.workOrderLots) !== null && _a !== void 0 ? _a : []) { relatedHTML += `
  • + data-tooltip="${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')}"> - ${cityssm.escapeHTML(((_b = lot.lotName) !== null && _b !== void 0 ? _b : '') === '' - ? '(No ' + los.escapedAliases.Lot + ' Name)' - : lot.lotName)} + ${cityssm.escapeHTML(((_c = lot.lotName) !== null && _c !== void 0 ? _c : '') === '' + ? `(No ${los.escapedAliases.Lot} Name)` + : (_d = lot.lotName) !== null && _d !== void 0 ? _d : '')}
  • `; } - for (const occupancy of workOrder.workOrderLotOccupancies) { - for (const occupant of occupancy.lotOccupancyOccupants) { + for (const occupancy of (_e = workOrder.workOrderLotOccupancies) !== null && _e !== void 0 ? _e : []) { + for (const occupant of (_f = occupancy.lotOccupancyOccupants) !== null && _f !== void 0 ? _f : []) { relatedHTML += `
  • + data-tooltip="${cityssm.escapeHTML((_g = occupant.lotOccupantType) !== null && _g !== void 0 ? _g : '')}"> - - ${cityssm.escapeHTML(((_e = occupant.occupantName) !== null && _e !== void 0 ? _e : '') === '' && - ((_f = occupant.occupantFamilyName) !== null && _f !== void 0 ? _f : '') === '' + : (_j = occupant.fontAwesomeIconClass) !== null && _j !== void 0 ? _j : '')}" aria-label="${los.escapedAliases.occupant}"> + ${cityssm.escapeHTML(((_k = occupant.occupantName) !== null && _k !== void 0 ? _k : '') === '' && + ((_l = occupant.occupantFamilyName) !== null && _l !== void 0 ? _l : '') === '' ? '(No Name)' - : occupant.occupantName + ' ' + occupant.occupantFamilyName)} + : `${occupant.occupantName} ${occupant.occupantFamilyName}`)}
  • `; } } - resultsTbodyElement.insertAdjacentHTML('beforeend', '
    ' + - ('') + - ` + ` + - ('') + - ('') + - ('') + - (workOrderPrints.length > 0 - ? '' - : '') + - ''); + + ${workOrderPrints.length > 0 + ? `` + : ''}`); } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `
    ' + - '' + - cityssm.escapeHTML(map.mapName === '' ? '(No Name)' : map.mapName) + - '
    ' + - '' + - cityssm.escapeHTML((_e = map.mapDescription) !== null && _e !== void 0 ? _e : '') + - '' + - '
    ' + - (((_f = map.mapAddress1) !== null && _f !== void 0 ? _f : '') === '' - ? '' - : cityssm.escapeHTML((_g = map.mapAddress1) !== null && _g !== void 0 ? _g : '') + '
    ') + - (((_h = map.mapAddress2) !== null && _h !== void 0 ? _h : '') === '' - ? '' - : cityssm.escapeHTML((_j = map.mapAddress2) !== null && _j !== void 0 ? _j : '') + '
    ') + - (map.mapCity || map.mapProvince - ? cityssm.escapeHTML((_k = map.mapCity) !== null && _k !== void 0 ? _k : '') + - ', ' + - cityssm.escapeHTML((_l = map.mapProvince) !== null && _l !== void 0 ? _l : '') + - '
    ' - : '') + - (((_m = map.mapPostalCode) !== null && _m !== void 0 ? _m : '') === '' - ? '' - : cityssm.escapeHTML((_o = map.mapPostalCode) !== null && _o !== void 0 ? _o : '')) + - '
    ' + cityssm.escapeHTML((_p = map.mapPhoneNumber) !== null && _p !== void 0 ? _p : '') + '' + - (map.mapLatitude && map.mapLongitude - ? '' - : '') + - '' + - (((_q = map.mapSVG) !== null && _q !== void 0 ? _q : '') === '' - ? '' - : '') + - ' + // eslint-disable-next-line no-unsanitized/method + searchResultsTbodyElement.insertAdjacentHTML('beforeend', `
    + + ${cityssm.escapeHTML(((_e = map.mapName) !== null && _e !== void 0 ? _e : '') === '' ? '(No Name)' : (_f = map.mapName) !== null && _f !== void 0 ? _f : '')} +
    + + ${cityssm.escapeHTML((_g = map.mapDescription) !== null && _g !== void 0 ? _g : '')} + +
    + ${((_h = map.mapAddress1) !== null && _h !== void 0 ? _h : '') === '' + ? '' + : `${cityssm.escapeHTML((_j = map.mapAddress1) !== null && _j !== void 0 ? _j : '')}
    `} + ${((_k = map.mapAddress2) !== null && _k !== void 0 ? _k : '') === '' + ? '' + : `${cityssm.escapeHTML((_l = map.mapAddress2) !== null && _l !== void 0 ? _l : '')}
    `} + ${map.mapCity || map.mapProvince + ? `${cityssm.escapeHTML((_m = map.mapCity) !== null && _m !== void 0 ? _m : '')}, ${cityssm.escapeHTML((_o = map.mapProvince) !== null && _o !== void 0 ? _o : '')}
    ` + : ''} + ${((_p = map.mapPostalCode) !== null && _p !== void 0 ? _p : '') === '' + ? '' + : cityssm.escapeHTML((_q = map.mapPostalCode) !== null && _q !== void 0 ? _q : '')} +
    + ${cityssm.escapeHTML((_r = map.mapPhoneNumber) !== null && _r !== void 0 ? _r : '')} + + ${map.mapLatitude && map.mapLongitude + ? ` + + ` + : ''} + + ${((_s = map.mapSVG) !== null && _s !== void 0 ? _s : '') === '' + ? '' + : ''} + ${map.lotCount} -
    ${los.escapedAliases.Map} Address
    ' + - '' + - cityssm.escapeHTML( - map.mapName! === '' ? '(No Name)' : map.mapName! - ) + - '
    ' + - '' + - cityssm.escapeHTML(map.mapDescription ?? '') + - '' + - '
    ' + - ((map.mapAddress1 ?? '') === '' - ? '' - : cityssm.escapeHTML(map.mapAddress1 ?? '') + '
    ') + - ((map.mapAddress2 ?? '') === '' - ? '' - : cityssm.escapeHTML(map.mapAddress2 ?? '') + '
    ') + - (map.mapCity || map.mapProvince - ? cityssm.escapeHTML(map.mapCity ?? '') + - ', ' + - cityssm.escapeHTML(map.mapProvince ?? '') + - '
    ' - : '') + - ((map.mapPostalCode ?? '') === '' - ? '' - : cityssm.escapeHTML(map.mapPostalCode ?? '')) + - '
    ' + cityssm.escapeHTML(map.mapPhoneNumber ?? '') + '' + - (map.mapLatitude && map.mapLongitude - ? '' - : '') + - '' + - ((map.mapSVG ?? '') === '' - ? '' - : '') + - ' - ${map.lotCount!} -
    + + ${cityssm.escapeHTML( + (map.mapName ?? '') === '' ? '(No Name)' : map.mapName ?? '' + )} +
    + + ${cityssm.escapeHTML(map.mapDescription ?? '')} + +
    + ${ + (map.mapAddress1 ?? '') === '' + ? '' + : `${cityssm.escapeHTML(map.mapAddress1 ?? '')}
    ` + } + ${ + (map.mapAddress2 ?? '') === '' + ? '' + : `${cityssm.escapeHTML(map.mapAddress2 ?? '')}
    ` + } + ${ + map.mapCity || map.mapProvince + ? `${cityssm.escapeHTML(map.mapCity ?? '')}, ${cityssm.escapeHTML(map.mapProvince ?? '')}
    ` + : '' + } + ${ + (map.mapPostalCode ?? '') === '' + ? '' + : cityssm.escapeHTML(map.mapPostalCode ?? '') + } +
    + ${cityssm.escapeHTML(map.mapPhoneNumber ?? '')} + + ${ + map.mapLatitude && map.mapLongitude + ? ` + + ` + : '' + } + + ${ + (map.mapSVG ?? '') === '' + ? '' + : '' + } + + ${map.lotCount} +
    ${los.escapedAliases.Map} Address
    ' + - '' + - (workOrder.workOrderNumber.trim() === '' - ? '(No Number)' - : cityssm.escapeHTML((_g = workOrder.workOrderNumber) !== null && _g !== void 0 ? _g : '')) + - '' + - ' - ${cityssm.escapeHTML((_h = workOrder.workOrderType) !== null && _h !== void 0 ? _h : '')}
    + // eslint-disable-next-line no-unsanitized/method + resultsTbodyElement.insertAdjacentHTML('beforeend', `
    + + ${((_m = workOrder.workOrderNumber) === null || _m === void 0 ? void 0 : _m.trim()) === '' + ? '(No Number)' + : cityssm.escapeHTML((_o = workOrder.workOrderNumber) !== null && _o !== void 0 ? _o : '')} + + + ${cityssm.escapeHTML((_p = workOrder.workOrderType) !== null && _p !== void 0 ? _p : '')}
    - ${cityssm.escapeHTML((_j = workOrder.workOrderDescription) !== null && _j !== void 0 ? _j : '')} + ${cityssm.escapeHTML((_q = workOrder.workOrderDescription) !== null && _q !== void 0 ? _q : '')} -
    ' + - (relatedHTML === '' - ? '' - : '
      ' + relatedHTML + '
    ') + - '
    ' + - '
      ' + - `
    • - - - - ${workOrder.workOrderOpenDateString} -
    • ` + - ('
    • ' + - '' + - ' ' + - (workOrder.workOrderCloseDate - ? workOrder.workOrderCloseDateString - : '(No ' + - los.escapedAliases.WorkOrderCloseDate + - ')') + - '
    • ') + - '
    ' + - '
    ' + - (workOrder.workOrderMilestoneCount === 0 - ? '-' - : workOrder.workOrderMilestoneCompletionCount.toString() + - ' / ' + - workOrder.workOrderMilestoneCount.toString()) + - '' + - '' + - '' + - '' + - '
    + ${relatedHTML === '' + ? '' + : '
      ' + relatedHTML + '
    '} +
    +
      +
    • + + + + ${workOrder.workOrderOpenDateString} +
    • +
    • + + + + ${workOrder.workOrderCloseDate + ? workOrder.workOrderCloseDateString + : `(No ${los.escapedAliases.WorkOrderCloseDate})`} +
    • +
    +
    + ${workOrder.workOrderMilestoneCount === 0 + ? '-' + : ((_r = workOrder.workOrderMilestoneCompletionCount) !== null && _r !== void 0 ? _r : '').toString() + + ' / ' + + ((_s = workOrder.workOrderMilestoneCount) !== null && _s !== void 0 ? _s : '').toString()} + + + + +
    @@ -126,18 +112,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); ${workOrderPrints.length > 0 ? '' : ''}
    Work Order Number
    `; + // eslint-disable-next-line no-unsanitized/method searchResultsContainerElement.insertAdjacentHTML('beforeend', los.getSearchResultsPagerHTML(limit, responseJSON.offset, responseJSON.count)); - searchResultsContainerElement - .querySelector('table') - .append(resultsTbodyElement); - (_k = searchResultsContainerElement - .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); + (_t = searchResultsContainerElement + .querySelector('table')) === null || _t === void 0 ? void 0 : _t.append(resultsTbodyElement); + (_u = searchResultsContainerElement + .querySelector("button[data-page='previous']")) === null || _u === void 0 ? void 0 : _u.addEventListener('click', previousAndGetWorkOrders); + (_v = searchResultsContainerElement + .querySelector("button[data-page='next']")) === null || _v === void 0 ? void 0 : _v.addEventListener('click', nextAndGetWorkOrders); } function getWorkOrders() { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML('Loading Work Orders...'); - cityssm.postJSON(los.urlPrefix + '/workOrders/doSearchWorkOrders', searchFilterFormElement, renderWorkOrders); + cityssm.postJSON(`${los.urlPrefix}/workOrders/doSearchWorkOrders`, searchFilterFormElement, renderWorkOrders); } function resetOffsetAndGetWorkOrders() { offsetElement.value = '0'; @@ -158,6 +145,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); searchFilterFormElement.addEventListener('submit', (formEvent) => { formEvent.preventDefault(); }); + // eslint-disable-next-line no-secrets/no-secrets /* const workOrderOpenDateStringElement = document.querySelector("#searchFilter--workOrderOpenDateString") as HTMLInputElement; @@ -186,6 +174,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); resetOffsetAndGetWorkOrders(); }); - */ + */ getWorkOrders(); })(); diff --git a/public-typescript/workOrderSearch.ts b/public-typescript/workOrderSearch.ts index 23e25a9d..a8397b36 100644 --- a/public-typescript/workOrderSearch.ts +++ b/public-typescript/workOrderSearch.ts @@ -1,14 +1,18 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type * as recordTypes from '../types/recordTypes' -import type * as globalTypes from '../types/globalTypes' -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' + +import type { LOS } from '../types/globalTypes.js' +import type * as recordTypes from '../types/recordTypes.js' declare const cityssm: cityssmGlobal + +declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS - const workOrderPrints: string[] = exports.workOrderPrints + const workOrderPrints = exports.workOrderPrints as string[] const searchFilterFormElement = document.querySelector( '#form--searchFilters' @@ -49,7 +53,7 @@ declare const cityssm: cityssmGlobal for (const workOrder of responseJSON.workOrders) { let relatedHTML = '' - for (const lot of workOrder.workOrderLots!) { + for (const lot of workOrder.workOrderLots ?? []) { relatedHTML += `
  • @@ -58,14 +62,14 @@ declare const cityssm: cityssmGlobal ${cityssm.escapeHTML( (lot.lotName ?? '') === '' - ? '(No ' + los.escapedAliases.Lot + ' Name)' - : lot.lotName! + ? `(No ${los.escapedAliases.Lot} Name)` + : lot.lotName ?? '' )}
  • ` } - for (const occupancy of workOrder.workOrderLotOccupancies!) { - for (const occupant of occupancy.lotOccupancyOccupants!) { + for (const occupancy of workOrder.workOrderLotOccupancies ?? []) { + for (const occupant of occupancy.lotOccupancyOccupants ?? []) { relatedHTML += `
  • ${cityssm.escapeHTML( (occupant.occupantName ?? '') === '' && (occupant.occupantFamilyName ?? '') === '' ? '(No Name)' - : occupant.occupantName! + ' ' + occupant.occupantFamilyName! + : `${occupant.occupantName} ${occupant.occupantFamilyName}` )}
  • ` } } + // eslint-disable-next-line no-unsanitized/method resultsTbodyElement.insertAdjacentHTML( 'beforeend', - '
    ' + - ('') + - ` + ` + - ('') + - ('') + - ('') + - (workOrderPrints.length > 0 - ? '' - : '') + - '' + + ${ + workOrderPrints.length > 0 + ? `` + : '' + }` ) } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `
    ' + - '' + - (workOrder.workOrderNumber!.trim() === '' - ? '(No Number)' - : cityssm.escapeHTML(workOrder.workOrderNumber ?? '')) + - '' + - ' + `
    + + ${ + workOrder.workOrderNumber?.trim() === '' + ? '(No Number)' + : cityssm.escapeHTML(workOrder.workOrderNumber ?? '') + } + + ${cityssm.escapeHTML(workOrder.workOrderType ?? '')}
    ${cityssm.escapeHTML(workOrder.workOrderDescription ?? '')} -
    ' + - (relatedHTML === '' - ? '' - : '
      ' + relatedHTML + '
    ') + - '
    ' + - '
      ' + - `
    • - - - - ${workOrder.workOrderOpenDateString!} -
    • ` + - ('
    • ' + - '' + - ' ' + - (workOrder.workOrderCloseDate - ? workOrder.workOrderCloseDateString! - : '(No ' + - los.escapedAliases.WorkOrderCloseDate + - ')') + - '
    • ') + - '
    ' + - '
    ' + - (workOrder.workOrderMilestoneCount === 0 - ? '-' - : workOrder.workOrderMilestoneCompletionCount!.toString() + - ' / ' + - workOrder.workOrderMilestoneCount!.toString()) + - '' + - '' + - '' + - '' + - '
    + ${ + relatedHTML === '' + ? '' + : '
      ' + relatedHTML + '
    ' + } +
    +
      +
    • + + + + ${workOrder.workOrderOpenDateString} +
    • +
    • + + + + ${ + workOrder.workOrderCloseDate + ? workOrder.workOrderCloseDateString + : `(No ${los.escapedAliases.WorkOrderCloseDate})` + } +
    • +
    +
    + ${ + workOrder.workOrderMilestoneCount === 0 + ? '-' + : ( + workOrder.workOrderMilestoneCompletionCount ?? '' + ).toString() + + ' / ' + + (workOrder.workOrderMilestoneCount ?? '').toString() + } + + + + +
    @@ -169,6 +170,7 @@ declare const cityssm: cityssmGlobal
    Work Order Number
    ` + // eslint-disable-next-line no-unsanitized/method searchResultsContainerElement.insertAdjacentHTML( 'beforeend', los.getSearchResultsPagerHTML( @@ -179,8 +181,8 @@ declare const cityssm: cityssmGlobal ) searchResultsContainerElement - .querySelector('table')! - .append(resultsTbodyElement) + .querySelector('table') + ?.append(resultsTbodyElement) searchResultsContainerElement .querySelector("button[data-page='previous']") @@ -192,12 +194,13 @@ declare const cityssm: cityssmGlobal } function getWorkOrders(): void { + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML( 'Loading Work Orders...' ) cityssm.postJSON( - los.urlPrefix + '/workOrders/doSearchWorkOrders', + `${los.urlPrefix}/workOrders/doSearchWorkOrders`, searchFilterFormElement, renderWorkOrders ) @@ -234,6 +237,7 @@ declare const cityssm: cityssmGlobal formEvent.preventDefault() }) + // eslint-disable-next-line no-secrets/no-secrets /* const workOrderOpenDateStringElement = document.querySelector("#searchFilter--workOrderOpenDateString") as HTMLInputElement; @@ -262,7 +266,7 @@ declare const cityssm: cityssmGlobal resetOffsetAndGetWorkOrders(); }); - */ + */ getWorkOrders() })() diff --git a/public-typescript/workOrderView.js b/public-typescript/workOrderView.js index 1c7ed966..9ed04eb9 100644 --- a/public-typescript/workOrderView.js +++ b/public-typescript/workOrderView.js @@ -1,14 +1,16 @@ "use strict"; -/* eslint-disable unicorn/prefer-module, @typescript-eslint/no-non-null-assertion */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { + var _a; const los = exports.los; const reopenWorkOrderButtonElement = document.querySelector('#button--reopenWorkOrder'); if (reopenWorkOrderButtonElement !== null) { - const workOrderId = reopenWorkOrderButtonElement.dataset.workOrderId; + const workOrderId = (_a = reopenWorkOrderButtonElement.dataset.workOrderId) !== null && _a !== void 0 ? _a : ''; reopenWorkOrderButtonElement.addEventListener('click', () => { function doReopen() { - cityssm.postJSON(los.urlPrefix + '/workOrders/doReopenWorkOrder', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doReopenWorkOrder`, { workOrderId }, (rawResponseJSON) => { var _a; diff --git a/public-typescript/workOrderView.ts b/public-typescript/workOrderView.ts index 4bbccc52..21238b0e 100644 --- a/public-typescript/workOrderView.ts +++ b/public-typescript/workOrderView.ts @@ -1,26 +1,28 @@ -/* eslint-disable unicorn/prefer-module, @typescript-eslint/no-non-null-assertion */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes' +import type { BulmaJS } from '@cityssm/bulma-js/types.js' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' - -import type { BulmaJS } from '@cityssm/bulma-js/types' +import type { LOS } from '../types/globalTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS + +declare const exports: Record ;(() => { - const los = exports.los as globalTypes.LOS + const los = exports.los as LOS const reopenWorkOrderButtonElement: HTMLButtonElement | null = document.querySelector('#button--reopenWorkOrder') if (reopenWorkOrderButtonElement !== null) { - const workOrderId = reopenWorkOrderButtonElement.dataset.workOrderId! + const workOrderId = reopenWorkOrderButtonElement.dataset.workOrderId ?? '' reopenWorkOrderButtonElement.addEventListener('click', () => { function doReopen(): void { cityssm.postJSON( - los.urlPrefix + '/workOrders/doReopenWorkOrder', + `${los.urlPrefix}/workOrders/doReopenWorkOrder`, { workOrderId }, diff --git a/public/javascripts/lotEdit.min.js b/public/javascripts/lotEdit.min.js index f7967112..5fba28ec 100644 --- a/public/javascripts/lotEdit.min.js +++ b/public/javascripts/lotEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const t=exports.los,o=document.querySelector("#lot--lotId").value,n=""===o;let l=n;function s(){var e;t.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lot']"))||void 0===e||e.classList.remove("is-light")}function a(){var e;t.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lot']"))||void 0===e||e.classList.add("is-light")}const i=document.querySelector("#form--lot");i.addEventListener("submit",function(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/lots/"+(n?"doCreateLot":"doUpdateLot"),i,e=>{var o;const s=e;s.success?(a(),n||l?window.location.href=t.getLotURL(s.lotId,!0,!0):bulmaJS.alert({message:t.escapedAliases.Lot+" Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating "+t.escapedAliases.Lot,message:null!==(o=s.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})});const r=i.querySelectorAll("input, select");for(const e of r)e.addEventListener("change",s);t.initializeUnlockFieldButtons(i),null===(e=document.querySelector("#button--deleteLot"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete "+t.escapedAliases.Lot,message:`Are you sure you want to delete this ${t.escapedAliases.lot}?`,contextualColorName:"warning",okButton:{text:`Yes, Delete ${t.escapedAliases.Lot}`,callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/lots/doDeleteLot",{lotId:o},e=>{var o;const n=e;n.success?(a(),window.location.href=t.getLotURL()):bulmaJS.alert({title:`Error Deleting ${t.escapedAliases.Lot}`,message:null!==(o=n.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})});const d=document.querySelector("#lot--lotTypeId");if(n){const e=document.querySelector("#container--lotFields");d.addEventListener("change",()=>{""!==d.value?cityssm.postJSON(t.urlPrefix+"/lots/doGetLotTypeFields",{lotTypeId:d.value},o=>{var n;const l=o;if(0===l.lotTypeFields.length)return void(e.innerHTML=`
    \n

    There are no additional fields for this ${t.escapedAliases.lot} type.

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

    Select the ${t.escapedAliases.lot} type to load the available fields.

    \n
    `})}else{const e=d.value;d.addEventListener("change",()=>{d.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${t.escapedAliases.lot} type?\n\n This change affects the additional fields associated with this record.`,contextualColorName:"warning",okButton:{text:"Yes, Keep the Change",callbackFunction:()=>{l=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{d.value=e}}})})}let m=exports.lotComments;function c(e){const n=Number.parseInt(e.currentTarget.closest("tr").dataset.lotCommentId,10),l=m.find(e=>e.lotCommentId===n);let s,a;function i(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/lots/doUpdateLotComment",s,e=>{var t;const o=e;o.success?(m=o.lotComments,a(),p()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(t=o.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lot-editComment",{onshow:e=>{t.populateAliases(e),e.querySelector("#lotCommentEdit--lotId").value=o,e.querySelector("#lotCommentEdit--lotCommentId").value=n.toString(),e.querySelector("#lotCommentEdit--lotComment").value=l.lotComment;const s=e.querySelector("#lotCommentEdit--lotCommentDateString");s.value=l.lotCommentDateString;const a=cityssm.dateToString(new Date);s.max=l.lotCommentDateString<=a?a:l.lotCommentDateString,e.querySelector("#lotCommentEdit--lotCommentTimeString").value=l.lotCommentTimeString},onshown:(e,o)=>{bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),e.querySelector("#lotCommentEdit--lotComment").focus(),(s=e.querySelector("form")).addEventListener("submit",i),a=o},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})}function u(e){const n=Number.parseInt(e.currentTarget.closest("tr").dataset.lotCommentId,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+"/lots/doDeleteLotComment",{lotId:o,lotCommentId:n},e=>{var t;const o=e;o.success?(m=o.lotComments,p()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(t=o.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function p(){var e,t;const o=document.querySelector("#container--lotComments");if(0===m.length)return void(o.innerHTML='
    \n

    There are no comments to display.

    \n
    ');const n=document.createElement("table");n.className="table is-fullwidth is-striped is-hoverable",n.innerHTML='
    \n \n \n \n \n \n ';for(const o of m){const l=document.createElement("tr");l.dataset.lotCommentId=o.lotCommentId.toString(),l.innerHTML="',l.querySelector(".button--edit").addEventListener("click",c),l.querySelector(".button--delete").addEventListener("click",u),n.querySelector("tbody").append(l)}o.innerHTML="",o.append(n)}delete exports.lotComments,n||(document.querySelector("#lotComments--add").addEventListener("click",function(){let e;function n(o){o.preventDefault(),cityssm.postJSON(t.urlPrefix+"/lots/doAddLotComment",o.currentTarget,t=>{const o=t;o.success&&(m=o.lotComments,p(),e())})}cityssm.openHtmlModal("lot-addComment",{onshow(e){t.populateAliases(e),e.querySelector("#lotCommentAdd--lotId").value=o,e.querySelector("form").addEventListener("submit",n)},onshown(t,o){bulmaJS.toggleHtmlClipped(),e=o,t.querySelector("#lotCommentAdd--lotComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#lotComments--add").focus()}})}),p())})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t;const o=exports.los,n=document.querySelector("#lot--lotId").value,l=""===n;let s=l;function a(){var e;o.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lot']"))||void 0===e||e.classList.remove("is-light")}function i(){var e;o.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lot']"))||void 0===e||e.classList.add("is-light")}const r=document.querySelector("#form--lot");r.addEventListener("submit",function(e){e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/lots/${l?"doCreateLot":"doUpdateLot"}`,r,e=>{var t;const n=e;n.success?(i(),l||s?window.location.href=o.getLotURL(n.lotId,!0,!0):bulmaJS.alert({message:`${o.escapedAliases.Lot} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Updating ${o.escapedAliases.Lot}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const d=r.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",a);o.initializeUnlockFieldButtons(r),null===(e=document.querySelector("#button--deleteLot"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${o.escapedAliases.Lot}`,message:`Are you sure you want to delete this ${o.escapedAliases.lot}?`,contextualColorName:"warning",okButton:{text:`Yes, Delete ${o.escapedAliases.Lot}`,callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/lots/doDeleteLot`,{lotId:n},e=>{var t;const n=e;n.success?(i(),window.location.href=o.getLotURL()):bulmaJS.alert({title:`Error Deleting ${o.escapedAliases.Lot}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})});const m=document.querySelector("#lot--lotTypeId");if(l){const e=document.querySelector("#container--lotFields");m.addEventListener("change",()=>{""!==m.value?cityssm.postJSON(`${o.urlPrefix}/lots/doGetLotTypeFields`,{lotTypeId:m.value},t=>{var n,l;const s=t;if(0===s.lotTypeFields.length)return void(e.innerHTML=`
    \n

    \n There are no additional fields for this ${o.escapedAliases.lot} type.\n

    \n
    `);e.innerHTML="";let a="";for(const t of s.lotTypeFields){a+=","+t.lotTypeFieldId.toString();const o=`lotFieldValue_${t.lotTypeFieldId.toString()}`,s=`lot--${o}`,i=document.createElement("div");if(i.className="field",i.innerHTML=`\n
    `,i.querySelector("label").textContent=t.lotTypeField,""===t.lotTypeFieldValues){const e=document.createElement("input");e.className="input",e.id=s,e.name=o,e.type="text",e.required=t.isRequired,e.minLength=t.minimumLength,e.maxLength=t.maximumLength,""!==(null!==(n=t.pattern)&&void 0!==n?n:"")&&(e.pattern=t.pattern),null===(l=i.querySelector(".control"))||void 0===l||l.append(e)}else{i.querySelector(".control").innerHTML=`
    \n \n
    `;const e=i.querySelector("select");e.required=t.isRequired;const n=t.lotTypeFieldValues.split("\n");for(const t of n){const o=document.createElement("option");o.value=t,o.textContent=t,e.append(o)}}e.append(i)}e.insertAdjacentHTML("beforeend",``)}):e.innerHTML=`
    \n

    Select the ${o.escapedAliases.lot} type to load the available fields.

    \n
    `})}else{const e=m.value;m.addEventListener("change",()=>{m.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${o.escapedAliases.lot} type?\n\n This change affects the additional fields associated with this record.`,contextualColorName:"warning",okButton:{text:"Yes, Keep the Change",callbackFunction(){s=!0}},cancelButton:{text:"Revert the Change",callbackFunction(){m.value=e}}})})}let c=exports.lotComments;function u(e){var t,l;const s=Number.parseInt(null!==(l=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotCommentId)&&void 0!==l?l:"",10),a=c.find(e=>e.lotCommentId===s);let i,r;function d(e){e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/lots/doUpdateLotComment`,i,e=>{var t;const o=e;o.success?(c=o.lotComments,r(),v()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(t=o.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lot-editComment",{onshow(e){var t,l,i,r;o.populateAliases(e),e.querySelector("#lotCommentEdit--lotId").value=n,e.querySelector("#lotCommentEdit--lotCommentId").value=s.toString(),e.querySelector("#lotCommentEdit--lotComment").value=null!==(t=a.lotComment)&&void 0!==t?t:"";const d=e.querySelector("#lotCommentEdit--lotCommentDateString");d.value=null!==(l=a.lotCommentDateString)&&void 0!==l?l:"";const m=cityssm.dateToString(new Date);d.max=a.lotCommentDateString<=m?m:null!==(i=a.lotCommentDateString)&&void 0!==i?i:"",e.querySelector("#lotCommentEdit--lotCommentTimeString").value=null!==(r=a.lotCommentTimeString)&&void 0!==r?r:""},onshown(e,t){bulmaJS.toggleHtmlClipped(),o.initializeDatePickers(e),e.querySelector("#lotCommentEdit--lotComment").focus(),(i=e.querySelector("form")).addEventListener("submit",d),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function p(e){var t,l;const s=Number.parseInt(null!==(l=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotCommentId)&&void 0!==l?l:"",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(`${o.urlPrefix}/lots/doDeleteLotComment`,{lotId:n,lotCommentId:s},e=>{var t;const o=e;o.success?(c=o.lotComments,v()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(t=o.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function v(){var e,t,o,n,l,s;const a=document.querySelector("#container--lotComments");if(0===c.length)return void(a.innerHTML='
    \n

    There are no comments to display.

    \n
    ');const i=document.createElement("table");i.className="table is-fullwidth is-striped is-hoverable",i.innerHTML='\n \n \n \n \n \n ';for(const a of c){const r=document.createElement("tr");r.dataset.lotCommentId=null===(e=a.lotCommentId)||void 0===e?void 0:e.toString(),r.innerHTML=``,null===(n=r.querySelector(".button--edit"))||void 0===n||n.addEventListener("click",u),null===(l=r.querySelector(".button--delete"))||void 0===l||l.addEventListener("click",p),null===(s=i.querySelector("tbody"))||void 0===s||s.append(r)}a.innerHTML="",a.append(i)}delete exports.lotComments,l||(null===(t=document.querySelector("#lotComments--add"))||void 0===t||t.addEventListener("click",function(){let e;function t(t){t.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/lots/doAddLotComment`,t.currentTarget,t=>{const o=t;o.success&&(c=o.lotComments,v(),e())})}cityssm.openHtmlModal("lot-addComment",{onshow(e){var l;o.populateAliases(e),e.querySelector("#lotCommentAdd--lotId").value=n,null===(l=e.querySelector("form"))||void 0===l||l.addEventListener("submit",t)},onshown(t,o){bulmaJS.toggleHtmlClipped(),e=o,t.querySelector("#lotCommentAdd--lotComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#lotComments--add").focus()}})}),v())})(); \ No newline at end of file diff --git a/public/javascripts/lotOccupancySearch.min.js b/public/javascripts/lotOccupancySearch.min.js index d24c474b..2012fb23 100644 --- a/public/javascripts/lotOccupancySearch.min.js +++ b/public/javascripts/lotOccupancySearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const a=exports.los,t=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(t){var c,n,l,i,d,p,u,h,y,f,m,v,g;const L=t;if(0===L.lotOccupancies.length)return void(e.innerHTML=`
    \n

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

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

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

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

    There are no ${e.escapedAliases.lots} that meet the search criteria.

    \n
    `);const u=document.createElement("tbody");for(const s of t.lots)u.insertAdjacentHTML("beforeend",'");s.innerHTML=`
    '+cityssm.escapeHTML(null!==(n=s.lotName)&&void 0!==n?n:"")+''+(s.mapName?cityssm.escapeHTML(s.mapName):'(No Name)')+""+cityssm.escapeHTML(null!==(r=s.lotType)&&void 0!==r?r:"")+""+(s.lotStatusId?cityssm.escapeHTML(s.lotStatus):'(No Status)')+"
    "+((null!==(o=s.lotOccupancyCount)&&void 0!==o?o:0)>0?'Currently Occupied':"")+"
    \n \n \n \n \n \n \n
    ${e.escapedAliases.Lot}${e.escapedAliases.Map}${e.escapedAliases.Lot} TypeStatus
    `,s.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(a,t.offset,t.count)),s.querySelector("table").append(u),null===(l=s.querySelector("button[data-page='previous']"))||void 0===l||l.addEventListener("click",c),null===(d=s.querySelector("button[data-page='next']"))||void 0===d||d.addEventListener("click",i)}function o(){s.innerHTML=e.getLoadingParagraphHTML(`Loading ${e.escapedAliases.Lots}...`),cityssm.postJSON(e.urlPrefix+"/lots/doSearchLots",t,r)}function l(){n.value="0",o()}function c(){n.value=Math.max(Number.parseInt(n.value,10)-a,0).toString(),o()}function i(){n.value=(Number.parseInt(n.value,10)+a).toString(),o()}const d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault()}),o()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),n=document.querySelector("#searchFilter--offset");function r(t){var n,r,o,l,d,u,p;const h=t;if(0===h.lots.length)return void(s.innerHTML=`
    \n

    There are no ${e.escapedAliases.lots} that meet the search criteria.

    \n
    `);const m=document.createElement("tbody");for(const t of h.lots)m.insertAdjacentHTML("beforeend",`\n \n `);s.innerHTML=`
    \n \n ${cityssm.escapeHTML(null!==(n=t.lotName)&&void 0!==n?n:"")}\n \n \n \n ${t.mapName?cityssm.escapeHTML(t.mapName):'(No Name)'}\n \n \n ${cityssm.escapeHTML(null!==(r=t.lotType)&&void 0!==r?r:"")}\n \n ${t.lotStatusId?cityssm.escapeHTML(null!==(o=t.lotStatus)&&void 0!==o?o:""):'(No Status)'}
    \n ${(null!==(l=t.lotOccupancyCount)&&void 0!==l?l:0)>0?'Currently Occupied':""}\n
    \n \n \n \n \n \n \n
    ${e.escapedAliases.Lot}${e.escapedAliases.Map}${e.escapedAliases.Lot} TypeStatus
    `,s.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(a,h.offset,h.count)),null===(d=s.querySelector("table"))||void 0===d||d.append(m),null===(u=s.querySelector("button[data-page='previous']"))||void 0===u||u.addEventListener("click",c),null===(p=s.querySelector("button[data-page='next']"))||void 0===p||p.addEventListener("click",i)}function o(){s.innerHTML=e.getLoadingParagraphHTML(`Loading ${e.escapedAliases.Lots}...`),cityssm.postJSON(e.urlPrefix+"/lots/doSearchLots",t,r)}function l(){n.value="0",o()}function c(){n.value=Math.max(Number.parseInt(n.value,10)-a,0).toString(),o()}function i(){n.value=(Number.parseInt(n.value,10)+a).toString(),o()}const d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault()}),o()})(); \ No newline at end of file diff --git a/public/javascripts/mapEdit.min.js b/public/javascripts/mapEdit.min.js index c7ab0ad9..848d9507 100644 --- a/public/javascripts/mapEdit.min.js +++ b/public/javascripts/mapEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const t=exports.los,a=document.querySelector("#map--mapId").value,s=""===a,o=document.querySelector("#form--map");function l(){var e;t.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--map']"))||void 0===e||e.classList.remove("is-light")}o.addEventListener("submit",function(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/maps/"+(s?"doCreateMap":"doUpdateMap"),o,e=>{var a;const o=e;o.success?(function(){var e;t.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--map']"))||void 0===e||e.classList.add("is-light")}(),s?window.location.href=t.getMapURL(o.mapId,!0):bulmaJS.alert({message:t.escapedAliases.Map+" Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating "+t.escapedAliases.Map,message:null!==(a=o.errorMessage)&&void 0!==a?a:"",contextualColorName:"danger"})})});const r=o.querySelectorAll("input, select");for(const e of r)e.addEventListener("change",l);null===(e=document.querySelector("#button--deleteMap"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete "+t.escapedAliases.Map,message:`Are you sure you want to delete this ${t.escapedAliases.map} and all related ${t.escapedAliases.lots}?`,contextualColorName:"warning",okButton:{text:`Yes, Delete ${t.escapedAliases.Map}`,callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/maps/doDeleteMap",{mapId:a},e=>{var a;const s=e;s.success?window.location.href=t.getMapURL():bulmaJS.alert({title:"Error Deleting "+t.escapedAliases.Map,message:null!==(a=s.errorMessage)&&void 0!==a?a:"",contextualColorName:"danger"})})}}})})})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const t=exports.los,a=document.querySelector("#map--mapId").value,s=""===a,o=document.querySelector("#form--map");function l(){var e;t.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--map']"))||void 0===e||e.classList.remove("is-light")}o.addEventListener("submit",function(e){e.preventDefault(),cityssm.postJSON(`${t.urlPrefix}/maps/${s?"doCreateMap":"doUpdateMap"}`,o,e=>{var a;const o=e;o.success?(function(){var e;t.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--map']"))||void 0===e||e.classList.add("is-light")}(),s?window.location.href=t.getMapURL(o.mapId,!0):bulmaJS.alert({message:`${t.escapedAliases.Map} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Updating ${t.escapedAliases.Map}`,message:null!==(a=o.errorMessage)&&void 0!==a?a:"",contextualColorName:"danger"})})});const r=o.querySelectorAll("input, select");for(const e of r)e.addEventListener("change",l);null===(e=document.querySelector("#button--deleteMap"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${t.escapedAliases.Map}`,message:`Are you sure you want to delete this ${t.escapedAliases.map} and all related ${t.escapedAliases.lots}?`,contextualColorName:"warning",okButton:{text:`Yes, Delete ${t.escapedAliases.Map}`,callbackFunction:function(){cityssm.postJSON(`${t.urlPrefix}/maps/doDeleteMap`,{mapId:a},e=>{var a;const s=e;s.success?window.location.href=t.getMapURL():bulmaJS.alert({title:`Error Deleting ${t.escapedAliases.Map}`,message:null!==(a=s.errorMessage)&&void 0!==a?a:"",contextualColorName:"danger"})})}}})})})(); \ No newline at end of file diff --git a/public/javascripts/mapSearch.min.js b/public/javascripts/mapSearch.min.js index 72cac76f..45c3788f 100644 --- a/public/javascripts/mapSearch.min.js +++ b/public/javascripts/mapSearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,a=exports.maps,s=document.querySelector("#searchFilter--map"),t=document.querySelector("#container--searchResults");function i(){var i,d,n,r,o,l,c,p,m,h,u,v,L,f,b;t.innerHTML=e.getLoadingParagraphHTML(`Loading ${e.escapedAliases.Maps}...`);let y=0;const H=document.createElement("tbody"),M=s.value.trim().toLowerCase().split(" ");for(const s of a){const a=`${null!==(i=s.mapName)&&void 0!==i?i:""} ${null!==(d=s.mapDescription)&&void 0!==d?d:""} ${null!==(n=s.mapAddress1)&&void 0!==n?n:""} ${null!==(r=s.mapAddress2)&&void 0!==r?r:""}`.toLowerCase();let t=!0;for(const e of M)if(!a.includes(e)){t=!1;break}t&&(y+=1,H.insertAdjacentHTML("beforeend",'"+``+""))}if(t.innerHTML="",0===y)t.innerHTML=`
    \n

    There are no ${e.escapedAliases.maps} that meet the search criteria.

    \n
    `;else{const a=document.createElement("table");a.className="table is-fullwidth is-striped is-hoverable has-sticky-header",a.innerHTML=`\n \n \n \n \n \n \n `,a.append(H),t.append(a)}}s.addEventListener("keyup",i),document.querySelector("#form--searchFilters").addEventListener("submit",e=>{e.preventDefault(),i()}),i()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const a=exports.los,s=exports.maps,t=document.querySelector("#searchFilter--map"),n=document.querySelector("#container--searchResults");function i(){var e,i,d,l,r,o,c,p,m,u,h,v,$,L,f,b,y;n.innerHTML=a.getLoadingParagraphHTML(`Loading ${a.escapedAliases.Maps}...`);let H=0;const M=document.createElement("tbody"),g=t.value.trim().toLowerCase().split(" ");for(const t of s){const s=`${null!==(e=t.mapName)&&void 0!==e?e:""} ${null!==(i=t.mapDescription)&&void 0!==i?i:""} ${null!==(d=t.mapAddress1)&&void 0!==d?d:""} ${null!==(l=t.mapAddress2)&&void 0!==l?l:""}`.toLowerCase();let n=!0;for(const e of g)if(!s.includes(e)){n=!1;break}n&&(H+=1,M.insertAdjacentHTML("beforeend",`\n \n `))}if(n.innerHTML="",0===H)n.innerHTML=`
    \n

    There are no ${a.escapedAliases.maps} that meet the search criteria.

    \n
    `;else{const e=document.createElement("table");e.className="table is-fullwidth is-striped is-hoverable has-sticky-header",e.innerHTML=`\n \n \n \n \n \n \n `,e.append(M),n.append(e)}}t.addEventListener("keyup",i),null===(e=document.querySelector("#form--searchFilters"))||void 0===e||e.addEventListener("submit",e=>{e.preventDefault(),i()}),i()})(); \ No newline at end of file diff --git a/public/javascripts/workOrderMilestoneCalendar.min.js b/public/javascripts/workOrderMilestoneCalendar.min.js index a091b7c2..825f4707 100644 --- a/public/javascripts/workOrderMilestoneCalendar.min.js +++ b/public/javascripts/workOrderMilestoneCalendar.min.js @@ -1 +1 @@ -"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,n,o,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="x";for(const M of s){u!==M.workOrderMilestoneDateString&&(m&&t.append(m),(m=document.createElement("div")).className="panel",m.innerHTML=`

    \n ${0===M.workOrderMilestoneDate?"No Set Date":M.workOrderMilestoneDateString}\n

    `,u=M.workOrderMilestoneDateString);const s=document.createElement("div");s.className="panel-block is-block",!M.workOrderMilestoneCompletionDate&&""!==M.workOrderMilestoneDateString&&M.workOrderMilestoneDateString\n \n \n \n ${cityssm.escapeHTML(null!==(a=s.lotName)&&void 0!==a?a:"")}\n `;for(const s of M.workOrderLotOccupancies)for(const r of s.lotOccupancyOccupants)f+=`
  • \n \n \n \n ${cityssm.escapeHTML(null!==(n=r.occupantName)&&void 0!==n?n:"")}\n ${cityssm.escapeHTML(null!==(o=r.occupantFamilyName)&&void 0!==o?o:"")}\n
  • `;s.innerHTML='
    '+(M.workOrderMilestoneCompletionDate?'':'')+'
    '+(0===M.workOrderMilestoneTime?"":M.workOrderMilestoneTimePeriodString+"
    ")+(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:"")+'
    '+(""===f?"":'
      '+f+"
    ")+"
    ",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 +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,s=document.querySelector("#form--searchFilters"),n=s.querySelector("#searchFilter--workOrderMilestoneDateFilter"),r=s.querySelector("#searchFilter--workOrderMilestoneDateString"),a=document.querySelector("#container--milestoneCalendar");function i(n){n&&n.preventDefault(),a.innerHTML=e.getLoadingParagraphHTML("Loading Milestones..."),cityssm.postJSON(`${e.urlPrefix}/workOrders/doGetWorkOrderMilestones`,s,s=>{!function(s){var n,r,i,t,l,o,c,d,p,u,m,v,M,f,O;if(0===s.length)return void(a.innerHTML='
    \n

    There are no milestones that meet the search criteria.

    \n
    ');a.innerHTML="";const k=cityssm.dateToString(new Date);let g,w="x";for(const y of s){w!==y.workOrderMilestoneDateString&&(g&&a.append(g),(g=document.createElement("div")).className="panel",g.innerHTML=`

    \n ${cityssm.escapeHTML(0===y.workOrderMilestoneDate?"No Set Date":null!==(n=y.workOrderMilestoneDateString)&&void 0!==n?n:"")}\n

    `,w=null!==(r=y.workOrderMilestoneDateString)&&void 0!==r?r:"");const s=document.createElement("div");s.className="panel-block is-block",!y.workOrderMilestoneCompletionDate&&""!==y.workOrderMilestoneDateString&&y.workOrderMilestoneDateString\n \n \n \n ${cityssm.escapeHTML(null!==(l=s.lotName)&&void 0!==l?l:"")}\n `;for(const s of null!==(o=y.workOrderLotOccupancies)&&void 0!==o?o:[])for(const n of null!==(c=s.lotOccupancyOccupants)&&void 0!==c?c:[])L+=`
  • \n \n \n \n ${cityssm.escapeHTML(null!==(p=n.occupantName)&&void 0!==p?p:"")}\n ${cityssm.escapeHTML(null!==(u=n.occupantFamilyName)&&void 0!==u?u:"")}\n
  • `;s.innerHTML=`
    \n
    \n \n ${y.workOrderMilestoneCompletionDate?'':''}\n \n
    \n ${0===y.workOrderMilestoneTime?"":`${y.workOrderMilestoneTimePeriodString}
    `}\n ${y.workOrderMilestoneTypeId?`${cityssm.escapeHTML(null!==(m=y.workOrderMilestoneType)&&void 0!==m?m:"")}
    `:""}\n \n ${cityssm.escapeHTML(null!==(v=y.workOrderMilestoneDescription)&&void 0!==v?v:"")}\n \n
    \n \n \n ${cityssm.escapeHTML(null!==(f=y.workOrderNumber)&&void 0!==f?f:"")}\n
    \n ${cityssm.escapeHTML(null!==(O=y.workOrderDescription)&&void 0!==O?O:"")}\n
    \n ${""===L?"":'
      '+L+"
    "}
    `,g.append(s)}a.append(g)}(s.workOrderMilestones)})}n.addEventListener("change",()=>{r.closest("fieldset").disabled="date"!==n.value,i()}),e.initializeDatePickers(s),r.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 3ff87664..8f26a6d5 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,n,i,p,u,f,m,h,O,k;const b=s;if(0===b.workOrders.length)return void(a.innerHTML='
    \n

    There are no work orders that meet the search criteria.

    \n
    ');const v=document.createElement("tbody");for(const s of b.workOrders){let a="";for(const t of s.workOrderLots)a+=`
  • \n \n \n \n ${cityssm.escapeHTML(""===(null!==(l=t.lotName)&&void 0!==l?l:"")?"(No "+e.escapedAliases.Lot+" Name)":t.lotName)}\n
  • `;for(const t of s.workOrderLotOccupancies)for(const s of t.lotOccupancyOccupants)a+=`
  • \n \n \n ${cityssm.escapeHTML(""===(null!==(p=s.occupantName)&&void 0!==p?p:"")&&""===(null!==(u=s.occupantFamilyName)&&void 0!==u?u:"")?"(No Name)":s.occupantName+" "+s.occupantFamilyName)}\n
  • `;v.insertAdjacentHTML("beforeend",'
    "+``+""+(t.length>0?'':"")+"")}a.innerHTML=`
    '+cityssm.escapeHTML(""===s.mapName?"(No Name)":s.mapName)+'
    '+cityssm.escapeHTML(null!==(o=s.mapDescription)&&void 0!==o?o:"")+"
    "+(""===(null!==(l=s.mapAddress1)&&void 0!==l?l:"")?"":cityssm.escapeHTML(null!==(c=s.mapAddress1)&&void 0!==c?c:"")+"
    ")+(""===(null!==(p=s.mapAddress2)&&void 0!==p?p:"")?"":cityssm.escapeHTML(null!==(m=s.mapAddress2)&&void 0!==m?m:"")+"
    ")+(s.mapCity||s.mapProvince?cityssm.escapeHTML(null!==(h=s.mapCity)&&void 0!==h?h:"")+", "+cityssm.escapeHTML(null!==(u=s.mapProvince)&&void 0!==u?u:"")+"
    ":"")+(""===(null!==(v=s.mapPostalCode)&&void 0!==v?v:"")?"":cityssm.escapeHTML(null!==(L=s.mapPostalCode)&&void 0!==L?L:""))+"
    "+cityssm.escapeHTML(null!==(f=s.mapPhoneNumber)&&void 0!==f?f:"")+''+(s.mapLatitude&&s.mapLongitude?'':"")+''+(""===(null!==(b=s.mapSVG)&&void 0!==b?b:"")?"":'')+"\n ${s.lotCount}\n
    ${e.escapedAliases.Map}AddressPhone NumberCoordinatesImage${e.escapedAliases.Lot} Count
    \n \n ${cityssm.escapeHTML(""===(null!==(r=t.mapName)&&void 0!==r?r:"")?"(No Name)":null!==(o=t.mapName)&&void 0!==o?o:"")}\n
    \n \n ${cityssm.escapeHTML(null!==(c=t.mapDescription)&&void 0!==c?c:"")}\n \n
    \n ${""===(null!==(p=t.mapAddress1)&&void 0!==p?p:"")?"":`${cityssm.escapeHTML(null!==(m=t.mapAddress1)&&void 0!==m?m:"")}
    `}\n ${""===(null!==(u=t.mapAddress2)&&void 0!==u?u:"")?"":`${cityssm.escapeHTML(null!==(h=t.mapAddress2)&&void 0!==h?h:"")}
    `}\n ${t.mapCity||t.mapProvince?`${cityssm.escapeHTML(null!==(v=t.mapCity)&&void 0!==v?v:"")}, ${cityssm.escapeHTML(null!==($=t.mapProvince)&&void 0!==$?$:"")}
    `:""}\n ${""===(null!==(L=t.mapPostalCode)&&void 0!==L?L:"")?"":cityssm.escapeHTML(null!==(f=t.mapPostalCode)&&void 0!==f?f:"")}\n
    \n ${cityssm.escapeHTML(null!==(b=t.mapPhoneNumber)&&void 0!==b?b:"")}\n \n ${t.mapLatitude&&t.mapLongitude?'\n \n ':""}\n \n ${""===(null!==(y=t.mapSVG)&&void 0!==y?y:"")?"":''}\n \n ${t.lotCount}\n
    ${a.escapedAliases.Map}AddressPhone NumberCoordinatesImage${a.escapedAliases.Lot} Count
    '+(""===s.workOrderNumber.trim()?"(No Number)":cityssm.escapeHTML(null!==(f=s.workOrderNumber)&&void 0!==f?f:""))+"\n ${cityssm.escapeHTML(null!==(m=s.workOrderType)&&void 0!==m?m:"")}
    \n \n ${cityssm.escapeHTML(null!==(h=s.workOrderDescription)&&void 0!==h?h:"")}\n \n
    "+(""===a?"":'
      '+a+"
    ")+'
      '+`
    • \n \n \n \n ${s.workOrderOpenDateString}\n
    • `+'
    • '+(s.workOrderCloseDate?s.workOrderCloseDateString:'(No '+e.escapedAliases.WorkOrderCloseDate+")")+"
    "+(0===s.workOrderMilestoneCount?"-":s.workOrderMilestoneCompletionCount.toString()+" / "+s.workOrderMilestoneCount.toString())+"
    \n \n \n \n \n \n \n ${t.length>0?'':""}\n \n
    Work Order NumberDescriptionRelatedDateProgress
    `,a.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(r,b.offset,b.count)),a.querySelector("table").append(v),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 n(){a.innerHTML=e.getLoadingParagraphHTML("Loading Work Orders..."),cityssm.postJSON(e.urlPrefix+"/workOrders/doSearchWorkOrders",s,l)}function i(){o.value="0",n()}function c(){o.value=Math.max(Number.parseInt(o.value,10)-r,0).toString(),n()}function d(){o.value=(Number.parseInt(o.value,10)+r).toString(),n()}const p=s.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",i);s.addEventListener("submit",e=>{e.preventDefault()}),n()})(); \ 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),n=document.querySelector("#searchFilter--offset");function o(s){var n,o,l,i,u,p,f,m,h,v,O,k,b,w,$,y,g,L,M,N;const T=s;if(0===T.workOrders.length)return void(a.innerHTML='
    \n

    There are no work orders that meet the search criteria.

    \n
    ');const S=document.createElement("tbody");for(const s of T.workOrders){let a="";for(const t of null!==(n=s.workOrderLots)&&void 0!==n?n:[])a+=`
  • \n \n \n \n ${cityssm.escapeHTML(""===(null!==(l=t.lotName)&&void 0!==l?l:"")?`(No ${e.escapedAliases.Lot} Name)`:null!==(i=t.lotName)&&void 0!==i?i:"")}\n
  • `;for(const t of null!==(u=s.workOrderLotOccupancies)&&void 0!==u?u:[])for(const s of null!==(p=t.lotOccupancyOccupants)&&void 0!==p?p:[])a+=`
  • \n \n \n ${cityssm.escapeHTML(""===(null!==(v=s.occupantName)&&void 0!==v?v:"")&&""===(null!==(O=s.occupantFamilyName)&&void 0!==O?O:"")?"(No Name)":`${s.occupantName} ${s.occupantFamilyName}`)}\n
  • `;S.insertAdjacentHTML("beforeend",`\n \n ${t.length>0?``:""}`)}a.innerHTML=`
    \n \n ${""===(null===(k=s.workOrderNumber)||void 0===k?void 0:k.trim())?"(No Number)":cityssm.escapeHTML(null!==(b=s.workOrderNumber)&&void 0!==b?b:"")}\n \n \n ${cityssm.escapeHTML(null!==(w=s.workOrderType)&&void 0!==w?w:"")}
    \n \n ${cityssm.escapeHTML(null!==($=s.workOrderDescription)&&void 0!==$?$:"")}\n \n
    \n ${""===a?"":'
      '+a+"
    "}\n
    \n
      \n
    • \n \n \n \n ${s.workOrderOpenDateString}\n
    • \n
    • \n \n \n \n ${s.workOrderCloseDate?s.workOrderCloseDateString:`(No ${e.escapedAliases.WorkOrderCloseDate})`}\n
    • \n
    \n
    \n ${0===s.workOrderMilestoneCount?"-":(null!==(y=s.workOrderMilestoneCompletionCount)&&void 0!==y?y:"").toString()+" / "+(null!==(g=s.workOrderMilestoneCount)&&void 0!==g?g:"").toString()}\n \n \n \n \n
    \n \n \n \n \n \n \n ${t.length>0?'':""}\n \n
    Work Order NumberDescriptionRelatedDateProgress
    `,a.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(r,T.offset,T.count)),null===(L=a.querySelector("table"))||void 0===L||L.append(S),null===(M=a.querySelector("button[data-page='previous']"))||void 0===M||M.addEventListener("click",c),null===(N=a.querySelector("button[data-page='next']"))||void 0===N||N.addEventListener("click",d)}function l(){a.innerHTML=e.getLoadingParagraphHTML("Loading Work Orders..."),cityssm.postJSON(`${e.urlPrefix}/workOrders/doSearchWorkOrders`,s,o)}function i(){n.value="0",l()}function c(){n.value=Math.max(Number.parseInt(n.value,10)-r,0).toString(),l()}function d(){n.value=(Number.parseInt(n.value,10)+r).toString(),l()}const u=s.querySelectorAll("input, select");for(const e of u)e.addEventListener("change",i);s.addEventListener("submit",e=>{e.preventDefault()}),l()})(); \ No newline at end of file diff --git a/public/javascripts/workOrderView.min.js b/public/javascripts/workOrderView.min.js index 12ff8607..39a3b2b3 100644 --- a/public/javascripts/workOrderView.min.js +++ b/public/javascripts/workOrderView.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,r=document.querySelector("#button--reopenWorkOrder");if(null!==r){const o=r.dataset.workOrderId;r.addEventListener("click",()=>{bulmaJS.confirm({title:"Reopen Work Order",message:"Are you sure you want to remove the close date from this work order and reopen it?",contextualColorName:"warning",okButton:{text:"Yes, Reopen Work Order",callbackFunction:function(){cityssm.postJSON(e.urlPrefix+"/workOrders/doReopenWorkOrder",{workOrderId:o},r=>{var t;const n=r;n.success?window.location.href=e.getWorkOrderURL(o,!0,!0):bulmaJS.alert({title:"Error Reopening Work Order",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})})}})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const r=exports.los,o=document.querySelector("#button--reopenWorkOrder");if(null!==o){const t=null!==(e=o.dataset.workOrderId)&&void 0!==e?e:"";o.addEventListener("click",()=>{bulmaJS.confirm({title:"Reopen Work Order",message:"Are you sure you want to remove the close date from this work order and reopen it?",contextualColorName:"warning",okButton:{text:"Yes, Reopen Work Order",callbackFunction:function(){cityssm.postJSON(`${r.urlPrefix}/workOrders/doReopenWorkOrder`,{workOrderId:t},e=>{var o;const n=e;n.success?window.location.href=r.getWorkOrderURL(t,!0,!0):bulmaJS.alert({title:"Error Reopening Work Order",message:null!==(o=n.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})})}})(); \ No newline at end of file