deepsource-autofix-76c6eb20
Dan Gowans 2023-01-12 15:20:59 -05:00
parent 802ecaf638
commit abd59f9c6e
10 changed files with 307 additions and 290 deletions

View File

@ -9,11 +9,11 @@ import { getLotNameWhereClause, getOccupantNameWhereClause } from '../functions.
function buildWhereClause(filters) {
let sqlWhereClause = ' where w.recordDelete_timeMillis is null';
const sqlParameters = [];
if (filters.workOrderTypeId) {
if ((filters.workOrderTypeId ?? '') !== '') {
sqlWhereClause += ' and w.workOrderTypeId = ?';
sqlParameters.push(filters.workOrderTypeId);
}
if (filters.workOrderOpenStatus) {
if ((filters.workOrderOpenStatus ?? '') !== '') {
if (filters.workOrderOpenStatus === 'open') {
sqlWhereClause += ' and w.workOrderCloseDate is null';
}
@ -21,7 +21,7 @@ function buildWhereClause(filters) {
sqlWhereClause += ' and w.workOrderCloseDate is not null';
}
}
if (filters.workOrderOpenDateString) {
if ((filters.workOrderOpenDateString ?? '') !== '') {
sqlWhereClause += ' and w.workOrderOpenDate = ?';
sqlParameters.push(dateStringToInteger(filters.workOrderOpenDateString));
}

View File

@ -43,12 +43,12 @@ function buildWhereClause(filters: GetWorkOrdersFilters): {
let sqlWhereClause = ' where w.recordDelete_timeMillis is null'
const sqlParameters: unknown[] = []
if (filters.workOrderTypeId) {
if ((filters.workOrderTypeId ?? '') !== '') {
sqlWhereClause += ' and w.workOrderTypeId = ?'
sqlParameters.push(filters.workOrderTypeId)
}
if (filters.workOrderOpenStatus) {
if ((filters.workOrderOpenStatus ?? '') !== '') {
if (filters.workOrderOpenStatus === 'open') {
sqlWhereClause += ' and w.workOrderCloseDate is null'
} else if (filters.workOrderOpenStatus === 'closed') {
@ -56,9 +56,9 @@ function buildWhereClause(filters: GetWorkOrdersFilters): {
}
}
if (filters.workOrderOpenDateString) {
if ((filters.workOrderOpenDateString ?? '') !== '') {
sqlWhereClause += ' and w.workOrderOpenDate = ?'
sqlParameters.push(dateStringToInteger(filters.workOrderOpenDateString))
sqlParameters.push(dateStringToInteger(filters.workOrderOpenDateString!))
}
const occupantNameFilters = getOccupantNameWhereClause(

View File

@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
function updateLot(formEvent) {
formEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/lots/' + (isCreate ? 'doCreateLot' : 'doUpdateLot'), formElement, (responseJSON) => {
var _a;
if (responseJSON.success) {
los.clearUnsavedChanges();
if (isCreate || refreshAfterSave) {
@ -20,15 +21,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
else {
bulmaJS.alert({
message: exports.aliases.lot + ' Updated Successfully',
message: los.escapedAliases.Lot + ' Updated Successfully',
contextualColorName: 'success'
});
}
}
else {
bulmaJS.alert({
title: 'Error Updating ' + exports.aliases.lot,
message: responseJSON.errorMessage || '',
title: 'Error Updating ' + los.escapedAliases.Lot,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
@ -43,10 +44,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
(_a = document
.querySelector('#button--deleteLot')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', (clickEvent) => {
clickEvent.preventDefault();
const doDelete = () => {
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLot', {
lotId
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href = los.getLotURL();
@ -54,14 +56,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: `Error Deleting ${los.escapedAliases.Lot}`,
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
bulmaJS.confirm({
title: 'Delete ' + exports.aliases.lot,
title: 'Delete ' + los.escapedAliases.Lot,
message: `Are you sure you want to delete this ${los.escapedAliases.lot}?`,
contextualColorName: 'warning',
okButton: {
@ -77,8 +79,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
lotTypeIdElement.addEventListener('change', () => {
if (lotTypeIdElement.value === '') {
lotFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.lot} type to load the available fields.</p>
</div>`;
<p class="message-body">Select the ${los.escapedAliases.lot} type to load the available fields.</p>
</div>`;
return;
}
cityssm.postJSON(los.urlPrefix + '/lots/doGetLotTypeFields', {
@ -172,9 +174,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
let editFormElement;
let editCloseModalFunction;
const editComment = (submitEvent) => {
function editComment(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/lots/doUpdateLotComment', editFormElement, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotComments = responseJSON.lotComments;
editCloseModalFunction();
@ -183,12 +186,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: 'Error Updating Comment',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
cityssm.openHtmlModal('lot-editComment', {
onshow: (modalElement) => {
los.populateAliases(modalElement);
@ -220,11 +223,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
function deleteLotComment(clickEvent) {
const lotCommentId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
.lotCommentId, 10);
const doDelete = () => {
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLotComment', {
lotId,
lotCommentId
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotComments = responseJSON.lotComments;
renderLotComments();
@ -232,12 +236,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: 'Error Removing Comment',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
bulmaJS.confirm({
title: 'Remove Comment?',
message: 'Are you sure you want to remove this comment?',
@ -249,6 +253,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function renderLotComments() {
var _a, _b;
const containerElement = document.querySelector('#container--lotComments');
if (lotComments.length === 0) {
containerElement.innerHTML = `<div class="message is-info">
@ -270,7 +275,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
tableRowElement.dataset.lotCommentId = lotComment.lotCommentId.toString();
tableRowElement.innerHTML =
'<td>' +
cityssm.escapeHTML(lotComment.recordCreate_userName || '') +
cityssm.escapeHTML((_a = lotComment.recordCreate_userName) !== null && _a !== void 0 ? _a : '') +
'</td>' +
'<td>' +
lotComment.lotCommentDateString +
@ -279,7 +284,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
: ' ' + lotComment.lotCommentTimeString) +
'</td>' +
'<td>' +
cityssm.escapeHTML(lotComment.lotComment || '') +
cityssm.escapeHTML((_b = lotComment.lotComment) !== null && _b !== void 0 ? _b : '') +
'</td>' +
('<td class="is-hidden-print">' +
'<div class="buttons are-small is-justify-content-end">' +
@ -305,7 +310,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
function openAddCommentModal() {
let addCommentCloseModalFunction;
const doAddComment = (formEvent) => {
function doAddComment(formEvent) {
formEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/lots/doAddLotComment', formEvent.currentTarget, (responseJSON) => {
if (responseJSON.success) {
@ -314,7 +319,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
addCommentCloseModalFunction();
}
});
};
}
cityssm.openHtmlModal('lot-addComment', {
onshow(modalElement) {
los.populateAliases(modalElement);

View File

@ -9,7 +9,6 @@ import type { BulmaJS } from '@cityssm/bulma-js/types'
declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
;(() => {
const los = exports.los as globalTypes.LOS
@ -23,7 +22,7 @@ declare const bulmaJS: BulmaJS
const formElement = document.querySelector('#form--lot') as HTMLFormElement
function updateLot(formEvent: SubmitEvent) {
function updateLot(formEvent: SubmitEvent): void {
formEvent.preventDefault()
cityssm.postJSON(
@ -41,14 +40,14 @@ declare const bulmaJS: BulmaJS
window.location.href = los.getLotURL(responseJSON.lotId, true, true)
} else {
bulmaJS.alert({
message: exports.aliases.lot + ' Updated Successfully',
message: los.escapedAliases.Lot + ' Updated Successfully',
contextualColorName: 'success'
})
}
} else {
bulmaJS.alert({
title: 'Error Updating ' + exports.aliases.lot,
message: responseJSON.errorMessage || '',
title: 'Error Updating ' + los.escapedAliases.Lot,
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
}
@ -71,7 +70,7 @@ declare const bulmaJS: BulmaJS
?.addEventListener('click', (clickEvent) => {
clickEvent.preventDefault()
const doDelete = () => {
function doDelete(): void {
cityssm.postJSON(
los.urlPrefix + '/lots/doDeleteLot',
{
@ -84,7 +83,7 @@ declare const bulmaJS: BulmaJS
} else {
bulmaJS.alert({
title: `Error Deleting ${los.escapedAliases.Lot}`,
message: responseJSON.errorMessage || '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
}
@ -93,7 +92,7 @@ declare const bulmaJS: BulmaJS
}
bulmaJS.confirm({
title: 'Delete ' + exports.aliases.lot,
title: 'Delete ' + los.escapedAliases.Lot,
message: `Are you sure you want to delete this ${los.escapedAliases.lot}?`,
contextualColorName: 'warning',
okButton: {
@ -117,8 +116,8 @@ declare const bulmaJS: BulmaJS
lotTypeIdElement.addEventListener('change', () => {
if (lotTypeIdElement.value === '') {
lotFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.lot} type to load the available fields.</p>
</div>`
<p class="message-body">Select the ${los.escapedAliases.lot} type to load the available fields.</p>
</div>`
return
}
@ -152,7 +151,6 @@ declare const bulmaJS: BulmaJS
fieldElement.className = 'field'
fieldElement.innerHTML = `<label class="label" for="${fieldId}"></label>
<div class="control"></div>`
;(
fieldElement.querySelector('label') as HTMLLabelElement
).textContent = lotTypeField.lotTypeField as string
@ -245,7 +243,7 @@ declare const bulmaJS: BulmaJS
let lotComments: recordTypes.LotComment[] = exports.lotComments
delete exports.lotComments
function openEditLotComment(clickEvent: Event) {
function openEditLotComment(clickEvent: Event): void {
const lotCommentId = Number.parseInt(
(clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset
.lotCommentId!,
@ -259,7 +257,7 @@ declare const bulmaJS: BulmaJS
let editFormElement: HTMLFormElement
let editCloseModalFunction: () => void
const editComment = (submitEvent: SubmitEvent) => {
function editComment(submitEvent: SubmitEvent): void {
submitEvent.preventDefault()
cityssm.postJSON(
@ -277,7 +275,7 @@ declare const bulmaJS: BulmaJS
} else {
bulmaJS.alert({
title: 'Error Updating Comment',
message: responseJSON.errorMessage || '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
}
@ -288,19 +286,16 @@ declare const bulmaJS: BulmaJS
cityssm.openHtmlModal('lot-editComment', {
onshow: (modalElement) => {
los.populateAliases(modalElement)
;(
modalElement.querySelector(
'#lotCommentEdit--lotId'
) as HTMLInputElement
).value = lotId
;(
modalElement.querySelector(
'#lotCommentEdit--lotCommentId'
) as HTMLInputElement
).value = lotCommentId.toString()
;(
modalElement.querySelector(
'#lotCommentEdit--lotComment'
@ -319,7 +314,6 @@ declare const bulmaJS: BulmaJS
lotComment.lotCommentDateString! <= currentDateString
? currentDateString
: lotComment.lotCommentDateString!
;(
modalElement.querySelector(
'#lotCommentEdit--lotCommentTimeString'
@ -331,7 +325,6 @@ declare const bulmaJS: BulmaJS
los.initializeDatePickers(modalElement)
// los.initializeTimePickers(modalElement);
;(
modalElement.querySelector(
'#lotCommentEdit--lotComment'
@ -349,14 +342,14 @@ declare const bulmaJS: BulmaJS
})
}
function deleteLotComment(clickEvent: Event) {
function deleteLotComment(clickEvent: Event): void {
const lotCommentId = Number.parseInt(
(clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset
.lotCommentId!,
10
)
const doDelete = () => {
function doDelete(): void {
cityssm.postJSON(
los.urlPrefix + '/lots/doDeleteLotComment',
{
@ -374,7 +367,7 @@ declare const bulmaJS: BulmaJS
} else {
bulmaJS.alert({
title: 'Error Removing Comment',
message: responseJSON.errorMessage || '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
}
@ -393,7 +386,7 @@ declare const bulmaJS: BulmaJS
})
}
function renderLotComments() {
function renderLotComments(): void {
const containerElement = document.querySelector(
'#container--lotComments'
) as HTMLElement
@ -421,7 +414,7 @@ declare const bulmaJS: BulmaJS
tableRowElement.innerHTML =
'<td>' +
cityssm.escapeHTML(lotComment.recordCreate_userName || '') +
cityssm.escapeHTML(lotComment.recordCreate_userName ?? '') +
'</td>' +
'<td>' +
lotComment.lotCommentDateString +
@ -430,7 +423,7 @@ declare const bulmaJS: BulmaJS
: ' ' + lotComment.lotCommentTimeString) +
'</td>' +
'<td>' +
cityssm.escapeHTML(lotComment.lotComment || '') +
cityssm.escapeHTML(lotComment.lotComment ?? '') +
'</td>' +
('<td class="is-hidden-print">' +
'<div class="buttons are-small is-justify-content-end">' +
@ -459,10 +452,10 @@ declare const bulmaJS: BulmaJS
containerElement.append(tableElement)
}
function openAddCommentModal() {
function openAddCommentModal(): void {
let addCommentCloseModalFunction: () => void
const doAddComment = (formEvent: SubmitEvent) => {
function doAddComment(formEvent: SubmitEvent): void {
formEvent.preventDefault()
cityssm.postJSON(

View File

@ -1006,7 +1006,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupancyFees = exports.lotOccupancyFees;
delete exports.lotOccupancyFees;
const lotOccupancyFeesContainerElement = document.querySelector('#container--lotOccupancyFees');
const getFeeGrandTotal = () => {
function getFeeGrandTotal() {
let feeGrandTotal = 0;
for (const lotOccupancyFee of lotOccupancyFees) {
feeGrandTotal +=
@ -1014,14 +1014,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
lotOccupancyFee.quantity;
}
return feeGrandTotal;
};
const deleteLotOccupancyFee = (clickEvent) => {
}
function deleteLotOccupancyFee(clickEvent) {
const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId;
const doDelete = () => {
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', {
lotOccupancyId,
feeId
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotOccupancyFees = responseJSON.lotOccupancyFees;
renderLotOccupancyFees();
@ -1029,12 +1030,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: 'Error Deleting Fee',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
bulmaJS.confirm({
title: 'Delete Fee',
message: 'Are you sure you want to delete this fee?',
@ -1044,34 +1045,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
callbackFunction: doDelete
}
});
};
const renderLotOccupancyFees = () => {
}
function renderLotOccupancyFees() {
var _a;
if (lotOccupancyFees.length === 0) {
lotOccupancyFeesContainerElement.innerHTML =
'<div class="message is-info">' +
'<p class="message-body">There are no fees associated with this record.</p>' +
'</div>';
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no fees associated with this record.</p>
</div>`;
renderLotOccupancyTransactions();
return;
}
lotOccupancyFeesContainerElement.innerHTML =
'<table class="table is-fullwidth is-striped is-hoverable">' +
('<thead><tr>' +
'<th>Fee</th>' +
'<th><span class="is-sr-only">Unit Cost</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">&times;</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">Quantity</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">equals</span></th>' +
'<th class="has-width-1 has-text-right">Total</th>' +
'<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>' +
'</tr></thead>') +
'<tbody></tbody>' +
('<tfoot>' +
'<tr><th colspan="5">Subtotal</th><td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--feeAmountTotal"></td><td class="is-hidden-print"></td></tr>' +
'<tr><th colspan="5">Tax</th><td class="has-text-right" id="lotOccupancyFees--taxAmountTotal"></td><td class="is-hidden-print"></td></tr>' +
'<tr><th colspan="5">Grand Total</th><td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--grandTotal"></td><td class="is-hidden-print"></td></tr>' +
'</tfoot>') +
'</table>';
lotOccupancyFeesContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
<thead><tr>
<th>Fee</th>
<th><span class="is-sr-only">Unit Cost</span></th>
<th class="has-width-1"><span class="is-sr-only">&times;</span></th>
<th class="has-width-1"><span class="is-sr-only">Quantity</span></th>
<th class="has-width-1"><span class="is-sr-only">equals</span></th>
<th class="has-width-1 has-text-right">Total</th>
<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>
<tfoot><tr>
<th colspan="5">Subtotal</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--feeAmountTotal"></td>
<td class="is-hidden-print"></td>
</tr><tr>
<th colspan="5">Tax</th>
<td class="has-text-right" id="lotOccupancyFees--taxAmountTotal"></td>
<td class="is-hidden-print"></td>
</tr><tr>
<th colspan="5">Grand Total</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--grandTotal"></td>
<td class="is-hidden-print"></td>
</tr></tfoot></table>`;
let feeAmountTotal = 0;
let taxAmountTotal = 0;
for (const lotOccupancyFee of lotOccupancyFees) {
@ -1085,7 +1092,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
'<td colspan="' +
(lotOccupancyFee.quantity === 1 ? '5' : '1') +
'">' +
cityssm.escapeHTML(lotOccupancyFee.feeName || '') +
cityssm.escapeHTML((_a = lotOccupancyFee.feeName) !== null && _a !== void 0 ? _a : '') +
'</td>' +
(lotOccupancyFee.quantity === 1
? ''
@ -1119,7 +1126,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--taxAmountTotal').textContent = '$' + taxAmountTotal.toFixed(2);
lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2);
renderLotOccupancyTransactions();
};
}
document.querySelector('#button--addFee').addEventListener('click', () => {
if (hasUnsavedChanges) {
bulmaJS.alert({
@ -1131,12 +1138,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
let feeCategories;
let feeFilterElement;
let feeFilterResultsElement;
const doAddFee = (feeId, quantity = 1) => {
function doAddFee(feeId, quantity = 1) {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', {
lotOccupancyId,
feeId,
quantity
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotOccupancyFees = responseJSON.lotOccupancyFees;
renderLotOccupancyFees();
@ -1145,20 +1153,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: 'Error Adding Fee',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
const doSetQuantityAndAddFee = (fee) => {
}
function doSetQuantityAndAddFee(fee) {
let quantityElement;
let quantityCloseModalFunction;
const doSetQuantity = (submitEvent) => {
function doSetQuantity(submitEvent) {
submitEvent.preventDefault();
doAddFee(fee.feeId, quantityElement.value);
quantityCloseModalFunction();
};
}
cityssm.openHtmlModal('lotOccupancy-setFeeQuantity', {
onshow: (modalElement) => {
;
@ -1172,8 +1180,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
.addEventListener('submit', doSetQuantity);
}
});
};
const tryAddFee = (clickEvent) => {
}
function tryAddFee(clickEvent) {
clickEvent.preventDefault();
const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10);
const feeCategoryId = Number.parseInt(clickEvent.currentTarget.closest('.container--feeCategory').dataset.feeCategoryId, 10);
@ -1189,8 +1197,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
doAddFee(feeId);
}
};
const filterFees = () => {
}
function filterFees() {
var _a, _b;
const filterStringPieces = feeFilterElement.value
.trim()
.toLowerCase()
@ -1230,11 +1239,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
panelBlockElement.href = '#';
panelBlockElement.innerHTML =
'<strong>' +
cityssm.escapeHTML(fee.feeName || '') +
cityssm.escapeHTML((_a = fee.feeName) !== null && _a !== void 0 ? _a : '') +
'</strong><br />' +
'<small>' +
cityssm
.escapeHTML(fee.feeDescription || '')
.escapeHTML((_b = fee.feeDescription) !== null && _b !== void 0 ? _b : '')
.replace(/\n/g, '<br />') +
'</small>';
panelBlockElement.addEventListener('click', tryAddFee);
@ -1244,9 +1253,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
feeFilterResultsElement.append(categoryContainerElement);
}
}
};
}
cityssm.openHtmlModal('lotOccupancy-addFee', {
onshow: (modalElement) => {
onshow(modalElement) {
feeFilterElement = modalElement.querySelector('#feeSelect--feeName');
feeFilterResultsElement = modalElement.querySelector('#resultsContainer--feeSelect');
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetFees', {
@ -1259,13 +1268,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
filterFees();
});
},
onshown: () => {
onshown() {
bulmaJS.toggleHtmlClipped();
},
onhidden: () => {
onhidden() {
renderLotOccupancyFees();
},
onremoved: () => {
onremoved() {
bulmaJS.toggleHtmlClipped();
}
});
@ -1273,20 +1282,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupancyTransactions = exports.lotOccupancyTransactions;
delete exports.lotOccupancyTransactions;
const lotOccupancyTransactionsContainerElement = document.querySelector('#container--lotOccupancyTransactions');
const getTransactionGrandTotal = () => {
function getTransactionGrandTotal() {
let transactionGrandTotal = 0;
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
transactionGrandTotal += lotOccupancyTransaction.transactionAmount;
}
return transactionGrandTotal;
};
const deleteLotOccupancyTransaction = (clickEvent) => {
}
function deleteLotOccupancyTransaction(clickEvent) {
const transactionIndex = clickEvent.currentTarget.closest('.container--lotOccupancyTransaction').dataset.transactionIndex;
const doDelete = () => {
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', {
lotOccupancyId,
transactionIndex
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions;
renderLotOccupancyTransactions();
@ -1294,12 +1304,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.alert({
title: 'Error Deleting Transaction',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
bulmaJS.confirm({
title: 'Delete Trasnaction',
message: 'Are you sure you want to delete this transaction?',
@ -1309,8 +1319,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
callbackFunction: doDelete
}
});
};
const renderLotOccupancyTransactions = () => {
}
function renderLotOccupancyTransactions() {
var _a, _b;
if (lotOccupancyTransactions.length === 0) {
lotOccupancyTransactionsContainerElement.innerHTML =
'<div class="message ' +
@ -1320,23 +1331,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
'</div>';
return;
}
lotOccupancyTransactionsContainerElement.innerHTML =
'<table class="table is-fullwidth is-striped is-hoverable">' +
'<thead><tr>' +
'<th class="has-width-1">Date</th>' +
'<th>' +
cityssm.escapeHTML(exports.aliases.externalReceiptNumber) +
'</th>' +
'<th class="has-text-right has-width-1">Amount</th>' +
'<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>' +
'</tr></thead>' +
'<tbody></tbody>' +
('<tfoot><tr>' +
'<th colspan="2">Transaction Total</th>' +
'<td class="has-text-weight-bold has-text-right" id="lotOccupancyTransactions--grandTotal"></td>' +
'<td class="is-hidden-print"></td>' +
'</tr></tfoot>') +
'</table>';
lotOccupancyTransactionsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
<thead><tr>
<th class="has-width-1">Date</th>
<th>${los.escapedAliases.ExternalReceiptNumber}</th>
<th class="has-text-right has-width-1">Amount</th>
<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>
<tfoot><tr>
<th colspan="2">Transaction Total</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyTransactions--grandTotal"></td>
<td class="is-hidden-print"></td>
</tr></tfoot>
</table>`;
let transactionGrandTotal = 0;
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
transactionGrandTotal += lotOccupancyTransaction.transactionAmount;
@ -1349,10 +1357,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
lotOccupancyTransaction.transactionDateString +
'</td>' +
('<td>' +
cityssm.escapeHTML(lotOccupancyTransaction.externalReceiptNumber || '') +
cityssm.escapeHTML((_a = lotOccupancyTransaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : '') +
'<br />' +
'<small>' +
cityssm.escapeHTML(lotOccupancyTransaction.transactionNote || '') +
cityssm.escapeHTML((_b = lotOccupancyTransaction.transactionNote) !== null && _b !== void 0 ? _b : '') +
'</small>' +
'</td>') +
('<td class="has-text-right">$' +
@ -1385,14 +1393,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
'</div>' +
'</div>');
}
};
}
document
.querySelector('#button--addTransaction')
.addEventListener('click', () => {
let addCloseModalFunction;
const doAddTransaction = (submitEvent) => {
function doAddTransaction(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', submitEvent.currentTarget, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions;
addCloseModalFunction();
@ -1401,12 +1410,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
else {
bulmaJS.confirm({
title: 'Error Adding Transaction',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
cityssm.openHtmlModal('lotOccupancy-addTransaction', {
onshow: (modalElement) => {
los.populateAliases(modalElement);

View File

@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupancyFees = exports.lotOccupancyFees;
delete exports.lotOccupancyFees;
const lotOccupancyFeesContainerElement = document.querySelector('#container--lotOccupancyFees');
const getFeeGrandTotal = () => {
function getFeeGrandTotal() {
let feeGrandTotal = 0;
for (const lotOccupancyFee of lotOccupancyFees) {
feeGrandTotal +=
@ -12,14 +12,15 @@ const getFeeGrandTotal = () => {
lotOccupancyFee.quantity;
}
return feeGrandTotal;
};
const deleteLotOccupancyFee = (clickEvent) => {
}
function deleteLotOccupancyFee(clickEvent) {
const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId;
const doDelete = () => {
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', {
lotOccupancyId,
feeId
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotOccupancyFees = responseJSON.lotOccupancyFees;
renderLotOccupancyFees();
@ -27,12 +28,12 @@ const deleteLotOccupancyFee = (clickEvent) => {
else {
bulmaJS.alert({
title: 'Error Deleting Fee',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
bulmaJS.confirm({
title: 'Delete Fee',
message: 'Are you sure you want to delete this fee?',
@ -42,34 +43,40 @@ const deleteLotOccupancyFee = (clickEvent) => {
callbackFunction: doDelete
}
});
};
const renderLotOccupancyFees = () => {
}
function renderLotOccupancyFees() {
var _a;
if (lotOccupancyFees.length === 0) {
lotOccupancyFeesContainerElement.innerHTML =
'<div class="message is-info">' +
'<p class="message-body">There are no fees associated with this record.</p>' +
'</div>';
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no fees associated with this record.</p>
</div>`;
renderLotOccupancyTransactions();
return;
}
lotOccupancyFeesContainerElement.innerHTML =
'<table class="table is-fullwidth is-striped is-hoverable">' +
('<thead><tr>' +
'<th>Fee</th>' +
'<th><span class="is-sr-only">Unit Cost</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">&times;</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">Quantity</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">equals</span></th>' +
'<th class="has-width-1 has-text-right">Total</th>' +
'<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>' +
'</tr></thead>') +
'<tbody></tbody>' +
('<tfoot>' +
'<tr><th colspan="5">Subtotal</th><td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--feeAmountTotal"></td><td class="is-hidden-print"></td></tr>' +
'<tr><th colspan="5">Tax</th><td class="has-text-right" id="lotOccupancyFees--taxAmountTotal"></td><td class="is-hidden-print"></td></tr>' +
'<tr><th colspan="5">Grand Total</th><td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--grandTotal"></td><td class="is-hidden-print"></td></tr>' +
'</tfoot>') +
'</table>';
lotOccupancyFeesContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
<thead><tr>
<th>Fee</th>
<th><span class="is-sr-only">Unit Cost</span></th>
<th class="has-width-1"><span class="is-sr-only">&times;</span></th>
<th class="has-width-1"><span class="is-sr-only">Quantity</span></th>
<th class="has-width-1"><span class="is-sr-only">equals</span></th>
<th class="has-width-1 has-text-right">Total</th>
<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>
<tfoot><tr>
<th colspan="5">Subtotal</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--feeAmountTotal"></td>
<td class="is-hidden-print"></td>
</tr><tr>
<th colspan="5">Tax</th>
<td class="has-text-right" id="lotOccupancyFees--taxAmountTotal"></td>
<td class="is-hidden-print"></td>
</tr><tr>
<th colspan="5">Grand Total</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--grandTotal"></td>
<td class="is-hidden-print"></td>
</tr></tfoot></table>`;
let feeAmountTotal = 0;
let taxAmountTotal = 0;
for (const lotOccupancyFee of lotOccupancyFees) {
@ -83,7 +90,7 @@ const renderLotOccupancyFees = () => {
'<td colspan="' +
(lotOccupancyFee.quantity === 1 ? '5' : '1') +
'">' +
cityssm.escapeHTML(lotOccupancyFee.feeName || '') +
cityssm.escapeHTML((_a = lotOccupancyFee.feeName) !== null && _a !== void 0 ? _a : '') +
'</td>' +
(lotOccupancyFee.quantity === 1
? ''
@ -117,7 +124,7 @@ const renderLotOccupancyFees = () => {
lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--taxAmountTotal').textContent = '$' + taxAmountTotal.toFixed(2);
lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2);
renderLotOccupancyTransactions();
};
}
document.querySelector('#button--addFee').addEventListener('click', () => {
if (hasUnsavedChanges) {
bulmaJS.alert({
@ -129,12 +136,13 @@ document.querySelector('#button--addFee').addEventListener('click', () => {
let feeCategories;
let feeFilterElement;
let feeFilterResultsElement;
const doAddFee = (feeId, quantity = 1) => {
function doAddFee(feeId, quantity = 1) {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', {
lotOccupancyId,
feeId,
quantity
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotOccupancyFees = responseJSON.lotOccupancyFees;
renderLotOccupancyFees();
@ -143,20 +151,20 @@ document.querySelector('#button--addFee').addEventListener('click', () => {
else {
bulmaJS.alert({
title: 'Error Adding Fee',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
const doSetQuantityAndAddFee = (fee) => {
}
function doSetQuantityAndAddFee(fee) {
let quantityElement;
let quantityCloseModalFunction;
const doSetQuantity = (submitEvent) => {
function doSetQuantity(submitEvent) {
submitEvent.preventDefault();
doAddFee(fee.feeId, quantityElement.value);
quantityCloseModalFunction();
};
}
cityssm.openHtmlModal('lotOccupancy-setFeeQuantity', {
onshow: (modalElement) => {
;
@ -170,8 +178,8 @@ document.querySelector('#button--addFee').addEventListener('click', () => {
.addEventListener('submit', doSetQuantity);
}
});
};
const tryAddFee = (clickEvent) => {
}
function tryAddFee(clickEvent) {
clickEvent.preventDefault();
const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10);
const feeCategoryId = Number.parseInt(clickEvent.currentTarget.closest('.container--feeCategory').dataset.feeCategoryId, 10);
@ -187,8 +195,9 @@ document.querySelector('#button--addFee').addEventListener('click', () => {
else {
doAddFee(feeId);
}
};
const filterFees = () => {
}
function filterFees() {
var _a, _b;
const filterStringPieces = feeFilterElement.value
.trim()
.toLowerCase()
@ -228,11 +237,11 @@ document.querySelector('#button--addFee').addEventListener('click', () => {
panelBlockElement.href = '#';
panelBlockElement.innerHTML =
'<strong>' +
cityssm.escapeHTML(fee.feeName || '') +
cityssm.escapeHTML((_a = fee.feeName) !== null && _a !== void 0 ? _a : '') +
'</strong><br />' +
'<small>' +
cityssm
.escapeHTML(fee.feeDescription || '')
.escapeHTML((_b = fee.feeDescription) !== null && _b !== void 0 ? _b : '')
.replace(/\n/g, '<br />') +
'</small>';
panelBlockElement.addEventListener('click', tryAddFee);
@ -242,9 +251,9 @@ document.querySelector('#button--addFee').addEventListener('click', () => {
feeFilterResultsElement.append(categoryContainerElement);
}
}
};
}
cityssm.openHtmlModal('lotOccupancy-addFee', {
onshow: (modalElement) => {
onshow(modalElement) {
feeFilterElement = modalElement.querySelector('#feeSelect--feeName');
feeFilterResultsElement = modalElement.querySelector('#resultsContainer--feeSelect');
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetFees', {
@ -257,13 +266,13 @@ document.querySelector('#button--addFee').addEventListener('click', () => {
filterFees();
});
},
onshown: () => {
onshown() {
bulmaJS.toggleHtmlClipped();
},
onhidden: () => {
onhidden() {
renderLotOccupancyFees();
},
onremoved: () => {
onremoved() {
bulmaJS.toggleHtmlClipped();
}
});
@ -271,20 +280,21 @@ document.querySelector('#button--addFee').addEventListener('click', () => {
let lotOccupancyTransactions = exports.lotOccupancyTransactions;
delete exports.lotOccupancyTransactions;
const lotOccupancyTransactionsContainerElement = document.querySelector('#container--lotOccupancyTransactions');
const getTransactionGrandTotal = () => {
function getTransactionGrandTotal() {
let transactionGrandTotal = 0;
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
transactionGrandTotal += lotOccupancyTransaction.transactionAmount;
}
return transactionGrandTotal;
};
const deleteLotOccupancyTransaction = (clickEvent) => {
}
function deleteLotOccupancyTransaction(clickEvent) {
const transactionIndex = clickEvent.currentTarget.closest('.container--lotOccupancyTransaction').dataset.transactionIndex;
const doDelete = () => {
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', {
lotOccupancyId,
transactionIndex
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions;
renderLotOccupancyTransactions();
@ -292,12 +302,12 @@ const deleteLotOccupancyTransaction = (clickEvent) => {
else {
bulmaJS.alert({
title: 'Error Deleting Transaction',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
bulmaJS.confirm({
title: 'Delete Trasnaction',
message: 'Are you sure you want to delete this transaction?',
@ -307,8 +317,9 @@ const deleteLotOccupancyTransaction = (clickEvent) => {
callbackFunction: doDelete
}
});
};
const renderLotOccupancyTransactions = () => {
}
function renderLotOccupancyTransactions() {
var _a, _b;
if (lotOccupancyTransactions.length === 0) {
lotOccupancyTransactionsContainerElement.innerHTML =
'<div class="message ' +
@ -318,23 +329,20 @@ const renderLotOccupancyTransactions = () => {
'</div>';
return;
}
lotOccupancyTransactionsContainerElement.innerHTML =
'<table class="table is-fullwidth is-striped is-hoverable">' +
'<thead><tr>' +
'<th class="has-width-1">Date</th>' +
'<th>' +
cityssm.escapeHTML(exports.aliases.externalReceiptNumber) +
'</th>' +
'<th class="has-text-right has-width-1">Amount</th>' +
'<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>' +
'</tr></thead>' +
'<tbody></tbody>' +
('<tfoot><tr>' +
'<th colspan="2">Transaction Total</th>' +
'<td class="has-text-weight-bold has-text-right" id="lotOccupancyTransactions--grandTotal"></td>' +
'<td class="is-hidden-print"></td>' +
'</tr></tfoot>') +
'</table>';
lotOccupancyTransactionsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
<thead><tr>
<th class="has-width-1">Date</th>
<th>${los.escapedAliases.ExternalReceiptNumber}</th>
<th class="has-text-right has-width-1">Amount</th>
<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>
<tfoot><tr>
<th colspan="2">Transaction Total</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyTransactions--grandTotal"></td>
<td class="is-hidden-print"></td>
</tr></tfoot>
</table>`;
let transactionGrandTotal = 0;
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
transactionGrandTotal += lotOccupancyTransaction.transactionAmount;
@ -347,10 +355,10 @@ const renderLotOccupancyTransactions = () => {
lotOccupancyTransaction.transactionDateString +
'</td>' +
('<td>' +
cityssm.escapeHTML(lotOccupancyTransaction.externalReceiptNumber || '') +
cityssm.escapeHTML((_a = lotOccupancyTransaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : '') +
'<br />' +
'<small>' +
cityssm.escapeHTML(lotOccupancyTransaction.transactionNote || '') +
cityssm.escapeHTML((_b = lotOccupancyTransaction.transactionNote) !== null && _b !== void 0 ? _b : '') +
'</small>' +
'</td>') +
('<td class="has-text-right">$' +
@ -383,14 +391,15 @@ const renderLotOccupancyTransactions = () => {
'</div>' +
'</div>');
}
};
}
document
.querySelector('#button--addTransaction')
.addEventListener('click', () => {
let addCloseModalFunction;
const doAddTransaction = (submitEvent) => {
function doAddTransaction(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', submitEvent.currentTarget, (responseJSON) => {
var _a;
if (responseJSON.success) {
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions;
addCloseModalFunction();
@ -399,12 +408,12 @@ document
else {
bulmaJS.confirm({
title: 'Error Adding Transaction',
message: responseJSON.errorMessage || '',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
}
});
};
}
cityssm.openHtmlModal('lotOccupancy-addTransaction', {
onshow: (modalElement) => {
los.populateAliases(modalElement);

View File

@ -22,7 +22,7 @@ const lotOccupancyFeesContainerElement = document.querySelector(
'#container--lotOccupancyFees'
) as HTMLElement
const getFeeGrandTotal = (): number => {
function getFeeGrandTotal(): number {
let feeGrandTotal = 0
for (const lotOccupancyFee of lotOccupancyFees) {
@ -34,14 +34,14 @@ const getFeeGrandTotal = (): number => {
return feeGrandTotal
}
const deleteLotOccupancyFee = (clickEvent: Event) => {
function deleteLotOccupancyFee(clickEvent: Event): void {
const feeId = (
(clickEvent.currentTarget as HTMLElement).closest(
'.container--lotOccupancyFee'
) as HTMLElement
).dataset.feeId
const doDelete = () => {
function doDelete(): void {
cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee',
{
@ -59,7 +59,7 @@ const deleteLotOccupancyFee = (clickEvent: Event) => {
} else {
bulmaJS.alert({
title: 'Error Deleting Fee',
message: responseJSON.errorMessage || '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
}
@ -78,36 +78,41 @@ const deleteLotOccupancyFee = (clickEvent: Event) => {
})
}
const renderLotOccupancyFees = () => {
function renderLotOccupancyFees(): void {
if (lotOccupancyFees.length === 0) {
lotOccupancyFeesContainerElement.innerHTML =
'<div class="message is-info">' +
'<p class="message-body">There are no fees associated with this record.</p>' +
'</div>'
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no fees associated with this record.</p>
</div>`
renderLotOccupancyTransactions()
return
}
lotOccupancyFeesContainerElement.innerHTML =
'<table class="table is-fullwidth is-striped is-hoverable">' +
('<thead><tr>' +
'<th>Fee</th>' +
'<th><span class="is-sr-only">Unit Cost</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">&times;</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">Quantity</span></th>' +
'<th class="has-width-1"><span class="is-sr-only">equals</span></th>' +
'<th class="has-width-1 has-text-right">Total</th>' +
'<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>' +
'</tr></thead>') +
'<tbody></tbody>' +
('<tfoot>' +
'<tr><th colspan="5">Subtotal</th><td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--feeAmountTotal"></td><td class="is-hidden-print"></td></tr>' +
'<tr><th colspan="5">Tax</th><td class="has-text-right" id="lotOccupancyFees--taxAmountTotal"></td><td class="is-hidden-print"></td></tr>' +
'<tr><th colspan="5">Grand Total</th><td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--grandTotal"></td><td class="is-hidden-print"></td></tr>' +
'</tfoot>') +
'</table>'
lotOccupancyFeesContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
<thead><tr>
<th>Fee</th>
<th><span class="is-sr-only">Unit Cost</span></th>
<th class="has-width-1"><span class="is-sr-only">&times;</span></th>
<th class="has-width-1"><span class="is-sr-only">Quantity</span></th>
<th class="has-width-1"><span class="is-sr-only">equals</span></th>
<th class="has-width-1 has-text-right">Total</th>
<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>
<tfoot><tr>
<th colspan="5">Subtotal</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--feeAmountTotal"></td>
<td class="is-hidden-print"></td>
</tr><tr>
<th colspan="5">Tax</th>
<td class="has-text-right" id="lotOccupancyFees--taxAmountTotal"></td>
<td class="is-hidden-print"></td>
</tr><tr>
<th colspan="5">Grand Total</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyFees--grandTotal"></td>
<td class="is-hidden-print"></td>
</tr></tfoot></table>`
let feeAmountTotal = 0
let taxAmountTotal = 0
@ -115,7 +120,7 @@ const renderLotOccupancyFees = () => {
for (const lotOccupancyFee of lotOccupancyFees) {
const tableRowElement = document.createElement('tr')
tableRowElement.className = 'container--lotOccupancyFee'
tableRowElement.dataset.feeId = lotOccupancyFee.feeId!.toString()
tableRowElement.dataset.feeId = lotOccupancyFee.feeId.toString()
tableRowElement.dataset.includeQuantity = lotOccupancyFee.includeQuantity
? '1'
: '0'
@ -124,7 +129,7 @@ const renderLotOccupancyFees = () => {
'<td colspan="' +
(lotOccupancyFee.quantity === 1 ? '5' : '1') +
'">' +
cityssm.escapeHTML(lotOccupancyFee.feeName || '') +
cityssm.escapeHTML(lotOccupancyFee.feeName ?? '') +
'</td>' +
(lotOccupancyFee.quantity === 1
? ''
@ -190,7 +195,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
let feeFilterElement: HTMLInputElement
let feeFilterResultsElement: HTMLElement
const doAddFee = (feeId: number, quantity: number | string = 1) => {
function doAddFee(feeId: number, quantity: number | string = 1): void {
cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee',
{
@ -210,7 +215,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
} else {
bulmaJS.alert({
title: 'Error Adding Fee',
message: responseJSON.errorMessage || '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
}
@ -218,13 +223,13 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
)
}
const doSetQuantityAndAddFee = (fee: recordTypes.Fee) => {
function doSetQuantityAndAddFee(fee: recordTypes.Fee): void {
let quantityElement: HTMLInputElement
let quantityCloseModalFunction: () => void
const doSetQuantity = (submitEvent: SubmitEvent) => {
function doSetQuantity(submitEvent: SubmitEvent): void {
submitEvent.preventDefault()
doAddFee(fee.feeId!, quantityElement.value)
doAddFee(fee.feeId, quantityElement.value)
quantityCloseModalFunction()
}
@ -250,7 +255,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
})
}
const tryAddFee = (clickEvent: Event) => {
function tryAddFee(clickEvent: Event): void {
clickEvent.preventDefault()
const feeId = Number.parseInt(
@ -270,7 +275,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
return currentFeeCategory.feeCategoryId === feeCategoryId
})!
const fee = feeCategory.fees!.find((currentFee) => {
const fee = feeCategory.fees.find((currentFee) => {
return currentFee.feeId === feeId
})!
@ -281,7 +286,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
}
}
const filterFees = () => {
function filterFees(): void {
const filterStringPieces = feeFilterElement.value
.trim()
.toLowerCase()
@ -293,7 +298,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
const categoryContainerElement = document.createElement('div')
categoryContainerElement.className = 'container--feeCategory'
categoryContainerElement.dataset.feeCategoryId =
feeCategory.feeCategoryId!.toString()
feeCategory.feeCategoryId.toString()
categoryContainerElement.innerHTML =
'<h4 class="title is-5 mt-2">' +
cityssm.escapeHTML(feeCategory.feeCategory || '') +
@ -302,7 +307,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
let hasFees = false
for (const fee of feeCategory.fees!) {
for (const fee of feeCategory.fees) {
if (
lotOccupancyFeesContainerElement.querySelector(
".container--lotOccupancyFee[data-fee-id='" +
@ -330,21 +335,20 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
const panelBlockElement = document.createElement('a')
panelBlockElement.className = 'panel-block is-block container--fee'
panelBlockElement.dataset.feeId = fee.feeId!.toString()
panelBlockElement.dataset.feeId = fee.feeId.toString()
panelBlockElement.href = '#'
panelBlockElement.innerHTML =
'<strong>' +
cityssm.escapeHTML(fee.feeName || '') +
cityssm.escapeHTML(fee.feeName ?? '') +
'</strong><br />' +
'<small>' +
cityssm
.escapeHTML(fee.feeDescription || '')
.escapeHTML(fee.feeDescription ?? '')
.replace(/\n/g, '<br />') +
'</small>'
panelBlockElement.addEventListener('click', tryAddFee)
;(
categoryContainerElement.querySelector('.panel') as HTMLElement
).append(panelBlockElement)
@ -357,7 +361,7 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
}
cityssm.openHtmlModal('lotOccupancy-addFee', {
onshow: (modalElement) => {
onshow(modalElement) {
feeFilterElement = modalElement.querySelector(
'#feeSelect--feeName'
) as HTMLInputElement
@ -382,13 +386,13 @@ document.querySelector('#button--addFee')!.addEventListener('click', () => {
}
)
},
onshown: () => {
onshown() {
bulmaJS.toggleHtmlClipped()
},
onhidden: () => {
onhidden() {
renderLotOccupancyFees()
},
onremoved: () => {
onremoved() {
bulmaJS.toggleHtmlClipped()
}
})
@ -402,7 +406,7 @@ const lotOccupancyTransactionsContainerElement = document.querySelector(
'#container--lotOccupancyTransactions'
) as HTMLElement
const getTransactionGrandTotal = (): number => {
function getTransactionGrandTotal(): number {
let transactionGrandTotal = 0
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
@ -412,14 +416,14 @@ const getTransactionGrandTotal = (): number => {
return transactionGrandTotal
}
const deleteLotOccupancyTransaction = (clickEvent: Event) => {
function deleteLotOccupancyTransaction(clickEvent: Event): void {
const transactionIndex = (
(clickEvent.currentTarget as HTMLElement).closest(
'.container--lotOccupancyTransaction'
) as HTMLElement
).dataset.transactionIndex
const doDelete = () => {
function doDelete(): void {
cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction',
{
@ -437,7 +441,7 @@ const deleteLotOccupancyTransaction = (clickEvent: Event) => {
} else {
bulmaJS.alert({
title: 'Error Deleting Transaction',
message: responseJSON.errorMessage || '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
}
@ -456,7 +460,7 @@ const deleteLotOccupancyTransaction = (clickEvent: Event) => {
})
}
const renderLotOccupancyTransactions = () => {
function renderLotOccupancyTransactions(): void {
if (lotOccupancyTransactions.length === 0) {
lotOccupancyTransactionsContainerElement.innerHTML =
'<div class="message ' +
@ -468,23 +472,20 @@ const renderLotOccupancyTransactions = () => {
return
}
lotOccupancyTransactionsContainerElement.innerHTML =
'<table class="table is-fullwidth is-striped is-hoverable">' +
'<thead><tr>' +
'<th class="has-width-1">Date</th>' +
'<th>' +
cityssm.escapeHTML(exports.aliases.externalReceiptNumber) +
'</th>' +
'<th class="has-text-right has-width-1">Amount</th>' +
'<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>' +
'</tr></thead>' +
'<tbody></tbody>' +
('<tfoot><tr>' +
'<th colspan="2">Transaction Total</th>' +
'<td class="has-text-weight-bold has-text-right" id="lotOccupancyTransactions--grandTotal"></td>' +
'<td class="is-hidden-print"></td>' +
'</tr></tfoot>') +
'</table>'
lotOccupancyTransactionsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
<thead><tr>
<th class="has-width-1">Date</th>
<th>${los.escapedAliases.ExternalReceiptNumber}</th>
<th class="has-text-right has-width-1">Amount</th>
<th class="has-width-1 is-hidden-print"><span class="is-sr-only">Options</span></th>
</tr></thead>
<tbody></tbody>
<tfoot><tr>
<th colspan="2">Transaction Total</th>
<td class="has-text-weight-bold has-text-right" id="lotOccupancyTransactions--grandTotal"></td>
<td class="is-hidden-print"></td>
</tr></tfoot>
</table>`
let transactionGrandTotal = 0
@ -502,11 +503,11 @@ const renderLotOccupancyTransactions = () => {
'</td>' +
('<td>' +
cityssm.escapeHTML(
lotOccupancyTransaction.externalReceiptNumber || ''
lotOccupancyTransaction.externalReceiptNumber ?? ''
) +
'<br />' +
'<small>' +
cityssm.escapeHTML(lotOccupancyTransaction.transactionNote || '') +
cityssm.escapeHTML(lotOccupancyTransaction.transactionNote ?? '') +
'</small>' +
'</td>') +
('<td class="has-text-right">$' +
@ -557,7 +558,7 @@ document
.addEventListener('click', () => {
let addCloseModalFunction: () => void
const doAddTransaction = (submitEvent: SubmitEvent) => {
function doAddTransaction(submitEvent: SubmitEvent): void {
submitEvent.preventDefault()
cityssm.postJSON(
@ -575,7 +576,7 @@ document
} else {
bulmaJS.confirm({
title: 'Error Adding Transaction',
message: responseJSON.errorMessage || '',
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
}
@ -586,7 +587,6 @@ document
cityssm.openHtmlModal('lotOccupancy-addTransaction', {
onshow: (modalElement) => {
los.populateAliases(modalElement)
;(
modalElement.querySelector(
'#lotOccupancyTransactionAdd--lotOccupancyId'

View File

@ -2,7 +2,8 @@
import * as globalTypes from '../types/globalTypes'
;(() => {
const mapContainerElement = document.querySelector('#lot--map') as HTMLElement
const mapContainerElement: HTMLElement | null =
document.querySelector('#lot--map')
if (mapContainerElement) {
;(exports.los as globalTypes.LOS).highlightMap(

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long