From 577141be613be34c742ce261d44f5c8e56267f55 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 25 Jun 2024 15:18:40 -0400 Subject: [PATCH] code cleanup --- cypress/e2e/01-admin/feeManagement.cy.js | 10 +++---- cypress/e2e/01-admin/feeManagement.cy.ts | 12 ++++---- public-typescript/lotOccupancyEdit.js | 29 ++++++++++--------- .../lotOccupancyEdit/lotOccupancyEditFees.js | 29 ++++++++++--------- .../lotOccupancyEdit/lotOccupancyEditFees.ts | 26 ++++++++++------- public/javascripts/lotOccupancyEdit.min.js | 2 +- 6 files changed, 60 insertions(+), 48 deletions(-) diff --git a/cypress/e2e/01-admin/feeManagement.cy.js b/cypress/e2e/01-admin/feeManagement.cy.js index d086e063..2744235a 100644 --- a/cypress/e2e/01-admin/feeManagement.cy.js +++ b/cypress/e2e/01-admin/feeManagement.cy.js @@ -19,7 +19,7 @@ describe('Admin - Fee Management', () => { cy.injectAxe(); cy.checkA11y(); cy.fixture('fee.json').then((fee) => { - cy.get(".modal input[name='feeCategory']").type(fee.feeCategory); + cy.get(".modal input[name='feeCategory']").type(fee.feeCategory ?? ''); cy.get(".modal button[type='submit']").click(); cy.wait(ajaxDelayMillis); cy.get('.container--feeCategory .panel-heading .title').should('contain.text', fee.feeCategory); @@ -31,11 +31,11 @@ describe('Admin - Fee Management', () => { cy.injectAxe(); cy.checkA11y(); cy.fixture('fee.json').then((fee) => { - cy.get(".modal input[name='feeName']").type(fee.feeName); - cy.get(".modal textarea[name='feeDescription']").type(fee.feeDescription); + cy.get(".modal input[name='feeName']").type(fee.feeName ?? ''); + cy.get(".modal textarea[name='feeDescription']").type(fee.feeDescription ?? ''); cy.get(".modal input[name='feeAmount']") .clear() - .type(fee.feeAmount.toString()); + .type(fee.feeAmount?.toString() ?? ''); cy.get(".modal input[name='taxAmount']").should('be.disabled'); cy.get(".modal input[name='taxPercentage']") .invoke('val') @@ -46,7 +46,7 @@ describe('Admin - Fee Management', () => { cy.get(".modal select[name='includeQuantity']").select('1'); cy.get(".modal input[name='quantityUnit']") .should('not.be.disabled') - .type(fee.quantityUnit); + .type(fee.quantityUnit ?? ''); cy.get(".modal button[type='submit']").click(); cy.wait(ajaxDelayMillis); cy.get('.container--fee a').should('contain.text', fee.feeName); diff --git a/cypress/e2e/01-admin/feeManagement.cy.ts b/cypress/e2e/01-admin/feeManagement.cy.ts index cc81d8ea..402a12b8 100644 --- a/cypress/e2e/01-admin/feeManagement.cy.ts +++ b/cypress/e2e/01-admin/feeManagement.cy.ts @@ -27,7 +27,7 @@ describe('Admin - Fee Management', () => { cy.checkA11y() cy.fixture('fee.json').then((fee: Fee) => { - cy.get(".modal input[name='feeCategory']").type(fee.feeCategory!) + cy.get(".modal input[name='feeCategory']").type(fee.feeCategory ?? '') cy.get(".modal button[type='submit']").click() @@ -49,13 +49,15 @@ describe('Admin - Fee Management', () => { cy.checkA11y() cy.fixture('fee.json').then((fee: Fee) => { - cy.get(".modal input[name='feeName']").type(fee.feeName!) + cy.get(".modal input[name='feeName']").type(fee.feeName ?? '') - cy.get(".modal textarea[name='feeDescription']").type(fee.feeDescription!) + cy.get(".modal textarea[name='feeDescription']").type( + fee.feeDescription ?? '' + ) cy.get(".modal input[name='feeAmount']") .clear() - .type(fee.feeAmount!.toString()) + .type(fee.feeAmount?.toString() ?? '') cy.get(".modal input[name='taxAmount']").should('be.disabled') @@ -74,7 +76,7 @@ describe('Admin - Fee Management', () => { cy.get(".modal input[name='quantityUnit']") .should('not.be.disabled') - .type(fee.quantityUnit!) + .type(fee.quantityUnit ?? '') cy.get(".modal button[type='submit']").click() diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js index 34319a48..ac17bb3e 100644 --- a/public-typescript/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit.js @@ -1098,11 +1098,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); delete exports.lotOccupancyFees; const lotOccupancyFeesContainerElement = document.querySelector('#container--lotOccupancyFees'); function getFeeGrandTotal() { + var _a, _b, _c; let feeGrandTotal = 0; for (const lotOccupancyFee of lotOccupancyFees) { feeGrandTotal += - (lotOccupancyFee.feeAmount + lotOccupancyFee.taxAmount) * - lotOccupancyFee.quantity; + (((_a = lotOccupancyFee.feeAmount) !== null && _a !== void 0 ? _a : 0) + ((_b = lotOccupancyFee.taxAmount) !== null && _b !== void 0 ? _b : 0)) * + ((_c = lotOccupancyFee.quantity) !== null && _c !== void 0 ? _c : 0); } return feeGrandTotal; } @@ -1186,7 +1187,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); }); } function renderLotOccupancyFees() { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; if (lotOccupancyFees.length === 0) { lotOccupancyFeesContainerElement.innerHTML = `

There are no fees associated with this record.

@@ -1241,11 +1242,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); ${(_e = lotOccupancyFee.quantity) === null || _e === void 0 ? void 0 : _e.toString()} =`} - $${(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2)} + $${(((_f = lotOccupancyFee.feeAmount) !== null && _f !== void 0 ? _f : 0) * ((_g = lotOccupancyFee.quantity) !== null && _g !== void 0 ? _g : 0)).toFixed(2)}
- ${((_f = lotOccupancyFee.includeQuantity) !== null && _f !== void 0 ? _f : false) + ${((_h = lotOccupancyFee.includeQuantity) !== null && _h !== void 0 ? _h : false) ? `
`; - (_g = tableRowElement - .querySelector('.button--editQuantity')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', editLotOccupancyFeeQuantity); - (_h = tableRowElement - .querySelector('.button--delete')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', deleteLotOccupancyFee); - (_j = lotOccupancyFeesContainerElement - .querySelector('tbody')) === null || _j === void 0 ? void 0 : _j.append(tableRowElement); - feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity; - taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity; + (_j = tableRowElement + .querySelector('.button--editQuantity')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', editLotOccupancyFeeQuantity); + (_k = tableRowElement + .querySelector('.button--delete')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', deleteLotOccupancyFee); + (_l = lotOccupancyFeesContainerElement + .querySelector('tbody')) === null || _l === void 0 ? void 0 : _l.append(tableRowElement); + feeAmountTotal += + ((_m = lotOccupancyFee.feeAmount) !== null && _m !== void 0 ? _m : 0) * ((_o = lotOccupancyFee.quantity) !== null && _o !== void 0 ? _o : 0); + taxAmountTotal += + ((_p = lotOccupancyFee.taxAmount) !== null && _p !== void 0 ? _p : 0) * ((_q = lotOccupancyFee.quantity) !== null && _q !== void 0 ? _q : 0); } ; lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--feeAmountTotal').textContent = '$' + feeAmountTotal.toFixed(2); diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js index a7db8242..eaa547f8 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js @@ -6,11 +6,12 @@ let lotOccupancyFees = exports.lotOccupancyFees; delete exports.lotOccupancyFees; const lotOccupancyFeesContainerElement = document.querySelector('#container--lotOccupancyFees'); function getFeeGrandTotal() { + var _a, _b, _c; let feeGrandTotal = 0; for (const lotOccupancyFee of lotOccupancyFees) { feeGrandTotal += - (lotOccupancyFee.feeAmount + lotOccupancyFee.taxAmount) * - lotOccupancyFee.quantity; + (((_a = lotOccupancyFee.feeAmount) !== null && _a !== void 0 ? _a : 0) + ((_b = lotOccupancyFee.taxAmount) !== null && _b !== void 0 ? _b : 0)) * + ((_c = lotOccupancyFee.quantity) !== null && _c !== void 0 ? _c : 0); } return feeGrandTotal; } @@ -94,7 +95,7 @@ function deleteLotOccupancyFee(clickEvent) { }); } function renderLotOccupancyFees() { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; if (lotOccupancyFees.length === 0) { lotOccupancyFeesContainerElement.innerHTML = `

There are no fees associated with this record.

@@ -149,11 +150,11 @@ function renderLotOccupancyFees() { ${(_e = lotOccupancyFee.quantity) === null || _e === void 0 ? void 0 : _e.toString()} =`} - $${(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2)} + $${(((_f = lotOccupancyFee.feeAmount) !== null && _f !== void 0 ? _f : 0) * ((_g = lotOccupancyFee.quantity) !== null && _g !== void 0 ? _g : 0)).toFixed(2)}
- ${((_f = lotOccupancyFee.includeQuantity) !== null && _f !== void 0 ? _f : false) + ${((_h = lotOccupancyFee.includeQuantity) !== null && _h !== void 0 ? _h : false) ? `
`; - (_g = tableRowElement - .querySelector('.button--editQuantity')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', editLotOccupancyFeeQuantity); - (_h = tableRowElement - .querySelector('.button--delete')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', deleteLotOccupancyFee); - (_j = lotOccupancyFeesContainerElement - .querySelector('tbody')) === null || _j === void 0 ? void 0 : _j.append(tableRowElement); - feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity; - taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity; + (_j = tableRowElement + .querySelector('.button--editQuantity')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', editLotOccupancyFeeQuantity); + (_k = tableRowElement + .querySelector('.button--delete')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', deleteLotOccupancyFee); + (_l = lotOccupancyFeesContainerElement + .querySelector('tbody')) === null || _l === void 0 ? void 0 : _l.append(tableRowElement); + feeAmountTotal += + ((_m = lotOccupancyFee.feeAmount) !== null && _m !== void 0 ? _m : 0) * ((_o = lotOccupancyFee.quantity) !== null && _o !== void 0 ? _o : 0); + taxAmountTotal += + ((_p = lotOccupancyFee.taxAmount) !== null && _p !== void 0 ? _p : 0) * ((_q = lotOccupancyFee.quantity) !== null && _q !== void 0 ? _q : 0); } ; lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--feeAmountTotal').textContent = '$' + feeAmountTotal.toFixed(2); diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts index b5b8cc53..c32d3548 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts @@ -28,8 +28,8 @@ function getFeeGrandTotal(): number { for (const lotOccupancyFee of lotOccupancyFees) { feeGrandTotal += - (lotOccupancyFee.feeAmount! + lotOccupancyFee.taxAmount!) * - lotOccupancyFee.quantity! + ((lotOccupancyFee.feeAmount ?? 0) + (lotOccupancyFee.taxAmount ?? 0)) * + (lotOccupancyFee.quantity ?? 0) } return feeGrandTotal @@ -41,9 +41,10 @@ function editLotOccupancyFeeQuantity(clickEvent: Event): void { .feeId ?? '', 10 ) + const fee = lotOccupancyFees.find((possibleFee) => { return possibleFee.feeId === feeId - })! + }) as recordTypes.LotOccupancyFee let updateCloseModalFunction: () => void @@ -56,11 +57,11 @@ function editLotOccupancyFeeQuantity(clickEvent: Event): void { (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean - lotOccupancyFees?: recordTypes.LotOccupancyFee[] + lotOccupancyFees: recordTypes.LotOccupancyFee[] } if (responseJSON.success) { - lotOccupancyFees = responseJSON.lotOccupancyFees! + lotOccupancyFees = responseJSON.lotOccupancyFees renderLotOccupancyFees() updateCloseModalFunction() } else { @@ -226,7 +227,7 @@ function renderLotOccupancyFees(): void { =` } - $${(lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!).toFixed(2)} + $${((lotOccupancyFee.feeAmount ?? 0) * (lotOccupancyFee.quantity ?? 0)).toFixed(2)}
@@ -256,8 +257,11 @@ function renderLotOccupancyFees(): void { .querySelector('tbody') ?.append(tableRowElement) - feeAmountTotal += lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity! - taxAmountTotal += lotOccupancyFee.taxAmount! * lotOccupancyFee.quantity! + feeAmountTotal += + (lotOccupancyFee.feeAmount ?? 0) * (lotOccupancyFee.quantity ?? 0) + + taxAmountTotal += + (lotOccupancyFee.taxAmount ?? 0) * (lotOccupancyFee.quantity ?? 0) } ;( @@ -373,11 +377,11 @@ addFeeButtonElement.addEventListener('click', () => { const feeCategory = feeCategories.find((currentFeeCategory) => { return currentFeeCategory.feeCategoryId === feeCategoryId - })! + }) as recordTypes.FeeCategory const fee = feeCategory.fees.find((currentFee) => { return currentFee.feeId === feeId - })! + }) as recordTypes.Fee if (fee.includeQuantity ?? false) { doSetQuantityAndAddFee(fee) @@ -532,7 +536,7 @@ function editLotOccupancyTransaction(clickEvent: Event): void { const transaction = lotOccupancyTransactions.find((possibleTransaction) => { return possibleTransaction.transactionIndex === transactionIndex - })! + }) as recordTypes.LotOccupancyTransaction let editCloseModalFunction: () => void diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js index 4d471489..e0a24c71 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 r=s;function i(){var e;a.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.remove("is-light")}function u(){var e;a.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.add("is-light")}const d=document.querySelector("#form--lotOccupancy");d.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/${s?"doCreateLotOccupancy":"doUpdateLotOccupancy"}`,d,e=>{var t;const n=e;n.success?(u(),s||r?window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Saving ${a.escapedAliases.Occupancy}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const p=d.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",i);function m(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,{lotOccupancyId: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:()=>{r=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{y.value=e}}})})}const v=document.querySelector("#lotOccupancy--lotName");v.addEventListener("click",e=>{const t=e.currentTarget.value;let n,c,o,l;function s(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,i(),n()}function r(e){var t,n;e.preventDefault();const c=e.currentTarget;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",r),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 r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const i=e.querySelector("#lotSelect--occupancyStatus");if(i.addEventListener("change",u),""!==t&&(i.value=""),o=e.querySelector("#form--lotSelect"),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="",i())}),a.initializeDatePickers(d),null===(o=document.querySelector("#lotOccupancy--occupancyStartDateString"))||void 0===o||o.addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),a.initializeUnlockFieldButtons(d),Object.defineProperty(exports,"__esModule",{value:!0});let f=exports.lotOccupancyOccupants;function O(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotOccupantIndex)&&void 0!==n?n:"",10),o=f.find(e=>e.lotOccupantIndex===c);let s,r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`,s,e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,r(),h()):bulmaJS.alert({title:`Error Updating ${a.escapedAliases.Occupant}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow(e){var t,n,s,r,i,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!==(i=o.occupantName)&&void 0!==i?i:"",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",i),r=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,r,i,u,d,p,m,y,v,h,S,b,C,T,x,L;const q=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(q),0===f.length)return void(q.innerHTML=`
\n

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

\n
`);const N=document.createElement("table");N.className="table is-fullwidth is-striped is-hoverable",N.innerHTML=`\n ${a.escapedAliases.Occupant}\n Address\n Other Contact\n Comment\n Options\n \n `;for(const q of f){const f=document.createElement("tr");f.dataset.lotOccupantIndex=q.lotOccupantIndex.toString(),f.innerHTML=""+cityssm.escapeHTML(""===(null!==(e=q.occupantName)&&void 0!==e?e:"")&&""===(null!==(t=q.occupantFamilyName)&&void 0!==t?t:"")?"(No Name)":`${q.occupantName} ${q.occupantFamilyName}`)+'
'+cityssm.escapeHTML(null!==(c=q.lotOccupantType)&&void 0!==c?c:"")+""+(""===(null!==(o=q.occupantAddress1)&&void 0!==o?o:"")?"":cityssm.escapeHTML(null!==(l=q.occupantAddress1)&&void 0!==l?l:"")+"
")+(""===(null!==(s=q.occupantAddress2)&&void 0!==s?s:"")?"":cityssm.escapeHTML(null!==(r=q.occupantAddress2)&&void 0!==r?r:"")+"
")+(""===(null!==(i=q.occupantCity)&&void 0!==i?i:"")?"":cityssm.escapeHTML(null!==(u=q.occupantCity)&&void 0!==u?u:"")+", ")+cityssm.escapeHTML(null!==(d=q.occupantProvince)&&void 0!==d?d:"")+"
"+cityssm.escapeHTML(null!==(p=q.occupantPostalCode)&&void 0!==p?p:"")+""+(""===(null!==(m=q.occupantPhoneNumber)&&void 0!==m?m:"")?"":cityssm.escapeHTML(null!==(y=q.occupantPhoneNumber)&&void 0!==y?y:"")+"
")+(""===(null!==(v=q.occupantEmailAddress)&&void 0!==v?v:"")?"":cityssm.escapeHTML(null!==(h=q.occupantEmailAddress)&&void 0!==h?h:""))+''+cityssm.escapeHTML(null!==(C=q.occupantComment)&&void 0!==C?C:"")+'
',null===(T=f.querySelector(".button--edit"))||void 0===T||T.addEventListener("click",O),null===(x=f.querySelector(".button--delete"))||void 0===x||x.addEventListener("click",g),null===(L=N.querySelector("tbody"))||void 0===L||L.append(f)}q.append(N)}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 r=[];function i(e){var t;e.preventDefault();const n=e.currentTarget,c=r[Number.parseInt(n.dataset.index,10)],s=(null===(t=n.closest(".modal"))||void 0===t?void 0:t.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId")).value;""===s?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(c.lotOccupantTypeId=Number.parseInt(s,10),c.lotOccupancyId=Number.parseInt(l,10),o(c))}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;r=e.occupants;const v=document.createElement("div");v.className="panel";for(const[e,c]of r.entries()){const r=document.createElement("a");r.className="panel-block is-block",r.dataset.index=e.toString(),r.innerHTML=`\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
`,r.addEventListener("click",i),v.append(r)}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 r,i;function u(t){t.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyComment`,r,t=>{var n,c;const o=t;o.success?(e=null!==(n=o.lotOccupancyComments)&&void 0!==n?n:[],i(),T()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editComment",{onshow(e){var t,n,c,r;a.populateAliases(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value=o.toString(),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value=null!==(t=s.lotOccupancyComment)&&void 0!==t?t:"";const i=e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");i.value=null!==(n=s.lotOccupancyCommentDateString)&&void 0!==n?n:"";const u=cityssm.dateToString(new Date);i.max=s.lotOccupancyCommentDateString<=u?u:null!==(c=s.lotOccupancyCommentDateString)&&void 0!==c?c:"",e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value=null!==(r=s.lotOccupancyCommentTimeString)&&void 0!==r?r:""},onshown(e,t){bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus(),(r=e.querySelector("form")).addEventListener("submit",u),i=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function C(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyComment`,{lotOccupancyId: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,r;const i=document.querySelector("#container--lotOccupancyComments");if(0===e.length)return void(i.innerHTML='
\n

There are no comments associated with this record.

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

There are no fees associated with this record.

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

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

\n
`;let p=!1;for(const t of o.fees){if(null!==n.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let 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!==(r=t.feeName)&&void 0!==r?r:"")}
\n \n ${cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replaceAll("\n","
")}\n
`,y.addEventListener("click",i),e.querySelector(".panel").append(y)}p&&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 r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`,e.currentTarget,e=>{const t=e;t.success?(o=t.lotOccupancyTransactions,I(),r()):bulmaJS.alert({title:"Error Updating Transaction",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editTransaction",{onshow(e){var t,n,c,o,r,i;a.populateAliases(e),e.querySelector("#lotOccupancyTransactionEdit--lotOccupancyId").value=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!==(r=s.transactionDateString)&&void 0!==r?r:"",e.querySelector("#lotOccupancyTransactionEdit--transactionTimeString").value=null!==(i=s.transactionTimeString)&&void 0!==i?i:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",i),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function M(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`,{lotOccupancyId:l,transactionIndex:t},e=>{var t;const n=e;n.success?(o=n.lotOccupancyTransactions,I()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function I(){var e,n,c,l,r,i,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===(r=o.querySelector(".button--edit"))||void 0===r||r.addEventListener("click",E),null===(i=o.querySelector(".button--delete"))||void 0===i||i.addEventListener("click",M),null===(u=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 r=document.querySelector("#button--addTransaction");r.addEventListener("click",()=>{let e,t,n;function c(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`,e.currentTarget,e=>{var t;const c=e;c.success?(o=c.lotOccupancyTransactions,n(),I()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function 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(),r=function(){let e=0;for(const t of o)e+=t.transactionAmount;return e}();if((e=n.querySelector("#lotOccupancyTransactionAdd--transactionAmount")).min=(-1*r).toFixed(2),e.max=Math.max(c-r,0).toFixed(2),e.value=Math.max(c-r,0).toFixed(2),a.dynamicsGPIntegrationIsEnabled){const c=(t=n.querySelector("#lotOccupancyTransactionAdd--externalReceiptNumber")).closest(".control");c.classList.add("has-icons-right"),c.insertAdjacentHTML("beforeend",''),c.insertAdjacentHTML("afterend",'

'),t.addEventListener("change",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(),r.focus()}})}),N()}})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,n,c,o;const a=exports.los,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;const q=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(q),0===f.length)return void(q.innerHTML=`
\n

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

\n
`);const N=document.createElement("table");N.className="table is-fullwidth is-striped is-hoverable",N.innerHTML=`\n ${a.escapedAliases.Occupant}\n Address\n Other Contact\n Comment\n Options\n \n `;for(const q of f){const f=document.createElement("tr");f.dataset.lotOccupantIndex=q.lotOccupantIndex.toString(),f.innerHTML=""+cityssm.escapeHTML(""===(null!==(e=q.occupantName)&&void 0!==e?e:"")&&""===(null!==(t=q.occupantFamilyName)&&void 0!==t?t:"")?"(No Name)":`${q.occupantName} ${q.occupantFamilyName}`)+'
'+cityssm.escapeHTML(null!==(c=q.lotOccupantType)&&void 0!==c?c:"")+""+(""===(null!==(o=q.occupantAddress1)&&void 0!==o?o:"")?"":cityssm.escapeHTML(null!==(l=q.occupantAddress1)&&void 0!==l?l:"")+"
")+(""===(null!==(s=q.occupantAddress2)&&void 0!==s?s:"")?"":cityssm.escapeHTML(null!==(i=q.occupantAddress2)&&void 0!==i?i:"")+"
")+(""===(null!==(r=q.occupantCity)&&void 0!==r?r:"")?"":cityssm.escapeHTML(null!==(u=q.occupantCity)&&void 0!==u?u:"")+", ")+cityssm.escapeHTML(null!==(d=q.occupantProvince)&&void 0!==d?d:"")+"
"+cityssm.escapeHTML(null!==(p=q.occupantPostalCode)&&void 0!==p?p:"")+""+(""===(null!==(m=q.occupantPhoneNumber)&&void 0!==m?m:"")?"":cityssm.escapeHTML(null!==(y=q.occupantPhoneNumber)&&void 0!==y?y:"")+"
")+(""===(null!==(v=q.occupantEmailAddress)&&void 0!==v?v:"")?"":cityssm.escapeHTML(null!==(h=q.occupantEmailAddress)&&void 0!==h?h:""))+''+cityssm.escapeHTML(null!==(C=q.occupantComment)&&void 0!==C?C:"")+'
',null===(T=f.querySelector(".button--edit"))||void 0===T||T.addEventListener("click",O),null===(x=f.querySelector(".button--delete"))||void 0===x||x.addEventListener("click",g),null===(L=N.querySelector("tbody"))||void 0===L||L.append(f)}q.append(N)}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;e.preventDefault();const n=e.currentTarget,c=i[Number.parseInt(n.dataset.index,10)],s=(null===(t=n.closest(".modal"))||void 0===t?void 0:t.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId")).value;""===s?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(c.lotOccupantTypeId=Number.parseInt(s,10),c.lotOccupancyId=Number.parseInt(l,10),o(c))}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.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 I();n.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
';let 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),I()}const c=document.querySelector("#button--addFee");c.addEventListener("click",()=>{if(a.hasUnsavedChanges())return void bulmaJS.alert({message:"Please save all unsaved changes before adding fees.",contextualColorName:"warning"});let e,o,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=`

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

\n
`;let p=!1;for(const t of o.fees){if(null!==n.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let 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(),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,I()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function I(){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(),I()):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