From 984390aaf4428d3472005d9091578a58c9f5d89a Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Thu, 12 Jan 2023 13:44:30 -0500 Subject: [PATCH] linting --- docs/adminFees.md | 12 ++--- public-typescript/lotOccupancySearch.js | 44 +++++++-------- public-typescript/lotOccupancySearch.ts | 56 ++++++++++---------- public-typescript/lotSearch.js | 16 +++--- public-typescript/lotSearch.ts | 14 +++-- public/javascripts/lotOccupancySearch.min.js | 2 +- public/javascripts/lotSearch.min.js | 2 +- 7 files changed, 73 insertions(+), 73 deletions(-) diff --git a/docs/adminFees.md b/docs/adminFees.md index 82668a8f..91134625 100644 --- a/docs/adminFees.md +++ b/docs/adminFees.md @@ -9,13 +9,11 @@ Fees can be applied to [occupancy records](lotOccupancies.md). Each fee includes the following properties. -- A category, name, and description. - -- Filter options by occupancy type and/or lot type. - -- Fee and tax amounts. +- A category, name, and description. +- Filter options by occupancy type and/or lot type. +- Fee and tax amounts. ## Related Links -- [Occupancy Type Management](adminOccupancyTypes.md) -- [Lot Type Management](adminLotTypes.md) +- [Occupancy Type Management](adminOccupancyTypes.md) +- [Lot Type Management](adminLotTypes.md) diff --git a/public-typescript/lotOccupancySearch.js b/public-typescript/lotOccupancySearch.js index 0e9da8e6..dfecbf2c 100644 --- a/public-typescript/lotOccupancySearch.js +++ b/public-typescript/lotOccupancySearch.js @@ -8,13 +8,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10); const offsetElement = document.querySelector('#searchFilter--offset'); function renderLotOccupancies(responseJSON) { - var _a, _b; + var _a, _b, _c, _d, _e, _f, _g; if (responseJSON.lotOccupancies.length === 0) { searchResultsContainerElement.innerHTML = `
-

- There are no ${los.escapedAliases.occupancy} records that meet the search criteria. -

-
`; +

+ There are no ${los.escapedAliases.occupancy} records that meet the search criteria. +

+ `; return; } const resultsTbodyElement = document.createElement('tbody'); @@ -25,29 +25,31 @@ Object.defineProperty(exports, "__esModule", { value: true }); (lotOccupancy.occupancyEndDateString === '' || lotOccupancy.occupancyEndDateString >= nowDateString)) { occupancyTimeHTML = ` - - `; + + `; } else if (lotOccupancy.occupancyStartDateString > nowDateString) { occupancyTimeHTML = ` - - `; + + `; } else { occupancyTimeHTML = ` - - `; + + `; } let occupantsHTML = ''; for (const occupant of lotOccupancy.lotOccupancyOccupants) { occupantsHTML += '' + (' ') + - cityssm.escapeHTML(occupant.occupantName || '') + + cityssm.escapeHTML((_c = occupant.occupantName) !== null && _c !== void 0 ? _c : '') + '
'; } resultsTbodyElement.insertAdjacentHTML('beforeend', '' + @@ -62,7 +64,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); ('' + (lotOccupancy.lotName ? '' + @@ -73,7 +75,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); ')') + '
' + ('' + - cityssm.escapeHTML(lotOccupancy.mapName || '') + + cityssm.escapeHTML((_e = lotOccupancy.mapName) !== null && _e !== void 0 ? _e : '') + '') + '') + ('' + lotOccupancy.occupancyStartDateString + '') + @@ -113,13 +115,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); .querySelector('table') .append(resultsTbodyElement); searchResultsContainerElement.insertAdjacentHTML('beforeend', los.getSearchResultsPagerHTML(limit, responseJSON.offset, responseJSON.count)); - (_a = searchResultsContainerElement - .querySelector("button[data-page='previous']")) === null || _a === void 0 ? void 0 : _a.addEventListener('click', previousAndGetLotOccupancies); - (_b = searchResultsContainerElement - .querySelector("button[data-page='next']")) === null || _b === void 0 ? void 0 : _b.addEventListener('click', nextAndGetLotOccupancies); + (_f = searchResultsContainerElement + .querySelector("button[data-page='previous']")) === null || _f === void 0 ? void 0 : _f.addEventListener('click', previousAndGetLotOccupancies); + (_g = searchResultsContainerElement + .querySelector("button[data-page='next']")) === null || _g === void 0 ? void 0 : _g.addEventListener('click', nextAndGetLotOccupancies); } function getLotOccupancies() { - searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${exports.aliases.occupancies}...`); + searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Occupancies}...`); cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFilterFormElement, renderLotOccupancies); } function resetOffsetAndGetLotOccupancies() { diff --git a/public-typescript/lotOccupancySearch.ts b/public-typescript/lotOccupancySearch.ts index d80516e2..4b05de8a 100644 --- a/public-typescript/lotOccupancySearch.ts +++ b/public-typescript/lotOccupancySearch.ts @@ -6,7 +6,6 @@ import type * as recordTypes from '../types/recordTypes' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' declare const cityssm: cityssmGlobal - ;(() => { const los = exports.los as globalTypes.LOS @@ -31,13 +30,13 @@ declare const cityssm: cityssmGlobal count: number offset: number lotOccupancies: recordTypes.LotOccupancy[] - }) { + }): void { if (responseJSON.lotOccupancies.length === 0) { searchResultsContainerElement.innerHTML = `
-

