Skip to content

Commit

Permalink
compile client js to es2021
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Jul 2, 2024
1 parent bca8a3b commit b889f10
Show file tree
Hide file tree
Showing 34 changed files with 1,158 additions and 1,294 deletions.
17 changes: 8 additions & 9 deletions public-typescript/adminDatabase.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
/* @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
(() => {
var _a, _b;
const los = exports.los;
function doBackup() {
cityssm.postJSON(`${los.urlPrefix}/admin/doBackupDatabase`, {}, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
bulmaJS.alert({
Expand All @@ -20,15 +18,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: 'Error Backing Up Database',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
});
}
});
}
function doCleanup() {
cityssm.postJSON(`${los.urlPrefix}/admin/doCleanupDatabase`, {}, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
bulmaJS.alert({
Expand All @@ -41,14 +38,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: 'Error Cleaning Database',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
});
}
});
}
(_a = document
.querySelector('#button--cleanupDatabase')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', () => {
document
.querySelector('#button--cleanupDatabase')
?.addEventListener('click', () => {
bulmaJS.confirm({
title: 'Cleanup Database',
message: 'Are you sure you want to cleanup up the database?',
Expand All @@ -58,8 +56,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
});
});
(_b = document
.querySelector('#button--backupDatabase')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', () => {
document
.querySelector('#button--backupDatabase')
?.addEventListener('click', () => {
bulmaJS.confirm({
title: 'Backup Database',
message: 'Are you sure you want to backup up the database?',
Expand Down
194 changes: 91 additions & 103 deletions public-typescript/adminFees.js

Large diffs are not rendered by default.

91 changes: 41 additions & 50 deletions public-typescript/adminLotTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
(() => {
var _a;
const los = exports.los;
const containerElement = document.querySelector('#container--lotTypes');
let lotTypes = exports.lotTypes;
delete exports.lotTypes;
const expandedLotTypes = new Set();
function toggleLotTypeFields(clickEvent) {
var _a;
const toggleButtonElement = clickEvent.currentTarget;
const lotTypeElement = toggleButtonElement.closest('.container--lotType');
const lotTypeId = Number.parseInt((_a = lotTypeElement.dataset.lotTypeId) !== null && _a !== void 0 ? _a : '', 10);
const lotTypeId = Number.parseInt(lotTypeElement.dataset.lotTypeId ?? '', 10);
if (expandedLotTypes.has(lotTypeId)) {
expandedLotTypes.delete(lotTypeId);
}
Expand All @@ -30,7 +28,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
}
function lotTypeResponseHandler(rawResponseJSON) {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotTypes = responseJSON.lotTypes;
Expand All @@ -39,14 +36,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: `Error Updating ${los.escapedAliases.Lot} Type`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
});
}
}
function deleteLotType(clickEvent) {
var _a;
const lotTypeId = Number.parseInt((_a = clickEvent.currentTarget.closest('.container--lotType').dataset.lotTypeId) !== null && _a !== void 0 ? _a : '', 10);
const lotTypeId = Number.parseInt(clickEvent.currentTarget.closest('.container--lotType').dataset.lotTypeId ?? '', 10);
function doDelete() {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotType`, {
lotTypeId
Expand All @@ -63,8 +59,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function openEditLotType(clickEvent) {
var _a;
const lotTypeId = Number.parseInt((_a = clickEvent.currentTarget.closest('.container--lotType').dataset.lotTypeId) !== null && _a !== void 0 ? _a : '', 10);
const lotTypeId = Number.parseInt(clickEvent.currentTarget.closest('.container--lotType').dataset.lotTypeId ?? '', 10);
const lotType = lotTypes.find((currentLotType) => {
return lotTypeId === currentLotType.lotTypeId;
});
Expand All @@ -86,10 +81,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector('#lotTypeEdit--lotType').value = lotType.lotType;
},
onshown(modalElement, closeModalFunction) {
var _a;
editCloseModalFunction = closeModalFunction;
modalElement.querySelector('#lotTypeEdit--lotType').focus();
(_a = modalElement.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doEdit);
modalElement.querySelector('form')?.addEventListener('submit', doEdit);
bulmaJS.toggleHtmlClipped();
},
onremoved() {
Expand All @@ -98,8 +92,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function openAddLotTypeField(clickEvent) {
var _a;
const lotTypeId = Number.parseInt((_a = clickEvent.currentTarget.closest('.container--lotType').dataset.lotTypeId) !== null && _a !== void 0 ? _a : '', 10);
const lotTypeId = Number.parseInt(clickEvent.currentTarget.closest('.container--lotType').dataset.lotTypeId ?? '', 10);
let addCloseModalFunction;
function doAdd(submitEvent) {
submitEvent.preventDefault();
Expand All @@ -122,10 +115,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
},
onshown(modalElement, closeModalFunction) {
var _a;
addCloseModalFunction = closeModalFunction;
modalElement.querySelector('#lotTypeFieldAdd--lotTypeField').focus();
(_a = modalElement.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAdd);
modalElement.querySelector('form')?.addEventListener('submit', doAdd);
bulmaJS.toggleHtmlClipped();
},
onremoved() {
Expand All @@ -144,11 +136,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
}, lotTypeResponseHandler);
}
function openEditLotTypeField(lotTypeId, lotTypeFieldId) {
var _a;
const lotType = lotTypes.find((currentLotType) => {
return currentLotType.lotTypeId === lotTypeId;
});
const lotTypeField = ((_a = lotType.lotTypeFields) !== null && _a !== void 0 ? _a : []).find((currentLotTypeField) => {
const lotTypeField = (lotType.lotTypeFields ?? []).find((currentLotTypeField) => {
return currentLotTypeField.lotTypeFieldId === lotTypeFieldId;
});
let minimumLengthElement;
Expand Down Expand Up @@ -205,35 +196,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
cityssm.openHtmlModal('adminLotTypes-editLotTypeField', {
onshow(modalElement) {
var _a, _b, _c, _d, _e, _f, _g;
los.populateAliases(modalElement);
modalElement.querySelector('#lotTypeFieldEdit--lotTypeFieldId').value = lotTypeField.lotTypeFieldId.toString();
modalElement.querySelector('#lotTypeFieldEdit--lotTypeField').value = (_a = lotTypeField.lotTypeField) !== null && _a !== void 0 ? _a : '';
modalElement.querySelector('#lotTypeFieldEdit--lotTypeField').value = lotTypeField.lotTypeField ?? '';
modalElement.querySelector('#lotTypeFieldEdit--isRequired').value = lotTypeField.isRequired ? '1' : '0';
minimumLengthElement = modalElement.querySelector('#lotTypeFieldEdit--minimumLength');
minimumLengthElement.value =
(_c = (_b = lotTypeField.minimumLength) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : '';
lotTypeField.minimumLength?.toString() ?? '';
maximumLengthElement = modalElement.querySelector('#lotTypeFieldEdit--maximumLength');
maximumLengthElement.value =
(_e = (_d = lotTypeField.maximumLength) === null || _d === void 0 ? void 0 : _d.toString()) !== null && _e !== void 0 ? _e : '';
lotTypeField.maximumLength?.toString() ?? '';
patternElement = modalElement.querySelector('#lotTypeFieldEdit--pattern');
patternElement.value = (_f = lotTypeField.pattern) !== null && _f !== void 0 ? _f : '';
patternElement.value = lotTypeField.pattern ?? '';
lotTypeFieldValuesElement = modalElement.querySelector('#lotTypeFieldEdit--lotTypeFieldValues');
lotTypeFieldValuesElement.value = (_g = lotTypeField.lotTypeFieldValues) !== null && _g !== void 0 ? _g : '';
lotTypeFieldValuesElement.value = lotTypeField.lotTypeFieldValues ?? '';
toggleInputFields();
},
onshown(modalElement, closeModalFunction) {
var _a, _b;
editCloseModalFunction = closeModalFunction;
bulmaJS.init(modalElement);
bulmaJS.toggleHtmlClipped();
cityssm.enableNavBlocker();
(_a = modalElement.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doUpdate);
modalElement.querySelector('form')?.addEventListener('submit', doUpdate);
minimumLengthElement.addEventListener('keyup', updateMaximumLengthMin);
updateMaximumLengthMin();
lotTypeFieldValuesElement.addEventListener('keyup', toggleInputFields);
(_b = modalElement
.querySelector('#button--deleteLotTypeField')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', confirmDoDelete);
modalElement
.querySelector('#button--deleteLotTypeField')
?.addEventListener('click', confirmDoDelete);
},
onremoved() {
bulmaJS.toggleHtmlClipped();
Expand All @@ -242,10 +232,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function openEditLotTypeFieldByClick(clickEvent) {
var _a, _b;
clickEvent.preventDefault();
const lotTypeFieldId = Number.parseInt((_a = clickEvent.currentTarget.closest('.container--lotTypeField').dataset.lotTypeFieldId) !== null && _a !== void 0 ? _a : '', 10);
const lotTypeId = Number.parseInt((_b = clickEvent.currentTarget.closest('.container--lotType').dataset.lotTypeId) !== null && _b !== void 0 ? _b : '', 10);
const lotTypeFieldId = Number.parseInt(clickEvent.currentTarget.closest('.container--lotTypeField').dataset.lotTypeFieldId ?? '', 10);
const lotTypeId = Number.parseInt(clickEvent.currentTarget.closest('.container--lotType').dataset.lotTypeId ?? '', 10);
openEditLotTypeField(lotTypeId, lotTypeFieldId);
}
function moveLotTypeField(clickEvent) {
Expand All @@ -259,7 +248,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
}, lotTypeResponseHandler);
}
function renderLotTypeFields(panelElement, lotTypeId, lotTypeFields) {
var _a, _b;
if (lotTypeFields.length === 0) {
// eslint-disable-next-line no-unsanitized/method
panelElement.insertAdjacentHTML('beforeend', `<div class="panel-block is-block
Expand All @@ -282,7 +270,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
<div class="level-left">
<div class="level-item">
<a class="has-text-weight-bold button--editLotTypeField" href="#">
${cityssm.escapeHTML((_a = lotTypeField.lotTypeField) !== null && _a !== void 0 ? _a : '')}
${cityssm.escapeHTML(lotTypeField.lotTypeField ?? '')}
</a>
</div>
</div>
Expand All @@ -292,16 +280,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
</div>
</div>
</div>`;
(_b = panelBlockElement
.querySelector('.button--editLotTypeField')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', openEditLotTypeFieldByClick);
panelBlockElement
.querySelector('.button--editLotTypeField')
?.addEventListener('click', openEditLotTypeFieldByClick);
panelBlockElement.querySelector('.button--moveLotTypeFieldUp').addEventListener('click', moveLotTypeField);
panelBlockElement.querySelector('.button--moveLotTypeFieldDown').addEventListener('click', moveLotTypeField);
panelElement.append(panelBlockElement);
}
}
}
function renderLotTypes() {
var _a, _b, _c, _d, _e;
containerElement.innerHTML = '';
if (lotTypes.length === 0) {
// eslint-disable-next-line no-unsanitized/method
Expand Down Expand Up @@ -354,27 +342,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
</div>
</div>
</div>`;
renderLotTypeFields(lotTypeContainer, lotType.lotTypeId, (_a = lotType.lotTypeFields) !== null && _a !== void 0 ? _a : []);
(_b = lotTypeContainer
.querySelector('.button--toggleLotTypeFields')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', toggleLotTypeFields);
(_c = lotTypeContainer
.querySelector('.button--deleteLotType')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', deleteLotType);
(_d = lotTypeContainer
.querySelector('.button--editLotType')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', openEditLotType);
(_e = lotTypeContainer
.querySelector('.button--addLotTypeField')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', openAddLotTypeField);
renderLotTypeFields(lotTypeContainer, lotType.lotTypeId, lotType.lotTypeFields ?? []);
lotTypeContainer
.querySelector('.button--toggleLotTypeFields')
?.addEventListener('click', toggleLotTypeFields);
lotTypeContainer
.querySelector('.button--deleteLotType')
?.addEventListener('click', deleteLotType);
lotTypeContainer
.querySelector('.button--editLotType')
?.addEventListener('click', openEditLotType);
lotTypeContainer
.querySelector('.button--addLotTypeField')
?.addEventListener('click', openAddLotTypeField);
lotTypeContainer.querySelector('.button--moveLotTypeUp').addEventListener('click', moveLotType);
lotTypeContainer.querySelector('.button--moveLotTypeDown').addEventListener('click', moveLotType);
containerElement.append(lotTypeContainer);
}
}
(_a = document
.querySelector('#button--addLotType')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', () => {
document
.querySelector('#button--addLotType')
?.addEventListener('click', () => {
let addCloseModalFunction;
function doAdd(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotType`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
addCloseModalFunction();
Expand All @@ -384,7 +376,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: `Error Adding ${los.escapedAliases.Lot} Type`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
});
}
Expand All @@ -395,10 +387,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
los.populateAliases(modalElement);
},
onshown(modalElement, closeModalFunction) {
var _a;
addCloseModalFunction = closeModalFunction;
modalElement.querySelector('#lotTypeAdd--lotType').focus();
(_a = modalElement.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAdd);
modalElement.querySelector('form')?.addEventListener('submit', doAdd);
bulmaJS.toggleHtmlClipped();
},
onremoved() {
Expand Down
2 changes: 1 addition & 1 deletion public-typescript/adminLotTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type ResponseJSON =
? '<i class="fas fa-fw fa-minus" aria-hidden="true"></i>'
: '<i class="fas fa-fw fa-plus" aria-hidden="true"></i>'

const panelBlockElements = lotTypeElement.querySelectorAll('.panel-block')
const panelBlockElements = lotTypeElement.querySelectorAll('.panel-block') as NodeListOf<HTMLElement>

for (const panelBlockElement of panelBlockElements) {
panelBlockElement.classList.toggle('is-hidden')
Expand Down
Loading

0 comments on commit b889f10

Please sign in to comment.