diff --git a/helpers/lotOccupancyDB/getWorkOrders.js b/helpers/lotOccupancyDB/getWorkOrders.js index b655ba5a..c4a57019 100644 --- a/helpers/lotOccupancyDB/getWorkOrders.js +++ b/helpers/lotOccupancyDB/getWorkOrders.js @@ -9,11 +9,11 @@ import { getLotNameWhereClause, getOccupantNameWhereClause } from '../functions. function buildWhereClause(filters) { let sqlWhereClause = ' where w.recordDelete_timeMillis is null'; const sqlParameters = []; - if (filters.workOrderTypeId) { + if ((filters.workOrderTypeId ?? '') !== '') { sqlWhereClause += ' and w.workOrderTypeId = ?'; sqlParameters.push(filters.workOrderTypeId); } - if (filters.workOrderOpenStatus) { + if ((filters.workOrderOpenStatus ?? '') !== '') { if (filters.workOrderOpenStatus === 'open') { sqlWhereClause += ' and w.workOrderCloseDate is null'; } @@ -21,7 +21,7 @@ function buildWhereClause(filters) { sqlWhereClause += ' and w.workOrderCloseDate is not null'; } } - if (filters.workOrderOpenDateString) { + if ((filters.workOrderOpenDateString ?? '') !== '') { sqlWhereClause += ' and w.workOrderOpenDate = ?'; sqlParameters.push(dateStringToInteger(filters.workOrderOpenDateString)); } diff --git a/helpers/lotOccupancyDB/getWorkOrders.ts b/helpers/lotOccupancyDB/getWorkOrders.ts index 1132d86a..4be03eb0 100644 --- a/helpers/lotOccupancyDB/getWorkOrders.ts +++ b/helpers/lotOccupancyDB/getWorkOrders.ts @@ -43,12 +43,12 @@ function buildWhereClause(filters: GetWorkOrdersFilters): { let sqlWhereClause = ' where w.recordDelete_timeMillis is null' const sqlParameters: unknown[] = [] - if (filters.workOrderTypeId) { + if ((filters.workOrderTypeId ?? '') !== '') { sqlWhereClause += ' and w.workOrderTypeId = ?' sqlParameters.push(filters.workOrderTypeId) } - if (filters.workOrderOpenStatus) { + if ((filters.workOrderOpenStatus ?? '') !== '') { if (filters.workOrderOpenStatus === 'open') { sqlWhereClause += ' and w.workOrderCloseDate is null' } else if (filters.workOrderOpenStatus === 'closed') { @@ -56,9 +56,9 @@ function buildWhereClause(filters: GetWorkOrdersFilters): { } } - if (filters.workOrderOpenDateString) { + if ((filters.workOrderOpenDateString ?? '') !== '') { sqlWhereClause += ' and w.workOrderOpenDate = ?' - sqlParameters.push(dateStringToInteger(filters.workOrderOpenDateString)) + sqlParameters.push(dateStringToInteger(filters.workOrderOpenDateString!)) } const occupantNameFilters = getOccupantNameWhereClause( diff --git a/public-typescript/lotEdit.js b/public-typescript/lotEdit.js index f9cc92c4..7212cae6 100644 --- a/public-typescript/lotEdit.js +++ b/public-typescript/lotEdit.js @@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); function updateLot(formEvent) { formEvent.preventDefault(); cityssm.postJSON(los.urlPrefix + '/lots/' + (isCreate ? 'doCreateLot' : 'doUpdateLot'), formElement, (responseJSON) => { + var _a; if (responseJSON.success) { los.clearUnsavedChanges(); if (isCreate || refreshAfterSave) { @@ -20,15 +21,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); } else { bulmaJS.alert({ - message: exports.aliases.lot + ' Updated Successfully', + message: los.escapedAliases.Lot + ' Updated Successfully', contextualColorName: 'success' }); } } else { bulmaJS.alert({ - title: 'Error Updating ' + exports.aliases.lot, - message: responseJSON.errorMessage || '', + title: 'Error Updating ' + los.escapedAliases.Lot, + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } @@ -43,10 +44,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); (_a = document .querySelector('#button--deleteLot')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', (clickEvent) => { clickEvent.preventDefault(); - const doDelete = () => { + function doDelete() { cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLot', { lotId }, (responseJSON) => { + var _a; if (responseJSON.success) { cityssm.disableNavBlocker(); window.location.href = los.getLotURL(); @@ -54,14 +56,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); else { bulmaJS.alert({ title: `Error Deleting ${los.escapedAliases.Lot}`, - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } bulmaJS.confirm({ - title: 'Delete ' + exports.aliases.lot, + title: 'Delete ' + los.escapedAliases.Lot, message: `Are you sure you want to delete this ${los.escapedAliases.lot}?`, contextualColorName: 'warning', okButton: { @@ -77,8 +79,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotTypeIdElement.addEventListener('change', () => { if (lotTypeIdElement.value === '') { lotFieldsContainerElement.innerHTML = `
-

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