- There are no ${los.escapedAliases.occupancy} records that meet the search criteria. -

-
` +

+ There are no ${los.escapedAliases.occupancy} records that meet the search criteria. +

+ ` return } @@ -55,16 +54,16 @@ declare const cityssm: cityssmGlobal lotOccupancy.occupancyEndDateString! >= nowDateString) ) { occupancyTimeHTML = ` - - ` + + ` } else if (lotOccupancy.occupancyStartDateString! > nowDateString) { occupancyTimeHTML = ` - - ` + + ` } else { occupancyTimeHTML = ` - - ` + + ` } let occupantsHTML = '' @@ -72,12 +71,16 @@ declare const cityssm: cityssmGlobal for (const occupant of lotOccupancy.lotOccupancyOccupants!) { occupantsHTML += '' + (' ') + - cityssm.escapeHTML(occupant.occupantName || '') + + cityssm.escapeHTML(occupant.occupantName ?? '') + '
' } @@ -87,7 +90,7 @@ declare const cityssm: cityssmGlobal ('' + occupancyTimeHTML + '') + ('' + '
' + cityssm.escapeHTML(lotOccupancy.occupancyType as string) + '' + @@ -95,9 +98,9 @@ declare const cityssm: cityssmGlobal ('' + (lotOccupancy.lotName ? '' + cityssm.escapeHTML(lotOccupancy.lotName) + '' @@ -106,7 +109,7 @@ declare const cityssm: cityssmGlobal ')') + '
' + ('' + - cityssm.escapeHTML(lotOccupancy.mapName || '') + + cityssm.escapeHTML(lotOccupancy.mapName ?? '') + '') + '') + ('' + lotOccupancy.occupancyStartDateString + '') + @@ -167,9 +170,9 @@ declare const cityssm: cityssmGlobal ?.addEventListener('click', nextAndGetLotOccupancies) } - function getLotOccupancies() { + function getLotOccupancies(): void { searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML( - `Loading ${exports.aliases.occupancies}...` + `Loading ${los.escapedAliases.Occupancies}...` ) cityssm.postJSON( @@ -179,12 +182,12 @@ declare const cityssm: cityssmGlobal ) } - function resetOffsetAndGetLotOccupancies() { + function resetOffsetAndGetLotOccupancies(): void { offsetElement.value = '0' getLotOccupancies() } - function previousAndGetLotOccupancies() { + function previousAndGetLotOccupancies(): void { offsetElement.value = Math.max( Number.parseInt(offsetElement.value, 10) - limit, 0 @@ -192,16 +195,15 @@ declare const cityssm: cityssmGlobal getLotOccupancies() } - function nextAndGetLotOccupancies() { + function nextAndGetLotOccupancies(): void { offsetElement.value = ( Number.parseInt(offsetElement.value, 10) + limit ).toString() getLotOccupancies() } - const filterElements = searchFilterFormElement.querySelectorAll( - 'input, select' - ) as NodeListOf + const filterElements = + searchFilterFormElement.querySelectorAll('input, select') for (const filterElement of filterElements) { filterElement.addEventListener('change', resetOffsetAndGetLotOccupancies) diff --git a/public-typescript/lotSearch.js b/public-typescript/lotSearch.js index 8c6f3b33..c42434a6 100644 --- a/public-typescript/lotSearch.js +++ b/public-typescript/lotSearch.js @@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10); const offsetElement = document.querySelector('#searchFilter--offset'); function renderLots(responseJSON) { - var _a, _b; + var _a, _b, _c, _d; if (responseJSON.lots.length === 0) { searchResultsContainerElement.innerHTML = `

There are no ${los.escapedAliases.lots} that meet the search criteria.

@@ -22,7 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); '' + - cityssm.escapeHTML(lot.lotName || '') + + cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + '' + '') + ('' + @@ -34,10 +34,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); : '(No Name)') + '' + '') + - ('' + cityssm.escapeHTML(lot.lotType || '') + '') + + ('' + cityssm.escapeHTML((_b = lot.lotType) !== null && _b !== void 0 ? _b : '') + '') + ('' + (lot.lotStatusId - ? cityssm.escapeHTML(lot.lotStatus || '') + ? cityssm.escapeHTML(lot.lotStatus) : '(No Status)') + '
' + (lot.lotOccupancyCount > 0 @@ -58,10 +58,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); searchResultsContainerElement .querySelector('table') .append(resultsTbodyElement); - (_a = searchResultsContainerElement - .querySelector("button[data-page='previous']")) === null || _a === void 0 ? void 0 : _a.addEventListener('click', previousAndGetLots); - (_b = searchResultsContainerElement - .querySelector("button[data-page='next']")) === null || _b === void 0 ? void 0 : _b.addEventListener('click', nextAndGetLots); + (_c = searchResultsContainerElement + .querySelector("button[data-page='previous']")) === null || _c === void 0 ? void 0 : _c.addEventListener('click', previousAndGetLots); + (_d = searchResultsContainerElement + .querySelector("button[data-page='next']")) === null || _d === void 0 ? void 0 : _d.addEventListener('click', nextAndGetLots); } function getLots() { searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Lots}...`); diff --git a/public-typescript/lotSearch.ts b/public-typescript/lotSearch.ts index 1c1fa293..a9b399c0 100644 --- a/public-typescript/lotSearch.ts +++ b/public-typescript/lotSearch.ts @@ -6,7 +6,6 @@ import type * as recordTypes from '../types/recordTypes' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' declare const cityssm: cityssmGlobal - ;(() => { const los = exports.los as globalTypes.LOS @@ -49,22 +48,22 @@ declare const cityssm: cityssmGlobal '' + - cityssm.escapeHTML(lot.lotName || '') + + cityssm.escapeHTML(lot.lotName ?? '') + '' + '') + ('' + '' + (lot.mapName ? cityssm.escapeHTML(lot.mapName) : '(No Name)') + '' + '') + - ('' + cityssm.escapeHTML(lot.lotType || '') + '') + + ('' + cityssm.escapeHTML(lot.lotType ?? '') + '') + ('' + (lot.lotStatusId - ? cityssm.escapeHTML(lot.lotStatus || '') + ? cityssm.escapeHTML(lot.lotStatus!) : '(No Status)') + '
' + (lot.lotOccupancyCount! > 0 @@ -138,9 +137,8 @@ declare const cityssm: cityssmGlobal getLots() } - const filterElements = searchFilterFormElement.querySelectorAll( - 'input, select' - ) as NodeListOf + const filterElements = + searchFilterFormElement.querySelectorAll('input, select') for (const filterElement of filterElements) { filterElement.addEventListener('change', resetOffsetAndGetLots) diff --git a/public/javascripts/lotOccupancySearch.min.js b/public/javascripts/lotOccupancySearch.min.js index 3dbe19c6..35510e9f 100644 --- a/public/javascripts/lotOccupancySearch.min.js +++ b/public/javascripts/lotOccupancySearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,a=document.querySelector("#form--searchFilters"),e=document.querySelector("#container--searchResults"),s=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),c=document.querySelector("#searchFilter--offset");function n(a){var c,n;if(0===a.lotOccupancies.length)return void(e.innerHTML=`
\n

\n There are no ${t.escapedAliases.occupancy} records that meet the search criteria.\n

\n
`);const i=document.createElement("tbody"),r=cityssm.dateToString(new Date);for(const e of a.lotOccupancies){let a="";a=e.occupancyStartDateString<=r&&(""===e.occupancyEndDateString||e.occupancyEndDateString>=r)?`\n \n `:e.occupancyStartDateString>r?`\n \n `:`\n \n `;let s="";for(const t of e.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(t.occupantName||"")+"
";i.insertAdjacentHTML("beforeend",''+a+''+cityssm.escapeHTML(e.occupancyType)+""+(e.lotName?''+cityssm.escapeHTML(e.lotName)+"":'(No '+t.escapedAliases.Lot+")")+'
'+cityssm.escapeHTML(e.mapName||"")+""+e.occupancyStartDateString+""+(e.occupancyEndDate?e.occupancyEndDateString:'(No End Date)')+""+s+""+(e.printEJS?'':"")+"")}e.innerHTML=`\n \n \n \n \n \n \n \n \n \n
${t.escapedAliases.Occupancy} Type${t.escapedAliases.Lot}${t.escapedAliases.OccupancyStartDate}End Date${t.escapedAliases.Occupants}Print
`,e.querySelector("table").append(i),e.insertAdjacentHTML("beforeend",t.getSearchResultsPagerHTML(s,a.offset,a.count)),null===(c=e.querySelector("button[data-page='previous']"))||void 0===c||c.addEventListener("click",o),null===(n=e.querySelector("button[data-page='next']"))||void 0===n||n.addEventListener("click",l)}function i(){e.innerHTML=t.getLoadingParagraphHTML(`Loading ${exports.aliases.occupancies}...`),cityssm.postJSON(t.urlPrefix+"/lotOccupancies/doSearchLotOccupancies",a,n)}function r(){c.value="0",i()}function o(){c.value=Math.max(Number.parseInt(c.value,10)-s,0).toString(),i()}function l(){c.value=(Number.parseInt(c.value,10)+s).toString(),i()}const p=a.querySelectorAll("input, select");for(const t of p)t.addEventListener("change",r);a.addEventListener("submit",t=>{t.preventDefault(),r()}),i()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,e=document.querySelector("#form--searchFilters"),a=document.querySelector("#container--searchResults"),s=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),c=document.querySelector("#searchFilter--offset");function n(e){var c,n,i,l,p,d,u;if(0===e.lotOccupancies.length)return void(a.innerHTML=`
\n

\n There are no ${t.escapedAliases.occupancy} records that meet the search criteria.\n

\n
`);const h=document.createElement("tbody"),y=cityssm.dateToString(new Date);for(const a of e.lotOccupancies){let e="";e=a.occupancyStartDateString<=y&&(""===a.occupancyEndDateString||a.occupancyEndDateString>=y)?`\n \n `:a.occupancyStartDateString>y?`\n \n `:`\n \n `;let s="";for(const t of a.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(null!==(i=t.occupantName)&&void 0!==i?i:"")+"
";h.insertAdjacentHTML("beforeend",'")}a.innerHTML=`
'+e+''+cityssm.escapeHTML(a.occupancyType)+""+(a.lotName?''+cityssm.escapeHTML(a.lotName)+"":'(No '+t.escapedAliases.Lot+")")+'
'+cityssm.escapeHTML(null!==(p=a.mapName)&&void 0!==p?p:"")+"
"+a.occupancyStartDateString+""+(a.occupancyEndDate?a.occupancyEndDateString:'(No End Date)')+""+s+""+(a.printEJS?'':"")+"
\n \n \n \n \n \n \n \n \n \n
${t.escapedAliases.Occupancy} Type${t.escapedAliases.Lot}${t.escapedAliases.OccupancyStartDate}End Date${t.escapedAliases.Occupants}Print
`,a.querySelector("table").append(h),a.insertAdjacentHTML("beforeend",t.getSearchResultsPagerHTML(s,e.offset,e.count)),null===(d=a.querySelector("button[data-page='previous']"))||void 0===d||d.addEventListener("click",o),null===(u=a.querySelector("button[data-page='next']"))||void 0===u||u.addEventListener("click",r)}function i(){a.innerHTML=t.getLoadingParagraphHTML(`Loading ${t.escapedAliases.Occupancies}...`),cityssm.postJSON(t.urlPrefix+"/lotOccupancies/doSearchLotOccupancies",e,n)}function l(){c.value="0",i()}function o(){c.value=Math.max(Number.parseInt(c.value,10)-s,0).toString(),i()}function r(){c.value=(Number.parseInt(c.value,10)+s).toString(),i()}const p=e.querySelectorAll("input, select");for(const t of p)t.addEventListener("change",l);e.addEventListener("submit",t=>{t.preventDefault(),l()}),i()})(); \ No newline at end of file diff --git a/public/javascripts/lotSearch.min.js b/public/javascripts/lotSearch.min.js index 77cf0a29..aa20488a 100644 --- a/public/javascripts/lotSearch.min.js +++ b/public/javascripts/lotSearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),n=document.querySelector("#searchFilter--offset");function r(t){var n,r;if(0===t.lots.length)return void(s.innerHTML=`
\n

There are no ${e.escapedAliases.lots} that meet the search criteria.

\n
`);const o=document.createElement("tbody");for(const s of t.lots)o.insertAdjacentHTML("beforeend",'");s.innerHTML=`
'+cityssm.escapeHTML(s.lotName||"")+''+(s.mapName?cityssm.escapeHTML(s.mapName):'(No Name)')+""+cityssm.escapeHTML(s.lotType||"")+""+(s.lotStatusId?cityssm.escapeHTML(s.lotStatus||""):'(No Status)')+"
"+(s.lotOccupancyCount>0?'Currently Occupied':"")+"
\n \n \n \n \n \n \n
${e.escapedAliases.Lot}${e.escapedAliases.Map}${e.escapedAliases.Lot} TypeStatus
`,s.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(a,t.offset,t.count)),s.querySelector("table").append(o),null===(n=s.querySelector("button[data-page='previous']"))||void 0===n||n.addEventListener("click",l),null===(r=s.querySelector("button[data-page='next']"))||void 0===r||r.addEventListener("click",i)}function o(){s.innerHTML=e.getLoadingParagraphHTML(`Loading ${e.escapedAliases.Lots}...`),cityssm.postJSON(e.urlPrefix+"/lots/doSearchLots",t,r)}function c(){n.value="0",o()}function l(){n.value=Math.max(Number.parseInt(n.value,10)-a,0).toString(),o()}function i(){n.value=(Number.parseInt(n.value,10)+a).toString(),o()}const d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",c);t.addEventListener("submit",e=>{e.preventDefault(),c()}),o()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),n=document.querySelector("#searchFilter--offset");function r(t){var n,r,o,c;if(0===t.lots.length)return void(s.innerHTML=`
\n

There are no ${e.escapedAliases.lots} that meet the search criteria.

\n
`);const d=document.createElement("tbody");for(const s of t.lots)d.insertAdjacentHTML("beforeend",'");s.innerHTML=`
'+cityssm.escapeHTML(null!==(n=s.lotName)&&void 0!==n?n:"")+''+(s.mapName?cityssm.escapeHTML(s.mapName):'(No Name)')+""+cityssm.escapeHTML(null!==(r=s.lotType)&&void 0!==r?r:"")+""+(s.lotStatusId?cityssm.escapeHTML(s.lotStatus):'(No Status)')+"
"+(s.lotOccupancyCount>0?'Currently Occupied':"")+"
\n \n \n \n \n \n \n
${e.escapedAliases.Lot}${e.escapedAliases.Map}${e.escapedAliases.Lot} TypeStatus
`,s.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(a,t.offset,t.count)),s.querySelector("table").append(d),null===(o=s.querySelector("button[data-page='previous']"))||void 0===o||o.addEventListener("click",l),null===(c=s.querySelector("button[data-page='next']"))||void 0===c||c.addEventListener("click",i)}function o(){s.innerHTML=e.getLoadingParagraphHTML(`Loading ${e.escapedAliases.Lots}...`),cityssm.postJSON(e.urlPrefix+"/lots/doSearchLots",t,r)}function c(){n.value="0",o()}function l(){n.value=Math.max(Number.parseInt(n.value,10)-a,0).toString(),o()}function i(){n.value=(Number.parseInt(n.value,10)+a).toString(),o()}const d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",c);t.addEventListener("submit",e=>{e.preventDefault(),c()}),o()})(); \ No newline at end of file