From 9f949061128b307d92e87f0f6e510853604d58d5 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Thu, 27 Jun 2024 13:48:12 -0400 Subject: [PATCH] linting --- public-typescript/lotOccupancyEdit.js | 12 +- .../lotOccupancyEdit/lotOccupancyEdit.js | 6 +- .../lotOccupancyEdit/lotOccupancyEdit.ts | 4 +- .../lotOccupancyEdit/lotOccupancyEditFees.js | 6 +- .../lotOccupancyEdit/lotOccupancyEditFees.ts | 6 +- public-typescript/lotSearch.js | 2 +- public-typescript/lotSearch.ts | 2 +- public-typescript/workOrderEdit.js | 537 +++++++++--------- .../workOrderEdit/workOrderEdit.js | 111 ++-- .../workOrderEdit/workOrderEdit.ts | 121 ++-- .../workOrderEdit/workOrderEditComments.js | 98 ++-- .../workOrderEdit/workOrderEditComments.ts | 149 ++--- .../workOrderEdit/workOrderEditLots.js | 328 ++++++----- .../workOrderEdit/workOrderEditLots.ts | 386 +++++++------ public/javascripts/lotOccupancyEdit.min.js | 2 +- public/javascripts/lotSearch.min.js | 2 +- public/javascripts/workOrderEdit.min.js | 2 +- 17 files changed, 888 insertions(+), 886 deletions(-) diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js index 6f8ed253..fbbf25e6 100644 --- a/public-typescript/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit.js @@ -380,7 +380,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); los.populateAliases(modalElement); }, onshown(modalElement, closeModalFunction) { - var _a; + var _a, _b; bulmaJS.toggleHtmlClipped(); lotSelectModalElement = modalElement; lotSelectCloseModalFunction = closeModalFunction; @@ -428,7 +428,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const optionElement = document.createElement('option'); optionElement.value = map.mapId.toString(); optionElement.textContent = - ((_a = map.mapName) !== null && _a !== void 0 ? _a : '') === '' ? '(No Name)' : map.mapName; + ((_a = map.mapName) !== null && _a !== void 0 ? _a : '') === '' ? '(No Name)' : (_b = map.mapName) !== null && _b !== void 0 ? _b : ''; mapElement.append(optionElement); } ; @@ -449,7 +449,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } else { - window.open(los.urlPrefix + '/lots/' + lotId); + window.open(`${los.urlPrefix}/lots/${lotId}`); } }); (_e = document @@ -1586,7 +1586,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); .querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement); } ; - lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = '$' + transactionGrandTotal.toFixed(2); + lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = `\$${transactionGrandTotal.toFixed(2)}`; const feeGrandTotal = getFeeGrandTotal(); if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) { lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `
@@ -1596,7 +1596,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
Outstanding Balance
-
$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}
+
+ $${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))} +
`); diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js index 60b11aac..e4b34cd1 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js @@ -380,7 +380,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); los.populateAliases(modalElement); }, onshown(modalElement, closeModalFunction) { - var _a; + var _a, _b; bulmaJS.toggleHtmlClipped(); lotSelectModalElement = modalElement; lotSelectCloseModalFunction = closeModalFunction; @@ -428,7 +428,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const optionElement = document.createElement('option'); optionElement.value = map.mapId.toString(); optionElement.textContent = - ((_a = map.mapName) !== null && _a !== void 0 ? _a : '') === '' ? '(No Name)' : map.mapName; + ((_a = map.mapName) !== null && _a !== void 0 ? _a : '') === '' ? '(No Name)' : (_b = map.mapName) !== null && _b !== void 0 ? _b : ''; mapElement.append(optionElement); } ; @@ -449,7 +449,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } else { - window.open(los.urlPrefix + '/lots/' + lotId); + window.open(`${los.urlPrefix}/lots/${lotId}`); } }); (_e = document diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts index 9f286b74..4045876f 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts @@ -661,7 +661,7 @@ declare const exports: Record const optionElement = document.createElement('option') optionElement.value = map.mapId!.toString() optionElement.textContent = - (map.mapName ?? '') === '' ? '(No Name)' : map.mapName! + (map.mapName ?? '') === '' ? '(No Name)' : map.mapName ?? '' mapElement.append(optionElement) } @@ -688,7 +688,7 @@ declare const exports: Record contextualColorName: 'info' }) } else { - window.open(los.urlPrefix + '/lots/' + lotId) + window.open(`${los.urlPrefix}/lots/${lotId}`) } }) diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js index 0a9e0911..d89d85c2 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js @@ -514,7 +514,7 @@ function renderLotOccupancyTransactions() { .querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement); } ; - lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = '$' + transactionGrandTotal.toFixed(2); + lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = `\$${transactionGrandTotal.toFixed(2)}`; const feeGrandTotal = getFeeGrandTotal(); if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) { lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `
@@ -524,7 +524,9 @@ function renderLotOccupancyTransactions() {
Outstanding Balance
-
$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}
+
+ $${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))} +
`); diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts index 6856a239..6cda72c6 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts @@ -784,7 +784,7 @@ function renderLotOccupancyTransactions(): void { lotOccupancyTransactionsContainerElement.querySelector( '#lotOccupancyTransactions--grandTotal' ) as HTMLElement - ).textContent = '$' + transactionGrandTotal.toFixed(2) + ).textContent = `\$${transactionGrandTotal.toFixed(2)}` const feeGrandTotal = getFeeGrandTotal() @@ -798,7 +798,9 @@ function renderLotOccupancyTransactions(): void {
Outstanding Balance
-
$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}
+
+ $${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))} +
` diff --git a/public-typescript/lotSearch.js b/public-typescript/lotSearch.js index 56ed5cb2..b767dfb4 100644 --- a/public-typescript/lotSearch.js +++ b/public-typescript/lotSearch.js @@ -65,7 +65,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); function getLots() { // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Lots}...`); - cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFilterFormElement, renderLots); + cityssm.postJSON(`${los.urlPrefix}/lots/doSearchLots`, searchFilterFormElement, renderLots); } function resetOffsetAndGetLots() { offsetElement.value = '0'; diff --git a/public-typescript/lotSearch.ts b/public-typescript/lotSearch.ts index 05305a73..d5459fa1 100644 --- a/public-typescript/lotSearch.ts +++ b/public-typescript/lotSearch.ts @@ -121,7 +121,7 @@ declare const exports: Record ) cityssm.postJSON( - los.urlPrefix + '/lots/doSearchLots', + `${los.urlPrefix}/lots/doSearchLots`, searchFilterFormElement, renderLots ) diff --git a/public-typescript/workOrderEdit.js b/public-typescript/workOrderEdit.js index af81c919..741550e1 100644 --- a/public-typescript/workOrderEdit.js +++ b/public-typescript/workOrderEdit.js @@ -153,7 +153,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); */ if (!isCreate) { "use strict"; - /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ + // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair + /* eslint-disable unicorn/prefer-module */ var _a, _b; Object.defineProperty(exports, "__esModule", { value: true }); let workOrderLots = exports.workOrderLots; @@ -163,7 +164,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); function deleteLotOccupancy(clickEvent) { const lotOccupancyId = clickEvent.currentTarget.closest('.container--lotOccupancy').dataset.lotOccupancyId; function doDelete() { - cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLotOccupancy', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doDeleteWorkOrderLotOccupancy`, { workOrderId, lotOccupancyId }, (rawResponseJSON) => { @@ -193,7 +194,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function addLot(lotId, callbackFunction) { - cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLot', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doAddWorkOrderLot`, { workOrderId, lotId }, (rawResponseJSON) => { @@ -216,7 +217,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function addLotOccupancy(lotOccupancyId, callbackFunction) { - cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLotOccupancy', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doAddWorkOrderLotOccupancy`, { workOrderId, lotOccupancyId }, (rawResponseJSON) => { @@ -228,7 +229,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); } else { bulmaJS.alert({ - title: 'Error Adding ' + los.escapedAliases.Occupancy, + title: `Error Adding ${los.escapedAliases.Occupancy}`, message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); @@ -239,19 +240,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function addLotFromLotOccupancy(clickEvent) { - const lotId = clickEvent.currentTarget.dataset.lotId; + var _a; + const lotId = (_a = clickEvent.currentTarget.dataset.lotId) !== null && _a !== void 0 ? _a : ''; addLot(lotId); } function renderRelatedOccupancies() { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f; const occupanciesContainerElement = document.querySelector('#container--lotOccupancies'); document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent = workOrderLotOccupancies.length.toString(); if (workOrderLotOccupancies.length === 0) { + // eslint-disable-next-line no-unsanitized/property occupanciesContainerElement.innerHTML = `

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

`; return; } + // eslint-disable-next-line no-unsanitized/property occupanciesContainerElement.innerHTML = ` @@ -275,44 +279,33 @@ Object.defineProperty(exports, "__esModule", { value: true }); workOrderLots.some((lot) => { return lotOccupancy.lotId === lot.lotId; }); - rowElement.innerHTML = - '' + - (''); + // eslint-disable-next-line no-unsanitized/property + rowElement.innerHTML = ``; if (lotOccupancy.lotId) { - rowElement.insertAdjacentHTML('beforeend', ''); + // eslint-disable-next-line no-unsanitized/method + rowElement.insertAdjacentHTML('beforeend', ``); } else { + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML('beforeend', ``); } let occupantsHTML = ''; @@ -328,41 +321,39 @@ Object.defineProperty(exports, "__esModule", { value: true }); ${cityssm.escapeHTML(occupant.occupantFamilyName)} `; } - rowElement.insertAdjacentHTML('beforeend', '' + - ('') + - ('') + - ('')); + // eslint-disable-next-line no-unsanitized/method + rowElement.insertAdjacentHTML('beforeend', ``); (_d = rowElement .querySelector('.button--addLot')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', addLotFromLotOccupancy); - rowElement - .querySelector('.button--deleteLotOccupancy') - .addEventListener('click', deleteLotOccupancy); - occupanciesContainerElement.querySelector('tbody').append(rowElement); + (_e = rowElement + .querySelector('.button--deleteLotOccupancy')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancy); + (_f = occupanciesContainerElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(rowElement); } } function openEditLotStatus(clickEvent) { - const lotId = Number.parseInt(clickEvent.currentTarget.closest('.container--lot').dataset.lotId, 10); + var _a; + const lotId = Number.parseInt((_a = clickEvent.currentTarget.closest('.container--lot').dataset.lotId) !== null && _a !== void 0 ? _a : '', 10); const lot = workOrderLots.find((possibleLot) => { return possibleLot.lotId === lotId; }); let editCloseModalFunction; function doUpdateLotStatus(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doUpdateLotStatus`, submitEvent.currentTarget, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -381,9 +372,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); } cityssm.openHtmlModal('lot-editLotStatus', { onshow(modalElement) { + var _a, _b, _c; los.populateAliases(modalElement); modalElement.querySelector('#lotStatusEdit--lotId').value = lotId.toString(); - modalElement.querySelector('#lotStatusEdit--lotName').value = lot.lotName; + modalElement.querySelector('#lotStatusEdit--lotName').value = (_a = lot.lotName) !== null && _a !== void 0 ? _a : ''; const lotStatusElement = modalElement.querySelector('#lotStatusEdit--lotStatusId'); let lotStatusFound = false; for (const lotStatus of exports.lotStatuses) { @@ -398,22 +390,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); if (!lotStatusFound && lot.lotStatusId) { const optionElement = document.createElement('option'); optionElement.value = lot.lotStatusId.toString(); - optionElement.textContent = lot.lotStatus; + optionElement.textContent = (_b = lot.lotStatus) !== null && _b !== void 0 ? _b : ''; lotStatusElement.append(optionElement); } if (lot.lotStatusId) { lotStatusElement.value = lot.lotStatusId.toString(); } - modalElement - .querySelector('form') - .insertAdjacentHTML('beforeend', ``); + // eslint-disable-next-line no-unsanitized/method + (_c = modalElement + .querySelector('form')) === null || _c === void 0 ? void 0 : _c.insertAdjacentHTML('beforeend', ``); }, onshown(modalElement, closeModalFunction) { + var _a; editCloseModalFunction = closeModalFunction; bulmaJS.toggleHtmlClipped(); - modalElement - .querySelector('form') - .addEventListener('submit', doUpdateLotStatus); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doUpdateLotStatus); }, onremoved() { bulmaJS.toggleHtmlClipped(); @@ -423,7 +415,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); function deleteLot(clickEvent) { const lotId = clickEvent.currentTarget.closest('.container--lot').dataset.lotId; function doDelete() { - cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLot', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doDeleteWorkOrderLot`, { workOrderId, lotId }, (rawResponseJSON) => { @@ -453,59 +445,57 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function renderRelatedLots() { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f, _g; const lotsContainerElement = document.querySelector('#container--lots'); document.querySelector(".tabs a[href='#relatedTab--lots'] .tag").textContent = workOrderLots.length.toString(); if (workOrderLots.length === 0) { + // eslint-disable-next-line no-unsanitized/property lotsContainerElement.innerHTML = `
-

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

-
`; +

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

+ `; return; } + // eslint-disable-next-line no-unsanitized/property lotsContainerElement.innerHTML = `
' + - (isActive - ? '' - : '') + - '' + - '' + - cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') + - '
' + - `#${lotOccupancy.lotOccupancyId}` + - '
+ ${isActive + ? `` + : ``} + + + ${cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '')} +
+ #${lotOccupancy.lotOccupancyId} +
' + - cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '') + - (hasLotRecord - ? '' - : ' ') + - ' + ${cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '')} + ${hasLotRecord + ? '' + : ` `} + (No ${los.escapedAliases.Lot})' + - lotOccupancy.occupancyStartDateString + - '' + - (lotOccupancy.occupancyEndDate - ? lotOccupancy.occupancyEndDateString - : '(No End Date)') + - '' + - (lotOccupancy.lotOccupancyOccupants.length === 0 - ? `(No ${los.escapedAliases.Occupants})` - : `
    ${occupantsHTML}
