refactoring

deepsource-autofix-76c6eb20
Dan Gowans 2024-06-25 09:57:47 -04:00
parent 47eb2f4abd
commit 2247857716
22 changed files with 211 additions and 369 deletions

View File

@ -1,15 +1,12 @@
import { configWebApp } from 'eslint-config-cityssm' import { configWebApp } from 'eslint-config-cityssm'
import tseslint from 'typescript-eslint' import tseslint from 'typescript-eslint'
export const config = tseslint.config( export const config = tseslint.config(...configWebApp, {
...configWebApp, languageOptions: {
{ parserOptions: {
languageOptions: { project: ['./tsconfig.json', './tsconfig.client.json']
parserOptions: {
project: ['./tsconfig.json', './tsconfig.client.json']
}
} }
} }
) })
export default config export default config

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b; var _a, _b;

View File

@ -1,5 +1,4 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {

View File

@ -1,5 +1,4 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {

View File

@ -1,5 +1,4 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {

View File

@ -13,7 +13,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
.querySelectorAll('.button.is-static')[1].innerHTML = `<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`; .querySelectorAll('.button.is-static')[1].innerHTML = `<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
} }
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let workOrderTypes = exports.workOrderTypes; let workOrderTypes = exports.workOrderTypes;
@ -189,7 +188,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
renderWorkOrderTypes(); renderWorkOrderTypes();
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let workOrderMilestoneTypes = exports.workOrderMilestoneTypes; let workOrderMilestoneTypes = exports.workOrderMilestoneTypes;
@ -364,7 +362,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
renderWorkOrderMilestoneTypes(); renderWorkOrderMilestoneTypes();
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let lotStatuses = exports.lotStatuses; let lotStatuses = exports.lotStatuses;
@ -541,7 +538,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
renderLotStatuses(); renderLotStatuses();
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupantTypes = exports.lotOccupantTypes; let lotOccupantTypes = exports.lotOccupantTypes;

View File

@ -1,5 +1,4 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupantTypes = exports.lotOccupantTypes; let lotOccupantTypes = exports.lotOccupantTypes;

View File

@ -1,5 +1,4 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let lotStatuses = exports.lotStatuses; let lotStatuses = exports.lotStatuses;

View File

@ -1,5 +1,4 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let workOrderMilestoneTypes = exports.workOrderMilestoneTypes; let workOrderMilestoneTypes = exports.workOrderMilestoneTypes;

View File

@ -1,5 +1,4 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let workOrderTypes = exports.workOrderTypes; let workOrderTypes = exports.workOrderTypes;

View File

@ -1,5 +1,6 @@
"use strict"; "use strict";
/* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @eslint-community/eslint-comments/disable-enable-pair */
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b, _c, _d, _e, _f; var _a, _b, _c, _d, _e, _f;
@ -25,9 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const formElement = document.querySelector('#form--lotOccupancy'); const formElement = document.querySelector('#form--lotOccupancy');
formElement.addEventListener('submit', (formEvent) => { formElement.addEventListener('submit', (formEvent) => {
formEvent.preventDefault(); formEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/${isCreate ? 'doCreateLotOccupancy' : 'doUpdateLotOccupancy'}`, formElement, (rawResponseJSON) => {
'/lotOccupancies/' +
(isCreate ? 'doCreateLotOccupancy' : 'doUpdateLotOccupancy'), formElement, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
@ -44,7 +43,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
else { else {
bulmaJS.alert({ bulmaJS.alert({
title: 'Error Saving ' + los.escapedAliases.Occupancy, title: `Error Saving ${los.escapedAliases.Occupancy}`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger' contextualColorName: 'danger'
}); });
@ -56,7 +55,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
formInputElement.addEventListener('change', setUnsavedChanges); formInputElement.addEventListener('change', setUnsavedChanges);
} }
function doCopy() { function doCopy() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doCopyLotOccupancy', { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doCopyLotOccupancy`, {
lotOccupancyId lotOccupancyId
}, (rawResponseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
@ -100,7 +99,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
.querySelector('#button--deleteLotOccupancy')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', (clickEvent) => { .querySelector('#button--deleteLotOccupancy')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', (clickEvent) => {
clickEvent.preventDefault(); clickEvent.preventDefault();
function doDelete() { function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancy', { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`, {
lotOccupancyId lotOccupancyId
}, (rawResponseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
@ -134,7 +133,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let createCloseModalFunction; let createCloseModalFunction;
function doCreate(formEvent) { function doCreate(formEvent) {
formEvent.preventDefault(); formEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/workOrders/doCreateWorkOrder', formEvent.currentTarget, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/workOrders/doCreateWorkOrder`, formEvent.currentTarget, (rawResponseJSON) => {
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
createCloseModalFunction(); createCloseModalFunction();
@ -166,7 +165,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector('#workOrderCreate--lotOccupancyId').value = lotOccupancyId; modalElement.querySelector('#workOrderCreate--lotOccupancyId').value = lotOccupancyId;
modalElement.querySelector('#workOrderCreate--workOrderOpenDateString').value = cityssm.dateToString(new Date()); modalElement.querySelector('#workOrderCreate--workOrderOpenDateString').value = cityssm.dateToString(new Date());
const workOrderTypeSelectElement = modalElement.querySelector('#workOrderCreate--workOrderTypeId'); const workOrderTypeSelectElement = modalElement.querySelector('#workOrderCreate--workOrderTypeId');
const workOrderTypes = exports.workOrderTypes; const workOrderTypes = exports
.workOrderTypes;
if (workOrderTypes.length === 1) { if (workOrderTypes.length === 1) {
workOrderTypeSelectElement.innerHTML = ''; workOrderTypeSelectElement.innerHTML = '';
} }
@ -197,6 +197,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const lotOccupancyFieldsContainerElement = document.querySelector('#container--lotOccupancyFields'); const lotOccupancyFieldsContainerElement = document.querySelector('#container--lotOccupancyFields');
occupancyTypeIdElement.addEventListener('change', () => { occupancyTypeIdElement.addEventListener('change', () => {
if (occupancyTypeIdElement.value === '') { if (occupancyTypeIdElement.value === '') {
// eslint-disable-next-line no-unsanitized/property
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p> <p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p>
</div>`; </div>`;
@ -208,6 +209,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var _a, _b; var _a, _b;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.occupancyTypeFields.length === 0) { if (responseJSON.occupancyTypeFields.length === 0) {
// eslint-disable-next-line no-unsanitized/property
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no additional fields for this ${los.escapedAliases.occupancy} type.</p> <p class="message-body">There are no additional fields for this ${los.escapedAliases.occupancy} type.</p>
</div>`; </div>`;
@ -218,12 +220,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
for (const occupancyTypeField of responseJSON.occupancyTypeFields) { for (const occupancyTypeField of responseJSON.occupancyTypeFields) {
occupancyTypeFieldIds += occupancyTypeFieldIds +=
',' + occupancyTypeField.occupancyTypeFieldId.toString(); ',' + occupancyTypeField.occupancyTypeFieldId.toString();
const fieldName = 'lotOccupancyFieldValue_' + const fieldName = `lotOccupancyFieldValue_${occupancyTypeField.occupancyTypeFieldId.toString()}`;
occupancyTypeField.occupancyTypeFieldId.toString(); const fieldId = `lotOccupancy--${fieldName}`;
const fieldId = 'lotOccupancy--' + fieldName;
const fieldElement = document.createElement('div'); const fieldElement = document.createElement('div');
fieldElement.className = 'field'; fieldElement.className = 'field';
fieldElement.innerHTML = `<label class="label" for="${fieldId}"></label><div class="control"></div>`; fieldElement.innerHTML = `<label class="label" for="${cityssm.escapeHTML(fieldId)}"></label><div class="control"></div>`;
fieldElement.querySelector('label').textContent = occupancyTypeField.occupancyTypeField; fieldElement.querySelector('label').textContent = occupancyTypeField.occupancyTypeField;
if (((_a = occupancyTypeField.occupancyTypeFieldValues) !== null && _a !== void 0 ? _a : '') === '') { if (((_a = occupancyTypeField.occupancyTypeFieldValues) !== null && _a !== void 0 ? _a : '') === '') {
const inputElement = document.createElement('input'); const inputElement = document.createElement('input');
@ -245,7 +246,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
else { else {
; ;
fieldElement.querySelector('.control').innerHTML = `<div class="select is-fullwidth"> fieldElement.querySelector('.control').innerHTML = `<div class="select is-fullwidth">
<select id="${fieldId}" name="${fieldName}"> <select id="${cityssm.escapeHTML(fieldId)}" name="${cityssm.escapeHTML(fieldName)}">
<option value="">(Not Set)</option> <option value="">(Not Set)</option>
</select> </select>
</div>`; </div>`;
@ -262,7 +263,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
console.log(fieldElement); console.log(fieldElement);
lotOccupancyFieldsContainerElement.append(fieldElement); lotOccupancyFieldsContainerElement.append(fieldElement);
} }
lotOccupancyFieldsContainerElement.insertAdjacentHTML('beforeend', `<input name="occupancyTypeFieldIds" type="hidden" value="${occupancyTypeFieldIds.slice(1)}" />`); lotOccupancyFieldsContainerElement.insertAdjacentHTML('beforeend',
// eslint-disable-next-line no-secrets/no-secrets
`<input name="occupancyTypeFieldIds" type="hidden"
value="${cityssm.escapeHTML(occupancyTypeFieldIds.slice(1))}" />`);
}); });
}); });
} }
@ -312,9 +316,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName); renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName);
} }
function searchLots() { function searchLots() {
// eslint-disable-next-line no-unsanitized/property
lotSelectResultsElement.innerHTML = lotSelectResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...'); los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', lotSelectFormElement, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/lots/doSearchLots`, lotSelectFormElement, (rawResponseJSON) => {
var _a, _b; var _a, _b;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.count === 0) { if (responseJSON.count === 0) {
@ -331,23 +336,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
panelBlockElement.href = '#'; panelBlockElement.href = '#';
panelBlockElement.dataset.lotId = lot.lotId.toString(); panelBlockElement.dataset.lotId = lot.lotId.toString();
panelBlockElement.dataset.lotName = lot.lotName; panelBlockElement.dataset.lotName = lot.lotName;
panelBlockElement.innerHTML = // eslint-disable-next-line no-unsanitized/property
'<div class="columns">' + panelBlockElement.innerHTML = `<div class="columns">
('<div class="column">' + <div class="column">
cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + ${cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '')}<br />
'<br />' + <span class="is-size-7">${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')}</span>
'<span class="is-size-7">' + </div>
cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '') + <div class="column">
'</span>' + ${cityssm.escapeHTML(lot.lotStatus)}<br />
'</div>') + <span class="is-size-7">
('<div class="column">' + ${lot.lotOccupancyCount > 0 ? 'Currently Occupied' : ''}
cityssm.escapeHTML(lot.lotStatus) + </span>
'<br />' + </div>
'<span class="is-size-7">' + </div>`;
(lot.lotOccupancyCount > 0 ? 'Currently Occupied' : '') +
'</span>' +
'</div>') +
'</div>';
panelBlockElement.addEventListener('click', selectExistingLot); panelBlockElement.addEventListener('click', selectExistingLot);
panelElement.append(panelBlockElement); panelElement.append(panelBlockElement);
} }
@ -358,7 +359,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
function createLotAndSelect(submitEvent) { function createLotAndSelect(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value; const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value;
cityssm.postJSON(los.urlPrefix + '/lots/doCreateLot', submitEvent.currentTarget, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/lots/doCreateLot`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
@ -1089,7 +1090,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
renderLotOccupancyComments(); renderLotOccupancyComments();
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent, unicorn/prefer-module */ /* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupancyFees = exports.lotOccupancyFees; let lotOccupancyFees = exports.lotOccupancyFees;
delete exports.lotOccupancyFees; delete exports.lotOccupancyFees;

View File

@ -1,5 +1,6 @@
"use strict"; "use strict";
/* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @eslint-community/eslint-comments/disable-enable-pair */
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b, _c, _d, _e, _f; var _a, _b, _c, _d, _e, _f;
@ -25,9 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const formElement = document.querySelector('#form--lotOccupancy'); const formElement = document.querySelector('#form--lotOccupancy');
formElement.addEventListener('submit', (formEvent) => { formElement.addEventListener('submit', (formEvent) => {
formEvent.preventDefault(); formEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/${isCreate ? 'doCreateLotOccupancy' : 'doUpdateLotOccupancy'}`, formElement, (rawResponseJSON) => {
'/lotOccupancies/' +
(isCreate ? 'doCreateLotOccupancy' : 'doUpdateLotOccupancy'), formElement, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
@ -44,7 +43,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
else { else {
bulmaJS.alert({ bulmaJS.alert({
title: 'Error Saving ' + los.escapedAliases.Occupancy, title: `Error Saving ${los.escapedAliases.Occupancy}`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger' contextualColorName: 'danger'
}); });
@ -56,7 +55,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
formInputElement.addEventListener('change', setUnsavedChanges); formInputElement.addEventListener('change', setUnsavedChanges);
} }
function doCopy() { function doCopy() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doCopyLotOccupancy', { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doCopyLotOccupancy`, {
lotOccupancyId lotOccupancyId
}, (rawResponseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
@ -100,7 +99,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
.querySelector('#button--deleteLotOccupancy')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', (clickEvent) => { .querySelector('#button--deleteLotOccupancy')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', (clickEvent) => {
clickEvent.preventDefault(); clickEvent.preventDefault();
function doDelete() { function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancy', { cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`, {
lotOccupancyId lotOccupancyId
}, (rawResponseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
@ -134,7 +133,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let createCloseModalFunction; let createCloseModalFunction;
function doCreate(formEvent) { function doCreate(formEvent) {
formEvent.preventDefault(); formEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/workOrders/doCreateWorkOrder', formEvent.currentTarget, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/workOrders/doCreateWorkOrder`, formEvent.currentTarget, (rawResponseJSON) => {
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
createCloseModalFunction(); createCloseModalFunction();
@ -166,7 +165,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector('#workOrderCreate--lotOccupancyId').value = lotOccupancyId; modalElement.querySelector('#workOrderCreate--lotOccupancyId').value = lotOccupancyId;
modalElement.querySelector('#workOrderCreate--workOrderOpenDateString').value = cityssm.dateToString(new Date()); modalElement.querySelector('#workOrderCreate--workOrderOpenDateString').value = cityssm.dateToString(new Date());
const workOrderTypeSelectElement = modalElement.querySelector('#workOrderCreate--workOrderTypeId'); const workOrderTypeSelectElement = modalElement.querySelector('#workOrderCreate--workOrderTypeId');
const workOrderTypes = exports.workOrderTypes; const workOrderTypes = exports
.workOrderTypes;
if (workOrderTypes.length === 1) { if (workOrderTypes.length === 1) {
workOrderTypeSelectElement.innerHTML = ''; workOrderTypeSelectElement.innerHTML = '';
} }
@ -197,6 +197,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const lotOccupancyFieldsContainerElement = document.querySelector('#container--lotOccupancyFields'); const lotOccupancyFieldsContainerElement = document.querySelector('#container--lotOccupancyFields');
occupancyTypeIdElement.addEventListener('change', () => { occupancyTypeIdElement.addEventListener('change', () => {
if (occupancyTypeIdElement.value === '') { if (occupancyTypeIdElement.value === '') {
// eslint-disable-next-line no-unsanitized/property
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p> <p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p>
</div>`; </div>`;
@ -208,6 +209,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var _a, _b; var _a, _b;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.occupancyTypeFields.length === 0) { if (responseJSON.occupancyTypeFields.length === 0) {
// eslint-disable-next-line no-unsanitized/property
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no additional fields for this ${los.escapedAliases.occupancy} type.</p> <p class="message-body">There are no additional fields for this ${los.escapedAliases.occupancy} type.</p>
</div>`; </div>`;
@ -218,12 +220,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
for (const occupancyTypeField of responseJSON.occupancyTypeFields) { for (const occupancyTypeField of responseJSON.occupancyTypeFields) {
occupancyTypeFieldIds += occupancyTypeFieldIds +=
',' + occupancyTypeField.occupancyTypeFieldId.toString(); ',' + occupancyTypeField.occupancyTypeFieldId.toString();
const fieldName = 'lotOccupancyFieldValue_' + const fieldName = `lotOccupancyFieldValue_${occupancyTypeField.occupancyTypeFieldId.toString()}`;
occupancyTypeField.occupancyTypeFieldId.toString(); const fieldId = `lotOccupancy--${fieldName}`;
const fieldId = 'lotOccupancy--' + fieldName;
const fieldElement = document.createElement('div'); const fieldElement = document.createElement('div');
fieldElement.className = 'field'; fieldElement.className = 'field';
fieldElement.innerHTML = `<label class="label" for="${fieldId}"></label><div class="control"></div>`; fieldElement.innerHTML = `<label class="label" for="${cityssm.escapeHTML(fieldId)}"></label><div class="control"></div>`;
fieldElement.querySelector('label').textContent = occupancyTypeField.occupancyTypeField; fieldElement.querySelector('label').textContent = occupancyTypeField.occupancyTypeField;
if (((_a = occupancyTypeField.occupancyTypeFieldValues) !== null && _a !== void 0 ? _a : '') === '') { if (((_a = occupancyTypeField.occupancyTypeFieldValues) !== null && _a !== void 0 ? _a : '') === '') {
const inputElement = document.createElement('input'); const inputElement = document.createElement('input');
@ -245,7 +246,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
else { else {
; ;
fieldElement.querySelector('.control').innerHTML = `<div class="select is-fullwidth"> fieldElement.querySelector('.control').innerHTML = `<div class="select is-fullwidth">
<select id="${fieldId}" name="${fieldName}"> <select id="${cityssm.escapeHTML(fieldId)}" name="${cityssm.escapeHTML(fieldName)}">
<option value="">(Not Set)</option> <option value="">(Not Set)</option>
</select> </select>
</div>`; </div>`;
@ -262,7 +263,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
console.log(fieldElement); console.log(fieldElement);
lotOccupancyFieldsContainerElement.append(fieldElement); lotOccupancyFieldsContainerElement.append(fieldElement);
} }
lotOccupancyFieldsContainerElement.insertAdjacentHTML('beforeend', `<input name="occupancyTypeFieldIds" type="hidden" value="${occupancyTypeFieldIds.slice(1)}" />`); lotOccupancyFieldsContainerElement.insertAdjacentHTML('beforeend',
// eslint-disable-next-line no-secrets/no-secrets
`<input name="occupancyTypeFieldIds" type="hidden"
value="${cityssm.escapeHTML(occupancyTypeFieldIds.slice(1))}" />`);
}); });
}); });
} }
@ -312,9 +316,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName); renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName);
} }
function searchLots() { function searchLots() {
// eslint-disable-next-line no-unsanitized/property
lotSelectResultsElement.innerHTML = lotSelectResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...'); los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', lotSelectFormElement, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/lots/doSearchLots`, lotSelectFormElement, (rawResponseJSON) => {
var _a, _b; var _a, _b;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.count === 0) { if (responseJSON.count === 0) {
@ -331,23 +336,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
panelBlockElement.href = '#'; panelBlockElement.href = '#';
panelBlockElement.dataset.lotId = lot.lotId.toString(); panelBlockElement.dataset.lotId = lot.lotId.toString();
panelBlockElement.dataset.lotName = lot.lotName; panelBlockElement.dataset.lotName = lot.lotName;
panelBlockElement.innerHTML = // eslint-disable-next-line no-unsanitized/property
'<div class="columns">' + panelBlockElement.innerHTML = `<div class="columns">
('<div class="column">' + <div class="column">
cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + ${cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '')}<br />
'<br />' + <span class="is-size-7">${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')}</span>
'<span class="is-size-7">' + </div>
cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '') + <div class="column">
'</span>' + ${cityssm.escapeHTML(lot.lotStatus)}<br />
'</div>') + <span class="is-size-7">
('<div class="column">' + ${lot.lotOccupancyCount > 0 ? 'Currently Occupied' : ''}
cityssm.escapeHTML(lot.lotStatus) + </span>
'<br />' + </div>
'<span class="is-size-7">' + </div>`;
(lot.lotOccupancyCount > 0 ? 'Currently Occupied' : '') +
'</span>' +
'</div>') +
'</div>';
panelBlockElement.addEventListener('click', selectExistingLot); panelBlockElement.addEventListener('click', selectExistingLot);
panelElement.append(panelBlockElement); panelElement.append(panelBlockElement);
} }
@ -358,7 +359,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
function createLotAndSelect(submitEvent) { function createLotAndSelect(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value; const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value;
cityssm.postJSON(los.urlPrefix + '/lots/doCreateLot', submitEvent.currentTarget, (rawResponseJSON) => { cityssm.postJSON(`${los.urlPrefix}/lots/doCreateLot`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON; const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {

View File

@ -1,16 +1,17 @@
/* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @eslint-community/eslint-comments/disable-enable-pair */
/* eslint-disable unicorn/prefer-module */
import type * as globalTypes from '../../types/globalTypes' import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type * as recordTypes from '../../types/recordTypes' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' import type * as globalTypes from '../../types/globalTypes.js'
import type * as recordTypes from '../../types/recordTypes.js'
import type { BulmaJS } from '@cityssm/bulma-js/types'
declare const cityssm: cityssmGlobal declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS declare const bulmaJS: BulmaJS
declare const exports: Record<string, unknown>
;(() => { ;(() => {
const los = exports.los as globalTypes.LOS const los = (exports as Record<string, unknown>).los as globalTypes.LOS
const lotOccupancyId = ( const lotOccupancyId = (
document.querySelector('#lotOccupancy--lotOccupancyId') as HTMLInputElement document.querySelector('#lotOccupancy--lotOccupancyId') as HTMLInputElement
@ -45,9 +46,7 @@ declare const bulmaJS: BulmaJS
formEvent.preventDefault() formEvent.preventDefault()
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + `${los.urlPrefix}/lotOccupancies/${isCreate ? 'doCreateLotOccupancy' : 'doUpdateLotOccupancy'}`,
'/lotOccupancies/' +
(isCreate ? 'doCreateLotOccupancy' : 'doUpdateLotOccupancy'),
formElement, formElement,
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
@ -73,7 +72,7 @@ declare const bulmaJS: BulmaJS
} }
} else { } else {
bulmaJS.alert({ bulmaJS.alert({
title: 'Error Saving ' + los.escapedAliases.Occupancy, title: `Error Saving ${los.escapedAliases.Occupancy}`,
message: responseJSON.errorMessage ?? '', message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger' contextualColorName: 'danger'
}) })
@ -90,7 +89,7 @@ declare const bulmaJS: BulmaJS
function doCopy(): void { function doCopy(): void {
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doCopyLotOccupancy', `${los.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,
{ {
lotOccupancyId lotOccupancyId
}, },
@ -150,7 +149,7 @@ declare const bulmaJS: BulmaJS
function doDelete(): void { function doDelete(): void {
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancy', `${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`,
{ {
lotOccupancyId lotOccupancyId
}, },
@ -196,7 +195,7 @@ declare const bulmaJS: BulmaJS
formEvent.preventDefault() formEvent.preventDefault()
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/workOrders/doCreateWorkOrder', `${los.urlPrefix}/workOrders/doCreateWorkOrder`,
formEvent.currentTarget, formEvent.currentTarget,
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
@ -250,8 +249,8 @@ declare const bulmaJS: BulmaJS
'#workOrderCreate--workOrderTypeId' '#workOrderCreate--workOrderTypeId'
) as HTMLSelectElement ) as HTMLSelectElement
const workOrderTypes = const workOrderTypes = (exports as Record<string, unknown>)
exports.workOrderTypes as recordTypes.WorkOrderType[] .workOrderTypes as recordTypes.WorkOrderType[]
if (workOrderTypes.length === 1) { if (workOrderTypes.length === 1) {
workOrderTypeSelectElement.innerHTML = '' workOrderTypeSelectElement.innerHTML = ''
@ -301,6 +300,7 @@ declare const bulmaJS: BulmaJS
occupancyTypeIdElement.addEventListener('change', () => { occupancyTypeIdElement.addEventListener('change', () => {
if (occupancyTypeIdElement.value === '') { if (occupancyTypeIdElement.value === '') {
// eslint-disable-next-line no-unsanitized/property
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p> <p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p>
</div>` </div>`
@ -319,6 +319,7 @@ declare const bulmaJS: BulmaJS
} }
if (responseJSON.occupancyTypeFields.length === 0) { if (responseJSON.occupancyTypeFields.length === 0) {
// eslint-disable-next-line no-unsanitized/property
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no additional fields for this ${los.escapedAliases.occupancy} type.</p> <p class="message-body">There are no additional fields for this ${los.escapedAliases.occupancy} type.</p>
</div>` </div>`
@ -332,17 +333,15 @@ declare const bulmaJS: BulmaJS
for (const occupancyTypeField of responseJSON.occupancyTypeFields) { for (const occupancyTypeField of responseJSON.occupancyTypeFields) {
occupancyTypeFieldIds += occupancyTypeFieldIds +=
',' + occupancyTypeField.occupancyTypeFieldId!.toString() ',' + occupancyTypeField.occupancyTypeFieldId.toString()
const fieldName = const fieldName = `lotOccupancyFieldValue_${occupancyTypeField.occupancyTypeFieldId.toString()}`
'lotOccupancyFieldValue_' +
occupancyTypeField.occupancyTypeFieldId!.toString()
const fieldId = 'lotOccupancy--' + fieldName const fieldId = `lotOccupancy--${fieldName}`
const fieldElement = document.createElement('div') const fieldElement = document.createElement('div')
fieldElement.className = 'field' fieldElement.className = 'field'
fieldElement.innerHTML = `<label class="label" for="${fieldId}"></label><div class="control"></div>` fieldElement.innerHTML = `<label class="label" for="${cityssm.escapeHTML(fieldId)}"></label><div class="control"></div>`
;( ;(
fieldElement.querySelector('label') as HTMLLabelElement fieldElement.querySelector('label') as HTMLLabelElement
).textContent = occupancyTypeField.occupancyTypeField as string ).textContent = occupancyTypeField.occupancyTypeField as string
@ -365,7 +364,7 @@ declare const bulmaJS: BulmaJS
occupancyTypeField.maximumLength as number occupancyTypeField.maximumLength as number
if ((occupancyTypeField.pattern ?? '') !== '') { if ((occupancyTypeField.pattern ?? '') !== '') {
inputElement.pattern = occupancyTypeField.pattern! inputElement.pattern = occupancyTypeField.pattern as string
} }
;(fieldElement.querySelector('.control') as HTMLElement).append( ;(fieldElement.querySelector('.control') as HTMLElement).append(
@ -375,7 +374,7 @@ declare const bulmaJS: BulmaJS
;( ;(
fieldElement.querySelector('.control') as HTMLElement fieldElement.querySelector('.control') as HTMLElement
).innerHTML = `<div class="select is-fullwidth"> ).innerHTML = `<div class="select is-fullwidth">
<select id="${fieldId}" name="${fieldName}"> <select id="${cityssm.escapeHTML(fieldId)}" name="${cityssm.escapeHTML(fieldName)}">
<option value="">(Not Set)</option> <option value="">(Not Set)</option>
</select> </select>
</div>` </div>`
@ -405,9 +404,9 @@ declare const bulmaJS: BulmaJS
lotOccupancyFieldsContainerElement.insertAdjacentHTML( lotOccupancyFieldsContainerElement.insertAdjacentHTML(
'beforeend', 'beforeend',
`<input name="occupancyTypeFieldIds" type="hidden" value="${occupancyTypeFieldIds.slice( // eslint-disable-next-line no-secrets/no-secrets
1 `<input name="occupancyTypeFieldIds" type="hidden"
)}" />` value="${cityssm.escapeHTML(occupancyTypeFieldIds.slice(1))}" />`
) )
} }
) )
@ -481,11 +480,12 @@ declare const bulmaJS: BulmaJS
} }
function searchLots(): void { function searchLots(): void {
// eslint-disable-next-line no-unsanitized/property
lotSelectResultsElement.innerHTML = lotSelectResultsElement.innerHTML =
los.getLoadingParagraphHTML('Searching...') los.getLoadingParagraphHTML('Searching...')
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lots/doSearchLots', `${los.urlPrefix}/lots/doSearchLots`,
lotSelectFormElement, lotSelectFormElement,
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {
@ -512,23 +512,19 @@ declare const bulmaJS: BulmaJS
panelBlockElement.dataset.lotId = lot.lotId.toString() panelBlockElement.dataset.lotId = lot.lotId.toString()
panelBlockElement.dataset.lotName = lot.lotName panelBlockElement.dataset.lotName = lot.lotName
panelBlockElement.innerHTML = // eslint-disable-next-line no-unsanitized/property
'<div class="columns">' + panelBlockElement.innerHTML = `<div class="columns">
('<div class="column">' + <div class="column">
cityssm.escapeHTML(lot.lotName ?? '') + ${cityssm.escapeHTML(lot.lotName ?? '')}<br />
'<br />' + <span class="is-size-7">${cityssm.escapeHTML(lot.mapName ?? '')}</span>
'<span class="is-size-7">' + </div>
cityssm.escapeHTML(lot.mapName ?? '') + <div class="column">
'</span>' + ${cityssm.escapeHTML(lot.lotStatus as string)}<br />
'</div>') + <span class="is-size-7">
('<div class="column">' + ${lot.lotOccupancyCount! > 0 ? 'Currently Occupied' : ''}
cityssm.escapeHTML(lot.lotStatus as string) + </span>
'<br />' + </div>
'<span class="is-size-7">' + </div>`
(lot.lotOccupancyCount! > 0 ? 'Currently Occupied' : '') +
'</span>' +
'</div>') +
'</div>'
panelBlockElement.addEventListener('click', selectExistingLot) panelBlockElement.addEventListener('click', selectExistingLot)
@ -551,7 +547,7 @@ declare const bulmaJS: BulmaJS
).value ).value
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lots/doCreateLot', `${los.urlPrefix}/lots/doCreateLot`,
submitEvent.currentTarget, submitEvent.currentTarget,
(rawResponseJSON) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { const responseJSON = rawResponseJSON as {

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent, unicorn/prefer-module */ /* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupancyFees = exports.lotOccupancyFees; let lotOccupancyFees = exports.lotOccupancyFees;
delete exports.lotOccupancyFees; delete exports.lotOccupancyFees;

View File

@ -1,10 +1,12 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
/* /*
* Unsaved Changes * Unsaved Changes
*/ */
var _a, _b, _c, _d;
let _hasUnsavedChanges = false; let _hasUnsavedChanges = false;
function setUnsavedChanges() { function setUnsavedChanges() {
if (!hasUnsavedChanges()) { if (!hasUnsavedChanges()) {
@ -80,7 +82,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
displayMode: 'dialog' displayMode: 'dialog'
}; };
function initializeDatePickers(containerElement) { function initializeDatePickers(containerElement) {
var _a, _b; var _a, _b, _c;
const dateElements = containerElement.querySelectorAll("input[type='date']"); const dateElements = containerElement.querySelectorAll("input[type='date']");
for (const dateElement of dateElements) { for (const dateElement of dateElements) {
const datePickerOptions = Object.assign({}, datePickerBaseOptions); const datePickerOptions = Object.assign({}, datePickerBaseOptions);
@ -110,7 +112,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
bulmaJS.toggleHtmlClipped(); bulmaJS.toggleHtmlClipped();
}); });
// Get the datepicker container element // Get the datepicker container element
const datepickerElement = containerElement.querySelector('#' + cal._id); const datepickerElement = containerElement.querySelector(`#${cal._id}`);
// Override the previous and next month button styles // Override the previous and next month button styles
const datePickerNavButtonElements = datepickerElement.querySelectorAll('.datepicker-nav button.is-text'); const datePickerNavButtonElements = datepickerElement.querySelectorAll('.datepicker-nav button.is-text');
for (const datePickerNavButtonElement of datePickerNavButtonElements) { for (const datePickerNavButtonElement of datePickerNavButtonElements) {
@ -133,84 +135,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
// Apply a label // Apply a label
const labelElement = document.querySelector("label[for='" + dateElement.id + "']"); const labelElement = document.querySelector("label[for='" + dateElement.id + "']");
if (labelElement !== null) { if (labelElement !== null) {
datepickerElement (_b = datepickerElement
.querySelector('.datetimepicker-dummy-input') .querySelector('.datetimepicker-dummy-input')) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-label', (_c = labelElement.textContent) !== null && _c !== void 0 ? _c : '');
.setAttribute('aria-label', (_b = labelElement.textContent) !== null && _b !== void 0 ? _b : '');
} }
} }
} }
/*
const timePickerBaseOptions: BulmaCalendarOptions = {
type: "time",
timeFormat: "hh:mm",
color: "info",
displayMode: "dialog",
validateLabel: "Set Time",
minuteSteps: 1
};
const initializeTimePickers = (containerElement: HTMLElement) => {
const timeElements = containerElement.querySelectorAll(
"input[type='time']"
) as NodeListOf<HTMLInputElement>;
for (const timeElement of timeElements) {
const timePickerOptions = Object.assign({}, timePickerBaseOptions);
if (timeElement.required) {
timePickerOptions.showClearButton = false;
}
const cal = exports.bulmaCalendar.attach(timeElement, timePickerOptions)[0];
// trigger change event on original element
cal.on("save", () => {
timeElement.value = cal.value();
timeElement.dispatchEvent(new Event("change"));
});
// Disable html scrolling when calendar is open
cal.on("show", () => {
document.querySelector("html")!.classList.add("is-clipped");
});
// Reenable scrolling, if a modal window is not open
cal.on("hide", () => {
bulmaJS.toggleHtmlClipped();
});
// Get the datepicker container element
const timePickerElement = containerElement.querySelector("#" + cal._id) as HTMLElement;
// Remove "cancel" button
const timePickerCancelButtonElement = timePickerElement.querySelector(
".datetimepicker-footer-cancel"
);
if (timePickerCancelButtonElement) {
timePickerCancelButtonElement.remove();
}
// Override the clear button style
const clearButtonElement = timePickerElement.querySelector(
".datetimepicker-clear-button"
) as HTMLElement;
if (clearButtonElement) {
if (timeElement.required) {
clearButtonElement.remove();
} else {
clearButtonElement.dataset.tooltip = "Clear";
clearButtonElement.innerHTML =
'<span class="has-text-weight-bold" aria-hidden="true">&times;</span>';
}
}
}
};
*/
/* /*
* Aliases * Aliases
*/ */
@ -301,27 +230,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
*/ */
function getMoveUpDownButtonFieldHTML(upButtonClassNames, downButtonClassNames, isSmall = true) { function getMoveUpDownButtonFieldHTML(upButtonClassNames, downButtonClassNames, isSmall = true) {
return `<div class="field has-addons"> return `<div class="field has-addons">
<div class="control"> <div class="control">
<button <button
class="button ${isSmall ? 'is-small' : ''} ${upButtonClassNames}" class="button ${isSmall ? 'is-small' : ''} ${upButtonClassNames}"
data-tooltip="Move Up" data-direction="up" type="button" aria-label="Move Up"> data-tooltip="Move Up" data-direction="up" type="button" aria-label="Move Up">
<i class="fas fa-arrow-up" aria-hidden="true"></i> <i class="fas fa-arrow-up" aria-hidden="true"></i>
</button> </button>
</div> </div>
<div class="control"> <div class="control">
<button <button
class="button ${isSmall ? 'is-small' : ''} ${downButtonClassNames}" class="button ${isSmall ? 'is-small' : ''} ${downButtonClassNames}"
data-tooltip="Move Down" data-direction="down" type="button" aria-label="Move Down"> data-tooltip="Move Down" data-direction="down" type="button" aria-label="Move Down">
<i class="fas fa-arrow-down" aria-hidden="true"></i> <i class="fas fa-arrow-down" aria-hidden="true"></i>
</button> </button>
</div> </div>
</div>`; </div>`;
} }
function getLoadingParagraphHTML(captionText = 'Loading...') { function getLoadingParagraphHTML(captionText = 'Loading...') {
return `<p class="has-text-centered has-text-grey"> return `<p class="has-text-centered has-text-grey">
<i class="fas fa-5x fa-circle-notch fa-spin" aria-hidden="true"></i><br /> <i class="fas fa-5x fa-circle-notch fa-spin" aria-hidden="true"></i><br />
${cityssm.escapeHTML(captionText)} ${cityssm.escapeHTML(captionText)}
</p>`; </p>`;
} }
function getSearchResultsPagerHTML(limit, offset, count) { function getSearchResultsPagerHTML(limit, offset, count) {
return ('<div class="level">' + return ('<div class="level">' +
@ -337,19 +266,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
'</div>') + '</div>') +
('<div class="level-right">' + ('<div class="level-right">' +
(offset > 0 (offset > 0
? '<div class="level-item">' + ? `<div class="level-item">
'<button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous">' + <button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous">
'<i class="fas fa-arrow-left" aria-hidden="true"></i>' + <i class="fas fa-arrow-left" aria-hidden="true"></i>
'</button>' + </button>
'</div>' </div>`
: '') + : '') +
(limit + offset < count (limit + offset < count
? '<div class="level-item">' + ? `<div class="level-item">
'<button class="button is-rounded is-link" data-page="next" type="button" title="Next">' + <button class="button is-rounded is-link" data-page="next" type="button" title="Next">
'<span>Next</span>' + <span>Next</span>
'<span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>' + <span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>
'</button>' + </button>
'</div>' </div>`
: '') + : '') +
'</div>') + '</div>') +
'</div>'); '</div>');
@ -357,7 +286,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
/* /*
* URLs * URLs
*/ */
const urlPrefix = document.querySelector('main').dataset.urlPrefix; const urlPrefix = (_b = (_a = document.querySelector('main')) === null || _a === void 0 ? void 0 : _a.dataset.urlPrefix) !== null && _b !== void 0 ? _b : '';
function getRecordURL(recordTypePlural, recordId, edit, time) { function getRecordURL(recordTypePlural, recordId, edit, time) {
return (urlPrefix + return (urlPrefix +
'/' + '/' +
@ -387,7 +316,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
*/ */
const los = { const los = {
urlPrefix, urlPrefix,
apiKey: document.querySelector('main').dataset.apiKey, apiKey: (_d = (_c = document.querySelector('main')) === null || _c === void 0 ? void 0 : _c.dataset.apiKey) !== null && _d !== void 0 ? _d : '',
dynamicsGPIntegrationIsEnabled, dynamicsGPIntegrationIsEnabled,
highlightMap, highlightMap,
initializeUnlockFieldButtons, initializeUnlockFieldButtons,

View File

@ -1,12 +1,17 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
import type * as globalTypes from '../types/globalTypes' import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { Options as BulmaCalendarOptions } from 'bulma-calendar' import type { Options as BulmaCalendarOptions } from 'bulma-calendar'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
import type { BulmaJS } from '@cityssm/bulma-js/types' import type * as globalTypes from '../types/globalTypes.js'
declare const cityssm: cityssmGlobal declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS declare const bulmaJS: BulmaJS
declare const exports: Record<string, unknown> & {
aliases: Record<string, string>
}
;(() => { ;(() => {
/* /*
* Unsaved Changes * Unsaved Changes
@ -71,7 +76,7 @@ declare const bulmaJS: BulmaJS
function unlockField(clickEvent: Event): void { function unlockField(clickEvent: Event): void {
const fieldElement = (clickEvent.currentTarget as HTMLElement).closest( const fieldElement = (clickEvent.currentTarget as HTMLElement).closest(
'.field' '.field'
)! ) as HTMLElement
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const inputOrSelectElement = fieldElement.querySelector( const inputOrSelectElement = fieldElement.querySelector(
@ -158,7 +163,9 @@ declare const bulmaJS: BulmaJS
}) })
// Get the datepicker container element // Get the datepicker container element
const datepickerElement = containerElement.querySelector('#' + (cal._id as string))! const datepickerElement = containerElement.querySelector(
`#${cal._id as string}`
)!
// Override the previous and next month button styles // Override the previous and next month button styles
const datePickerNavButtonElements = datepickerElement.querySelectorAll( const datePickerNavButtonElements = datepickerElement.querySelectorAll(
@ -194,85 +201,12 @@ declare const bulmaJS: BulmaJS
if (labelElement !== null) { if (labelElement !== null) {
datepickerElement datepickerElement
.querySelector('.datetimepicker-dummy-input')! .querySelector('.datetimepicker-dummy-input')
.setAttribute('aria-label', labelElement.textContent ?? '') ?.setAttribute('aria-label', labelElement.textContent ?? '')
} }
} }
} }
/*
const timePickerBaseOptions: BulmaCalendarOptions = {
type: "time",
timeFormat: "hh:mm",
color: "info",
displayMode: "dialog",
validateLabel: "Set Time",
minuteSteps: 1
};
const initializeTimePickers = (containerElement: HTMLElement) => {
const timeElements = containerElement.querySelectorAll(
"input[type='time']"
) as NodeListOf<HTMLInputElement>;
for (const timeElement of timeElements) {
const timePickerOptions = Object.assign({}, timePickerBaseOptions);
if (timeElement.required) {
timePickerOptions.showClearButton = false;
}
const cal = exports.bulmaCalendar.attach(timeElement, timePickerOptions)[0];
// trigger change event on original element
cal.on("save", () => {
timeElement.value = cal.value();
timeElement.dispatchEvent(new Event("change"));
});
// Disable html scrolling when calendar is open
cal.on("show", () => {
document.querySelector("html")!.classList.add("is-clipped");
});
// Reenable scrolling, if a modal window is not open
cal.on("hide", () => {
bulmaJS.toggleHtmlClipped();
});
// Get the datepicker container element
const timePickerElement = containerElement.querySelector("#" + cal._id) as HTMLElement;
// Remove "cancel" button
const timePickerCancelButtonElement = timePickerElement.querySelector(
".datetimepicker-footer-cancel"
);
if (timePickerCancelButtonElement) {
timePickerCancelButtonElement.remove();
}
// Override the clear button style
const clearButtonElement = timePickerElement.querySelector(
".datetimepicker-clear-button"
) as HTMLElement;
if (clearButtonElement) {
if (timeElement.required) {
clearButtonElement.remove();
} else {
clearButtonElement.dataset.tooltip = "Clear";
clearButtonElement.innerHTML =
'<span class="has-text-weight-bold" aria-hidden="true">&times;</span>';
}
}
}
};
*/
/* /*
* Aliases * Aliases
*/ */
@ -400,32 +334,28 @@ declare const bulmaJS: BulmaJS
isSmall = true isSmall = true
): string { ): string {
return `<div class="field has-addons"> return `<div class="field has-addons">
<div class="control"> <div class="control">
<button <button
class="button ${ class="button ${isSmall ? 'is-small' : ''} ${upButtonClassNames}"
isSmall ? 'is-small' : '' data-tooltip="Move Up" data-direction="up" type="button" aria-label="Move Up">
} ${upButtonClassNames}" <i class="fas fa-arrow-up" aria-hidden="true"></i>
data-tooltip="Move Up" data-direction="up" type="button" aria-label="Move Up"> </button>
<i class="fas fa-arrow-up" aria-hidden="true"></i> </div>
</button> <div class="control">
</div> <button
<div class="control"> class="button ${isSmall ? 'is-small' : ''} ${downButtonClassNames}"
<button data-tooltip="Move Down" data-direction="down" type="button" aria-label="Move Down">
class="button ${ <i class="fas fa-arrow-down" aria-hidden="true"></i>
isSmall ? 'is-small' : '' </button>
} ${downButtonClassNames}" </div>
data-tooltip="Move Down" data-direction="down" type="button" aria-label="Move Down"> </div>`
<i class="fas fa-arrow-down" aria-hidden="true"></i>
</button>
</div>
</div>`
} }
function getLoadingParagraphHTML(captionText = 'Loading...'): string { function getLoadingParagraphHTML(captionText = 'Loading...'): string {
return `<p class="has-text-centered has-text-grey"> return `<p class="has-text-centered has-text-grey">
<i class="fas fa-5x fa-circle-notch fa-spin" aria-hidden="true"></i><br /> <i class="fas fa-5x fa-circle-notch fa-spin" aria-hidden="true"></i><br />
${cityssm.escapeHTML(captionText)} ${cityssm.escapeHTML(captionText)}
</p>` </p>`
} }
function getSearchResultsPagerHTML( function getSearchResultsPagerHTML(
@ -447,19 +377,19 @@ declare const bulmaJS: BulmaJS
'</div>') + '</div>') +
('<div class="level-right">' + ('<div class="level-right">' +
(offset > 0 (offset > 0
? '<div class="level-item">' + ? `<div class="level-item">
'<button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous">' + <button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous">
'<i class="fas fa-arrow-left" aria-hidden="true"></i>' + <i class="fas fa-arrow-left" aria-hidden="true"></i>
'</button>' + </button>
'</div>' </div>`
: '') + : '') +
(limit + offset < count (limit + offset < count
? '<div class="level-item">' + ? `<div class="level-item">
'<button class="button is-rounded is-link" data-page="next" type="button" title="Next">' + <button class="button is-rounded is-link" data-page="next" type="button" title="Next">
'<span>Next</span>' + <span>Next</span>
'<span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>' + <span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>
'</button>' + </button>
'</div>' </div>`
: '') + : '') +
'</div>') + '</div>') +
'</div>' '</div>'
@ -470,7 +400,7 @@ declare const bulmaJS: BulmaJS
* URLs * URLs
*/ */
const urlPrefix = document.querySelector('main')!.dataset.urlPrefix! const urlPrefix = document.querySelector('main')?.dataset.urlPrefix ?? ''
function getRecordURL( function getRecordURL(
recordTypePlural: 'maps' | 'lots' | 'lotOccupancies' | 'workOrders', recordTypePlural: 'maps' | 'lots' | 'lotOccupancies' | 'workOrders',
@ -524,7 +454,8 @@ declare const bulmaJS: BulmaJS
* Settings * Settings
*/ */
const dynamicsGPIntegrationIsEnabled = exports.dynamicsGPIntegrationIsEnabled as boolean const dynamicsGPIntegrationIsEnabled =
exports.dynamicsGPIntegrationIsEnabled as boolean
/* /*
* Declare LOS * Declare LOS
@ -532,7 +463,7 @@ declare const bulmaJS: BulmaJS
const los: globalTypes.LOS = { const los: globalTypes.LOS = {
urlPrefix, urlPrefix,
apiKey: document.querySelector('main')!.dataset.apiKey!, apiKey: document.querySelector('main')?.dataset.apiKey ?? '',
dynamicsGPIntegrationIsEnabled, dynamicsGPIntegrationIsEnabled,
highlightMap, highlightMap,
initializeUnlockFieldButtons, initializeUnlockFieldButtons,

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/* eslint-disable spaced-comment, @typescript-eslint/indent, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b, _c; var _a, _b, _c;
@ -155,7 +155,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
*/ */
if (!isCreate) { if (!isCreate) {
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
var _a, _b; var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/* eslint-disable spaced-comment, @typescript-eslint/indent, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b, _c; var _a, _b, _c;

View File

@ -1,5 +1,4 @@
"use strict"; "use strict";
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
var _a, _b; var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long