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) { function buildWhereClause(filters) {
let sqlWhereClause = ' where w.recordDelete_timeMillis is null'; let sqlWhereClause = ' where w.recordDelete_timeMillis is null';
const sqlParameters = []; const sqlParameters = [];
if (filters.workOrderTypeId) { if ((filters.workOrderTypeId ?? '') !== '') {
sqlWhereClause += ' and w.workOrderTypeId = ?'; sqlWhereClause += ' and w.workOrderTypeId = ?';
sqlParameters.push(filters.workOrderTypeId); sqlParameters.push(filters.workOrderTypeId);
} }
if (filters.workOrderOpenStatus) { if ((filters.workOrderOpenStatus ?? '') !== '') {
if (filters.workOrderOpenStatus === 'open') { if (filters.workOrderOpenStatus === 'open') {
sqlWhereClause += ' and w.workOrderCloseDate is null'; sqlWhereClause += ' and w.workOrderCloseDate is null';
} }
@ -21,7 +21,7 @@ function buildWhereClause(filters) {
sqlWhereClause += ' and w.workOrderCloseDate is not null'; sqlWhereClause += ' and w.workOrderCloseDate is not null';
} }
} }
if (filters.workOrderOpenDateString) { if ((filters.workOrderOpenDateString ?? '') !== '') {
sqlWhereClause += ' and w.workOrderOpenDate = ?'; sqlWhereClause += ' and w.workOrderOpenDate = ?';
sqlParameters.push(dateStringToInteger(filters.workOrderOpenDateString)); sqlParameters.push(dateStringToInteger(filters.workOrderOpenDateString));
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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