From 5aeb485d07f012bad6240eaaf07473b4973c7e8a Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Thu, 27 Jun 2024 11:04:13 -0400 Subject: [PATCH] template literals --- public-typescript/lotOccupancyEdit.js | 32 +++++++++---------- .../lotOccupancyEdit/lotOccupancyEdit.js | 2 +- .../lotOccupancyEdit/lotOccupancyEdit.ts | 2 +- .../lotOccupancyEdit/lotOccupancyEditFees.js | 10 +++--- .../lotOccupancyEdit/lotOccupancyEditFees.ts | 10 +++--- .../lotOccupancyEditOccupants.js | 20 ++++++------ .../lotOccupancyEditOccupants.ts | 22 ++++++------- public/javascripts/lotOccupancyEdit.min.js | 2 +- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js index 581e2836..6f8ed253 100644 --- a/public-typescript/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit.js @@ -203,7 +203,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); `; return; } - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetOccupancyTypeFields', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetOccupancyTypeFields`, { occupancyTypeId: occupancyTypeIdElement.value }, (rawResponseJSON) => { var _a, _b; @@ -664,19 +664,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); ${((_f = lotOccupancyOccupant.occupantAddress1) !== null && _f !== void 0 ? _f : '') === '' ? '' - : cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantAddress1) !== null && _g !== void 0 ? _g : '') + - '
'} + : `${cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantAddress1) !== null && _g !== void 0 ? _g : '')}
`} ${((_h = lotOccupancyOccupant.occupantAddress2) !== null && _h !== void 0 ? _h : '') === '' ? '' - : cityssm.escapeHTML((_j = lotOccupancyOccupant.occupantAddress2) !== null && _j !== void 0 ? _j : '') + - '
'} + : `${cityssm.escapeHTML((_j = lotOccupancyOccupant.occupantAddress2) !== null && _j !== void 0 ? _j : '')}
`} ${((_k = lotOccupancyOccupant.occupantCity) !== null && _k !== void 0 ? _k : '') === '' ? '' - : cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantCity) !== null && _l !== void 0 ? _l : '') + ', '} + : `${cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantCity) !== null && _l !== void 0 ? _l : '')}, `} ${cityssm.escapeHTML((_m = lotOccupancyOccupant.occupantProvince) !== null && _m !== void 0 ? _m : '')}
- ${cityssm.escapeHTML((_o = lotOccupancyOccupant.occupantPostalCode) !== null && _o !== void 0 ? _o : '')}${((_p = lotOccupancyOccupant.occupantPhoneNumber) !== null && _p !== void 0 ? _p : '') === '' + ${cityssm.escapeHTML((_o = lotOccupancyOccupant.occupantPostalCode) !== null && _o !== void 0 ? _o : '')} + + ${((_p = lotOccupancyOccupant.occupantPhoneNumber) !== null && _p !== void 0 ? _p : '') === '' ? '' - : cityssm.escapeHTML((_q = lotOccupancyOccupant.occupantPhoneNumber) !== null && _q !== void 0 ? _q : '') + '
'} + : `${cityssm.escapeHTML((_q = lotOccupancyOccupant.occupantPhoneNumber) !== null && _q !== void 0 ? _q : '')}
`} ${((_r = lotOccupancyOccupant.occupantEmailAddress) !== null && _r !== void 0 ? _r : '') === '' ? '' : cityssm.escapeHTML((_s = lotOccupancyOccupant.occupantEmailAddress) !== null && _s !== void 0 ? _s : '')} @@ -805,15 +805,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); ${cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '')}
${((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === '' ? '' - : cityssm.escapeHTML((_e = occupant.occupantAddress2) !== null && _e !== void 0 ? _e : '') + - '
'}${cityssm.escapeHTML((_f = occupant.occupantCity) !== null && _f !== void 0 ? _f : '')}, ${cityssm.escapeHTML((_g = occupant.occupantProvince) !== null && _g !== void 0 ? _g : '')}
+ : `${cityssm.escapeHTML((_e = occupant.occupantAddress2) !== null && _e !== void 0 ? _e : '')}
`}${cityssm.escapeHTML((_f = occupant.occupantCity) !== null && _f !== void 0 ? _f : '')}, ${cityssm.escapeHTML((_g = occupant.occupantProvince) !== null && _g !== void 0 ? _g : '')}
${cityssm.escapeHTML((_h = occupant.occupantPostalCode) !== null && _h !== void 0 ? _h : '')}
${((_j = occupant.occupantPhoneNumber) !== null && _j !== void 0 ? _j : '') === '' ? '' - : cityssm.escapeHTML((_k = occupant.occupantPhoneNumber) !== null && _k !== void 0 ? _k : '') + - '
'} + : `${cityssm.escapeHTML((_k = occupant.occupantPhoneNumber) !== null && _k !== void 0 ? _k : '')}
`} ${cityssm.escapeHTML((_l = occupant.occupantEmailAddress) !== null && _l !== void 0 ? _l : '')}
`; @@ -1251,9 +1249,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); ((_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); - lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--taxAmountTotal').textContent = '$' + taxAmountTotal.toFixed(2); - lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2); + lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--feeAmountTotal').textContent = `$${feeAmountTotal.toFixed(2)}`; + lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--taxAmountTotal').textContent = `$${taxAmountTotal.toFixed(2)}`; + lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = `$${(feeAmountTotal + taxAmountTotal).toFixed(2)}`; renderLotOccupancyTransactions(); } const addFeeButtonElement = document.querySelector('#button--addFee'); @@ -1343,7 +1341,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); categoryContainerElement.className = 'container--feeCategory'; categoryContainerElement.dataset.feeCategoryId = feeCategory.feeCategoryId.toString(); - categoryContainerElement.innerHTML = `

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

