diff --git a/handlers/lots-post/doSearchLots.js b/handlers/lots-post/doSearchLots.js index 8527e14a..1520a12a 100644 --- a/handlers/lots-post/doSearchLots.js +++ b/handlers/lots-post/doSearchLots.js @@ -6,6 +6,7 @@ export const handler = async (request, response) => { }); response.json({ count: result.count, + offset: Number.parseInt(request.body.offset, 10), lots: result.lots }); }; diff --git a/handlers/lots-post/doSearchLots.ts b/handlers/lots-post/doSearchLots.ts index 60ac7c70..f491653d 100644 --- a/handlers/lots-post/doSearchLots.ts +++ b/handlers/lots-post/doSearchLots.ts @@ -10,6 +10,7 @@ export const handler: RequestHandler = async (request, response) => { response.json({ count: result.count, + offset: Number.parseInt(request.body.offset, 10), lots: result.lots }); }; diff --git a/public-typescript/lotOccupancySearch.js b/public-typescript/lotOccupancySearch.js index 1d04b8b9..8a9151f7 100644 --- a/public-typescript/lotOccupancySearch.js +++ b/public-typescript/lotOccupancySearch.js @@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); searchResultsContainerElement.innerHTML = '
' + '

There are no ' + - cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase()) + + los.escapedAliases.occupancy + " records that meet the search criteria.

" + "
"; return; @@ -26,30 +26,30 @@ Object.defineProperty(exports, "__esModule", { value: true }); lotOccupancy.occupancyEndDateString >= nowDateString)) { occupancyTimeHTML = '' + ('') + ""; } else if (lotOccupancy.occupancyStartDateString > nowDateString) { occupancyTimeHTML = '' + ('') + ""; } else { occupancyTimeHTML = '' + ('') + ""; } @@ -88,7 +88,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); cityssm.escapeHTML(lotOccupancy.lotName) + "" : '(No ' + - cityssm.escapeHTML(exports.aliases.lot) + + los.escapedAliases.Lot + ")") + "
" + ('' + @@ -121,11 +121,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); '' + "" + '' + - ("") + - ("") + - ("") + + ("") + + ("") + + ("") + "" + - ("") + + ("") + '' + "" + "
" + cityssm.escapeHTML(exports.aliases.occupancy) + " Type" + cityssm.escapeHTML(exports.aliases.lot) + "" + cityssm.escapeHTML(exports.aliases.occupancyStartDate) + "" + los.escapedAliases.Occupancy + " Type" + los.escapedAliases.Lot + "" + los.escapedAliases.OccupancyStartDate + "End Date" + cityssm.escapeHTML(exports.aliases.occupants) + "" + los.escapedAliases.Occupants + "Print
" + diff --git a/public-typescript/lotOccupancySearch.ts b/public-typescript/lotOccupancySearch.ts index 9311da53..9d3ea276 100644 --- a/public-typescript/lotOccupancySearch.ts +++ b/public-typescript/lotOccupancySearch.ts @@ -33,7 +33,7 @@ declare const cityssm: cityssmGlobal; searchResultsContainerElement.innerHTML = '
' + '

There are no ' + - cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase()) + + los.escapedAliases.occupancy + " records that meet the search criteria.

" + "
"; @@ -54,28 +54,28 @@ declare const cityssm: cityssmGlobal; ) { occupancyTimeHTML = '' + ('') + ""; } else if (lotOccupancy.occupancyStartDateString! > nowDateString) { occupancyTimeHTML = '' + ('') + ""; } else { occupancyTimeHTML = '' + ('') + ""; } @@ -119,7 +119,7 @@ declare const cityssm: cityssmGlobal; cityssm.escapeHTML(lotOccupancy.lotName) + "" : '(No ' + - cityssm.escapeHTML(exports.aliases.lot) + + los.escapedAliases.Lot + ")") + "
" + ('' + @@ -154,11 +154,11 @@ declare const cityssm: cityssmGlobal; '
' + "" + '' + - ("") + - ("") + - ("") + + ("") + + ("") + + ("") + "" + - ("") + + ("") + '' + "" + "
" + cityssm.escapeHTML(exports.aliases.occupancy) + " Type" + cityssm.escapeHTML(exports.aliases.lot) + "" + cityssm.escapeHTML(exports.aliases.occupancyStartDate) + "" + los.escapedAliases.Occupancy + " Type" + los.escapedAliases.Lot + "" + los.escapedAliases.OccupancyStartDate + "End Date" + cityssm.escapeHTML(exports.aliases.occupants) + "" + los.escapedAliases.Occupants + "Print
" + diff --git a/public-typescript/lotSearch.js b/public-typescript/lotSearch.js index e90b1665..fa3e9af1 100644 --- a/public-typescript/lotSearch.js +++ b/public-typescript/lotSearch.js @@ -7,119 +7,119 @@ Object.defineProperty(exports, "__esModule", { value: true }); const searchResultsContainerElement = document.querySelector("#container--searchResults"); const limit = Number.parseInt(document.querySelector("#searchFilter--limit").value, 10); const offsetElement = document.querySelector("#searchFilter--offset"); - const getLots = () => { - const offset = Number.parseInt(offsetElement.value, 10); + function renderLots(responseJSON) { + if (responseJSON.lots.length === 0) { + searchResultsContainerElement.innerHTML = + '
' + + '

There are no ' + + los.escapedAliases.lots + + " that meet the search criteria.

" + + "
"; + return; + } + const resultsTbodyElement = document.createElement("tbody"); + for (const lot of responseJSON.lots) { + resultsTbodyElement.insertAdjacentHTML("beforeend", "" + + ("") + + ("") + + ("") + + ("") + + ""); + } + searchResultsContainerElement.innerHTML = + '
" + + '' + + cityssm.escapeHTML(lot.lotName || "") + + "" + + "" + + '' + + (lot.mapName + ? cityssm.escapeHTML(lot.mapName) + : '(No Name)') + + "" + + "" + cityssm.escapeHTML(lot.lotType || "") + "" + + (lot.lotStatusId + ? cityssm.escapeHTML(lot.lotStatus || "") + : '(No Status)') + + "
" + + (lot.lotOccupancyCount > 0 + ? 'Currently Occupied' + : "") + + "
' + + "" + + ("") + + ("") + + ("") + + "" + + "" + + "
" + los.escapedAliases.Lot + "" + los.escapedAliases.Map + "" + los.escapedAliases.Lot + " TypeStatus
" + + '
' + + ('
' + + '
' + + "Displaying " + + (responseJSON.offset + 1).toString() + + " to " + + Math.min(responseJSON.count, limit + responseJSON.offset) + + " of " + + responseJSON.count + + "
" + + "
") + + ('
' + + (responseJSON.offset > 0 + ? '
' + + '" + + "
" + : "") + + (limit + responseJSON.offset < responseJSON.count + ? '
' + + '" + + "
" + : "") + + "
") + + "
"; + searchResultsContainerElement.querySelector("table").append(resultsTbodyElement); + if (responseJSON.offset > 0) { + searchResultsContainerElement.querySelector("button[data-page='previous']").addEventListener("click", previousAndGetLots); + } + if (limit + responseJSON.offset < responseJSON.count) { + searchResultsContainerElement.querySelector("button[data-page='next']").addEventListener("click", nextAndGetLots); + } + } + function getLots() { searchResultsContainerElement.innerHTML = '
' + '
' + "Loading " + - exports.aliases.lots + + los.escapedAliases.Lots + "..." + "
"; - cityssm.postJSON(los.urlPrefix + "/lots/doSearchLots", searchFilterFormElement, (responseJSON) => { - if (responseJSON.lots.length === 0) { - searchResultsContainerElement.innerHTML = - '
' + - '

