diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js
index fdadf934..34319a48 100644
--- a/public-typescript/lotOccupancyEdit.js
+++ b/public-typescript/lotOccupancyEdit.js
@@ -514,7 +514,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
cityssm.openHtmlModal('lotOccupancy-editOccupant', {
onshow(modalElement) {
- var _a;
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
los.populateAliases(modalElement);
modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupancyId').value = lotOccupancyId;
modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupantIndex').value = lotOccupantIndex.toString();
@@ -537,8 +537,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
if (!lotOccupantTypeSelected) {
const optionElement = document.createElement('option');
- optionElement.value = lotOccupancyOccupant.lotOccupantTypeId.toString();
- optionElement.textContent = lotOccupancyOccupant.lotOccupantType;
+ optionElement.value =
+ (_b = (_a = lotOccupancyOccupant.lotOccupantTypeId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '';
+ optionElement.textContent = (_c = lotOccupancyOccupant.lotOccupantType) !== null && _c !== void 0 ? _c : '';
optionElement.dataset.occupantCommentTitle =
lotOccupancyOccupant.occupantCommentTitle;
optionElement.dataset.fontAwesomeIconClass =
@@ -546,22 +547,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
optionElement.selected = true;
lotOccupantTypeSelectElement.append(optionElement);
}
+ ;
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
- ` `;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = lotOccupancyOccupant.occupantAddress2;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = lotOccupancyOccupant.occupantCity;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantProvince').value = lotOccupancyOccupant.occupantProvince;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPostalCode').value = lotOccupancyOccupant.occupantPostalCode;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPhoneNumber').value = lotOccupancyOccupant.occupantPhoneNumber;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantEmailAddress').value = lotOccupancyOccupant.occupantEmailAddress;
+ ` `;
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = (_e = lotOccupancyOccupant.occupantName) !== null && _e !== void 0 ? _e : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = (_f = lotOccupancyOccupant.occupantFamilyName) !== null && _f !== void 0 ? _f : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = (_g = lotOccupancyOccupant.occupantAddress1) !== null && _g !== void 0 ? _g : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = (_h = lotOccupancyOccupant.occupantAddress2) !== null && _h !== void 0 ? _h : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = (_j = lotOccupancyOccupant.occupantCity) !== null && _j !== void 0 ? _j : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantProvince').value = (_k = lotOccupancyOccupant.occupantProvince) !== null && _k !== void 0 ? _k : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPostalCode').value = (_l = lotOccupancyOccupant.occupantPostalCode) !== null && _l !== void 0 ? _l : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPhoneNumber').value = (_m = lotOccupancyOccupant.occupantPhoneNumber) !== null && _m !== void 0 ? _m : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantEmailAddress').value = (_o = lotOccupancyOccupant.occupantEmailAddress) !== null && _o !== void 0 ? _o : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCommentTitle').textContent =
- ((_a = lotOccupancyOccupant.occupantCommentTitle) !== null && _a !== void 0 ? _a : '') === ''
+ ((_p = lotOccupancyOccupant.occupantCommentTitle) !== null && _p !== void 0 ? _p : '') === ''
? 'Comment'
- : lotOccupancyOccupant.occupantCommentTitle;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantComment').value = lotOccupancyOccupant.occupantComment;
+ : (_q = lotOccupancyOccupant.occupantCommentTitle) !== null && _q !== void 0 ? _q : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantComment').value = (_r = lotOccupancyOccupant.occupantComment) !== null && _r !== void 0 ? _r : '';
},
onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped();
@@ -572,7 +574,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
- ` `;
+ ` `;
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
if (occupantCommentTitle === '') {
@@ -591,9 +593,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function deleteLotOccupancyOccupant(clickEvent) {
- const lotOccupantIndex = clickEvent.currentTarget.closest('tr').dataset.lotOccupantIndex;
+ var _a;
+ const lotOccupantIndex = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.lotOccupantIndex;
function doDelete() {
- cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyOccupant', {
+ cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`, {
lotOccupancyId,
lotOccupantIndex
}, (rawResponseJSON) => {
@@ -605,7 +608,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
else {
bulmaJS.alert({
- title: 'Error Removing ' + los.escapedAliases.Occupant,
+ title: `Error Removing ${los.escapedAliases.Occupant}`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
@@ -616,17 +619,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
title: `Remove ${los.escapedAliases.Occupant}?`,
message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`,
okButton: {
- text: 'Yes, Remove ' + los.escapedAliases.Occupant,
+ text: `Yes, Remove ${los.escapedAliases.Occupant}`,
callbackFunction: doDelete
},
contextualColorName: 'warning'
});
}
function renderLotOccupancyOccupants() {
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
const occupantsContainer = document.querySelector('#container--lotOccupancyOccupants');
cityssm.clearElement(occupantsContainer);
if (lotOccupancyOccupants.length === 0) {
+ // eslint-disable-next-line no-unsanitized/property
occupantsContainer.innerHTML = `
There are no ${los.escapedAliases.occupants} associated with this record.
`;
@@ -634,6 +638,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
const tableElement = document.createElement('table');
tableElement.className = 'table is-fullwidth is-striped is-hoverable';
+ // eslint-disable-next-line no-unsanitized/property
tableElement.innerHTML = `
${los.escapedAliases.Occupant}
Address
@@ -646,56 +651,56 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotOccupantIndex =
lotOccupancyOccupant.lotOccupantIndex.toString();
+ // eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML =
'' +
cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' &&
((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === ''
? '(No Name)'
- : lotOccupancyOccupant.occupantName +
- ' ' +
- lotOccupancyOccupant.occupantFamilyName) +
+ : `${lotOccupancyOccupant.occupantName} ${lotOccupancyOccupant.occupantFamilyName}`) +
' ' +
('' +
' ' +
' ' +
- cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType) +
+ cityssm.escapeHTML((_d = lotOccupancyOccupant.lotOccupantType) !== null && _d !== void 0 ? _d : '') +
' ' +
' ') +
' ' +
('' +
- (((_c = lotOccupancyOccupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') === ''
+ (((_e = lotOccupancyOccupant.occupantAddress1) !== null && _e !== void 0 ? _e : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1) +
+ : cityssm.escapeHTML((_f = lotOccupancyOccupant.occupantAddress1) !== null && _f !== void 0 ? _f : '') +
' ') +
- (((_d = lotOccupancyOccupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === ''
+ (((_g = lotOccupancyOccupant.occupantAddress2) !== null && _g !== void 0 ? _g : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress2) +
+ : cityssm.escapeHTML((_h = lotOccupancyOccupant.occupantAddress2) !== null && _h !== void 0 ? _h : '') +
' ') +
- (((_e = lotOccupancyOccupant.occupantCity) !== null && _e !== void 0 ? _e : '') === ''
+ (((_j = lotOccupancyOccupant.occupantCity) !== null && _j !== void 0 ? _j : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantCity) + ', ') +
- cityssm.escapeHTML((_f = lotOccupancyOccupant.occupantProvince) !== null && _f !== void 0 ? _f : '') +
+ : cityssm.escapeHTML((_k = lotOccupancyOccupant.occupantCity) !== null && _k !== void 0 ? _k : '') +
+ ', ') +
+ cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantProvince) !== null && _l !== void 0 ? _l : '') +
' ' +
- cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') +
+ cityssm.escapeHTML((_m = lotOccupancyOccupant.occupantPostalCode) !== null && _m !== void 0 ? _m : '') +
' ') +
('' +
- (((_h = lotOccupancyOccupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === ''
+ (((_o = lotOccupancyOccupant.occupantPhoneNumber) !== null && _o !== void 0 ? _o : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) +
+ : cityssm.escapeHTML((_p = lotOccupancyOccupant.occupantPhoneNumber) !== null && _p !== void 0 ? _p : '') +
' ') +
- (((_j = lotOccupancyOccupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') === ''
+ (((_q = lotOccupancyOccupant.occupantEmailAddress) !== null && _q !== void 0 ? _q : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)) +
+ : cityssm.escapeHTML((_r = lotOccupancyOccupant.occupantEmailAddress) !== null && _r !== void 0 ? _r : '')) +
' ') +
('' +
'' +
- cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantComment) !== null && _l !== void 0 ? _l : '') +
+ cityssm.escapeHTML((_u = lotOccupancyOccupant.occupantComment) !== null && _u !== void 0 ? _u : '') +
' ' +
' ') +
('' +
@@ -705,19 +710,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
' Edit ' +
'') +
('' +
' ' +
' ') +
'' +
' ');
- tableRowElement
- .querySelector('.button--edit')
- .addEventListener('click', openEditLotOccupancyOccupant);
- tableRowElement
- .querySelector('.button--delete')
- .addEventListener('click', deleteLotOccupancyOccupant);
- tableElement.querySelector('tbody').append(tableRowElement);
+ (_v = tableRowElement
+ .querySelector('.button--edit')) === null || _v === void 0 ? void 0 : _v.addEventListener('click', openEditLotOccupancyOccupant);
+ (_w = tableRowElement
+ .querySelector('.button--delete')) === null || _w === void 0 ? void 0 : _w.addEventListener('click', deleteLotOccupancyOccupant);
+ (_x = tableElement.querySelector('tbody')) === null || _x === void 0 ? void 0 : _x.append(tableRowElement);
}
occupantsContainer.append(tableElement);
}
@@ -734,6 +737,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment';
}
+ ;
formElement.querySelector('#lotOccupancy--occupantCommentTitle').textContent = occupantCommentTitle;
});
}
@@ -747,7 +751,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let searchFormElement;
let searchResultsElement;
function addOccupant(formOrObject) {
- cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, (rawResponseJSON) => {
+ cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`, formOrObject, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
@@ -770,12 +774,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
let pastOccupantSearchResults = [];
function addOccupantFromCopy(clickEvent) {
+ var _a;
clickEvent.preventDefault();
const panelBlockElement = clickEvent.currentTarget;
const occupant = pastOccupantSearchResults[Number.parseInt(panelBlockElement.dataset.index, 10)];
- const lotOccupantTypeId = panelBlockElement
- .closest('.modal')
- .querySelector('#lotOccupancyOccupantCopy--lotOccupantTypeId').value;
+ const lotOccupantTypeId = ((_a = panelBlockElement
+ .closest('.modal')) === null || _a === void 0 ? void 0 : _a.querySelector('#lotOccupancyOccupantCopy--lotOccupantTypeId')).value;
if (lotOccupantTypeId === '') {
bulmaJS.alert({
title: `No ${los.escapedAliases.Occupant} Type Selected`,
@@ -792,16 +796,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
function searchOccupants(event) {
event.preventDefault();
if (searchFormElement.querySelector('#lotOccupancyOccupantCopy--searchFilter').value === '') {
- searchResultsElement.innerHTML =
- '' +
- '
Enter a partial name or address in the search field above.
' +
- '
';
+ searchResultsElement.innerHTML = `
+
Enter a partial name or address in the search field above.
+
`;
return;
}
+ // eslint-disable-next-line no-unsanitized/property
searchResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...');
- cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (rawResponseJSON) => {
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
+ cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doSearchPastOccupants`, searchFormElement, (rawResponseJSON) => {
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
const responseJSON = rawResponseJSON;
pastOccupantSearchResults = responseJSON.occupants;
const panelElement = document.createElement('div');
@@ -810,35 +814,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
const panelBlockElement = document.createElement('a');
panelBlockElement.className = 'panel-block is-block';
panelBlockElement.dataset.index = index.toString();
- panelBlockElement.innerHTML =
- '' +
- cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '') +
- ' ' +
- cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') +
- ' ' +
- ' ' +
- '' +
- ('
' +
- cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') +
- ' ' +
- (((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === ''
- ? ''
- : cityssm.escapeHTML(occupant.occupantAddress2) + ' ') +
- cityssm.escapeHTML((_e = occupant.occupantCity) !== null && _e !== void 0 ? _e : '') +
- ', ' +
- cityssm.escapeHTML((_f = occupant.occupantProvince) !== null && _f !== void 0 ? _f : '') +
- ' ' +
- cityssm.escapeHTML((_g = occupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') +
- '
') +
- ('
' +
- (((_h = occupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === ''
- ? ''
- : cityssm.escapeHTML(occupant.occupantPhoneNumber) +
- ' ') +
- cityssm.escapeHTML((_j = occupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') +
- ' ' +
- '
') +
- '
';
+ // eslint-disable-next-line no-unsanitized/property
+ panelBlockElement.innerHTML = `
+ ${cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '')} ${cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '')}
+
+
+
+ ${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((_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((_l = occupant.occupantEmailAddress) !== null && _l !== void 0 ? _l : '')}
+
+
`;
panelBlockElement.addEventListener('click', addOccupantFromCopy);
panelElement.append(panelBlockElement);
}
@@ -877,12 +873,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML =
- ` `;
+ ` `;
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment';
}
+ ;
modalElement.querySelector('#lotOccupancyOccupantAdd--occupantCommentTitle').textContent = occupantCommentTitle;
});
addFormElement = modalElement.querySelector('#form--lotOccupancyOccupantAdd');
diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js
index 9a3d1636..8b3624ee 100644
--- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js
+++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js
@@ -34,7 +34,7 @@ function openEditLotOccupancyOccupant(clickEvent) {
}
cityssm.openHtmlModal('lotOccupancy-editOccupant', {
onshow(modalElement) {
- var _a;
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
los.populateAliases(modalElement);
modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupancyId').value = lotOccupancyId;
modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupantIndex').value = lotOccupantIndex.toString();
@@ -57,8 +57,9 @@ function openEditLotOccupancyOccupant(clickEvent) {
}
if (!lotOccupantTypeSelected) {
const optionElement = document.createElement('option');
- optionElement.value = lotOccupancyOccupant.lotOccupantTypeId.toString();
- optionElement.textContent = lotOccupancyOccupant.lotOccupantType;
+ optionElement.value =
+ (_b = (_a = lotOccupancyOccupant.lotOccupantTypeId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '';
+ optionElement.textContent = (_c = lotOccupancyOccupant.lotOccupantType) !== null && _c !== void 0 ? _c : '';
optionElement.dataset.occupantCommentTitle =
lotOccupancyOccupant.occupantCommentTitle;
optionElement.dataset.fontAwesomeIconClass =
@@ -66,22 +67,23 @@ function openEditLotOccupancyOccupant(clickEvent) {
optionElement.selected = true;
lotOccupantTypeSelectElement.append(optionElement);
}
+ ;
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
- ` `;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = lotOccupancyOccupant.occupantAddress2;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = lotOccupancyOccupant.occupantCity;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantProvince').value = lotOccupancyOccupant.occupantProvince;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPostalCode').value = lotOccupancyOccupant.occupantPostalCode;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPhoneNumber').value = lotOccupancyOccupant.occupantPhoneNumber;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantEmailAddress').value = lotOccupancyOccupant.occupantEmailAddress;
+ ` `;
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = (_e = lotOccupancyOccupant.occupantName) !== null && _e !== void 0 ? _e : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = (_f = lotOccupancyOccupant.occupantFamilyName) !== null && _f !== void 0 ? _f : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = (_g = lotOccupancyOccupant.occupantAddress1) !== null && _g !== void 0 ? _g : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = (_h = lotOccupancyOccupant.occupantAddress2) !== null && _h !== void 0 ? _h : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = (_j = lotOccupancyOccupant.occupantCity) !== null && _j !== void 0 ? _j : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantProvince').value = (_k = lotOccupancyOccupant.occupantProvince) !== null && _k !== void 0 ? _k : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPostalCode').value = (_l = lotOccupancyOccupant.occupantPostalCode) !== null && _l !== void 0 ? _l : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPhoneNumber').value = (_m = lotOccupancyOccupant.occupantPhoneNumber) !== null && _m !== void 0 ? _m : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantEmailAddress').value = (_o = lotOccupancyOccupant.occupantEmailAddress) !== null && _o !== void 0 ? _o : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCommentTitle').textContent =
- ((_a = lotOccupancyOccupant.occupantCommentTitle) !== null && _a !== void 0 ? _a : '') === ''
+ ((_p = lotOccupancyOccupant.occupantCommentTitle) !== null && _p !== void 0 ? _p : '') === ''
? 'Comment'
- : lotOccupancyOccupant.occupantCommentTitle;
- modalElement.querySelector('#lotOccupancyOccupantEdit--occupantComment').value = lotOccupancyOccupant.occupantComment;
+ : (_q = lotOccupancyOccupant.occupantCommentTitle) !== null && _q !== void 0 ? _q : '';
+ modalElement.querySelector('#lotOccupancyOccupantEdit--occupantComment').value = (_r = lotOccupancyOccupant.occupantComment) !== null && _r !== void 0 ? _r : '';
},
onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped();
@@ -92,7 +94,7 @@ function openEditLotOccupancyOccupant(clickEvent) {
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
- ` `;
+ ` `;
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
if (occupantCommentTitle === '') {
@@ -111,9 +113,10 @@ function openEditLotOccupancyOccupant(clickEvent) {
});
}
function deleteLotOccupancyOccupant(clickEvent) {
- const lotOccupantIndex = clickEvent.currentTarget.closest('tr').dataset.lotOccupantIndex;
+ var _a;
+ const lotOccupantIndex = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.lotOccupantIndex;
function doDelete() {
- cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyOccupant', {
+ cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`, {
lotOccupancyId,
lotOccupantIndex
}, (rawResponseJSON) => {
@@ -125,7 +128,7 @@ function deleteLotOccupancyOccupant(clickEvent) {
}
else {
bulmaJS.alert({
- title: 'Error Removing ' + los.escapedAliases.Occupant,
+ title: `Error Removing ${los.escapedAliases.Occupant}`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
@@ -136,17 +139,18 @@ function deleteLotOccupancyOccupant(clickEvent) {
title: `Remove ${los.escapedAliases.Occupant}?`,
message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`,
okButton: {
- text: 'Yes, Remove ' + los.escapedAliases.Occupant,
+ text: `Yes, Remove ${los.escapedAliases.Occupant}`,
callbackFunction: doDelete
},
contextualColorName: 'warning'
});
}
function renderLotOccupancyOccupants() {
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
const occupantsContainer = document.querySelector('#container--lotOccupancyOccupants');
cityssm.clearElement(occupantsContainer);
if (lotOccupancyOccupants.length === 0) {
+ // eslint-disable-next-line no-unsanitized/property
occupantsContainer.innerHTML = `
There are no ${los.escapedAliases.occupants} associated with this record.
`;
@@ -154,6 +158,7 @@ function renderLotOccupancyOccupants() {
}
const tableElement = document.createElement('table');
tableElement.className = 'table is-fullwidth is-striped is-hoverable';
+ // eslint-disable-next-line no-unsanitized/property
tableElement.innerHTML = `
${los.escapedAliases.Occupant}
Address
@@ -166,56 +171,56 @@ function renderLotOccupancyOccupants() {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotOccupantIndex =
lotOccupancyOccupant.lotOccupantIndex.toString();
+ // eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML =
'' +
cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' &&
((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === ''
? '(No Name)'
- : lotOccupancyOccupant.occupantName +
- ' ' +
- lotOccupancyOccupant.occupantFamilyName) +
+ : `${lotOccupancyOccupant.occupantName} ${lotOccupancyOccupant.occupantFamilyName}`) +
' ' +
('' +
' ' +
' ' +
- cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType) +
+ cityssm.escapeHTML((_d = lotOccupancyOccupant.lotOccupantType) !== null && _d !== void 0 ? _d : '') +
' ' +
' ') +
' ' +
('' +
- (((_c = lotOccupancyOccupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') === ''
+ (((_e = lotOccupancyOccupant.occupantAddress1) !== null && _e !== void 0 ? _e : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1) +
+ : cityssm.escapeHTML((_f = lotOccupancyOccupant.occupantAddress1) !== null && _f !== void 0 ? _f : '') +
' ') +
- (((_d = lotOccupancyOccupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === ''
+ (((_g = lotOccupancyOccupant.occupantAddress2) !== null && _g !== void 0 ? _g : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress2) +
+ : cityssm.escapeHTML((_h = lotOccupancyOccupant.occupantAddress2) !== null && _h !== void 0 ? _h : '') +
' ') +
- (((_e = lotOccupancyOccupant.occupantCity) !== null && _e !== void 0 ? _e : '') === ''
+ (((_j = lotOccupancyOccupant.occupantCity) !== null && _j !== void 0 ? _j : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantCity) + ', ') +
- cityssm.escapeHTML((_f = lotOccupancyOccupant.occupantProvince) !== null && _f !== void 0 ? _f : '') +
+ : cityssm.escapeHTML((_k = lotOccupancyOccupant.occupantCity) !== null && _k !== void 0 ? _k : '') +
+ ', ') +
+ cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantProvince) !== null && _l !== void 0 ? _l : '') +
' ' +
- cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') +
+ cityssm.escapeHTML((_m = lotOccupancyOccupant.occupantPostalCode) !== null && _m !== void 0 ? _m : '') +
' ') +
('' +
- (((_h = lotOccupancyOccupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === ''
+ (((_o = lotOccupancyOccupant.occupantPhoneNumber) !== null && _o !== void 0 ? _o : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) +
+ : cityssm.escapeHTML((_p = lotOccupancyOccupant.occupantPhoneNumber) !== null && _p !== void 0 ? _p : '') +
' ') +
- (((_j = lotOccupancyOccupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') === ''
+ (((_q = lotOccupancyOccupant.occupantEmailAddress) !== null && _q !== void 0 ? _q : '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)) +
+ : cityssm.escapeHTML((_r = lotOccupancyOccupant.occupantEmailAddress) !== null && _r !== void 0 ? _r : '')) +
' ') +
('' +
'' +
- cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantComment) !== null && _l !== void 0 ? _l : '') +
+ cityssm.escapeHTML((_u = lotOccupancyOccupant.occupantComment) !== null && _u !== void 0 ? _u : '') +
' ' +
' ') +
('' +
@@ -225,19 +230,17 @@ function renderLotOccupancyOccupants() {
' Edit ' +
'') +
('' +
' ' +
' ') +
'' +
' ');
- tableRowElement
- .querySelector('.button--edit')
- .addEventListener('click', openEditLotOccupancyOccupant);
- tableRowElement
- .querySelector('.button--delete')
- .addEventListener('click', deleteLotOccupancyOccupant);
- tableElement.querySelector('tbody').append(tableRowElement);
+ (_v = tableRowElement
+ .querySelector('.button--edit')) === null || _v === void 0 ? void 0 : _v.addEventListener('click', openEditLotOccupancyOccupant);
+ (_w = tableRowElement
+ .querySelector('.button--delete')) === null || _w === void 0 ? void 0 : _w.addEventListener('click', deleteLotOccupancyOccupant);
+ (_x = tableElement.querySelector('tbody')) === null || _x === void 0 ? void 0 : _x.append(tableRowElement);
}
occupantsContainer.append(tableElement);
}
@@ -254,6 +257,7 @@ if (isCreate) {
if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment';
}
+ ;
formElement.querySelector('#lotOccupancy--occupantCommentTitle').textContent = occupantCommentTitle;
});
}
@@ -267,7 +271,7 @@ else {
let searchFormElement;
let searchResultsElement;
function addOccupant(formOrObject) {
- cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, (rawResponseJSON) => {
+ cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`, formOrObject, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
@@ -290,12 +294,12 @@ else {
}
let pastOccupantSearchResults = [];
function addOccupantFromCopy(clickEvent) {
+ var _a;
clickEvent.preventDefault();
const panelBlockElement = clickEvent.currentTarget;
const occupant = pastOccupantSearchResults[Number.parseInt(panelBlockElement.dataset.index, 10)];
- const lotOccupantTypeId = panelBlockElement
- .closest('.modal')
- .querySelector('#lotOccupancyOccupantCopy--lotOccupantTypeId').value;
+ const lotOccupantTypeId = ((_a = panelBlockElement
+ .closest('.modal')) === null || _a === void 0 ? void 0 : _a.querySelector('#lotOccupancyOccupantCopy--lotOccupantTypeId')).value;
if (lotOccupantTypeId === '') {
bulmaJS.alert({
title: `No ${los.escapedAliases.Occupant} Type Selected`,
@@ -312,16 +316,16 @@ else {
function searchOccupants(event) {
event.preventDefault();
if (searchFormElement.querySelector('#lotOccupancyOccupantCopy--searchFilter').value === '') {
- searchResultsElement.innerHTML =
- '' +
- '
Enter a partial name or address in the search field above.
' +
- '
';
+ searchResultsElement.innerHTML = `
+
Enter a partial name or address in the search field above.
+
`;
return;
}
+ // eslint-disable-next-line no-unsanitized/property
searchResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...');
- cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (rawResponseJSON) => {
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
+ cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doSearchPastOccupants`, searchFormElement, (rawResponseJSON) => {
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
const responseJSON = rawResponseJSON;
pastOccupantSearchResults = responseJSON.occupants;
const panelElement = document.createElement('div');
@@ -330,35 +334,27 @@ else {
const panelBlockElement = document.createElement('a');
panelBlockElement.className = 'panel-block is-block';
panelBlockElement.dataset.index = index.toString();
- panelBlockElement.innerHTML =
- '' +
- cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '') +
- ' ' +
- cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') +
- ' ' +
- ' ' +
- '' +
- ('
' +
- cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') +
- ' ' +
- (((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === ''
- ? ''
- : cityssm.escapeHTML(occupant.occupantAddress2) + ' ') +
- cityssm.escapeHTML((_e = occupant.occupantCity) !== null && _e !== void 0 ? _e : '') +
- ', ' +
- cityssm.escapeHTML((_f = occupant.occupantProvince) !== null && _f !== void 0 ? _f : '') +
- ' ' +
- cityssm.escapeHTML((_g = occupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') +
- '
') +
- ('
' +
- (((_h = occupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === ''
- ? ''
- : cityssm.escapeHTML(occupant.occupantPhoneNumber) +
- ' ') +
- cityssm.escapeHTML((_j = occupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') +
- ' ' +
- '
') +
- '
';
+ // eslint-disable-next-line no-unsanitized/property
+ panelBlockElement.innerHTML = `
+ ${cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '')} ${cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '')}
+
+
+
+ ${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((_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((_l = occupant.occupantEmailAddress) !== null && _l !== void 0 ? _l : '')}
+
+
`;
panelBlockElement.addEventListener('click', addOccupantFromCopy);
panelElement.append(panelBlockElement);
}
@@ -397,12 +393,13 @@ else {
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML =
- ` `;
+ ` `;
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment';
}
+ ;
modalElement.querySelector('#lotOccupancyOccupantAdd--occupantCommentTitle').textContent = occupantCommentTitle;
});
addFormElement = modalElement.querySelector('#form--lotOccupancyOccupantAdd');
diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts
index ffa0e34d..e20871a5 100644
--- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts
+++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts
@@ -112,69 +112,72 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
if (!lotOccupantTypeSelected) {
const optionElement = document.createElement('option')
- optionElement.value = lotOccupancyOccupant.lotOccupantTypeId!.toString()
- optionElement.textContent = lotOccupancyOccupant.lotOccupantType!
+ optionElement.value =
+ lotOccupancyOccupant.lotOccupantTypeId?.toString() ?? ''
+ optionElement.textContent = lotOccupancyOccupant.lotOccupantType ?? ''
optionElement.dataset.occupantCommentTitle =
- lotOccupancyOccupant.occupantCommentTitle!
+ lotOccupancyOccupant.occupantCommentTitle
optionElement.dataset.fontAwesomeIconClass =
- lotOccupancyOccupant.fontAwesomeIconClass!
+ lotOccupancyOccupant.fontAwesomeIconClass
optionElement.selected = true
lotOccupantTypeSelectElement.append(optionElement)
}
- modalElement.querySelector(
- '#lotOccupancyOccupantEdit--fontAwesomeIconClass'
- )!.innerHTML =
- ` `
+ ;(
+ modalElement.querySelector(
+ '#lotOccupancyOccupantEdit--fontAwesomeIconClass'
+ ) as HTMLElement
+ ).innerHTML =
+ ` `
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantName'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantName!
+ ).value = lotOccupancyOccupant.occupantName ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantFamilyName'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantFamilyName!
+ ).value = lotOccupancyOccupant.occupantFamilyName ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantAddress1'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantAddress1!
+ ).value = lotOccupancyOccupant.occupantAddress1 ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantAddress2'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantAddress2!
+ ).value = lotOccupancyOccupant.occupantAddress2 ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantCity'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantCity!
+ ).value = lotOccupancyOccupant.occupantCity ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantProvince'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantProvince!
+ ).value = lotOccupancyOccupant.occupantProvince ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantPostalCode'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantPostalCode!
+ ).value = lotOccupancyOccupant.occupantPostalCode ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantPhoneNumber'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantPhoneNumber!
+ ).value = lotOccupancyOccupant.occupantPhoneNumber ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantEmailAddress'
) as HTMLInputElement
- ).value = lotOccupancyOccupant.occupantEmailAddress!
+ ).value = lotOccupancyOccupant.occupantEmailAddress ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantCommentTitle'
@@ -182,12 +185,12 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
).textContent =
(lotOccupancyOccupant.occupantCommentTitle ?? '') === ''
? 'Comment'
- : lotOccupancyOccupant.occupantCommentTitle!
+ : lotOccupancyOccupant.occupantCommentTitle ?? ''
;(
modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantComment'
) as HTMLTextAreaElement
- ).value = lotOccupancyOccupant.occupantComment!
+ ).value = lotOccupancyOccupant.occupantComment ?? ''
},
onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped()
@@ -203,10 +206,12 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass ?? 'user'
- modalElement.querySelector(
- '#lotOccupancyOccupantEdit--fontAwesomeIconClass'
- )!.innerHTML =
- ` `
+ ;(
+ modalElement.querySelector(
+ '#lotOccupancyOccupantEdit--fontAwesomeIconClass'
+ ) as HTMLElement
+ ).innerHTML =
+ ` `
let occupantCommentTitle =
lotOccupantTypeIdElement.selectedOptions[0].dataset
@@ -222,7 +227,7 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
).textContent = occupantCommentTitle
})
- editFormElement = modalElement.querySelector('form')!
+ editFormElement = modalElement.querySelector('form') as HTMLFormElement
editFormElement.addEventListener('submit', editOccupant)
editCloseModalFunction = closeModalFunction
@@ -236,11 +241,11 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
function deleteLotOccupancyOccupant(clickEvent: Event): void {
const lotOccupantIndex = (clickEvent.currentTarget as HTMLElement).closest(
'tr'
- )!.dataset.lotOccupantIndex
+ )?.dataset.lotOccupantIndex
function doDelete(): void {
cityssm.postJSON(
- los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyOccupant',
+ `${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`,
{
lotOccupancyId,
lotOccupantIndex
@@ -257,7 +262,7 @@ function deleteLotOccupancyOccupant(clickEvent: Event): void {
renderLotOccupancyOccupants()
} else {
bulmaJS.alert({
- title: 'Error Removing ' + los.escapedAliases.Occupant,
+ title: `Error Removing ${los.escapedAliases.Occupant}`,
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
@@ -270,7 +275,7 @@ function deleteLotOccupancyOccupant(clickEvent: Event): void {
title: `Remove ${los.escapedAliases.Occupant}?`,
message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`,
okButton: {
- text: 'Yes, Remove ' + los.escapedAliases.Occupant,
+ text: `Yes, Remove ${los.escapedAliases.Occupant}`,
callbackFunction: doDelete
},
contextualColorName: 'warning'
@@ -285,6 +290,7 @@ function renderLotOccupancyOccupants(): void {
cityssm.clearElement(occupantsContainer)
if (lotOccupancyOccupants.length === 0) {
+ // eslint-disable-next-line no-unsanitized/property
occupantsContainer.innerHTML = `
There are no ${los.escapedAliases.occupants} associated with this record.
`
@@ -295,6 +301,7 @@ function renderLotOccupancyOccupants(): void {
const tableElement = document.createElement('table')
tableElement.className = 'table is-fullwidth is-striped is-hoverable'
+ // eslint-disable-next-line no-unsanitized/property
tableElement.innerHTML = `
${los.escapedAliases.Occupant}
Address
@@ -309,38 +316,38 @@ function renderLotOccupancyOccupants(): void {
tableRowElement.dataset.lotOccupantIndex =
lotOccupancyOccupant.lotOccupantIndex!.toString()
+ // eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML =
'' +
cityssm.escapeHTML(
(lotOccupancyOccupant.occupantName ?? '') === '' &&
(lotOccupancyOccupant.occupantFamilyName ?? '') === ''
? '(No Name)'
- : lotOccupancyOccupant.occupantName! +
- ' ' +
- lotOccupancyOccupant.occupantFamilyName!
+ : `${lotOccupancyOccupant.occupantName} ${lotOccupancyOccupant.occupantFamilyName}`
) +
' ' +
('' +
' ' +
' ' +
- cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType!) +
+ cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType ?? '') +
' ' +
' ') +
' ' +
('' +
((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 ?? '') +
@@ -348,18 +355,20 @@ function renderLotOccupancyOccupants(): void {
(' ' +
((lotOccupancyOccupant.occupantPhoneNumber ?? '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber!) +
+ : cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber ?? '') +
' ') +
((lotOccupancyOccupant.occupantEmailAddress ?? '') === ''
? ''
- : cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress!)) +
+ : cityssm.escapeHTML(
+ lotOccupancyOccupant.occupantEmailAddress ?? ''
+ )) +
' ') +
('' +
'' +
cityssm.escapeHTML(lotOccupancyOccupant.occupantComment ?? '') +
@@ -372,7 +381,7 @@ function renderLotOccupancyOccupants(): void {
' Edit ' +
'') +
('' +
' ' +
' ') +
@@ -380,14 +389,14 @@ function renderLotOccupancyOccupants(): void {
' ')
tableRowElement
- .querySelector('.button--edit')!
- .addEventListener('click', openEditLotOccupancyOccupant)
+ .querySelector('.button--edit')
+ ?.addEventListener('click', openEditLotOccupancyOccupant)
tableRowElement
- .querySelector('.button--delete')!
- .addEventListener('click', deleteLotOccupancyOccupant)
+ .querySelector('.button--delete')
+ ?.addEventListener('click', deleteLotOccupancyOccupant)
- tableElement.querySelector('tbody')!.append(tableRowElement)
+ tableElement.querySelector('tbody')?.append(tableRowElement)
}
occupantsContainer.append(tableElement)
@@ -413,9 +422,11 @@ if (isCreate) {
occupantCommentTitle = 'Comment'
}
- formElement.querySelector(
- '#lotOccupancy--occupantCommentTitle'
- )!.textContent = occupantCommentTitle
+ ;(
+ formElement.querySelector(
+ '#lotOccupancy--occupantCommentTitle'
+ ) as HTMLElement
+ ).textContent = occupantCommentTitle
})
} else {
renderLotOccupancyOccupants()
@@ -435,17 +446,17 @@ document
formOrObject: HTMLFormElement | recordTypes.LotOccupancyOccupant
): void {
cityssm.postJSON(
- los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant',
+ `${los.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`,
formOrObject,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
- lotOccupancyOccupants?: recordTypes.LotOccupancyOccupant[]
+ lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[]
}
if (responseJSON.success) {
- lotOccupancyOccupants = responseJSON.lotOccupancyOccupants!
+ lotOccupancyOccupants = responseJSON.lotOccupancyOccupants
addCloseModalFunction()
renderLotOccupancyOccupants()
} else {
@@ -478,8 +489,8 @@ document
const lotOccupantTypeId = (
panelBlockElement
- .closest('.modal')!
- .querySelector(
+ .closest('.modal')
+ ?.querySelector(
'#lotOccupancyOccupantCopy--lotOccupantTypeId'
) as HTMLSelectElement
).value
@@ -507,19 +518,19 @@ document
) as HTMLInputElement
).value === ''
) {
- searchResultsElement.innerHTML =
- '' +
- '
Enter a partial name or address in the search field above.
' +
- '
'
+ searchResultsElement.innerHTML = `
+
Enter a partial name or address in the search field above.
+
`
return
}
+ // eslint-disable-next-line no-unsanitized/property
searchResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...')
cityssm.postJSON(
- los.urlPrefix + '/lotOccupancies/doSearchPastOccupants',
+ `${los.urlPrefix}/lotOccupancies/doSearchPastOccupants`,
searchFormElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
@@ -536,35 +547,31 @@ document
panelBlockElement.className = 'panel-block is-block'
panelBlockElement.dataset.index = index.toString()
- panelBlockElement.innerHTML =
- '' +
- cityssm.escapeHTML(occupant.occupantName ?? '') +
- ' ' +
- cityssm.escapeHTML(occupant.occupantFamilyName ?? '') +
- ' ' +
- ' ' +
- '' +
- ('
' +
- cityssm.escapeHTML(occupant.occupantAddress1 ?? '') +
- ' ' +
- ((occupant.occupantAddress2 ?? '') === ''
- ? ''
- : cityssm.escapeHTML(occupant.occupantAddress2!) + ' ') +
- cityssm.escapeHTML(occupant.occupantCity ?? '') +
- ', ' +
- cityssm.escapeHTML(occupant.occupantProvince ?? '') +
- ' ' +
- cityssm.escapeHTML(occupant.occupantPostalCode ?? '') +
- '
') +
- ('
' +
- ((occupant.occupantPhoneNumber ?? '') === ''
- ? ''
- : cityssm.escapeHTML(occupant.occupantPhoneNumber!) +
- ' ') +
- cityssm.escapeHTML(occupant.occupantEmailAddress ?? '') +
- ' ' +
- '
') +
- '
'
+ // eslint-disable-next-line no-unsanitized/property
+ panelBlockElement.innerHTML = `
+ ${cityssm.escapeHTML(occupant.occupantName ?? '')} ${cityssm.escapeHTML(occupant.occupantFamilyName ?? '')}
+
+
+
+ ${cityssm.escapeHTML(occupant.occupantAddress1 ?? '')}
+ ${
+ (occupant.occupantAddress2 ?? '') === ''
+ ? ''
+ : cityssm.escapeHTML(occupant.occupantAddress2 ?? '') +
+ ' '
+ }${cityssm.escapeHTML(occupant.occupantCity ?? '')}, ${cityssm.escapeHTML(occupant.occupantProvince ?? '')}
+ ${cityssm.escapeHTML(occupant.occupantPostalCode ?? '')}
+
+
+ ${
+ (occupant.occupantPhoneNumber ?? '') === ''
+ ? ''
+ : cityssm.escapeHTML(occupant.occupantPhoneNumber ?? '') +
+ ' '
+ }
+ ${cityssm.escapeHTML(occupant.occupantEmailAddress ?? '')}
+
+
`
panelBlockElement.addEventListener('click', addOccupantFromCopy)
@@ -614,12 +621,12 @@ document
modalElement.querySelector(
'#lotOccupancyOccupantAdd--occupantCity'
) as HTMLInputElement
- ).value = exports.occupantCityDefault
+ ).value = exports.occupantCityDefault as string
;(
modalElement.querySelector(
'#lotOccupancyOccupantAdd--occupantProvince'
) as HTMLInputElement
- ).value = exports.occupantProvinceDefault
+ ).value = exports.occupantProvinceDefault as string
},
onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped()
@@ -636,10 +643,10 @@ document
lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass ?? 'user'
- modalElement.querySelector(
+ ;(modalElement.querySelector(
'#lotOccupancyOccupantAdd--fontAwesomeIconClass'
- )!.innerHTML =
- ` `
+ ) as HTMLElement).innerHTML =
+ ` `
let occupantCommentTitle =
lotOccupantTypeIdElement.selectedOptions[0].dataset
@@ -649,9 +656,9 @@ document
occupantCommentTitle = 'Comment'
}
- modalElement.querySelector(
+ ;(modalElement.querySelector(
'#lotOccupancyOccupantAdd--occupantCommentTitle'
- )!.textContent = occupantCommentTitle
+ ) as HTMLElement).textContent = occupantCommentTitle
})
addFormElement = modalElement.querySelector(
diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js
index c30b68e7..4d471489 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,s=document.querySelector("#lotOccupancy--lotOccupancyId").value,l=""===s;let r=l;function i(){var e;a.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.remove("is-light")}function u(){var e;a.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.add("is-light")}const d=document.querySelector("#form--lotOccupancy");d.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/${l?"doCreateLotOccupancy":"doUpdateLotOccupancy"}`,d,e=>{var t;const n=e;n.success?(u(),l||r?window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Saving ${a.escapedAliases.Occupancy}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const p=d.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",i);function m(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,{lotOccupancyId:s},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(S=document.querySelector("#button--copyLotOccupancy"))||void 0===S||S.addEventListener("click",e=>{e.preventDefault(),a.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${a.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:m}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${a.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`,{lotOccupancyId:s},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function n(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/workOrders/doCreateWorkOrder`,e.currentTarget,e=>{const n=e;n.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(n.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:n.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=s,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const n=e.querySelector("#workOrderCreate--workOrderTypeId"),c=exports.workOrderTypes;1===c.length&&(n.innerHTML="");for(const e of c){const c=document.createElement("option");c.value=e.workOrderTypeId.toString(),c.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",n.append(c)}},onshown(e,c){var o;t=c,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",n)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const y=document.querySelector("#lotOccupancy--occupancyTypeId");if(l){const e=document.querySelector("#container--lotOccupancyFields");y.addEventListener("change",()=>{""!==y.value?cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetOccupancyTypeFields",{occupancyTypeId:y.value},t=>{var n,c;const o=t;if(0===o.occupancyTypeFields.length)return void(e.innerHTML=`\n
There are no additional fields for this ${a.escapedAliases.occupancy} type.
\n
`);e.innerHTML="";let s="";for(const t of o.occupancyTypeFields){s+=","+t.occupancyTypeFieldId.toString();const o=`lotOccupancyFieldValue_${t.occupancyTypeFieldId.toString()}`,a=`lotOccupancy--${o}`,l=document.createElement("div");if(l.className="field",l.innerHTML=`
`,l.querySelector("label").textContent=t.occupancyTypeField,""===(null!==(n=t.occupancyTypeFieldValues)&&void 0!==n?n:"")){const e=document.createElement("input");e.className="input",e.id=a,e.name=o,e.type="text",e.required=t.isRequired,e.minLength=t.minimumLength,e.maxLength=t.maximumLength,""!==(null!==(c=t.pattern)&&void 0!==c?c:"")&&(e.pattern=t.pattern),l.querySelector(".control").append(e)}else{l.querySelector(".control").innerHTML=`\n \n (Not Set) \n \n
`;const e=l.querySelector("select");e.required=t.isRequired;const n=t.occupancyTypeFieldValues.split("\n");for(const t of n){const n=document.createElement("option");n.value=t,n.textContent=t,e.append(n)}}console.log(l),e.append(l)}e.insertAdjacentHTML("beforeend",` `)}):e.innerHTML=`\n
Select the ${a.escapedAliases.occupancy} type to load the available fields.
\n
`})}else{const e=y.value;y.addEventListener("change",()=>{y.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${a.escapedAliases.occupancy} type?\n\n This change affects the additional fields associated with this record, and may also affect the available fees.`,contextualColorName:"warning",okButton:{text:"Yes, Keep the Change",callbackFunction:()=>{r=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{y.value=e}}})})}const v=document.querySelector("#lotOccupancy--lotName");v.addEventListener("click",e=>{const t=e.currentTarget.value;let n,c,o,s;function l(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,i(),n()}function r(e){var t,n;e.preventDefault();const c=e.currentTarget;l(null!==(t=c.dataset.lotId)&&void 0!==t?t:"",null!==(n=c.dataset.lotName)&&void 0!==n?n:"")}function u(){s.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(`${a.urlPrefix}/lots/doSearchLots`,o,e=>{var t,n;const c=e;if(0===c.count)return void(s.innerHTML='');const o=document.createElement("div");o.className="panel";for(const e of c.lots){const c=document.createElement("a");c.className="panel-block is-block",c.href="#",c.dataset.lotId=e.lotId.toString(),c.dataset.lotName=e.lotName,c.innerHTML=`\n
\n ${cityssm.escapeHTML(null!==(t=e.lotName)&&void 0!==t?t:"")} \n ${cityssm.escapeHTML(null!==(n=e.mapName)&&void 0!==n?n:"")} \n
\n
\n ${cityssm.escapeHTML(e.lotStatus)} \n \n ${e.lotOccupancyCount>0?"Currently Occupied":""}\n \n
\n
`,c.addEventListener("click",r),o.append(c)}s.innerHTML="",s.append(o)})}function d(e){e.preventDefault();const t=c.querySelector("#lotCreate--lotName").value;cityssm.postJSON(`${a.urlPrefix}/lots/doCreateLot`,e.currentTarget,e=>{var n;const c=e;c.success?l(c.lotId,t):bulmaJS.alert({title:`Error Creating ${a.escapedAliases.Lot}`,message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-selectLot",{onshow(e){a.populateAliases(e)},onshown(e,a){var l;bulmaJS.toggleHtmlClipped(),c=e,n=a,bulmaJS.init(e);const r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const i=e.querySelector("#lotSelect--occupancyStatus");if(i.addEventListener("change",u),""!==t&&(i.value=""),o=e.querySelector("#form--lotSelect"),s=e.querySelector("#resultsContainer--lotSelect"),o.addEventListener("submit",e=>{e.preventDefault()}),u(),exports.lotNamePattern){const t=exports.lotNamePattern;e.querySelector("#lotCreate--lotName").pattern=t.source}const p=e.querySelector("#lotCreate--lotTypeId");for(const e of exports.lotTypes){const t=document.createElement("option");t.value=e.lotTypeId.toString(),t.textContent=e.lotType,p.append(t)}const m=e.querySelector("#lotCreate--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,m.append(t)}const y=e.querySelector("#lotCreate--mapId");for(const e of exports.maps){const t=document.createElement("option");t.value=e.mapId.toString(),t.textContent=""===(null!==(l=e.mapName)&&void 0!==l?l:"")?"(No Name)":e.mapName,y.append(t)}e.querySelector("#form--lotCreate").addEventListener("submit",d)},onremoved(){bulmaJS.toggleHtmlClipped()}})}),null===(n=document.querySelector(".is-lot-view-button"))||void 0===n||n.addEventListener("click",()=>{const e=document.querySelector("#lotOccupancy--lotId").value;""===e?bulmaJS.alert({message:`No ${a.escapedAliases.lot} selected.`,contextualColorName:"info"}):window.open(a.urlPrefix+"/lots/"+e)}),null===(c=document.querySelector(".is-clear-lot-button"))||void 0===c||c.addEventListener("click",()=>{v.disabled?bulmaJS.alert({message:"You need to unlock the field before clearing it.",contextualColorName:"info"}):(v.value=`(No ${a.escapedAliases.Lot})`,document.querySelector("#lotOccupancy--lotId").value="",i())}),a.initializeDatePickers(d),null===(o=document.querySelector("#lotOccupancy--occupancyStartDateString"))||void 0===o||o.addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),a.initializeUnlockFieldButtons(d),Object.defineProperty(exports,"__esModule",{value:!0});let f=exports.lotOccupancyOccupants;function O(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotOccupantIndex)&&void 0!==n?n:"",10),o=f.find(e=>e.lotOccupantIndex===c);let l,r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`,l,e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,r(),h()):bulmaJS.alert({title:`Error Updating ${a.escapedAliases.Occupant}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow(e){var t;a.populateAliases(e),e.querySelector("#lotOccupancyOccupantEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyOccupantEdit--lotOccupantIndex").value=c.toString();const n=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");let l=!1;for(const e of exports.lotOccupantTypes){const t=document.createElement("option");t.value=e.lotOccupantTypeId.toString(),t.textContent=e.lotOccupantType,t.dataset.occupantCommentTitle=e.occupantCommentTitle,t.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,e.lotOccupantTypeId===o.lotOccupantTypeId&&(t.selected=!0,l=!0),n.append(t)}if(!l){const e=document.createElement("option");e.value=o.lotOccupantTypeId.toString(),e.textContent=o.lotOccupantType,e.dataset.occupantCommentTitle=o.occupantCommentTitle,e.dataset.fontAwesomeIconClass=o.fontAwesomeIconClass,e.selected=!0,n.append(e)}e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=` `,e.querySelector("#lotOccupancyOccupantEdit--occupantName").value=o.occupantName,e.querySelector("#lotOccupancyOccupantEdit--occupantFamilyName").value=o.occupantFamilyName,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress1").value=o.occupantAddress1,e.querySelector("#lotOccupancyOccupantEdit--occupantAddress2").value=o.occupantAddress2,e.querySelector("#lotOccupancyOccupantEdit--occupantCity").value=o.occupantCity,e.querySelector("#lotOccupancyOccupantEdit--occupantProvince").value=o.occupantProvince,e.querySelector("#lotOccupancyOccupantEdit--occupantPostalCode").value=o.occupantPostalCode,e.querySelector("#lotOccupancyOccupantEdit--occupantPhoneNumber").value=o.occupantPhoneNumber,e.querySelector("#lotOccupancyOccupantEdit--occupantEmailAddress").value=o.occupantEmailAddress,e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=""===(null!==(t=o.occupantCommentTitle)&&void 0!==t?t:"")?"Comment":o.occupantCommentTitle,e.querySelector("#lotOccupancyOccupantEdit--occupantComment").value=o.occupantComment},onshown(e,t){bulmaJS.toggleHtmlClipped();const n=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");n.focus(),n.addEventListener("change",()=>{var t,c;const o=null!==(t=n.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==t?t:"user";e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=` `;let a=null!==(c=n.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==c?c:"";""===a&&(a="Comment"),e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=a}),(l=e.querySelector("form")).addEventListener("submit",i),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function g(e){const t=e.currentTarget.closest("tr").dataset.lotOccupantIndex;bulmaJS.confirm({title:`Remove ${a.escapedAliases.Occupant}?`,message:`Are you sure you want to remove this ${a.escapedAliases.occupant}?`,okButton:{text:"Yes, Remove "+a.escapedAliases.Occupant,callbackFunction:function(){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doDeleteLotOccupancyOccupant",{lotOccupancyId:s,lotOccupantIndex:t},e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,h()):bulmaJS.alert({title:"Error Removing "+a.escapedAliases.Occupant,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function h(){var e,t,n,c,o,s,l,r,i,u,d;const p=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(p),0===f.length)return void(p.innerHTML=`\n
There are no ${a.escapedAliases.occupants} associated with this record.
\n
`);const m=document.createElement("table");m.className="table is-fullwidth is-striped is-hoverable",m.innerHTML=`\n ${a.escapedAliases.Occupant} \n Address \n Other Contact \n Comment \n Options \n \n `;for(const a of f){const p=document.createElement("tr");p.dataset.lotOccupantIndex=a.lotOccupantIndex.toString(),p.innerHTML=""+cityssm.escapeHTML(""===(null!==(e=a.occupantName)&&void 0!==e?e:"")&&""===(null!==(t=a.occupantFamilyName)&&void 0!==t?t:"")?"(No Name)":a.occupantName+" "+a.occupantFamilyName)+' '+cityssm.escapeHTML(a.lotOccupantType)+" "+(""===(null!==(n=a.occupantAddress1)&&void 0!==n?n:"")?"":cityssm.escapeHTML(a.occupantAddress1)+" ")+(""===(null!==(c=a.occupantAddress2)&&void 0!==c?c:"")?"":cityssm.escapeHTML(a.occupantAddress2)+" ")+(""===(null!==(o=a.occupantCity)&&void 0!==o?o:"")?"":cityssm.escapeHTML(a.occupantCity)+", ")+cityssm.escapeHTML(null!==(s=a.occupantProvince)&&void 0!==s?s:"")+" "+cityssm.escapeHTML(null!==(l=a.occupantPostalCode)&&void 0!==l?l:"")+" "+(""===(null!==(r=a.occupantPhoneNumber)&&void 0!==r?r:"")?"":cityssm.escapeHTML(a.occupantPhoneNumber)+" ")+(""===(null!==(i=a.occupantEmailAddress)&&void 0!==i?i:"")?"":cityssm.escapeHTML(a.occupantEmailAddress))+' '+cityssm.escapeHTML(null!==(d=a.occupantComment)&&void 0!==d?d:"")+' Edit
',p.querySelector(".button--edit").addEventListener("click",O),p.querySelector(".button--delete").addEventListener("click",g),m.querySelector("tbody").append(p)}p.append(m)}if(delete exports.lotOccupancyOccupants,l){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{var t;const n=d.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const t of n)t.disabled=""===e.value;let c=null!==(t=e.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),d.querySelector("#lotOccupancy--occupantCommentTitle").textContent=c})}else h();if(null===(S=document.querySelector("#button--addOccupant"))||void 0===S||S.addEventListener("click",()=>{let e,t,n,c;function o(t){cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doAddLotOccupancyOccupant",t,t=>{var n;const c=t;c.success?(f=c.lotOccupancyOccupants,e(),h()):bulmaJS.alert({title:`Error Adding ${a.escapedAliases.Occupant}`,message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function l(e){e.preventDefault(),o(t)}let r=[];function i(e){e.preventDefault();const t=e.currentTarget,n=r[Number.parseInt(t.dataset.index,10)],c=t.closest(".modal").querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId").value;""===c?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(n.lotOccupantTypeId=Number.parseInt(c,10),n.lotOccupancyId=Number.parseInt(s,10),o(n))}function u(e){e.preventDefault(),""!==n.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(c.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doSearchPastOccupants",n,e=>{var t,n,o,a,s,l,u,d,p;r=e.occupants;const m=document.createElement("div");m.className="panel";for(const[e,c]of r.entries()){const r=document.createElement("a");r.className="panel-block is-block",r.dataset.index=e.toString(),r.innerHTML=""+cityssm.escapeHTML(null!==(t=c.occupantName)&&void 0!==t?t:"")+" "+cityssm.escapeHTML(null!==(n=c.occupantFamilyName)&&void 0!==n?n:"")+' '+cityssm.escapeHTML(null!==(o=c.occupantAddress1)&&void 0!==o?o:"")+" "+(""===(null!==(a=c.occupantAddress2)&&void 0!==a?a:"")?"":cityssm.escapeHTML(c.occupantAddress2)+" ")+cityssm.escapeHTML(null!==(s=c.occupantCity)&&void 0!==s?s:"")+", "+cityssm.escapeHTML(null!==(l=c.occupantProvince)&&void 0!==l?l:"")+" "+cityssm.escapeHTML(null!==(u=c.occupantPostalCode)&&void 0!==u?u:"")+'
'+(""===(null!==(d=c.occupantPhoneNumber)&&void 0!==d?d:"")?"":cityssm.escapeHTML(c.occupantPhoneNumber)+" ")+cityssm.escapeHTML(null!==(p=c.occupantEmailAddress)&&void 0!==p?p:"")+"
",r.addEventListener("click",i),m.append(r)}c.innerHTML="",c.append(m)})):c.innerHTML='Enter a partial name or address in the search field above.
'}cityssm.openHtmlModal("lotOccupancy-addOccupant",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyOccupantAdd--lotOccupancyId").value=s;const t=e.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId"),n=e.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId");for(const e of exports.lotOccupantTypes){const c=document.createElement("option");c.value=e.lotOccupantTypeId.toString(),c.textContent=e.lotOccupantType,c.dataset.occupantCommentTitle=e.occupantCommentTitle,c.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,t.append(c),n.append(c.cloneNode(!0))}e.querySelector("#lotOccupancyOccupantAdd--occupantCity").value=exports.occupantCityDefault,e.querySelector("#lotOccupancyOccupantAdd--occupantProvince").value=exports.occupantProvinceDefault},onshown(o,a){bulmaJS.toggleHtmlClipped(),bulmaJS.init(o);const s=o.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId");s.focus(),s.addEventListener("change",()=>{var e,t;const n=null!==(e=s.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==e?e:"user";o.querySelector("#lotOccupancyOccupantAdd--fontAwesomeIconClass").innerHTML=` `;let c=null!==(t=s.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),o.querySelector("#lotOccupancyOccupantAdd--occupantCommentTitle").textContent=c}),(t=o.querySelector("#form--lotOccupancyOccupantAdd")).addEventListener("submit",l),c=o.querySelector("#lotOccupancyOccupantCopy--searchResults"),(n=o.querySelector("#form--lotOccupancyOccupantCopy")).addEventListener("submit",e=>{e.preventDefault()}),o.querySelector("#lotOccupancyOccupantCopy--searchFilter").addEventListener("change",u),e=a},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addOccupant").focus()}})}),!l){var S;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.lotOccupancyComments;function b(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10),l=e.find(e=>e.lotOccupancyCommentId===o);let r,i;function u(t){t.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyComment`,r,t=>{var n,c;const o=t;o.success?(e=null!==(n=o.lotOccupancyComments)&&void 0!==n?n:[],i(),T()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editComment",{onshow(e){var t,n,c,r;a.populateAliases(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value=o.toString(),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value=null!==(t=l.lotOccupancyComment)&&void 0!==t?t:"";const i=e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");i.value=null!==(n=l.lotOccupancyCommentDateString)&&void 0!==n?n:"";const u=cityssm.dateToString(new Date);i.max=l.lotOccupancyCommentDateString<=u?u:null!==(c=l.lotOccupancyCommentDateString)&&void 0!==c?c:"",e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value=null!==(r=l.lotOccupancyCommentTimeString)&&void 0!==r?r:""},onshown(e,t){bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus(),(r=e.querySelector("form")).addEventListener("submit",u),i=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function C(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyComment`,{lotOccupancyId:s,lotOccupancyCommentId:o},t=>{var n;const c=t;c.success?(e=c.lotOccupancyComments,T()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function T(){var t,n,c,o,a,s,l,r;const i=document.querySelector("#container--lotOccupancyComments");if(0===e.length)return void(i.innerHTML='\n
There are no comments associated with this record.
\n
');const u=document.createElement("table");u.className="table is-fullwidth is-striped is-hoverable",u.innerHTML='\n Commentor \n Comment Date \n Comment \n Options \n \n ';for(const i of e){const e=document.createElement("tr");e.dataset.lotOccupancyCommentId=null===(t=i.lotOccupancyCommentId)||void 0===t?void 0:t.toString(),e.innerHTML=`${cityssm.escapeHTML(null!==(n=i.recordCreate_userName)&&void 0!==n?n:"")} \n \n ${cityssm.escapeHTML(null!==(c=i.lotOccupancyCommentDateString)&&void 0!==c?c:"")}\n ${cityssm.escapeHTML(0===i.lotOccupancyCommentTime?"":null!==(o=i.lotOccupancyCommentTimePeriodString)&&void 0!==o?o:"")}\n \n ${cityssm.escapeHTML(null!==(a=i.lotOccupancyComment)&&void 0!==a?a:"")} \n \n \n \n \n Edit \n \n \n \n \n
\n `,null===(s=e.querySelector(".button--edit"))||void 0===s||s.addEventListener("click",b),null===(l=e.querySelector(".button--delete"))||void 0===l||l.addEventListener("click",C),null===(r=u.querySelector("tbody"))||void 0===r||r.append(e)}i.innerHTML="",i.append(u)}delete exports.lotOccupancyComments,null===(S=document.querySelector("#button--addComment"))||void 0===S||S.addEventListener("click",()=>{let t,n;function c(c){c.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyComment`,t,t=>{var c;const o=t;o.success?(e=o.lotOccupancyComments,n(),T()):bulmaJS.alert({title:"Error Adding Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addComment",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyId").value=s},onshown(e,o){bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyComment").focus(),(t=e.querySelector("form")).addEventListener("submit",c),n=o},onremoved:()=>{bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addComment").focus()}})}),T(),Object.defineProperty(exports,"__esModule",{value:!0});let t=exports.lotOccupancyFees;delete exports.lotOccupancyFees;const n=document.querySelector("#container--lotOccupancyFees");function x(){let e=0;for(const n of t)e+=(n.feeAmount+n.taxAmount)*n.quantity;return e}function L(e){var n,c;const o=Number.parseInt(null!==(c=null===(n=e.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.feeId)&&void 0!==c?c:"",10),l=t.find(e=>e.feeId===o);let r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`,e.currentTarget,e=>{const n=e;n.success?(t=n.lotOccupancyFees,N(),r()):bulmaJS.alert({title:"Error Updating Quantity",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editFeeQuantity",{onshow(e){var t,n;e.querySelector("#lotOccupancyFeeQuantity--lotOccupancyId").value=s,e.querySelector("#lotOccupancyFeeQuantity--feeId").value=l.feeId.toString(),e.querySelector("#lotOccupancyFeeQuantity--quantity").valueAsNumber=null!==(t=l.quantity)&&void 0!==t?t:0,e.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=null!==(n=l.quantityUnit)&&void 0!==n?n:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),r=t,e.querySelector("#lotOccupancyFeeQuantity--quantity").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",i)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function q(e){const n=e.currentTarget.closest(".container--lotOccupancyFee").dataset.feeId;bulmaJS.confirm({title:"Delete Fee",message:"Are you sure you want to delete this fee?",contextualColorName:"warning",okButton:{text:"Yes, Delete Fee",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`,{lotOccupancyId:s,feeId:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N()):bulmaJS.alert({title:"Error Deleting Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}}})}function N(){var e,c,o,a,s,l,r,i,u;if(0===t.length)return n.innerHTML='\n
There are no fees associated with this record.
\n
',void I();n.innerHTML='\n \n Fee \n Unit Cost \n × \n Quantity \n equals \n Total \n Options \n \n \n \n Subtotal \n \n \n \n Tax \n \n \n \n Grand Total \n \n \n
';let d=0,p=0;for(const m of t){const t=document.createElement("tr");t.className="container--lotOccupancyFee",t.dataset.feeId=m.feeId.toString(),t.dataset.includeQuantity=null!==(e=m.includeQuantity)&&void 0!==e&&e?"1":"0",t.innerHTML=`\n ${cityssm.escapeHTML(null!==(c=m.feeName)&&void 0!==c?c:"")} \n ${cityssm.escapeHTML(null!==(o=m.feeCategory)&&void 0!==o?o:"")} \n \n ${1===m.quantity?"":`\n $${null===(a=m.feeAmount)||void 0===a?void 0:a.toFixed(2)}\n \n × \n ${null===(s=m.quantity)||void 0===s?void 0:s.toString()} \n = `}\n \n $${(m.feeAmount*m.quantity).toFixed(2)}\n \n \n \n ${null!==(l=m.includeQuantity)&&void 0!==l&&l?'\n \n Edit \n ':""}\n \n \n \n
\n `,null===(r=t.querySelector(".button--editQuantity"))||void 0===r||r.addEventListener("click",L),null===(i=t.querySelector(".button--delete"))||void 0===i||i.addEventListener("click",q),null===(u=n.querySelector("tbody"))||void 0===u||u.append(t),d+=m.feeAmount*m.quantity,p+=m.taxAmount*m.quantity}n.querySelector("#lotOccupancyFees--feeAmountTotal").textContent="$"+d.toFixed(2),n.querySelector("#lotOccupancyFees--taxAmountTotal").textContent="$"+p.toFixed(2),n.querySelector("#lotOccupancyFees--grandTotal").textContent="$"+(d+p).toFixed(2),I()}const c=document.querySelector("#button--addFee");c.addEventListener("click",()=>{if(a.hasUnsavedChanges())return void bulmaJS.alert({message:"Please save all unsaved changes before adding fees.",contextualColorName:"warning"});let e,o,l;function r(e,n=1){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`,{lotOccupancyId:s,feeId:e,quantity:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N(),u()):bulmaJS.alert({title:"Error Adding Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function i(t){var n,c,o;t.preventDefault();const a=Number.parseInt(null!==(n=t.currentTarget.dataset.feeId)&&void 0!==n?n:"",10),s=Number.parseInt(null!==(c=t.currentTarget.dataset.feeCategoryId)&&void 0!==c?c:"",10),l=e.find(e=>e.feeCategoryId===s).fees.find(e=>e.feeId===a);null!==(o=l.includeQuantity)&&void 0!==o&&o?function(e){let t,n;function c(c){c.preventDefault(),r(e.feeId,t.value),n()}cityssm.openHtmlModal("lotOccupancy-setFeeQuantity",{onshow(t){var n;t.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=null!==(n=e.quantityUnit)&&void 0!==n?n:""},onshown(e,o){var a;n=o,t=e.querySelector("#lotOccupancyFeeQuantity--quantity"),null===(a=e.querySelector("form"))||void 0===a||a.addEventListener("submit",c)}})}(l):r(a)}function u(){var t,c,a,s,r,u;const d=o.value.trim().toLowerCase().split(" ");l.innerHTML="";for(const o of e){const e=document.createElement("div");e.className="container--feeCategory",e.dataset.feeCategoryId=o.feeCategoryId.toString(),e.innerHTML=`${cityssm.escapeHTML(null!==(t=o.feeCategory)&&void 0!==t?t:"")} \n
`;let p=!1;for(const t of o.fees){if(null!==n.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let l=!0;const m=`${null!==(c=o.feeCategory)&&void 0!==c?c:""} ${null!==(a=t.feeName)&&void 0!==a?a:""} ${null!==(s=t.feeDescription)&&void 0!==s?s:""}`.toLowerCase();for(const e of d)if(!m.includes(e)){l=!1;break}if(!l)continue;p=!0;const y=document.createElement("a");y.className="panel-block is-block container--fee",y.dataset.feeId=t.feeId.toString(),y.dataset.feeCategoryId=o.feeCategoryId.toString(),y.href="#",y.innerHTML=`${cityssm.escapeHTML(null!==(r=t.feeName)&&void 0!==r?r:"")} \n \n ${cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replaceAll("\n"," ")}\n `,y.addEventListener("click",i),e.querySelector(".panel").append(y)}p&&l.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){o=t.querySelector("#feeSelect--feeName"),l=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetFees`,{lotOccupancyId:s},t=>{e=t.feeCategories,o.disabled=!1,o.addEventListener("keyup",u),o.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){N()},onremoved(){bulmaJS.toggleHtmlClipped(),c.focus()}})});let o=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const l=document.querySelector("#container--lotOccupancyTransactions");function E(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.transactionIndex)&&void 0!==n?n:"",10),l=o.find(e=>e.transactionIndex===c);let r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`,e.currentTarget,e=>{const t=e;t.success?(o=t.lotOccupancyTransactions,I(),r()):bulmaJS.alert({title:"Error Updating Transaction",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editTransaction",{onshow(e){var t,n,c,o,r,i;a.populateAliases(e),e.querySelector("#lotOccupancyTransactionEdit--lotOccupancyId").value=s,e.querySelector("#lotOccupancyTransactionEdit--transactionIndex").value=null!==(n=null===(t=l.transactionIndex)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").value=l.transactionAmount.toFixed(2),e.querySelector("#lotOccupancyTransactionEdit--externalReceiptNumber").value=null!==(c=l.externalReceiptNumber)&&void 0!==c?c:"",e.querySelector("#lotOccupancyTransactionEdit--transactionNote").value=null!==(o=l.transactionNote)&&void 0!==o?o:"",e.querySelector("#lotOccupancyTransactionEdit--transactionDateString").value=null!==(r=l.transactionDateString)&&void 0!==r?r:"",e.querySelector("#lotOccupancyTransactionEdit--transactionTimeString").value=null!==(i=l.transactionTimeString)&&void 0!==i?i:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",i),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function M(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`,{lotOccupancyId:s,transactionIndex:t},e=>{var t;const n=e;n.success?(o=n.lotOccupancyTransactions,I()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function I(){var e,n,c,s,r,i,u;if(0===o.length)return void(l.innerHTML=`\n
There are no transactions associated with this record.
\n
`);l.innerHTML=`\n \n Date \n ${a.escapedAliases.ExternalReceiptNumber} \n Amount \n Options \n \n \n \n Transaction Total \n \n \n \n
`;let d=0;for(const t of o){d+=t.transactionAmount;const o=document.createElement("tr");o.className="container--lotOccupancyTransaction",o.dataset.transactionIndex=null===(e=t.transactionIndex)||void 0===e?void 0:e.toString();let p="";""!==t.externalReceiptNumber&&(p=cityssm.escapeHTML(null!==(n=t.externalReceiptNumber)&&void 0!==n?n:""),a.dynamicsGPIntegrationIsEnabled&&(void 0===t.dynamicsGPDocument?p+=' \n \n ':t.dynamicsGPDocument.documentTotal.toFixed(2)===t.transactionAmount.toFixed(2)?p+=' \n \n ':p+=` \n \n `),p+=" "),o.innerHTML=`\n ${cityssm.escapeHTML(null!==(c=t.transactionDateString)&&void 0!==c?c:"")}\n \n \n ${p}\n ${cityssm.escapeHTML(null!==(s=t.transactionNote)&&void 0!==s?s:"")} \n \n \n $${cityssm.escapeHTML(t.transactionAmount.toFixed(2))}\n \n \n \n \n \n Edit \n \n \n \n \n
\n `,null===(r=o.querySelector(".button--edit"))||void 0===r||r.addEventListener("click",E),null===(i=o.querySelector(".button--delete"))||void 0===i||i.addEventListener("click",M),null===(u=l.querySelector("tbody"))||void 0===u||u.append(o)}l.querySelector("#lotOccupancyTransactions--grandTotal").textContent="$"+d.toFixed(2);const p=x();p.toFixed(2)!==d.toFixed(2)&&l.insertAdjacentHTML("afterbegin",`\n
\n
\n
\n
\n
$${cityssm.escapeHTML((p-d).toFixed(2))}
\n
\n
\n
`)}const r=document.querySelector("#button--addTransaction");r.addEventListener("click",()=>{let e,t,n;function c(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`,e.currentTarget,e=>{var t;const c=e;c.success?(o=c.lotOccupancyTransactions,n(),I()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function l(){var n,c;const o=t.value,s=null===(n=t.closest(".control"))||void 0===n?void 0:n.querySelector(".icon"),l=null===(c=t.closest(".field"))||void 0===c?void 0:c.querySelector(".help");if(""===o)return l.innerHTML=" ",void(s.innerHTML=' ');cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`,{externalReceiptNumber:o},t=>{const n=t;n.success&&void 0!==n.dynamicsGPDocument?e.valueAsNumber===n.dynamicsGPDocument.documentTotal?(l.textContent="Matching Document Found",s.innerHTML=' '):(l.textContent="Matching Document: $"+n.dynamicsGPDocument.documentTotal.toFixed(2),s.innerHTML=' '):(l.textContent="No Matching Document Found",s.innerHTML=' ')})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow(n){a.populateAliases(n),n.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=s.toString();const c=x(),r=function(){let e=0;for(const t of o)e+=t.transactionAmount;return e}();if((e=n.querySelector("#lotOccupancyTransactionAdd--transactionAmount")).min=(-1*r).toFixed(2),e.max=Math.max(c-r,0).toFixed(2),e.value=Math.max(c-r,0).toFixed(2),a.dynamicsGPIntegrationIsEnabled){const c=(t=n.querySelector("#lotOccupancyTransactionAdd--externalReceiptNumber")).closest(".control");c.classList.add("has-icons-right"),c.insertAdjacentHTML("beforeend",' '),c.insertAdjacentHTML("afterend",'
'),t.addEventListener("change",l),e.addEventListener("change",l),l()}},onshown(t,o){var a;bulmaJS.toggleHtmlClipped(),e.focus(),n=o,null===(a=t.querySelector("form"))||void 0===a||a.addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),r.focus()}})}),N()}})();
\ No newline at end of file
+"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,n,c,o;const a=exports.los,l=document.querySelector("#lotOccupancy--lotOccupancyId").value,s=""===l;let r=s;function i(){var e;a.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.remove("is-light")}function u(){var e;a.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.add("is-light")}const d=document.querySelector("#form--lotOccupancy");d.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/${s?"doCreateLotOccupancy":"doUpdateLotOccupancy"}`,d,e=>{var t;const n=e;n.success?(u(),s||r?window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Saving ${a.escapedAliases.Occupancy}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const p=d.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",i);function m(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,{lotOccupancyId:l},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(S=document.querySelector("#button--copyLotOccupancy"))||void 0===S||S.addEventListener("click",e=>{e.preventDefault(),a.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${a.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:m}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${a.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`,{lotOccupancyId:l},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function n(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/workOrders/doCreateWorkOrder`,e.currentTarget,e=>{const n=e;n.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(n.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:n.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=l,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const n=e.querySelector("#workOrderCreate--workOrderTypeId"),c=exports.workOrderTypes;1===c.length&&(n.innerHTML="");for(const e of c){const c=document.createElement("option");c.value=e.workOrderTypeId.toString(),c.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",n.append(c)}},onshown(e,c){var o;t=c,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",n)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const y=document.querySelector("#lotOccupancy--occupancyTypeId");if(s){const e=document.querySelector("#container--lotOccupancyFields");y.addEventListener("change",()=>{""!==y.value?cityssm.postJSON(a.urlPrefix+"/lotOccupancies/doGetOccupancyTypeFields",{occupancyTypeId:y.value},t=>{var n,c;const o=t;if(0===o.occupancyTypeFields.length)return void(e.innerHTML=`\n
There are no additional fields for this ${a.escapedAliases.occupancy} type.
\n
`);e.innerHTML="";let l="";for(const t of o.occupancyTypeFields){l+=","+t.occupancyTypeFieldId.toString();const o=`lotOccupancyFieldValue_${t.occupancyTypeFieldId.toString()}`,a=`lotOccupancy--${o}`,s=document.createElement("div");if(s.className="field",s.innerHTML=`
`,s.querySelector("label").textContent=t.occupancyTypeField,""===(null!==(n=t.occupancyTypeFieldValues)&&void 0!==n?n:"")){const e=document.createElement("input");e.className="input",e.id=a,e.name=o,e.type="text",e.required=t.isRequired,e.minLength=t.minimumLength,e.maxLength=t.maximumLength,""!==(null!==(c=t.pattern)&&void 0!==c?c:"")&&(e.pattern=t.pattern),s.querySelector(".control").append(e)}else{s.querySelector(".control").innerHTML=`\n \n (Not Set) \n \n
`;const e=s.querySelector("select");e.required=t.isRequired;const n=t.occupancyTypeFieldValues.split("\n");for(const t of n){const n=document.createElement("option");n.value=t,n.textContent=t,e.append(n)}}console.log(s),e.append(s)}e.insertAdjacentHTML("beforeend",` `)}):e.innerHTML=`\n
Select the ${a.escapedAliases.occupancy} type to load the available fields.
\n
`})}else{const e=y.value;y.addEventListener("change",()=>{y.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${a.escapedAliases.occupancy} type?\n\n This change affects the additional fields associated with this record, and may also affect the available fees.`,contextualColorName:"warning",okButton:{text:"Yes, Keep the Change",callbackFunction:()=>{r=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{y.value=e}}})})}const v=document.querySelector("#lotOccupancy--lotName");v.addEventListener("click",e=>{const t=e.currentTarget.value;let n,c,o,l;function s(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,i(),n()}function r(e){var t,n;e.preventDefault();const c=e.currentTarget;s(null!==(t=c.dataset.lotId)&&void 0!==t?t:"",null!==(n=c.dataset.lotName)&&void 0!==n?n:"")}function u(){l.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(`${a.urlPrefix}/lots/doSearchLots`,o,e=>{var t,n;const c=e;if(0===c.count)return void(l.innerHTML='');const o=document.createElement("div");o.className="panel";for(const e of c.lots){const c=document.createElement("a");c.className="panel-block is-block",c.href="#",c.dataset.lotId=e.lotId.toString(),c.dataset.lotName=e.lotName,c.innerHTML=`\n
\n ${cityssm.escapeHTML(null!==(t=e.lotName)&&void 0!==t?t:"")} \n ${cityssm.escapeHTML(null!==(n=e.mapName)&&void 0!==n?n:"")} \n
\n
\n ${cityssm.escapeHTML(e.lotStatus)} \n \n ${e.lotOccupancyCount>0?"Currently Occupied":""}\n \n
\n
`,c.addEventListener("click",r),o.append(c)}l.innerHTML="",l.append(o)})}function d(e){e.preventDefault();const t=c.querySelector("#lotCreate--lotName").value;cityssm.postJSON(`${a.urlPrefix}/lots/doCreateLot`,e.currentTarget,e=>{var n;const c=e;c.success?s(c.lotId,t):bulmaJS.alert({title:`Error Creating ${a.escapedAliases.Lot}`,message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-selectLot",{onshow(e){a.populateAliases(e)},onshown(e,a){var s;bulmaJS.toggleHtmlClipped(),c=e,n=a,bulmaJS.init(e);const r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const i=e.querySelector("#lotSelect--occupancyStatus");if(i.addEventListener("change",u),""!==t&&(i.value=""),o=e.querySelector("#form--lotSelect"),l=e.querySelector("#resultsContainer--lotSelect"),o.addEventListener("submit",e=>{e.preventDefault()}),u(),exports.lotNamePattern){const t=exports.lotNamePattern;e.querySelector("#lotCreate--lotName").pattern=t.source}const p=e.querySelector("#lotCreate--lotTypeId");for(const e of exports.lotTypes){const t=document.createElement("option");t.value=e.lotTypeId.toString(),t.textContent=e.lotType,p.append(t)}const m=e.querySelector("#lotCreate--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,m.append(t)}const y=e.querySelector("#lotCreate--mapId");for(const e of exports.maps){const t=document.createElement("option");t.value=e.mapId.toString(),t.textContent=""===(null!==(s=e.mapName)&&void 0!==s?s:"")?"(No Name)":e.mapName,y.append(t)}e.querySelector("#form--lotCreate").addEventListener("submit",d)},onremoved(){bulmaJS.toggleHtmlClipped()}})}),null===(n=document.querySelector(".is-lot-view-button"))||void 0===n||n.addEventListener("click",()=>{const e=document.querySelector("#lotOccupancy--lotId").value;""===e?bulmaJS.alert({message:`No ${a.escapedAliases.lot} selected.`,contextualColorName:"info"}):window.open(a.urlPrefix+"/lots/"+e)}),null===(c=document.querySelector(".is-clear-lot-button"))||void 0===c||c.addEventListener("click",()=>{v.disabled?bulmaJS.alert({message:"You need to unlock the field before clearing it.",contextualColorName:"info"}):(v.value=`(No ${a.escapedAliases.Lot})`,document.querySelector("#lotOccupancy--lotId").value="",i())}),a.initializeDatePickers(d),null===(o=document.querySelector("#lotOccupancy--occupancyStartDateString"))||void 0===o||o.addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),a.initializeUnlockFieldButtons(d),Object.defineProperty(exports,"__esModule",{value:!0});let f=exports.lotOccupancyOccupants;function O(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotOccupantIndex)&&void 0!==n?n:"",10),o=f.find(e=>e.lotOccupantIndex===c);let s,r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`,s,e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,r(),h()):bulmaJS.alert({title:`Error Updating ${a.escapedAliases.Occupant}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow(e){var t,n,s,r,i,u,d,p,m,y,v,f,O,g,h,S;a.populateAliases(e),e.querySelector("#lotOccupancyOccupantEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyOccupantEdit--lotOccupantIndex").value=c.toString();const b=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");let C=!1;for(const e of exports.lotOccupantTypes){const t=document.createElement("option");t.value=e.lotOccupantTypeId.toString(),t.textContent=e.lotOccupantType,t.dataset.occupantCommentTitle=e.occupantCommentTitle,t.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,e.lotOccupantTypeId===o.lotOccupantTypeId&&(t.selected=!0,C=!0),b.append(t)}if(!C){const e=document.createElement("option");e.value=null!==(n=null===(t=o.lotOccupantTypeId)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",e.textContent=null!==(s=o.lotOccupantType)&&void 0!==s?s:"",e.dataset.occupantCommentTitle=o.occupantCommentTitle,e.dataset.fontAwesomeIconClass=o.fontAwesomeIconClass,e.selected=!0,b.append(e)}e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=` `,e.querySelector("#lotOccupancyOccupantEdit--occupantName").value=null!==(i=o.occupantName)&&void 0!==i?i:"",e.querySelector("#lotOccupancyOccupantEdit--occupantFamilyName").value=null!==(u=o.occupantFamilyName)&&void 0!==u?u:"",e.querySelector("#lotOccupancyOccupantEdit--occupantAddress1").value=null!==(d=o.occupantAddress1)&&void 0!==d?d:"",e.querySelector("#lotOccupancyOccupantEdit--occupantAddress2").value=null!==(p=o.occupantAddress2)&&void 0!==p?p:"",e.querySelector("#lotOccupancyOccupantEdit--occupantCity").value=null!==(m=o.occupantCity)&&void 0!==m?m:"",e.querySelector("#lotOccupancyOccupantEdit--occupantProvince").value=null!==(y=o.occupantProvince)&&void 0!==y?y:"",e.querySelector("#lotOccupancyOccupantEdit--occupantPostalCode").value=null!==(v=o.occupantPostalCode)&&void 0!==v?v:"",e.querySelector("#lotOccupancyOccupantEdit--occupantPhoneNumber").value=null!==(f=o.occupantPhoneNumber)&&void 0!==f?f:"",e.querySelector("#lotOccupancyOccupantEdit--occupantEmailAddress").value=null!==(O=o.occupantEmailAddress)&&void 0!==O?O:"",e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=""===(null!==(g=o.occupantCommentTitle)&&void 0!==g?g:"")?"Comment":null!==(h=o.occupantCommentTitle)&&void 0!==h?h:"",e.querySelector("#lotOccupancyOccupantEdit--occupantComment").value=null!==(S=o.occupantComment)&&void 0!==S?S:""},onshown(e,t){bulmaJS.toggleHtmlClipped();const n=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");n.focus(),n.addEventListener("change",()=>{var t,c;const o=null!==(t=n.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==t?t:"user";e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=` `;let a=null!==(c=n.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==c?c:"";""===a&&(a="Comment"),e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=a}),(s=e.querySelector("form")).addEventListener("submit",i),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function g(e){var t;const n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotOccupantIndex;bulmaJS.confirm({title:`Remove ${a.escapedAliases.Occupant}?`,message:`Are you sure you want to remove this ${a.escapedAliases.occupant}?`,okButton:{text:`Yes, Remove ${a.escapedAliases.Occupant}`,callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`,{lotOccupancyId:l,lotOccupantIndex:n},e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,h()):bulmaJS.alert({title:`Error Removing ${a.escapedAliases.Occupant}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function h(){var e,t,n,c,o,l,s,r,i,u,d,p,m,y,v,h,S,b,C,T,x,L;const q=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(q),0===f.length)return void(q.innerHTML=`\n
There are no ${a.escapedAliases.occupants} associated with this record.
\n
`);const N=document.createElement("table");N.className="table is-fullwidth is-striped is-hoverable",N.innerHTML=`\n ${a.escapedAliases.Occupant} \n Address \n Other Contact \n Comment \n Options \n \n `;for(const q of f){const f=document.createElement("tr");f.dataset.lotOccupantIndex=q.lotOccupantIndex.toString(),f.innerHTML=""+cityssm.escapeHTML(""===(null!==(e=q.occupantName)&&void 0!==e?e:"")&&""===(null!==(t=q.occupantFamilyName)&&void 0!==t?t:"")?"(No Name)":`${q.occupantName} ${q.occupantFamilyName}`)+' '+cityssm.escapeHTML(null!==(c=q.lotOccupantType)&&void 0!==c?c:"")+" "+(""===(null!==(o=q.occupantAddress1)&&void 0!==o?o:"")?"":cityssm.escapeHTML(null!==(l=q.occupantAddress1)&&void 0!==l?l:"")+" ")+(""===(null!==(s=q.occupantAddress2)&&void 0!==s?s:"")?"":cityssm.escapeHTML(null!==(r=q.occupantAddress2)&&void 0!==r?r:"")+" ")+(""===(null!==(i=q.occupantCity)&&void 0!==i?i:"")?"":cityssm.escapeHTML(null!==(u=q.occupantCity)&&void 0!==u?u:"")+", ")+cityssm.escapeHTML(null!==(d=q.occupantProvince)&&void 0!==d?d:"")+" "+cityssm.escapeHTML(null!==(p=q.occupantPostalCode)&&void 0!==p?p:"")+" "+(""===(null!==(m=q.occupantPhoneNumber)&&void 0!==m?m:"")?"":cityssm.escapeHTML(null!==(y=q.occupantPhoneNumber)&&void 0!==y?y:"")+" ")+(""===(null!==(v=q.occupantEmailAddress)&&void 0!==v?v:"")?"":cityssm.escapeHTML(null!==(h=q.occupantEmailAddress)&&void 0!==h?h:""))+' '+cityssm.escapeHTML(null!==(C=q.occupantComment)&&void 0!==C?C:"")+' Edit
',null===(T=f.querySelector(".button--edit"))||void 0===T||T.addEventListener("click",O),null===(x=f.querySelector(".button--delete"))||void 0===x||x.addEventListener("click",g),null===(L=N.querySelector("tbody"))||void 0===L||L.append(f)}q.append(N)}if(delete exports.lotOccupancyOccupants,s){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{var t;const n=d.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const t of n)t.disabled=""===e.value;let c=null!==(t=e.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),d.querySelector("#lotOccupancy--occupantCommentTitle").textContent=c})}else h();if(null===(S=document.querySelector("#button--addOccupant"))||void 0===S||S.addEventListener("click",()=>{let e,t,n,c;function o(t){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`,t,t=>{var n;const c=t;c.success?(f=c.lotOccupancyOccupants,e(),h()):bulmaJS.alert({title:`Error Adding ${a.escapedAliases.Occupant}`,message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function s(e){e.preventDefault(),o(t)}let r=[];function i(e){var t;e.preventDefault();const n=e.currentTarget,c=r[Number.parseInt(n.dataset.index,10)],s=(null===(t=n.closest(".modal"))||void 0===t?void 0:t.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId")).value;""===s?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(c.lotOccupantTypeId=Number.parseInt(s,10),c.lotOccupancyId=Number.parseInt(l,10),o(c))}function u(e){e.preventDefault(),""!==n.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(c.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doSearchPastOccupants`,n,e=>{var t,n,o,a,l,s,u,d,p,m,y;r=e.occupants;const v=document.createElement("div");v.className="panel";for(const[e,c]of r.entries()){const r=document.createElement("a");r.className="panel-block is-block",r.dataset.index=e.toString(),r.innerHTML=`\n ${cityssm.escapeHTML(null!==(t=c.occupantName)&&void 0!==t?t:"")} ${cityssm.escapeHTML(null!==(n=c.occupantFamilyName)&&void 0!==n?n:"")}\n \n \n
\n ${cityssm.escapeHTML(null!==(o=c.occupantAddress1)&&void 0!==o?o:"")} \n ${""===(null!==(a=c.occupantAddress2)&&void 0!==a?a:"")?"":cityssm.escapeHTML(null!==(l=c.occupantAddress2)&&void 0!==l?l:"")+" "}${cityssm.escapeHTML(null!==(s=c.occupantCity)&&void 0!==s?s:"")}, ${cityssm.escapeHTML(null!==(u=c.occupantProvince)&&void 0!==u?u:"")} \n ${cityssm.escapeHTML(null!==(d=c.occupantPostalCode)&&void 0!==d?d:"")}\n
\n
\n ${""===(null!==(p=c.occupantPhoneNumber)&&void 0!==p?p:"")?"":cityssm.escapeHTML(null!==(m=c.occupantPhoneNumber)&&void 0!==m?m:"")+" "}\n ${cityssm.escapeHTML(null!==(y=c.occupantEmailAddress)&&void 0!==y?y:"")} \n
\n
`,r.addEventListener("click",i),v.append(r)}c.innerHTML="",c.append(v)})):c.innerHTML='\n
Enter a partial name or address in the search field above.
\n
'}cityssm.openHtmlModal("lotOccupancy-addOccupant",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyOccupantAdd--lotOccupancyId").value=l;const t=e.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId"),n=e.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId");for(const e of exports.lotOccupantTypes){const c=document.createElement("option");c.value=e.lotOccupantTypeId.toString(),c.textContent=e.lotOccupantType,c.dataset.occupantCommentTitle=e.occupantCommentTitle,c.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,t.append(c),n.append(c.cloneNode(!0))}e.querySelector("#lotOccupancyOccupantAdd--occupantCity").value=exports.occupantCityDefault,e.querySelector("#lotOccupancyOccupantAdd--occupantProvince").value=exports.occupantProvinceDefault},onshown(o,a){bulmaJS.toggleHtmlClipped(),bulmaJS.init(o);const l=o.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId");l.focus(),l.addEventListener("change",()=>{var e,t;const n=null!==(e=l.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==e?e:"user";o.querySelector("#lotOccupancyOccupantAdd--fontAwesomeIconClass").innerHTML=` `;let c=null!==(t=l.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),o.querySelector("#lotOccupancyOccupantAdd--occupantCommentTitle").textContent=c}),(t=o.querySelector("#form--lotOccupancyOccupantAdd")).addEventListener("submit",s),c=o.querySelector("#lotOccupancyOccupantCopy--searchResults"),(n=o.querySelector("#form--lotOccupancyOccupantCopy")).addEventListener("submit",e=>{e.preventDefault()}),o.querySelector("#lotOccupancyOccupantCopy--searchFilter").addEventListener("change",u),e=a},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addOccupant").focus()}})}),!s){var S;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.lotOccupancyComments;function b(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10),s=e.find(e=>e.lotOccupancyCommentId===o);let r,i;function u(t){t.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyComment`,r,t=>{var n,c;const o=t;o.success?(e=null!==(n=o.lotOccupancyComments)&&void 0!==n?n:[],i(),T()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editComment",{onshow(e){var t,n,c,r;a.populateAliases(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value=o.toString(),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value=null!==(t=s.lotOccupancyComment)&&void 0!==t?t:"";const i=e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");i.value=null!==(n=s.lotOccupancyCommentDateString)&&void 0!==n?n:"";const u=cityssm.dateToString(new Date);i.max=s.lotOccupancyCommentDateString<=u?u:null!==(c=s.lotOccupancyCommentDateString)&&void 0!==c?c:"",e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value=null!==(r=s.lotOccupancyCommentTimeString)&&void 0!==r?r:""},onshown(e,t){bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus(),(r=e.querySelector("form")).addEventListener("submit",u),i=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function C(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyComment`,{lotOccupancyId:l,lotOccupancyCommentId:o},t=>{var n;const c=t;c.success?(e=c.lotOccupancyComments,T()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function T(){var t,n,c,o,a,l,s,r;const i=document.querySelector("#container--lotOccupancyComments");if(0===e.length)return void(i.innerHTML='\n
There are no comments associated with this record.
\n
');const u=document.createElement("table");u.className="table is-fullwidth is-striped is-hoverable",u.innerHTML='\n Commentor \n Comment Date \n Comment \n Options \n \n ';for(const i of e){const e=document.createElement("tr");e.dataset.lotOccupancyCommentId=null===(t=i.lotOccupancyCommentId)||void 0===t?void 0:t.toString(),e.innerHTML=`${cityssm.escapeHTML(null!==(n=i.recordCreate_userName)&&void 0!==n?n:"")} \n \n ${cityssm.escapeHTML(null!==(c=i.lotOccupancyCommentDateString)&&void 0!==c?c:"")}\n ${cityssm.escapeHTML(0===i.lotOccupancyCommentTime?"":null!==(o=i.lotOccupancyCommentTimePeriodString)&&void 0!==o?o:"")}\n \n ${cityssm.escapeHTML(null!==(a=i.lotOccupancyComment)&&void 0!==a?a:"")} \n \n \n \n \n Edit \n \n \n \n \n
\n `,null===(l=e.querySelector(".button--edit"))||void 0===l||l.addEventListener("click",b),null===(s=e.querySelector(".button--delete"))||void 0===s||s.addEventListener("click",C),null===(r=u.querySelector("tbody"))||void 0===r||r.append(e)}i.innerHTML="",i.append(u)}delete exports.lotOccupancyComments,null===(S=document.querySelector("#button--addComment"))||void 0===S||S.addEventListener("click",()=>{let t,n;function c(c){c.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyComment`,t,t=>{var c;const o=t;o.success?(e=o.lotOccupancyComments,n(),T()):bulmaJS.alert({title:"Error Adding Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addComment",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyId").value=l},onshown(e,o){bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyComment").focus(),(t=e.querySelector("form")).addEventListener("submit",c),n=o},onremoved:()=>{bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addComment").focus()}})}),T(),Object.defineProperty(exports,"__esModule",{value:!0});let t=exports.lotOccupancyFees;delete exports.lotOccupancyFees;const n=document.querySelector("#container--lotOccupancyFees");function x(){let e=0;for(const n of t)e+=(n.feeAmount+n.taxAmount)*n.quantity;return e}function L(e){var n,c;const o=Number.parseInt(null!==(c=null===(n=e.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.feeId)&&void 0!==c?c:"",10),s=t.find(e=>e.feeId===o);let r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`,e.currentTarget,e=>{const n=e;n.success?(t=n.lotOccupancyFees,N(),r()):bulmaJS.alert({title:"Error Updating Quantity",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editFeeQuantity",{onshow(e){var t,n;e.querySelector("#lotOccupancyFeeQuantity--lotOccupancyId").value=l,e.querySelector("#lotOccupancyFeeQuantity--feeId").value=s.feeId.toString(),e.querySelector("#lotOccupancyFeeQuantity--quantity").valueAsNumber=null!==(t=s.quantity)&&void 0!==t?t:0,e.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=null!==(n=s.quantityUnit)&&void 0!==n?n:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),r=t,e.querySelector("#lotOccupancyFeeQuantity--quantity").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",i)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function q(e){const n=e.currentTarget.closest(".container--lotOccupancyFee").dataset.feeId;bulmaJS.confirm({title:"Delete Fee",message:"Are you sure you want to delete this fee?",contextualColorName:"warning",okButton:{text:"Yes, Delete Fee",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`,{lotOccupancyId:l,feeId:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N()):bulmaJS.alert({title:"Error Deleting Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}}})}function N(){var e,c,o,a,l,s,r,i,u;if(0===t.length)return n.innerHTML='\n
There are no fees associated with this record.
\n
',void I();n.innerHTML='\n \n Fee \n Unit Cost \n × \n Quantity \n equals \n Total \n Options \n \n \n \n Subtotal \n \n \n \n Tax \n \n \n \n Grand Total \n \n \n
';let d=0,p=0;for(const m of t){const t=document.createElement("tr");t.className="container--lotOccupancyFee",t.dataset.feeId=m.feeId.toString(),t.dataset.includeQuantity=null!==(e=m.includeQuantity)&&void 0!==e&&e?"1":"0",t.innerHTML=`\n ${cityssm.escapeHTML(null!==(c=m.feeName)&&void 0!==c?c:"")} \n ${cityssm.escapeHTML(null!==(o=m.feeCategory)&&void 0!==o?o:"")} \n \n ${1===m.quantity?"":`\n $${null===(a=m.feeAmount)||void 0===a?void 0:a.toFixed(2)}\n \n × \n ${null===(l=m.quantity)||void 0===l?void 0:l.toString()} \n = `}\n \n $${(m.feeAmount*m.quantity).toFixed(2)}\n \n \n \n ${null!==(s=m.includeQuantity)&&void 0!==s&&s?'\n \n Edit \n ':""}\n \n \n \n
\n `,null===(r=t.querySelector(".button--editQuantity"))||void 0===r||r.addEventListener("click",L),null===(i=t.querySelector(".button--delete"))||void 0===i||i.addEventListener("click",q),null===(u=n.querySelector("tbody"))||void 0===u||u.append(t),d+=m.feeAmount*m.quantity,p+=m.taxAmount*m.quantity}n.querySelector("#lotOccupancyFees--feeAmountTotal").textContent="$"+d.toFixed(2),n.querySelector("#lotOccupancyFees--taxAmountTotal").textContent="$"+p.toFixed(2),n.querySelector("#lotOccupancyFees--grandTotal").textContent="$"+(d+p).toFixed(2),I()}const c=document.querySelector("#button--addFee");c.addEventListener("click",()=>{if(a.hasUnsavedChanges())return void bulmaJS.alert({message:"Please save all unsaved changes before adding fees.",contextualColorName:"warning"});let e,o,s;function r(e,n=1){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`,{lotOccupancyId:l,feeId:e,quantity:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N(),u()):bulmaJS.alert({title:"Error Adding Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function i(t){var n,c,o;t.preventDefault();const a=Number.parseInt(null!==(n=t.currentTarget.dataset.feeId)&&void 0!==n?n:"",10),l=Number.parseInt(null!==(c=t.currentTarget.dataset.feeCategoryId)&&void 0!==c?c:"",10),s=e.find(e=>e.feeCategoryId===l).fees.find(e=>e.feeId===a);null!==(o=s.includeQuantity)&&void 0!==o&&o?function(e){let t,n;function c(c){c.preventDefault(),r(e.feeId,t.value),n()}cityssm.openHtmlModal("lotOccupancy-setFeeQuantity",{onshow(t){var n;t.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=null!==(n=e.quantityUnit)&&void 0!==n?n:""},onshown(e,o){var a;n=o,t=e.querySelector("#lotOccupancyFeeQuantity--quantity"),null===(a=e.querySelector("form"))||void 0===a||a.addEventListener("submit",c)}})}(s):r(a)}function u(){var t,c,a,l,r,u;const d=o.value.trim().toLowerCase().split(" ");s.innerHTML="";for(const o of e){const e=document.createElement("div");e.className="container--feeCategory",e.dataset.feeCategoryId=o.feeCategoryId.toString(),e.innerHTML=`${cityssm.escapeHTML(null!==(t=o.feeCategory)&&void 0!==t?t:"")} \n
`;let p=!1;for(const t of o.fees){if(null!==n.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let s=!0;const m=`${null!==(c=o.feeCategory)&&void 0!==c?c:""} ${null!==(a=t.feeName)&&void 0!==a?a:""} ${null!==(l=t.feeDescription)&&void 0!==l?l:""}`.toLowerCase();for(const e of d)if(!m.includes(e)){s=!1;break}if(!s)continue;p=!0;const y=document.createElement("a");y.className="panel-block is-block container--fee",y.dataset.feeId=t.feeId.toString(),y.dataset.feeCategoryId=o.feeCategoryId.toString(),y.href="#",y.innerHTML=`${cityssm.escapeHTML(null!==(r=t.feeName)&&void 0!==r?r:"")} \n \n ${cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replaceAll("\n"," ")}\n `,y.addEventListener("click",i),e.querySelector(".panel").append(y)}p&&s.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){o=t.querySelector("#feeSelect--feeName"),s=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetFees`,{lotOccupancyId:l},t=>{e=t.feeCategories,o.disabled=!1,o.addEventListener("keyup",u),o.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){N()},onremoved(){bulmaJS.toggleHtmlClipped(),c.focus()}})});let o=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const s=document.querySelector("#container--lotOccupancyTransactions");function E(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.transactionIndex)&&void 0!==n?n:"",10),s=o.find(e=>e.transactionIndex===c);let r;function i(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`,e.currentTarget,e=>{const t=e;t.success?(o=t.lotOccupancyTransactions,I(),r()):bulmaJS.alert({title:"Error Updating Transaction",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editTransaction",{onshow(e){var t,n,c,o,r,i;a.populateAliases(e),e.querySelector("#lotOccupancyTransactionEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyTransactionEdit--transactionIndex").value=null!==(n=null===(t=s.transactionIndex)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").value=s.transactionAmount.toFixed(2),e.querySelector("#lotOccupancyTransactionEdit--externalReceiptNumber").value=null!==(c=s.externalReceiptNumber)&&void 0!==c?c:"",e.querySelector("#lotOccupancyTransactionEdit--transactionNote").value=null!==(o=s.transactionNote)&&void 0!==o?o:"",e.querySelector("#lotOccupancyTransactionEdit--transactionDateString").value=null!==(r=s.transactionDateString)&&void 0!==r?r:"",e.querySelector("#lotOccupancyTransactionEdit--transactionTimeString").value=null!==(i=s.transactionTimeString)&&void 0!==i?i:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",i),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function M(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`,{lotOccupancyId:l,transactionIndex:t},e=>{var t;const n=e;n.success?(o=n.lotOccupancyTransactions,I()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function I(){var e,n,c,l,r,i,u;if(0===o.length)return void(s.innerHTML=`\n
There are no transactions associated with this record.
\n
`);s.innerHTML=`\n \n Date \n ${a.escapedAliases.ExternalReceiptNumber} \n Amount \n Options \n \n \n \n Transaction Total \n \n \n \n
`;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 Edit \n \n \n \n \n
\n `,null===(r=o.querySelector(".button--edit"))||void 0===r||r.addEventListener("click",E),null===(i=o.querySelector(".button--delete"))||void 0===i||i.addEventListener("click",M),null===(u=s.querySelector("tbody"))||void 0===u||u.append(o)}s.querySelector("#lotOccupancyTransactions--grandTotal").textContent="$"+d.toFixed(2);const p=x();p.toFixed(2)!==d.toFixed(2)&&s.insertAdjacentHTML("afterbegin",`\n
\n
\n
\n
\n
$${cityssm.escapeHTML((p-d).toFixed(2))}
\n
\n
\n
`)}const r=document.querySelector("#button--addTransaction");r.addEventListener("click",()=>{let e,t,n;function c(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`,e.currentTarget,e=>{var t;const c=e;c.success?(o=c.lotOccupancyTransactions,n(),I()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function s(){var n,c;const o=t.value,l=null===(n=t.closest(".control"))||void 0===n?void 0:n.querySelector(".icon"),s=null===(c=t.closest(".field"))||void 0===c?void 0:c.querySelector(".help");if(""===o)return s.innerHTML=" ",void(l.innerHTML=' ');cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`,{externalReceiptNumber:o},t=>{const n=t;n.success&&void 0!==n.dynamicsGPDocument?e.valueAsNumber===n.dynamicsGPDocument.documentTotal?(s.textContent="Matching Document Found",l.innerHTML=' '):(s.textContent="Matching Document: $"+n.dynamicsGPDocument.documentTotal.toFixed(2),l.innerHTML=' '):(s.textContent="No Matching Document Found",l.innerHTML=' ')})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow(n){a.populateAliases(n),n.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=l.toString();const c=x(),r=function(){let e=0;for(const t of o)e+=t.transactionAmount;return e}();if((e=n.querySelector("#lotOccupancyTransactionAdd--transactionAmount")).min=(-1*r).toFixed(2),e.max=Math.max(c-r,0).toFixed(2),e.value=Math.max(c-r,0).toFixed(2),a.dynamicsGPIntegrationIsEnabled){const c=(t=n.querySelector("#lotOccupancyTransactionAdd--externalReceiptNumber")).closest(".control");c.classList.add("has-icons-right"),c.insertAdjacentHTML("beforeend",' '),c.insertAdjacentHTML("afterend",'
'),t.addEventListener("change",s),e.addEventListener("change",s),s()}},onshown(t,o){var a;bulmaJS.toggleHtmlClipped(),e.focus(),n=o,null===(a=t.querySelector("form"))||void 0===a||a.addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),r.focus()}})}),N()}})();
\ No newline at end of file