-
`; +

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

+ `; return; } cityssm.postJSON(los.urlPrefix + '/lots/doGetLotTypeFields', { @@ -172,9 +174,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); let editFormElement; let editCloseModalFunction; - const editComment = (submitEvent) => { + function editComment(submitEvent) { submitEvent.preventDefault(); cityssm.postJSON(los.urlPrefix + '/lots/doUpdateLotComment', editFormElement, (responseJSON) => { + var _a; if (responseJSON.success) { lotComments = responseJSON.lotComments; editCloseModalFunction(); @@ -183,12 +186,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); else { bulmaJS.alert({ title: 'Error Updating Comment', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } cityssm.openHtmlModal('lot-editComment', { onshow: (modalElement) => { los.populateAliases(modalElement); @@ -220,11 +223,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); function deleteLotComment(clickEvent) { const lotCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset .lotCommentId, 10); - const doDelete = () => { + function doDelete() { cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLotComment', { lotId, lotCommentId }, (responseJSON) => { + var _a; if (responseJSON.success) { lotComments = responseJSON.lotComments; renderLotComments(); @@ -232,12 +236,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); else { bulmaJS.alert({ title: 'Error Removing Comment', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } bulmaJS.confirm({ title: 'Remove Comment?', message: 'Are you sure you want to remove this comment?', @@ -249,6 +253,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function renderLotComments() { + var _a, _b; const containerElement = document.querySelector('#container--lotComments'); if (lotComments.length === 0) { containerElement.innerHTML = `
@@ -270,7 +275,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); tableRowElement.dataset.lotCommentId = lotComment.lotCommentId.toString(); tableRowElement.innerHTML = '' + - cityssm.escapeHTML(lotComment.recordCreate_userName || '') + + cityssm.escapeHTML((_a = lotComment.recordCreate_userName) !== null && _a !== void 0 ? _a : '') + '' + '' + lotComment.lotCommentDateString + @@ -279,7 +284,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); : ' ' + lotComment.lotCommentTimeString) + '' + '' + - cityssm.escapeHTML(lotComment.lotComment || '') + + cityssm.escapeHTML((_b = lotComment.lotComment) !== null && _b !== void 0 ? _b : '') + '' + ('' + '
' + @@ -305,7 +310,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); } function openAddCommentModal() { let addCommentCloseModalFunction; - const doAddComment = (formEvent) => { + function doAddComment(formEvent) { formEvent.preventDefault(); cityssm.postJSON(los.urlPrefix + '/lots/doAddLotComment', formEvent.currentTarget, (responseJSON) => { if (responseJSON.success) { @@ -314,7 +319,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); addCommentCloseModalFunction(); } }); - }; + } cityssm.openHtmlModal('lot-addComment', { onshow(modalElement) { los.populateAliases(modalElement); diff --git a/public-typescript/lotEdit.ts b/public-typescript/lotEdit.ts index 15c0cde6..b7ff288b 100644 --- a/public-typescript/lotEdit.ts +++ b/public-typescript/lotEdit.ts @@ -9,7 +9,6 @@ import type { BulmaJS } from '@cityssm/bulma-js/types' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS - ;(() => { const los = exports.los as globalTypes.LOS @@ -23,7 +22,7 @@ declare const bulmaJS: BulmaJS const formElement = document.querySelector('#form--lot') as HTMLFormElement - function updateLot(formEvent: SubmitEvent) { + function updateLot(formEvent: SubmitEvent): void { formEvent.preventDefault() cityssm.postJSON( @@ -41,14 +40,14 @@ declare const bulmaJS: BulmaJS window.location.href = los.getLotURL(responseJSON.lotId, true, true) } else { bulmaJS.alert({ - message: exports.aliases.lot + ' Updated Successfully', + message: los.escapedAliases.Lot + ' Updated Successfully', contextualColorName: 'success' }) } } else { bulmaJS.alert({ - title: 'Error Updating ' + exports.aliases.lot, - message: responseJSON.errorMessage || '', + title: 'Error Updating ' + los.escapedAliases.Lot, + message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) } @@ -71,7 +70,7 @@ declare const bulmaJS: BulmaJS ?.addEventListener('click', (clickEvent) => { clickEvent.preventDefault() - const doDelete = () => { + function doDelete(): void { cityssm.postJSON( los.urlPrefix + '/lots/doDeleteLot', { @@ -84,7 +83,7 @@ declare const bulmaJS: BulmaJS } else { bulmaJS.alert({ title: `Error Deleting ${los.escapedAliases.Lot}`, - message: responseJSON.errorMessage || '', + message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) } @@ -93,7 +92,7 @@ declare const bulmaJS: BulmaJS } bulmaJS.confirm({ - title: 'Delete ' + exports.aliases.lot, + title: 'Delete ' + los.escapedAliases.Lot, message: `Are you sure you want to delete this ${los.escapedAliases.lot}?`, contextualColorName: 'warning', okButton: { @@ -117,8 +116,8 @@ declare const bulmaJS: BulmaJS lotTypeIdElement.addEventListener('change', () => { if (lotTypeIdElement.value === '') { lotFieldsContainerElement.innerHTML = `
-

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

-
` +

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

+
` return } @@ -152,7 +151,6 @@ declare const bulmaJS: BulmaJS fieldElement.className = 'field' fieldElement.innerHTML = `
` - ;( fieldElement.querySelector('label') as HTMLLabelElement ).textContent = lotTypeField.lotTypeField as string @@ -245,7 +243,7 @@ declare const bulmaJS: BulmaJS let lotComments: recordTypes.LotComment[] = exports.lotComments delete exports.lotComments - function openEditLotComment(clickEvent: Event) { + function openEditLotComment(clickEvent: Event): void { const lotCommentId = Number.parseInt( (clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset .lotCommentId!, @@ -259,7 +257,7 @@ declare const bulmaJS: BulmaJS let editFormElement: HTMLFormElement let editCloseModalFunction: () => void - const editComment = (submitEvent: SubmitEvent) => { + function editComment(submitEvent: SubmitEvent): void { submitEvent.preventDefault() cityssm.postJSON( @@ -277,7 +275,7 @@ declare const bulmaJS: BulmaJS } else { bulmaJS.alert({ title: 'Error Updating Comment', - message: responseJSON.errorMessage || '', + message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) } @@ -288,19 +286,16 @@ declare const bulmaJS: BulmaJS cityssm.openHtmlModal('lot-editComment', { onshow: (modalElement) => { los.populateAliases(modalElement) - ;( modalElement.querySelector( '#lotCommentEdit--lotId' ) as HTMLInputElement ).value = lotId - ;( modalElement.querySelector( '#lotCommentEdit--lotCommentId' ) as HTMLInputElement ).value = lotCommentId.toString() - ;( modalElement.querySelector( '#lotCommentEdit--lotComment' @@ -319,7 +314,6 @@ declare const bulmaJS: BulmaJS lotComment.lotCommentDateString! <= currentDateString ? currentDateString : lotComment.lotCommentDateString! - ;( modalElement.querySelector( '#lotCommentEdit--lotCommentTimeString' @@ -331,7 +325,6 @@ declare const bulmaJS: BulmaJS los.initializeDatePickers(modalElement) // los.initializeTimePickers(modalElement); - ;( modalElement.querySelector( '#lotCommentEdit--lotComment' @@ -349,14 +342,14 @@ declare const bulmaJS: BulmaJS }) } - function deleteLotComment(clickEvent: Event) { + function deleteLotComment(clickEvent: Event): void { const lotCommentId = Number.parseInt( (clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset .lotCommentId!, 10 ) - const doDelete = () => { + function doDelete(): void { cityssm.postJSON( los.urlPrefix + '/lots/doDeleteLotComment', { @@ -374,7 +367,7 @@ declare const bulmaJS: BulmaJS } else { bulmaJS.alert({ title: 'Error Removing Comment', - message: responseJSON.errorMessage || '', + message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) } @@ -393,7 +386,7 @@ declare const bulmaJS: BulmaJS }) } - function renderLotComments() { + function renderLotComments(): void { const containerElement = document.querySelector( '#container--lotComments' ) as HTMLElement @@ -421,7 +414,7 @@ declare const bulmaJS: BulmaJS tableRowElement.innerHTML = '' + - cityssm.escapeHTML(lotComment.recordCreate_userName || '') + + cityssm.escapeHTML(lotComment.recordCreate_userName ?? '') + '' + '' + lotComment.lotCommentDateString + @@ -430,7 +423,7 @@ declare const bulmaJS: BulmaJS : ' ' + lotComment.lotCommentTimeString) + '' + '' + - cityssm.escapeHTML(lotComment.lotComment || '') + + cityssm.escapeHTML(lotComment.lotComment ?? '') + '' + ('' + '
' + @@ -459,10 +452,10 @@ declare const bulmaJS: BulmaJS containerElement.append(tableElement) } - function openAddCommentModal() { + function openAddCommentModal(): void { let addCommentCloseModalFunction: () => void - const doAddComment = (formEvent: SubmitEvent) => { + function doAddComment(formEvent: SubmitEvent): void { formEvent.preventDefault() cityssm.postJSON( diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js index 670076fd..a28bbcb2 100644 --- a/public-typescript/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit.js @@ -1006,7 +1006,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); let lotOccupancyFees = exports.lotOccupancyFees; delete exports.lotOccupancyFees; const lotOccupancyFeesContainerElement = document.querySelector('#container--lotOccupancyFees'); - const getFeeGrandTotal = () => { + function getFeeGrandTotal() { let feeGrandTotal = 0; for (const lotOccupancyFee of lotOccupancyFees) { feeGrandTotal += @@ -1014,14 +1014,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotOccupancyFee.quantity; } return feeGrandTotal; - }; - const deleteLotOccupancyFee = (clickEvent) => { + } + function deleteLotOccupancyFee(clickEvent) { const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId; - const doDelete = () => { + function doDelete() { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', { lotOccupancyId, feeId }, (responseJSON) => { + var _a; if (responseJSON.success) { lotOccupancyFees = responseJSON.lotOccupancyFees; renderLotOccupancyFees(); @@ -1029,12 +1030,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); else { bulmaJS.alert({ title: 'Error Deleting Fee', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } bulmaJS.confirm({ title: 'Delete Fee', message: 'Are you sure you want to delete this fee?', @@ -1044,34 +1045,40 @@ Object.defineProperty(exports, "__esModule", { value: true }); callbackFunction: doDelete } }); - }; - const renderLotOccupancyFees = () => { + } + function renderLotOccupancyFees() { + var _a; if (lotOccupancyFees.length === 0) { - lotOccupancyFeesContainerElement.innerHTML = - '
' + - '

There are no fees associated with this record.

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

There are no fees associated with this record.

+
`; renderLotOccupancyTransactions(); return; } - lotOccupancyFeesContainerElement.innerHTML = - '' + - ('' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '') + - '' + - ('' + - '' + - '' + - '' + - '') + - '
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
'; + lotOccupancyFeesContainerElement.innerHTML = ` + + + + + + + + + + + + + + + + + + + + + + +
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
`; let feeAmountTotal = 0; let taxAmountTotal = 0; for (const lotOccupancyFee of lotOccupancyFees) { @@ -1085,7 +1092,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); '' + - cityssm.escapeHTML(lotOccupancyFee.feeName || '') + + cityssm.escapeHTML((_a = lotOccupancyFee.feeName) !== null && _a !== void 0 ? _a : '') + '' + (lotOccupancyFee.quantity === 1 ? '' @@ -1119,7 +1126,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--taxAmountTotal').textContent = '$' + taxAmountTotal.toFixed(2); lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2); renderLotOccupancyTransactions(); - }; + } document.querySelector('#button--addFee').addEventListener('click', () => { if (hasUnsavedChanges) { bulmaJS.alert({ @@ -1131,12 +1138,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); let feeCategories; let feeFilterElement; let feeFilterResultsElement; - const doAddFee = (feeId, quantity = 1) => { + function doAddFee(feeId, quantity = 1) { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', { lotOccupancyId, feeId, quantity }, (responseJSON) => { + var _a; if (responseJSON.success) { lotOccupancyFees = responseJSON.lotOccupancyFees; renderLotOccupancyFees(); @@ -1145,20 +1153,20 @@ Object.defineProperty(exports, "__esModule", { value: true }); else { bulmaJS.alert({ title: 'Error Adding Fee', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; - const doSetQuantityAndAddFee = (fee) => { + } + function doSetQuantityAndAddFee(fee) { let quantityElement; let quantityCloseModalFunction; - const doSetQuantity = (submitEvent) => { + function doSetQuantity(submitEvent) { submitEvent.preventDefault(); doAddFee(fee.feeId, quantityElement.value); quantityCloseModalFunction(); - }; + } cityssm.openHtmlModal('lotOccupancy-setFeeQuantity', { onshow: (modalElement) => { ; @@ -1172,8 +1180,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); .addEventListener('submit', doSetQuantity); } }); - }; - const tryAddFee = (clickEvent) => { + } + function tryAddFee(clickEvent) { clickEvent.preventDefault(); const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10); const feeCategoryId = Number.parseInt(clickEvent.currentTarget.closest('.container--feeCategory').dataset.feeCategoryId, 10); @@ -1189,8 +1197,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); else { doAddFee(feeId); } - }; - const filterFees = () => { + } + function filterFees() { + var _a, _b; const filterStringPieces = feeFilterElement.value .trim() .toLowerCase() @@ -1230,11 +1239,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); panelBlockElement.href = '#'; panelBlockElement.innerHTML = '' + - cityssm.escapeHTML(fee.feeName || '') + + cityssm.escapeHTML((_a = fee.feeName) !== null && _a !== void 0 ? _a : '') + '
' + '' + cityssm - .escapeHTML(fee.feeDescription || '') + .escapeHTML((_b = fee.feeDescription) !== null && _b !== void 0 ? _b : '') .replace(/\n/g, '
') + '
'; panelBlockElement.addEventListener('click', tryAddFee); @@ -1244,9 +1253,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); feeFilterResultsElement.append(categoryContainerElement); } } - }; + } cityssm.openHtmlModal('lotOccupancy-addFee', { - onshow: (modalElement) => { + onshow(modalElement) { feeFilterElement = modalElement.querySelector('#feeSelect--feeName'); feeFilterResultsElement = modalElement.querySelector('#resultsContainer--feeSelect'); cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetFees', { @@ -1259,13 +1268,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); filterFees(); }); }, - onshown: () => { + onshown() { bulmaJS.toggleHtmlClipped(); }, - onhidden: () => { + onhidden() { renderLotOccupancyFees(); }, - onremoved: () => { + onremoved() { bulmaJS.toggleHtmlClipped(); } }); @@ -1273,20 +1282,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); let lotOccupancyTransactions = exports.lotOccupancyTransactions; delete exports.lotOccupancyTransactions; const lotOccupancyTransactionsContainerElement = document.querySelector('#container--lotOccupancyTransactions'); - const getTransactionGrandTotal = () => { + function getTransactionGrandTotal() { let transactionGrandTotal = 0; for (const lotOccupancyTransaction of lotOccupancyTransactions) { transactionGrandTotal += lotOccupancyTransaction.transactionAmount; } return transactionGrandTotal; - }; - const deleteLotOccupancyTransaction = (clickEvent) => { + } + function deleteLotOccupancyTransaction(clickEvent) { const transactionIndex = clickEvent.currentTarget.closest('.container--lotOccupancyTransaction').dataset.transactionIndex; - const doDelete = () => { + function doDelete() { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', { lotOccupancyId, transactionIndex }, (responseJSON) => { + var _a; if (responseJSON.success) { lotOccupancyTransactions = responseJSON.lotOccupancyTransactions; renderLotOccupancyTransactions(); @@ -1294,12 +1304,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); else { bulmaJS.alert({ title: 'Error Deleting Transaction', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } bulmaJS.confirm({ title: 'Delete Trasnaction', message: 'Are you sure you want to delete this transaction?', @@ -1309,8 +1319,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); callbackFunction: doDelete } }); - }; - const renderLotOccupancyTransactions = () => { + } + function renderLotOccupancyTransactions() { + var _a, _b; if (lotOccupancyTransactions.length === 0) { lotOccupancyTransactionsContainerElement.innerHTML = '
'; return; } - lotOccupancyTransactionsContainerElement.innerHTML = - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - ('' + - '' + - '' + - '' + - '') + - '
Date' + - cityssm.escapeHTML(exports.aliases.externalReceiptNumber) + - 'AmountOptions
Transaction Total
'; + lotOccupancyTransactionsContainerElement.innerHTML = ` + + + + + + + + + + + + +
Date${los.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`; let transactionGrandTotal = 0; for (const lotOccupancyTransaction of lotOccupancyTransactions) { transactionGrandTotal += lotOccupancyTransaction.transactionAmount; @@ -1349,10 +1357,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotOccupancyTransaction.transactionDateString + '' + ('' + - cityssm.escapeHTML(lotOccupancyTransaction.externalReceiptNumber || '') + + cityssm.escapeHTML((_a = lotOccupancyTransaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : '') + '
' + '' + - cityssm.escapeHTML(lotOccupancyTransaction.transactionNote || '') + + cityssm.escapeHTML((_b = lotOccupancyTransaction.transactionNote) !== null && _b !== void 0 ? _b : '') + '' + '') + ('$' + @@ -1385,14 +1393,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); '
' + '
'); } - }; + } document .querySelector('#button--addTransaction') .addEventListener('click', () => { let addCloseModalFunction; - const doAddTransaction = (submitEvent) => { + function doAddTransaction(submitEvent) { submitEvent.preventDefault(); cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', submitEvent.currentTarget, (responseJSON) => { + var _a; if (responseJSON.success) { lotOccupancyTransactions = responseJSON.lotOccupancyTransactions; addCloseModalFunction(); @@ -1401,12 +1410,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); else { bulmaJS.confirm({ title: 'Error Adding Transaction', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } cityssm.openHtmlModal('lotOccupancy-addTransaction', { onshow: (modalElement) => { los.populateAliases(modalElement); diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js index 684610a0..8c30c678 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js @@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); let lotOccupancyFees = exports.lotOccupancyFees; delete exports.lotOccupancyFees; const lotOccupancyFeesContainerElement = document.querySelector('#container--lotOccupancyFees'); -const getFeeGrandTotal = () => { +function getFeeGrandTotal() { let feeGrandTotal = 0; for (const lotOccupancyFee of lotOccupancyFees) { feeGrandTotal += @@ -12,14 +12,15 @@ const getFeeGrandTotal = () => { lotOccupancyFee.quantity; } return feeGrandTotal; -}; -const deleteLotOccupancyFee = (clickEvent) => { +} +function deleteLotOccupancyFee(clickEvent) { const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId; - const doDelete = () => { + function doDelete() { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', { lotOccupancyId, feeId }, (responseJSON) => { + var _a; if (responseJSON.success) { lotOccupancyFees = responseJSON.lotOccupancyFees; renderLotOccupancyFees(); @@ -27,12 +28,12 @@ const deleteLotOccupancyFee = (clickEvent) => { else { bulmaJS.alert({ title: 'Error Deleting Fee', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } bulmaJS.confirm({ title: 'Delete Fee', message: 'Are you sure you want to delete this fee?', @@ -42,34 +43,40 @@ const deleteLotOccupancyFee = (clickEvent) => { callbackFunction: doDelete } }); -}; -const renderLotOccupancyFees = () => { +} +function renderLotOccupancyFees() { + var _a; if (lotOccupancyFees.length === 0) { - lotOccupancyFeesContainerElement.innerHTML = - '
' + - '

There are no fees associated with this record.

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

There are no fees associated with this record.

+
`; renderLotOccupancyTransactions(); return; } - lotOccupancyFeesContainerElement.innerHTML = - '' + - ('' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '') + - '' + - ('' + - '' + - '' + - '' + - '') + - '
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
'; + lotOccupancyFeesContainerElement.innerHTML = ` + + + + + + + + + + + + + + + + + + + + + + +
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
`; let feeAmountTotal = 0; let taxAmountTotal = 0; for (const lotOccupancyFee of lotOccupancyFees) { @@ -83,7 +90,7 @@ const renderLotOccupancyFees = () => { '' + - cityssm.escapeHTML(lotOccupancyFee.feeName || '') + + cityssm.escapeHTML((_a = lotOccupancyFee.feeName) !== null && _a !== void 0 ? _a : '') + '' + (lotOccupancyFee.quantity === 1 ? '' @@ -117,7 +124,7 @@ const renderLotOccupancyFees = () => { lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--taxAmountTotal').textContent = '$' + taxAmountTotal.toFixed(2); lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2); renderLotOccupancyTransactions(); -}; +} document.querySelector('#button--addFee').addEventListener('click', () => { if (hasUnsavedChanges) { bulmaJS.alert({ @@ -129,12 +136,13 @@ document.querySelector('#button--addFee').addEventListener('click', () => { let feeCategories; let feeFilterElement; let feeFilterResultsElement; - const doAddFee = (feeId, quantity = 1) => { + function doAddFee(feeId, quantity = 1) { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', { lotOccupancyId, feeId, quantity }, (responseJSON) => { + var _a; if (responseJSON.success) { lotOccupancyFees = responseJSON.lotOccupancyFees; renderLotOccupancyFees(); @@ -143,20 +151,20 @@ document.querySelector('#button--addFee').addEventListener('click', () => { else { bulmaJS.alert({ title: 'Error Adding Fee', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; - const doSetQuantityAndAddFee = (fee) => { + } + function doSetQuantityAndAddFee(fee) { let quantityElement; let quantityCloseModalFunction; - const doSetQuantity = (submitEvent) => { + function doSetQuantity(submitEvent) { submitEvent.preventDefault(); doAddFee(fee.feeId, quantityElement.value); quantityCloseModalFunction(); - }; + } cityssm.openHtmlModal('lotOccupancy-setFeeQuantity', { onshow: (modalElement) => { ; @@ -170,8 +178,8 @@ document.querySelector('#button--addFee').addEventListener('click', () => { .addEventListener('submit', doSetQuantity); } }); - }; - const tryAddFee = (clickEvent) => { + } + function tryAddFee(clickEvent) { clickEvent.preventDefault(); const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10); const feeCategoryId = Number.parseInt(clickEvent.currentTarget.closest('.container--feeCategory').dataset.feeCategoryId, 10); @@ -187,8 +195,9 @@ document.querySelector('#button--addFee').addEventListener('click', () => { else { doAddFee(feeId); } - }; - const filterFees = () => { + } + function filterFees() { + var _a, _b; const filterStringPieces = feeFilterElement.value .trim() .toLowerCase() @@ -228,11 +237,11 @@ document.querySelector('#button--addFee').addEventListener('click', () => { panelBlockElement.href = '#'; panelBlockElement.innerHTML = '' + - cityssm.escapeHTML(fee.feeName || '') + + cityssm.escapeHTML((_a = fee.feeName) !== null && _a !== void 0 ? _a : '') + '
' + '' + cityssm - .escapeHTML(fee.feeDescription || '') + .escapeHTML((_b = fee.feeDescription) !== null && _b !== void 0 ? _b : '') .replace(/\n/g, '
') + '
'; panelBlockElement.addEventListener('click', tryAddFee); @@ -242,9 +251,9 @@ document.querySelector('#button--addFee').addEventListener('click', () => { feeFilterResultsElement.append(categoryContainerElement); } } - }; + } cityssm.openHtmlModal('lotOccupancy-addFee', { - onshow: (modalElement) => { + onshow(modalElement) { feeFilterElement = modalElement.querySelector('#feeSelect--feeName'); feeFilterResultsElement = modalElement.querySelector('#resultsContainer--feeSelect'); cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetFees', { @@ -257,13 +266,13 @@ document.querySelector('#button--addFee').addEventListener('click', () => { filterFees(); }); }, - onshown: () => { + onshown() { bulmaJS.toggleHtmlClipped(); }, - onhidden: () => { + onhidden() { renderLotOccupancyFees(); }, - onremoved: () => { + onremoved() { bulmaJS.toggleHtmlClipped(); } }); @@ -271,20 +280,21 @@ document.querySelector('#button--addFee').addEventListener('click', () => { let lotOccupancyTransactions = exports.lotOccupancyTransactions; delete exports.lotOccupancyTransactions; const lotOccupancyTransactionsContainerElement = document.querySelector('#container--lotOccupancyTransactions'); -const getTransactionGrandTotal = () => { +function getTransactionGrandTotal() { let transactionGrandTotal = 0; for (const lotOccupancyTransaction of lotOccupancyTransactions) { transactionGrandTotal += lotOccupancyTransaction.transactionAmount; } return transactionGrandTotal; -}; -const deleteLotOccupancyTransaction = (clickEvent) => { +} +function deleteLotOccupancyTransaction(clickEvent) { const transactionIndex = clickEvent.currentTarget.closest('.container--lotOccupancyTransaction').dataset.transactionIndex; - const doDelete = () => { + function doDelete() { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', { lotOccupancyId, transactionIndex }, (responseJSON) => { + var _a; if (responseJSON.success) { lotOccupancyTransactions = responseJSON.lotOccupancyTransactions; renderLotOccupancyTransactions(); @@ -292,12 +302,12 @@ const deleteLotOccupancyTransaction = (clickEvent) => { else { bulmaJS.alert({ title: 'Error Deleting Transaction', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } bulmaJS.confirm({ title: 'Delete Trasnaction', message: 'Are you sure you want to delete this transaction?', @@ -307,8 +317,9 @@ const deleteLotOccupancyTransaction = (clickEvent) => { callbackFunction: doDelete } }); -}; -const renderLotOccupancyTransactions = () => { +} +function renderLotOccupancyTransactions() { + var _a, _b; if (lotOccupancyTransactions.length === 0) { lotOccupancyTransactionsContainerElement.innerHTML = '
' + - '' + - 'Date' + - '' + - cityssm.escapeHTML(exports.aliases.externalReceiptNumber) + - '' + - 'Amount' + - 'Options' + - '' + - '' + - ('' + - 'Transaction Total' + - '' + - '' + - '') + - ''; + lotOccupancyTransactionsContainerElement.innerHTML = ` + + + + + + + + + + + + +
Date${los.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`; let transactionGrandTotal = 0; for (const lotOccupancyTransaction of lotOccupancyTransactions) { transactionGrandTotal += lotOccupancyTransaction.transactionAmount; @@ -347,10 +355,10 @@ const renderLotOccupancyTransactions = () => { lotOccupancyTransaction.transactionDateString + '' + ('' + - cityssm.escapeHTML(lotOccupancyTransaction.externalReceiptNumber || '') + + cityssm.escapeHTML((_a = lotOccupancyTransaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : '') + '
' + '' + - cityssm.escapeHTML(lotOccupancyTransaction.transactionNote || '') + + cityssm.escapeHTML((_b = lotOccupancyTransaction.transactionNote) !== null && _b !== void 0 ? _b : '') + '' + '') + ('$' + @@ -383,14 +391,15 @@ const renderLotOccupancyTransactions = () => { '
' + '
'); } -}; +} document .querySelector('#button--addTransaction') .addEventListener('click', () => { let addCloseModalFunction; - const doAddTransaction = (submitEvent) => { + function doAddTransaction(submitEvent) { submitEvent.preventDefault(); cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', submitEvent.currentTarget, (responseJSON) => { + var _a; if (responseJSON.success) { lotOccupancyTransactions = responseJSON.lotOccupancyTransactions; addCloseModalFunction(); @@ -399,12 +408,12 @@ document else { bulmaJS.confirm({ title: 'Error Adding Transaction', - message: responseJSON.errorMessage || '', + message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); } }); - }; + } cityssm.openHtmlModal('lotOccupancy-addTransaction', { onshow: (modalElement) => { los.populateAliases(modalElement); diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts index 97dc0142..8d78784e 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts @@ -22,7 +22,7 @@ const lotOccupancyFeesContainerElement = document.querySelector( '#container--lotOccupancyFees' ) as HTMLElement -const getFeeGrandTotal = (): number => { +function getFeeGrandTotal(): number { let feeGrandTotal = 0 for (const lotOccupancyFee of lotOccupancyFees) { @@ -34,14 +34,14 @@ const getFeeGrandTotal = (): number => { return feeGrandTotal } -const deleteLotOccupancyFee = (clickEvent: Event) => { +function deleteLotOccupancyFee(clickEvent: Event): void { const feeId = ( (clickEvent.currentTarget as HTMLElement).closest( '.container--lotOccupancyFee' ) as HTMLElement ).dataset.feeId - const doDelete = () => { + function doDelete(): void { cityssm.postJSON( los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', { @@ -59,7 +59,7 @@ const deleteLotOccupancyFee = (clickEvent: Event) => { } else { bulmaJS.alert({ title: 'Error Deleting Fee', - message: responseJSON.errorMessage || '', + message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) } @@ -78,36 +78,41 @@ const deleteLotOccupancyFee = (clickEvent: Event) => { }) } -const renderLotOccupancyFees = () => { +function renderLotOccupancyFees(): void { if (lotOccupancyFees.length === 0) { - lotOccupancyFeesContainerElement.innerHTML = - '
' + - '

There are no fees associated with this record.

' + - '
' + lotOccupancyFeesContainerElement.innerHTML = `
+

There are no fees associated with this record.

+
` renderLotOccupancyTransactions() return } - lotOccupancyFeesContainerElement.innerHTML = - '' + - ('' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '') + - '' + - ('' + - '' + - '' + - '' + - '') + - '
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
' + lotOccupancyFeesContainerElement.innerHTML = ` + + + + + + + + + + + + + + + + + + + + + + +
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
` let feeAmountTotal = 0 let taxAmountTotal = 0 @@ -115,7 +120,7 @@ const renderLotOccupancyFees = () => { for (const lotOccupancyFee of lotOccupancyFees) { const tableRowElement = document.createElement('tr') tableRowElement.className = 'container--lotOccupancyFee' - tableRowElement.dataset.feeId = lotOccupancyFee.feeId!.toString() + tableRowElement.dataset.feeId = lotOccupancyFee.feeId.toString() tableRowElement.dataset.includeQuantity = lotOccupancyFee.includeQuantity ? '1' : '0' @@ -124,7 +129,7 @@ const renderLotOccupancyFees = () => { '' + - cityssm.escapeHTML(lotOccupancyFee.feeName || '') + + cityssm.escapeHTML(lotOccupancyFee.feeName ?? '') + '' + (lotOccupancyFee.quantity === 1 ? '' @@ -190,7 +195,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { let feeFilterElement: HTMLInputElement let feeFilterResultsElement: HTMLElement - const doAddFee = (feeId: number, quantity: number | string = 1) => { + function doAddFee(feeId: number, quantity: number | string = 1): void { cityssm.postJSON( los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', { @@ -210,7 +215,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { } else { bulmaJS.alert({ title: 'Error Adding Fee', - message: responseJSON.errorMessage || '', + message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) } @@ -218,13 +223,13 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { ) } - const doSetQuantityAndAddFee = (fee: recordTypes.Fee) => { + function doSetQuantityAndAddFee(fee: recordTypes.Fee): void { let quantityElement: HTMLInputElement let quantityCloseModalFunction: () => void - const doSetQuantity = (submitEvent: SubmitEvent) => { + function doSetQuantity(submitEvent: SubmitEvent): void { submitEvent.preventDefault() - doAddFee(fee.feeId!, quantityElement.value) + doAddFee(fee.feeId, quantityElement.value) quantityCloseModalFunction() } @@ -250,7 +255,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { }) } - const tryAddFee = (clickEvent: Event) => { + function tryAddFee(clickEvent: Event): void { clickEvent.preventDefault() const feeId = Number.parseInt( @@ -270,7 +275,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { return currentFeeCategory.feeCategoryId === feeCategoryId })! - const fee = feeCategory.fees!.find((currentFee) => { + const fee = feeCategory.fees.find((currentFee) => { return currentFee.feeId === feeId })! @@ -281,7 +286,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { } } - const filterFees = () => { + function filterFees(): void { const filterStringPieces = feeFilterElement.value .trim() .toLowerCase() @@ -293,7 +298,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { const categoryContainerElement = document.createElement('div') categoryContainerElement.className = 'container--feeCategory' categoryContainerElement.dataset.feeCategoryId = - feeCategory.feeCategoryId!.toString() + feeCategory.feeCategoryId.toString() categoryContainerElement.innerHTML = '

' + cityssm.escapeHTML(feeCategory.feeCategory || '') + @@ -302,7 +307,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { let hasFees = false - for (const fee of feeCategory.fees!) { + for (const fee of feeCategory.fees) { if ( lotOccupancyFeesContainerElement.querySelector( ".container--lotOccupancyFee[data-fee-id='" + @@ -330,21 +335,20 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { const panelBlockElement = document.createElement('a') panelBlockElement.className = 'panel-block is-block container--fee' - panelBlockElement.dataset.feeId = fee.feeId!.toString() + panelBlockElement.dataset.feeId = fee.feeId.toString() panelBlockElement.href = '#' panelBlockElement.innerHTML = '' + - cityssm.escapeHTML(fee.feeName || '') + + cityssm.escapeHTML(fee.feeName ?? '') + '
' + '' + cityssm - .escapeHTML(fee.feeDescription || '') + .escapeHTML(fee.feeDescription ?? '') .replace(/\n/g, '
') + '
' panelBlockElement.addEventListener('click', tryAddFee) - ;( categoryContainerElement.querySelector('.panel') as HTMLElement ).append(panelBlockElement) @@ -357,7 +361,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { } cityssm.openHtmlModal('lotOccupancy-addFee', { - onshow: (modalElement) => { + onshow(modalElement) { feeFilterElement = modalElement.querySelector( '#feeSelect--feeName' ) as HTMLInputElement @@ -382,13 +386,13 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => { } ) }, - onshown: () => { + onshown() { bulmaJS.toggleHtmlClipped() }, - onhidden: () => { + onhidden() { renderLotOccupancyFees() }, - onremoved: () => { + onremoved() { bulmaJS.toggleHtmlClipped() } }) @@ -402,7 +406,7 @@ const lotOccupancyTransactionsContainerElement = document.querySelector( '#container--lotOccupancyTransactions' ) as HTMLElement -const getTransactionGrandTotal = (): number => { +function getTransactionGrandTotal(): number { let transactionGrandTotal = 0 for (const lotOccupancyTransaction of lotOccupancyTransactions) { @@ -412,14 +416,14 @@ const getTransactionGrandTotal = (): number => { return transactionGrandTotal } -const deleteLotOccupancyTransaction = (clickEvent: Event) => { +function deleteLotOccupancyTransaction(clickEvent: Event): void { const transactionIndex = ( (clickEvent.currentTarget as HTMLElement).closest( '.container--lotOccupancyTransaction' ) as HTMLElement ).dataset.transactionIndex - const doDelete = () => { + function doDelete(): void { cityssm.postJSON( los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', { @@ -437,7 +441,7 @@ const deleteLotOccupancyTransaction = (clickEvent: Event) => { } else { bulmaJS.alert({ title: 'Error Deleting Transaction', - message: responseJSON.errorMessage || '', + message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) } @@ -456,7 +460,7 @@ const deleteLotOccupancyTransaction = (clickEvent: Event) => { }) } -const renderLotOccupancyTransactions = () => { +function renderLotOccupancyTransactions(): void { if (lotOccupancyTransactions.length === 0) { lotOccupancyTransactionsContainerElement.innerHTML = '
' + - '' + - 'Date' + - '' + - cityssm.escapeHTML(exports.aliases.externalReceiptNumber) + - '' + - 'Amount' + - 'Options' + - '' + - '' + - ('' + - 'Transaction Total' + - '' + - '' + - '') + - '' + lotOccupancyTransactionsContainerElement.innerHTML = ` + + + + + + + + + + + + +
Date${los.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
` let transactionGrandTotal = 0 @@ -502,11 +503,11 @@ const renderLotOccupancyTransactions = () => { '' + ('' + cityssm.escapeHTML( - lotOccupancyTransaction.externalReceiptNumber || '' + lotOccupancyTransaction.externalReceiptNumber ?? '' ) + '
' + '' + - cityssm.escapeHTML(lotOccupancyTransaction.transactionNote || '') + + cityssm.escapeHTML(lotOccupancyTransaction.transactionNote ?? '') + '' + '') + ('$' + @@ -557,7 +558,7 @@ document .addEventListener('click', () => { let addCloseModalFunction: () => void - const doAddTransaction = (submitEvent: SubmitEvent) => { + function doAddTransaction(submitEvent: SubmitEvent): void { submitEvent.preventDefault() cityssm.postJSON( @@ -575,7 +576,7 @@ document } else { bulmaJS.confirm({ title: 'Error Adding Transaction', - message: responseJSON.errorMessage || '', + message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) } @@ -586,7 +587,6 @@ document cityssm.openHtmlModal('lotOccupancy-addTransaction', { onshow: (modalElement) => { los.populateAliases(modalElement) - ;( modalElement.querySelector( '#lotOccupancyTransactionAdd--lotOccupancyId' diff --git a/public-typescript/lotView.ts b/public-typescript/lotView.ts index b7109684..e5a674b9 100644 --- a/public-typescript/lotView.ts +++ b/public-typescript/lotView.ts @@ -2,7 +2,8 @@ import * as globalTypes from '../types/globalTypes' ;(() => { - const mapContainerElement = document.querySelector('#lot--map') as HTMLElement + const mapContainerElement: HTMLElement | null = + document.querySelector('#lot--map') if (mapContainerElement) { ;(exports.los as globalTypes.LOS).highlightMap( diff --git a/public/javascripts/lotEdit.min.js b/public/javascripts/lotEdit.min.js index 61bd07c3..57f73f3a 100644 --- a/public/javascripts/lotEdit.min.js +++ b/public/javascripts/lotEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const t=exports.los,o=document.querySelector("#lot--lotId").value,n=""===o;let l=n;const s=document.querySelector("#form--lot");s.addEventListener("submit",function(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/lots/"+(n?"doCreateLot":"doUpdateLot"),s,e=>{e.success?(t.clearUnsavedChanges(),n||l?window.location.href=t.getLotURL(e.lotId,!0,!0):bulmaJS.alert({message:exports.aliases.lot+" Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating "+exports.aliases.lot,message:e.errorMessage||"",contextualColorName:"danger"})})});const a=s.querySelectorAll("input, select");for(const e of a)e.addEventListener("change",t.setUnsavedChanges);t.initializeUnlockFieldButtons(s),null===(e=document.querySelector("#button--deleteLot"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault();bulmaJS.confirm({title:"Delete "+exports.aliases.lot,message:`Are you sure you want to delete this ${t.escapedAliases.lot}?`,contextualColorName:"warning",okButton:{text:`Yes, Delete ${t.escapedAliases.Lot}`,callbackFunction:()=>{cityssm.postJSON(t.urlPrefix+"/lots/doDeleteLot",{lotId:o},e=>{e.success?(cityssm.disableNavBlocker(),window.location.href=t.getLotURL()):bulmaJS.alert({title:`Error Deleting ${t.escapedAliases.Lot}`,message:e.errorMessage||"",contextualColorName:"danger"})})}}})});const r=document.querySelector("#lot--lotTypeId");if(n){const e=document.querySelector("#container--lotFields");r.addEventListener("change",()=>{""!==r.value?cityssm.postJSON(t.urlPrefix+"/lots/doGetLotTypeFields",{lotTypeId:r.value},o=>{if(0===o.lotTypeFields.length)return void(e.innerHTML=`
\n

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

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

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

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

There are no comments to display.

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

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

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

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

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

There are no comments to display.

\n
');const n=document.createElement("table");n.className="table is-fullwidth is-striped is-hoverable",n.innerHTML='\n Commentor\n Comment Date\n Comment\n Options\n \n ';for(const o of i){const l=document.createElement("tr");l.dataset.lotCommentId=o.lotCommentId.toString(),l.innerHTML=""+cityssm.escapeHTML(null!==(e=o.recordCreate_userName)&&void 0!==e?e:"")+""+o.lotCommentDateString+(0===o.lotCommentTime?"":" "+o.lotCommentTimeString)+""+cityssm.escapeHTML(null!==(t=o.lotComment)&&void 0!==t?t:"")+'
',l.querySelector(".button--edit").addEventListener("click",d),l.querySelector(".button--delete").addEventListener("click",m),n.querySelector("tbody").append(l)}o.innerHTML="",o.append(n)}delete exports.lotComments,n||(document.querySelector("#lotComments--add").addEventListener("click",function(){let e;function n(o){o.preventDefault(),cityssm.postJSON(t.urlPrefix+"/lots/doAddLotComment",o.currentTarget,t=>{t.success&&(i=t.lotComments,c(),e())})}cityssm.openHtmlModal("lot-addComment",{onshow(e){t.populateAliases(e),e.querySelector("#lotCommentAdd--lotId").value=o,e.querySelector("form").addEventListener("submit",n)},onshown(t,o){bulmaJS.toggleHtmlClipped(),e=o,t.querySelector("#lotCommentAdd--lotComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#lotComments--add").focus()}})}),c())})(); \ No newline at end of file diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js index de1340b6..10cc6e69 100644 --- a/public/javascripts/lotOccupancyEdit.min.js +++ b/public/javascripts/lotOccupancyEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,c;const a=exports.los,n=document.querySelector("#lotOccupancy--lotOccupancyId").value,o=""===n;let s=o;const l=document.querySelector("#form--lotOccupancy");l.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/"+(o?"doCreateLotOccupancy":"doUpdateLotOccupancy"),l,e=>{var t;e.success?(a.clearUnsavedChanges(),o||s?window.location.href=a.getLotOccupancyURL(e.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:"Error Saving "+a.escapedAliases.Occupancy,message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const r=l.querySelectorAll("input, select");for(const e of r)e.addEventListener("change",a.setUnsavedChanges);function u(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doCopyLotOccupancy",{lotOccupancyId:n},e=>{var t;e.success?(cityssm.disableNavBlocker(),window.location.href=a.getLotOccupancyURL(e.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(e=document.querySelector("#button--copyLotOccupancy"))||void 0===e||e.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:u}})}),null===(t=document.querySelector("#button--deleteLotOccupancy"))||void 0===t||t.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:n},e=>{var t;e.success?(cityssm.disableNavBlocker(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(c=document.querySelector("#button--createWorkOrder"))||void 0===c||c.addEventListener("click",e=>{let t;function c(e){e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/workOrders/doCreateWorkOrder",e.currentTarget,e=>{e.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(e.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:e.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){e.querySelector("#workOrderCreate--lotOccupancyId").value=n,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const t=e.querySelector("#workOrderCreate--workOrderTypeId"),c=exports.workOrderTypes;1===c.length&&(t.innerHTML="");for(const e of c){const c=document.createElement("option");c.value=e.workOrderTypeId.toString(),c.textContent=e.workOrderType,t.append(c)}},onshown(e,a){var n;t=a,null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",c)}})});const i=document.querySelector("#lotOccupancy--occupancyTypeId");if(o){const e=document.querySelector("#container--lotOccupancyFields");i.addEventListener("change",()=>{""!==i.value?cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetOccupancyTypeFields",{occupancyTypeId:i.value},t=>{if(0===t.occupancyTypeFields.length)return void(e.innerHTML=`
\n

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

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

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

\n
`})}else{const e=i.value;i.addEventListener("change",()=>{i.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:()=>{s=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{i.value=e}}})})}const d=document.querySelector("#lotOccupancy--lotName");let p;function m(e){const t=Number.parseInt(e.currentTarget.closest("tr").dataset.lotOccupantIndex,10),c=p.find(e=>e.lotOccupantIndex===t);let o,s;function l(e){e.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyOccupant",o,e=>{var t;e.success?(p=e.lotOccupancyOccupants,s(),O()):bulmaJS.alert({title:"Error Updating "+a.escapedAliases.Occupant,message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow:e=>{a.populateAliases(e),e.querySelector("#lotOccupancyOccupantEdit--lotOccupancyId").value=n,e.querySelector("#lotOccupancyOccupantEdit--lotOccupantIndex").value=t.toString();const o=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");let s=!1;for(const e of exports.lotOccupantTypes){const t=document.createElement("option");t.value=e.lotOccupantTypeId.toString(),t.textContent=e.lotOccupantType,e.lotOccupantTypeId===c.lotOccupantTypeId&&(t.selected=!0,s=!0),o.append(t)}if(!s){const e=document.createElement("option");e.value=c.lotOccupantTypeId.toString(),e.textContent=c.lotOccupantType,e.selected=!0,o.append(e)}e.querySelector("#lotOccupancyOccupantEdit--occupantName").value=c.occupantName,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress1").value=c.occupantAddress1,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress2").value=c.occupantAddress2,e.querySelector("#lotOccupancyOccupantEdit--occupantCity").value=c.occupantCity,e.querySelector("#lotOccupancyOccupantEdit--occupantProvince").value=c.occupantProvince,e.querySelector("#lotOccupancyOccupantEdit--occupantPostalCode").value=c.occupantPostalCode,e.querySelector("#lotOccupancyOccupantEdit--occupantPhoneNumber").value=c.occupantPhoneNumber,e.querySelector("#lotOccupancyOccupantEdit--occupantEmailAddress").value=c.occupantEmailAddress,e.querySelector("#lotOccupancyOccupantEdit--occupantComment").value=c.occupantComment},onshown:(e,t)=>{bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId").focus(),(o=e.querySelector("form")).addEventListener("submit",l),s=t},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})}function y(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:n,lotOccupantIndex:t},e=>{var t;e.success?(p=e.lotOccupancyOccupants,O()):bulmaJS.alert({title:"Error Removing "+a.escapedAliases.Occupant,message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function O(){var e,t,c;const n=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(n),0===p.length)return void(n.innerHTML=`
\n

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

\n
`);const o=document.createElement("table");o.className="table is-fullwidth is-striped is-hoverable",o.innerHTML=`\n ${a.escapedAliases.Occupant}\n Address\n Other Contact\n Comment\n Options\n \n `;for(const a of p){const n=document.createElement("tr");n.dataset.lotOccupantIndex=a.lotOccupantIndex.toString(),n.innerHTML=""+cityssm.escapeHTML(""===(null!==(e=a.occupantName)&&void 0!==e?e:"")?"(No Name)":a.occupantName)+'
'+cityssm.escapeHTML(a.lotOccupantType)+""+(a.occupantAddress1?cityssm.escapeHTML(a.occupantAddress1)+"
":"")+(a.occupantAddress2?cityssm.escapeHTML(a.occupantAddress2)+"
":"")+(a.occupantCity?cityssm.escapeHTML(a.occupantCity)+", ":"")+cityssm.escapeHTML(null!==(t=a.occupantProvince)&&void 0!==t?t:"")+"
"+cityssm.escapeHTML(null!==(c=a.occupantPostalCode)&&void 0!==c?c:"")+""+(a.occupantPhoneNumber?cityssm.escapeHTML(a.occupantPhoneNumber)+"
":"")+(a.occupantEmailAddress?cityssm.escapeHTML(a.occupantEmailAddress):"")+""+cityssm.escapeHTML(a.occupantComment)+'
',n.querySelector(".button--edit").addEventListener("click",m),n.querySelector(".button--delete").addEventListener("click",y),o.querySelector("tbody").append(n)}n.append(o)}if(d.addEventListener("click",e=>{const t=e.currentTarget.value;let c,n,o,s;function l(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,a.setUnsavedChanges(),c()}function r(e){e.preventDefault();const t=e.currentTarget;l(t.dataset.lotId,t.dataset.lotName)}function u(){s.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(a.urlPrefix+"/lots/doSearchLots",o,e=>{var t,c;if(0===e.count)return void(s.innerHTML='
\n

No results.

\n
');const a=document.createElement("div");a.className="panel";for(const n of e.lots){const e=document.createElement("a");e.className="panel-block is-block",e.href="#",e.dataset.lotId=n.lotId.toString(),e.dataset.lotName=n.lotName,e.innerHTML='
'+cityssm.escapeHTML(null!==(t=n.lotName)&&void 0!==t?t:"")+'
'+cityssm.escapeHTML(null!==(c=n.mapName)&&void 0!==c?c:"")+'
'+cityssm.escapeHTML(n.lotStatus)+'
'+(n.lotOccupancyCount>0?"Currently Occupied":"")+"
",e.addEventListener("click",r),a.append(e)}s.innerHTML="",s.append(a)})}function i(e){e.preventDefault();const t=n.querySelector("#lotCreate--lotName").value;cityssm.postJSON(a.urlPrefix+"/lots/doCreateLot",e.currentTarget,e=>{var c;e.success?l(e.lotId,t):bulmaJS.alert({title:`Error Creating ${a.escapedAliases.Lot}`,message:null!==(c=e.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-selectLot",{onshow:e=>{a.populateAliases(e)},onshown:(e,a)=>{var l;bulmaJS.toggleHtmlClipped(),n=e,c=a,bulmaJS.init(e);const r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const d=e.querySelector("#lotSelect--occupancyStatus");if(d.addEventListener("change",u),""!==t&&(d.value=""),o=e.querySelector("#form--lotSelect"),s=e.querySelector("#resultsContainer--lotSelect"),o.addEventListener("submit",e=>{e.preventDefault()}),u(),exports.lotNamePattern){const t=exports.lotNamePattern;e.querySelector("#lotCreate--lotName").pattern=t.source}const p=e.querySelector("#lotCreate--lotTypeId");for(const e of exports.lotTypes){const t=document.createElement("option");t.value=e.lotTypeId.toString(),t.textContent=e.lotType,p.append(t)}const m=e.querySelector("#lotCreate--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,m.append(t)}const y=e.querySelector("#lotCreate--mapId");for(const e of exports.maps){const t=document.createElement("option");t.value=e.mapId.toString(),t.textContent=""===(null!==(l=e.mapName)&&void 0!==l?l:"")?"(No Name)":e.mapName,y.append(t)}e.querySelector("#form--lotCreate").addEventListener("submit",i)},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})}),document.querySelector(".is-lot-view-button").addEventListener("click",()=>{const e=document.querySelector("#lotOccupancy--lotId").value;e?window.open(a.urlPrefix+"/lots/"+e):bulmaJS.alert({message:`No ${a.escapedAliases.lot} selected.`,contextualColorName:"info"})}),document.querySelector(".is-clear-lot-button").addEventListener("click",()=>{d.disabled?bulmaJS.alert({message:"You need to unlock the field before clearing it.",contextualColorName:"info"}):(d.value=`(No ${a.escapedAliases.Lot})`,document.querySelector("#lotOccupancy--lotId").value="",a.setUnsavedChanges())}),a.initializeDatePickers(l),document.querySelector("#lotOccupancy--occupancyStartDateString").addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),a.initializeUnlockFieldButtons(l),Object.defineProperty(exports,"__esModule",{value:!0}),o){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{const t=l.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const c of t)c.disabled=""===e.value})}else p=exports.lotOccupancyOccupants,delete exports.lotOccupancyOccupants,document.querySelector("#button--addOccupant").addEventListener("click",()=>{let e,t,c,o;function s(t){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyOccupant",t,t=>{var c;t.success?(p=t.lotOccupancyOccupants,e(),O()):bulmaJS.alert({title:`Error Adding ${a.escapedAliases.Occupant}`,message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}function l(e){e.preventDefault(),s(t)}let r=[];function u(e){e.preventDefault();const t=e.currentTarget,c=r[Number.parseInt(t.dataset.index,10)],o=t.closest(".modal").querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId").value;""===o?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(c.lotOccupantTypeId=Number.parseInt(o,10),c.lotOccupancyId=Number.parseInt(n,10),s(c))}function i(e){e.preventDefault(),""!==c.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(o.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doSearchPastOccupants",c,e=>{var t,c,a,n,s,l;r=e.occupants;const i=document.createElement("div");i.className="panel";for(const[e,o]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=o.occupantName)&&void 0!==t?t:"")+'
'+cityssm.escapeHTML(null!==(c=o.occupantAddress1)&&void 0!==c?c:"")+"
"+(o.occupantAddress2?cityssm.escapeHTML(o.occupantAddress2)+"
":"")+cityssm.escapeHTML(null!==(a=o.occupantCity)&&void 0!==a?a:"")+", "+cityssm.escapeHTML(null!==(n=o.occupantProvince)&&void 0!==n?n:"")+"
"+cityssm.escapeHTML(null!==(s=o.occupantPostalCode)&&void 0!==s?s:"")+'
'+(o.occupantPhoneNumber?cityssm.escapeHTML(o.occupantPhoneNumber)+"
":"")+cityssm.escapeHTML(null!==(l=o.occupantEmailAddress)&&void 0!==l?l:"")+"
",r.addEventListener("click",u),i.append(r)}o.innerHTML="",o.append(i)})):o.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=n;const t=e.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId"),c=e.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId");for(const e of exports.lotOccupantTypes){const a=document.createElement("option");a.value=e.lotOccupantTypeId.toString(),a.textContent=e.lotOccupantType,t.append(a),c.append(a.cloneNode(!0))}e.querySelector("#lotOccupancyOccupantAdd--occupantCity").value=exports.occupantCityDefault,e.querySelector("#lotOccupancyOccupantAdd--occupantProvince").value=exports.occupantProvinceDefault},onshown:(a,n)=>{bulmaJS.toggleHtmlClipped(),bulmaJS.init(a),a.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId").focus(),(t=a.querySelector("#form--lotOccupancyOccupantAdd")).addEventListener("submit",l),o=a.querySelector("#lotOccupancyOccupantCopy--searchResults"),(c=a.querySelector("#form--lotOccupancyOccupantCopy")).addEventListener("submit",e=>{e.preventDefault()}),a.querySelector("#lotOccupancyOccupantCopy--searchFilter").addEventListener("change",i),e=n},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})}),O();if(!o){Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.lotOccupancyComments;function v(t){const c=Number.parseInt(t.currentTarget.closest("tr").dataset.lotOccupancyCommentId,10),o=e.find(e=>e.lotOccupancyCommentId===c);let s,l;function r(t){t.preventDefault(),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyComment",s,t=>{var c;t.success?(e=t.lotOccupancyComments,l(),f()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editComment",{onshow:e=>{a.populateAliases(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value=n,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value=c.toString(),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value=o.lotOccupancyComment;const t=e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");t.value=o.lotOccupancyCommentDateString;const s=cityssm.dateToString(new Date);t.max=o.lotOccupancyCommentDateString<=s?s:o.lotOccupancyCommentDateString,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value=o.lotOccupancyCommentTimeString},onshown:(e,t)=>{bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus(),(s=e.querySelector("form")).addEventListener("submit",r),l=t},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})}function g(t){const c=Number.parseInt(t.currentTarget.closest("tr").dataset.lotOccupancyCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyComment",{lotOccupancyId:n,lotOccupancyCommentId:c},t=>{var c;t.success?(e=t.lotOccupancyComments,f()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function f(){var t,c;const a=document.querySelector("#container--lotOccupancyComments");if(0===e.length)return void(a.innerHTML='

There are no comments associated with this record.

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

There are no fees associated with this record.

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

';let n=!1;for(const o of a.fees){if(c.querySelector(".container--lotOccupancyFee[data-fee-id='"+o.feeId+"'][data-include-quantity='0']"))continue;let a=!0;for(const e of t)if(!o.feeName.toLowerCase().includes(e)){a=!1;break}if(!a)continue;n=!0;const s=document.createElement("a");s.className="panel-block is-block container--fee",s.dataset.feeId=o.feeId.toString(),s.href="#",s.innerHTML=""+cityssm.escapeHTML(o.feeName||"")+"
"+cityssm.escapeHTML(o.feeDescription||"").replace(/\n/g,"
")+"
",s.addEventListener("click",u),e.querySelector(".panel").append(s)}n&&s.append(e)}};cityssm.openHtmlModal("lotOccupancy-addFee",{onshow:t=>{o=t.querySelector("#feeSelect--feeName"),s=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetFees",{lotOccupancyId:n},t=>{e=t.feeCategories,o.disabled=!1,o.addEventListener("keyup",i),o.focus(),i()})},onshown:()=>{bulmaJS.toggleHtmlClipped()},onhidden:()=>{l()},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})});let r=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const u=document.querySelector("#container--lotOccupancyTransactions"),i=()=>{let e=0;for(const t of r)e+=t.transactionAmount;return e},d=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:()=>{cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyTransaction",{lotOccupancyId:n,transactionIndex:t},e=>{e.success?(r=e.lotOccupancyTransactions,p()):bulmaJS.alert({title:"Error Deleting Transaction",message:e.errorMessage||"",contextualColorName:"danger"})})}}})},p=()=>{if(0===r.length)return void(u.innerHTML='

There are no transactions associated with this record.

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

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

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

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

\n
`})}else{const e=i.value;i.addEventListener("change",()=>{i.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${n.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:()=>{s=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{i.value=e}}})})}const d=document.querySelector("#lotOccupancy--lotName");let p;function m(e){const t=Number.parseInt(e.currentTarget.closest("tr").dataset.lotOccupantIndex,10),c=p.find(e=>e.lotOccupantIndex===t);let o,s;function l(e){e.preventDefault(),cityssm.postJSON(n.urlPrefix+"/lotOccupancies/doUpdateLotOccupancyOccupant",o,e=>{var t;e.success?(p=e.lotOccupancyOccupants,s(),O()):bulmaJS.alert({title:"Error Updating "+n.escapedAliases.Occupant,message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow:e=>{n.populateAliases(e),e.querySelector("#lotOccupancyOccupantEdit--lotOccupancyId").value=a,e.querySelector("#lotOccupancyOccupantEdit--lotOccupantIndex").value=t.toString();const o=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");let s=!1;for(const e of exports.lotOccupantTypes){const t=document.createElement("option");t.value=e.lotOccupantTypeId.toString(),t.textContent=e.lotOccupantType,e.lotOccupantTypeId===c.lotOccupantTypeId&&(t.selected=!0,s=!0),o.append(t)}if(!s){const e=document.createElement("option");e.value=c.lotOccupantTypeId.toString(),e.textContent=c.lotOccupantType,e.selected=!0,o.append(e)}e.querySelector("#lotOccupancyOccupantEdit--occupantName").value=c.occupantName,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress1").value=c.occupantAddress1,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress2").value=c.occupantAddress2,e.querySelector("#lotOccupancyOccupantEdit--occupantCity").value=c.occupantCity,e.querySelector("#lotOccupancyOccupantEdit--occupantProvince").value=c.occupantProvince,e.querySelector("#lotOccupancyOccupantEdit--occupantPostalCode").value=c.occupantPostalCode,e.querySelector("#lotOccupancyOccupantEdit--occupantPhoneNumber").value=c.occupantPhoneNumber,e.querySelector("#lotOccupancyOccupantEdit--occupantEmailAddress").value=c.occupantEmailAddress,e.querySelector("#lotOccupancyOccupantEdit--occupantComment").value=c.occupantComment},onshown:(e,t)=>{bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId").focus(),(o=e.querySelector("form")).addEventListener("submit",l),s=t},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})}function y(e){const t=e.currentTarget.closest("tr").dataset.lotOccupantIndex;bulmaJS.confirm({title:`Remove ${n.escapedAliases.Occupant}?`,message:`Are you sure you want to remove this ${n.escapedAliases.occupant}?`,okButton:{text:"Yes, Remove "+n.escapedAliases.Occupant,callbackFunction:function(){cityssm.postJSON(n.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyOccupant",{lotOccupancyId:a,lotOccupantIndex:t},e=>{var t;e.success?(p=e.lotOccupancyOccupants,O()):bulmaJS.alert({title:"Error Removing "+n.escapedAliases.Occupant,message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function O(){var e,t,c;const a=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(a),0===p.length)return void(a.innerHTML=`
\n

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

\n
`);const o=document.createElement("table");o.className="table is-fullwidth is-striped is-hoverable",o.innerHTML=`\n ${n.escapedAliases.Occupant}\n Address\n Other Contact\n Comment\n Options\n \n `;for(const n of p){const a=document.createElement("tr");a.dataset.lotOccupantIndex=n.lotOccupantIndex.toString(),a.innerHTML=""+cityssm.escapeHTML(""===(null!==(e=n.occupantName)&&void 0!==e?e:"")?"(No Name)":n.occupantName)+'
'+cityssm.escapeHTML(n.lotOccupantType)+""+(n.occupantAddress1?cityssm.escapeHTML(n.occupantAddress1)+"
":"")+(n.occupantAddress2?cityssm.escapeHTML(n.occupantAddress2)+"
":"")+(n.occupantCity?cityssm.escapeHTML(n.occupantCity)+", ":"")+cityssm.escapeHTML(null!==(t=n.occupantProvince)&&void 0!==t?t:"")+"
"+cityssm.escapeHTML(null!==(c=n.occupantPostalCode)&&void 0!==c?c:"")+""+(n.occupantPhoneNumber?cityssm.escapeHTML(n.occupantPhoneNumber)+"
":"")+(n.occupantEmailAddress?cityssm.escapeHTML(n.occupantEmailAddress):"")+""+cityssm.escapeHTML(n.occupantComment)+'
',a.querySelector(".button--edit").addEventListener("click",m),a.querySelector(".button--delete").addEventListener("click",y),o.querySelector("tbody").append(a)}a.append(o)}if(d.addEventListener("click",e=>{const t=e.currentTarget.value;let c,a,o,s;function l(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,n.setUnsavedChanges(),c()}function r(e){e.preventDefault();const t=e.currentTarget;l(t.dataset.lotId,t.dataset.lotName)}function u(){s.innerHTML=n.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(n.urlPrefix+"/lots/doSearchLots",o,e=>{var t,c;if(0===e.count)return void(s.innerHTML='
\n

No results.

\n
');const n=document.createElement("div");n.className="panel";for(const a of e.lots){const e=document.createElement("a");e.className="panel-block is-block",e.href="#",e.dataset.lotId=a.lotId.toString(),e.dataset.lotName=a.lotName,e.innerHTML='
'+cityssm.escapeHTML(null!==(t=a.lotName)&&void 0!==t?t:"")+'
'+cityssm.escapeHTML(null!==(c=a.mapName)&&void 0!==c?c:"")+'
'+cityssm.escapeHTML(a.lotStatus)+'
'+(a.lotOccupancyCount>0?"Currently Occupied":"")+"
",e.addEventListener("click",r),n.append(e)}s.innerHTML="",s.append(n)})}function i(e){e.preventDefault();const t=a.querySelector("#lotCreate--lotName").value;cityssm.postJSON(n.urlPrefix+"/lots/doCreateLot",e.currentTarget,e=>{var c;e.success?l(e.lotId,t):bulmaJS.alert({title:`Error Creating ${n.escapedAliases.Lot}`,message:null!==(c=e.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-selectLot",{onshow:e=>{n.populateAliases(e)},onshown:(e,n)=>{var l;bulmaJS.toggleHtmlClipped(),a=e,c=n,bulmaJS.init(e);const r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const d=e.querySelector("#lotSelect--occupancyStatus");if(d.addEventListener("change",u),""!==t&&(d.value=""),o=e.querySelector("#form--lotSelect"),s=e.querySelector("#resultsContainer--lotSelect"),o.addEventListener("submit",e=>{e.preventDefault()}),u(),exports.lotNamePattern){const t=exports.lotNamePattern;e.querySelector("#lotCreate--lotName").pattern=t.source}const p=e.querySelector("#lotCreate--lotTypeId");for(const e of exports.lotTypes){const t=document.createElement("option");t.value=e.lotTypeId.toString(),t.textContent=e.lotType,p.append(t)}const m=e.querySelector("#lotCreate--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,m.append(t)}const y=e.querySelector("#lotCreate--mapId");for(const e of exports.maps){const t=document.createElement("option");t.value=e.mapId.toString(),t.textContent=""===(null!==(l=e.mapName)&&void 0!==l?l:"")?"(No Name)":e.mapName,y.append(t)}e.querySelector("#form--lotCreate").addEventListener("submit",i)},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})}),document.querySelector(".is-lot-view-button").addEventListener("click",()=>{const e=document.querySelector("#lotOccupancy--lotId").value;e?window.open(n.urlPrefix+"/lots/"+e):bulmaJS.alert({message:`No ${n.escapedAliases.lot} selected.`,contextualColorName:"info"})}),document.querySelector(".is-clear-lot-button").addEventListener("click",()=>{d.disabled?bulmaJS.alert({message:"You need to unlock the field before clearing it.",contextualColorName:"info"}):(d.value=`(No ${n.escapedAliases.Lot})`,document.querySelector("#lotOccupancy--lotId").value="",n.setUnsavedChanges())}),n.initializeDatePickers(l),document.querySelector("#lotOccupancy--occupancyStartDateString").addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),n.initializeUnlockFieldButtons(l),Object.defineProperty(exports,"__esModule",{value:!0}),o){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{const t=l.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const c of t)c.disabled=""===e.value})}else p=exports.lotOccupancyOccupants,delete exports.lotOccupancyOccupants,document.querySelector("#button--addOccupant").addEventListener("click",()=>{let e,t,c,o;function s(t){cityssm.postJSON(n.urlPrefix+"/lotOccupancies/doAddLotOccupancyOccupant",t,t=>{var c;t.success?(p=t.lotOccupancyOccupants,e(),O()):bulmaJS.alert({title:`Error Adding ${n.escapedAliases.Occupant}`,message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}function l(e){e.preventDefault(),s(t)}let r=[];function u(e){e.preventDefault();const t=e.currentTarget,c=r[Number.parseInt(t.dataset.index,10)],o=t.closest(".modal").querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId").value;""===o?bulmaJS.alert({title:`No ${n.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${n.escapedAliases.occupant}.`,contextualColorName:"warning"}):(c.lotOccupantTypeId=Number.parseInt(o,10),c.lotOccupancyId=Number.parseInt(a,10),s(c))}function i(e){e.preventDefault(),""!==c.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(o.innerHTML=n.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(n.urlPrefix+"/lotOccupancies/doSearchPastOccupants",c,e=>{var t,c,n,a,s,l;r=e.occupants;const i=document.createElement("div");i.className="panel";for(const[e,o]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=o.occupantName)&&void 0!==t?t:"")+'
'+cityssm.escapeHTML(null!==(c=o.occupantAddress1)&&void 0!==c?c:"")+"
"+(o.occupantAddress2?cityssm.escapeHTML(o.occupantAddress2)+"
":"")+cityssm.escapeHTML(null!==(n=o.occupantCity)&&void 0!==n?n:"")+", "+cityssm.escapeHTML(null!==(a=o.occupantProvince)&&void 0!==a?a:"")+"
"+cityssm.escapeHTML(null!==(s=o.occupantPostalCode)&&void 0!==s?s:"")+'
'+(o.occupantPhoneNumber?cityssm.escapeHTML(o.occupantPhoneNumber)+"
":"")+cityssm.escapeHTML(null!==(l=o.occupantEmailAddress)&&void 0!==l?l:"")+"
",r.addEventListener("click",u),i.append(r)}o.innerHTML="",o.append(i)})):o.innerHTML='

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

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

There are no comments associated with this record.

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

There are no fees associated with this record.

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

';let l=!1;for(const s of o.fees){if(c.querySelector(".container--lotOccupancyFee[data-fee-id='"+s.feeId+"'][data-include-quantity='0']"))continue;let o=!0;for(const e of a)if(!s.feeName.toLowerCase().includes(e)){o=!1;break}if(!o)continue;l=!0;const u=document.createElement("a");u.className="panel-block is-block container--fee",u.dataset.feeId=s.feeId.toString(),u.href="#",u.innerHTML=""+cityssm.escapeHTML(null!==(t=s.feeName)&&void 0!==t?t:"")+"
"+cityssm.escapeHTML(null!==(n=s.feeDescription)&&void 0!==n?n:"").replace(/\n/g,"
")+"
",u.addEventListener("click",r),e.querySelector(".panel").append(u)}l&&s.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){o=t.querySelector("#feeSelect--feeName"),s=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(n.urlPrefix+"/lotOccupancies/doGetFees",{lotOccupancyId:a},t=>{e=t.feeCategories,o.disabled=!1,o.addEventListener("keyup",u),o.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){b()},onremoved(){bulmaJS.toggleHtmlClipped()}})});let o=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const s=document.querySelector("#container--lotOccupancyTransactions");function C(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(n.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyTransaction",{lotOccupancyId:a,transactionIndex:t},e=>{var t;e.success?(o=e.lotOccupancyTransactions,T()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=e.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function T(){var e,c;if(0===o.length)return void(s.innerHTML='

There are no transactions associated with this record.

');s.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n \n \n
Date${n.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`;let a=0;for(const t of o){a+=t.transactionAmount;const n=document.createElement("tr");n.className="container--lotOccupancyTransaction",n.dataset.transactionIndex=t.transactionIndex.toString(),n.innerHTML=""+t.transactionDateString+""+cityssm.escapeHTML(null!==(e=t.externalReceiptNumber)&&void 0!==e?e:"")+"
"+cityssm.escapeHTML(null!==(c=t.transactionNote)&&void 0!==c?c:"")+'$'+t.transactionAmount.toFixed(2)+'',n.querySelector("button").addEventListener("click",C),s.querySelector("tbody").append(n)}s.querySelector("#lotOccupancyTransactions--grandTotal").textContent="$"+a.toFixed(2);const l=h();l>a&&s.insertAdjacentHTML("afterbegin",'
Outstanding Balance
$'+(l-a).toFixed(2)+"
")}document.querySelector("#button--addTransaction").addEventListener("click",()=>{let e;function t(t){t.preventDefault(),cityssm.postJSON(n.urlPrefix+"/lotOccupancies/doAddLotOccupancyTransaction",t.currentTarget,t=>{var c;t.success?(o=t.lotOccupancyTransactions,e(),T()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(c=t.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow:e=>{n.populateAliases(e),e.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=a.toString();const t=h(),c=function(){let e=0;for(const t of o)e+=t.transactionAmount;return e}(),s=e.querySelector("#lotOccupancyTransactionAdd--transactionAmount");s.min=(-1*c).toFixed(2),s.max=Math.max(t-c,0).toFixed(2),s.value=Math.max(t-c,0).toFixed(2)},onshown:(c,n)=>{bulmaJS.toggleHtmlClipped(),e=n,c.querySelector("form").addEventListener("submit",t)},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})}),b()}})(); \ No newline at end of file