There are no ' + - exports.aliases.lots.toLowerCase() + - " that meet the search criteria.

" + - "
"; - return; - } - const resultsTbodyElement = document.createElement("tbody"); - for (const lot of responseJSON.lots) { - resultsTbodyElement.insertAdjacentHTML("beforeend", "" + - ("") + - ("") + - ("") + - ("") + - ""); - } - searchResultsContainerElement.innerHTML = - '
" + - '' + - cityssm.escapeHTML(lot.lotName || "") + - "" + - "" + - '' + - (lot.mapName - ? cityssm.escapeHTML(lot.mapName) - : '(No Name)') + - "" + - "" + cityssm.escapeHTML(lot.lotType || "") + "" + - (lot.lotStatusId - ? cityssm.escapeHTML(lot.lotStatus || "") - : '(No Status)') + - "
" + - (lot.lotOccupancyCount > 0 - ? 'Currently Occupied' - : "") + - "
' + - "" + - ("") + - ("") + - ("") + - "" + - "" + - "
" + cityssm.escapeHTML(exports.aliases.lot) + "" + cityssm.escapeHTML(exports.aliases.map) + "" + cityssm.escapeHTML(exports.aliases.lot) + " TypeStatus
" + - '
' + - ('
' + - '
' + - "Displaying " + - (offset + 1).toString() + - " to " + - Math.min(responseJSON.count, limit + offset) + - " of " + - responseJSON.count + - "
" + - "
") + - ('
' + - (offset > 0 - ? '
' + - '" + - "
" - : "") + - (limit + offset < responseJSON.count - ? '
' + - '" + - "
" - : "") + - "
") + - "
"; - searchResultsContainerElement.querySelector("table").append(resultsTbodyElement); - if (offset > 0) { - searchResultsContainerElement.querySelector("button[data-page='previous']").addEventListener("click", previousAndGetLots); - } - if (limit + offset < responseJSON.count) { - searchResultsContainerElement.querySelector("button[data-page='next']").addEventListener("click", nextAndGetLots); - } - }); - }; - const resetOffsetAndGetLots = () => { + cityssm.postJSON(los.urlPrefix + "/lots/doSearchLots", searchFilterFormElement, renderLots); + } + function resetOffsetAndGetLots() { offsetElement.value = "0"; getLots(); - }; - const previousAndGetLots = () => { + } + function previousAndGetLots() { offsetElement.value = Math.max(Number.parseInt(offsetElement.value, 10) - limit, 0).toString(); getLots(); - }; - const nextAndGetLots = () => { + } + function nextAndGetLots() { offsetElement.value = (Number.parseInt(offsetElement.value, 10) + limit).toString(); getLots(); - }; + } const filterElements = searchFilterFormElement.querySelectorAll("input, select"); for (const filterElement of filterElements) { filterElement.addEventListener("change", resetOffsetAndGetLots); diff --git a/public-typescript/lotSearch.ts b/public-typescript/lotSearch.ts index 9b8a6f09..52ffdd0d 100644 --- a/public-typescript/lotSearch.ts +++ b/public-typescript/lotSearch.ts @@ -23,149 +23,145 @@ declare const cityssm: cityssmGlobal; ); const offsetElement = document.querySelector("#searchFilter--offset") as HTMLInputElement; - const getLots = () => { - const offset = Number.parseInt(offsetElement.value, 10); + function renderLots(responseJSON: { count: number; offset: number; lots: recordTypes.Lot[] }): void { + if (responseJSON.lots.length === 0) { + searchResultsContainerElement.innerHTML = + '
' + + '

There are no ' + + los.escapedAliases.lots + + " that meet the search criteria.

" + + "
"; + return; + } + + const resultsTbodyElement = document.createElement("tbody"); + + for (const lot of responseJSON.lots) { + resultsTbodyElement.insertAdjacentHTML( + "beforeend", + "" + + ("") + + ("") + + ("") + + ("") + + "" + ); + } + + searchResultsContainerElement.innerHTML = + '
" + + '' + + cityssm.escapeHTML(lot.lotName || "") + + "" + + "" + + '' + + (lot.mapName + ? cityssm.escapeHTML(lot.mapName) + : '(No Name)') + + "" + + "" + cityssm.escapeHTML(lot.lotType || "") + "" + + (lot.lotStatusId + ? cityssm.escapeHTML(lot.lotStatus || "") + : '(No Status)') + + "
" + + (lot.lotOccupancyCount! > 0 + ? 'Currently Occupied' + : "") + + "
' + + "" + + ("") + + ("") + + ("") + + "" + + "" + + "
" + los.escapedAliases.Lot + "" + los.escapedAliases.Map + "" + los.escapedAliases.Lot + " TypeStatus
" + + '
' + + ('
' + + '
' + + "Displaying " + + (responseJSON.offset + 1).toString() + + " to " + + Math.min(responseJSON.count, limit + responseJSON.offset) + + " of " + + responseJSON.count + + "
" + + "
") + + ('
' + + (responseJSON.offset > 0 + ? '
' + + '" + + "
" + : "") + + (limit + responseJSON.offset < responseJSON.count + ? '
' + + '" + + "
" + : "") + + "
") + + "
"; + + searchResultsContainerElement.querySelector("table")!.append(resultsTbodyElement); + + if (responseJSON.offset > 0) { + ( + searchResultsContainerElement.querySelector( + "button[data-page='previous']" + ) as HTMLButtonElement + ).addEventListener("click", previousAndGetLots); + } + + if (limit + responseJSON.offset < responseJSON.count) { + ( + searchResultsContainerElement.querySelector( + "button[data-page='next']" + ) as HTMLButtonElement + ).addEventListener("click", nextAndGetLots); + } + } + + function getLots(): void { searchResultsContainerElement.innerHTML = '
' + '
' + "Loading " + - exports.aliases.lots + + los.escapedAliases.Lots + "..." + "
"; - cityssm.postJSON( - los.urlPrefix + "/lots/doSearchLots", - searchFilterFormElement, - (responseJSON: { count: number; lots: recordTypes.Lot[] }) => { - if (responseJSON.lots.length === 0) { - searchResultsContainerElement.innerHTML = - '
' + - '

There are no ' + - exports.aliases.lots.toLowerCase() + - " that meet the search criteria.