`) + - '
' + - '' + - ' + ${lotOccupancy.occupancyStartDateString} + + ${lotOccupancy.occupancyEndDate + ? lotOccupancy.occupancyEndDateString + : '(No End Date)'} + + ${lotOccupancy.lotOccupancyOccupants.length === 0 + ? `(No ${los.escapedAliases.Occupants})` + : `
    ${occupantsHTML}
`} +
+ +
- - - - - - - - -
${los.escapedAliases.Lot}${los.escapedAliases.Map}${los.escapedAliases.Lot} TypeStatus
`; + + ${los.escapedAliases.Lot} + ${los.escapedAliases.Map} + ${los.escapedAliases.Lot} Type + Status + + + + `; for (const lot of workOrderLots) { const rowElement = document.createElement('tr'); rowElement.className = 'container--lot'; rowElement.dataset.lotId = lot.lotId.toString(); - rowElement.innerHTML = - '' + - '' + - cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + - '' + - '' + - `${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')}` + - `${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')}` + - ('' + - (lot.lotStatusId - ? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '') - : '(No Status)') + - '') + - ` + // eslint-disable-next-line no-unsanitized/property + rowElement.innerHTML = ` + + ${cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '')} + + + ${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')} + + ${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')} + + ${lot.lotStatusId + ? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '') + : '(No Status)'} + - `; - rowElement - .querySelector('.button--editLotStatus') - .addEventListener('click', openEditLotStatus); - rowElement - .querySelector('.button--deleteLot') - .addEventListener('click', deleteLot); - lotsContainerElement.querySelector('tbody').append(rowElement); + `; + (_e = rowElement + .querySelector('.button--editLotStatus')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', openEditLotStatus); + (_f = rowElement + .querySelector('.button--deleteLot')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLot); + (_g = lotsContainerElement.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(rowElement); } } function renderRelatedLotsAndOccupancies() { @@ -514,8 +504,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); } renderRelatedLotsAndOccupancies(); function doAddLotOccupancy(clickEvent) { + var _a; const rowElement = clickEvent.currentTarget.closest('tr'); - const lotOccupancyId = rowElement.dataset.lotOccupancyId; + const lotOccupancyId = (_a = rowElement.dataset.lotOccupancyId) !== null && _a !== void 0 ? _a : ''; addLotOccupancy(lotOccupancyId, (success) => { if (success) { rowElement.remove(); @@ -530,10 +521,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); if (event) { event.preventDefault(); } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML('Searching...'); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFormElement, (rawResponseJSON) => { - var _a, _b; + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doSearchLotOccupancies`, searchFormElement, (rawResponseJSON) => { + var _a, _b, _c, _d; const responseJSON = rawResponseJSON; if (responseJSON.lotOccupancies.length === 0) { searchResultsContainerElement.innerHTML = `
@@ -541,6 +533,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
`; return; } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = ` @@ -571,32 +564,32 @@ Object.defineProperty(exports, "__esModule", { value: true }); ''); } else { + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML('beforeend', ``); } - rowElement.insertAdjacentHTML('beforeend', `` + - ('') + - ('')); - rowElement - .querySelector('.button--addLotOccupancy') - .addEventListener('click', doAddLotOccupancy); - searchResultsContainerElement - .querySelector('tbody') - .append(rowElement); + // eslint-disable-next-line no-unsanitized/method + rowElement.insertAdjacentHTML('beforeend', ``); + (_c = rowElement + .querySelector('.button--addLotOccupancy')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', doAddLotOccupancy); + (_d = searchResultsContainerElement + .querySelector('tbody')) === null || _d === void 0 ? void 0 : _d.append(rowElement); } }); } @@ -624,8 +617,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); }); function doAddLot(clickEvent) { + var _a; const rowElement = clickEvent.currentTarget.closest('tr'); - const lotId = rowElement.dataset.lotId; + const lotId = (_a = rowElement.dataset.lotId) !== null && _a !== void 0 ? _a : ''; addLot(lotId, (success) => { if (success) { rowElement.remove(); @@ -639,18 +633,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); if (event) { event.preventDefault(); } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML('Searching...'); - cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFormElement, (rawResponseJSON) => { - var _a, _b, _c, _d; + cityssm.postJSON(`${los.urlPrefix}/lots/doSearchLots`, searchFormElement, (rawResponseJSON) => { + var _a, _b, _c, _d, _e, _f; const responseJSON = rawResponseJSON; if (responseJSON.lots.length === 0) { - searchResultsContainerElement.innerHTML = - '
' + - '

There are no records that meet the search criteria.

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

There are no records that meet the search criteria.

