diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js index a5db325e..82581274 100644 --- a/public-typescript/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit.js @@ -476,8 +476,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); let editCloseModalFunction; function editOccupant(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, (responseJSON) => { + cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants; editCloseModalFunction(); @@ -506,6 +507,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); optionElement.textContent = lotOccupantType.lotOccupantType; optionElement.dataset.occupantCommentTitle = lotOccupantType.occupantCommentTitle; + optionElement.dataset.fontAwesomeIconClass = + lotOccupantType.fontAwesomeIconClass; if (lotOccupantType.lotOccupantTypeId === lotOccupancyOccupant.lotOccupantTypeId) { optionElement.selected = true; @@ -519,10 +522,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); optionElement.textContent = lotOccupancyOccupant.lotOccupantType; optionElement.dataset.occupantCommentTitle = lotOccupancyOccupant.occupantCommentTitle; + optionElement.dataset.fontAwesomeIconClass = + lotOccupancyOccupant.fontAwesomeIconClass; optionElement.selected = true; lotOccupantTypeSelectElement.append(optionElement); } - ; + modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = ``; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = lotOccupancyOccupant.occupantAddress2; @@ -542,9 +547,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); const lotOccupantTypeIdElement = modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupantTypeId'); lotOccupantTypeIdElement.focus(); lotOccupantTypeIdElement.addEventListener('change', () => { - var _a; - let occupantCommentTitle = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset - .occupantCommentTitle) !== null && _a !== void 0 ? _a : ''; + var _a, _b; + 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 === '') { occupantCommentTitle = 'Comment'; } @@ -566,8 +574,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyOccupant', { lotOccupancyId, lotOccupantIndex - }, (responseJSON) => { + }, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants; renderLotOccupancyOccupants(); @@ -706,8 +715,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); let searchFormElement; let searchResultsElement; function addOccupant(formOrObject) { - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, (responseJSON) => { + cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants; addCloseModalFunction(); @@ -758,8 +768,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); } searchResultsElement.innerHTML = los.getLoadingParagraphHTML('Searching...'); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (responseJSON) => { + cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (rawResponseJSON) => { var _a, _b, _c, _d, _e, _f, _g, _h; + const responseJSON = rawResponseJSON; pastOccupantSearchResults = responseJSON.occupants; const panelElement = document.createElement('div'); panelElement.className = 'panel'; @@ -813,6 +824,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); optionElement.textContent = lotOccupantType.lotOccupantType; optionElement.dataset.occupantCommentTitle = lotOccupantType.occupantCommentTitle; + optionElement.dataset.fontAwesomeIconClass = + lotOccupantType.fontAwesomeIconClass; lotOccupantTypeSelectElement.append(optionElement); lotOccupantTypeCopySelectElement.append(optionElement.cloneNode(true)); } @@ -826,9 +839,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); const lotOccupantTypeIdElement = modalElement.querySelector('#lotOccupancyOccupantAdd--lotOccupantTypeId'); lotOccupantTypeIdElement.focus(); lotOccupantTypeIdElement.addEventListener('change', () => { - var _a; - let occupantCommentTitle = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset - .occupantCommentTitle) !== null && _a !== void 0 ? _a : ''; + var _a, _b; + 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'; } diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js index 90969c3d..a617f417 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.js @@ -14,8 +14,9 @@ function openEditLotOccupancyOccupant(clickEvent) { let editCloseModalFunction; function editOccupant(submitEvent) { submitEvent.preventDefault(); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, (responseJSON) => { + cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants; editCloseModalFunction(); @@ -44,6 +45,8 @@ function openEditLotOccupancyOccupant(clickEvent) { optionElement.textContent = lotOccupantType.lotOccupantType; optionElement.dataset.occupantCommentTitle = lotOccupantType.occupantCommentTitle; + optionElement.dataset.fontAwesomeIconClass = + lotOccupantType.fontAwesomeIconClass; if (lotOccupantType.lotOccupantTypeId === lotOccupancyOccupant.lotOccupantTypeId) { optionElement.selected = true; @@ -57,10 +60,12 @@ function openEditLotOccupancyOccupant(clickEvent) { optionElement.textContent = lotOccupancyOccupant.lotOccupantType; optionElement.dataset.occupantCommentTitle = lotOccupancyOccupant.occupantCommentTitle; + optionElement.dataset.fontAwesomeIconClass = + lotOccupancyOccupant.fontAwesomeIconClass; optionElement.selected = true; lotOccupantTypeSelectElement.append(optionElement); } - ; + modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = ``; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1; modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress2').value = lotOccupancyOccupant.occupantAddress2; @@ -80,9 +85,12 @@ function openEditLotOccupancyOccupant(clickEvent) { const lotOccupantTypeIdElement = modalElement.querySelector('#lotOccupancyOccupantEdit--lotOccupantTypeId'); lotOccupantTypeIdElement.focus(); lotOccupantTypeIdElement.addEventListener('change', () => { - var _a; - let occupantCommentTitle = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset - .occupantCommentTitle) !== null && _a !== void 0 ? _a : ''; + var _a, _b; + 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 === '') { occupantCommentTitle = 'Comment'; } @@ -104,8 +112,9 @@ function deleteLotOccupancyOccupant(clickEvent) { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyOccupant', { lotOccupancyId, lotOccupantIndex - }, (responseJSON) => { + }, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants; renderLotOccupancyOccupants(); @@ -244,8 +253,9 @@ else { let searchFormElement; let searchResultsElement; function addOccupant(formOrObject) { - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, (responseJSON) => { + cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, (rawResponseJSON) => { var _a; + const responseJSON = rawResponseJSON; if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants; addCloseModalFunction(); @@ -296,8 +306,9 @@ else { } searchResultsElement.innerHTML = los.getLoadingParagraphHTML('Searching...'); - cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (responseJSON) => { + cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, (rawResponseJSON) => { var _a, _b, _c, _d, _e, _f, _g, _h; + const responseJSON = rawResponseJSON; pastOccupantSearchResults = responseJSON.occupants; const panelElement = document.createElement('div'); panelElement.className = 'panel'; @@ -351,6 +362,8 @@ else { optionElement.textContent = lotOccupantType.lotOccupantType; optionElement.dataset.occupantCommentTitle = lotOccupantType.occupantCommentTitle; + optionElement.dataset.fontAwesomeIconClass = + lotOccupantType.fontAwesomeIconClass; lotOccupantTypeSelectElement.append(optionElement); lotOccupantTypeCopySelectElement.append(optionElement.cloneNode(true)); } @@ -364,9 +377,12 @@ else { const lotOccupantTypeIdElement = modalElement.querySelector('#lotOccupancyOccupantAdd--lotOccupantTypeId'); lotOccupantTypeIdElement.focus(); lotOccupantTypeIdElement.addEventListener('change', () => { - var _a; - let occupantCommentTitle = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset - .occupantCommentTitle) !== null && _a !== void 0 ? _a : ''; + var _a, _b; + 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'; } diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts index fb62080b..d681e56b 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts @@ -42,11 +42,13 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { cityssm.postJSON( los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, - (responseJSON: { - success: boolean - errorMessage?: string - lotOccupancyOccupants?: recordTypes.LotOccupancyOccupant[] - }) => { + (rawResponseJSON) => { + const responseJSON = rawResponseJSON as { + success: boolean + errorMessage?: string + lotOccupancyOccupants?: recordTypes.LotOccupancyOccupant[] + } + if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants! editCloseModalFunction() @@ -86,9 +88,13 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { const optionElement = document.createElement('option') optionElement.value = lotOccupantType.lotOccupantTypeId.toString() optionElement.textContent = lotOccupantType.lotOccupantType + optionElement.dataset.occupantCommentTitle = lotOccupantType.occupantCommentTitle + optionElement.dataset.fontAwesomeIconClass = + lotOccupantType.fontAwesomeIconClass + if ( lotOccupantType.lotOccupantTypeId === lotOccupancyOccupant.lotOccupantTypeId @@ -105,13 +111,21 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { optionElement.value = lotOccupancyOccupant.lotOccupantTypeId!.toString() optionElement.textContent = lotOccupancyOccupant.lotOccupantType! + optionElement.dataset.occupantCommentTitle = lotOccupancyOccupant.occupantCommentTitle! + + optionElement.dataset.fontAwesomeIconClass = + lotOccupancyOccupant.fontAwesomeIconClass! + optionElement.selected = true lotOccupantTypeSelectElement.append(optionElement) } + modalElement.querySelector( + '#lotOccupancyOccupantEdit--fontAwesomeIconClass' + )!.innerHTML = `` ;( modalElement.querySelector( '#lotOccupancyOccupantEdit--occupantName' @@ -176,6 +190,14 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { lotOccupantTypeIdElement.focus() lotOccupantTypeIdElement.addEventListener('change', () => { + const fontAwesomeIconClass = + lotOccupantTypeIdElement.selectedOptions[0].dataset + .fontAwesomeIconClass ?? 'user' + + modalElement.querySelector( + '#lotOccupancyOccupantEdit--fontAwesomeIconClass' + )!.innerHTML = `` + let occupantCommentTitle = lotOccupantTypeIdElement.selectedOptions[0].dataset .occupantCommentTitle ?? '' @@ -213,11 +235,13 @@ function deleteLotOccupancyOccupant(clickEvent: Event): void { lotOccupancyId, lotOccupantIndex }, - (responseJSON: { - success: boolean - errorMessage?: string - lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] - }) => { + (rawResponseJSON) => { + const responseJSON = rawResponseJSON as { + success: boolean + errorMessage?: string + lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] + } + if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants renderLotOccupancyOccupants() @@ -389,11 +413,13 @@ document cityssm.postJSON( los.urlPrefix + '/lotOccupancies/doAddLotOccupancyOccupant', formOrObject, - (responseJSON: { - success: boolean - errorMessage?: string - lotOccupancyOccupants?: recordTypes.LotOccupancyOccupant[] - }) => { + (rawResponseJSON) => { + const responseJSON = rawResponseJSON as { + success: boolean + errorMessage?: string + lotOccupancyOccupants?: recordTypes.LotOccupancyOccupant[] + } + if (responseJSON.success) { lotOccupancyOccupants = responseJSON.lotOccupancyOccupants! addCloseModalFunction() @@ -471,7 +497,11 @@ document cityssm.postJSON( los.urlPrefix + '/lotOccupancies/doSearchPastOccupants', searchFormElement, - (responseJSON: { occupants: recordTypes.LotOccupancyOccupant[] }) => { + (rawResponseJSON) => { + const responseJSON = rawResponseJSON as { + occupants: recordTypes.LotOccupancyOccupant[] + } + pastOccupantSearchResults = responseJSON.occupants const panelElement = document.createElement('div') @@ -542,9 +572,13 @@ document const optionElement = document.createElement('option') optionElement.value = lotOccupantType.lotOccupantTypeId.toString() optionElement.textContent = lotOccupantType.lotOccupantType + optionElement.dataset.occupantCommentTitle = lotOccupantType.occupantCommentTitle + optionElement.dataset.fontAwesomeIconClass = + lotOccupantType.fontAwesomeIconClass + lotOccupantTypeSelectElement.append(optionElement) lotOccupantTypeCopySelectElement.append(optionElement.cloneNode(true)) @@ -572,6 +606,14 @@ document lotOccupantTypeIdElement.focus() lotOccupantTypeIdElement.addEventListener('change', () => { + const fontAwesomeIconClass = + lotOccupantTypeIdElement.selectedOptions[0].dataset + .fontAwesomeIconClass ?? 'user' + + modalElement.querySelector( + '#lotOccupancyOccupantAdd--fontAwesomeIconClass' + )!.innerHTML = `` + let occupantCommentTitle = lotOccupantTypeIdElement.selectedOptions[0].dataset .occupantCommentTitle ?? '' diff --git a/public/html/lotOccupancy-addOccupant.html b/public/html/lotOccupancy-addOccupant.html index 4737842d..ab29c518 100644 --- a/public/html/lotOccupancy-addOccupant.html +++ b/public/html/lotOccupancy-addOccupant.html @@ -15,10 +15,20 @@
@@ -31,23 +41,28 @@ type="hidden" value="" /> -
- -
+ +
+
+
+ + + +