" + - "
"; + cityssm.postJSON(los.urlPrefix + "/lots/doSearchLots", searchFilterFormElement, renderLots); + } - return; - } - - const resultsTbodyElement = document.createElement("tbody"); - - for (const lot of responseJSON.lots) { - resultsTbodyElement.insertAdjacentHTML( - "beforeend", - "" + - ("") + - ("") + - ("") + - ("") + - "" - ); - } - - searchResultsContainerElement.innerHTML = - '
" + - '' + - cityssm.escapeHTML(lot.lotName || "") + - "" + - "" + - '' + - (lot.mapName - ? cityssm.escapeHTML(lot.mapName) - : '(No Name)') + - "" + - "" + cityssm.escapeHTML(lot.lotType || "") + "" + - (lot.lotStatusId - ? cityssm.escapeHTML(lot.lotStatus || "") - : '(No Status)') + - "
" + - (lot.lotOccupancyCount! > 0 - ? 'Currently Occupied' - : "") + - "
' + - "" + - ("") + - ("") + - ("") + - "" + - "" + - "
" + cityssm.escapeHTML(exports.aliases.lot) + "" + cityssm.escapeHTML(exports.aliases.map) + "" + cityssm.escapeHTML(exports.aliases.lot) + " TypeStatus
" + - '
' + - ('
' + - '
' + - "Displaying " + - (offset + 1).toString() + - " to " + - Math.min(responseJSON.count, limit + offset) + - " of " + - responseJSON.count + - "
" + - "
") + - ('
' + - (offset > 0 - ? '
' + - '" + - "
" - : "") + - (limit + offset < responseJSON.count - ? '
' + - '" + - "
" - : "") + - "
") + - "
"; - - searchResultsContainerElement.querySelector("table")!.append(resultsTbodyElement); - - if (offset > 0) { - ( - searchResultsContainerElement.querySelector( - "button[data-page='previous']" - ) as HTMLButtonElement - ).addEventListener("click", previousAndGetLots); - } - - if (limit + offset < responseJSON.count) { - ( - searchResultsContainerElement.querySelector( - "button[data-page='next']" - ) as HTMLButtonElement - ).addEventListener("click", nextAndGetLots); - } - } - ); - }; - - const resetOffsetAndGetLots = () => { + function resetOffsetAndGetLots(): void { offsetElement.value = "0"; getLots(); - }; + } - const previousAndGetLots = () => { + function previousAndGetLots(): void { offsetElement.value = Math.max( Number.parseInt(offsetElement.value, 10) - limit, 0 ).toString(); getLots(); - }; + } - const nextAndGetLots = () => { + function nextAndGetLots(): void { offsetElement.value = (Number.parseInt(offsetElement.value, 10) + limit).toString(); getLots(); - }; + } const filterElements = searchFilterFormElement.querySelectorAll("input, select") as NodeListOf< HTMLInputElement | HTMLSelectElement diff --git a/public-typescript/main.js b/public-typescript/main.js index 2eee3802..52c2a31a 100644 --- a/public-typescript/main.js +++ b/public-typescript/main.js @@ -107,7 +107,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); // Apply a label const labelElement = document.querySelector("label[for='" + dateElement.id + "']"); if (labelElement) { - datepickerElement.querySelector(".datetimepicker-dummy-input").ariaLabel = labelElement.textContent; + datepickerElement.querySelector(".datetimepicker-dummy-input").ariaLabel = + labelElement.textContent; } } }; @@ -222,6 +223,30 @@ Object.defineProperty(exports, "__esModule", { value: true }); } } }; + const escapedAliases = Object.freeze({ + Map: cityssm.escapeHTML(exports.aliases.map), + map: cityssm.escapeHTML(exports.aliases.map.toLowerCase()), + Lot: cityssm.escapeHTML(exports.aliases.lot), + lot: cityssm.escapeHTML(exports.aliases.lot.toLowerCase()), + Lots: cityssm.escapeHTML(exports.aliases.lots), + lots: cityssm.escapeHTML(exports.aliases.lots.toLowerCase()), + Occupancy: cityssm.escapeHTML(exports.aliases.occupancy), + occupancy: cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase()), + Occupancies: cityssm.escapeHTML(exports.aliases.occupancies), + occupancies: cityssm.escapeHTML(exports.aliases.occupancies.toLowerCase()), + Occupant: cityssm.escapeHTML(exports.aliases.occupant), + occupant: cityssm.escapeHTML(exports.aliases.occupant.toLowerCase()), + Occupants: cityssm.escapeHTML(exports.aliases.occupants), + occupants: cityssm.escapeHTML(exports.aliases.occupants.toLowerCase()), + ExternalReceiptNumber: cityssm.escapeHTML(exports.aliases.externalReceiptNumber), + externalReceiptNumber: cityssm.escapeHTML(exports.aliases.externalReceiptNumber.toLowerCase()), + OccupancyStartDate: cityssm.escapeHTML(exports.aliases.occupancyStartDate), + occupancyStartDate: cityssm.escapeHTML(exports.aliases.occupancyStartDate.toLowerCase()), + WorkOrderOpenDate: cityssm.escapeHTML(exports.aliases.workOrderOpenDate), + workOrderOpenDate: cityssm.escapeHTML(exports.aliases.workOrderOpenDate.toLowerCase()), + WorkOrderCloseDate: cityssm.escapeHTML(exports.aliases.workOrderCloseDate), + workOrderCloseDate: cityssm.escapeHTML(exports.aliases.workOrderCloseDate.toLowerCase()) + }); const hues = ["red", "green", "orange", "blue", "pink", "yellow", "purple"]; const luminosity = ["bright", "light", "dark"]; const getRandomColor = (seedString) => { @@ -243,6 +268,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); initializeDatePickers, // initializeTimePickers, populateAliases, + escapedAliases, getRandomColor }; exports.los = los; diff --git a/public-typescript/main.ts b/public-typescript/main.ts index f022280a..f8344015 100644 --- a/public-typescript/main.ts +++ b/public-typescript/main.ts @@ -158,9 +158,10 @@ declare const bulmaJS: BulmaJS; // Apply a label const labelElement = document.querySelector("label[for='" + dateElement.id + "']"); - + if (labelElement) { - datepickerElement.querySelector(".datetimepicker-dummy-input")!.ariaLabel = labelElement.textContent; + datepickerElement.querySelector(".datetimepicker-dummy-input")!.ariaLabel = + labelElement.textContent; } } }; @@ -281,6 +282,40 @@ declare const bulmaJS: BulmaJS; } }; + const escapedAliases = Object.freeze({ + Map: cityssm.escapeHTML(exports.aliases.map), + map: cityssm.escapeHTML(exports.aliases.map.toLowerCase()), + + Lot: cityssm.escapeHTML(exports.aliases.lot), + lot: cityssm.escapeHTML(exports.aliases.lot.toLowerCase()), + Lots: cityssm.escapeHTML(exports.aliases.lots), + lots: cityssm.escapeHTML(exports.aliases.lots.toLowerCase()), + + Occupancy: cityssm.escapeHTML(exports.aliases.occupancy), + occupancy: cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase()), + Occupancies: cityssm.escapeHTML(exports.aliases.occupancies), + occupancies: cityssm.escapeHTML(exports.aliases.occupancies.toLowerCase()), + + Occupant: cityssm.escapeHTML(exports.aliases.occupant), + occupant: cityssm.escapeHTML(exports.aliases.occupant.toLowerCase()), + Occupants: cityssm.escapeHTML(exports.aliases.occupants), + occupants: cityssm.escapeHTML(exports.aliases.occupants.toLowerCase()), + + ExternalReceiptNumber: cityssm.escapeHTML(exports.aliases.externalReceiptNumber), + externalReceiptNumber: cityssm.escapeHTML( + exports.aliases.externalReceiptNumber.toLowerCase() + ), + + OccupancyStartDate: cityssm.escapeHTML(exports.aliases.occupancyStartDate), + occupancyStartDate: cityssm.escapeHTML(exports.aliases.occupancyStartDate.toLowerCase()), + + WorkOrderOpenDate: cityssm.escapeHTML(exports.aliases.workOrderOpenDate), + workOrderOpenDate: cityssm.escapeHTML(exports.aliases.workOrderOpenDate.toLowerCase()), + + WorkOrderCloseDate: cityssm.escapeHTML(exports.aliases.workOrderCloseDate), + workOrderCloseDate: cityssm.escapeHTML(exports.aliases.workOrderCloseDate.toLowerCase()) + }); + const hues = ["red", "green", "orange", "blue", "pink", "yellow", "purple"]; const luminosity = ["bright", "light", "dark"]; @@ -309,6 +344,7 @@ declare const bulmaJS: BulmaJS; initializeDatePickers, // initializeTimePickers, populateAliases, + escapedAliases, getRandomColor }; diff --git a/public-typescript/workOrderMilestoneCalendar.js b/public-typescript/workOrderMilestoneCalendar.js index b2c25e11..645a3595 100644 --- a/public-typescript/workOrderMilestoneCalendar.js +++ b/public-typescript/workOrderMilestoneCalendar.js @@ -43,7 +43,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); cityssm.escapeHTML(lot.mapName || "") + '">' + ' ' + cityssm.escapeHTML(lot.lotName || "") + "" + @@ -56,7 +56,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); cityssm.escapeHTML(occupant.lotOccupantType || "") + '">' + ' ' + cityssm.escapeHTML(occupant.occupantName || "") + "" + diff --git a/public-typescript/workOrderMilestoneCalendar.ts b/public-typescript/workOrderMilestoneCalendar.ts index 3ba4f10c..98773833 100644 --- a/public-typescript/workOrderMilestoneCalendar.ts +++ b/public-typescript/workOrderMilestoneCalendar.ts @@ -75,7 +75,7 @@ declare const cityssm: cityssmGlobal; cityssm.escapeHTML(lot.mapName || "") + '">' + ' ' + cityssm.escapeHTML(lot.lotName || "") + "" + @@ -89,7 +89,7 @@ declare const cityssm: cityssmGlobal; cityssm.escapeHTML(occupant.lotOccupantType || "") + '">' + ' ' + cityssm.escapeHTML(occupant.occupantName || "") + "" + diff --git a/public-typescript/workOrderSearch.js b/public-typescript/workOrderSearch.js index 7426f955..6766e02b 100644 --- a/public-typescript/workOrderSearch.js +++ b/public-typescript/workOrderSearch.js @@ -26,9 +26,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); cityssm.escapeHTML(lot.mapName || "") + '">' + ' ' + - cityssm.escapeHTML(lot.lotName || "(No Lot Name)") + + cityssm.escapeHTML(lot.lotName || "(No " + exports.aliases.Lot + " Name)") + "
"; } for (const occupancy of workOrder.workOrderLotOccupancies) { @@ -37,8 +37,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); '' + - ' ' + cityssm.escapeHTML(occupant.occupantName || "(No Name)") + "
"; @@ -68,23 +70,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); "") + ('") + diff --git a/public-typescript/workOrderSearch.ts b/public-typescript/workOrderSearch.ts index c9b7ef16..d3116a1e 100644 --- a/public-typescript/workOrderSearch.ts +++ b/public-typescript/workOrderSearch.ts @@ -28,7 +28,11 @@ declare const cityssm: cityssmGlobal; const offsetElement = document.querySelector("#searchFilter--offset") as HTMLInputElement; - function renderWorkOrders(responseJSON: { count: number; offset: number; workOrders: recordTypes.WorkOrder[]; }) { + function renderWorkOrders(responseJSON: { + count: number; + offset: number; + workOrders: recordTypes.WorkOrder[]; + }) { if (responseJSON.workOrders.length === 0) { searchResultsContainerElement.innerHTML = '
' + @@ -49,9 +53,9 @@ declare const cityssm: cityssmGlobal; cityssm.escapeHTML(lot.mapName || "") + '">' + ' ' + - cityssm.escapeHTML(lot.lotName || "(No Lot Name)") + + cityssm.escapeHTML(lot.lotName || "(No " + exports.aliases.Lot + " Name)") + "
"; } @@ -61,8 +65,10 @@ declare const cityssm: cityssmGlobal; '' + - ' ' + cityssm.escapeHTML(occupant.occupantName || "(No Name)") + "
"; @@ -72,70 +78,70 @@ declare const cityssm: cityssmGlobal; resultsTbodyElement.insertAdjacentHTML( "beforeend", "
" + - ("") + - ("") + - ('") + - ('") + - ("") + - (workOrderPrints.length > 0 - ? "" - : "") + - "" + (workOrder.workOrderNumber!.trim() + ? cityssm.escapeHTML(workOrder.workOrderNumber || "") + : "(No Number)") + + "" + + "") + + ("") + + ('") + + ('") + + ("") + + (workOrderPrints.length > 0 + ? "" + : "") + + "" ); } @@ -164,18 +170,18 @@ declare const cityssm: cityssmGlobal; ('
' + (responseJSON.offset > 0 ? '
' + - '" + - "
" + '" + + "
" : "") + (limit + responseJSON.offset < responseJSON.count ? '
' + - '" + - "
" + '" + + "" : "") + "") + ""; diff --git a/public/javascripts/lotOccupancySearch.min.js b/public/javascripts/lotOccupancySearch.min.js index 85fe67c7..b12f8fb7 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,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 i(e){if(0===e.lotOccupancies.length)return void(a.innerHTML='

There are no '+cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase())+" records that meet the search criteria.

");const c=document.createElement("tbody"),i=cityssm.dateToString(new Date);for(const a of e.lotOccupancies){let e="";e=a.occupancyStartDateString<=i&&(""===a.occupancyEndDateString||a.occupancyEndDateString>=i)?'':a.occupancyStartDateString>i?'':'';let s="";for(const t of a.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(t.occupantName||"")+"
";c.insertAdjacentHTML("beforeend",'")}a.innerHTML='
' + ('' + ' ' + workOrder.workOrderOpenDateString + "
") + ('' + ' ' + (workOrder.workOrderCloseDate ? workOrder.workOrderCloseDateString : '(No ' + - cityssm.escapeHTML(exports.aliases.workOrderCloseDate) + + los.escapedAliases.WorkOrderCloseDate + ")") + "") + "
" + - '' + - (workOrder.workOrderNumber!.trim() - ? cityssm.escapeHTML(workOrder.workOrderNumber || "") - : "(No Number)") + - "" + - "" + - cityssm.escapeHTML(workOrder.workOrderType || "") + - "
" + - '' + - cityssm.escapeHTML(workOrder.workOrderDescription || "") + - "" + - "
' + - relatedHTML + - "' + - ('" + + '' + - ' ' + - workOrder.workOrderOpenDateString + - "
") + - ('' + - ' ' + - (workOrder.workOrderCloseDate - ? workOrder.workOrderCloseDateString - : '(No ' + - cityssm.escapeHTML(exports.aliases.workOrderCloseDate) + - ")") + - "") + - "
" + - (workOrder.workOrderMilestoneCount === 0 - ? "-" - : workOrder.workOrderMilestoneCompletionCount + - " / " + - workOrder.workOrderMilestoneCount) + - "" + - '' + - '' + - "" + - "
" + + cityssm.escapeHTML(workOrder.workOrderType || "") + + "
" + + '' + + cityssm.escapeHTML(workOrder.workOrderDescription || "") + + "" + + "
' + + relatedHTML + + "' + + ('' + + ' ' + + workOrder.workOrderOpenDateString + + "
") + + ('' + + ' ' + + (workOrder.workOrderCloseDate + ? workOrder.workOrderCloseDateString + : '(No ' + + los.escapedAliases.WorkOrderCloseDate + + ")") + + "") + + "
" + + (workOrder.workOrderMilestoneCount === 0 + ? "-" + : workOrder.workOrderMilestoneCompletionCount + + " / " + + workOrder.workOrderMilestoneCount) + + "" + + '' + + '' + + "" + + "
'+e+''+cityssm.escapeHTML(a.occupancyType)+""+(a.lotName?''+cityssm.escapeHTML(a.lotName)+"":'(No '+cityssm.escapeHTML(exports.aliases.lot)+")")+'
'+cityssm.escapeHTML(a.mapName||"")+"
"+a.occupancyStartDateString+""+(a.occupancyEndDate?a.occupancyEndDateString:'(No End Date)')+""+s+""+(a.printEJS?'':"")+"
'+cityssm.escapeHTML(exports.aliases.occupancy)+" Type"+cityssm.escapeHTML(exports.aliases.lot)+""+cityssm.escapeHTML(exports.aliases.occupancyStartDate)+"End Date"+cityssm.escapeHTML(exports.aliases.occupants)+'Print
Displaying '+(e.offset+1).toString()+" to "+Math.min(e.count,s+e.offset)+" of "+e.count+'
'+(e.offset>0?'
':"")+(s+e.offset
':"")+"
",a.querySelector("table").append(c),e.offset>0&&a.querySelector("button[data-page='previous']").addEventListener("click",r),s+e.offset",cityssm.postJSON(t.urlPrefix+"/lotOccupancies/doSearchLotOccupancies",e,i)}function n(){c.value="0",o()}function r(){c.value=Math.max(Number.parseInt(c.value,10)-s,0).toString(),o()}function l(){c.value=(Number.parseInt(c.value,10)+s).toString(),o()}const p=e.querySelectorAll("input, select");for(const t of p)t.addEventListener("change",n);e.addEventListener("submit",t=>{t.preventDefault(),n()}),o()})(); \ 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 i(e){if(0===e.lotOccupancies.length)return void(a.innerHTML='

There are no '+t.escapedAliases.occupancy+" records that meet the search criteria.

");const c=document.createElement("tbody"),i=cityssm.dateToString(new Date);for(const a of e.lotOccupancies){let e="";e=a.occupancyStartDateString<=i&&(""===a.occupancyEndDateString||a.occupancyEndDateString>=i)?'':a.occupancyStartDateString>i?'':'';let s="";for(const t of a.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(t.occupantName||"")+"
";c.insertAdjacentHTML("beforeend",'
")}a.innerHTML='
'+e+''+cityssm.escapeHTML(a.occupancyType)+""+(a.lotName?''+cityssm.escapeHTML(a.lotName)+"":'(No '+t.escapedAliases.Lot+")")+'
'+cityssm.escapeHTML(a.mapName||"")+"
"+a.occupancyStartDateString+""+(a.occupancyEndDate?a.occupancyEndDateString:'(No End Date)')+""+s+""+(a.printEJS?'':"")+"
'+t.escapedAliases.Occupancy+" Type"+t.escapedAliases.Lot+""+t.escapedAliases.OccupancyStartDate+"End Date"+t.escapedAliases.Occupants+'Print
Displaying '+(e.offset+1).toString()+" to "+Math.min(e.count,s+e.offset)+" of "+e.count+'
'+(e.offset>0?'
':"")+(s+e.offset
':"")+"
",a.querySelector("table").append(c),e.offset>0&&a.querySelector("button[data-page='previous']").addEventListener("click",o),s+e.offset",cityssm.postJSON(t.urlPrefix+"/lotOccupancies/doSearchLotOccupancies",e,i)}function l(){c.value="0",n()}function o(){c.value=Math.max(Number.parseInt(c.value,10)-s,0).toString(),n()}function r(){c.value=(Number.parseInt(c.value,10)+s).toString(),n()}const p=e.querySelectorAll("input, select");for(const t of p)t.addEventListener("change",l);e.addEventListener("submit",t=>{t.preventDefault(),l()}),n()})(); \ No newline at end of file diff --git a/public/javascripts/lotSearch.min.js b/public/javascripts/lotSearch.min.js index 62f63c91..7d4e6908 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),i=document.querySelector("#searchFilter--offset"),r=()=>{const r=Number.parseInt(i.value,10);s.innerHTML='

Loading '+exports.aliases.lots+"...
",cityssm.postJSON(e.urlPrefix+"/lots/doSearchLots",t,t=>{if(0===t.lots.length)return void(s.innerHTML='

There are no '+exports.aliases.lots.toLowerCase()+" that meet the search criteria.

");const i=document.createElement("tbody");for(const s of t.lots)i.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':"")+"
'+cityssm.escapeHTML(exports.aliases.lot)+""+cityssm.escapeHTML(exports.aliases.map)+""+cityssm.escapeHTML(exports.aliases.lot)+' TypeStatus
Displaying '+(r+1).toString()+" to "+Math.min(t.count,a+r)+" of "+t.count+'
'+(r>0?'
':"")+(a+r
':"")+"
",s.querySelector("table").append(i),r>0&&s.querySelector("button[data-page='previous']").addEventListener("click",o),a+r{i.value="0",r()},o=()=>{i.value=Math.max(Number.parseInt(i.value,10)-a,0).toString(),r()},n=()=>{i.value=(Number.parseInt(i.value,10)+a).toString(),r()},c=t.querySelectorAll("input, select");for(const e of c)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault(),l()}),r()})(); \ 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),i=document.querySelector("#searchFilter--offset");function r(t){if(0===t.lots.length)return void(s.innerHTML='

There are no '+e.escapedAliases.lots+" that meet the search criteria.

");const i=document.createElement("tbody");for(const s of t.lots)i.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':"")+"
'+e.escapedAliases.Lot+""+e.escapedAliases.Map+""+e.escapedAliases.Lot+' TypeStatus
Displaying '+(t.offset+1).toString()+" to "+Math.min(t.count,a+t.offset)+" of "+t.count+'
'+(t.offset>0?'
':"")+(a+t.offset
':"")+"
",s.querySelector("table").append(i),t.offset>0&&s.querySelector("button[data-page='previous']").addEventListener("click",n),a+t.offset",cityssm.postJSON(e.urlPrefix+"/lots/doSearchLots",t,r)}function o(){i.value="0",l()}function n(){i.value=Math.max(Number.parseInt(i.value,10)-a,0).toString(),l()}function c(){i.value=(Number.parseInt(i.value,10)+a).toString(),l()}const d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",o);t.addEventListener("submit",e=>{e.preventDefault(),o()}),l()})(); \ No newline at end of file diff --git a/public/javascripts/main.min.js b/public/javascripts/main.min.js index a4b1b3bf..307697a2 100644 --- a/public/javascripts/main.min.js +++ b/public/javascripts/main.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=e=>{const t=e.currentTarget.closest(".field").querySelector("input, select");if(t.classList.remove("is-readonly"),"INPUT"===t.tagName)t.readOnly=!1,t.disabled=!1;else{const e=t.querySelectorAll("option");for(const t of e)t.disabled=!1}t.focus()},t={type:"date",dateFormat:"yyyy-MM-dd",showFooter:!1,color:"info",displayMode:"dialog"},a=["red","green","orange","blue","pink","yellow","purple"],o=["bright","light","dark"],s={urlPrefix:document.querySelector("main").dataset.urlPrefix,apiKey:document.querySelector("main").dataset.apiKey,highlightMap:(e,t,a)=>{let o,s=t;for(;!(o=e.querySelector("#"+s))&&s.includes("-");)s=s.slice(0,Math.max(0,s.lastIndexOf("-")));if(o){o.style.fill="",o.classList.add("highlight","is-"+a);const e=o.querySelectorAll("path");for(const t of e)t.style.fill=""}},initializeUnlockFieldButtons:t=>{const a=t.querySelectorAll(".is-unlock-field-button");for(const t of a)t.addEventListener("click",e)},initializeDatePickers:e=>{const a=e.querySelectorAll("input[type='date']");for(const o of a){const a=Object.assign({},t);o.required&&(a.showClearButton=!1),o.min&&(a.minDate=cityssm.dateStringToDate(o.min)),o.max&&(a.maxDate=cityssm.dateStringToDate(o.max));const s=exports.bulmaCalendar.attach(o,a)[0];s.on("save",()=>{o.value=s.value(),o.dispatchEvent(new Event("change"))}),s.on("show",()=>{document.querySelector("html").classList.add("is-clipped")}),s.on("hide",()=>{bulmaJS.toggleHtmlClipped()});const l=e.querySelector("#"+s._id),r=l.querySelectorAll(".datepicker-nav button.is-text");for(const e of r)e.classList.add("is-"+t.color),e.classList.remove("is-text");const n=l.querySelector(".datetimepicker-clear-button");n&&(o.required?n.remove():(n.dataset.tooltip="Clear",n.ariaLabel="Clear",n.innerHTML=''));const i=document.querySelector("label[for='"+o.id+"']");i&&(l.querySelector(".datetimepicker-dummy-input").ariaLabel=i.textContent)}},populateAliases:e=>{const t=e.querySelectorAll(".alias");for(const e of t)switch(e.dataset.alias){case"Map":e.textContent=exports.aliases.map;break;case"Lot":e.textContent=exports.aliases.lot;break;case"lot":e.textContent=exports.aliases.lot.toLowerCase();break;case"Occupancy":e.textContent=exports.aliases.occupancy;break;case"occupancy":e.textContent=exports.aliases.occupancy.toLowerCase();break;case"Occupant":e.textContent=exports.aliases.occupant;break;case"occupant":e.textContent=exports.aliases.occupant.toLowerCase();break;case"ExternalReceiptNumber":e.textContent=exports.aliases.externalReceiptNumber}},getRandomColor:e=>{let t=e;return t.length<2&&(t+="a1"),exports.randomColor({seed:t+t,hue:a[t.codePointAt(t.length-1)%a.length],luminosity:o[t.codePointAt(t.length-2)%o.length]})}};exports.los=s})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=e=>{const t=e.currentTarget.closest(".field").querySelector("input, select");if(t.classList.remove("is-readonly"),"INPUT"===t.tagName)t.readOnly=!1,t.disabled=!1;else{const e=t.querySelectorAll("option");for(const t of e)t.disabled=!1}t.focus()},t={type:"date",dateFormat:"yyyy-MM-dd",showFooter:!1,color:"info",displayMode:"dialog"},s=Object.freeze({Map:cityssm.escapeHTML(exports.aliases.map),map:cityssm.escapeHTML(exports.aliases.map.toLowerCase()),Lot:cityssm.escapeHTML(exports.aliases.lot),lot:cityssm.escapeHTML(exports.aliases.lot.toLowerCase()),Lots:cityssm.escapeHTML(exports.aliases.lots),lots:cityssm.escapeHTML(exports.aliases.lots.toLowerCase()),Occupancy:cityssm.escapeHTML(exports.aliases.occupancy),occupancy:cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase()),Occupancies:cityssm.escapeHTML(exports.aliases.occupancies),occupancies:cityssm.escapeHTML(exports.aliases.occupancies.toLowerCase()),Occupant:cityssm.escapeHTML(exports.aliases.occupant),occupant:cityssm.escapeHTML(exports.aliases.occupant.toLowerCase()),Occupants:cityssm.escapeHTML(exports.aliases.occupants),occupants:cityssm.escapeHTML(exports.aliases.occupants.toLowerCase()),ExternalReceiptNumber:cityssm.escapeHTML(exports.aliases.externalReceiptNumber),externalReceiptNumber:cityssm.escapeHTML(exports.aliases.externalReceiptNumber.toLowerCase()),OccupancyStartDate:cityssm.escapeHTML(exports.aliases.occupancyStartDate),occupancyStartDate:cityssm.escapeHTML(exports.aliases.occupancyStartDate.toLowerCase()),WorkOrderOpenDate:cityssm.escapeHTML(exports.aliases.workOrderOpenDate),workOrderOpenDate:cityssm.escapeHTML(exports.aliases.workOrderOpenDate.toLowerCase()),WorkOrderCloseDate:cityssm.escapeHTML(exports.aliases.workOrderCloseDate),workOrderCloseDate:cityssm.escapeHTML(exports.aliases.workOrderCloseDate.toLowerCase())}),a=["red","green","orange","blue","pink","yellow","purple"],o=["bright","light","dark"],c={urlPrefix:document.querySelector("main").dataset.urlPrefix,apiKey:document.querySelector("main").dataset.apiKey,highlightMap:(e,t,s)=>{let a,o=t;for(;!(a=e.querySelector("#"+o))&&o.includes("-");)o=o.slice(0,Math.max(0,o.lastIndexOf("-")));if(a){a.style.fill="",a.classList.add("highlight","is-"+s);const e=a.querySelectorAll("path");for(const t of e)t.style.fill=""}},initializeUnlockFieldButtons:t=>{const s=t.querySelectorAll(".is-unlock-field-button");for(const t of s)t.addEventListener("click",e)},initializeDatePickers:e=>{const s=e.querySelectorAll("input[type='date']");for(const a of s){const s=Object.assign({},t);a.required&&(s.showClearButton=!1),a.min&&(s.minDate=cityssm.dateStringToDate(a.min)),a.max&&(s.maxDate=cityssm.dateStringToDate(a.max));const o=exports.bulmaCalendar.attach(a,s)[0];o.on("save",()=>{a.value=o.value(),a.dispatchEvent(new Event("change"))}),o.on("show",()=>{document.querySelector("html").classList.add("is-clipped")}),o.on("hide",()=>{bulmaJS.toggleHtmlClipped()});const c=e.querySelector("#"+o._id),r=c.querySelectorAll(".datepicker-nav button.is-text");for(const e of r)e.classList.add("is-"+t.color),e.classList.remove("is-text");const l=c.querySelector(".datetimepicker-clear-button");l&&(a.required?l.remove():(l.dataset.tooltip="Clear",l.ariaLabel="Clear",l.innerHTML=''));const i=document.querySelector("label[for='"+a.id+"']");i&&(c.querySelector(".datetimepicker-dummy-input").ariaLabel=i.textContent)}},populateAliases:e=>{const t=e.querySelectorAll(".alias");for(const e of t)switch(e.dataset.alias){case"Map":e.textContent=exports.aliases.map;break;case"Lot":e.textContent=exports.aliases.lot;break;case"lot":e.textContent=exports.aliases.lot.toLowerCase();break;case"Occupancy":e.textContent=exports.aliases.occupancy;break;case"occupancy":e.textContent=exports.aliases.occupancy.toLowerCase();break;case"Occupant":e.textContent=exports.aliases.occupant;break;case"occupant":e.textContent=exports.aliases.occupant.toLowerCase();break;case"ExternalReceiptNumber":e.textContent=exports.aliases.externalReceiptNumber}},escapedAliases:s,getRandomColor:e=>{let t=e;return t.length<2&&(t+="a1"),exports.randomColor({seed:t+t,hue:a[t.codePointAt(t.length-1)%a.length],luminosity:o[t.codePointAt(t.length-2)%o.length]})}};exports.los=c})(); \ No newline at end of file diff --git a/public/javascripts/workOrderMilestoneCalendar.min.js b/public/javascripts/workOrderMilestoneCalendar.min.js index 1fd94fbc..37aa7f7d 100644 --- a/public/javascripts/workOrderMilestoneCalendar.min.js +++ b/public/javascripts/workOrderMilestoneCalendar.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,s=document.querySelector("#form--searchFilters"),r=s.querySelector("#searchFilter--workOrderMilestoneDateFilter"),a=s.querySelector("#searchFilter--workOrderMilestoneDateString"),t=document.querySelector("#container--milestoneCalendar"),i=r=>{r&&r.preventDefault(),t.innerHTML='