+
`; return; } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `
(No ${los.escapedAliases.Lot})${lotOccupancy.occupancyStartDateString}' + - (lotOccupancy.occupancyEndDate - ? lotOccupancy.occupancyEndDateString - : '(No End Date)') + - '' + - (lotOccupancy.lotOccupancyOccupants.length === 0 - ? `(No ${cityssm.escapeHTML(los.escapedAliases.Occupants)})` - : cityssm.escapeHTML(lotOccupancy.lotOccupancyOccupants[0].occupantName + - ' ' + - lotOccupancy.lotOccupancyOccupants[0] - .occupantFamilyName) + - (lotOccupancy.lotOccupancyOccupants.length > 1 - ? ' plus ' + - (lotOccupancy.lotOccupancyOccupants.length - 1).toString() - : '')) + - ' + ${lotOccupancy.occupancyStartDateString} + + ${lotOccupancy.occupancyEndDate + ? lotOccupancy.occupancyEndDateString + : '(No End Date)'} + + ${lotOccupancy.lotOccupancyOccupants.length === 0 + ? ` + (No ${cityssm.escapeHTML(los.escapedAliases.Occupants)}) + ` + : cityssm.escapeHTML(`${lotOccupancy.lotOccupancyOccupants[0].occupantName} + ${lotOccupancy.lotOccupancyOccupants[0] + .occupantFamilyName}`) + + (lotOccupancy.lotOccupancyOccupants.length > 1 + ? ` plus + ${(lotOccupancy.lotOccupancyOccupants.length - 1).toString()}` + : '')}
@@ -665,26 +660,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); const rowElement = document.createElement('tr'); rowElement.className = 'container--lot'; rowElement.dataset.lotId = lot.lotId.toString(); - rowElement.innerHTML = - '' + - ('') + - '' + - ('') + - (''); - rowElement - .querySelector('.button--addLot') - .addEventListener('click', doAddLot); - searchResultsContainerElement - .querySelector('tbody') - .append(rowElement); + rowElement.innerHTML = ``; + (_e = rowElement + .querySelector('.button--addLot')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', doAddLot); + (_f = searchResultsContainerElement + .querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(rowElement); } }); } @@ -704,13 +696,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); doSearch(); }, onshown(modalElement) { + var _a; bulmaJS.toggleHtmlClipped(); const lotNameElement = modalElement.querySelector('#lotSearch--lotName'); lotNameElement.addEventListener('change', doSearch); lotNameElement.focus(); - modalElement - .querySelector('#lotSearch--lotStatusId') - .addEventListener('change', doSearch); + (_a = modalElement + .querySelector('#lotSearch--lotStatusId')) === null || _a === void 0 ? void 0 : _a.addEventListener('change', doSearch); searchFormElement.addEventListener('submit', doSearch); }, onremoved() { @@ -725,14 +717,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); * Comments */ "use strict"; - /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ + // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair + /* eslint-disable unicorn/prefer-module */ var _a; Object.defineProperty(exports, "__esModule", { value: true }); let workOrderComments = exports.workOrderComments; delete exports.workOrderComments; function openEditWorkOrderComment(clickEvent) { - const workOrderCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .workOrderCommentId, 10); + var _a, _b; + const workOrderCommentId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.workOrderCommentId) !== null && _b !== void 0 ? _b : '', 10); const workOrderComment = workOrderComments.find((currentComment) => { return currentComment.workOrderCommentId === workOrderCommentId; }); @@ -740,8 +733,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); let editCloseModalFunction; function editComment(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateWorkOrderComment', editFormElement, (responseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doUpdateWorkOrderComment`, editFormElement, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { workOrderComments = responseJSON.workOrderComments; editCloseModalFunction(); @@ -758,19 +752,20 @@ Object.defineProperty(exports, "__esModule", { value: true }); } cityssm.openHtmlModal('workOrder-editComment', { onshow(modalElement) { + var _a, _b, _c, _d; ; modalElement.querySelector('#workOrderCommentEdit--workOrderId').value = workOrderId; modalElement.querySelector('#workOrderCommentEdit--workOrderCommentId').value = workOrderCommentId.toString(); - modalElement.querySelector('#workOrderCommentEdit--workOrderComment').value = workOrderComment.workOrderComment; + modalElement.querySelector('#workOrderCommentEdit--workOrderComment').value = (_a = workOrderComment.workOrderComment) !== null && _a !== void 0 ? _a : ''; const workOrderCommentDateStringElement = modalElement.querySelector('#workOrderCommentEdit--workOrderCommentDateString'); workOrderCommentDateStringElement.value = - workOrderComment.workOrderCommentDateString; + (_b = workOrderComment.workOrderCommentDateString) !== null && _b !== void 0 ? _b : ''; const currentDateString = cityssm.dateToString(new Date()); workOrderCommentDateStringElement.max = workOrderComment.workOrderCommentDateString <= currentDateString ? currentDateString - : workOrderComment.workOrderCommentDateString; - modalElement.querySelector('#workOrderCommentEdit--workOrderCommentTimeString').value = workOrderComment.workOrderCommentTimeString; + : (_c = workOrderComment.workOrderCommentDateString) !== null && _c !== void 0 ? _c : ''; + modalElement.querySelector('#workOrderCommentEdit--workOrderCommentTimeString').value = (_d = workOrderComment.workOrderCommentTimeString) !== null && _d !== void 0 ? _d : ''; }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped(); @@ -786,14 +781,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function deleteWorkOrderComment(clickEvent) { - const workOrderCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .workOrderCommentId, 10); + var _a, _b; + const workOrderCommentId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.workOrderCommentId) !== null && _b !== void 0 ? _b : '', 10); function doDelete() { - cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderComment', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doDeleteWorkOrderComment`, { workOrderId, workOrderCommentId - }, (responseJSON) => { + }, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { workOrderComments = responseJSON.workOrderComments; renderWorkOrderComments(); @@ -818,7 +814,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function renderWorkOrderComments() { - var _a, _b; + var _a, _b, _c, _d, _e, _f; const containerElement = document.querySelector('#container--workOrderComments'); if (workOrderComments.length === 0) { containerElement.innerHTML = `
@@ -836,38 +832,33 @@ Object.defineProperty(exports, "__esModule", { value: true }); for (const workOrderComment of workOrderComments) { const tableRowElement = document.createElement('tr'); tableRowElement.dataset.workOrderCommentId = - workOrderComment.workOrderCommentId.toString(); - tableRowElement.innerHTML = - '
' + - '' + - '' + - (''); - tableRowElement - .querySelector('.button--edit') - .addEventListener('click', openEditWorkOrderComment); - tableRowElement - .querySelector('.button--delete') - .addEventListener('click', deleteWorkOrderComment); - tableElement.querySelector('tbody').append(tableRowElement); + (_a = workOrderComment.workOrderCommentId) === null || _a === void 0 ? void 0 : _a.toString(); + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ``; + (_d = tableRowElement + .querySelector('.button--edit')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', openEditWorkOrderComment); + (_e = tableRowElement + .querySelector('.button--delete')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteWorkOrderComment); + (_f = tableElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(tableRowElement); } containerElement.innerHTML = ''; containerElement.append(tableElement); @@ -876,7 +867,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); let addCommentCloseModalFunction; function doAddComment(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderComment', formEvent.currentTarget, (responseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doAddWorkOrderComment`, formEvent.currentTarget, (rawResponseJSON) => { + const responseJSON = rawResponseJSON; if (responseJSON.success) { workOrderComments = responseJSON.workOrderComments; renderWorkOrderComments(); @@ -886,11 +878,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); } cityssm.openHtmlModal('workOrder-addComment', { onshow(modalElement) { + var _a; los.populateAliases(modalElement); modalElement.querySelector('#workOrderCommentAdd--workOrderId').value = workOrderId; - modalElement - .querySelector('form') - .addEventListener('submit', doAddComment); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAddComment); }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped(); @@ -1136,66 +1128,57 @@ Object.defineProperty(exports, "__esModule", { value: true }); panelBlockElement.dataset.workOrderMilestoneId = (_a = milestone.workOrderMilestoneId) === null || _a === void 0 ? void 0 : _a.toString(); // eslint-disable-next-line no-unsanitized/property - panelBlockElement.innerHTML = - '
' + - ('
' + - (milestone.workOrderMilestoneCompletionDate - ? '' + - '' + - '' - : '') + - '
') + - ('
' + - (milestone.workOrderMilestoneTypeId - ? '' + - cityssm.escapeHTML((_b = milestone.workOrderMilestoneType) !== null && _b !== void 0 ? _b : '') + - '
' - : '') + - (milestone.workOrderMilestoneDate === 0 - ? '(No Set Date)' - : milestone.workOrderMilestoneDateString) + - (milestone.workOrderMilestoneTime - ? ' ' + milestone.workOrderMilestoneTimePeriodString - : '') + - '
' + - '' + - cityssm.escapeHTML((_c = milestone.workOrderMilestoneDescription) !== null && _c !== void 0 ? _c : '') + - '' + - '
') + - ('
' + - '' + - '
') + - '
'; + panelBlockElement.innerHTML = `
+
+ ${milestone.workOrderMilestoneCompletionDate + ? ` + + ` + : ``} +
+ ${milestone.workOrderMilestoneTypeId + ? `${cityssm.escapeHTML((_b = milestone.workOrderMilestoneType) !== null && _b !== void 0 ? _b : '')}
` + : ''} + ${milestone.workOrderMilestoneDate === 0 + ? '(No Set Date)' + : milestone.workOrderMilestoneDateString} + ${milestone.workOrderMilestoneTime + ? ` ${milestone.workOrderMilestoneTimePeriodString}` + : ''}
+ + ${cityssm.escapeHTML((_c = milestone.workOrderMilestoneDescription) !== null && _c !== void 0 ? _c : '')} + +
+ +
`; (_d = panelBlockElement .querySelector('.button--reopenMilestone')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', reopenMilestone); (_e = panelBlockElement diff --git a/public-typescript/workOrderEdit/workOrderEdit.js b/public-typescript/workOrderEdit/workOrderEdit.js index d1be8145..df9f1b82 100644 --- a/public-typescript/workOrderEdit/workOrderEdit.js +++ b/public-typescript/workOrderEdit/workOrderEdit.js @@ -385,66 +385,57 @@ Object.defineProperty(exports, "__esModule", { value: true }); panelBlockElement.dataset.workOrderMilestoneId = (_a = milestone.workOrderMilestoneId) === null || _a === void 0 ? void 0 : _a.toString(); // eslint-disable-next-line no-unsanitized/property - panelBlockElement.innerHTML = - '
' + - ('
' + - (milestone.workOrderMilestoneCompletionDate - ? '' + - '' + - '' - : '') + - '
') + - ('
' + - (milestone.workOrderMilestoneTypeId - ? '' + - cityssm.escapeHTML((_b = milestone.workOrderMilestoneType) !== null && _b !== void 0 ? _b : '') + - '
' - : '') + - (milestone.workOrderMilestoneDate === 0 - ? '(No Set Date)' - : milestone.workOrderMilestoneDateString) + - (milestone.workOrderMilestoneTime - ? ' ' + milestone.workOrderMilestoneTimePeriodString - : '') + - '
' + - '' + - cityssm.escapeHTML((_c = milestone.workOrderMilestoneDescription) !== null && _c !== void 0 ? _c : '') + - '' + - '
') + - ('
' + - '' + - '
') + - '
'; + panelBlockElement.innerHTML = `
+
+ ${milestone.workOrderMilestoneCompletionDate + ? ` + + ` + : ``} +
+ ${milestone.workOrderMilestoneTypeId + ? `${cityssm.escapeHTML((_b = milestone.workOrderMilestoneType) !== null && _b !== void 0 ? _b : '')}
` + : ''} + ${milestone.workOrderMilestoneDate === 0 + ? '(No Set Date)' + : milestone.workOrderMilestoneDateString} + ${milestone.workOrderMilestoneTime + ? ` ${milestone.workOrderMilestoneTimePeriodString}` + : ''}
+ + ${cityssm.escapeHTML((_c = milestone.workOrderMilestoneDescription) !== null && _c !== void 0 ? _c : '')} + +
+ +
`; (_d = panelBlockElement .querySelector('.button--reopenMilestone')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', reopenMilestone); (_e = panelBlockElement diff --git a/public-typescript/workOrderEdit/workOrderEdit.ts b/public-typescript/workOrderEdit/workOrderEdit.ts index 7bccb8ac..3e90604d 100644 --- a/public-typescript/workOrderEdit/workOrderEdit.ts +++ b/public-typescript/workOrderEdit/workOrderEdit.ts @@ -598,66 +598,67 @@ declare const exports: Record milestone.workOrderMilestoneId?.toString() // eslint-disable-next-line no-unsanitized/property - panelBlockElement.innerHTML = - '
' + - ('
' + - (milestone.workOrderMilestoneCompletionDate - ? '' + - '' + - '' - : '') + - '
') + - ('
' + - (milestone.workOrderMilestoneTypeId - ? '' + - cityssm.escapeHTML(milestone.workOrderMilestoneType ?? '') + - '
' - : '') + - (milestone.workOrderMilestoneDate === 0 - ? '(No Set Date)' - : milestone.workOrderMilestoneDateString) + - (milestone.workOrderMilestoneTime - ? ' ' + milestone.workOrderMilestoneTimePeriodString - : '') + - '
' + - '' + - cityssm.escapeHTML(milestone.workOrderMilestoneDescription ?? '') + - '' + - '
') + - ('
' + - '' + - '
') + - '
' + panelBlockElement.innerHTML = `
+
+ ${ + milestone.workOrderMilestoneCompletionDate + ? ` + + ` + : `` + } +
+ ${ + milestone.workOrderMilestoneTypeId + ? `${cityssm.escapeHTML(milestone.workOrderMilestoneType ?? '')}
` + : '' + } + ${ + milestone.workOrderMilestoneDate === 0 + ? '(No Set Date)' + : milestone.workOrderMilestoneDateString + } + ${ + milestone.workOrderMilestoneTime + ? ` ${milestone.workOrderMilestoneTimePeriodString}` + : '' + }
+ + ${cityssm.escapeHTML(milestone.workOrderMilestoneDescription ?? '')} + +
+ +
` panelBlockElement .querySelector('.button--reopenMilestone') diff --git a/public-typescript/workOrderEdit/workOrderEditComments.js b/public-typescript/workOrderEdit/workOrderEditComments.js index ecaf71d4..e014f24c 100644 --- a/public-typescript/workOrderEdit/workOrderEditComments.js +++ b/public-typescript/workOrderEdit/workOrderEditComments.js @@ -1,12 +1,13 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ var _a; Object.defineProperty(exports, "__esModule", { value: true }); let workOrderComments = exports.workOrderComments; delete exports.workOrderComments; function openEditWorkOrderComment(clickEvent) { - const workOrderCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .workOrderCommentId, 10); + var _a, _b; + const workOrderCommentId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.workOrderCommentId) !== null && _b !== void 0 ? _b : '', 10); const workOrderComment = workOrderComments.find((currentComment) => { return currentComment.workOrderCommentId === workOrderCommentId; }); @@ -14,8 +15,9 @@ function openEditWorkOrderComment(clickEvent) { let editCloseModalFunction; function editComment(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateWorkOrderComment', editFormElement, (responseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doUpdateWorkOrderComment`, editFormElement, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { workOrderComments = responseJSON.workOrderComments; editCloseModalFunction(); @@ -32,19 +34,20 @@ function openEditWorkOrderComment(clickEvent) { } cityssm.openHtmlModal('workOrder-editComment', { onshow(modalElement) { + var _a, _b, _c, _d; ; modalElement.querySelector('#workOrderCommentEdit--workOrderId').value = workOrderId; modalElement.querySelector('#workOrderCommentEdit--workOrderCommentId').value = workOrderCommentId.toString(); - modalElement.querySelector('#workOrderCommentEdit--workOrderComment').value = workOrderComment.workOrderComment; + modalElement.querySelector('#workOrderCommentEdit--workOrderComment').value = (_a = workOrderComment.workOrderComment) !== null && _a !== void 0 ? _a : ''; const workOrderCommentDateStringElement = modalElement.querySelector('#workOrderCommentEdit--workOrderCommentDateString'); workOrderCommentDateStringElement.value = - workOrderComment.workOrderCommentDateString; + (_b = workOrderComment.workOrderCommentDateString) !== null && _b !== void 0 ? _b : ''; const currentDateString = cityssm.dateToString(new Date()); workOrderCommentDateStringElement.max = workOrderComment.workOrderCommentDateString <= currentDateString ? currentDateString - : workOrderComment.workOrderCommentDateString; - modalElement.querySelector('#workOrderCommentEdit--workOrderCommentTimeString').value = workOrderComment.workOrderCommentTimeString; + : (_c = workOrderComment.workOrderCommentDateString) !== null && _c !== void 0 ? _c : ''; + modalElement.querySelector('#workOrderCommentEdit--workOrderCommentTimeString').value = (_d = workOrderComment.workOrderCommentTimeString) !== null && _d !== void 0 ? _d : ''; }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped(); @@ -60,14 +63,15 @@ function openEditWorkOrderComment(clickEvent) { }); } function deleteWorkOrderComment(clickEvent) { - const workOrderCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset - .workOrderCommentId, 10); + var _a, _b; + const workOrderCommentId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.workOrderCommentId) !== null && _b !== void 0 ? _b : '', 10); function doDelete() { - cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderComment', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doDeleteWorkOrderComment`, { workOrderId, workOrderCommentId - }, (responseJSON) => { + }, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { workOrderComments = responseJSON.workOrderComments; renderWorkOrderComments(); @@ -92,7 +96,7 @@ function deleteWorkOrderComment(clickEvent) { }); } function renderWorkOrderComments() { - var _a, _b; + var _a, _b, _c, _d, _e, _f; const containerElement = document.querySelector('#container--workOrderComments'); if (workOrderComments.length === 0) { containerElement.innerHTML = `
@@ -110,38 +114,33 @@ function renderWorkOrderComments() { for (const workOrderComment of workOrderComments) { const tableRowElement = document.createElement('tr'); tableRowElement.dataset.workOrderCommentId = - workOrderComment.workOrderCommentId.toString(); - tableRowElement.innerHTML = - '
' + - '' + - '' + - (''); - tableRowElement - .querySelector('.button--edit') - .addEventListener('click', openEditWorkOrderComment); - tableRowElement - .querySelector('.button--delete') - .addEventListener('click', deleteWorkOrderComment); - tableElement.querySelector('tbody').append(tableRowElement); + (_a = workOrderComment.workOrderCommentId) === null || _a === void 0 ? void 0 : _a.toString(); + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = ``; + (_d = tableRowElement + .querySelector('.button--edit')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', openEditWorkOrderComment); + (_e = tableRowElement + .querySelector('.button--delete')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteWorkOrderComment); + (_f = tableElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(tableRowElement); } containerElement.innerHTML = ''; containerElement.append(tableElement); @@ -150,7 +149,8 @@ function openAddCommentModal() { let addCommentCloseModalFunction; function doAddComment(formEvent) { formEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderComment', formEvent.currentTarget, (responseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doAddWorkOrderComment`, formEvent.currentTarget, (rawResponseJSON) => { + const responseJSON = rawResponseJSON; if (responseJSON.success) { workOrderComments = responseJSON.workOrderComments; renderWorkOrderComments(); @@ -160,11 +160,11 @@ function openAddCommentModal() { } cityssm.openHtmlModal('workOrder-addComment', { onshow(modalElement) { + var _a; los.populateAliases(modalElement); modalElement.querySelector('#workOrderCommentAdd--workOrderId').value = workOrderId; - modalElement - .querySelector('form') - .addEventListener('submit', doAddComment); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAddComment); }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped(); diff --git a/public-typescript/workOrderEdit/workOrderEditComments.ts b/public-typescript/workOrderEdit/workOrderEditComments.ts index 9cfdb677..6243cc70 100644 --- a/public-typescript/workOrderEdit/workOrderEditComments.ts +++ b/public-typescript/workOrderEdit/workOrderEditComments.ts @@ -1,33 +1,35 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' -import type { BulmaJS } from '@cityssm/bulma-js/types' +import type { BulmaJS } from '@cityssm/bulma-js/types.js' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../../types/globalTypes' -import type * as recordTypes from '../../types/recordTypes' +import type { LOS } from '../../types/globalTypes.js' +import type * as recordTypes from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS -declare const los: globalTypes.LOS +declare const exports: Record +declare const los: LOS declare const workOrderId: string declare const isCreate: boolean -let workOrderComments: recordTypes.WorkOrderComment[] = - exports.workOrderComments +let workOrderComments = + exports.workOrderComments as recordTypes.WorkOrderComment[] delete exports.workOrderComments function openEditWorkOrderComment(clickEvent: Event): void { const workOrderCommentId = Number.parseInt( - (clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset - .workOrderCommentId!, + (clickEvent.currentTarget as HTMLElement).closest('tr')?.dataset + .workOrderCommentId ?? '', 10 ) const workOrderComment = workOrderComments.find((currentComment) => { return currentComment.workOrderCommentId === workOrderCommentId - })! + }) as recordTypes.WorkOrderComment let editFormElement: HTMLFormElement let editCloseModalFunction: () => void @@ -36,15 +38,17 @@ function openEditWorkOrderComment(clickEvent: Event): void { submitEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/workOrders/doUpdateWorkOrderComment', + `${los.urlPrefix}/workOrders/doUpdateWorkOrderComment`, editFormElement, - (responseJSON: { - success: boolean - errorMessage?: string - workOrderComments?: recordTypes.WorkOrderComment[] - }) => { + (rawResponseJSON) => { + const responseJSON = rawResponseJSON as { + success: boolean + errorMessage?: string + workOrderComments: recordTypes.WorkOrderComment[] + } + if (responseJSON.success) { - workOrderComments = responseJSON.workOrderComments! + workOrderComments = responseJSON.workOrderComments editCloseModalFunction() renderWorkOrderComments() } else { @@ -74,26 +78,26 @@ function openEditWorkOrderComment(clickEvent: Event): void { modalElement.querySelector( '#workOrderCommentEdit--workOrderComment' ) as HTMLInputElement - ).value = workOrderComment.workOrderComment! + ).value = workOrderComment.workOrderComment ?? '' const workOrderCommentDateStringElement = modalElement.querySelector( '#workOrderCommentEdit--workOrderCommentDateString' ) as HTMLInputElement workOrderCommentDateStringElement.value = - workOrderComment.workOrderCommentDateString! + workOrderComment.workOrderCommentDateString ?? '' const currentDateString = cityssm.dateToString(new Date()) workOrderCommentDateStringElement.max = workOrderComment.workOrderCommentDateString! <= currentDateString ? currentDateString - : workOrderComment.workOrderCommentDateString! + : workOrderComment.workOrderCommentDateString ?? '' ;( modalElement.querySelector( '#workOrderCommentEdit--workOrderCommentTimeString' ) as HTMLInputElement - ).value = workOrderComment.workOrderCommentTimeString! + ).value = workOrderComment.workOrderCommentTimeString ?? '' }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped() @@ -105,7 +109,7 @@ function openEditWorkOrderComment(clickEvent: Event): void { ) as HTMLTextAreaElement ).focus() - editFormElement = modalElement.querySelector('form')! + editFormElement = modalElement.querySelector('form') as HTMLFormElement editFormElement.addEventListener('submit', editComment) editCloseModalFunction = closeModalFunction @@ -118,23 +122,25 @@ function openEditWorkOrderComment(clickEvent: Event): void { function deleteWorkOrderComment(clickEvent: Event): void { const workOrderCommentId = Number.parseInt( - (clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset - .workOrderCommentId!, + (clickEvent.currentTarget as HTMLElement).closest('tr')?.dataset + .workOrderCommentId ?? '', 10 ) function doDelete(): void { cityssm.postJSON( - los.urlPrefix + '/workOrders/doDeleteWorkOrderComment', + `${los.urlPrefix}/workOrders/doDeleteWorkOrderComment`, { workOrderId, workOrderCommentId }, - (responseJSON: { - success: boolean - errorMessage?: string - workOrderComments: recordTypes.WorkOrderComment[] - }) => { + (rawResponseJSON) => { + const responseJSON = rawResponseJSON as { + success: boolean + errorMessage?: string + workOrderComments: recordTypes.WorkOrderComment[] + } + if (responseJSON.success) { workOrderComments = responseJSON.workOrderComments renderWorkOrderComments() @@ -182,43 +188,43 @@ function renderWorkOrderComments(): void { for (const workOrderComment of workOrderComments) { const tableRowElement = document.createElement('tr') + tableRowElement.dataset.workOrderCommentId = - workOrderComment.workOrderCommentId!.toString() - - tableRowElement.innerHTML = - '' + - '' + - '' + - ('') + workOrderComment.workOrderCommentId?.toString() + + // eslint-disable-next-line no-unsanitized/property + tableRowElement.innerHTML = `` tableRowElement - .querySelector('.button--edit')! - .addEventListener('click', openEditWorkOrderComment) + .querySelector('.button--edit') + ?.addEventListener('click', openEditWorkOrderComment) tableRowElement - .querySelector('.button--delete')! - .addEventListener('click', deleteWorkOrderComment) + .querySelector('.button--delete') + ?.addEventListener('click', deleteWorkOrderComment) - tableElement.querySelector('tbody')!.append(tableRowElement) + tableElement.querySelector('tbody')?.append(tableRowElement) } containerElement.innerHTML = '' @@ -232,14 +238,16 @@ function openAddCommentModal(): void { formEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/workOrders/doAddWorkOrderComment', + `${los.urlPrefix}/workOrders/doAddWorkOrderComment`, formEvent.currentTarget, - (responseJSON: { - success: boolean - workOrderComments?: recordTypes.WorkOrderComment[] - }) => { + (rawResponseJSON) => { + const responseJSON = rawResponseJSON as { + success: boolean + workOrderComments: recordTypes.WorkOrderComment[] + } + if (responseJSON.success) { - workOrderComments = responseJSON.workOrderComments! + workOrderComments = responseJSON.workOrderComments renderWorkOrderComments() addCommentCloseModalFunction() } @@ -255,9 +263,10 @@ function openAddCommentModal(): void { '#workOrderCommentAdd--workOrderId' ) as HTMLInputElement ).value = workOrderId + modalElement - .querySelector('form')! - .addEventListener('submit', doAddComment) + .querySelector('form') + ?.addEventListener('submit', doAddComment) }, onshown(modalElement, closeModalFunction) { bulmaJS.toggleHtmlClipped() diff --git a/public-typescript/workOrderEdit/workOrderEditLots.js b/public-typescript/workOrderEdit/workOrderEditLots.js index 4f0598e4..25f21057 100644 --- a/public-typescript/workOrderEdit/workOrderEditLots.js +++ b/public-typescript/workOrderEdit/workOrderEditLots.js @@ -1,5 +1,6 @@ "use strict"; -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ var _a, _b; Object.defineProperty(exports, "__esModule", { value: true }); let workOrderLots = exports.workOrderLots; @@ -9,7 +10,7 @@ delete exports.workOrderLotOccupancies; function deleteLotOccupancy(clickEvent) { const lotOccupancyId = clickEvent.currentTarget.closest('.container--lotOccupancy').dataset.lotOccupancyId; function doDelete() { - cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLotOccupancy', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doDeleteWorkOrderLotOccupancy`, { workOrderId, lotOccupancyId }, (rawResponseJSON) => { @@ -39,7 +40,7 @@ function deleteLotOccupancy(clickEvent) { }); } function addLot(lotId, callbackFunction) { - cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLot', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doAddWorkOrderLot`, { workOrderId, lotId }, (rawResponseJSON) => { @@ -62,7 +63,7 @@ function addLot(lotId, callbackFunction) { }); } function addLotOccupancy(lotOccupancyId, callbackFunction) { - cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLotOccupancy', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doAddWorkOrderLotOccupancy`, { workOrderId, lotOccupancyId }, (rawResponseJSON) => { @@ -74,7 +75,7 @@ function addLotOccupancy(lotOccupancyId, callbackFunction) { } else { bulmaJS.alert({ - title: 'Error Adding ' + los.escapedAliases.Occupancy, + title: `Error Adding ${los.escapedAliases.Occupancy}`, message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', contextualColorName: 'danger' }); @@ -85,19 +86,22 @@ function addLotOccupancy(lotOccupancyId, callbackFunction) { }); } function addLotFromLotOccupancy(clickEvent) { - const lotId = clickEvent.currentTarget.dataset.lotId; + var _a; + const lotId = (_a = clickEvent.currentTarget.dataset.lotId) !== null && _a !== void 0 ? _a : ''; addLot(lotId); } function renderRelatedOccupancies() { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f; const occupanciesContainerElement = document.querySelector('#container--lotOccupancies'); document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent = workOrderLotOccupancies.length.toString(); if (workOrderLotOccupancies.length === 0) { + // eslint-disable-next-line no-unsanitized/property occupanciesContainerElement.innerHTML = `

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

`; return; } + // eslint-disable-next-line no-unsanitized/property occupanciesContainerElement.innerHTML = `
' + - '' + - '' + - cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + - '' + - cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '') + - '' + cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '') + '' + cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '') + ' + + + ${cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '')} + + ${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')} + + ${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')} + + ${cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '')} + ' + - cityssm.escapeHTML((_a = workOrderComment.recordCreate_userName) !== null && _a !== void 0 ? _a : '') + - '' + - workOrderComment.workOrderCommentDateString + - (workOrderComment.workOrderCommentTime === 0 - ? '' - : ' ' + workOrderComment.workOrderCommentTimePeriodString) + - '' + - cityssm.escapeHTML((_b = workOrderComment.workOrderComment) !== null && _b !== void 0 ? _b : '') + - '' + - '
' + - ('') + - ('') + - '
' + - '
+ ${cityssm.escapeHTML((_b = workOrderComment.recordCreate_userName) !== null && _b !== void 0 ? _b : '')} + + ${workOrderComment.workOrderCommentDateString} + ${workOrderComment.workOrderCommentTime === 0 + ? '' + : ' ' + workOrderComment.workOrderCommentTimePeriodString} + + ${cityssm.escapeHTML((_c = workOrderComment.workOrderComment) !== null && _c !== void 0 ? _c : '')} + +
+ + +
+
' + - cityssm.escapeHTML((_a = workOrderComment.recordCreate_userName) !== null && _a !== void 0 ? _a : '') + - '' + - workOrderComment.workOrderCommentDateString + - (workOrderComment.workOrderCommentTime === 0 - ? '' - : ' ' + workOrderComment.workOrderCommentTimePeriodString) + - '' + - cityssm.escapeHTML((_b = workOrderComment.workOrderComment) !== null && _b !== void 0 ? _b : '') + - '' + - '
' + - ('') + - ('') + - '
' + - '
+ ${cityssm.escapeHTML((_b = workOrderComment.recordCreate_userName) !== null && _b !== void 0 ? _b : '')} + + ${workOrderComment.workOrderCommentDateString} + ${workOrderComment.workOrderCommentTime === 0 + ? '' + : ' ' + workOrderComment.workOrderCommentTimePeriodString} + + ${cityssm.escapeHTML((_c = workOrderComment.workOrderComment) !== null && _c !== void 0 ? _c : '')} + +
+ + +
+
' + - cityssm.escapeHTML(workOrderComment.recordCreate_userName ?? '') + - '' + - workOrderComment.workOrderCommentDateString + - (workOrderComment.workOrderCommentTime === 0 - ? '' - : ' ' + workOrderComment.workOrderCommentTimePeriodString!) + - '' + - cityssm.escapeHTML(workOrderComment.workOrderComment ?? '') + - '' + - '
' + - ('') + - ('') + - '
' + - '
+ ${cityssm.escapeHTML(workOrderComment.recordCreate_userName ?? '')} + + ${workOrderComment.workOrderCommentDateString} + ${ + workOrderComment.workOrderCommentTime === 0 + ? '' + : ' ' + workOrderComment.workOrderCommentTimePeriodString + } + + ${cityssm.escapeHTML(workOrderComment.workOrderComment ?? '')} + +
+ + +
+
@@ -121,44 +125,33 @@ function renderRelatedOccupancies() { workOrderLots.some((lot) => { return lotOccupancy.lotId === lot.lotId; }); - rowElement.innerHTML = - '' + - (''); + // eslint-disable-next-line no-unsanitized/property + rowElement.innerHTML = ``; if (lotOccupancy.lotId) { - rowElement.insertAdjacentHTML('beforeend', ''); + // eslint-disable-next-line no-unsanitized/method + rowElement.insertAdjacentHTML('beforeend', ``); } else { + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML('beforeend', ``); } let occupantsHTML = ''; @@ -174,41 +167,39 @@ function renderRelatedOccupancies() { ${cityssm.escapeHTML(occupant.occupantFamilyName)} `; } - rowElement.insertAdjacentHTML('beforeend', '' + - ('') + - ('') + - ('')); + // eslint-disable-next-line no-unsanitized/method + rowElement.insertAdjacentHTML('beforeend', ``); (_d = rowElement .querySelector('.button--addLot')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', addLotFromLotOccupancy); - rowElement - .querySelector('.button--deleteLotOccupancy') - .addEventListener('click', deleteLotOccupancy); - occupanciesContainerElement.querySelector('tbody').append(rowElement); + (_e = rowElement + .querySelector('.button--deleteLotOccupancy')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancy); + (_f = occupanciesContainerElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(rowElement); } } function openEditLotStatus(clickEvent) { - const lotId = Number.parseInt(clickEvent.currentTarget.closest('.container--lot').dataset.lotId, 10); + var _a; + const lotId = Number.parseInt((_a = clickEvent.currentTarget.closest('.container--lot').dataset.lotId) !== null && _a !== void 0 ? _a : '', 10); const lot = workOrderLots.find((possibleLot) => { return possibleLot.lotId === lotId; }); let editCloseModalFunction; function doUpdateLotStatus(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doUpdateLotStatus`, submitEvent.currentTarget, (rawResponseJSON) => { var _a; const responseJSON = rawResponseJSON; if (responseJSON.success) { @@ -227,9 +218,10 @@ function openEditLotStatus(clickEvent) { } cityssm.openHtmlModal('lot-editLotStatus', { onshow(modalElement) { + var _a, _b, _c; los.populateAliases(modalElement); modalElement.querySelector('#lotStatusEdit--lotId').value = lotId.toString(); - modalElement.querySelector('#lotStatusEdit--lotName').value = lot.lotName; + modalElement.querySelector('#lotStatusEdit--lotName').value = (_a = lot.lotName) !== null && _a !== void 0 ? _a : ''; const lotStatusElement = modalElement.querySelector('#lotStatusEdit--lotStatusId'); let lotStatusFound = false; for (const lotStatus of exports.lotStatuses) { @@ -244,22 +236,22 @@ function openEditLotStatus(clickEvent) { if (!lotStatusFound && lot.lotStatusId) { const optionElement = document.createElement('option'); optionElement.value = lot.lotStatusId.toString(); - optionElement.textContent = lot.lotStatus; + optionElement.textContent = (_b = lot.lotStatus) !== null && _b !== void 0 ? _b : ''; lotStatusElement.append(optionElement); } if (lot.lotStatusId) { lotStatusElement.value = lot.lotStatusId.toString(); } - modalElement - .querySelector('form') - .insertAdjacentHTML('beforeend', ``); + // eslint-disable-next-line no-unsanitized/method + (_c = modalElement + .querySelector('form')) === null || _c === void 0 ? void 0 : _c.insertAdjacentHTML('beforeend', ``); }, onshown(modalElement, closeModalFunction) { + var _a; editCloseModalFunction = closeModalFunction; bulmaJS.toggleHtmlClipped(); - modalElement - .querySelector('form') - .addEventListener('submit', doUpdateLotStatus); + (_a = modalElement + .querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doUpdateLotStatus); }, onremoved() { bulmaJS.toggleHtmlClipped(); @@ -269,7 +261,7 @@ function openEditLotStatus(clickEvent) { function deleteLot(clickEvent) { const lotId = clickEvent.currentTarget.closest('.container--lot').dataset.lotId; function doDelete() { - cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLot', { + cityssm.postJSON(`${los.urlPrefix}/workOrders/doDeleteWorkOrderLot`, { workOrderId, lotId }, (rawResponseJSON) => { @@ -299,59 +291,57 @@ function deleteLot(clickEvent) { }); } function renderRelatedLots() { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f, _g; const lotsContainerElement = document.querySelector('#container--lots'); document.querySelector(".tabs a[href='#relatedTab--lots'] .tag").textContent = workOrderLots.length.toString(); if (workOrderLots.length === 0) { + // eslint-disable-next-line no-unsanitized/property lotsContainerElement.innerHTML = `
-

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

-
`; +

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

+ `; return; } + // eslint-disable-next-line no-unsanitized/property lotsContainerElement.innerHTML = `
' + - (isActive - ? '' - : '') + - '' + - '' + - cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') + - '
' + - `#${lotOccupancy.lotOccupancyId}` + - '
+ ${isActive + ? `` + : ``} + + + ${cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '')} +
+ #${lotOccupancy.lotOccupancyId} +
' + - cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '') + - (hasLotRecord - ? '' - : ' ') + - ' + ${cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '')} + ${hasLotRecord + ? '' + : ` `} + (No ${los.escapedAliases.Lot})' + - lotOccupancy.occupancyStartDateString + - '' + - (lotOccupancy.occupancyEndDate - ? lotOccupancy.occupancyEndDateString - : '(No End Date)') + - '' + - (lotOccupancy.lotOccupancyOccupants.length === 0 - ? `(No ${los.escapedAliases.Occupants})` - : `
    ${occupantsHTML}
