From 50e6c19b2b3883a330943e06a16d261b13b47d7e Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 25 Jun 2024 11:05:11 -0400 Subject: [PATCH] linting --- public-typescript/lotOccupancyEdit.js | 311 +++++++++--------- .../lotOccupancyEdit/lotOccupancyEdit.js | 3 +- .../lotOccupancyEdit/lotOccupancyEdit.ts | 4 +- .../lotOccupancyEdit/lotOccupancyEditFees.js | 281 ++++++++-------- .../lotOccupancyEdit/lotOccupancyEditFees.ts | 278 ++++++++-------- .../lotOccupancyEditOccupants.js | 27 +- .../lotOccupancyEditOccupants.ts | 47 +-- public/javascripts/lotOccupancyEdit.min.js | 2 +- tsconfig.client.json | 3 +- 9 files changed, 476 insertions(+), 480 deletions(-) diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js index 6c7854c8..fdadf934 100644 --- a/public-typescript/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit.js @@ -311,9 +311,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotSelectCloseModalFunction(); } function selectExistingLot(clickEvent) { + var _a, _b; clickEvent.preventDefault(); const selectedLotElement = clickEvent.currentTarget; - renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName); + renderSelectedLotAndClose((_a = selectedLotElement.dataset.lotId) !== null && _a !== void 0 ? _a : '', (_b = selectedLotElement.dataset.lotName) !== null && _b !== void 0 ? _b : ''); } function searchLots() { // eslint-disable-next-line no-unsanitized/property @@ -478,14 +479,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); * Occupants */ "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 */ var _a; Object.defineProperty(exports, "__esModule", { value: true }); let lotOccupancyOccupants = exports.lotOccupancyOccupants; delete exports.lotOccupancyOccupants; function openEditLotOccupancyOccupant(clickEvent) { - const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .lotOccupantIndex, 10); + var _a, _b; + const lotOccupantIndex = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.lotOccupantIndex) !== null && _b !== void 0 ? _b : '', 10); const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => { return currentLotOccupancyOccupant.lotOccupantIndex === lotOccupantIndex; }); @@ -493,7 +495,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); let editCloseModalFunction; function editOccupant(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`, editFormElement, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -503,7 +505,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); } else { bulmaJS.alert({ - title: 'Error Updating ' + los.escapedAliases.Occupant, + title: `Error Updating ${los.escapedAliases.Occupant}`, message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); @@ -544,7 +546,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); optionElement.selected = true; lotOccupantTypeSelectElement.append(optionElement); } - modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = ``; + modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = + ``; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1; @@ -568,7 +571,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); var _a, _b; const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset .fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user'; - modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = ``; + modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = + ``; let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset .occupantCommentTitle) !== null && _b !== void 0 ? _b : ''; if (occupantCommentTitle === '') { @@ -644,9 +648,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotOccupancyOccupant.lotOccupantIndex.toString(); tableRowElement.innerHTML = '' + - cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === '' + cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && + ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === '' ? '(No Name)' - : lotOccupancyOccupant.occupantName + ' ' + lotOccupancyOccupant.occupantFamilyName) + + : lotOccupancyOccupant.occupantName + + ' ' + + lotOccupancyOccupant.occupantFamilyName) + '
' + ('' + '`; + modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML = + ``; let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset .occupantCommentTitle) !== null && _b !== void 0 ? _b : ''; if (occupantCommentTitle === '') { @@ -1086,6 +1094,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); renderLotOccupancyComments(); "use strict"; + // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair /* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); let lotOccupancyFees = exports.lotOccupancyFees; @@ -1101,15 +1110,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); return feeGrandTotal; } function editLotOccupancyFeeQuantity(clickEvent) { - const feeId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .feeId, 10); + var _a, _b; + const feeId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.feeId) !== null && _b !== void 0 ? _b : '', 10); const fee = lotOccupancyFees.find((possibleFee) => { return possibleFee.feeId === feeId; }); let updateCloseModalFunction; function doUpdateQuantity(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity', formEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`, formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyFees = responseJSON.lotOccupancyFees; @@ -1127,11 +1136,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); } cityssm.openHtmlModal('lotOccupancy-editFeeQuantity', { onshow(modalElement) { + var _a, _b; ; modalElement.querySelector('#lotOccupancyFeeQuantity--lotOccupancyId').value = lotOccupancyId; modalElement.querySelector('#lotOccupancyFeeQuantity--feeId').value = fee.feeId.toString(); - modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = fee.quantity; - modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit; + modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = (_a = fee.quantity) !== null && _a !== void 0 ? _a : 0; + modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = (_b = fee.quantityUnit) !== null && _b !== void 0 ? _b : ''; }, onshown(modalElement, closeModalFunction) { var _a; @@ -1149,7 +1159,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); function deleteLotOccupancyFee(clickEvent) { const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId; function doDelete() { - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`, { lotOccupancyId, feeId }, (rawResponseJSON) => { @@ -1179,7 +1189,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function renderLotOccupancyFees() { - var _a, _b, _c, _d, _e, _f, _g; + var _a, _b, _c, _d, _e, _f, _g, _h, _j; if (lotOccupancyFees.length === 0) { lotOccupancyFeesContainerElement.innerHTML = `

There are no fees associated with this record.

@@ -1187,6 +1197,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); renderLotOccupancyTransactions(); return; } + // eslint-disable-next-line no-secrets/no-secrets lotOccupancyFeesContainerElement.innerHTML = ` @@ -1219,45 +1230,41 @@ Object.defineProperty(exports, "__esModule", { value: true }); tableRowElement.dataset.feeId = lotOccupancyFee.feeId.toString(); tableRowElement.dataset.includeQuantity = ((_a = lotOccupancyFee.includeQuantity) !== null && _a !== void 0 ? _a : false) ? '1' : '0'; - tableRowElement.innerHTML = - '' + - (lotOccupancyFee.quantity === 1 - ? '' - : '' + - '' + - '' + - '') + - '' + - (''); - (_e = tableRowElement - .querySelector('.button--editQuantity')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyFeeQuantity); - (_f = tableRowElement - .querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyFee); - (_g = lotOccupancyFeesContainerElement - .querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement); + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ` + ${lotOccupancyFee.quantity === 1 + ? '' + : ` + + + `} + + `; + (_g = tableRowElement + .querySelector('.button--editQuantity')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', editLotOccupancyFeeQuantity); + (_h = tableRowElement + .querySelector('.button--delete')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', deleteLotOccupancyFee); + (_j = lotOccupancyFeesContainerElement + .querySelector('tbody')) === null || _j === void 0 ? void 0 : _j.append(tableRowElement); feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity; taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity; } @@ -1280,7 +1287,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); let feeFilterElement; let feeFilterResultsElement; function doAddFee(feeId, quantity = 1) { - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`, { lotOccupancyId, feeId, quantity @@ -1311,30 +1318,31 @@ Object.defineProperty(exports, "__esModule", { value: true }); } cityssm.openHtmlModal('lotOccupancy-setFeeQuantity', { onshow(modalElement) { + var _a; ; - modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit; + modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = (_a = fee.quantityUnit) !== null && _a !== void 0 ? _a : ''; }, onshown(modalElement, closeModalFunction) { + var _a; quantityCloseModalFunction = closeModalFunction; quantityElement = modalElement.querySelector('#lotOccupancyFeeQuantity--quantity'); - modalElement - .querySelector('form') - .addEventListener('submit', doSetQuantity); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doSetQuantity); } }); } function tryAddFee(clickEvent) { - var _a; + var _a, _b, _c; clickEvent.preventDefault(); - const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10); - const feeCategoryId = Number.parseInt(clickEvent.currentTarget.dataset.feeCategoryId, 10); + const feeId = Number.parseInt((_a = clickEvent.currentTarget.dataset.feeId) !== null && _a !== void 0 ? _a : '', 10); + const feeCategoryId = Number.parseInt((_b = clickEvent.currentTarget.dataset.feeCategoryId) !== null && _b !== void 0 ? _b : '', 10); const feeCategory = feeCategories.find((currentFeeCategory) => { return currentFeeCategory.feeCategoryId === feeCategoryId; }); const fee = feeCategory.fees.find((currentFee) => { return currentFee.feeId === feeId; }); - if ((_a = fee.includeQuantity) !== null && _a !== void 0 ? _a : false) { + if ((_c = fee.includeQuantity) !== null && _c !== void 0 ? _c : false) { doSetQuantityAndAddFee(fee); } else { @@ -1353,11 +1361,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); categoryContainerElement.className = 'container--feeCategory'; categoryContainerElement.dataset.feeCategoryId = feeCategory.feeCategoryId.toString(); - categoryContainerElement.innerHTML = - '

' + - cityssm.escapeHTML((_a = feeCategory.feeCategory) !== null && _a !== void 0 ? _a : '') + - '

' + - '
'; + categoryContainerElement.innerHTML = `

${cityssm.escapeHTML((_a = feeCategory.feeCategory) !== null && _a !== void 0 ? _a : '')}

+
`; let hasFees = false; for (const fee of feeCategory.fees) { // Don't include already applied fees that limit quantity @@ -1365,11 +1370,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); continue; } let includeFee = true; - const feeSearchString = (((_b = feeCategory.feeCategory) !== null && _b !== void 0 ? _b : '') + - ' ' + - ((_c = fee.feeName) !== null && _c !== void 0 ? _c : '') + - ' ' + - ((_d = fee.feeDescription) !== null && _d !== void 0 ? _d : '')).toLowerCase(); + const feeSearchString = `${(_b = feeCategory.feeCategory) !== null && _b !== void 0 ? _b : ''} ${(_c = fee.feeName) !== null && _c !== void 0 ? _c : ''} ${(_d = fee.feeDescription) !== null && _d !== void 0 ? _d : ''}`.toLowerCase(); for (const filterStringPiece of filterStringPieces) { if (!feeSearchString.includes(filterStringPiece)) { includeFee = false; @@ -1386,15 +1387,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); panelBlockElement.dataset.feeCategoryId = feeCategory.feeCategoryId.toString(); panelBlockElement.href = '#'; - panelBlockElement.innerHTML = - '' + - cityssm.escapeHTML((_e = fee.feeName) !== null && _e !== void 0 ? _e : '') + - '
' + - '' + - cityssm - .escapeHTML((_f = fee.feeDescription) !== null && _f !== void 0 ? _f : '') - .replace(/\n/g, '
') + - '
'; + // eslint-disable-next-line no-unsanitized/property + panelBlockElement.innerHTML = `${cityssm.escapeHTML((_e = fee.feeName) !== null && _e !== void 0 ? _e : '')}
+ + ${cityssm + .escapeHTML((_f = fee.feeDescription) !== null && _f !== void 0 ? _f : '') + .replaceAll('\n', '
')} +
`; panelBlockElement.addEventListener('click', tryAddFee); categoryContainerElement.querySelector('.panel').append(panelBlockElement); } @@ -1407,7 +1406,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); onshow(modalElement) { feeFilterElement = modalElement.querySelector('#feeSelect--feeName'); feeFilterResultsElement = modalElement.querySelector('#resultsContainer--feeSelect'); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetFees', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetFees`, { lotOccupancyId }, (rawResponseJSON) => { const responseJSON = rawResponseJSON; @@ -1441,15 +1440,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); return transactionGrandTotal; } function editLotOccupancyTransaction(clickEvent) { - const transactionIndex = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .transactionIndex, 10); + var _a, _b; + const transactionIndex = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.transactionIndex) !== null && _b !== void 0 ? _b : '', 10); const transaction = lotOccupancyTransactions.find((possibleTransaction) => { return possibleTransaction.transactionIndex === transactionIndex; }); let editCloseModalFunction; function doEdit(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyTransaction', formEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`, formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyTransactions = responseJSON.lotOccupancyTransactions; @@ -1467,15 +1466,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); } cityssm.openHtmlModal('lotOccupancy-editTransaction', { onshow(modalElement) { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f; los.populateAliases(modalElement); modalElement.querySelector('#lotOccupancyTransactionEdit--lotOccupancyId').value = lotOccupancyId; - modalElement.querySelector('#lotOccupancyTransactionEdit--transactionIndex').value = transaction.transactionIndex.toString(); + modalElement.querySelector('#lotOccupancyTransactionEdit--transactionIndex').value = (_b = (_a = transaction.transactionIndex) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; modalElement.querySelector('#lotOccupancyTransactionEdit--transactionAmount').value = transaction.transactionAmount.toFixed(2); - modalElement.querySelector('#lotOccupancyTransactionEdit--externalReceiptNumber').value = (_a = transaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : ''; - modalElement.querySelector('#lotOccupancyTransactionEdit--transactionNote').value = (_b = transaction.transactionNote) !== null && _b !== void 0 ? _b : ''; - modalElement.querySelector('#lotOccupancyTransactionEdit--transactionDateString').value = (_c = transaction.transactionDateString) !== null && _c !== void 0 ? _c : ''; - modalElement.querySelector('#lotOccupancyTransactionEdit--transactionTimeString').value = (_d = transaction.transactionTimeString) !== null && _d !== void 0 ? _d : ''; + modalElement.querySelector('#lotOccupancyTransactionEdit--externalReceiptNumber').value = (_c = transaction.externalReceiptNumber) !== null && _c !== void 0 ? _c : ''; + modalElement.querySelector('#lotOccupancyTransactionEdit--transactionNote').value = (_d = transaction.transactionNote) !== null && _d !== void 0 ? _d : ''; + modalElement.querySelector('#lotOccupancyTransactionEdit--transactionDateString').value = (_e = transaction.transactionDateString) !== null && _e !== void 0 ? _e : ''; + modalElement.querySelector('#lotOccupancyTransactionEdit--transactionTimeString').value = (_f = transaction.transactionTimeString) !== null && _f !== void 0 ? _f : ''; }, onshown(modalElement, closeModalFunction) { var _a; @@ -1493,7 +1492,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); function deleteLotOccupancyTransaction(clickEvent) { const transactionIndex = clickEvent.currentTarget.closest('.container--lotOccupancyTransaction').dataset.transactionIndex; function doDelete() { - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`, { lotOccupancyId, transactionIndex }, (rawResponseJSON) => { @@ -1523,16 +1522,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function renderLotOccupancyTransactions() { - var _a, _b, _c, _d, _e; + var _a, _b, _c, _d, _e, _f, _g; if (lotOccupancyTransactions.length === 0) { - lotOccupancyTransactionsContainerElement.innerHTML = - '
' + - '

There are no transactions associated with this record.

' + - '
'; + // eslint-disable-next-line no-unsanitized/property + lotOccupancyTransactionsContainerElement.innerHTML = `
+

There are no transactions associated with this record.

+
`; return; } + // eslint-disable-next-line no-unsanitized/property lotOccupancyTransactionsContainerElement.innerHTML = `
Fee' + - cityssm.escapeHTML((_b = lotOccupancyFee.feeName) !== null && _b !== void 0 ? _b : '') + - '
' + - '' + - cityssm.escapeHTML((_c = lotOccupancyFee.feeCategory) !== null && _c !== void 0 ? _c : '') + - '' + - '
$' + - lotOccupancyFee.feeAmount.toFixed(2) + - '×' + - lotOccupancyFee.quantity.toString() + - '=$' + - (lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2) + - '' + - '
' + - (((_d = lotOccupancyFee.includeQuantity) !== null && _d !== void 0 ? _d : false) - ? '' - : '') + - '' + - '
' + - '
+ ${cityssm.escapeHTML((_b = lotOccupancyFee.feeName) !== null && _b !== void 0 ? _b : '')}
+ ${cityssm.escapeHTML((_c = lotOccupancyFee.feeCategory) !== null && _c !== void 0 ? _c : '')} +
+ $${(_d = lotOccupancyFee.feeAmount) === null || _d === void 0 ? void 0 : _d.toFixed(2)} + ×${(_e = lotOccupancyFee.quantity) === null || _e === void 0 ? void 0 : _e.toString()}= + $${(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2)} + +
+ ${((_f = lotOccupancyFee.includeQuantity) !== null && _f !== void 0 ? _f : false) + ? `` + : ''} + +
+
@@ -1553,10 +1551,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tableRowElement = document.createElement('tr'); tableRowElement.className = 'container--lotOccupancyTransaction'; tableRowElement.dataset.transactionIndex = - lotOccupancyTransaction.transactionIndex.toString(); + (_a = lotOccupancyTransaction.transactionIndex) === null || _a === void 0 ? void 0 : _a.toString(); let externalReceiptNumberHTML = ''; if (lotOccupancyTransaction.externalReceiptNumber !== '') { - externalReceiptNumberHTML = cityssm.escapeHTML((_a = lotOccupancyTransaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : ''); + externalReceiptNumberHTML = cityssm.escapeHTML((_b = lotOccupancyTransaction.externalReceiptNumber) !== null && _b !== void 0 ? _b : ''); if (los.dynamicsGPIntegrationIsEnabled) { if (lotOccupancyTransaction.dynamicsGPDocument === undefined) { externalReceiptNumberHTML += ` @@ -1576,52 +1574,50 @@ Object.defineProperty(exports, "__esModule", { value: true }); } externalReceiptNumberHTML += '
'; } - tableRowElement.innerHTML = - '
' + - ('') + - ('') + - (''); - (_d = tableRowElement - .querySelector('.button--edit')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', editLotOccupancyTransaction); + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ` + + + `; (_e = tableRowElement - .querySelector('.button--delete')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancyTransaction); - lotOccupancyTransactionsContainerElement - .querySelector('tbody') - .append(tableRowElement); + .querySelector('.button--edit')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyTransaction); + (_f = tableRowElement + .querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyTransaction); + (_g = lotOccupancyTransactionsContainerElement + .querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement); } ; lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = '$' + transactionGrandTotal.toFixed(2); const feeGrandTotal = getFeeGrandTotal(); if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) { - lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', '
' + - '
' + - '
' + - '
Outstanding Balance
' + - '
$' + - (feeGrandTotal - transactionGrandTotal).toFixed(2) + - '
' + - '
' + - '
' + - '
'); + lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `
+
+
+
+
Outstanding Balance
+
+
+
$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}
+
+
+
`); } } const addTransactionButtonElement = document.querySelector('#button--addTransaction'); @@ -1631,7 +1627,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); let addCloseModalFunction; function doAddTransaction(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', submitEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`, submitEvent.currentTarget, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -1650,19 +1646,18 @@ Object.defineProperty(exports, "__esModule", { value: true }); } // eslint-disable-next-line @typescript-eslint/naming-convention function dynamicsGP_refreshExternalReceiptNumberIcon() { + var _a, _b; const externalReceiptNumber = externalReceiptNumberElement.value; - const iconElement = externalReceiptNumberElement - .closest('.control') - .querySelector('.icon'); - const helpTextElement = externalReceiptNumberElement - .closest('.field') - .querySelector('.help'); + const iconElement = (_a = externalReceiptNumberElement + .closest('.control')) === null || _a === void 0 ? void 0 : _a.querySelector('.icon'); + const helpTextElement = (_b = externalReceiptNumberElement + .closest('.field')) === null || _b === void 0 ? void 0 : _b.querySelector('.help'); if (externalReceiptNumber === '') { helpTextElement.innerHTML = ' '; iconElement.innerHTML = ''; return; } - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`, { externalReceiptNumber }, (rawResponseJSON) => { const responseJSON = rawResponseJSON; @@ -1698,7 +1693,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); transactionAmountElement.max = Math.max(feeGrandTotal - transactionGrandTotal, 0).toFixed(2); transactionAmountElement.value = Math.max(feeGrandTotal - transactionGrandTotal, 0).toFixed(2); if (los.dynamicsGPIntegrationIsEnabled) { - externalReceiptNumberElement = modalElement.querySelector('#lotOccupancyTransactionAdd--externalReceiptNumber'); + externalReceiptNumberElement = modalElement.querySelector( + // eslint-disable-next-line no-secrets/no-secrets + '#lotOccupancyTransactionAdd--externalReceiptNumber'); const externalReceiptNumberControlElement = externalReceiptNumberElement.closest('.control'); externalReceiptNumberControlElement.classList.add('has-icons-right'); externalReceiptNumberControlElement.insertAdjacentHTML('beforeend', ''); @@ -1709,12 +1706,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); } }, onshown(modalElement, closeModalFunction) { + var _a; bulmaJS.toggleHtmlClipped(); transactionAmountElement.focus(); addCloseModalFunction = closeModalFunction; - modalElement - .querySelector('form') - .addEventListener('submit', doAddTransaction); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAddTransaction); }, onremoved() { bulmaJS.toggleHtmlClipped(); diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js index 0f608fd8..e797949f 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js @@ -311,9 +311,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotSelectCloseModalFunction(); } function selectExistingLot(clickEvent) { + var _a, _b; clickEvent.preventDefault(); const selectedLotElement = clickEvent.currentTarget; - renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName); + renderSelectedLotAndClose((_a = selectedLotElement.dataset.lotId) !== null && _a !== void 0 ? _a : '', (_b = selectedLotElement.dataset.lotName) !== null && _b !== void 0 ? _b : ''); } function searchLots() { // eslint-disable-next-line no-unsanitized/property diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts index 371888dd..5dc17ab2 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts @@ -474,8 +474,8 @@ declare const exports: Record const selectedLotElement = clickEvent.currentTarget as HTMLElement renderSelectedLotAndClose( - selectedLotElement.dataset.lotId!, - selectedLotElement.dataset.lotName! + selectedLotElement.dataset.lotId ?? '', + selectedLotElement.dataset.lotName ?? '' ) } diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js index 5eee2b44..a7db8242 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js @@ -1,4 +1,5 @@ "use strict"; +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair /* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); let lotOccupancyFees = exports.lotOccupancyFees; @@ -14,15 +15,15 @@ function getFeeGrandTotal() { return feeGrandTotal; } function editLotOccupancyFeeQuantity(clickEvent) { - const feeId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .feeId, 10); + var _a, _b; + const feeId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.feeId) !== null && _b !== void 0 ? _b : '', 10); const fee = lotOccupancyFees.find((possibleFee) => { return possibleFee.feeId === feeId; }); let updateCloseModalFunction; function doUpdateQuantity(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity', formEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`, formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyFees = responseJSON.lotOccupancyFees; @@ -40,11 +41,12 @@ function editLotOccupancyFeeQuantity(clickEvent) { } cityssm.openHtmlModal('lotOccupancy-editFeeQuantity', { onshow(modalElement) { + var _a, _b; ; modalElement.querySelector('#lotOccupancyFeeQuantity--lotOccupancyId').value = lotOccupancyId; modalElement.querySelector('#lotOccupancyFeeQuantity--feeId').value = fee.feeId.toString(); - modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = fee.quantity; - modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit; + modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = (_a = fee.quantity) !== null && _a !== void 0 ? _a : 0; + modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = (_b = fee.quantityUnit) !== null && _b !== void 0 ? _b : ''; }, onshown(modalElement, closeModalFunction) { var _a; @@ -62,7 +64,7 @@ function editLotOccupancyFeeQuantity(clickEvent) { function deleteLotOccupancyFee(clickEvent) { const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId; function doDelete() { - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`, { lotOccupancyId, feeId }, (rawResponseJSON) => { @@ -92,7 +94,7 @@ function deleteLotOccupancyFee(clickEvent) { }); } function renderLotOccupancyFees() { - var _a, _b, _c, _d, _e, _f, _g; + var _a, _b, _c, _d, _e, _f, _g, _h, _j; if (lotOccupancyFees.length === 0) { lotOccupancyFeesContainerElement.innerHTML = `

There are no fees associated with this record.

@@ -100,6 +102,7 @@ function renderLotOccupancyFees() { renderLotOccupancyTransactions(); return; } + // eslint-disable-next-line no-secrets/no-secrets lotOccupancyFeesContainerElement.innerHTML = `
Date' + - ((_b = lotOccupancyTransaction.transactionDateString) !== null && _b !== void 0 ? _b : '') + - '' + - externalReceiptNumberHTML + - '' + - cityssm.escapeHTML((_c = lotOccupancyTransaction.transactionNote) !== null && _c !== void 0 ? _c : '') + - '' + - '$' + - lotOccupancyTransaction.transactionAmount.toFixed(2) + - '' + - '
' + - '' + - '' + - '
' + - '
+ ${cityssm.escapeHTML((_c = lotOccupancyTransaction.transactionDateString) !== null && _c !== void 0 ? _c : '')} + + ${externalReceiptNumberHTML} + ${cityssm.escapeHTML((_d = lotOccupancyTransaction.transactionNote) !== null && _d !== void 0 ? _d : '')} + + $${cityssm.escapeHTML(lotOccupancyTransaction.transactionAmount.toFixed(2))} + +
+ + +
+
@@ -132,45 +135,41 @@ function renderLotOccupancyFees() { tableRowElement.dataset.feeId = lotOccupancyFee.feeId.toString(); tableRowElement.dataset.includeQuantity = ((_a = lotOccupancyFee.includeQuantity) !== null && _a !== void 0 ? _a : false) ? '1' : '0'; - tableRowElement.innerHTML = - '' + - (lotOccupancyFee.quantity === 1 - ? '' - : '' + - '' + - '' + - '') + - '' + - (''); - (_e = tableRowElement - .querySelector('.button--editQuantity')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyFeeQuantity); - (_f = tableRowElement - .querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyFee); - (_g = lotOccupancyFeesContainerElement - .querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement); + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ` + ${lotOccupancyFee.quantity === 1 + ? '' + : ` + + + `} + + `; + (_g = tableRowElement + .querySelector('.button--editQuantity')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', editLotOccupancyFeeQuantity); + (_h = tableRowElement + .querySelector('.button--delete')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', deleteLotOccupancyFee); + (_j = lotOccupancyFeesContainerElement + .querySelector('tbody')) === null || _j === void 0 ? void 0 : _j.append(tableRowElement); feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity; taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity; } @@ -193,7 +192,7 @@ addFeeButtonElement.addEventListener('click', () => { let feeFilterElement; let feeFilterResultsElement; function doAddFee(feeId, quantity = 1) { - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`, { lotOccupancyId, feeId, quantity @@ -224,30 +223,31 @@ addFeeButtonElement.addEventListener('click', () => { } cityssm.openHtmlModal('lotOccupancy-setFeeQuantity', { onshow(modalElement) { + var _a; ; - modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit; + modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = (_a = fee.quantityUnit) !== null && _a !== void 0 ? _a : ''; }, onshown(modalElement, closeModalFunction) { + var _a; quantityCloseModalFunction = closeModalFunction; quantityElement = modalElement.querySelector('#lotOccupancyFeeQuantity--quantity'); - modalElement - .querySelector('form') - .addEventListener('submit', doSetQuantity); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doSetQuantity); } }); } function tryAddFee(clickEvent) { - var _a; + var _a, _b, _c; clickEvent.preventDefault(); - const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10); - const feeCategoryId = Number.parseInt(clickEvent.currentTarget.dataset.feeCategoryId, 10); + const feeId = Number.parseInt((_a = clickEvent.currentTarget.dataset.feeId) !== null && _a !== void 0 ? _a : '', 10); + const feeCategoryId = Number.parseInt((_b = clickEvent.currentTarget.dataset.feeCategoryId) !== null && _b !== void 0 ? _b : '', 10); const feeCategory = feeCategories.find((currentFeeCategory) => { return currentFeeCategory.feeCategoryId === feeCategoryId; }); const fee = feeCategory.fees.find((currentFee) => { return currentFee.feeId === feeId; }); - if ((_a = fee.includeQuantity) !== null && _a !== void 0 ? _a : false) { + if ((_c = fee.includeQuantity) !== null && _c !== void 0 ? _c : false) { doSetQuantityAndAddFee(fee); } else { @@ -266,11 +266,8 @@ addFeeButtonElement.addEventListener('click', () => { categoryContainerElement.className = 'container--feeCategory'; categoryContainerElement.dataset.feeCategoryId = feeCategory.feeCategoryId.toString(); - categoryContainerElement.innerHTML = - '

' + - cityssm.escapeHTML((_a = feeCategory.feeCategory) !== null && _a !== void 0 ? _a : '') + - '

' + - '
'; + categoryContainerElement.innerHTML = `

${cityssm.escapeHTML((_a = feeCategory.feeCategory) !== null && _a !== void 0 ? _a : '')}

+
`; let hasFees = false; for (const fee of feeCategory.fees) { // Don't include already applied fees that limit quantity @@ -278,11 +275,7 @@ addFeeButtonElement.addEventListener('click', () => { continue; } let includeFee = true; - const feeSearchString = (((_b = feeCategory.feeCategory) !== null && _b !== void 0 ? _b : '') + - ' ' + - ((_c = fee.feeName) !== null && _c !== void 0 ? _c : '') + - ' ' + - ((_d = fee.feeDescription) !== null && _d !== void 0 ? _d : '')).toLowerCase(); + const feeSearchString = `${(_b = feeCategory.feeCategory) !== null && _b !== void 0 ? _b : ''} ${(_c = fee.feeName) !== null && _c !== void 0 ? _c : ''} ${(_d = fee.feeDescription) !== null && _d !== void 0 ? _d : ''}`.toLowerCase(); for (const filterStringPiece of filterStringPieces) { if (!feeSearchString.includes(filterStringPiece)) { includeFee = false; @@ -299,15 +292,13 @@ addFeeButtonElement.addEventListener('click', () => { panelBlockElement.dataset.feeCategoryId = feeCategory.feeCategoryId.toString(); panelBlockElement.href = '#'; - panelBlockElement.innerHTML = - '' + - cityssm.escapeHTML((_e = fee.feeName) !== null && _e !== void 0 ? _e : '') + - '
' + - '' + - cityssm - .escapeHTML((_f = fee.feeDescription) !== null && _f !== void 0 ? _f : '') - .replace(/\n/g, '
') + - '
'; + // eslint-disable-next-line no-unsanitized/property + panelBlockElement.innerHTML = `${cityssm.escapeHTML((_e = fee.feeName) !== null && _e !== void 0 ? _e : '')}
+ + ${cityssm + .escapeHTML((_f = fee.feeDescription) !== null && _f !== void 0 ? _f : '') + .replaceAll('\n', '
')} +
`; panelBlockElement.addEventListener('click', tryAddFee); categoryContainerElement.querySelector('.panel').append(panelBlockElement); } @@ -320,7 +311,7 @@ addFeeButtonElement.addEventListener('click', () => { onshow(modalElement) { feeFilterElement = modalElement.querySelector('#feeSelect--feeName'); feeFilterResultsElement = modalElement.querySelector('#resultsContainer--feeSelect'); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetFees', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetFees`, { lotOccupancyId }, (rawResponseJSON) => { const responseJSON = rawResponseJSON; @@ -354,15 +345,15 @@ function getTransactionGrandTotal() { return transactionGrandTotal; } function editLotOccupancyTransaction(clickEvent) { - const transactionIndex = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .transactionIndex, 10); + var _a, _b; + const transactionIndex = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.transactionIndex) !== null && _b !== void 0 ? _b : '', 10); const transaction = lotOccupancyTransactions.find((possibleTransaction) => { return possibleTransaction.transactionIndex === transactionIndex; }); let editCloseModalFunction; function doEdit(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyTransaction', formEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`, formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyTransactions = responseJSON.lotOccupancyTransactions; @@ -380,15 +371,15 @@ function editLotOccupancyTransaction(clickEvent) { } cityssm.openHtmlModal('lotOccupancy-editTransaction', { onshow(modalElement) { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f; los.populateAliases(modalElement); modalElement.querySelector('#lotOccupancyTransactionEdit--lotOccupancyId').value = lotOccupancyId; - modalElement.querySelector('#lotOccupancyTransactionEdit--transactionIndex').value = transaction.transactionIndex.toString(); + modalElement.querySelector('#lotOccupancyTransactionEdit--transactionIndex').value = (_b = (_a = transaction.transactionIndex) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; modalElement.querySelector('#lotOccupancyTransactionEdit--transactionAmount').value = transaction.transactionAmount.toFixed(2); - modalElement.querySelector('#lotOccupancyTransactionEdit--externalReceiptNumber').value = (_a = transaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : ''; - modalElement.querySelector('#lotOccupancyTransactionEdit--transactionNote').value = (_b = transaction.transactionNote) !== null && _b !== void 0 ? _b : ''; - modalElement.querySelector('#lotOccupancyTransactionEdit--transactionDateString').value = (_c = transaction.transactionDateString) !== null && _c !== void 0 ? _c : ''; - modalElement.querySelector('#lotOccupancyTransactionEdit--transactionTimeString').value = (_d = transaction.transactionTimeString) !== null && _d !== void 0 ? _d : ''; + modalElement.querySelector('#lotOccupancyTransactionEdit--externalReceiptNumber').value = (_c = transaction.externalReceiptNumber) !== null && _c !== void 0 ? _c : ''; + modalElement.querySelector('#lotOccupancyTransactionEdit--transactionNote').value = (_d = transaction.transactionNote) !== null && _d !== void 0 ? _d : ''; + modalElement.querySelector('#lotOccupancyTransactionEdit--transactionDateString').value = (_e = transaction.transactionDateString) !== null && _e !== void 0 ? _e : ''; + modalElement.querySelector('#lotOccupancyTransactionEdit--transactionTimeString').value = (_f = transaction.transactionTimeString) !== null && _f !== void 0 ? _f : ''; }, onshown(modalElement, closeModalFunction) { var _a; @@ -406,7 +397,7 @@ function editLotOccupancyTransaction(clickEvent) { function deleteLotOccupancyTransaction(clickEvent) { const transactionIndex = clickEvent.currentTarget.closest('.container--lotOccupancyTransaction').dataset.transactionIndex; function doDelete() { - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`, { lotOccupancyId, transactionIndex }, (rawResponseJSON) => { @@ -436,16 +427,15 @@ function deleteLotOccupancyTransaction(clickEvent) { }); } function renderLotOccupancyTransactions() { - var _a, _b, _c, _d, _e; + var _a, _b, _c, _d, _e, _f, _g; if (lotOccupancyTransactions.length === 0) { - lotOccupancyTransactionsContainerElement.innerHTML = - '
' + - '

There are no transactions associated with this record.

' + - '
'; + // eslint-disable-next-line no-unsanitized/property + lotOccupancyTransactionsContainerElement.innerHTML = `
+

There are no transactions associated with this record.

+
`; return; } + // eslint-disable-next-line no-unsanitized/property lotOccupancyTransactionsContainerElement.innerHTML = `
Fee' + - cityssm.escapeHTML((_b = lotOccupancyFee.feeName) !== null && _b !== void 0 ? _b : '') + - '
' + - '' + - cityssm.escapeHTML((_c = lotOccupancyFee.feeCategory) !== null && _c !== void 0 ? _c : '') + - '' + - '
$' + - lotOccupancyFee.feeAmount.toFixed(2) + - '×' + - lotOccupancyFee.quantity.toString() + - '=$' + - (lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2) + - '' + - '
' + - (((_d = lotOccupancyFee.includeQuantity) !== null && _d !== void 0 ? _d : false) - ? '' - : '') + - '' + - '
' + - '
+ ${cityssm.escapeHTML((_b = lotOccupancyFee.feeName) !== null && _b !== void 0 ? _b : '')}
+ ${cityssm.escapeHTML((_c = lotOccupancyFee.feeCategory) !== null && _c !== void 0 ? _c : '')} +
+ $${(_d = lotOccupancyFee.feeAmount) === null || _d === void 0 ? void 0 : _d.toFixed(2)} + ×${(_e = lotOccupancyFee.quantity) === null || _e === void 0 ? void 0 : _e.toString()}= + $${(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2)} + +
+ ${((_f = lotOccupancyFee.includeQuantity) !== null && _f !== void 0 ? _f : false) + ? `` + : ''} + +
+
@@ -466,10 +456,10 @@ function renderLotOccupancyTransactions() { const tableRowElement = document.createElement('tr'); tableRowElement.className = 'container--lotOccupancyTransaction'; tableRowElement.dataset.transactionIndex = - lotOccupancyTransaction.transactionIndex.toString(); + (_a = lotOccupancyTransaction.transactionIndex) === null || _a === void 0 ? void 0 : _a.toString(); let externalReceiptNumberHTML = ''; if (lotOccupancyTransaction.externalReceiptNumber !== '') { - externalReceiptNumberHTML = cityssm.escapeHTML((_a = lotOccupancyTransaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : ''); + externalReceiptNumberHTML = cityssm.escapeHTML((_b = lotOccupancyTransaction.externalReceiptNumber) !== null && _b !== void 0 ? _b : ''); if (los.dynamicsGPIntegrationIsEnabled) { if (lotOccupancyTransaction.dynamicsGPDocument === undefined) { externalReceiptNumberHTML += ` @@ -489,52 +479,50 @@ function renderLotOccupancyTransactions() { } externalReceiptNumberHTML += '
'; } - tableRowElement.innerHTML = - '
' + - ('') + - ('') + - (''); - (_d = tableRowElement - .querySelector('.button--edit')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', editLotOccupancyTransaction); + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ` + + + `; (_e = tableRowElement - .querySelector('.button--delete')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancyTransaction); - lotOccupancyTransactionsContainerElement - .querySelector('tbody') - .append(tableRowElement); + .querySelector('.button--edit')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyTransaction); + (_f = tableRowElement + .querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyTransaction); + (_g = lotOccupancyTransactionsContainerElement + .querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement); } ; lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = '$' + transactionGrandTotal.toFixed(2); const feeGrandTotal = getFeeGrandTotal(); if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) { - lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', '
' + - '
' + - '
' + - '
Outstanding Balance
' + - '
$' + - (feeGrandTotal - transactionGrandTotal).toFixed(2) + - '
' + - '
' + - '
' + - '
'); + lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `
+
+
+
+
Outstanding Balance
+
+
+
$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}
+
+
+
`); } } const addTransactionButtonElement = document.querySelector('#button--addTransaction'); @@ -544,7 +532,7 @@ addTransactionButtonElement.addEventListener('click', () => { let addCloseModalFunction; function doAddTransaction(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', submitEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`, submitEvent.currentTarget, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -563,19 +551,18 @@ addTransactionButtonElement.addEventListener('click', () => { } // eslint-disable-next-line @typescript-eslint/naming-convention function dynamicsGP_refreshExternalReceiptNumberIcon() { + var _a, _b; const externalReceiptNumber = externalReceiptNumberElement.value; - const iconElement = externalReceiptNumberElement - .closest('.control') - .querySelector('.icon'); - const helpTextElement = externalReceiptNumberElement - .closest('.field') - .querySelector('.help'); + const iconElement = (_a = externalReceiptNumberElement + .closest('.control')) === null || _a === void 0 ? void 0 : _a.querySelector('.icon'); + const helpTextElement = (_b = externalReceiptNumberElement + .closest('.field')) === null || _b === void 0 ? void 0 : _b.querySelector('.help'); if (externalReceiptNumber === '') { helpTextElement.innerHTML = ' '; iconElement.innerHTML = ''; return; } - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`, { externalReceiptNumber }, (rawResponseJSON) => { const responseJSON = rawResponseJSON; @@ -611,7 +598,9 @@ addTransactionButtonElement.addEventListener('click', () => { transactionAmountElement.max = Math.max(feeGrandTotal - transactionGrandTotal, 0).toFixed(2); transactionAmountElement.value = Math.max(feeGrandTotal - transactionGrandTotal, 0).toFixed(2); if (los.dynamicsGPIntegrationIsEnabled) { - externalReceiptNumberElement = modalElement.querySelector('#lotOccupancyTransactionAdd--externalReceiptNumber'); + externalReceiptNumberElement = modalElement.querySelector( + // eslint-disable-next-line no-secrets/no-secrets + '#lotOccupancyTransactionAdd--externalReceiptNumber'); const externalReceiptNumberControlElement = externalReceiptNumberElement.closest('.control'); externalReceiptNumberControlElement.classList.add('has-icons-right'); externalReceiptNumberControlElement.insertAdjacentHTML('beforeend', ''); @@ -622,12 +611,12 @@ addTransactionButtonElement.addEventListener('click', () => { } }, onshown(modalElement, closeModalFunction) { + var _a; bulmaJS.toggleHtmlClipped(); transactionAmountElement.focus(); addCloseModalFunction = closeModalFunction; - modalElement - .querySelector('form') - .addEventListener('submit', doAddTransaction); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAddTransaction); }, onremoved() { bulmaJS.toggleHtmlClipped(); diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts index 4f66f66b..b5b8cc53 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.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' -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 * as globalTypes from '../../types/globalTypes.js' +import type * as recordTypes from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS @@ -14,7 +14,9 @@ declare const los: globalTypes.LOS declare const lotOccupancyId: string -let lotOccupancyFees: recordTypes.LotOccupancyFee[] = exports.lotOccupancyFees +declare const exports: Record + +let lotOccupancyFees = exports.lotOccupancyFees as recordTypes.LotOccupancyFee[] delete exports.lotOccupancyFees const lotOccupancyFeesContainerElement = document.querySelector( @@ -35,8 +37,8 @@ function getFeeGrandTotal(): number { function editLotOccupancyFeeQuantity(clickEvent: Event): void { const feeId = Number.parseInt( - (clickEvent.currentTarget as HTMLButtonElement).closest('tr')!.dataset - .feeId!, + (clickEvent.currentTarget as HTMLButtonElement).closest('tr')?.dataset + .feeId ?? '', 10 ) const fee = lotOccupancyFees.find((possibleFee) => { @@ -49,7 +51,7 @@ function editLotOccupancyFeeQuantity(clickEvent: Event): void { formEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity', + `${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`, formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { @@ -88,12 +90,12 @@ function editLotOccupancyFeeQuantity(clickEvent: Event): void { modalElement.querySelector( '#lotOccupancyFeeQuantity--quantity' ) as HTMLInputElement - ).valueAsNumber = fee.quantity! + ).valueAsNumber = fee.quantity ?? 0 ;( modalElement.querySelector( '#lotOccupancyFeeQuantity--quantityUnit' ) as HTMLElement - ).textContent = fee.quantityUnit! + ).textContent = fee.quantityUnit ?? '' }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped() @@ -124,7 +126,7 @@ function deleteLotOccupancyFee(clickEvent: Event): void { function doDelete(): void { cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', + `${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`, { lotOccupancyId, feeId @@ -133,11 +135,11 @@ function deleteLotOccupancyFee(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyFees?: recordTypes.LotOccupancyFee[] + lotOccupancyFees: recordTypes.LotOccupancyFee[] } if (responseJSON.success) { - lotOccupancyFees = responseJSON.lotOccupancyFees! + lotOccupancyFees = responseJSON.lotOccupancyFees renderLotOccupancyFees() } else { bulmaJS.alert({ @@ -172,6 +174,7 @@ function renderLotOccupancyFees(): void { return } + // eslint-disable-next-line no-secrets/no-secrets lotOccupancyFeesContainerElement.innerHTML = `
Date' + - ((_b = lotOccupancyTransaction.transactionDateString) !== null && _b !== void 0 ? _b : '') + - '' + - externalReceiptNumberHTML + - '' + - cityssm.escapeHTML((_c = lotOccupancyTransaction.transactionNote) !== null && _c !== void 0 ? _c : '') + - '' + - '$' + - lotOccupancyTransaction.transactionAmount.toFixed(2) + - '' + - '
' + - '' + - '' + - '
' + - '
+ ${cityssm.escapeHTML((_c = lotOccupancyTransaction.transactionDateString) !== null && _c !== void 0 ? _c : '')} + + ${externalReceiptNumberHTML} + ${cityssm.escapeHTML((_d = lotOccupancyTransaction.transactionNote) !== null && _d !== void 0 ? _d : '')} + + $${cityssm.escapeHTML(lotOccupancyTransaction.transactionAmount.toFixed(2))} + +
+ + +
+
@@ -207,39 +210,39 @@ function renderLotOccupancyFees(): void { tableRowElement.dataset.includeQuantity = lotOccupancyFee.includeQuantity ?? false ? '1' : '0' - tableRowElement.innerHTML = - '' + - (lotOccupancyFee.quantity === 1 - ? '' - : '' + - '' + - '' + - '') + - '' + - ('') + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ` + ${ + lotOccupancyFee.quantity === 1 + ? '' + : ` + + + ` + } + + ` tableRowElement .querySelector('.button--editQuantity') @@ -296,7 +299,7 @@ addFeeButtonElement.addEventListener('click', () => { function doAddFee(feeId: number, quantity: number | string = 1): void { cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', + `${los.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`, { lotOccupancyId, feeId, @@ -306,11 +309,11 @@ addFeeButtonElement.addEventListener('click', () => { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyFees?: recordTypes.LotOccupancyFee[] + lotOccupancyFees: recordTypes.LotOccupancyFee[] } if (responseJSON.success) { - lotOccupancyFees = responseJSON.lotOccupancyFees! + lotOccupancyFees = responseJSON.lotOccupancyFees renderLotOccupancyFees() filterFees() } else { @@ -340,7 +343,7 @@ addFeeButtonElement.addEventListener('click', () => { modalElement.querySelector( '#lotOccupancyFeeQuantity--quantityUnit' ) as HTMLElement - ).textContent = fee.quantityUnit! + ).textContent = fee.quantityUnit ?? '' }, onshown(modalElement, closeModalFunction) { quantityCloseModalFunction = closeModalFunction @@ -350,8 +353,8 @@ addFeeButtonElement.addEventListener('click', () => { ) as HTMLInputElement modalElement - .querySelector('form')! - .addEventListener('submit', doSetQuantity) + .querySelector('form') + ?.addEventListener('submit', doSetQuantity) } }) } @@ -360,11 +363,11 @@ addFeeButtonElement.addEventListener('click', () => { clickEvent.preventDefault() const feeId = Number.parseInt( - (clickEvent.currentTarget as HTMLElement).dataset.feeId!, + (clickEvent.currentTarget as HTMLElement).dataset.feeId ?? '', 10 ) const feeCategoryId = Number.parseInt( - (clickEvent.currentTarget as HTMLElement).dataset.feeCategoryId!, + (clickEvent.currentTarget as HTMLElement).dataset.feeCategoryId ?? '', 10 ) @@ -399,11 +402,8 @@ addFeeButtonElement.addEventListener('click', () => { categoryContainerElement.dataset.feeCategoryId = feeCategory.feeCategoryId.toString() - categoryContainerElement.innerHTML = - '

' + - cityssm.escapeHTML(feeCategory.feeCategory ?? '') + - '

' + - '
' + categoryContainerElement.innerHTML = `

${cityssm.escapeHTML(feeCategory.feeCategory ?? '')}

+
` let hasFees = false @@ -419,13 +419,8 @@ addFeeButtonElement.addEventListener('click', () => { let includeFee = true - const feeSearchString = ( - (feeCategory.feeCategory ?? '') + - ' ' + - (fee.feeName ?? '') + - ' ' + - (fee.feeDescription ?? '') - ).toLowerCase() + const feeSearchString = + `${feeCategory.feeCategory ?? ''} ${fee.feeName ?? ''} ${fee.feeDescription ?? ''}`.toLowerCase() for (const filterStringPiece of filterStringPieces) { if (!feeSearchString.includes(filterStringPiece)) { @@ -447,15 +442,13 @@ addFeeButtonElement.addEventListener('click', () => { feeCategory.feeCategoryId.toString() panelBlockElement.href = '#' - panelBlockElement.innerHTML = - '' + - cityssm.escapeHTML(fee.feeName ?? '') + - '
' + - '' + - cityssm + // eslint-disable-next-line no-unsanitized/property + panelBlockElement.innerHTML = `${cityssm.escapeHTML(fee.feeName ?? '')}
+ + ${cityssm .escapeHTML(fee.feeDescription ?? '') - .replace(/\n/g, '
') + - '
' + .replaceAll('\n', '
')} +
` panelBlockElement.addEventListener('click', tryAddFee) ;( @@ -471,14 +464,16 @@ addFeeButtonElement.addEventListener('click', () => { cityssm.openHtmlModal('lotOccupancy-addFee', { onshow(modalElement) { - feeFilterElement = modalElement.querySelector('#feeSelect--feeName')! + feeFilterElement = modalElement.querySelector( + '#feeSelect--feeName' + ) as HTMLInputElement feeFilterResultsElement = modalElement.querySelector( '#resultsContainer--feeSelect' - )! + ) as HTMLElement cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doGetFees', + `${los.urlPrefix}/lotOccupancies/doGetFees`, { lotOccupancyId }, @@ -510,8 +505,8 @@ addFeeButtonElement.addEventListener('click', () => { }) }) -let lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[] = - exports.lotOccupancyTransactions +let lotOccupancyTransactions = + exports.lotOccupancyTransactions as recordTypes.LotOccupancyTransaction[] delete exports.lotOccupancyTransactions const lotOccupancyTransactionsContainerElement = document.querySelector( @@ -530,8 +525,8 @@ function getTransactionGrandTotal(): number { function editLotOccupancyTransaction(clickEvent: Event): void { const transactionIndex = Number.parseInt( - (clickEvent.currentTarget as HTMLButtonElement).closest('tr')!.dataset - .transactionIndex!, + (clickEvent.currentTarget as HTMLButtonElement).closest('tr')?.dataset + .transactionIndex ?? '', 10 ) @@ -545,7 +540,7 @@ function editLotOccupancyTransaction(clickEvent: Event): void { formEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyTransaction', + `${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`, formEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { @@ -580,7 +575,7 @@ function editLotOccupancyTransaction(clickEvent: Event): void { modalElement.querySelector( '#lotOccupancyTransactionEdit--transactionIndex' ) as HTMLInputElement - ).value = transaction.transactionIndex!.toString() + ).value = transaction.transactionIndex?.toString() ?? '' ;( modalElement.querySelector( '#lotOccupancyTransactionEdit--transactionAmount' @@ -636,7 +631,7 @@ function deleteLotOccupancyTransaction(clickEvent: Event): void { function doDelete(): void { cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', + `${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`, { lotOccupancyId, transactionIndex @@ -645,11 +640,11 @@ function deleteLotOccupancyTransaction(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyTransactions?: recordTypes.LotOccupancyTransaction[] + lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[] } if (responseJSON.success) { - lotOccupancyTransactions = responseJSON.lotOccupancyTransactions! + lotOccupancyTransactions = responseJSON.lotOccupancyTransactions renderLotOccupancyTransactions() } else { bulmaJS.alert({ @@ -675,16 +670,15 @@ function deleteLotOccupancyTransaction(clickEvent: Event): void { function renderLotOccupancyTransactions(): void { if (lotOccupancyTransactions.length === 0) { - lotOccupancyTransactionsContainerElement.innerHTML = - '
' + - '

There are no transactions associated with this record.

' + - '
' + // eslint-disable-next-line no-unsanitized/property + lotOccupancyTransactionsContainerElement.innerHTML = `
+

There are no transactions associated with this record.

+
` return } + // eslint-disable-next-line no-unsanitized/property lotOccupancyTransactionsContainerElement.innerHTML = `
Fee' + - cityssm.escapeHTML(lotOccupancyFee.feeName ?? '') + - '
' + - '' + - cityssm.escapeHTML(lotOccupancyFee.feeCategory ?? '') + - '' + - '
$' + - lotOccupancyFee.feeAmount!.toFixed(2) + - '×' + - lotOccupancyFee.quantity!.toString() + - '=$' + - (lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!).toFixed(2) + - '' + - '
' + - (lotOccupancyFee.includeQuantity ?? false - ? '' - : '') + - '' + - '
' + - '
+ ${cityssm.escapeHTML(lotOccupancyFee.feeName ?? '')}
+ ${cityssm.escapeHTML(lotOccupancyFee.feeCategory ?? '')} +
+ $${lotOccupancyFee.feeAmount?.toFixed(2)} + ×${lotOccupancyFee.quantity?.toString()}= + $${(lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!).toFixed(2)} + +
+ ${ + lotOccupancyFee.includeQuantity ?? false + ? `` + : '' + } + +
+
@@ -708,7 +702,7 @@ function renderLotOccupancyTransactions(): void { const tableRowElement = document.createElement('tr') tableRowElement.className = 'container--lotOccupancyTransaction' tableRowElement.dataset.transactionIndex = - lotOccupancyTransaction.transactionIndex!.toString() + lotOccupancyTransaction.transactionIndex?.toString() let externalReceiptNumberHTML = '' @@ -744,30 +738,28 @@ function renderLotOccupancyTransactions(): void { externalReceiptNumberHTML += '
' } - tableRowElement.innerHTML = - '' + - ('') + - ('') + - ('') + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ` + + + ` tableRowElement .querySelector('.button--edit') @@ -778,8 +770,8 @@ function renderLotOccupancyTransactions(): void { ?.addEventListener('click', deleteLotOccupancyTransaction) lotOccupancyTransactionsContainerElement - .querySelector('tbody')! - .append(tableRowElement) + .querySelector('tbody') + ?.append(tableRowElement) } ;( @@ -793,16 +785,17 @@ function renderLotOccupancyTransactions(): void { if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) { lotOccupancyTransactionsContainerElement.insertAdjacentHTML( 'afterbegin', - '
' + - '
' + - '
' + - '
Outstanding Balance
' + - '
$' + - (feeGrandTotal - transactionGrandTotal).toFixed(2) + - '
' + - '
' + - '
' + - '
' + `
+
+
+
+
Outstanding Balance
+
+
+
$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}
+
+
+
` ) } } @@ -821,17 +814,17 @@ addTransactionButtonElement.addEventListener('click', () => { submitEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', + `${los.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`, submitEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyTransactions?: recordTypes.LotOccupancyTransaction[] + lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[] } if (responseJSON.success) { - lotOccupancyTransactions = responseJSON.lotOccupancyTransactions! + lotOccupancyTransactions = responseJSON.lotOccupancyTransactions addCloseModalFunction() renderLotOccupancyTransactions() } else { @@ -850,12 +843,12 @@ addTransactionButtonElement.addEventListener('click', () => { const externalReceiptNumber = externalReceiptNumberElement.value const iconElement = externalReceiptNumberElement - .closest('.control')! - .querySelector('.icon') as HTMLElement + .closest('.control') + ?.querySelector('.icon') as HTMLElement const helpTextElement = externalReceiptNumberElement - .closest('.field')! - .querySelector('.help') as HTMLElement + .closest('.field') + ?.querySelector('.help') as HTMLElement if (externalReceiptNumber === '') { helpTextElement.innerHTML = ' ' @@ -864,7 +857,7 @@ addTransactionButtonElement.addEventListener('click', () => { } cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument', + `${los.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`, { externalReceiptNumber }, @@ -929,11 +922,12 @@ addTransactionButtonElement.addEventListener('click', () => { if (los.dynamicsGPIntegrationIsEnabled) { externalReceiptNumberElement = modalElement.querySelector( + // eslint-disable-next-line no-secrets/no-secrets '#lotOccupancyTransactionAdd--externalReceiptNumber' - )! + ) as HTMLInputElement const externalReceiptNumberControlElement = - externalReceiptNumberElement.closest('.control')! + externalReceiptNumberElement.closest('.control') as HTMLElement externalReceiptNumberControlElement.classList.add('has-icons-right') @@ -968,8 +962,8 @@ addTransactionButtonElement.addEventListener('click', () => { addCloseModalFunction = closeModalFunction modalElement - .querySelector('form')! - .addEventListener('submit', doAddTransaction) + .querySelector('form') + ?.addEventListener('submit', doAddTransaction) }, onremoved() { bulmaJS.toggleHtmlClipped() diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js index c44b7ed6..9a3d1636 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js @@ -1,12 +1,13 @@ "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 */ var _a; Object.defineProperty(exports, "__esModule", { value: true }); let lotOccupancyOccupants = exports.lotOccupancyOccupants; delete exports.lotOccupancyOccupants; function openEditLotOccupancyOccupant(clickEvent) { - const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .lotOccupantIndex, 10); + var _a, _b; + const lotOccupantIndex = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.lotOccupantIndex) !== null && _b !== void 0 ? _b : '', 10); const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => { return currentLotOccupancyOccupant.lotOccupantIndex === lotOccupantIndex; }); @@ -14,7 +15,7 @@ function openEditLotOccupancyOccupant(clickEvent) { let editCloseModalFunction; function editOccupant(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`, editFormElement, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -24,7 +25,7 @@ function openEditLotOccupancyOccupant(clickEvent) { } else { bulmaJS.alert({ - title: 'Error Updating ' + los.escapedAliases.Occupant, + title: `Error Updating ${los.escapedAliases.Occupant}`, message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); @@ -65,7 +66,8 @@ function openEditLotOccupancyOccupant(clickEvent) { optionElement.selected = true; lotOccupantTypeSelectElement.append(optionElement); } - modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = ``; + modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = + ``; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1; @@ -89,7 +91,8 @@ function openEditLotOccupancyOccupant(clickEvent) { var _a, _b; const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset .fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user'; - modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = ``; + modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = + ``; let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset .occupantCommentTitle) !== null && _b !== void 0 ? _b : ''; if (occupantCommentTitle === '') { @@ -165,9 +168,12 @@ function renderLotOccupancyOccupants() { lotOccupancyOccupant.lotOccupantIndex.toString(); tableRowElement.innerHTML = '\n \n \n \n \n \n \n `;for(const o of f){const p=document.createElement("tr");p.dataset.lotOccupantIndex=o.lotOccupantIndex.toString(),p.innerHTML="',p.querySelector(".button--edit").addEventListener("click",O),p.querySelector(".button--delete").addEventListener("click",g),m.querySelector("tbody").append(p)}p.append(m)}if(delete exports.lotOccupancyOccupants,l){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{var t;const n=d.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const t of n)t.disabled=""===e.value;let c=null!==(t=e.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),d.querySelector("#lotOccupancy--occupantCommentTitle").textContent=c})}else h();if(null===(S=document.querySelector("#button--addOccupant"))||void 0===S||S.addEventListener("click",()=>{let e,t,n,c;function a(t){cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doAddLotOccupancyOccupant",t,t=>{var n;const c=t;c.success?(f=c.lotOccupancyOccupants,e(),h()):bulmaJS.alert({title:`Error Adding ${o.escapedAliases.Occupant}`,message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function l(e){e.preventDefault(),a(t)}let r=[];function i(e){e.preventDefault();const t=e.currentTarget,n=r[Number.parseInt(t.dataset.index,10)],c=t.closest(".modal").querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId").value;""===c?bulmaJS.alert({title:`No ${o.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${o.escapedAliases.occupant}.`,contextualColorName:"warning"}):(n.lotOccupantTypeId=Number.parseInt(c,10),n.lotOccupancyId=Number.parseInt(s,10),a(n))}function u(e){e.preventDefault(),""!==n.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(c.innerHTML=o.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doSearchPastOccupants",n,e=>{var t,n,a,o,s,l,u,d,p;r=e.occupants;const m=document.createElement("div");m.className="panel";for(const[e,c]of r.entries()){const r=document.createElement("a");r.className="panel-block is-block",r.dataset.index=e.toString(),r.innerHTML=""+cityssm.escapeHTML(null!==(t=c.occupantName)&&void 0!==t?t:"")+" "+cityssm.escapeHTML(null!==(n=c.occupantFamilyName)&&void 0!==n?n:"")+'
'+cityssm.escapeHTML(null!==(a=c.occupantAddress1)&&void 0!==a?a:"")+"
"+(""===(null!==(o=c.occupantAddress2)&&void 0!==o?o:"")?"":cityssm.escapeHTML(c.occupantAddress2)+"
")+cityssm.escapeHTML(null!==(s=c.occupantCity)&&void 0!==s?s:"")+", "+cityssm.escapeHTML(null!==(l=c.occupantProvince)&&void 0!==l?l:"")+"
"+cityssm.escapeHTML(null!==(u=c.occupantPostalCode)&&void 0!==u?u:"")+'
'+(""===(null!==(d=c.occupantPhoneNumber)&&void 0!==d?d:"")?"":cityssm.escapeHTML(c.occupantPhoneNumber)+"
")+cityssm.escapeHTML(null!==(p=c.occupantEmailAddress)&&void 0!==p?p:"")+"
",r.addEventListener("click",i),m.append(r)}c.innerHTML="",c.append(m)})):c.innerHTML='

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

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

There are no comments associated with this record.

\n
');const u=document.createElement("table");u.className="table is-fullwidth is-striped is-hoverable",u.innerHTML='\n \n \n \n \n \n ';for(const i of e){const e=document.createElement("tr");e.dataset.lotOccupancyCommentId=null===(t=i.lotOccupancyCommentId)||void 0===t?void 0:t.toString(),e.innerHTML=`\n \n \n `,null===(s=e.querySelector(".button--edit"))||void 0===s||s.addEventListener("click",b),null===(l=e.querySelector(".button--delete"))||void 0===l||l.addEventListener("click",C),null===(r=u.querySelector("tbody"))||void 0===r||r.append(e)}i.innerHTML="",i.append(u)}delete exports.lotOccupancyComments,null===(S=document.querySelector("#button--addComment"))||void 0===S||S.addEventListener("click",()=>{let t,n;function c(c){c.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/lotOccupancies/doAddLotOccupancyComment`,t,t=>{var c;const a=t;a.success?(e=a.lotOccupancyComments,n(),T()):bulmaJS.alert({title:"Error Adding Comment",message:null!==(c=a.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addComment",{onshow(e){o.populateAliases(e),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyId").value=s},onshown(e,a){bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyComment").focus(),(t=e.querySelector("form")).addEventListener("submit",c),n=a},onremoved:()=>{bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addComment").focus()}})}),T(),Object.defineProperty(exports,"__esModule",{value:!0});let t=exports.lotOccupancyFees;delete exports.lotOccupancyFees;const n=document.querySelector("#container--lotOccupancyFees");function x(){let e=0;for(const n of t)e+=(n.feeAmount+n.taxAmount)*n.quantity;return e}function L(e){const n=Number.parseInt(e.currentTarget.closest("tr").dataset.feeId,10),c=t.find(e=>e.feeId===n);let a;function l(e){e.preventDefault(),cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyFeeQuantity",e.currentTarget,e=>{const n=e;n.success?(t=n.lotOccupancyFees,N(),a()):bulmaJS.alert({title:"Error Updating Quantity",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editFeeQuantity",{onshow(e){e.querySelector("#lotOccupancyFeeQuantity--lotOccupancyId").value=s,e.querySelector("#lotOccupancyFeeQuantity--feeId").value=c.feeId.toString(),e.querySelector("#lotOccupancyFeeQuantity--quantity").valueAsNumber=c.quantity,e.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=c.quantityUnit},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),a=t,e.querySelector("#lotOccupancyFeeQuantity--quantity").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",l)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function q(e){const n=e.currentTarget.closest(".container--lotOccupancyFee").dataset.feeId;bulmaJS.confirm({title:"Delete Fee",message:"Are you sure you want to delete this fee?",contextualColorName:"warning",okButton:{text:"Yes, Delete Fee",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyFee",{lotOccupancyId:s,feeId:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N()):bulmaJS.alert({title:"Error Deleting Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}}})}function N(){var e,c,a,o,s,l,r;if(0===t.length)return n.innerHTML='
\n

There are no fees associated with this record.

\n
',void M();n.innerHTML='
Date' + - (lotOccupancyTransaction.transactionDateString ?? '') + - '' + - externalReceiptNumberHTML + - '' + - cityssm.escapeHTML(lotOccupancyTransaction.transactionNote ?? '') + - '' + - '$' + - lotOccupancyTransaction.transactionAmount.toFixed(2) + - '' + - '
' + - '' + - '' + - '
' + - '
+ ${cityssm.escapeHTML(lotOccupancyTransaction.transactionDateString ?? '')} + + ${externalReceiptNumberHTML} + ${cityssm.escapeHTML(lotOccupancyTransaction.transactionNote ?? '')} + + $${cityssm.escapeHTML(lotOccupancyTransaction.transactionAmount.toFixed(2))} + +
+ + +
+
' + - cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === '' + cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && + ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === '' ? '(No Name)' - : lotOccupancyOccupant.occupantName + ' ' + lotOccupancyOccupant.occupantFamilyName) + + : lotOccupancyOccupant.occupantName + + ' ' + + lotOccupancyOccupant.occupantFamilyName) + '
' + ('' + '`; + modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML = + ``; let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset .occupantCommentTitle) !== null && _b !== void 0 ? _b : ''; if (occupantCommentTitle === '') { diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts index a8030eeb..ffa0e34d 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts @@ -1,11 +1,11 @@ -/* 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 * as globalTypes from '../../types/globalTypes.js' +import type * as recordTypes from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS @@ -16,14 +16,17 @@ declare const lotOccupancyId: string declare const isCreate: boolean declare const formElement: HTMLFormElement -let lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] = - exports.lotOccupancyOccupants +declare const exports: Record + +let lotOccupancyOccupants = + exports.lotOccupancyOccupants as recordTypes.LotOccupancyOccupant[] + delete exports.lotOccupancyOccupants function openEditLotOccupancyOccupant(clickEvent: Event): void { const lotOccupantIndex = Number.parseInt( - (clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset - .lotOccupantIndex!, + (clickEvent.currentTarget as HTMLElement).closest('tr')?.dataset + .lotOccupantIndex ?? '', 10 ) @@ -40,22 +43,22 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { submitEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', + `${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`, editFormElement, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyOccupants?: recordTypes.LotOccupancyOccupant[] + lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] } if (responseJSON.success) { - lotOccupancyOccupants = responseJSON.lotOccupancyOccupants! + lotOccupancyOccupants = responseJSON.lotOccupancyOccupants editCloseModalFunction() renderLotOccupancyOccupants() } else { bulmaJS.alert({ - title: 'Error Updating ' + los.escapedAliases.Occupant, + title: `Error Updating ${los.escapedAliases.Occupant}`, message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) @@ -125,7 +128,8 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { modalElement.querySelector( '#lotOccupancyOccupantEdit--fontAwesomeIconClass' - )!.innerHTML = `` + )!.innerHTML = + `` ;( modalElement.querySelector( '#lotOccupancyOccupantEdit--occupantName' @@ -201,7 +205,8 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { modalElement.querySelector( '#lotOccupancyOccupantEdit--fontAwesomeIconClass' - )!.innerHTML = `` + )!.innerHTML = + `` let occupantCommentTitle = lotOccupantTypeIdElement.selectedOptions[0].dataset @@ -307,9 +312,12 @@ function renderLotOccupancyOccupants(): void { tableRowElement.innerHTML = '
' + cityssm.escapeHTML( - (lotOccupancyOccupant.occupantName ?? '') === '' && (lotOccupancyOccupant.occupantFamilyName ?? '') === '' + (lotOccupancyOccupant.occupantName ?? '') === '' && + (lotOccupancyOccupant.occupantFamilyName ?? '') === '' ? '(No Name)' - : lotOccupancyOccupant.occupantName! + ' ' + lotOccupancyOccupant.occupantFamilyName! + : lotOccupancyOccupant.occupantName! + + ' ' + + lotOccupancyOccupant.occupantFamilyName! ) + '
' + ('' + @@ -630,7 +638,8 @@ document modalElement.querySelector( '#lotOccupancyOccupantAdd--fontAwesomeIconClass' - )!.innerHTML = `` + )!.innerHTML = + `` let occupantCommentTitle = lotOccupantTypeIdElement.selectedOptions[0].dataset diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js index 74255ee7..c30b68e7 100644 --- a/public/javascripts/lotOccupancyEdit.min.js +++ b/public/javascripts/lotOccupancyEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,n,c,a;const o=exports.los,s=document.querySelector("#lotOccupancy--lotOccupancyId").value,l=""===s;let r=l;function i(){var e;o.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.remove("is-light")}function u(){var e;o.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.add("is-light")}const d=document.querySelector("#form--lotOccupancy");d.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/lotOccupancies/${l?"doCreateLotOccupancy":"doUpdateLotOccupancy"}`,d,e=>{var t;const n=e;n.success?(u(),l||r?window.location.href=o.getLotOccupancyURL(n.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${o.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Saving ${o.escapedAliases.Occupancy}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const p=d.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",i);function m(){cityssm.postJSON(`${o.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,{lotOccupancyId:s},e=>{var t;const n=e;n.success?(u(),window.location.href=o.getLotOccupancyURL(n.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(S=document.querySelector("#button--copyLotOccupancy"))||void 0===S||S.addEventListener("click",e=>{e.preventDefault(),o.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${o.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:m}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${o.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`,{lotOccupancyId:s},e=>{var t;const n=e;n.success?(u(),window.location.href=o.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function n(e){e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/doCreateWorkOrder`,e.currentTarget,e=>{const n=e;n.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=o.getWorkOrderURL(n.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:n.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=s,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const n=e.querySelector("#workOrderCreate--workOrderTypeId"),c=exports.workOrderTypes;1===c.length&&(n.innerHTML="");for(const e of c){const c=document.createElement("option");c.value=e.workOrderTypeId.toString(),c.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",n.append(c)}},onshown(e,c){var a;t=c,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(a=e.querySelector("form"))||void 0===a||a.addEventListener("submit",n)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const y=document.querySelector("#lotOccupancy--occupancyTypeId");if(l){const e=document.querySelector("#container--lotOccupancyFields");y.addEventListener("change",()=>{""!==y.value?cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doGetOccupancyTypeFields",{occupancyTypeId:y.value},t=>{var n,c;const a=t;if(0===a.occupancyTypeFields.length)return void(e.innerHTML=`
\n

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

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

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

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

No results.

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

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

\n
`);const m=document.createElement("table");m.className="table is-fullwidth is-striped is-hoverable",m.innerHTML=`
${o.escapedAliases.Occupant}AddressOther ContactCommentOptions
"+cityssm.escapeHTML(""===(null!==(e=o.occupantName)&&void 0!==e?e:"")&&""===(null!==(t=o.occupantFamilyName)&&void 0!==t?t:"")?"(No Name)":o.occupantName+" "+o.occupantFamilyName)+'
'+cityssm.escapeHTML(o.lotOccupantType)+"
"+(""===(null!==(n=o.occupantAddress1)&&void 0!==n?n:"")?"":cityssm.escapeHTML(o.occupantAddress1)+"
")+(""===(null!==(c=o.occupantAddress2)&&void 0!==c?c:"")?"":cityssm.escapeHTML(o.occupantAddress2)+"
")+(""===(null!==(a=o.occupantCity)&&void 0!==a?a:"")?"":cityssm.escapeHTML(o.occupantCity)+", ")+cityssm.escapeHTML(null!==(s=o.occupantProvince)&&void 0!==s?s:"")+"
"+cityssm.escapeHTML(null!==(l=o.occupantPostalCode)&&void 0!==l?l:"")+"
"+(""===(null!==(r=o.occupantPhoneNumber)&&void 0!==r?r:"")?"":cityssm.escapeHTML(o.occupantPhoneNumber)+"
")+(""===(null!==(i=o.occupantEmailAddress)&&void 0!==i?i:"")?"":cityssm.escapeHTML(o.occupantEmailAddress))+'
'+cityssm.escapeHTML(null!==(d=o.occupantComment)&&void 0!==d?d:"")+'
CommentorComment DateCommentOptions
${cityssm.escapeHTML(null!==(n=i.recordCreate_userName)&&void 0!==n?n:"")}\n ${cityssm.escapeHTML(null!==(c=i.lotOccupancyCommentDateString)&&void 0!==c?c:"")}\n ${cityssm.escapeHTML(0===i.lotOccupancyCommentTime?"":null!==(a=i.lotOccupancyCommentTimePeriodString)&&void 0!==a?a:"")}\n ${cityssm.escapeHTML(null!==(o=i.lotOccupancyComment)&&void 0!==o?o:"")}\n
\n \n \n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
';let i=0,u=0;for(const d of t){const t=document.createElement("tr");t.className="container--lotOccupancyFee",t.dataset.feeId=d.feeId.toString(),t.dataset.includeQuantity=null!==(e=d.includeQuantity)&&void 0!==e&&e?"1":"0",t.innerHTML=''+cityssm.escapeHTML(null!==(c=d.feeName)&&void 0!==c?c:"")+'
'+cityssm.escapeHTML(null!==(a=d.feeCategory)&&void 0!==a?a:"")+""+(1===d.quantity?"":'$'+d.feeAmount.toFixed(2)+'×'+d.quantity.toString()+"=")+'$'+(d.feeAmount*d.quantity).toFixed(2)+'
'+(null!==(o=d.includeQuantity)&&void 0!==o&&o?'':"")+'
',null===(s=t.querySelector(".button--editQuantity"))||void 0===s||s.addEventListener("click",L),null===(l=t.querySelector(".button--delete"))||void 0===l||l.addEventListener("click",q),null===(r=n.querySelector("tbody"))||void 0===r||r.append(t),i+=d.feeAmount*d.quantity,u+=d.taxAmount*d.quantity}n.querySelector("#lotOccupancyFees--feeAmountTotal").textContent="$"+i.toFixed(2),n.querySelector("#lotOccupancyFees--taxAmountTotal").textContent="$"+u.toFixed(2),n.querySelector("#lotOccupancyFees--grandTotal").textContent="$"+(i+u).toFixed(2),M()}const c=document.querySelector("#button--addFee");c.addEventListener("click",()=>{if(o.hasUnsavedChanges())return void bulmaJS.alert({message:"Please save all unsaved changes before adding fees.",contextualColorName:"warning"});let e,a,l;function r(e,n=1){cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doAddLotOccupancyFee",{lotOccupancyId:s,feeId:e,quantity:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N(),u()):bulmaJS.alert({title:"Error Adding Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function i(t){var n;t.preventDefault();const c=Number.parseInt(t.currentTarget.dataset.feeId,10),a=Number.parseInt(t.currentTarget.dataset.feeCategoryId,10),o=e.find(e=>e.feeCategoryId===a).fees.find(e=>e.feeId===c);null!==(n=o.includeQuantity)&&void 0!==n&&n?function(e){let t,n;function c(c){c.preventDefault(),r(e.feeId,t.value),n()}cityssm.openHtmlModal("lotOccupancy-setFeeQuantity",{onshow(t){t.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=e.quantityUnit},onshown(e,a){n=a,t=e.querySelector("#lotOccupancyFeeQuantity--quantity"),e.querySelector("form").addEventListener("submit",c)}})}(o):r(c)}function u(){var t,c,o,s,r,u;const d=a.value.trim().toLowerCase().split(" ");l.innerHTML="";for(const a of e){const e=document.createElement("div");e.className="container--feeCategory",e.dataset.feeCategoryId=a.feeCategoryId.toString(),e.innerHTML='

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

';let p=!1;for(const t of a.fees){if(null!==n.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let l=!0;const m=((null!==(c=a.feeCategory)&&void 0!==c?c:"")+" "+(null!==(o=t.feeName)&&void 0!==o?o:"")+" "+(null!==(s=t.feeDescription)&&void 0!==s?s:"")).toLowerCase();for(const e of d)if(!m.includes(e)){l=!1;break}if(!l)continue;p=!0;const y=document.createElement("a");y.className="panel-block is-block container--fee",y.dataset.feeId=t.feeId.toString(),y.dataset.feeCategoryId=a.feeCategoryId.toString(),y.href="#",y.innerHTML=""+cityssm.escapeHTML(null!==(r=t.feeName)&&void 0!==r?r:"")+"
"+cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replace(/\n/g,"
")+"
",y.addEventListener("click",i),e.querySelector(".panel").append(y)}p&&l.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){a=t.querySelector("#feeSelect--feeName"),l=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doGetFees",{lotOccupancyId:s},t=>{e=t.feeCategories,a.disabled=!1,a.addEventListener("keyup",u),a.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){N()},onremoved(){bulmaJS.toggleHtmlClipped(),c.focus()}})});let a=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const l=document.querySelector("#container--lotOccupancyTransactions");function E(e){const t=Number.parseInt(e.currentTarget.closest("tr").dataset.transactionIndex,10),n=a.find(e=>e.transactionIndex===t);let c;function l(e){e.preventDefault(),cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyTransaction",e.currentTarget,e=>{const t=e;t.success?(a=t.lotOccupancyTransactions,M(),c()):bulmaJS.alert({title:"Error Updating Transaction",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editTransaction",{onshow(e){var t,c,a,l;o.populateAliases(e),e.querySelector("#lotOccupancyTransactionEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyTransactionEdit--transactionIndex").value=n.transactionIndex.toString(),e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").value=n.transactionAmount.toFixed(2),e.querySelector("#lotOccupancyTransactionEdit--externalReceiptNumber").value=null!==(t=n.externalReceiptNumber)&&void 0!==t?t:"",e.querySelector("#lotOccupancyTransactionEdit--transactionNote").value=null!==(c=n.transactionNote)&&void 0!==c?c:"",e.querySelector("#lotOccupancyTransactionEdit--transactionDateString").value=null!==(a=n.transactionDateString)&&void 0!==a?a:"",e.querySelector("#lotOccupancyTransactionEdit--transactionTimeString").value=null!==(l=n.transactionTimeString)&&void 0!==l?l:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),o.initializeDatePickers(e),e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",l),c=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function I(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyTransaction",{lotOccupancyId:s,transactionIndex:t},e=>{var t;const n=e;n.success?(a=n.lotOccupancyTransactions,M()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function M(){var e,n,c,s,r;if(0===a.length)return void(l.innerHTML='

There are no transactions associated with this record.

');l.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n \n \n
Date${o.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`;let i=0;for(const t of a){i+=t.transactionAmount;const a=document.createElement("tr");a.className="container--lotOccupancyTransaction",a.dataset.transactionIndex=t.transactionIndex.toString();let u="";""!==t.externalReceiptNumber&&(u=cityssm.escapeHTML(null!==(e=t.externalReceiptNumber)&&void 0!==e?e:""),o.dynamicsGPIntegrationIsEnabled&&(void 0===t.dynamicsGPDocument?u+=' \n \n ':t.dynamicsGPDocument.documentTotal.toFixed(2)===t.transactionAmount.toFixed(2)?u+=' \n \n ':u+=` \n \n `),u+="
"),a.innerHTML=""+(null!==(n=t.transactionDateString)&&void 0!==n?n:"")+""+u+""+cityssm.escapeHTML(null!==(c=t.transactionNote)&&void 0!==c?c:"")+'$'+t.transactionAmount.toFixed(2)+'
',null===(s=a.querySelector(".button--edit"))||void 0===s||s.addEventListener("click",E),null===(r=a.querySelector(".button--delete"))||void 0===r||r.addEventListener("click",I),l.querySelector("tbody").append(a)}l.querySelector("#lotOccupancyTransactions--grandTotal").textContent="$"+i.toFixed(2);const u=x();u.toFixed(2)!==i.toFixed(2)&&l.insertAdjacentHTML("afterbegin",'
Outstanding Balance
$'+(u-i).toFixed(2)+"
")}const r=document.querySelector("#button--addTransaction");r.addEventListener("click",()=>{let e,t,n;function c(e){e.preventDefault(),cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doAddLotOccupancyTransaction",e.currentTarget,e=>{var t;const c=e;c.success?(a=c.lotOccupancyTransactions,n(),M()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function l(){const n=t.value,c=t.closest(".control").querySelector(".icon"),a=t.closest(".field").querySelector(".help");if(""===n)return a.innerHTML=" ",void(c.innerHTML='');cityssm.postJSON(o.urlPrefix+"/lotOccupancies/doGetDynamicsGPDocument",{externalReceiptNumber:n},t=>{const n=t;n.success&&void 0!==n.dynamicsGPDocument?e.valueAsNumber===n.dynamicsGPDocument.documentTotal?(a.textContent="Matching Document Found",c.innerHTML=''):(a.textContent="Matching Document: $"+n.dynamicsGPDocument.documentTotal.toFixed(2),c.innerHTML=''):(a.textContent="No Matching Document Found",c.innerHTML='')})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow(n){o.populateAliases(n),n.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=s.toString();const c=x(),r=function(){let e=0;for(const t of a)e+=t.transactionAmount;return e}();if((e=n.querySelector("#lotOccupancyTransactionAdd--transactionAmount")).min=(-1*r).toFixed(2),e.max=Math.max(c-r,0).toFixed(2),e.value=Math.max(c-r,0).toFixed(2),o.dynamicsGPIntegrationIsEnabled){const c=(t=n.querySelector("#lotOccupancyTransactionAdd--externalReceiptNumber")).closest(".control");c.classList.add("has-icons-right"),c.insertAdjacentHTML("beforeend",''),c.insertAdjacentHTML("afterend",'

'),t.addEventListener("change",l),e.addEventListener("change",l),l()}},onshown(t,a){bulmaJS.toggleHtmlClipped(),e.focus(),n=a,t.querySelector("form").addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),r.focus()}})}),N()}})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,n,c,o;const a=exports.los,s=document.querySelector("#lotOccupancy--lotOccupancyId").value,l=""===s;let r=l;function i(){var e;a.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.remove("is-light")}function u(){var e;a.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.add("is-light")}const d=document.querySelector("#form--lotOccupancy");d.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/${l?"doCreateLotOccupancy":"doUpdateLotOccupancy"}`,d,e=>{var t;const n=e;n.success?(u(),l||r?window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Saving ${a.escapedAliases.Occupancy}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const p=d.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",i);function m(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,{lotOccupancyId:s},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(S=document.querySelector("#button--copyLotOccupancy"))||void 0===S||S.addEventListener("click",e=>{e.preventDefault(),a.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${a.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:m}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${a.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`,{lotOccupancyId:s},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function n(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/workOrders/doCreateWorkOrder`,e.currentTarget,e=>{const n=e;n.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(n.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:n.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=s,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const n=e.querySelector("#workOrderCreate--workOrderTypeId"),c=exports.workOrderTypes;1===c.length&&(n.innerHTML="");for(const e of c){const c=document.createElement("option");c.value=e.workOrderTypeId.toString(),c.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",n.append(c)}},onshown(e,c){var o;t=c,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",n)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const y=document.querySelector("#lotOccupancy--occupancyTypeId");if(l){const e=document.querySelector("#container--lotOccupancyFields");y.addEventListener("change",()=>{""!==y.value?cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetOccupancyTypeFields",{occupancyTypeId:y.value},t=>{var n,c;const o=t;if(0===o.occupancyTypeFields.length)return void(e.innerHTML=`
\n

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

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

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

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

No results.

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

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

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

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

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

There are no comments associated with this record.

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

There are no fees associated with this record.

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

${cityssm.escapeHTML(null!==(t=o.feeCategory)&&void 0!==t?t:"")}

\n
`;let p=!1;for(const t of o.fees){if(null!==n.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let l=!0;const m=`${null!==(c=o.feeCategory)&&void 0!==c?c:""} ${null!==(a=t.feeName)&&void 0!==a?a:""} ${null!==(s=t.feeDescription)&&void 0!==s?s:""}`.toLowerCase();for(const e of d)if(!m.includes(e)){l=!1;break}if(!l)continue;p=!0;const y=document.createElement("a");y.className="panel-block is-block container--fee",y.dataset.feeId=t.feeId.toString(),y.dataset.feeCategoryId=o.feeCategoryId.toString(),y.href="#",y.innerHTML=`${cityssm.escapeHTML(null!==(r=t.feeName)&&void 0!==r?r:"")}
\n \n ${cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replaceAll("\n","
")}\n
`,y.addEventListener("click",i),e.querySelector(".panel").append(y)}p&&l.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){o=t.querySelector("#feeSelect--feeName"),l=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetFees`,{lotOccupancyId:s},t=>{e=t.feeCategories,o.disabled=!1,o.addEventListener("keyup",u),o.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){N()},onremoved(){bulmaJS.toggleHtmlClipped(),c.focus()}})});let o=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const l=document.querySelector("#container--lotOccupancyTransactions");function E(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.transactionIndex)&&void 0!==n?n:"",10),l=o.find(e=>e.transactionIndex===c);let r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`,e.currentTarget,e=>{const t=e;t.success?(o=t.lotOccupancyTransactions,I(),r()):bulmaJS.alert({title:"Error Updating Transaction",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editTransaction",{onshow(e){var t,n,c,o,r,i;a.populateAliases(e),e.querySelector("#lotOccupancyTransactionEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyTransactionEdit--transactionIndex").value=null!==(n=null===(t=l.transactionIndex)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").value=l.transactionAmount.toFixed(2),e.querySelector("#lotOccupancyTransactionEdit--externalReceiptNumber").value=null!==(c=l.externalReceiptNumber)&&void 0!==c?c:"",e.querySelector("#lotOccupancyTransactionEdit--transactionNote").value=null!==(o=l.transactionNote)&&void 0!==o?o:"",e.querySelector("#lotOccupancyTransactionEdit--transactionDateString").value=null!==(r=l.transactionDateString)&&void 0!==r?r:"",e.querySelector("#lotOccupancyTransactionEdit--transactionTimeString").value=null!==(i=l.transactionTimeString)&&void 0!==i?i:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",i),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function M(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`,{lotOccupancyId:s,transactionIndex:t},e=>{var t;const n=e;n.success?(o=n.lotOccupancyTransactions,I()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function I(){var e,n,c,s,r,i,u;if(0===o.length)return void(l.innerHTML=`
\n

There are no transactions associated with this record.

\n
`);l.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n \n \n
Date${a.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`;let d=0;for(const t of o){d+=t.transactionAmount;const o=document.createElement("tr");o.className="container--lotOccupancyTransaction",o.dataset.transactionIndex=null===(e=t.transactionIndex)||void 0===e?void 0:e.toString();let p="";""!==t.externalReceiptNumber&&(p=cityssm.escapeHTML(null!==(n=t.externalReceiptNumber)&&void 0!==n?n:""),a.dynamicsGPIntegrationIsEnabled&&(void 0===t.dynamicsGPDocument?p+=' \n \n ':t.dynamicsGPDocument.documentTotal.toFixed(2)===t.transactionAmount.toFixed(2)?p+=' \n \n ':p+=` \n \n `),p+="
"),o.innerHTML=`\n ${cityssm.escapeHTML(null!==(c=t.transactionDateString)&&void 0!==c?c:"")}\n \n \n ${p}\n ${cityssm.escapeHTML(null!==(s=t.transactionNote)&&void 0!==s?s:"")}\n \n \n $${cityssm.escapeHTML(t.transactionAmount.toFixed(2))}\n \n \n
\n \n \n
\n `,null===(r=o.querySelector(".button--edit"))||void 0===r||r.addEventListener("click",E),null===(i=o.querySelector(".button--delete"))||void 0===i||i.addEventListener("click",M),null===(u=l.querySelector("tbody"))||void 0===u||u.append(o)}l.querySelector("#lotOccupancyTransactions--grandTotal").textContent="$"+d.toFixed(2);const p=x();p.toFixed(2)!==d.toFixed(2)&&l.insertAdjacentHTML("afterbegin",`
\n
\n
\n
\n
Outstanding Balance
\n
\n
\n
$${cityssm.escapeHTML((p-d).toFixed(2))}
\n
\n
\n
`)}const r=document.querySelector("#button--addTransaction");r.addEventListener("click",()=>{let e,t,n;function c(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`,e.currentTarget,e=>{var t;const c=e;c.success?(o=c.lotOccupancyTransactions,n(),I()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function l(){var n,c;const o=t.value,s=null===(n=t.closest(".control"))||void 0===n?void 0:n.querySelector(".icon"),l=null===(c=t.closest(".field"))||void 0===c?void 0:c.querySelector(".help");if(""===o)return l.innerHTML=" ",void(s.innerHTML='');cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`,{externalReceiptNumber:o},t=>{const n=t;n.success&&void 0!==n.dynamicsGPDocument?e.valueAsNumber===n.dynamicsGPDocument.documentTotal?(l.textContent="Matching Document Found",s.innerHTML=''):(l.textContent="Matching Document: $"+n.dynamicsGPDocument.documentTotal.toFixed(2),s.innerHTML=''):(l.textContent="No Matching Document Found",s.innerHTML='')})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow(n){a.populateAliases(n),n.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=s.toString();const c=x(),r=function(){let e=0;for(const t of o)e+=t.transactionAmount;return e}();if((e=n.querySelector("#lotOccupancyTransactionAdd--transactionAmount")).min=(-1*r).toFixed(2),e.max=Math.max(c-r,0).toFixed(2),e.value=Math.max(c-r,0).toFixed(2),a.dynamicsGPIntegrationIsEnabled){const c=(t=n.querySelector("#lotOccupancyTransactionAdd--externalReceiptNumber")).closest(".control");c.classList.add("has-icons-right"),c.insertAdjacentHTML("beforeend",''),c.insertAdjacentHTML("afterend",'

'),t.addEventListener("change",l),e.addEventListener("change",l),l()}},onshown(t,o){var a;bulmaJS.toggleHtmlClipped(),e.focus(),n=o,null===(a=t.querySelector("form"))||void 0===a||a.addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),r.focus()}})}),N()}})(); \ No newline at end of file diff --git a/tsconfig.client.json b/tsconfig.client.json index 25ff969c..eeb13807 100644 --- a/tsconfig.client.json +++ b/tsconfig.client.json @@ -1,8 +1,7 @@ { "compilerOptions": { - "target": "ES6", + "target": "ES2017", "module": "CommonJS", - "moduleResolution": "Node", "isolatedModules": false, "declaration": true, "noImplicitAny": false,