Loading Milestones...
',cityssm.postJSON(e.urlPrefix+"/workOrders/doGetWorkOrderMilestones",s,s=>{(s=>{if(0===s.length)return void(t.innerHTML='

There are no milestones that meet the search criteria.

');t.innerHTML="";const r=cityssm.dateToString(new Date);let a,i="";for(const o of s){i!==o.workOrderMilestoneDateString&&(a&&t.append(a),(a=document.createElement("div")).className="panel",a.innerHTML='

'+o.workOrderMilestoneDateString+"

",i=o.workOrderMilestoneDateString);const s=document.createElement("div");s.className="panel-block is-block",!o.workOrderMilestoneCompletionDate&&o.workOrderMilestoneDateString '+cityssm.escapeHTML(e.lotName||"")+"
";for(const e of o.workOrderLotOccupancies)for(const s of e.lotOccupancyOccupants)n+=' '+cityssm.escapeHTML(s.occupantName||"")+"
";s.innerHTML='
'+(o.workOrderMilestoneCompletionDate?'':'')+'
'+(0===o.workOrderMilestoneTime?"":o.workOrderMilestoneTimeString+"
")+(o.workOrderMilestoneTypeId?""+cityssm.escapeHTML(o.workOrderMilestoneType)+"
":"")+''+cityssm.escapeHTML(o.workOrderMilestoneDescription)+'
'+cityssm.escapeHTML(o.workOrderNumber||"")+'
'+cityssm.escapeHTML(o.workOrderDescription||"")+'
'+n+"
",a.append(s)}t.append(a)})(s.workOrderMilestones)})};r.addEventListener("change",()=>{a.closest("fieldset").disabled="date"!==r.value,i()}),e.initializeDatePickers(s),a.addEventListener("change",i),s.addEventListener("submit",i),i()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,s=document.querySelector("#form--searchFilters"),r=s.querySelector("#searchFilter--workOrderMilestoneDateFilter"),a=s.querySelector("#searchFilter--workOrderMilestoneDateString"),t=document.querySelector("#container--milestoneCalendar"),i=r=>{r&&r.preventDefault(),t.innerHTML='