+ categoryContainerElement.innerHTML = `

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

`; let hasFees = false; for (const fee of feeCategory.fees) { diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js index e797949f..60b11aac 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js @@ -203,7 +203,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); `; return; } - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetOccupancyTypeFields', { + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetOccupancyTypeFields`, { occupancyTypeId: occupancyTypeIdElement.value }, (rawResponseJSON) => { var _a, _b; diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts index 5dc17ab2..9f286b74 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts @@ -309,7 +309,7 @@ declare const exports: Record } cityssm.postJSON( - los.urlPrefix + '/lotOccupancies/doGetOccupancyTypeFields', + `${los.urlPrefix}/lotOccupancies/doGetOccupancyTypeFields`, { occupancyTypeId: occupancyTypeIdElement.value }, diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js index eaa547f8..0a9e0911 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.js @@ -177,9 +177,9 @@ function renderLotOccupancyFees() { ((_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); - lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--taxAmountTotal').textContent = '$' + taxAmountTotal.toFixed(2); - lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2); + lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--feeAmountTotal').textContent = `$${feeAmountTotal.toFixed(2)}`; + lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--taxAmountTotal').textContent = `$${taxAmountTotal.toFixed(2)}`; + lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = `$${(feeAmountTotal + taxAmountTotal).toFixed(2)}`; renderLotOccupancyTransactions(); } const addFeeButtonElement = document.querySelector('#button--addFee'); @@ -269,7 +269,9 @@ addFeeButtonElement.addEventListener('click', () => { categoryContainerElement.className = 'container--feeCategory'; categoryContainerElement.dataset.feeCategoryId = feeCategory.feeCategoryId.toString(); - categoryContainerElement.innerHTML = `

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

+ categoryContainerElement.innerHTML = `

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

`; let hasFees = false; for (const fee of feeCategory.fees) { diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts index c32d3548..6856a239 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts @@ -268,17 +268,17 @@ function renderLotOccupancyFees(): void { lotOccupancyFeesContainerElement.querySelector( '#lotOccupancyFees--feeAmountTotal' ) as HTMLElement - ).textContent = '$' + feeAmountTotal.toFixed(2) + ).textContent = `$${feeAmountTotal.toFixed(2)}` ;( lotOccupancyFeesContainerElement.querySelector( '#lotOccupancyFees--taxAmountTotal' ) as HTMLElement - ).textContent = '$' + taxAmountTotal.toFixed(2) + ).textContent = `$${taxAmountTotal.toFixed(2)}` ;( lotOccupancyFeesContainerElement.querySelector( '#lotOccupancyFees--grandTotal' ) as HTMLElement - ).textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2) + ).textContent = `$${(feeAmountTotal + taxAmountTotal).toFixed(2)}` renderLotOccupancyTransactions() } @@ -406,7 +406,9 @@ addFeeButtonElement.addEventListener('click', () => { categoryContainerElement.dataset.feeCategoryId = feeCategory.feeCategoryId.toString() - categoryContainerElement.innerHTML = `

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

+ categoryContainerElement.innerHTML = `

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

` let hasFees = false diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js index ac17461c..0c0f609f 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js @@ -184,19 +184,19 @@ function renderLotOccupancyOccupants() { ${((_f = lotOccupancyOccupant.occupantAddress1) !== null && _f !== void 0 ? _f : '') === '' ? '' - : cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantAddress1) !== null && _g !== void 0 ? _g : '') + - '
'} + : `${cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantAddress1) !== null && _g !== void 0 ? _g : '')}
`} ${((_h = lotOccupancyOccupant.occupantAddress2) !== null && _h !== void 0 ? _h : '') === '' ? '' - : cityssm.escapeHTML((_j = lotOccupancyOccupant.occupantAddress2) !== null && _j !== void 0 ? _j : '') + - '
'} + : `${cityssm.escapeHTML((_j = lotOccupancyOccupant.occupantAddress2) !== null && _j !== void 0 ? _j : '')}
`} ${((_k = lotOccupancyOccupant.occupantCity) !== null && _k !== void 0 ? _k : '') === '' ? '' - : cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantCity) !== null && _l !== void 0 ? _l : '') + ', '} + : `${cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantCity) !== null && _l !== void 0 ? _l : '')}, `} ${cityssm.escapeHTML((_m = lotOccupancyOccupant.occupantProvince) !== null && _m !== void 0 ? _m : '')}
- ${cityssm.escapeHTML((_o = lotOccupancyOccupant.occupantPostalCode) !== null && _o !== void 0 ? _o : '')}${((_p = lotOccupancyOccupant.occupantPhoneNumber) !== null && _p !== void 0 ? _p : '') === '' + ${cityssm.escapeHTML((_o = lotOccupancyOccupant.occupantPostalCode) !== null && _o !== void 0 ? _o : '')} + + ${((_p = lotOccupancyOccupant.occupantPhoneNumber) !== null && _p !== void 0 ? _p : '') === '' ? '' - : cityssm.escapeHTML((_q = lotOccupancyOccupant.occupantPhoneNumber) !== null && _q !== void 0 ? _q : '') + '
'} + : `${cityssm.escapeHTML((_q = lotOccupancyOccupant.occupantPhoneNumber) !== null && _q !== void 0 ? _q : '')}
`} ${((_r = lotOccupancyOccupant.occupantEmailAddress) !== null && _r !== void 0 ? _r : '') === '' ? '' : cityssm.escapeHTML((_s = lotOccupancyOccupant.occupantEmailAddress) !== null && _s !== void 0 ? _s : '')} @@ -325,15 +325,13 @@ else { ${cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '')}
${((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === '' ? '' - : cityssm.escapeHTML((_e = occupant.occupantAddress2) !== null && _e !== void 0 ? _e : '') + - '
'}${cityssm.escapeHTML((_f = occupant.occupantCity) !== null && _f !== void 0 ? _f : '')}, ${cityssm.escapeHTML((_g = occupant.occupantProvince) !== null && _g !== void 0 ? _g : '')}
+ : `${cityssm.escapeHTML((_e = occupant.occupantAddress2) !== null && _e !== void 0 ? _e : '')}
`}${cityssm.escapeHTML((_f = occupant.occupantCity) !== null && _f !== void 0 ? _f : '')}, ${cityssm.escapeHTML((_g = occupant.occupantProvince) !== null && _g !== void 0 ? _g : '')}
${cityssm.escapeHTML((_h = occupant.occupantPostalCode) !== null && _h !== void 0 ? _h : '')}
${((_j = occupant.occupantPhoneNumber) !== null && _j !== void 0 ? _j : '') === '' ? '' - : cityssm.escapeHTML((_k = occupant.occupantPhoneNumber) !== null && _k !== void 0 ? _k : '') + - '
'} + : `${cityssm.escapeHTML((_k = occupant.occupantPhoneNumber) !== null && _k !== void 0 ? _k : '')}
`} ${cityssm.escapeHTML((_l = occupant.occupantEmailAddress) !== null && _l !== void 0 ? _l : '')}
`; diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts index e1dc4f8e..c9d4066d 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts @@ -332,27 +332,27 @@ function renderLotOccupancyOccupants(): void { ${ (lotOccupancyOccupant.occupantAddress1 ?? '') === '' ? '' - : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1 ?? '') + - '
' + : `${cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1 ?? '')}
` } ${ (lotOccupancyOccupant.occupantAddress2 ?? '') === '' ? '' - : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress2 ?? '') + - '
' + : `${cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress2 ?? '')}
` } ${ (lotOccupancyOccupant.occupantCity ?? '') === '' ? '' - : cityssm.escapeHTML(lotOccupancyOccupant.occupantCity ?? '') + ', ' + : `${cityssm.escapeHTML(lotOccupancyOccupant.occupantCity ?? '')}, ` } ${cityssm.escapeHTML(lotOccupancyOccupant.occupantProvince ?? '')}
- ${cityssm.escapeHTML(lotOccupancyOccupant.occupantPostalCode ?? '')}${ + ${cityssm.escapeHTML(lotOccupancyOccupant.occupantPostalCode ?? '')} + + ${ (lotOccupancyOccupant.occupantPhoneNumber ?? '') === '' ? '' - : cityssm.escapeHTML( + : `${cityssm.escapeHTML( lotOccupancyOccupant.occupantPhoneNumber ?? '' - ) + '
' + )}
` } ${ (lotOccupancyOccupant.occupantEmailAddress ?? '') === '' @@ -551,8 +551,7 @@ document ${ (occupant.occupantAddress2 ?? '') === '' ? '' - : cityssm.escapeHTML(occupant.occupantAddress2 ?? '') + - '
' + : `${cityssm.escapeHTML(occupant.occupantAddress2 ?? '')}
` }${cityssm.escapeHTML(occupant.occupantCity ?? '')}, ${cityssm.escapeHTML(occupant.occupantProvince ?? '')}
${cityssm.escapeHTML(occupant.occupantPostalCode ?? '')} @@ -560,8 +559,7 @@ document ${ (occupant.occupantPhoneNumber ?? '') === '' ? '' - : cityssm.escapeHTML(occupant.occupantPhoneNumber ?? '') + - '
' + : `${cityssm.escapeHTML(occupant.occupantPhoneNumber ?? '')}
` } ${cityssm.escapeHTML(occupant.occupantEmailAddress ?? '')}
diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js index d17f8037..910363fc 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 ${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:"")}${""===(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 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 +"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 ${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 $();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)}`,$()}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