`) + - '
' + - '' + - ' + ${lotOccupancy.occupancyStartDateString} + + ${lotOccupancy.occupancyEndDate + ? lotOccupancy.occupancyEndDateString + : '(No End Date)'} + + ${lotOccupancy.lotOccupancyOccupants.length === 0 + ? `(No ${los.escapedAliases.Occupants})` + : `
    ${occupantsHTML}
`} +
+ +
- - - - - - - - -
${los.escapedAliases.Lot}${los.escapedAliases.Map}${los.escapedAliases.Lot} TypeStatus
`; + + ${los.escapedAliases.Lot} + ${los.escapedAliases.Map} + ${los.escapedAliases.Lot} Type + Status + + + + `; for (const lot of workOrderLots) { const rowElement = document.createElement('tr'); rowElement.className = 'container--lot'; rowElement.dataset.lotId = lot.lotId.toString(); - rowElement.innerHTML = - '' + - '' + - cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + - '' + - '' + - `${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')}` + - `${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')}` + - ('' + - (lot.lotStatusId - ? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '') - : '(No Status)') + - '') + - ` + // eslint-disable-next-line no-unsanitized/property + rowElement.innerHTML = ` + + ${cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '')} + + + ${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')} + + ${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')} + + ${lot.lotStatusId + ? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '') + : '(No Status)'} + - `; - rowElement - .querySelector('.button--editLotStatus') - .addEventListener('click', openEditLotStatus); - rowElement - .querySelector('.button--deleteLot') - .addEventListener('click', deleteLot); - lotsContainerElement.querySelector('tbody').append(rowElement); + `; + (_e = rowElement + .querySelector('.button--editLotStatus')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', openEditLotStatus); + (_f = rowElement + .querySelector('.button--deleteLot')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLot); + (_g = lotsContainerElement.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(rowElement); } } function renderRelatedLotsAndOccupancies() { @@ -360,8 +350,9 @@ function renderRelatedLotsAndOccupancies() { } renderRelatedLotsAndOccupancies(); function doAddLotOccupancy(clickEvent) { + var _a; const rowElement = clickEvent.currentTarget.closest('tr'); - const lotOccupancyId = rowElement.dataset.lotOccupancyId; + const lotOccupancyId = (_a = rowElement.dataset.lotOccupancyId) !== null && _a !== void 0 ? _a : ''; addLotOccupancy(lotOccupancyId, (success) => { if (success) { rowElement.remove(); @@ -376,10 +367,11 @@ function doAddLotOccupancy(clickEvent) { if (event) { event.preventDefault(); } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML('Searching...'); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFormElement, (rawResponseJSON) => { - var _a, _b; + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doSearchLotOccupancies`, searchFormElement, (rawResponseJSON) => { + var _a, _b, _c, _d; const responseJSON = rawResponseJSON; if (responseJSON.lotOccupancies.length === 0) { searchResultsContainerElement.innerHTML = `
@@ -387,6 +379,7 @@ function doAddLotOccupancy(clickEvent) {
`; return; } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = ` @@ -417,32 +410,32 @@ function doAddLotOccupancy(clickEvent) { ''); } else { + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML('beforeend', ``); } - rowElement.insertAdjacentHTML('beforeend', `` + - ('') + - ('')); - rowElement - .querySelector('.button--addLotOccupancy') - .addEventListener('click', doAddLotOccupancy); - searchResultsContainerElement - .querySelector('tbody') - .append(rowElement); + // eslint-disable-next-line no-unsanitized/method + rowElement.insertAdjacentHTML('beforeend', ``); + (_c = rowElement + .querySelector('.button--addLotOccupancy')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', doAddLotOccupancy); + (_d = searchResultsContainerElement + .querySelector('tbody')) === null || _d === void 0 ? void 0 : _d.append(rowElement); } }); } @@ -470,8 +463,9 @@ function doAddLotOccupancy(clickEvent) { }); }); function doAddLot(clickEvent) { + var _a; const rowElement = clickEvent.currentTarget.closest('tr'); - const lotId = rowElement.dataset.lotId; + const lotId = (_a = rowElement.dataset.lotId) !== null && _a !== void 0 ? _a : ''; addLot(lotId, (success) => { if (success) { rowElement.remove(); @@ -485,18 +479,19 @@ function doAddLot(clickEvent) { if (event) { event.preventDefault(); } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML('Searching...'); - cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFormElement, (rawResponseJSON) => { - var _a, _b, _c, _d; + cityssm.postJSON(`${los.urlPrefix}/lots/doSearchLots`, searchFormElement, (rawResponseJSON) => { + var _a, _b, _c, _d, _e, _f; const responseJSON = rawResponseJSON; if (responseJSON.lots.length === 0) { - searchResultsContainerElement.innerHTML = - '
' + - '

