code cleanup

deepsource-autofix-76c6eb20
Dan Gowans 2024-06-25 11:17:31 -04:00
parent 50e6c19b2b
commit d8e833a954
4 changed files with 276 additions and 275 deletions

View File

@ -514,7 +514,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
cityssm.openHtmlModal('lotOccupancy-editOccupant', { cityssm.openHtmlModal('lotOccupancy-editOccupant', {
onshow(modalElement) { onshow(modalElement) {
var _a; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
los.populateAliases(modalElement); los.populateAliases(modalElement);
modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupancyId').value = lotOccupancyId; modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupancyId').value = lotOccupancyId;
modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupantIndex').value = lotOccupantIndex.toString(); modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupantIndex').value = lotOccupantIndex.toString();
@ -537,8 +537,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
if (!lotOccupantTypeSelected) { if (!lotOccupantTypeSelected) {
const optionElement = document.createElement('option'); const optionElement = document.createElement('option');
optionElement.value = lotOccupancyOccupant.lotOccupantTypeId.toString(); optionElement.value =
optionElement.textContent = lotOccupancyOccupant.lotOccupantType; (_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 = optionElement.dataset.occupantCommentTitle =
lotOccupancyOccupant.occupantCommentTitle; lotOccupancyOccupant.occupantCommentTitle;
optionElement.dataset.fontAwesomeIconClass = optionElement.dataset.fontAwesomeIconClass =
@ -546,22 +547,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
optionElement.selected = true; optionElement.selected = true;
lotOccupantTypeSelectElement.append(optionElement); lotOccupantTypeSelectElement.append(optionElement);
} }
;
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
`<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass}" aria-hidden="true"></i>`; `<i class="fas fa-fw fa-${cityssm.escapeHTML((_d = lotOccupancyOccupant.fontAwesomeIconClass) !== null && _d !== void 0 ? _d : '')}" aria-hidden="true"></i>`;
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = (_e = lotOccupancyOccupant.occupantName) !== null && _e !== void 0 ? _e : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = (_f = lotOccupancyOccupant.occupantFamilyName) !== null && _f !== void 0 ? _f : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = (_g = lotOccupancyOccupant.occupantAddress1) !== null && _g !== void 0 ? _g : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = lotOccupancyOccupant.occupantAddress2; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = (_h = lotOccupancyOccupant.occupantAddress2) !== null && _h !== void 0 ? _h : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = lotOccupancyOccupant.occupantCity; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = (_j = lotOccupancyOccupant.occupantCity) !== null && _j !== void 0 ? _j : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantProvince').value = lotOccupancyOccupant.occupantProvince; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantProvince').value = (_k = lotOccupancyOccupant.occupantProvince) !== null && _k !== void 0 ? _k : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPostalCode').value = lotOccupancyOccupant.occupantPostalCode; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPostalCode').value = (_l = lotOccupancyOccupant.occupantPostalCode) !== null && _l !== void 0 ? _l : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPhoneNumber').value = lotOccupancyOccupant.occupantPhoneNumber; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPhoneNumber').value = (_m = lotOccupancyOccupant.occupantPhoneNumber) !== null && _m !== void 0 ? _m : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantEmailAddress').value = lotOccupancyOccupant.occupantEmailAddress; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantEmailAddress').value = (_o = lotOccupancyOccupant.occupantEmailAddress) !== null && _o !== void 0 ? _o : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCommentTitle').textContent = modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCommentTitle').textContent =
((_a = lotOccupancyOccupant.occupantCommentTitle) !== null && _a !== void 0 ? _a : '') === '' ((_p = lotOccupancyOccupant.occupantCommentTitle) !== null && _p !== void 0 ? _p : '') === ''
? 'Comment' ? 'Comment'
: lotOccupancyOccupant.occupantCommentTitle; : (_q = lotOccupancyOccupant.occupantCommentTitle) !== null && _q !== void 0 ? _q : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantComment').value = lotOccupancyOccupant.occupantComment; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantComment').value = (_r = lotOccupancyOccupant.occupantComment) !== null && _r !== void 0 ? _r : '';
}, },
onshown(modalElement, closeModalFunction) { onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped(); bulmaJS.toggleHtmlClipped();
@ -572,7 +574,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user'; .fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`; `<i class="fas fa-fw fa-${cityssm.escapeHTML(fontAwesomeIconClass)}" aria-hidden="true"></i>`;
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _b !== void 0 ? _b : ''; .occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
if (occupantCommentTitle === '') { if (occupantCommentTitle === '') {
@ -591,9 +593,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
}); });
} }
function deleteLotOccupancyOccupant(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() { function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyOccupant', { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`, {
lotOccupancyId, lotOccupancyId,
lotOccupantIndex lotOccupantIndex
}, (rawResponseJSON) => { }, (rawResponseJSON) => {
@ -605,7 +608,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
else { else {
bulmaJS.alert({ bulmaJS.alert({
title: 'Error Removing ' + los.escapedAliases.Occupant, title: `Error Removing ${los.escapedAliases.Occupant}`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger' contextualColorName: 'danger'
}); });
@ -616,17 +619,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
title: `Remove ${los.escapedAliases.Occupant}?`, title: `Remove ${los.escapedAliases.Occupant}?`,
message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`, message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`,
okButton: { okButton: {
text: 'Yes, Remove ' + los.escapedAliases.Occupant, text: `Yes, Remove ${los.escapedAliases.Occupant}`,
callbackFunction: doDelete callbackFunction: doDelete
}, },
contextualColorName: 'warning' contextualColorName: 'warning'
}); });
} }
function renderLotOccupancyOccupants() { 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'); const occupantsContainer = document.querySelector('#container--lotOccupancyOccupants');
cityssm.clearElement(occupantsContainer); cityssm.clearElement(occupantsContainer);
if (lotOccupancyOccupants.length === 0) { if (lotOccupancyOccupants.length === 0) {
// eslint-disable-next-line no-unsanitized/property
occupantsContainer.innerHTML = `<div class="message is-warning"> occupantsContainer.innerHTML = `<div class="message is-warning">
<p class="message-body">There are no ${los.escapedAliases.occupants} associated with this record.</p> <p class="message-body">There are no ${los.escapedAliases.occupants} associated with this record.</p>
</div>`; </div>`;
@ -634,6 +638,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
const tableElement = document.createElement('table'); const tableElement = document.createElement('table');
tableElement.className = 'table is-fullwidth is-striped is-hoverable'; tableElement.className = 'table is-fullwidth is-striped is-hoverable';
// eslint-disable-next-line no-unsanitized/property
tableElement.innerHTML = `<thead><tr> tableElement.innerHTML = `<thead><tr>
<th>${los.escapedAliases.Occupant}</th> <th>${los.escapedAliases.Occupant}</th>
<th>Address</th> <th>Address</th>
@ -646,56 +651,56 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tableRowElement = document.createElement('tr'); const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotOccupantIndex = tableRowElement.dataset.lotOccupantIndex =
lotOccupancyOccupant.lotOccupantIndex.toString(); lotOccupancyOccupant.lotOccupantIndex.toString();
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = tableRowElement.innerHTML =
'<td>' + '<td>' +
cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' &&
((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === '' ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === ''
? '(No Name)' ? '(No Name)'
: lotOccupancyOccupant.occupantName + : `${lotOccupancyOccupant.occupantName} ${lotOccupancyOccupant.occupantFamilyName}`) +
' ' +
lotOccupancyOccupant.occupantFamilyName) +
'<br />' + '<br />' +
('<span class="tag">' + ('<span class="tag">' +
'<i class="fas fa-fw fa-' + '<i class="fas fa-fw fa-' +
cityssm.escapeHTML(lotOccupancyOccupant.fontAwesomeIconClass) + cityssm.escapeHTML((_c = lotOccupancyOccupant.fontAwesomeIconClass) !== null && _c !== void 0 ? _c : '') +
'" aria-hidden="true"></i>' + '" aria-hidden="true"></i>' +
' <span class="ml-1">' + ' <span class="ml-1">' +
cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType) + cityssm.escapeHTML((_d = lotOccupancyOccupant.lotOccupantType) !== null && _d !== void 0 ? _d : '') +
'</span>' + '</span>' +
'</span>') + '</span>') +
'</td>' + '</td>' +
('<td>' + ('<td>' +
(((_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 : '') +
'<br />') + '<br />') +
(((_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 : '') +
'<br />') + '<br />') +
(((_e = lotOccupancyOccupant.occupantCity) !== null && _e !== void 0 ? _e : '') === '' (((_j = lotOccupancyOccupant.occupantCity) !== null && _j !== void 0 ? _j : '') === ''
? '' ? ''
: cityssm.escapeHTML(lotOccupancyOccupant.occupantCity) + ', ') + : cityssm.escapeHTML((_k = lotOccupancyOccupant.occupantCity) !== null && _k !== void 0 ? _k : '') +
cityssm.escapeHTML((_f = lotOccupancyOccupant.occupantProvince) !== null && _f !== void 0 ? _f : '') + ', ') +
cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantProvince) !== null && _l !== void 0 ? _l : '') +
'<br />' + '<br />' +
cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') + cityssm.escapeHTML((_m = lotOccupancyOccupant.occupantPostalCode) !== null && _m !== void 0 ? _m : '') +
'</td>') + '</td>') +
('<td>' + ('<td>' +
(((_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 : '') +
'<br />') + '<br />') +
(((_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 : '')) +
'</td>') + '</td>') +
('<td>' + ('<td>' +
'<span data-tooltip="' + '<span data-tooltip="' +
cityssm.escapeHTML(((_k = lotOccupancyOccupant.occupantCommentTitle) !== null && _k !== void 0 ? _k : '') === '' cityssm.escapeHTML(((_s = lotOccupancyOccupant.occupantCommentTitle) !== null && _s !== void 0 ? _s : '') === ''
? 'Comment' ? 'Comment'
: lotOccupancyOccupant.occupantCommentTitle) + : (_t = lotOccupancyOccupant.occupantCommentTitle) !== null && _t !== void 0 ? _t : '') +
'">' + '">' +
cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantComment) !== null && _l !== void 0 ? _l : '') + cityssm.escapeHTML((_u = lotOccupancyOccupant.occupantComment) !== null && _u !== void 0 ? _u : '') +
'</span>' + '</span>' +
'</td>') + '</td>') +
('<td class="is-hidden-print">' + ('<td class="is-hidden-print">' +
@ -705,19 +710,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
' <span>Edit</span>' + ' <span>Edit</span>' +
'</button>') + '</button>') +
('<button class="button is-light is-danger button--delete" data-tooltip="Delete ' + ('<button class="button is-light is-danger button--delete" data-tooltip="Delete ' +
cityssm.escapeHTML(exports.aliases.occupant) + los.escapedAliases.Occupant +
'" type="button" aria-label="Delete">' + '" type="button" aria-label="Delete">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' + '<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>') + '</button>') +
'</div>' + '</div>' +
'</td>'); '</td>');
tableRowElement (_v = tableRowElement
.querySelector('.button--edit') .querySelector('.button--edit')) === null || _v === void 0 ? void 0 : _v.addEventListener('click', openEditLotOccupancyOccupant);
.addEventListener('click', openEditLotOccupancyOccupant); (_w = tableRowElement
tableRowElement .querySelector('.button--delete')) === null || _w === void 0 ? void 0 : _w.addEventListener('click', deleteLotOccupancyOccupant);
.querySelector('.button--delete') (_x = tableElement.querySelector('tbody')) === null || _x === void 0 ? void 0 : _x.append(tableRowElement);
.addEventListener('click', deleteLotOccupancyOccupant);
tableElement.querySelector('tbody').append(tableRowElement);
} }
occupantsContainer.append(tableElement); occupantsContainer.append(tableElement);
} }
@ -734,6 +737,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
if (occupantCommentTitle === '') { if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment'; occupantCommentTitle = 'Comment';
} }
;
formElement.querySelector('#lotOccupancy--occupantCommentTitle').textContent = occupantCommentTitle; formElement.querySelector('#lotOccupancy--occupantCommentTitle').textContent = occupantCommentTitle;
}); });
} }
@ -747,7 +751,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let searchFormElement; let searchFormElement;
let searchResultsElement; let searchResultsElement;
function addOccupant(formOrObject) { function addOccupant(formOrObject) {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`, formOrObject, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
@ -770,12 +774,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
let pastOccupantSearchResults = []; let pastOccupantSearchResults = [];
function addOccupantFromCopy(clickEvent) { function addOccupantFromCopy(clickEvent) {
var _a;
clickEvent.preventDefault(); clickEvent.preventDefault();
const panelBlockElement = clickEvent.currentTarget; const panelBlockElement = clickEvent.currentTarget;
const occupant = pastOccupantSearchResults[Number.parseInt(panelBlockElement.dataset.index, 10)]; const occupant = pastOccupantSearchResults[Number.parseInt(panelBlockElement.dataset.index, 10)];
const lotOccupantTypeId = panelBlockElement const lotOccupantTypeId = ((_a = panelBlockElement
.closest('.modal') .closest('.modal')) === null || _a === void 0 ? void 0 : _a.querySelector('#lotOccupancyOccupantCopy--lotOccupantTypeId')).value;
.querySelector('#lotOccupancyOccupantCopy--lotOccupantTypeId').value;
if (lotOccupantTypeId === '') { if (lotOccupantTypeId === '') {
bulmaJS.alert({ bulmaJS.alert({
title: `No ${los.escapedAliases.Occupant} Type Selected`, title: `No ${los.escapedAliases.Occupant} Type Selected`,
@ -792,16 +796,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
function searchOccupants(event) { function searchOccupants(event) {
event.preventDefault(); event.preventDefault();
if (searchFormElement.querySelector('#lotOccupancyOccupantCopy--searchFilter').value === '') { if (searchFormElement.querySelector('#lotOccupancyOccupantCopy--searchFilter').value === '') {
searchResultsElement.innerHTML = searchResultsElement.innerHTML = `<div class="message is-info">
'<div class="message is-info">' + <p class="message-body">Enter a partial name or address in the search field above.</p>
'<p class="message-body">Enter a partial name or address in the search field above.</p>' + </div>`;
'</div>';
return; return;
} }
// eslint-disable-next-line no-unsanitized/property
searchResultsElement.innerHTML = searchResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...'); los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doSearchPastOccupants`, searchFormElement, (rawResponseJSON) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
pastOccupantSearchResults = responseJSON.occupants; pastOccupantSearchResults = responseJSON.occupants;
const panelElement = document.createElement('div'); const panelElement = document.createElement('div');
@ -810,35 +814,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
const panelBlockElement = document.createElement('a'); const panelBlockElement = document.createElement('a');
panelBlockElement.className = 'panel-block is-block'; panelBlockElement.className = 'panel-block is-block';
panelBlockElement.dataset.index = index.toString(); panelBlockElement.dataset.index = index.toString();
panelBlockElement.innerHTML = // eslint-disable-next-line no-unsanitized/property
'<strong>' + panelBlockElement.innerHTML = `<strong>
cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '') + ${cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '')} ${cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '')}
' ' + </strong><br />
cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') + <div class="columns">
'</strong>' + <div class="column">
'<br />' + ${cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '')}<br />
'<div class="columns">' + ${((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === ''
('<div class="column">' +
cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') +
'<br />' +
(((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === ''
? '' ? ''
: cityssm.escapeHTML(occupant.occupantAddress2) + '<br />') + : cityssm.escapeHTML((_e = occupant.occupantAddress2) !== null && _e !== void 0 ? _e : '') +
cityssm.escapeHTML((_e = occupant.occupantCity) !== null && _e !== void 0 ? _e : '') + '<br />'}${cityssm.escapeHTML((_f = occupant.occupantCity) !== null && _f !== void 0 ? _f : '')}, ${cityssm.escapeHTML((_g = occupant.occupantProvince) !== null && _g !== void 0 ? _g : '')}<br />
', ' + ${cityssm.escapeHTML((_h = occupant.occupantPostalCode) !== null && _h !== void 0 ? _h : '')}
cityssm.escapeHTML((_f = occupant.occupantProvince) !== null && _f !== void 0 ? _f : '') + </div>
'<br />' + <div class="column">
cityssm.escapeHTML((_g = occupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') + ${((_j = occupant.occupantPhoneNumber) !== null && _j !== void 0 ? _j : '') === ''
'</div>') +
('<div class="column">' +
(((_h = occupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === ''
? '' ? ''
: cityssm.escapeHTML(occupant.occupantPhoneNumber) + : cityssm.escapeHTML((_k = occupant.occupantPhoneNumber) !== null && _k !== void 0 ? _k : '') +
'<br />') + '<br />'}
cityssm.escapeHTML((_j = occupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') + ${cityssm.escapeHTML((_l = occupant.occupantEmailAddress) !== null && _l !== void 0 ? _l : '')}<br />
'<br />' + </div>
'</div>') + </div>`;
'</div>';
panelBlockElement.addEventListener('click', addOccupantFromCopy); panelBlockElement.addEventListener('click', addOccupantFromCopy);
panelElement.append(panelBlockElement); panelElement.append(panelBlockElement);
} }
@ -877,12 +873,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user'; .fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML = modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML =
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`; `<i class="fas fa-fw fa-${cityssm.escapeHTML(fontAwesomeIconClass)}" aria-hidden="true"></i>`;
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _b !== void 0 ? _b : ''; .occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
if (occupantCommentTitle === '') { if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment'; occupantCommentTitle = 'Comment';
} }
;
modalElement.querySelector('#lotOccupancyOccupantAdd--occupantCommentTitle').textContent = occupantCommentTitle; modalElement.querySelector('#lotOccupancyOccupantAdd--occupantCommentTitle').textContent = occupantCommentTitle;
}); });
addFormElement = modalElement.querySelector('#form--lotOccupancyOccupantAdd'); addFormElement = modalElement.querySelector('#form--lotOccupancyOccupantAdd');

View File

@ -34,7 +34,7 @@ function openEditLotOccupancyOccupant(clickEvent) {
} }
cityssm.openHtmlModal('lotOccupancy-editOccupant', { cityssm.openHtmlModal('lotOccupancy-editOccupant', {
onshow(modalElement) { onshow(modalElement) {
var _a; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
los.populateAliases(modalElement); los.populateAliases(modalElement);
modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupancyId').value = lotOccupancyId; modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupancyId').value = lotOccupancyId;
modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupantIndex').value = lotOccupantIndex.toString(); modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupantIndex').value = lotOccupantIndex.toString();
@ -57,8 +57,9 @@ function openEditLotOccupancyOccupant(clickEvent) {
} }
if (!lotOccupantTypeSelected) { if (!lotOccupantTypeSelected) {
const optionElement = document.createElement('option'); const optionElement = document.createElement('option');
optionElement.value = lotOccupancyOccupant.lotOccupantTypeId.toString(); optionElement.value =
optionElement.textContent = lotOccupancyOccupant.lotOccupantType; (_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 = optionElement.dataset.occupantCommentTitle =
lotOccupancyOccupant.occupantCommentTitle; lotOccupancyOccupant.occupantCommentTitle;
optionElement.dataset.fontAwesomeIconClass = optionElement.dataset.fontAwesomeIconClass =
@ -66,22 +67,23 @@ function openEditLotOccupancyOccupant(clickEvent) {
optionElement.selected = true; optionElement.selected = true;
lotOccupantTypeSelectElement.append(optionElement); lotOccupantTypeSelectElement.append(optionElement);
} }
;
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
`<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass}" aria-hidden="true"></i>`; `<i class="fas fa-fw fa-${cityssm.escapeHTML((_d = lotOccupancyOccupant.fontAwesomeIconClass) !== null && _d !== void 0 ? _d : '')}" aria-hidden="true"></i>`;
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = (_e = lotOccupancyOccupant.occupantName) !== null && _e !== void 0 ? _e : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = (_f = lotOccupancyOccupant.occupantFamilyName) !== null && _f !== void 0 ? _f : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = (_g = lotOccupancyOccupant.occupantAddress1) !== null && _g !== void 0 ? _g : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = lotOccupancyOccupant.occupantAddress2; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = (_h = lotOccupancyOccupant.occupantAddress2) !== null && _h !== void 0 ? _h : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = lotOccupancyOccupant.occupantCity; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCity').value = (_j = lotOccupancyOccupant.occupantCity) !== null && _j !== void 0 ? _j : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantProvince').value = lotOccupancyOccupant.occupantProvince; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantProvince').value = (_k = lotOccupancyOccupant.occupantProvince) !== null && _k !== void 0 ? _k : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPostalCode').value = lotOccupancyOccupant.occupantPostalCode; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPostalCode').value = (_l = lotOccupancyOccupant.occupantPostalCode) !== null && _l !== void 0 ? _l : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPhoneNumber').value = lotOccupancyOccupant.occupantPhoneNumber; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantPhoneNumber').value = (_m = lotOccupancyOccupant.occupantPhoneNumber) !== null && _m !== void 0 ? _m : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantEmailAddress').value = lotOccupancyOccupant.occupantEmailAddress; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantEmailAddress').value = (_o = lotOccupancyOccupant.occupantEmailAddress) !== null && _o !== void 0 ? _o : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCommentTitle').textContent = modalElement.querySelector('#lotOccupancyOccupantEdit--occupantCommentTitle').textContent =
((_a = lotOccupancyOccupant.occupantCommentTitle) !== null && _a !== void 0 ? _a : '') === '' ((_p = lotOccupancyOccupant.occupantCommentTitle) !== null && _p !== void 0 ? _p : '') === ''
? 'Comment' ? 'Comment'
: lotOccupancyOccupant.occupantCommentTitle; : (_q = lotOccupancyOccupant.occupantCommentTitle) !== null && _q !== void 0 ? _q : '';
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantComment').value = lotOccupancyOccupant.occupantComment; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantComment').value = (_r = lotOccupancyOccupant.occupantComment) !== null && _r !== void 0 ? _r : '';
}, },
onshown(modalElement, closeModalFunction) { onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped(); bulmaJS.toggleHtmlClipped();
@ -92,7 +94,7 @@ function openEditLotOccupancyOccupant(clickEvent) {
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user'; .fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`; `<i class="fas fa-fw fa-${cityssm.escapeHTML(fontAwesomeIconClass)}" aria-hidden="true"></i>`;
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _b !== void 0 ? _b : ''; .occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
if (occupantCommentTitle === '') { if (occupantCommentTitle === '') {
@ -111,9 +113,10 @@ function openEditLotOccupancyOccupant(clickEvent) {
}); });
} }
function deleteLotOccupancyOccupant(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() { function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyOccupant', { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`, {
lotOccupancyId, lotOccupancyId,
lotOccupantIndex lotOccupantIndex
}, (rawResponseJSON) => { }, (rawResponseJSON) => {
@ -125,7 +128,7 @@ function deleteLotOccupancyOccupant(clickEvent) {
} }
else { else {
bulmaJS.alert({ bulmaJS.alert({
title: 'Error Removing ' + los.escapedAliases.Occupant, title: `Error Removing ${los.escapedAliases.Occupant}`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger' contextualColorName: 'danger'
}); });
@ -136,17 +139,18 @@ function deleteLotOccupancyOccupant(clickEvent) {
title: `Remove ${los.escapedAliases.Occupant}?`, title: `Remove ${los.escapedAliases.Occupant}?`,
message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`, message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`,
okButton: { okButton: {
text: 'Yes, Remove ' + los.escapedAliases.Occupant, text: `Yes, Remove ${los.escapedAliases.Occupant}`,
callbackFunction: doDelete callbackFunction: doDelete
}, },
contextualColorName: 'warning' contextualColorName: 'warning'
}); });
} }
function renderLotOccupancyOccupants() { 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'); const occupantsContainer = document.querySelector('#container--lotOccupancyOccupants');
cityssm.clearElement(occupantsContainer); cityssm.clearElement(occupantsContainer);
if (lotOccupancyOccupants.length === 0) { if (lotOccupancyOccupants.length === 0) {
// eslint-disable-next-line no-unsanitized/property
occupantsContainer.innerHTML = `<div class="message is-warning"> occupantsContainer.innerHTML = `<div class="message is-warning">
<p class="message-body">There are no ${los.escapedAliases.occupants} associated with this record.</p> <p class="message-body">There are no ${los.escapedAliases.occupants} associated with this record.</p>
</div>`; </div>`;
@ -154,6 +158,7 @@ function renderLotOccupancyOccupants() {
} }
const tableElement = document.createElement('table'); const tableElement = document.createElement('table');
tableElement.className = 'table is-fullwidth is-striped is-hoverable'; tableElement.className = 'table is-fullwidth is-striped is-hoverable';
// eslint-disable-next-line no-unsanitized/property
tableElement.innerHTML = `<thead><tr> tableElement.innerHTML = `<thead><tr>
<th>${los.escapedAliases.Occupant}</th> <th>${los.escapedAliases.Occupant}</th>
<th>Address</th> <th>Address</th>
@ -166,56 +171,56 @@ function renderLotOccupancyOccupants() {
const tableRowElement = document.createElement('tr'); const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotOccupantIndex = tableRowElement.dataset.lotOccupantIndex =
lotOccupancyOccupant.lotOccupantIndex.toString(); lotOccupancyOccupant.lotOccupantIndex.toString();
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = tableRowElement.innerHTML =
'<td>' + '<td>' +
cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' &&
((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === '' ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === ''
? '(No Name)' ? '(No Name)'
: lotOccupancyOccupant.occupantName + : `${lotOccupancyOccupant.occupantName} ${lotOccupancyOccupant.occupantFamilyName}`) +
' ' +
lotOccupancyOccupant.occupantFamilyName) +
'<br />' + '<br />' +
('<span class="tag">' + ('<span class="tag">' +
'<i class="fas fa-fw fa-' + '<i class="fas fa-fw fa-' +
cityssm.escapeHTML(lotOccupancyOccupant.fontAwesomeIconClass) + cityssm.escapeHTML((_c = lotOccupancyOccupant.fontAwesomeIconClass) !== null && _c !== void 0 ? _c : '') +
'" aria-hidden="true"></i>' + '" aria-hidden="true"></i>' +
' <span class="ml-1">' + ' <span class="ml-1">' +
cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType) + cityssm.escapeHTML((_d = lotOccupancyOccupant.lotOccupantType) !== null && _d !== void 0 ? _d : '') +
'</span>' + '</span>' +
'</span>') + '</span>') +
'</td>' + '</td>' +
('<td>' + ('<td>' +
(((_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 : '') +
'<br />') + '<br />') +
(((_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 : '') +
'<br />') + '<br />') +
(((_e = lotOccupancyOccupant.occupantCity) !== null && _e !== void 0 ? _e : '') === '' (((_j = lotOccupancyOccupant.occupantCity) !== null && _j !== void 0 ? _j : '') === ''
? '' ? ''
: cityssm.escapeHTML(lotOccupancyOccupant.occupantCity) + ', ') + : cityssm.escapeHTML((_k = lotOccupancyOccupant.occupantCity) !== null && _k !== void 0 ? _k : '') +
cityssm.escapeHTML((_f = lotOccupancyOccupant.occupantProvince) !== null && _f !== void 0 ? _f : '') + ', ') +
cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantProvince) !== null && _l !== void 0 ? _l : '') +
'<br />' + '<br />' +
cityssm.escapeHTML((_g = lotOccupancyOccupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') + cityssm.escapeHTML((_m = lotOccupancyOccupant.occupantPostalCode) !== null && _m !== void 0 ? _m : '') +
'</td>') + '</td>') +
('<td>' + ('<td>' +
(((_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 : '') +
'<br />') + '<br />') +
(((_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 : '')) +
'</td>') + '</td>') +
('<td>' + ('<td>' +
'<span data-tooltip="' + '<span data-tooltip="' +
cityssm.escapeHTML(((_k = lotOccupancyOccupant.occupantCommentTitle) !== null && _k !== void 0 ? _k : '') === '' cityssm.escapeHTML(((_s = lotOccupancyOccupant.occupantCommentTitle) !== null && _s !== void 0 ? _s : '') === ''
? 'Comment' ? 'Comment'
: lotOccupancyOccupant.occupantCommentTitle) + : (_t = lotOccupancyOccupant.occupantCommentTitle) !== null && _t !== void 0 ? _t : '') +
'">' + '">' +
cityssm.escapeHTML((_l = lotOccupancyOccupant.occupantComment) !== null && _l !== void 0 ? _l : '') + cityssm.escapeHTML((_u = lotOccupancyOccupant.occupantComment) !== null && _u !== void 0 ? _u : '') +
'</span>' + '</span>' +
'</td>') + '</td>') +
('<td class="is-hidden-print">' + ('<td class="is-hidden-print">' +
@ -225,19 +230,17 @@ function renderLotOccupancyOccupants() {
' <span>Edit</span>' + ' <span>Edit</span>' +
'</button>') + '</button>') +
('<button class="button is-light is-danger button--delete" data-tooltip="Delete ' + ('<button class="button is-light is-danger button--delete" data-tooltip="Delete ' +
cityssm.escapeHTML(exports.aliases.occupant) + los.escapedAliases.Occupant +
'" type="button" aria-label="Delete">' + '" type="button" aria-label="Delete">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' + '<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>') + '</button>') +
'</div>' + '</div>' +
'</td>'); '</td>');
tableRowElement (_v = tableRowElement
.querySelector('.button--edit') .querySelector('.button--edit')) === null || _v === void 0 ? void 0 : _v.addEventListener('click', openEditLotOccupancyOccupant);
.addEventListener('click', openEditLotOccupancyOccupant); (_w = tableRowElement
tableRowElement .querySelector('.button--delete')) === null || _w === void 0 ? void 0 : _w.addEventListener('click', deleteLotOccupancyOccupant);
.querySelector('.button--delete') (_x = tableElement.querySelector('tbody')) === null || _x === void 0 ? void 0 : _x.append(tableRowElement);
.addEventListener('click', deleteLotOccupancyOccupant);
tableElement.querySelector('tbody').append(tableRowElement);
} }
occupantsContainer.append(tableElement); occupantsContainer.append(tableElement);
} }
@ -254,6 +257,7 @@ if (isCreate) {
if (occupantCommentTitle === '') { if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment'; occupantCommentTitle = 'Comment';
} }
;
formElement.querySelector('#lotOccupancy--occupantCommentTitle').textContent = occupantCommentTitle; formElement.querySelector('#lotOccupancy--occupantCommentTitle').textContent = occupantCommentTitle;
}); });
} }
@ -267,7 +271,7 @@ else {
let searchFormElement; let searchFormElement;
let searchResultsElement; let searchResultsElement;
function addOccupant(formOrObject) { function addOccupant(formOrObject) {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`, formOrObject, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
@ -290,12 +294,12 @@ else {
} }
let pastOccupantSearchResults = []; let pastOccupantSearchResults = [];
function addOccupantFromCopy(clickEvent) { function addOccupantFromCopy(clickEvent) {
var _a;
clickEvent.preventDefault(); clickEvent.preventDefault();
const panelBlockElement = clickEvent.currentTarget; const panelBlockElement = clickEvent.currentTarget;
const occupant = pastOccupantSearchResults[Number.parseInt(panelBlockElement.dataset.index, 10)]; const occupant = pastOccupantSearchResults[Number.parseInt(panelBlockElement.dataset.index, 10)];
const lotOccupantTypeId = panelBlockElement const lotOccupantTypeId = ((_a = panelBlockElement
.closest('.modal') .closest('.modal')) === null || _a === void 0 ? void 0 : _a.querySelector('#lotOccupancyOccupantCopy--lotOccupantTypeId')).value;
.querySelector('#lotOccupancyOccupantCopy--lotOccupantTypeId').value;
if (lotOccupantTypeId === '') { if (lotOccupantTypeId === '') {
bulmaJS.alert({ bulmaJS.alert({
title: `No ${los.escapedAliases.Occupant} Type Selected`, title: `No ${los.escapedAliases.Occupant} Type Selected`,
@ -312,16 +316,16 @@ else {
function searchOccupants(event) { function searchOccupants(event) {
event.preventDefault(); event.preventDefault();
if (searchFormElement.querySelector('#lotOccupancyOccupantCopy--searchFilter').value === '') { if (searchFormElement.querySelector('#lotOccupancyOccupantCopy--searchFilter').value === '') {
searchResultsElement.innerHTML = searchResultsElement.innerHTML = `<div class="message is-info">
'<div class="message is-info">' + <p class="message-body">Enter a partial name or address in the search field above.</p>
'<p class="message-body">Enter a partial name or address in the search field above.</p>' + </div>`;
'</div>';
return; return;
} }
// eslint-disable-next-line no-unsanitized/property
searchResultsElement.innerHTML = searchResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...'); los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doSearchPastOccupants`, searchFormElement, (rawResponseJSON) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
pastOccupantSearchResults = responseJSON.occupants; pastOccupantSearchResults = responseJSON.occupants;
const panelElement = document.createElement('div'); const panelElement = document.createElement('div');
@ -330,35 +334,27 @@ else {
const panelBlockElement = document.createElement('a'); const panelBlockElement = document.createElement('a');
panelBlockElement.className = 'panel-block is-block'; panelBlockElement.className = 'panel-block is-block';
panelBlockElement.dataset.index = index.toString(); panelBlockElement.dataset.index = index.toString();
panelBlockElement.innerHTML = // eslint-disable-next-line no-unsanitized/property
'<strong>' + panelBlockElement.innerHTML = `<strong>
cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '') + ${cityssm.escapeHTML((_a = occupant.occupantName) !== null && _a !== void 0 ? _a : '')} ${cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '')}
' ' + </strong><br />
cityssm.escapeHTML((_b = occupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') + <div class="columns">
'</strong>' + <div class="column">
'<br />' + ${cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '')}<br />
'<div class="columns">' + ${((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === ''
('<div class="column">' +
cityssm.escapeHTML((_c = occupant.occupantAddress1) !== null && _c !== void 0 ? _c : '') +
'<br />' +
(((_d = occupant.occupantAddress2) !== null && _d !== void 0 ? _d : '') === ''
? '' ? ''
: cityssm.escapeHTML(occupant.occupantAddress2) + '<br />') + : cityssm.escapeHTML((_e = occupant.occupantAddress2) !== null && _e !== void 0 ? _e : '') +
cityssm.escapeHTML((_e = occupant.occupantCity) !== null && _e !== void 0 ? _e : '') + '<br />'}${cityssm.escapeHTML((_f = occupant.occupantCity) !== null && _f !== void 0 ? _f : '')}, ${cityssm.escapeHTML((_g = occupant.occupantProvince) !== null && _g !== void 0 ? _g : '')}<br />
', ' + ${cityssm.escapeHTML((_h = occupant.occupantPostalCode) !== null && _h !== void 0 ? _h : '')}
cityssm.escapeHTML((_f = occupant.occupantProvince) !== null && _f !== void 0 ? _f : '') + </div>
'<br />' + <div class="column">
cityssm.escapeHTML((_g = occupant.occupantPostalCode) !== null && _g !== void 0 ? _g : '') + ${((_j = occupant.occupantPhoneNumber) !== null && _j !== void 0 ? _j : '') === ''
'</div>') +
('<div class="column">' +
(((_h = occupant.occupantPhoneNumber) !== null && _h !== void 0 ? _h : '') === ''
? '' ? ''
: cityssm.escapeHTML(occupant.occupantPhoneNumber) + : cityssm.escapeHTML((_k = occupant.occupantPhoneNumber) !== null && _k !== void 0 ? _k : '') +
'<br />') + '<br />'}
cityssm.escapeHTML((_j = occupant.occupantEmailAddress) !== null && _j !== void 0 ? _j : '') + ${cityssm.escapeHTML((_l = occupant.occupantEmailAddress) !== null && _l !== void 0 ? _l : '')}<br />
'<br />' + </div>
'</div>') + </div>`;
'</div>';
panelBlockElement.addEventListener('click', addOccupantFromCopy); panelBlockElement.addEventListener('click', addOccupantFromCopy);
panelElement.append(panelBlockElement); panelElement.append(panelBlockElement);
} }
@ -397,12 +393,13 @@ else {
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user'; .fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML = modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML =
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`; `<i class="fas fa-fw fa-${cityssm.escapeHTML(fontAwesomeIconClass)}" aria-hidden="true"></i>`;
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _b !== void 0 ? _b : ''; .occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
if (occupantCommentTitle === '') { if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment'; occupantCommentTitle = 'Comment';
} }
;
modalElement.querySelector('#lotOccupancyOccupantAdd--occupantCommentTitle').textContent = occupantCommentTitle; modalElement.querySelector('#lotOccupancyOccupantAdd--occupantCommentTitle').textContent = occupantCommentTitle;
}); });
addFormElement = modalElement.querySelector('#form--lotOccupancyOccupantAdd'); addFormElement = modalElement.querySelector('#form--lotOccupancyOccupantAdd');

View File

@ -112,69 +112,72 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
if (!lotOccupantTypeSelected) { if (!lotOccupantTypeSelected) {
const optionElement = document.createElement('option') const optionElement = document.createElement('option')
optionElement.value = lotOccupancyOccupant.lotOccupantTypeId!.toString() optionElement.value =
optionElement.textContent = lotOccupancyOccupant.lotOccupantType! lotOccupancyOccupant.lotOccupantTypeId?.toString() ?? ''
optionElement.textContent = lotOccupancyOccupant.lotOccupantType ?? ''
optionElement.dataset.occupantCommentTitle = optionElement.dataset.occupantCommentTitle =
lotOccupancyOccupant.occupantCommentTitle! lotOccupancyOccupant.occupantCommentTitle
optionElement.dataset.fontAwesomeIconClass = optionElement.dataset.fontAwesomeIconClass =
lotOccupancyOccupant.fontAwesomeIconClass! lotOccupancyOccupant.fontAwesomeIconClass
optionElement.selected = true optionElement.selected = true
lotOccupantTypeSelectElement.append(optionElement) lotOccupantTypeSelectElement.append(optionElement)
} }
;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--fontAwesomeIconClass' '#lotOccupancyOccupantEdit--fontAwesomeIconClass'
)!.innerHTML = ) as HTMLElement
`<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass!}" aria-hidden="true"></i>` ).innerHTML =
`<i class="fas fa-fw fa-${cityssm.escapeHTML(lotOccupancyOccupant.fontAwesomeIconClass ?? '')}" aria-hidden="true"></i>`
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantName' '#lotOccupancyOccupantEdit--occupantName'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantName! ).value = lotOccupancyOccupant.occupantName ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantFamilyName' '#lotOccupancyOccupantEdit--occupantFamilyName'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantFamilyName! ).value = lotOccupancyOccupant.occupantFamilyName ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantAddress1' '#lotOccupancyOccupantEdit--occupantAddress1'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantAddress1! ).value = lotOccupancyOccupant.occupantAddress1 ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantAddress2' '#lotOccupancyOccupantEdit--occupantAddress2'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantAddress2! ).value = lotOccupancyOccupant.occupantAddress2 ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantCity' '#lotOccupancyOccupantEdit--occupantCity'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantCity! ).value = lotOccupancyOccupant.occupantCity ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantProvince' '#lotOccupancyOccupantEdit--occupantProvince'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantProvince! ).value = lotOccupancyOccupant.occupantProvince ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantPostalCode' '#lotOccupancyOccupantEdit--occupantPostalCode'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantPostalCode! ).value = lotOccupancyOccupant.occupantPostalCode ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantPhoneNumber' '#lotOccupancyOccupantEdit--occupantPhoneNumber'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantPhoneNumber! ).value = lotOccupancyOccupant.occupantPhoneNumber ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantEmailAddress' '#lotOccupancyOccupantEdit--occupantEmailAddress'
) as HTMLInputElement ) as HTMLInputElement
).value = lotOccupancyOccupant.occupantEmailAddress! ).value = lotOccupancyOccupant.occupantEmailAddress ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantCommentTitle' '#lotOccupancyOccupantEdit--occupantCommentTitle'
@ -182,12 +185,12 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
).textContent = ).textContent =
(lotOccupancyOccupant.occupantCommentTitle ?? '') === '' (lotOccupancyOccupant.occupantCommentTitle ?? '') === ''
? 'Comment' ? 'Comment'
: lotOccupancyOccupant.occupantCommentTitle! : lotOccupancyOccupant.occupantCommentTitle ?? ''
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--occupantComment' '#lotOccupancyOccupantEdit--occupantComment'
) as HTMLTextAreaElement ) as HTMLTextAreaElement
).value = lotOccupancyOccupant.occupantComment! ).value = lotOccupancyOccupant.occupantComment ?? ''
}, },
onshown(modalElement, closeModalFunction) { onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped() bulmaJS.toggleHtmlClipped()
@ -203,10 +206,12 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
lotOccupantTypeIdElement.selectedOptions[0].dataset lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass ?? 'user' .fontAwesomeIconClass ?? 'user'
;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantEdit--fontAwesomeIconClass' '#lotOccupancyOccupantEdit--fontAwesomeIconClass'
)!.innerHTML = ) as HTMLElement
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>` ).innerHTML =
`<i class="fas fa-fw fa-${cityssm.escapeHTML(fontAwesomeIconClass)}" aria-hidden="true"></i>`
let occupantCommentTitle = let occupantCommentTitle =
lotOccupantTypeIdElement.selectedOptions[0].dataset lotOccupantTypeIdElement.selectedOptions[0].dataset
@ -222,7 +227,7 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
).textContent = occupantCommentTitle ).textContent = occupantCommentTitle
}) })
editFormElement = modalElement.querySelector('form')! editFormElement = modalElement.querySelector('form') as HTMLFormElement
editFormElement.addEventListener('submit', editOccupant) editFormElement.addEventListener('submit', editOccupant)
editCloseModalFunction = closeModalFunction editCloseModalFunction = closeModalFunction
@ -236,11 +241,11 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
function deleteLotOccupancyOccupant(clickEvent: Event): void { function deleteLotOccupancyOccupant(clickEvent: Event): void {
const lotOccupantIndex = (clickEvent.currentTarget as HTMLElement).closest( const lotOccupantIndex = (clickEvent.currentTarget as HTMLElement).closest(
'tr' 'tr'
)!.dataset.lotOccupantIndex )?.dataset.lotOccupantIndex
function doDelete(): void { function doDelete(): void {
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyOccupant', `${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`,
{ {
lotOccupancyId, lotOccupancyId,
lotOccupantIndex lotOccupantIndex
@ -257,7 +262,7 @@ function deleteLotOccupancyOccupant(clickEvent: Event): void {
renderLotOccupancyOccupants() renderLotOccupancyOccupants()
} else { } else {
bulmaJS.alert({ bulmaJS.alert({
title: 'Error Removing ' + los.escapedAliases.Occupant, title: `Error Removing ${los.escapedAliases.Occupant}`,
message: responseJSON.errorMessage ?? '', message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger' contextualColorName: 'danger'
}) })
@ -270,7 +275,7 @@ function deleteLotOccupancyOccupant(clickEvent: Event): void {
title: `Remove ${los.escapedAliases.Occupant}?`, title: `Remove ${los.escapedAliases.Occupant}?`,
message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`, message: `Are you sure you want to remove this ${los.escapedAliases.occupant}?`,
okButton: { okButton: {
text: 'Yes, Remove ' + los.escapedAliases.Occupant, text: `Yes, Remove ${los.escapedAliases.Occupant}`,
callbackFunction: doDelete callbackFunction: doDelete
}, },
contextualColorName: 'warning' contextualColorName: 'warning'
@ -285,6 +290,7 @@ function renderLotOccupancyOccupants(): void {
cityssm.clearElement(occupantsContainer) cityssm.clearElement(occupantsContainer)
if (lotOccupancyOccupants.length === 0) { if (lotOccupancyOccupants.length === 0) {
// eslint-disable-next-line no-unsanitized/property
occupantsContainer.innerHTML = `<div class="message is-warning"> occupantsContainer.innerHTML = `<div class="message is-warning">
<p class="message-body">There are no ${los.escapedAliases.occupants} associated with this record.</p> <p class="message-body">There are no ${los.escapedAliases.occupants} associated with this record.</p>
</div>` </div>`
@ -295,6 +301,7 @@ function renderLotOccupancyOccupants(): void {
const tableElement = document.createElement('table') const tableElement = document.createElement('table')
tableElement.className = 'table is-fullwidth is-striped is-hoverable' tableElement.className = 'table is-fullwidth is-striped is-hoverable'
// eslint-disable-next-line no-unsanitized/property
tableElement.innerHTML = `<thead><tr> tableElement.innerHTML = `<thead><tr>
<th>${los.escapedAliases.Occupant}</th> <th>${los.escapedAliases.Occupant}</th>
<th>Address</th> <th>Address</th>
@ -309,38 +316,38 @@ function renderLotOccupancyOccupants(): void {
tableRowElement.dataset.lotOccupantIndex = tableRowElement.dataset.lotOccupantIndex =
lotOccupancyOccupant.lotOccupantIndex!.toString() lotOccupancyOccupant.lotOccupantIndex!.toString()
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = tableRowElement.innerHTML =
'<td>' + '<td>' +
cityssm.escapeHTML( cityssm.escapeHTML(
(lotOccupancyOccupant.occupantName ?? '') === '' && (lotOccupancyOccupant.occupantName ?? '') === '' &&
(lotOccupancyOccupant.occupantFamilyName ?? '') === '' (lotOccupancyOccupant.occupantFamilyName ?? '') === ''
? '(No Name)' ? '(No Name)'
: lotOccupancyOccupant.occupantName! + : `${lotOccupancyOccupant.occupantName} ${lotOccupancyOccupant.occupantFamilyName}`
' ' +
lotOccupancyOccupant.occupantFamilyName!
) + ) +
'<br />' + '<br />' +
('<span class="tag">' + ('<span class="tag">' +
'<i class="fas fa-fw fa-' + '<i class="fas fa-fw fa-' +
cityssm.escapeHTML(lotOccupancyOccupant.fontAwesomeIconClass!) + cityssm.escapeHTML(lotOccupancyOccupant.fontAwesomeIconClass ?? '') +
'" aria-hidden="true"></i>' + '" aria-hidden="true"></i>' +
' <span class="ml-1">' + ' <span class="ml-1">' +
cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType!) + cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType ?? '') +
'</span>' + '</span>' +
'</span>') + '</span>') +
'</td>' + '</td>' +
('<td>' + ('<td>' +
((lotOccupancyOccupant.occupantAddress1 ?? '') === '' ((lotOccupancyOccupant.occupantAddress1 ?? '') === ''
? '' ? ''
: cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1!) + : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1 ?? '') +
'<br />') + '<br />') +
((lotOccupancyOccupant.occupantAddress2 ?? '') === '' ((lotOccupancyOccupant.occupantAddress2 ?? '') === ''
? '' ? ''
: cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress2!) + : cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress2 ?? '') +
'<br />') + '<br />') +
((lotOccupancyOccupant.occupantCity ?? '') === '' ((lotOccupancyOccupant.occupantCity ?? '') === ''
? '' ? ''
: cityssm.escapeHTML(lotOccupancyOccupant.occupantCity!) + ', ') + : cityssm.escapeHTML(lotOccupancyOccupant.occupantCity ?? '') +
', ') +
cityssm.escapeHTML(lotOccupancyOccupant.occupantProvince ?? '') + cityssm.escapeHTML(lotOccupancyOccupant.occupantProvince ?? '') +
'<br />' + '<br />' +
cityssm.escapeHTML(lotOccupancyOccupant.occupantPostalCode ?? '') + cityssm.escapeHTML(lotOccupancyOccupant.occupantPostalCode ?? '') +
@ -348,18 +355,20 @@ function renderLotOccupancyOccupants(): void {
('<td>' + ('<td>' +
((lotOccupancyOccupant.occupantPhoneNumber ?? '') === '' ((lotOccupancyOccupant.occupantPhoneNumber ?? '') === ''
? '' ? ''
: cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber!) + : cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber ?? '') +
'<br />') + '<br />') +
((lotOccupancyOccupant.occupantEmailAddress ?? '') === '' ((lotOccupancyOccupant.occupantEmailAddress ?? '') === ''
? '' ? ''
: cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress!)) + : cityssm.escapeHTML(
lotOccupancyOccupant.occupantEmailAddress ?? ''
)) +
'</td>') + '</td>') +
('<td>' + ('<td>' +
'<span data-tooltip="' + '<span data-tooltip="' +
cityssm.escapeHTML( cityssm.escapeHTML(
(lotOccupancyOccupant.occupantCommentTitle ?? '') === '' (lotOccupancyOccupant.occupantCommentTitle ?? '') === ''
? 'Comment' ? 'Comment'
: lotOccupancyOccupant.occupantCommentTitle! : lotOccupancyOccupant.occupantCommentTitle ?? ''
) + ) +
'">' + '">' +
cityssm.escapeHTML(lotOccupancyOccupant.occupantComment ?? '') + cityssm.escapeHTML(lotOccupancyOccupant.occupantComment ?? '') +
@ -372,7 +381,7 @@ function renderLotOccupancyOccupants(): void {
' <span>Edit</span>' + ' <span>Edit</span>' +
'</button>') + '</button>') +
('<button class="button is-light is-danger button--delete" data-tooltip="Delete ' + ('<button class="button is-light is-danger button--delete" data-tooltip="Delete ' +
cityssm.escapeHTML(exports.aliases.occupant) + los.escapedAliases.Occupant +
'" type="button" aria-label="Delete">' + '" type="button" aria-label="Delete">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' + '<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>') + '</button>') +
@ -380,14 +389,14 @@ function renderLotOccupancyOccupants(): void {
'</td>') '</td>')
tableRowElement tableRowElement
.querySelector('.button--edit')! .querySelector('.button--edit')
.addEventListener('click', openEditLotOccupancyOccupant) ?.addEventListener('click', openEditLotOccupancyOccupant)
tableRowElement tableRowElement
.querySelector('.button--delete')! .querySelector('.button--delete')
.addEventListener('click', deleteLotOccupancyOccupant) ?.addEventListener('click', deleteLotOccupancyOccupant)
tableElement.querySelector('tbody')!.append(tableRowElement) tableElement.querySelector('tbody')?.append(tableRowElement)
} }
occupantsContainer.append(tableElement) occupantsContainer.append(tableElement)
@ -413,9 +422,11 @@ if (isCreate) {
occupantCommentTitle = 'Comment' occupantCommentTitle = 'Comment'
} }
;(
formElement.querySelector( formElement.querySelector(
'#lotOccupancy--occupantCommentTitle' '#lotOccupancy--occupantCommentTitle'
)!.textContent = occupantCommentTitle ) as HTMLElement
).textContent = occupantCommentTitle
}) })
} else { } else {
renderLotOccupancyOccupants() renderLotOccupancyOccupants()
@ -435,17 +446,17 @@ document
formOrObject: HTMLFormElement | recordTypes.LotOccupancyOccupant formOrObject: HTMLFormElement | recordTypes.LotOccupancyOccupant
): void { ): void {
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', `${los.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`,
formOrObject, formOrObject,
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
success: boolean success: boolean
errorMessage?: string errorMessage?: string
lotOccupancyOccupants?: recordTypes.LotOccupancyOccupant[] lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[]
} }
if (responseJSON.success) { if (responseJSON.success) {
lotOccupancyOccupants = responseJSON.lotOccupancyOccupants! lotOccupancyOccupants = responseJSON.lotOccupancyOccupants
addCloseModalFunction() addCloseModalFunction()
renderLotOccupancyOccupants() renderLotOccupancyOccupants()
} else { } else {
@ -478,8 +489,8 @@ document
const lotOccupantTypeId = ( const lotOccupantTypeId = (
panelBlockElement panelBlockElement
.closest('.modal')! .closest('.modal')
.querySelector( ?.querySelector(
'#lotOccupancyOccupantCopy--lotOccupantTypeId' '#lotOccupancyOccupantCopy--lotOccupantTypeId'
) as HTMLSelectElement ) as HTMLSelectElement
).value ).value
@ -507,19 +518,19 @@ document
) as HTMLInputElement ) as HTMLInputElement
).value === '' ).value === ''
) { ) {
searchResultsElement.innerHTML = searchResultsElement.innerHTML = `<div class="message is-info">
'<div class="message is-info">' + <p class="message-body">Enter a partial name or address in the search field above.</p>
'<p class="message-body">Enter a partial name or address in the search field above.</p>' + </div>`
'</div>'
return return
} }
// eslint-disable-next-line no-unsanitized/property
searchResultsElement.innerHTML = searchResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...') los.getLoadingParagraphHTML('Searching...')
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', `${los.urlPrefix}/lotOccupancies/doSearchPastOccupants`,
searchFormElement, searchFormElement,
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
@ -536,35 +547,31 @@ document
panelBlockElement.className = 'panel-block is-block' panelBlockElement.className = 'panel-block is-block'
panelBlockElement.dataset.index = index.toString() panelBlockElement.dataset.index = index.toString()
panelBlockElement.innerHTML = // eslint-disable-next-line no-unsanitized/property
'<strong>' + panelBlockElement.innerHTML = `<strong>
cityssm.escapeHTML(occupant.occupantName ?? '') + ${cityssm.escapeHTML(occupant.occupantName ?? '')} ${cityssm.escapeHTML(occupant.occupantFamilyName ?? '')}
' ' + </strong><br />
cityssm.escapeHTML(occupant.occupantFamilyName ?? '') + <div class="columns">
'</strong>' + <div class="column">
'<br />' + ${cityssm.escapeHTML(occupant.occupantAddress1 ?? '')}<br />
'<div class="columns">' + ${
('<div class="column">' + (occupant.occupantAddress2 ?? '') === ''
cityssm.escapeHTML(occupant.occupantAddress1 ?? '') +
'<br />' +
((occupant.occupantAddress2 ?? '') === ''
? '' ? ''
: cityssm.escapeHTML(occupant.occupantAddress2!) + '<br />') + : cityssm.escapeHTML(occupant.occupantAddress2 ?? '') +
cityssm.escapeHTML(occupant.occupantCity ?? '') + '<br />'
', ' + }${cityssm.escapeHTML(occupant.occupantCity ?? '')}, ${cityssm.escapeHTML(occupant.occupantProvince ?? '')}<br />
cityssm.escapeHTML(occupant.occupantProvince ?? '') + ${cityssm.escapeHTML(occupant.occupantPostalCode ?? '')}
'<br />' + </div>
cityssm.escapeHTML(occupant.occupantPostalCode ?? '') + <div class="column">
'</div>') + ${
('<div class="column">' + (occupant.occupantPhoneNumber ?? '') === ''
((occupant.occupantPhoneNumber ?? '') === ''
? '' ? ''
: cityssm.escapeHTML(occupant.occupantPhoneNumber!) + : cityssm.escapeHTML(occupant.occupantPhoneNumber ?? '') +
'<br />') + '<br />'
cityssm.escapeHTML(occupant.occupantEmailAddress ?? '') + }
'<br />' + ${cityssm.escapeHTML(occupant.occupantEmailAddress ?? '')}<br />
'</div>') + </div>
'</div>' </div>`
panelBlockElement.addEventListener('click', addOccupantFromCopy) panelBlockElement.addEventListener('click', addOccupantFromCopy)
@ -614,12 +621,12 @@ document
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantAdd--occupantCity' '#lotOccupancyOccupantAdd--occupantCity'
) as HTMLInputElement ) as HTMLInputElement
).value = exports.occupantCityDefault ).value = exports.occupantCityDefault as string
;( ;(
modalElement.querySelector( modalElement.querySelector(
'#lotOccupancyOccupantAdd--occupantProvince' '#lotOccupancyOccupantAdd--occupantProvince'
) as HTMLInputElement ) as HTMLInputElement
).value = exports.occupantProvinceDefault ).value = exports.occupantProvinceDefault as string
}, },
onshown(modalElement, closeModalFunction) { onshown(modalElement, closeModalFunction) {
bulmaJS.toggleHtmlClipped() bulmaJS.toggleHtmlClipped()
@ -636,10 +643,10 @@ document
lotOccupantTypeIdElement.selectedOptions[0].dataset lotOccupantTypeIdElement.selectedOptions[0].dataset
.fontAwesomeIconClass ?? 'user' .fontAwesomeIconClass ?? 'user'
modalElement.querySelector( ;(modalElement.querySelector(
'#lotOccupancyOccupantAdd--fontAwesomeIconClass' '#lotOccupancyOccupantAdd--fontAwesomeIconClass'
)!.innerHTML = ) as HTMLElement).innerHTML =
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>` `<i class="fas fa-fw fa-${cityssm.escapeHTML(fontAwesomeIconClass)}" aria-hidden="true"></i>`
let occupantCommentTitle = let occupantCommentTitle =
lotOccupantTypeIdElement.selectedOptions[0].dataset lotOccupantTypeIdElement.selectedOptions[0].dataset
@ -649,9 +656,9 @@ document
occupantCommentTitle = 'Comment' occupantCommentTitle = 'Comment'
} }
modalElement.querySelector( ;(modalElement.querySelector(
'#lotOccupancyOccupantAdd--occupantCommentTitle' '#lotOccupancyOccupantAdd--occupantCommentTitle'
)!.textContent = occupantCommentTitle ) as HTMLElement).textContent = occupantCommentTitle
}) })
addFormElement = modalElement.querySelector( addFormElement = modalElement.querySelector(

File diff suppressed because one or more lines are too long