Loading Milestones...
',cityssm.postJSON(e.urlPrefix+"/workOrders/doGetWorkOrderMilestones",s,s=>{(s=>{if(0===s.length)return void(t.innerHTML='

There are no milestones that meet the search criteria.

');t.innerHTML="";const r=cityssm.dateToString(new Date);let a,i="";for(const o of s){i!==o.workOrderMilestoneDateString&&(a&&t.append(a),(a=document.createElement("div")).className="panel",a.innerHTML='

'+o.workOrderMilestoneDateString+"

",i=o.workOrderMilestoneDateString);const s=document.createElement("div");s.className="panel-block is-block",!o.workOrderMilestoneCompletionDate&&o.workOrderMilestoneDateString '+cityssm.escapeHTML(s.lotName||"")+"
";for(const s of o.workOrderLotOccupancies)for(const r of s.lotOccupancyOccupants)n+=' '+cityssm.escapeHTML(r.occupantName||"")+"
";s.innerHTML='
'+(o.workOrderMilestoneCompletionDate?'':'')+'
'+(0===o.workOrderMilestoneTime?"":o.workOrderMilestoneTimeString+"
")+(o.workOrderMilestoneTypeId?""+cityssm.escapeHTML(o.workOrderMilestoneType)+"
":"")+''+cityssm.escapeHTML(o.workOrderMilestoneDescription)+'
'+cityssm.escapeHTML(o.workOrderNumber||"")+'
'+cityssm.escapeHTML(o.workOrderDescription||"")+'
'+n+"
",a.append(s)}t.append(a)})(s.workOrderMilestones)})};r.addEventListener("change",()=>{a.closest("fieldset").disabled="date"!==r.value,i()}),e.initializeDatePickers(s),a.addEventListener("change",i),s.addEventListener("submit",i),i()})(); \ No newline at end of file diff --git a/public/javascripts/workOrderSearch.min.js b/public/javascripts/workOrderSearch.min.js index 4bc37e1e..2fee0bcb 100644 --- a/public/javascripts/workOrderSearch.min.js +++ b/public/javascripts/workOrderSearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=exports.workOrderPrints,s=document.querySelector("#form--searchFilters");e.initializeDatePickers(s);const a=document.querySelector("#container--searchResults"),r=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),o=document.querySelector("#searchFilter--offset");function i(s){if(0===s.workOrders.length)return void(a.innerHTML='