There are no records that meet the search criteria.

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

There are no records that meet the search criteria.

+
`; return; } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `
(No ${los.escapedAliases.Lot})${lotOccupancy.occupancyStartDateString}' + - (lotOccupancy.occupancyEndDate - ? lotOccupancy.occupancyEndDateString - : '(No End Date)') + - '' + - (lotOccupancy.lotOccupancyOccupants.length === 0 - ? `(No ${cityssm.escapeHTML(los.escapedAliases.Occupants)})` - : cityssm.escapeHTML(lotOccupancy.lotOccupancyOccupants[0].occupantName + - ' ' + - lotOccupancy.lotOccupancyOccupants[0] - .occupantFamilyName) + - (lotOccupancy.lotOccupancyOccupants.length > 1 - ? ' plus ' + - (lotOccupancy.lotOccupancyOccupants.length - 1).toString() - : '')) + - ' + ${lotOccupancy.occupancyStartDateString} + + ${lotOccupancy.occupancyEndDate + ? lotOccupancy.occupancyEndDateString + : '(No End Date)'} + + ${lotOccupancy.lotOccupancyOccupants.length === 0 + ? ` + (No ${cityssm.escapeHTML(los.escapedAliases.Occupants)}) + ` + : cityssm.escapeHTML(`${lotOccupancy.lotOccupancyOccupants[0].occupantName} + ${lotOccupancy.lotOccupancyOccupants[0] + .occupantFamilyName}`) + + (lotOccupancy.lotOccupancyOccupants.length > 1 + ? ` plus + ${(lotOccupancy.lotOccupancyOccupants.length - 1).toString()}` + : '')}
@@ -511,26 +506,23 @@ function doAddLot(clickEvent) { const rowElement = document.createElement('tr'); rowElement.className = 'container--lot'; rowElement.dataset.lotId = lot.lotId.toString(); - rowElement.innerHTML = - '' + - ('') + - '' + - ('') + - (''); - rowElement - .querySelector('.button--addLot') - .addEventListener('click', doAddLot); - searchResultsContainerElement - .querySelector('tbody') - .append(rowElement); + rowElement.innerHTML = ``; + (_e = rowElement + .querySelector('.button--addLot')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', doAddLot); + (_f = searchResultsContainerElement + .querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(rowElement); } }); } @@ -550,13 +542,13 @@ function doAddLot(clickEvent) { doSearch(); }, onshown(modalElement) { + var _a; bulmaJS.toggleHtmlClipped(); const lotNameElement = modalElement.querySelector('#lotSearch--lotName'); lotNameElement.addEventListener('change', doSearch); lotNameElement.focus(); - modalElement - .querySelector('#lotSearch--lotStatusId') - .addEventListener('change', doSearch); + (_a = modalElement + .querySelector('#lotSearch--lotStatusId')) === null || _a === void 0 ? void 0 : _a.addEventListener('change', doSearch); searchFormElement.addEventListener('submit', doSearch); }, onremoved() { diff --git a/public-typescript/workOrderEdit/workOrderEditLots.ts b/public-typescript/workOrderEdit/workOrderEditLots.ts index 369fdab2..817884d9 100644 --- a/public-typescript/workOrderEdit/workOrderEditLots.ts +++ b/public-typescript/workOrderEdit/workOrderEditLots.ts @@ -1,23 +1,25 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair +/* eslint-disable unicorn/prefer-module */ -import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' -import type { BulmaJS } from '@cityssm/bulma-js/types' +import type { BulmaJS } from '@cityssm/bulma-js/types.js' +import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../../types/globalTypes' -import type * as recordTypes from '../../types/recordTypes' +import type { LOS } from '../../types/globalTypes.js' +import type * as recordTypes from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS -declare const los: globalTypes.LOS +declare const exports: Record +declare const los: LOS declare const workOrderId: string -let workOrderLots: recordTypes.Lot[] = exports.workOrderLots +let workOrderLots = exports.workOrderLots as recordTypes.Lot[] delete exports.workOrderLots -let workOrderLotOccupancies: recordTypes.LotOccupancy[] = - exports.workOrderLotOccupancies +let workOrderLotOccupancies = + exports.workOrderLotOccupancies as recordTypes.LotOccupancy[] delete exports.workOrderLotOccupancies function deleteLotOccupancy(clickEvent: Event): void { @@ -29,7 +31,7 @@ function deleteLotOccupancy(clickEvent: Event): void { function doDelete(): void { cityssm.postJSON( - los.urlPrefix + '/workOrders/doDeleteWorkOrderLotOccupancy', + `${los.urlPrefix}/workOrders/doDeleteWorkOrderLotOccupancy`, { workOrderId, lotOccupancyId @@ -38,11 +40,11 @@ function deleteLotOccupancy(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - workOrderLotOccupancies?: recordTypes.LotOccupancy[] + workOrderLotOccupancies: recordTypes.LotOccupancy[] } if (responseJSON.success) { - workOrderLotOccupancies = responseJSON.workOrderLotOccupancies! + workOrderLotOccupancies = responseJSON.workOrderLotOccupancies renderRelatedLotsAndOccupancies() } else { bulmaJS.alert({ @@ -71,7 +73,7 @@ function addLot( callbackFunction?: (success: boolean) => void ): void { cityssm.postJSON( - los.urlPrefix + '/workOrders/doAddWorkOrderLot', + `${los.urlPrefix}/workOrders/doAddWorkOrderLot`, { workOrderId, lotId @@ -80,11 +82,11 @@ function addLot( const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - workOrderLots?: recordTypes.Lot[] + workOrderLots: recordTypes.Lot[] } if (responseJSON.success) { - workOrderLots = responseJSON.workOrderLots! + workOrderLots = responseJSON.workOrderLots renderRelatedLotsAndOccupancies() } else { bulmaJS.alert({ @@ -106,7 +108,7 @@ function addLotOccupancy( callbackFunction?: (success?: boolean) => void ): void { cityssm.postJSON( - los.urlPrefix + '/workOrders/doAddWorkOrderLotOccupancy', + `${los.urlPrefix}/workOrders/doAddWorkOrderLotOccupancy`, { workOrderId, lotOccupancyId @@ -115,15 +117,15 @@ function addLotOccupancy( const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - workOrderLotOccupancies?: recordTypes.LotOccupancy[] + workOrderLotOccupancies: recordTypes.LotOccupancy[] } if (responseJSON.success) { - workOrderLotOccupancies = responseJSON.workOrderLotOccupancies! + workOrderLotOccupancies = responseJSON.workOrderLotOccupancies renderRelatedLotsAndOccupancies() } else { bulmaJS.alert({ - title: 'Error Adding ' + los.escapedAliases.Occupancy, + title: `Error Adding ${los.escapedAliases.Occupancy}`, message: responseJSON.errorMessage ?? '', contextualColorName: 'danger' }) @@ -137,7 +139,7 @@ function addLotOccupancy( } function addLotFromLotOccupancy(clickEvent: Event): void { - const lotId = (clickEvent.currentTarget as HTMLElement).dataset.lotId! + const lotId = (clickEvent.currentTarget as HTMLElement).dataset.lotId ?? '' addLot(lotId) } @@ -153,6 +155,7 @@ function renderRelatedOccupancies(): void { ).textContent = workOrderLotOccupancies.length.toString() if (workOrderLotOccupancies.length === 0) { + // eslint-disable-next-line no-unsanitized/property occupanciesContainerElement.innerHTML = `

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

` @@ -160,6 +163,7 @@ function renderRelatedOccupancies(): void { return } + // eslint-disable-next-line no-unsanitized/property occupanciesContainerElement.innerHTML = `
' + - '' + - '' + - cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + - '' + - cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '') + - '' + cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '') + '' + cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '') + ' + + + ${cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '')} + + ${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')} + + ${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')} + + ${cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '')} +
@@ -178,7 +182,7 @@ function renderRelatedOccupancies(): void { for (const lotOccupancy of workOrderLotOccupancies) { const rowElement = document.createElement('tr') rowElement.className = 'container--lotOccupancy' - rowElement.dataset.lotOccupancyId = lotOccupancy.lotOccupancyId!.toString() + rowElement.dataset.lotOccupancyId = lotOccupancy.lotOccupancyId.toString() const isActive = !( lotOccupancy.occupancyEndDate && @@ -191,47 +195,40 @@ function renderRelatedOccupancies(): void { return lotOccupancy.lotId === lot.lotId }) - rowElement.innerHTML = - '' + - ('') + // eslint-disable-next-line no-unsanitized/property + rowElement.innerHTML = `` if (lotOccupancy.lotId) { + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML( 'beforeend', - '' + `` ) } else { + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML( 'beforeend', `` @@ -255,26 +252,28 @@ function renderRelatedOccupancies(): void { ` } + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML( 'beforeend', - '' + - ('') + - ('') + - ('') + `` ) rowElement @@ -282,10 +281,10 @@ function renderRelatedOccupancies(): void { ?.addEventListener('click', addLotFromLotOccupancy) rowElement - .querySelector('.button--deleteLotOccupancy')! - .addEventListener('click', deleteLotOccupancy) + .querySelector('.button--deleteLotOccupancy') + ?.addEventListener('click', deleteLotOccupancy) - occupanciesContainerElement.querySelector('tbody')!.append(rowElement) + occupanciesContainerElement.querySelector('tbody')?.append(rowElement) } } @@ -295,13 +294,13 @@ function openEditLotStatus(clickEvent: Event): void { (clickEvent.currentTarget as HTMLElement).closest( '.container--lot' ) as HTMLElement - ).dataset.lotId!, + ).dataset.lotId ?? '', 10 ) const lot = workOrderLots.find((possibleLot) => { return possibleLot.lotId === lotId - })! + }) as recordTypes.Lot let editCloseModalFunction: () => void @@ -309,17 +308,17 @@ function openEditLotStatus(clickEvent: Event): void { submitEvent.preventDefault() cityssm.postJSON( - los.urlPrefix + '/workOrders/doUpdateLotStatus', + `${los.urlPrefix}/workOrders/doUpdateLotStatus`, submitEvent.currentTarget, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - workOrderLots?: recordTypes.Lot[] + workOrderLots: recordTypes.Lot[] } if (responseJSON.success) { - workOrderLots = responseJSON.workOrderLots! + workOrderLots = responseJSON.workOrderLots renderRelatedLotsAndOccupancies() editCloseModalFunction() } else { @@ -343,7 +342,7 @@ function openEditLotStatus(clickEvent: Event): void { modalElement.querySelector( '#lotStatusEdit--lotName' ) as HTMLInputElement - ).value = lot.lotName! + ).value = lot.lotName ?? '' const lotStatusElement = modalElement.querySelector( '#lotStatusEdit--lotStatusId' @@ -366,7 +365,7 @@ function openEditLotStatus(clickEvent: Event): void { if (!lotStatusFound && lot.lotStatusId) { const optionElement = document.createElement('option') optionElement.value = lot.lotStatusId.toString() - optionElement.textContent = lot.lotStatus! + optionElement.textContent = lot.lotStatus ?? '' lotStatusElement.append(optionElement) } @@ -374,9 +373,10 @@ function openEditLotStatus(clickEvent: Event): void { lotStatusElement.value = lot.lotStatusId.toString() } + // eslint-disable-next-line no-unsanitized/method modalElement - .querySelector('form')! - .insertAdjacentHTML( + .querySelector('form') + ?.insertAdjacentHTML( 'beforeend', `` ) @@ -387,8 +387,8 @@ function openEditLotStatus(clickEvent: Event): void { bulmaJS.toggleHtmlClipped() modalElement - .querySelector('form')! - .addEventListener('submit', doUpdateLotStatus) + .querySelector('form') + ?.addEventListener('submit', doUpdateLotStatus) }, onremoved() { bulmaJS.toggleHtmlClipped() @@ -405,7 +405,7 @@ function deleteLot(clickEvent: Event): void { function doDelete(): void { cityssm.postJSON( - los.urlPrefix + '/workOrders/doDeleteWorkOrderLot', + `${los.urlPrefix}/workOrders/doDeleteWorkOrderLot`, { workOrderId, lotId @@ -414,11 +414,11 @@ function deleteLot(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - workOrderLots?: recordTypes.Lot[] + workOrderLots: recordTypes.Lot[] } if (responseJSON.success) { - workOrderLots = responseJSON.workOrderLots! + workOrderLots = responseJSON.workOrderLots renderRelatedLotsAndOccupancies() } else { bulmaJS.alert({ @@ -454,23 +454,25 @@ function renderRelatedLots(): void { ).textContent = workOrderLots.length.toString() if (workOrderLots.length === 0) { + // eslint-disable-next-line no-unsanitized/property lotsContainerElement.innerHTML = `
-

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

-
` +

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

+ ` return } + // eslint-disable-next-line no-unsanitized/property lotsContainerElement.innerHTML = `
' + - (isActive - ? '' - : '') + - '' + - '' + - cityssm.escapeHTML(lotOccupancy.occupancyType ?? '') + - '
' + - `#${lotOccupancy.lotOccupancyId!}` + - '
+ ${ + isActive + ? `` + : `` + } + + + ${cityssm.escapeHTML(lotOccupancy.occupancyType ?? '')} +
+ #${lotOccupancy.lotOccupancyId} +
' + - cityssm.escapeHTML(lotOccupancy.lotName ?? '') + - (hasLotRecord - ? '' - : ' ') + - ' + ${cityssm.escapeHTML(lotOccupancy.lotName ?? '')} + ${ + hasLotRecord + ? '' + : ` ` + } + (No ${los.escapedAliases.Lot})' + - lotOccupancy.occupancyStartDateString! + - '' + - (lotOccupancy.occupancyEndDate - ? lotOccupancy.occupancyEndDateString! - : '(No End Date)') + - '' + - (lotOccupancy.lotOccupancyOccupants!.length === 0 - ? `(No ${los.escapedAliases.Occupants})` - : `
    ${occupantsHTML}
`) + - '
' + - '' + - ' + ${lotOccupancy.occupancyStartDateString} + + ${ + lotOccupancy.occupancyEndDate + ? lotOccupancy.occupancyEndDateString + : '(No End Date)' + } + + ${ + lotOccupancy.lotOccupancyOccupants!.length === 0 + ? `(No ${los.escapedAliases.Occupants})` + : `
    ${occupantsHTML}
` + } +
+ +
- - - - - - - - -
${los.escapedAliases.Lot}${los.escapedAliases.Map}${los.escapedAliases.Lot} TypeStatus
` + + ${los.escapedAliases.Lot} + ${los.escapedAliases.Map} + ${los.escapedAliases.Lot} Type + Status + + + + ` for (const lot of workOrderLots) { const rowElement = document.createElement('tr') @@ -478,39 +480,39 @@ function renderRelatedLots(): void { rowElement.dataset.lotId = lot.lotId.toString() - rowElement.innerHTML = - '' + - '' + - cityssm.escapeHTML(lot.lotName ?? '') + - '' + - '' + - `${cityssm.escapeHTML(lot.mapName ?? '')}` + - `${cityssm.escapeHTML(lot.lotType ?? '')}` + - ('' + - (lot.lotStatusId - ? cityssm.escapeHTML(lot.lotStatus ?? '') - : '(No Status)') + - '') + - ` + // eslint-disable-next-line no-unsanitized/property + rowElement.innerHTML = ` + + ${cityssm.escapeHTML(lot.lotName ?? '')} + + + ${cityssm.escapeHTML(lot.mapName ?? '')} + + ${cityssm.escapeHTML(lot.lotType ?? '')} + + ${ + lot.lotStatusId + ? cityssm.escapeHTML(lot.lotStatus ?? '') + : '(No Status)' + } + - ` + ` rowElement - .querySelector('.button--editLotStatus')! - .addEventListener('click', openEditLotStatus) + .querySelector('.button--editLotStatus') + ?.addEventListener('click', openEditLotStatus) rowElement - .querySelector('.button--deleteLot')! - .addEventListener('click', deleteLot) + .querySelector('.button--deleteLot') + ?.addEventListener('click', deleteLot) - lotsContainerElement.querySelector('tbody')!.append(rowElement) + lotsContainerElement.querySelector('tbody')?.append(rowElement) } } @@ -522,9 +524,11 @@ function renderRelatedLotsAndOccupancies(): void { renderRelatedLotsAndOccupancies() function doAddLotOccupancy(clickEvent: Event): void { - const rowElement = (clickEvent.currentTarget as HTMLElement).closest('tr')! + const rowElement = (clickEvent.currentTarget as HTMLElement).closest( + 'tr' + ) as HTMLTableRowElement - const lotOccupancyId = rowElement.dataset.lotOccupancyId! + const lotOccupancyId = rowElement.dataset.lotOccupancyId ?? '' addLotOccupancy(lotOccupancyId, (success) => { if (success) { @@ -544,11 +548,12 @@ document event.preventDefault() } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML('Searching...') cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', + `${los.urlPrefix}/lotOccupancies/doSearchLotOccupancies`, searchFormElement, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { @@ -563,6 +568,7 @@ document return } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = ` @@ -579,7 +585,7 @@ document const rowElement = document.createElement('tr') rowElement.className = 'container--lotOccupancy' rowElement.dataset.lotOccupancyId = - lotOccupancy.lotOccupancyId!.toString() + lotOccupancy.lotOccupancyId.toString() rowElement.innerHTML = `' ) } else { + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML( 'beforeend', `` ) } + // eslint-disable-next-line no-unsanitized/method rowElement.insertAdjacentHTML( 'beforeend', - `` + - ('') + - ('') + `` ) rowElement - .querySelector('.button--addLotOccupancy')! - .addEventListener('click', doAddLotOccupancy) + .querySelector('.button--addLotOccupancy') + ?.addEventListener('click', doAddLotOccupancy) searchResultsContainerElement - .querySelector('tbody')! - .append(rowElement) + .querySelector('tbody') + ?.append(rowElement) } } ) @@ -646,7 +662,9 @@ document onshow(modalElement) { los.populateAliases(modalElement) - searchFormElement = modalElement.querySelector('form')! + searchFormElement = modalElement.querySelector( + 'form' + ) as HTMLFormElement searchResultsContainerElement = modalElement.querySelector( '#resultsContainer--lotOccupancyAdd' @@ -697,9 +715,11 @@ document }) function doAddLot(clickEvent: Event): void { - const rowElement = (clickEvent.currentTarget as HTMLElement).closest('tr')! + const rowElement = (clickEvent.currentTarget as HTMLElement).closest( + 'tr' + ) as HTMLTableRowElement - const lotId = rowElement.dataset.lotId! + const lotId = rowElement.dataset.lotId ?? '' addLot(lotId, (success) => { if (success) { @@ -717,24 +737,25 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => { event.preventDefault() } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML('Searching...') cityssm.postJSON( - los.urlPrefix + '/lots/doSearchLots', + `${los.urlPrefix}/lots/doSearchLots`, searchFormElement, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { lots: recordTypes.Lot[] } if (responseJSON.lots.length === 0) { - searchResultsContainerElement.innerHTML = - '
' + - '

There are no records that meet the search criteria.

' + - '
' + searchResultsContainerElement.innerHTML = `
+

There are no records that meet the search criteria.

+
` return } + // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `
(No ${los.escapedAliases.Lot})${lotOccupancy.occupancyStartDateString!}' + - (lotOccupancy.occupancyEndDate - ? lotOccupancy.occupancyEndDateString! - : '(No End Date)') + - '' + - (lotOccupancy.lotOccupancyOccupants!.length === 0 - ? `(No ${cityssm.escapeHTML( - los.escapedAliases.Occupants - )})` - : cityssm.escapeHTML( - lotOccupancy.lotOccupancyOccupants![0].occupantName! + - ' ' + - lotOccupancy.lotOccupancyOccupants![0] - .occupantFamilyName! - ) + - (lotOccupancy.lotOccupancyOccupants!.length > 1 - ? ' plus ' + - (lotOccupancy.lotOccupancyOccupants!.length - 1).toString() - : '')) + - ' + ${lotOccupancy.occupancyStartDateString} + + ${ + lotOccupancy.occupancyEndDate + ? lotOccupancy.occupancyEndDateString + : '(No End Date)' + } + + ${ + lotOccupancy.lotOccupancyOccupants!.length === 0 + ? ` + (No ${cityssm.escapeHTML( + los.escapedAliases.Occupants + )}) + ` + : cityssm.escapeHTML( + `${lotOccupancy.lotOccupancyOccupants![0].occupantName} + ${ + lotOccupancy.lotOccupancyOccupants![0] + .occupantFamilyName + }` + ) + + (lotOccupancy.lotOccupancyOccupants!.length > 1 + ? ` plus + ${( + lotOccupancy.lotOccupancyOccupants!.length - 1 + ).toString()}` + : '') + }
@@ -751,28 +772,27 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => { rowElement.className = 'container--lot' rowElement.dataset.lotId = lot.lotId.toString() - rowElement.innerHTML = - '' + - ('') + - '' + - ('') + - ('') + rowElement.innerHTML = `` rowElement - .querySelector('.button--addLot')! - .addEventListener('click', doAddLot) + .querySelector('.button--addLot') + ?.addEventListener('click', doAddLot) searchResultsContainerElement - .querySelector('tbody')! - .append(rowElement) + .querySelector('tbody') + ?.append(rowElement) } } ) @@ -782,7 +802,7 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => { onshow(modalElement) { los.populateAliases(modalElement) - searchFormElement = modalElement.querySelector('form')! + searchFormElement = modalElement.querySelector('form') as HTMLFormElement searchResultsContainerElement = modalElement.querySelector( '#resultsContainer--lotAdd' @@ -817,8 +837,8 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => { lotNameElement.focus() modalElement - .querySelector('#lotSearch--lotStatusId')! - .addEventListener('change', doSearch) + .querySelector('#lotSearch--lotStatusId') + ?.addEventListener('change', doSearch) searchFormElement.addEventListener('submit', doSearch) }, diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js index 910363fc..67d40b48 100644 --- a/public/javascripts/lotOccupancyEdit.min.js +++ b/public/javascripts/lotOccupancyEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,n,c,o;const a=exports.los,l=document.querySelector("#lotOccupancy--lotOccupancyId").value,s=""===l;let i=s;function r(){var e;a.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.remove("is-light")}function u(){var e;a.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.add("is-light")}const d=document.querySelector("#form--lotOccupancy");d.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/${s?"doCreateLotOccupancy":"doUpdateLotOccupancy"}`,d,e=>{var t;const n=e;n.success?(u(),s||i?window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Saving ${a.escapedAliases.Occupancy}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const p=d.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",r);function m(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,{lotOccupancyId:l},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(S=document.querySelector("#button--copyLotOccupancy"))||void 0===S||S.addEventListener("click",e=>{e.preventDefault(),a.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${a.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:m}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${a.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`,{lotOccupancyId:l},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function n(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/workOrders/doCreateWorkOrder`,e.currentTarget,e=>{const n=e;n.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(n.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:n.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=l,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const n=e.querySelector("#workOrderCreate--workOrderTypeId"),c=exports.workOrderTypes;1===c.length&&(n.innerHTML="");for(const e of c){const c=document.createElement("option");c.value=e.workOrderTypeId.toString(),c.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",n.append(c)}},onshown(e,c){var o;t=c,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",n)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const y=document.querySelector("#lotOccupancy--occupancyTypeId");if(s){const e=document.querySelector("#container--lotOccupancyFields");y.addEventListener("change",()=>{""!==y.value?cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetOccupancyTypeFields`,{occupancyTypeId:y.value},t=>{var n,c;const o=t;if(0===o.occupancyTypeFields.length)return void(e.innerHTML=`
\n

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

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

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

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

No results.

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

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

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

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

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

There are no comments associated with this record.

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

There are no fees associated with this record.

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

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

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

There are no transactions associated with this record.

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

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

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

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

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

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

No results.

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

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

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

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

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

There are no comments associated with this record.

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

There are no fees associated with this record.

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

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

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

There are no transactions associated with this record.

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

'),t.addEventListener("change",s),e.addEventListener("change",s),s()}},onshown(t,o){var a;bulmaJS.toggleHtmlClipped(),e.focus(),n=o,null===(a=t.querySelector("form"))||void 0===a||a.addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),i.focus()}})}),N()}})(); \ No newline at end of file diff --git a/public/javascripts/lotSearch.min.js b/public/javascripts/lotSearch.min.js index a8d9bf08..27f5f72e 100644 --- a/public/javascripts/lotSearch.min.js +++ b/public/javascripts/lotSearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),n=document.querySelector("#searchFilter--offset");function r(t){var n,r,o,l,d,u,p;const h=t;if(0===h.lots.length)return void(s.innerHTML=`
\n

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

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

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

\n
`);const m=document.createElement("tbody");for(const t of h.lots)m.insertAdjacentHTML("beforeend",`\n \n `);s.innerHTML=`
\n \n ${cityssm.escapeHTML(null!==(n=t.lotName)&&void 0!==n?n:"")}\n \n \n \n ${t.mapName?cityssm.escapeHTML(t.mapName):'(No Name)'}\n \n \n ${cityssm.escapeHTML(null!==(r=t.lotType)&&void 0!==r?r:"")}\n \n ${t.lotStatusId?cityssm.escapeHTML(null!==(o=t.lotStatus)&&void 0!==o?o:""):'(No Status)'}
\n ${(null!==(l=t.lotOccupancyCount)&&void 0!==l?l:0)>0?'Currently Occupied':""}\n
\n \n \n \n \n \n \n
${e.escapedAliases.Lot}${e.escapedAliases.Map}${e.escapedAliases.Lot} TypeStatus
`,s.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(a,h.offset,h.count)),null===(d=s.querySelector("table"))||void 0===d||d.append(m),null===(u=s.querySelector("button[data-page='previous']"))||void 0===u||u.addEventListener("click",c),null===(p=s.querySelector("button[data-page='next']"))||void 0===p||p.addEventListener("click",i)}function o(){s.innerHTML=e.getLoadingParagraphHTML(`Loading ${e.escapedAliases.Lots}...`),cityssm.postJSON(`${e.urlPrefix}/lots/doSearchLots`,t,r)}function l(){n.value="0",o()}function c(){n.value=Math.max(Number.parseInt(n.value,10)-a,0).toString(),o()}function i(){n.value=(Number.parseInt(n.value,10)+a).toString(),o()}const d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault()}),o()})(); \ No newline at end of file diff --git a/public/javascripts/workOrderEdit.min.js b/public/javascripts/workOrderEdit.min.js index 1597f0d4..12a993dc 100644 --- a/public/javascripts/workOrderEdit.min.js +++ b/public/javascripts/workOrderEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t;const o=exports.los,r=document.querySelector("#workOrderEdit--workOrderId").value,n=""===r,s=document.querySelector("#form--workOrderEdit");function a(){var e;o.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--workOrderEdit']"))||void 0===e||e.classList.remove("is-light")}function l(){var e;o.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--workOrderEdit']"))||void 0===e||e.classList.add("is-light")}o.initializeDatePickers(null===(S=s.querySelector("#workOrderEdit--workOrderOpenDateString"))||void 0===S?void 0:S.closest(".field")),o.initializeUnlockFieldButtons(s),s.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/${n?"doCreateWorkOrder":"doUpdateWorkOrder"}`,e.currentTarget,e=>{var t;const r=e;r.success?(l(),n?window.location.href=o.getWorkOrderURL(r.workOrderId,!0):bulmaJS.alert({message:"Work Order Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating Work Order",message:null!==(t=r.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const i=s.querySelectorAll("input, select, textarea");for(const e of i)e.addEventListener("change",a);function d(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doCloseWorkOrder`,{workOrderId:r},e=>{var t;const n=e;n.success?(l(),window.location.href=o.getWorkOrderURL(r)):bulmaJS.alert({title:"Error Closing Work Order",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function c(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doDeleteWorkOrder`,{workOrderId:r},e=>{var t;const r=e;r.success?(l(),window.location.href=`${o.urlPrefix}/workOrders`):bulmaJS.alert({title:"Error Deleting Work Order",message:null!==(t=r.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}let u;if(null===(m=document.querySelector("#button--closeWorkOrder"))||void 0===m||m.addEventListener("click",()=>{u.some(e=>!e.workOrderMilestoneCompletionDate)?bulmaJS.alert({title:"Outstanding Milestones",message:"You cannot close a work order with outstanding milestones.\n Either complete the outstanding milestones, or remove them from the work order.",contextualColorName:"warning"}):bulmaJS.confirm({title:"Close Work Order",message:o.hasUnsavedChanges()?"Are you sure you want to close this work order with unsaved changes?":"Are you sure you want to close this work order?",contextualColorName:o.hasUnsavedChanges()?"warning":"info",okButton:{text:"Yes, Close Work Order",callbackFunction:d}})}),null===(e=document.querySelector("#button--deleteWorkOrder"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete Work Order",message:"Are you sure you want to delete this work order?",contextualColorName:"warning",okButton:{text:"Yes, Delete Work Order",callbackFunction:c}})}),!n){var m;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.workOrderLots;delete exports.workOrderLots;let t=exports.workOrderLotOccupancies;function p(e){const n=e.currentTarget.closest(".container--lotOccupancy").dataset.lotOccupancyId;bulmaJS.confirm({title:`Delete ${o.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${o.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/workOrders/doDeleteWorkOrderLotOccupancy",{workOrderId:r,lotOccupancyId:n},e=>{var o;const r=e;r.success?(t=r.workOrderLotOccupancies,k()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=r.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})}function y(t,n){cityssm.postJSON(o.urlPrefix+"/workOrders/doAddWorkOrderLot",{workOrderId:r,lotId:t},t=>{var r;const s=t;s.success?(e=s.workOrderLots,k()):bulmaJS.alert({title:`Error Adding ${o.escapedAliases.Lot}`,message:null!==(r=s.errorMessage)&&void 0!==r?r:"",contextualColorName:"danger"}),void 0!==n&&n(s.success)})}function O(e){y(e.currentTarget.dataset.lotId)}function h(t){const n=Number.parseInt(t.currentTarget.closest(".container--lot").dataset.lotId,10),s=e.find(e=>e.lotId===n);let a;function l(t){t.preventDefault(),cityssm.postJSON(o.urlPrefix+"/workOrders/doUpdateLotStatus",t.currentTarget,t=>{var o;const r=t;r.success?(e=r.workOrderLots,k(),a()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=r.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lot-editLotStatus",{onshow(e){o.populateAliases(e),e.querySelector("#lotStatusEdit--lotId").value=n.toString(),e.querySelector("#lotStatusEdit--lotName").value=s.lotName;const t=e.querySelector("#lotStatusEdit--lotStatusId");let a=!1;for(const e of exports.lotStatuses){const o=document.createElement("option");o.value=e.lotStatusId.toString(),o.textContent=e.lotStatus,e.lotStatusId===s.lotStatusId&&(a=!0),t.append(o)}if(!a&&s.lotStatusId){const e=document.createElement("option");e.value=s.lotStatusId.toString(),e.textContent=s.lotStatus,t.append(e)}s.lotStatusId&&(t.value=s.lotStatusId.toString()),e.querySelector("form").insertAdjacentHTML("beforeend",``)},onshown(e,t){a=t,bulmaJS.toggleHtmlClipped(),e.querySelector("form").addEventListener("submit",l)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function g(t){const n=t.currentTarget.closest(".container--lot").dataset.lotId;bulmaJS.confirm({title:`Delete ${o.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${o.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/workOrders/doDeleteWorkOrderLot",{workOrderId:r,lotId:n},t=>{var o;const r=t;r.success?(e=r.workOrderLots,k()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=r.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})}function k(){!function(){var r,n,s,a;const l=document.querySelector("#container--lotOccupancies");if(document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent=t.length.toString(),0===t.length)return void(l.innerHTML=`
\n

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

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

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

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

    There are no records that meet the search criteria.

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

    There are no records that meet the search criteria.

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

    There are no comments to display.

    \n
    ');const r=document.createElement("table");r.className="table is-fullwidth is-striped is-hoverable",r.innerHTML='\n Commentor\n Comment Date\n Comment\n Options';for(const o of f){const n=document.createElement("tr");n.dataset.workOrderCommentId=o.workOrderCommentId.toString(),n.innerHTML=""+cityssm.escapeHTML(null!==(e=o.recordCreate_userName)&&void 0!==e?e:"")+""+o.workOrderCommentDateString+(0===o.workOrderCommentTime?"":" "+o.workOrderCommentTimePeriodString)+""+cityssm.escapeHTML(null!==(t=o.workOrderComment)&&void 0!==t?t:"")+'
    ',n.querySelector(".button--edit").addEventListener("click",b),n.querySelector(".button--delete").addEventListener("click",M),r.querySelector("tbody").append(n)}o.innerHTML="",o.append(r)}function T(e){for(const t of e.querySelectorAll(".panel-block"))t.remove()}function C(e,t){T(t),t.insertAdjacentHTML("beforeend",`
    \n ${o.getLoadingParagraphHTML("Loading conflicting milestones...")}\n
    `),cityssm.postJSON(`${o.urlPrefix}/workOrders/doGetWorkOrderMilestones`,{workOrderMilestoneDateFilter:"date",workOrderMilestoneDateString:e},o=>{var n,s,a,l;const i=o.workOrderMilestones.filter(e=>e.workOrderId.toString()!==r);T(t);for(const e of i)t.insertAdjacentHTML("beforeend",`
    \n
    \n
    \n ${cityssm.escapeHTML(0===e.workOrderMilestoneTime?"No Time":null!==(n=e.workOrderMilestoneTimePeriodString)&&void 0!==n?n:"")}
    \n ${cityssm.escapeHTML(null!==(s=e.workOrderMilestoneType)&&void 0!==s?s:"")}\n
    \n
    \n ${cityssm.escapeHTML(null!==(a=e.workOrderNumber)&&void 0!==a?a:"")}
    \n \n ${cityssm.escapeHTML(null!==(l=e.workOrderDescription)&&void 0!==l?l:"")}\n \n
    \n
    \n
    `);0===i.length&&t.insertAdjacentHTML("beforeend",`
    \n
    \n

    \n There are no milestones on other work orders scheduled for\n ${cityssm.escapeHTML(e)}.\n

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

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

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

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

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

    There are no records that meet the search criteria.

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

    There are no records that meet the search criteria.

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

    There are no comments to display.

    \n
    ');const l=document.createElement("table");l.className="table is-fullwidth is-striped is-hoverable",l.innerHTML='\n Commentor\n Comment Date\n Comment\n Options';for(const a of f){const i=document.createElement("tr");i.dataset.workOrderCommentId=null===(e=a.workOrderCommentId)||void 0===e?void 0:e.toString(),i.innerHTML=`\n ${cityssm.escapeHTML(null!==(t=a.recordCreate_userName)&&void 0!==t?t:"")}\n \n ${a.workOrderCommentDateString}\n ${0===a.workOrderCommentTime?"":" "+a.workOrderCommentTimePeriodString}\n \n ${cityssm.escapeHTML(null!==(o=a.workOrderComment)&&void 0!==o?o:"")}\n \n
    \n \n \n
    \n `,null===(n=i.querySelector(".button--edit"))||void 0===n||n.addEventListener("click",b),null===(r=i.querySelector(".button--delete"))||void 0===r||r.addEventListener("click",M),null===(s=l.querySelector("tbody"))||void 0===s||s.append(i)}a.innerHTML="",a.append(l)}function T(e){for(const t of e.querySelectorAll(".panel-block"))t.remove()}function C(e,t){T(t),t.insertAdjacentHTML("beforeend",`
    \n ${o.getLoadingParagraphHTML("Loading conflicting milestones...")}\n
    `),cityssm.postJSON(`${o.urlPrefix}/workOrders/doGetWorkOrderMilestones`,{workOrderMilestoneDateFilter:"date",workOrderMilestoneDateString:e},o=>{var r,s,a,l;const i=o.workOrderMilestones.filter(e=>e.workOrderId.toString()!==n);T(t);for(const e of i)t.insertAdjacentHTML("beforeend",`
    \n
    \n
    \n ${cityssm.escapeHTML(0===e.workOrderMilestoneTime?"No Time":null!==(r=e.workOrderMilestoneTimePeriodString)&&void 0!==r?r:"")}
    \n ${cityssm.escapeHTML(null!==(s=e.workOrderMilestoneType)&&void 0!==s?s:"")}\n
    \n
    \n ${cityssm.escapeHTML(null!==(a=e.workOrderNumber)&&void 0!==a?a:"")}
    \n \n ${cityssm.escapeHTML(null!==(l=e.workOrderDescription)&&void 0!==l?l:"")}\n \n
    \n
    \n
    `);0===i.length&&t.insertAdjacentHTML("beforeend",`
    \n
    \n

    \n There are no milestones on other work orders scheduled for\n ${cityssm.escapeHTML(e)}.\n

    \n
    \n
    `)})}function $(e){var t;const o=e;o.success?(u=o.workOrderMilestones,q()):bulmaJS.alert({title:"Error Reopening Milestone",message:null!==(t=o.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})}function I(e){var t;e.preventDefault();const r=cityssm.dateToString(new Date),s=Number.parseInt(null!==(t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId)&&void 0!==t?t:"",10),a=u.find(e=>e.workOrderMilestoneId===s);bulmaJS.confirm({title:"Complete Milestone",message:`Are you sure you want to complete this milestone?\n ${void 0!==a.workOrderMilestoneDateString&&""!==a.workOrderMilestoneDateString&&a.workOrderMilestoneDateString>r?"
    Note that this milestone is expected to be completed in the future.":""}`,messageIsHtml:!0,contextualColorName:"warning",okButton:{text:"Yes, Complete Milestone",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doCompleteWorkOrderMilestone`,{workOrderId:n,workOrderMilestoneId:s},$)}}})}function x(e){e.preventDefault();const t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Reopen Milestone",message:"Are you sure you want to remove the completion status from this milestone, and reopen it?",contextualColorName:"warning",okButton:{text:"Yes, Reopen Milestone",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/workOrders/doReopenWorkOrderMilestone",{workOrderId:n,workOrderMilestoneId:t},$)}}})}function E(e){e.preventDefault();const t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Delete Milestone",message:"Are you sure you want to delete this milestone?",contextualColorName:"warning",okButton:{text:"Yes, Delete Milestone",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doDeleteWorkOrderMilestone`,{workOrderMilestoneId:t,workOrderId:n},$)}}})}function D(e){var t;e.preventDefault();const r=Number.parseInt(null!==(t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId)&&void 0!==t?t:"",10),s=u.find(e=>e.workOrderMilestoneId===r);let a,l;function i(e){e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/doUpdateWorkOrderMilestone`,e.currentTarget,e=>{const t=e;$(t),t.success&&a()})}cityssm.openHtmlModal("workOrder-editMilestone",{onshow(e){var t,o,r,a,i,d;e.querySelector("#milestoneEdit--workOrderId").value=n,e.querySelector("#milestoneEdit--workOrderMilestoneId").value=null!==(o=null===(t=s.workOrderMilestoneId)||void 0===t?void 0:t.toString())&&void 0!==o?o:"";const c=e.querySelector("#milestoneEdit--workOrderMilestoneTypeId");let u=!1;for(const e of exports.workOrderMilestoneTypes){const t=document.createElement("option");t.value=e.workOrderMilestoneTypeId.toString(),t.textContent=e.workOrderMilestoneType,e.workOrderMilestoneTypeId===s.workOrderMilestoneTypeId&&(t.selected=!0,u=!0),c.append(t)}if(!u&&s.workOrderMilestoneTypeId){const e=document.createElement("option");e.value=s.workOrderMilestoneTypeId.toString(),e.textContent=null!==(r=s.workOrderMilestoneType)&&void 0!==r?r:"",e.selected=!0,c.append(e)}(l=e.querySelector("#milestoneEdit--workOrderMilestoneDateString")).value=null!==(a=s.workOrderMilestoneDateString)&&void 0!==a?a:"",s.workOrderMilestoneTime&&(e.querySelector("#milestoneEdit--workOrderMilestoneTimeString").value=null!==(i=s.workOrderMilestoneTimeString)&&void 0!==i?i:""),e.querySelector("#milestoneEdit--workOrderMilestoneDescription").value=null!==(d=s.workOrderMilestoneDescription)&&void 0!==d?d:""},onshown(e,t){var n;a=t,bulmaJS.toggleHtmlClipped(),o.initializeDatePickers(e),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",i);const r=document.querySelector("#milestoneEdit--conflictingMilestonesPanel");l.addEventListener("change",()=>{C(l.value,r)}),C(l.value,r)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function q(){var e,t,o,n,r,s,a;const l=document.querySelector("#panel--milestones"),i=l.querySelectorAll(".panel-block");for(const e of i)e.remove();for(const i of u){const d=document.createElement("div");d.className="panel-block is-block container--milestone",d.dataset.workOrderMilestoneId=null===(e=i.workOrderMilestoneId)||void 0===e?void 0:e.toString(),d.innerHTML=`
    \n
    \n ${i.workOrderMilestoneCompletionDate?`\n \n `:''}\n
    \n ${i.workOrderMilestoneTypeId?`${cityssm.escapeHTML(null!==(t=i.workOrderMilestoneType)&&void 0!==t?t:"")}
    `:""}\n ${0===i.workOrderMilestoneDate?'(No Set Date)':i.workOrderMilestoneDateString}\n ${i.workOrderMilestoneTime?` ${i.workOrderMilestoneTimePeriodString}`:""}
    \n \n ${cityssm.escapeHTML(null!==(o=i.workOrderMilestoneDescription)&&void 0!==o?o:"")}\n \n
    \n \n
    `,null===(n=d.querySelector(".button--reopenMilestone"))||void 0===n||n.addEventListener("click",x),null===(r=d.querySelector(".button--editMilestone"))||void 0===r||r.addEventListener("click",D),null===(s=d.querySelector(".button--completeMilestone"))||void 0===s||s.addEventListener("click",I),null===(a=d.querySelector(".button--deleteMilestone"))||void 0===a||a.addEventListener("click",E),l.append(d)}bulmaJS.init(l)}delete exports.workOrderComments,null===(S=document.querySelector("#workOrderComments--add"))||void 0===S||S.addEventListener("click",function(){let e;function t(t){t.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/doAddWorkOrderComment`,t.currentTarget,t=>{const o=t;o.success&&(f=o.workOrderComments,L(),e())})}cityssm.openHtmlModal("workOrder-addComment",{onshow(e){var r;o.populateAliases(e),e.querySelector("#workOrderCommentAdd--workOrderId").value=n,null===(r=e.querySelector("form"))||void 0===r||r.addEventListener("submit",t)},onshown(t,o){bulmaJS.toggleHtmlClipped(),e=o,t.querySelector("#workOrderCommentAdd--workOrderComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#workOrderComments--add").focus()}})}),r||L(),r||(u=exports.workOrderMilestones,delete exports.workOrderMilestones,q(),null===(t=document.querySelector("#button--addMilestone"))||void 0===t||t.addEventListener("click",()=>{let e,t,r;function s(n){n&&n.preventDefault();const s=cityssm.dateToString(new Date);function a(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doAddWorkOrderMilestone`,e,e=>{const t=e;$(t),t.success&&r()})}const l=t.value;""!==l&&l{C(t.value,l)}),C(t.value,l)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addMilestone").focus()}})}))})(); \ No newline at end of file