There are no work orders that meet the search criteria.

');const o=document.createElement("tbody");for(const a of s.workOrders){let s="";for(const e of a.workOrderLots)s+=' '+cityssm.escapeHTML(e.lotName||"(No Lot Name)")+"
";for(const e of a.workOrderLotOccupancies)for(const t of e.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(t.occupantName||"(No Name)")+"
";o.insertAdjacentHTML("beforeend",'
"+(t.length>0?'':"")+"")}a.innerHTML='
'+(a.workOrderNumber.trim()?cityssm.escapeHTML(a.workOrderNumber||""):"(No Number)")+""+cityssm.escapeHTML(a.workOrderType||"")+'
'+cityssm.escapeHTML(a.workOrderDescription||"")+'
'+s+' '+a.workOrderOpenDateString+'
'+(a.workOrderCloseDate?a.workOrderCloseDateString:'(No '+cityssm.escapeHTML(exports.aliases.workOrderCloseDate)+")")+"
"+(0===a.workOrderMilestoneCount?"-":a.workOrderMilestoneCompletionCount+" / "+a.workOrderMilestoneCount)+"
'+(t.length>0?'':"")+'
Work Order NumberDescriptionRelatedDateProgress
Displaying '+(s.offset+1).toString()+" to "+Math.min(s.count,r+s.offset)+" of "+s.count+'
'+(s.offset>0?'
':"")+(r+s.offset
':"")+"
",a.querySelector("table").append(o),s.offset>0&&a.querySelector("button[data-page='previous']").addEventListener("click",c),r+s.offset{e.preventDefault(),n()}),l()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=exports.workOrderPrints,s=document.querySelector("#form--searchFilters");e.initializeDatePickers(s);const a=document.querySelector("#container--searchResults"),r=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),o=document.querySelector("#searchFilter--offset");function i(s){if(0===s.workOrders.length)return void(a.innerHTML='

There are no work orders that meet the search criteria.

');const o=document.createElement("tbody");for(const a of s.workOrders){let s="";for(const t of a.workOrderLots)s+=' '+cityssm.escapeHTML(t.lotName||"(No "+exports.aliases.Lot+" Name)")+"
";for(const t of a.workOrderLotOccupancies)for(const a of t.lotOccupancyOccupants)s+=' '+cityssm.escapeHTML(a.occupantName||"(No Name)")+"
";o.insertAdjacentHTML("beforeend",'
"+(t.length>0?'':"")+"")}a.innerHTML='
'+(a.workOrderNumber.trim()?cityssm.escapeHTML(a.workOrderNumber||""):"(No Number)")+""+cityssm.escapeHTML(a.workOrderType||"")+'
'+cityssm.escapeHTML(a.workOrderDescription||"")+'
'+s+' '+a.workOrderOpenDateString+'
'+(a.workOrderCloseDate?a.workOrderCloseDateString:'(No '+e.escapedAliases.WorkOrderCloseDate+")")+"
"+(0===a.workOrderMilestoneCount?"-":a.workOrderMilestoneCompletionCount+" / "+a.workOrderMilestoneCount)+"
'+(t.length>0?'':"")+'
Work Order NumberDescriptionRelatedDateProgress
Displaying '+(s.offset+1).toString()+" to "+Math.min(s.count,r+s.offset)+" of "+s.count+'
'+(s.offset>0?'
':"")+(r+s.offset
':"")+"
",a.querySelector("table").append(o),s.offset>0&&a.querySelector("button[data-page='previous']").addEventListener("click",c),r+s.offset{e.preventDefault(),n()}),l()})(); \ No newline at end of file diff --git a/types/globalTypes.d.ts b/types/globalTypes.d.ts index 439f228c..d6517137 100644 --- a/types/globalTypes.d.ts +++ b/types/globalTypes.d.ts @@ -5,5 +5,29 @@ export interface LOS { initializeDatePickers: (containerElement: HTMLElement) => void; initializeUnlockFieldButtons: (containerElement: HTMLElement) => void; populateAliases: (containerElement: HTMLElement) => void; + escapedAliases: { + Map: string; + map: string; + Lot: string; + lot: string; + Lots: string; + lots: string; + Occupancy: string; + occupancy: string; + Occupancies: string; + occupancies: string; + Occupant: string; + occupant: string; + Occupants: string; + occupants: string; + ExternalReceiptNumber: string; + externalReceiptNumber: string; + OccupancyStartDate: string; + occupancyStartDate: string; + WorkOrderOpenDate: string; + workOrderOpenDate: string; + WorkOrderCloseDate: string; + workOrderCloseDate: string; + }; getRandomColor: (seedString: string) => string; } diff --git a/types/globalTypes.ts b/types/globalTypes.ts index daf6b131..c09caf3d 100644 --- a/types/globalTypes.ts +++ b/types/globalTypes.ts @@ -14,5 +14,30 @@ export interface LOS { initializeUnlockFieldButtons: (containerElement: HTMLElement) => void; populateAliases: (containerElement: HTMLElement) => void; + escapedAliases: { + Map: string; + map: string; + Lot: string; + lot: string; + Lots: string; + lots: string; + Occupancy: string; + occupancy: string; + Occupancies: string; + occupancies: string; + Occupant: string; + occupant: string; + Occupants: string; + occupants: string; + ExternalReceiptNumber: string; + externalReceiptNumber: string; + OccupancyStartDate: string; + occupancyStartDate: string; + WorkOrderOpenDate: string; + workOrderOpenDate: string; + WorkOrderCloseDate: string; + workOrderCloseDate: string; + }; + getRandomColor: (seedString: string) => string; }