linting
parent
d55d76ba03
commit
50e6c19b2b
|
|
@ -311,9 +311,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
lotSelectCloseModalFunction();
|
||||
}
|
||||
function selectExistingLot(clickEvent) {
|
||||
var _a, _b;
|
||||
clickEvent.preventDefault();
|
||||
const selectedLotElement = clickEvent.currentTarget;
|
||||
renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName);
|
||||
renderSelectedLotAndClose((_a = selectedLotElement.dataset.lotId) !== null && _a !== void 0 ? _a : '', (_b = selectedLotElement.dataset.lotName) !== null && _b !== void 0 ? _b : '');
|
||||
}
|
||||
function searchLots() {
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
|
|
@ -478,14 +479,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
* Occupants
|
||||
*/
|
||||
"use strict";
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
|
||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable unicorn/prefer-module */
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
||||
delete exports.lotOccupancyOccupants;
|
||||
function openEditLotOccupancyOccupant(clickEvent) {
|
||||
const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
|
||||
.lotOccupantIndex, 10);
|
||||
var _a, _b;
|
||||
const lotOccupantIndex = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.lotOccupantIndex) !== null && _b !== void 0 ? _b : '', 10);
|
||||
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
||||
return currentLotOccupancyOccupant.lotOccupantIndex === lotOccupantIndex;
|
||||
});
|
||||
|
|
@ -493,7 +495,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
let editCloseModalFunction;
|
||||
function editOccupant(submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`, editFormElement, (rawResponseJSON) => {
|
||||
var _a;
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
|
|
@ -503,7 +505,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
title: 'Error Updating ' + los.escapedAliases.Occupant,
|
||||
title: `Error Updating ${los.escapedAliases.Occupant}`,
|
||||
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
|
||||
contextualColorName: 'danger'
|
||||
});
|
||||
|
|
@ -544,7 +546,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
optionElement.selected = true;
|
||||
lotOccupantTypeSelectElement.append(optionElement);
|
||||
}
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = `<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
|
||||
`<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1;
|
||||
|
|
@ -568,7 +571,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
var _a, _b;
|
||||
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = `<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
|
||||
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
.occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
|
||||
if (occupantCommentTitle === '') {
|
||||
|
|
@ -644,9 +648,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
lotOccupancyOccupant.lotOccupantIndex.toString();
|
||||
tableRowElement.innerHTML =
|
||||
'<td>' +
|
||||
cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === ''
|
||||
cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' &&
|
||||
((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === ''
|
||||
? '(No Name)'
|
||||
: lotOccupancyOccupant.occupantName + ' ' + lotOccupancyOccupant.occupantFamilyName) +
|
||||
: lotOccupancyOccupant.occupantName +
|
||||
' ' +
|
||||
lotOccupancyOccupant.occupantFamilyName) +
|
||||
'<br />' +
|
||||
('<span class="tag">' +
|
||||
'<i class="fas fa-fw fa-' +
|
||||
|
|
@ -869,7 +876,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
var _a, _b;
|
||||
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
|
||||
modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML = `<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML =
|
||||
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
.occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
|
||||
if (occupantCommentTitle === '') {
|
||||
|
|
@ -1086,6 +1094,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
renderLotOccupancyComments();
|
||||
|
||||
"use strict";
|
||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable unicorn/prefer-module */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let lotOccupancyFees = exports.lotOccupancyFees;
|
||||
|
|
@ -1101,15 +1110,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
return feeGrandTotal;
|
||||
}
|
||||
function editLotOccupancyFeeQuantity(clickEvent) {
|
||||
const feeId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
|
||||
.feeId, 10);
|
||||
var _a, _b;
|
||||
const feeId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.feeId) !== null && _b !== void 0 ? _b : '', 10);
|
||||
const fee = lotOccupancyFees.find((possibleFee) => {
|
||||
return possibleFee.feeId === feeId;
|
||||
});
|
||||
let updateCloseModalFunction;
|
||||
function doUpdateQuantity(formEvent) {
|
||||
formEvent.preventDefault();
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity', formEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`, formEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyFees = responseJSON.lotOccupancyFees;
|
||||
|
|
@ -1127,11 +1136,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
cityssm.openHtmlModal('lotOccupancy-editFeeQuantity', {
|
||||
onshow(modalElement) {
|
||||
var _a, _b;
|
||||
;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--lotOccupancyId').value = lotOccupancyId;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--feeId').value = fee.feeId.toString();
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = fee.quantity;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = (_a = fee.quantity) !== null && _a !== void 0 ? _a : 0;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = (_b = fee.quantityUnit) !== null && _b !== void 0 ? _b : '';
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
var _a;
|
||||
|
|
@ -1149,7 +1159,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
function deleteLotOccupancyFee(clickEvent) {
|
||||
const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId;
|
||||
function doDelete() {
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`, {
|
||||
lotOccupancyId,
|
||||
feeId
|
||||
}, (rawResponseJSON) => {
|
||||
|
|
@ -1179,7 +1189,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
});
|
||||
}
|
||||
function renderLotOccupancyFees() {
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||
if (lotOccupancyFees.length === 0) {
|
||||
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
|
||||
<p class="message-body">There are no fees associated with this record.</p>
|
||||
|
|
@ -1187,6 +1197,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
renderLotOccupancyTransactions();
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
lotOccupancyFeesContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
|
||||
<thead><tr>
|
||||
<th>Fee</th>
|
||||
|
|
@ -1219,45 +1230,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
tableRowElement.dataset.feeId = lotOccupancyFee.feeId.toString();
|
||||
tableRowElement.dataset.includeQuantity =
|
||||
((_a = lotOccupancyFee.includeQuantity) !== null && _a !== void 0 ? _a : false) ? '1' : '0';
|
||||
tableRowElement.innerHTML =
|
||||
'<td colspan="' +
|
||||
(lotOccupancyFee.quantity === 1 ? '5' : '1') +
|
||||
'">' +
|
||||
cityssm.escapeHTML((_b = lotOccupancyFee.feeName) !== null && _b !== void 0 ? _b : '') +
|
||||
'<br />' +
|
||||
'<span class="tag">' +
|
||||
cityssm.escapeHTML((_c = lotOccupancyFee.feeCategory) !== null && _c !== void 0 ? _c : '') +
|
||||
'</span>' +
|
||||
'</td>' +
|
||||
(lotOccupancyFee.quantity === 1
|
||||
? ''
|
||||
: '<td class="has-text-right">$' +
|
||||
lotOccupancyFee.feeAmount.toFixed(2) +
|
||||
'</td>' +
|
||||
'<td>×</td>' +
|
||||
'<td class="has-text-right">' +
|
||||
lotOccupancyFee.quantity.toString() +
|
||||
'</td>' +
|
||||
'<td>=</td>') +
|
||||
'<td class="has-text-right">$' +
|
||||
(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2) +
|
||||
'</td>' +
|
||||
('<td class="is-hidden-print">' +
|
||||
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||
(((_d = lotOccupancyFee.includeQuantity) !== null && _d !== void 0 ? _d : false)
|
||||
? '<button class="button is-primary button--editQuantity"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span><span>Edit</span></button>'
|
||||
: '') +
|
||||
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">' +
|
||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
'</td>');
|
||||
(_e = tableRowElement
|
||||
.querySelector('.button--editQuantity')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyFeeQuantity);
|
||||
(_f = tableRowElement
|
||||
.querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyFee);
|
||||
(_g = lotOccupancyFeesContainerElement
|
||||
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
tableRowElement.innerHTML = `<td colspan="${lotOccupancyFee.quantity === 1 ? '5' : '1'}">
|
||||
${cityssm.escapeHTML((_b = lotOccupancyFee.feeName) !== null && _b !== void 0 ? _b : '')}<br />
|
||||
<span class="tag">${cityssm.escapeHTML((_c = lotOccupancyFee.feeCategory) !== null && _c !== void 0 ? _c : '')}</span>
|
||||
</td>
|
||||
${lotOccupancyFee.quantity === 1
|
||||
? ''
|
||||
: `<td class="has-text-right">
|
||||
$${(_d = lotOccupancyFee.feeAmount) === null || _d === void 0 ? void 0 : _d.toFixed(2)}
|
||||
</td>
|
||||
<td>×</td>
|
||||
<td class="has-text-right">${(_e = lotOccupancyFee.quantity) === null || _e === void 0 ? void 0 : _e.toString()}</td>
|
||||
<td>=</td>`}
|
||||
<td class="has-text-right">
|
||||
$${(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2)}
|
||||
</td>
|
||||
<td class="is-hidden-print">
|
||||
<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">
|
||||
${((_f = lotOccupancyFee.includeQuantity) !== null && _f !== void 0 ? _f : false)
|
||||
? `<button class="button is-primary button--editQuantity">
|
||||
<span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
|
||||
<span>Edit</span>
|
||||
</button>`
|
||||
: ''}
|
||||
<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>`;
|
||||
(_g = tableRowElement
|
||||
.querySelector('.button--editQuantity')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', editLotOccupancyFeeQuantity);
|
||||
(_h = tableRowElement
|
||||
.querySelector('.button--delete')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', deleteLotOccupancyFee);
|
||||
(_j = lotOccupancyFeesContainerElement
|
||||
.querySelector('tbody')) === null || _j === void 0 ? void 0 : _j.append(tableRowElement);
|
||||
feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity;
|
||||
taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity;
|
||||
}
|
||||
|
|
@ -1280,7 +1287,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
let feeFilterElement;
|
||||
let feeFilterResultsElement;
|
||||
function doAddFee(feeId, quantity = 1) {
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`, {
|
||||
lotOccupancyId,
|
||||
feeId,
|
||||
quantity
|
||||
|
|
@ -1311,30 +1318,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
cityssm.openHtmlModal('lotOccupancy-setFeeQuantity', {
|
||||
onshow(modalElement) {
|
||||
var _a;
|
||||
;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = (_a = fee.quantityUnit) !== null && _a !== void 0 ? _a : '';
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
var _a;
|
||||
quantityCloseModalFunction = closeModalFunction;
|
||||
quantityElement = modalElement.querySelector('#lotOccupancyFeeQuantity--quantity');
|
||||
modalElement
|
||||
.querySelector('form')
|
||||
.addEventListener('submit', doSetQuantity);
|
||||
(_a = modalElement
|
||||
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doSetQuantity);
|
||||
}
|
||||
});
|
||||
}
|
||||
function tryAddFee(clickEvent) {
|
||||
var _a;
|
||||
var _a, _b, _c;
|
||||
clickEvent.preventDefault();
|
||||
const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10);
|
||||
const feeCategoryId = Number.parseInt(clickEvent.currentTarget.dataset.feeCategoryId, 10);
|
||||
const feeId = Number.parseInt((_a = clickEvent.currentTarget.dataset.feeId) !== null && _a !== void 0 ? _a : '', 10);
|
||||
const feeCategoryId = Number.parseInt((_b = clickEvent.currentTarget.dataset.feeCategoryId) !== null && _b !== void 0 ? _b : '', 10);
|
||||
const feeCategory = feeCategories.find((currentFeeCategory) => {
|
||||
return currentFeeCategory.feeCategoryId === feeCategoryId;
|
||||
});
|
||||
const fee = feeCategory.fees.find((currentFee) => {
|
||||
return currentFee.feeId === feeId;
|
||||
});
|
||||
if ((_a = fee.includeQuantity) !== null && _a !== void 0 ? _a : false) {
|
||||
if ((_c = fee.includeQuantity) !== null && _c !== void 0 ? _c : false) {
|
||||
doSetQuantityAndAddFee(fee);
|
||||
}
|
||||
else {
|
||||
|
|
@ -1353,11 +1361,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
categoryContainerElement.className = 'container--feeCategory';
|
||||
categoryContainerElement.dataset.feeCategoryId =
|
||||
feeCategory.feeCategoryId.toString();
|
||||
categoryContainerElement.innerHTML =
|
||||
'<h4 class="title is-5 mt-2">' +
|
||||
cityssm.escapeHTML((_a = feeCategory.feeCategory) !== null && _a !== void 0 ? _a : '') +
|
||||
'</h4>' +
|
||||
'<div class="panel mb-5"></div>';
|
||||
categoryContainerElement.innerHTML = `<h4 class="title is-5 mt-2">${cityssm.escapeHTML((_a = feeCategory.feeCategory) !== null && _a !== void 0 ? _a : '')}</h4>
|
||||
<div class="panel mb-5"></div>`;
|
||||
let hasFees = false;
|
||||
for (const fee of feeCategory.fees) {
|
||||
// Don't include already applied fees that limit quantity
|
||||
|
|
@ -1365,11 +1370,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
continue;
|
||||
}
|
||||
let includeFee = true;
|
||||
const feeSearchString = (((_b = feeCategory.feeCategory) !== null && _b !== void 0 ? _b : '') +
|
||||
' ' +
|
||||
((_c = fee.feeName) !== null && _c !== void 0 ? _c : '') +
|
||||
' ' +
|
||||
((_d = fee.feeDescription) !== null && _d !== void 0 ? _d : '')).toLowerCase();
|
||||
const feeSearchString = `${(_b = feeCategory.feeCategory) !== null && _b !== void 0 ? _b : ''} ${(_c = fee.feeName) !== null && _c !== void 0 ? _c : ''} ${(_d = fee.feeDescription) !== null && _d !== void 0 ? _d : ''}`.toLowerCase();
|
||||
for (const filterStringPiece of filterStringPieces) {
|
||||
if (!feeSearchString.includes(filterStringPiece)) {
|
||||
includeFee = false;
|
||||
|
|
@ -1386,15 +1387,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
panelBlockElement.dataset.feeCategoryId =
|
||||
feeCategory.feeCategoryId.toString();
|
||||
panelBlockElement.href = '#';
|
||||
panelBlockElement.innerHTML =
|
||||
'<strong>' +
|
||||
cityssm.escapeHTML((_e = fee.feeName) !== null && _e !== void 0 ? _e : '') +
|
||||
'</strong><br />' +
|
||||
'<small>' +
|
||||
cityssm
|
||||
.escapeHTML((_f = fee.feeDescription) !== null && _f !== void 0 ? _f : '')
|
||||
.replace(/\n/g, '<br />') +
|
||||
'</small>';
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
panelBlockElement.innerHTML = `<strong>${cityssm.escapeHTML((_e = fee.feeName) !== null && _e !== void 0 ? _e : '')}</strong><br />
|
||||
<small>
|
||||
${cityssm
|
||||
.escapeHTML((_f = fee.feeDescription) !== null && _f !== void 0 ? _f : '')
|
||||
.replaceAll('\n', '<br />')}
|
||||
</small>`;
|
||||
panelBlockElement.addEventListener('click', tryAddFee);
|
||||
categoryContainerElement.querySelector('.panel').append(panelBlockElement);
|
||||
}
|
||||
|
|
@ -1407,7 +1406,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
onshow(modalElement) {
|
||||
feeFilterElement = modalElement.querySelector('#feeSelect--feeName');
|
||||
feeFilterResultsElement = modalElement.querySelector('#resultsContainer--feeSelect');
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetFees', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetFees`, {
|
||||
lotOccupancyId
|
||||
}, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
|
|
@ -1441,15 +1440,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
return transactionGrandTotal;
|
||||
}
|
||||
function editLotOccupancyTransaction(clickEvent) {
|
||||
const transactionIndex = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
|
||||
.transactionIndex, 10);
|
||||
var _a, _b;
|
||||
const transactionIndex = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.transactionIndex) !== null && _b !== void 0 ? _b : '', 10);
|
||||
const transaction = lotOccupancyTransactions.find((possibleTransaction) => {
|
||||
return possibleTransaction.transactionIndex === transactionIndex;
|
||||
});
|
||||
let editCloseModalFunction;
|
||||
function doEdit(formEvent) {
|
||||
formEvent.preventDefault();
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyTransaction', formEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`, formEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions;
|
||||
|
|
@ -1467,15 +1466,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
cityssm.openHtmlModal('lotOccupancy-editTransaction', {
|
||||
onshow(modalElement) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
los.populateAliases(modalElement);
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--lotOccupancyId').value = lotOccupancyId;
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionIndex').value = transaction.transactionIndex.toString();
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionIndex').value = (_b = (_a = transaction.transactionIndex) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionAmount').value = transaction.transactionAmount.toFixed(2);
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--externalReceiptNumber').value = (_a = transaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionNote').value = (_b = transaction.transactionNote) !== null && _b !== void 0 ? _b : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionDateString').value = (_c = transaction.transactionDateString) !== null && _c !== void 0 ? _c : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionTimeString').value = (_d = transaction.transactionTimeString) !== null && _d !== void 0 ? _d : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--externalReceiptNumber').value = (_c = transaction.externalReceiptNumber) !== null && _c !== void 0 ? _c : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionNote').value = (_d = transaction.transactionNote) !== null && _d !== void 0 ? _d : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionDateString').value = (_e = transaction.transactionDateString) !== null && _e !== void 0 ? _e : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionTimeString').value = (_f = transaction.transactionTimeString) !== null && _f !== void 0 ? _f : '';
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
var _a;
|
||||
|
|
@ -1493,7 +1492,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
function deleteLotOccupancyTransaction(clickEvent) {
|
||||
const transactionIndex = clickEvent.currentTarget.closest('.container--lotOccupancyTransaction').dataset.transactionIndex;
|
||||
function doDelete() {
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`, {
|
||||
lotOccupancyId,
|
||||
transactionIndex
|
||||
}, (rawResponseJSON) => {
|
||||
|
|
@ -1523,16 +1522,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
});
|
||||
}
|
||||
function renderLotOccupancyTransactions() {
|
||||
var _a, _b, _c, _d, _e;
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
if (lotOccupancyTransactions.length === 0) {
|
||||
lotOccupancyTransactionsContainerElement.innerHTML =
|
||||
'<div class="message ' +
|
||||
(lotOccupancyFees.length === 0 ? 'is-info' : 'is-warning') +
|
||||
'">' +
|
||||
'<p class="message-body">There are no transactions associated with this record.</p>' +
|
||||
'</div>';
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
lotOccupancyTransactionsContainerElement.innerHTML = `<div class="message ${lotOccupancyFees.length === 0 ? 'is-info' : 'is-warning'}">
|
||||
<p class="message-body">There are no transactions associated with this record.</p>
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
lotOccupancyTransactionsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
|
||||
<thead><tr>
|
||||
<th class="has-width-1">Date</th>
|
||||
|
|
@ -1553,10 +1551,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const tableRowElement = document.createElement('tr');
|
||||
tableRowElement.className = 'container--lotOccupancyTransaction';
|
||||
tableRowElement.dataset.transactionIndex =
|
||||
lotOccupancyTransaction.transactionIndex.toString();
|
||||
(_a = lotOccupancyTransaction.transactionIndex) === null || _a === void 0 ? void 0 : _a.toString();
|
||||
let externalReceiptNumberHTML = '';
|
||||
if (lotOccupancyTransaction.externalReceiptNumber !== '') {
|
||||
externalReceiptNumberHTML = cityssm.escapeHTML((_a = lotOccupancyTransaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : '');
|
||||
externalReceiptNumberHTML = cityssm.escapeHTML((_b = lotOccupancyTransaction.externalReceiptNumber) !== null && _b !== void 0 ? _b : '');
|
||||
if (los.dynamicsGPIntegrationIsEnabled) {
|
||||
if (lotOccupancyTransaction.dynamicsGPDocument === undefined) {
|
||||
externalReceiptNumberHTML += ` <span data-tooltip="No Matching Document Found">
|
||||
|
|
@ -1576,52 +1574,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
externalReceiptNumberHTML += '<br />';
|
||||
}
|
||||
tableRowElement.innerHTML =
|
||||
'<td>' +
|
||||
((_b = lotOccupancyTransaction.transactionDateString) !== null && _b !== void 0 ? _b : '') +
|
||||
'</td>' +
|
||||
('<td>' +
|
||||
externalReceiptNumberHTML +
|
||||
'<small>' +
|
||||
cityssm.escapeHTML((_c = lotOccupancyTransaction.transactionNote) !== null && _c !== void 0 ? _c : '') +
|
||||
'</small>' +
|
||||
'</td>') +
|
||||
('<td class="has-text-right">$' +
|
||||
lotOccupancyTransaction.transactionAmount.toFixed(2) +
|
||||
'</td>') +
|
||||
('<td class="is-hidden-print">' +
|
||||
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||
'<button class="button is-primary button--edit" type="button">' +
|
||||
'<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>' +
|
||||
'<span>Edit</span>' +
|
||||
'</button>' +
|
||||
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Transaction" type="button">' +
|
||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
'</td>');
|
||||
(_d = tableRowElement
|
||||
.querySelector('.button--edit')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', editLotOccupancyTransaction);
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
tableRowElement.innerHTML = `<td>
|
||||
${cityssm.escapeHTML((_c = lotOccupancyTransaction.transactionDateString) !== null && _c !== void 0 ? _c : '')}
|
||||
</td>
|
||||
<td>
|
||||
${externalReceiptNumberHTML}
|
||||
<small>${cityssm.escapeHTML((_d = lotOccupancyTransaction.transactionNote) !== null && _d !== void 0 ? _d : '')}</small>
|
||||
</td>
|
||||
<td class="has-text-right">
|
||||
$${cityssm.escapeHTML(lotOccupancyTransaction.transactionAmount.toFixed(2))}
|
||||
</td>
|
||||
<td class="is-hidden-print">
|
||||
<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">
|
||||
<button class="button is-primary button--edit" type="button">
|
||||
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
|
||||
<span>Edit</span>
|
||||
</button>
|
||||
<button class="button is-danger is-light button--delete" data-tooltip="Delete Transaction" type="button">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>`;
|
||||
(_e = tableRowElement
|
||||
.querySelector('.button--delete')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancyTransaction);
|
||||
lotOccupancyTransactionsContainerElement
|
||||
.querySelector('tbody')
|
||||
.append(tableRowElement);
|
||||
.querySelector('.button--edit')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyTransaction);
|
||||
(_f = tableRowElement
|
||||
.querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyTransaction);
|
||||
(_g = lotOccupancyTransactionsContainerElement
|
||||
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
|
||||
}
|
||||
;
|
||||
lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = '$' + transactionGrandTotal.toFixed(2);
|
||||
const feeGrandTotal = getFeeGrandTotal();
|
||||
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
|
||||
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', '<div class="message is-warning">' +
|
||||
'<div class="message-body">' +
|
||||
'<div class="level">' +
|
||||
'<div class="level-left"><div class="level-item">Outstanding Balance</div></div>' +
|
||||
'<div class="level-right"><div class="level-item">$' +
|
||||
(feeGrandTotal - transactionGrandTotal).toFixed(2) +
|
||||
'</div></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `<div class="message is-warning">
|
||||
<div class="message-body">
|
||||
<div class="level">
|
||||
<div class="level-left">
|
||||
<div class="level-item">Outstanding Balance</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div></div>`);
|
||||
}
|
||||
}
|
||||
const addTransactionButtonElement = document.querySelector('#button--addTransaction');
|
||||
|
|
@ -1631,7 +1627,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
let addCloseModalFunction;
|
||||
function doAddTransaction(submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
var _a;
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
|
|
@ -1650,19 +1646,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function dynamicsGP_refreshExternalReceiptNumberIcon() {
|
||||
var _a, _b;
|
||||
const externalReceiptNumber = externalReceiptNumberElement.value;
|
||||
const iconElement = externalReceiptNumberElement
|
||||
.closest('.control')
|
||||
.querySelector('.icon');
|
||||
const helpTextElement = externalReceiptNumberElement
|
||||
.closest('.field')
|
||||
.querySelector('.help');
|
||||
const iconElement = (_a = externalReceiptNumberElement
|
||||
.closest('.control')) === null || _a === void 0 ? void 0 : _a.querySelector('.icon');
|
||||
const helpTextElement = (_b = externalReceiptNumberElement
|
||||
.closest('.field')) === null || _b === void 0 ? void 0 : _b.querySelector('.help');
|
||||
if (externalReceiptNumber === '') {
|
||||
helpTextElement.innerHTML = ' ';
|
||||
iconElement.innerHTML = '<i class="fas fa-minus" aria-hidden="true"></i>';
|
||||
return;
|
||||
}
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`, {
|
||||
externalReceiptNumber
|
||||
}, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
|
|
@ -1698,7 +1693,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
transactionAmountElement.max = Math.max(feeGrandTotal - transactionGrandTotal, 0).toFixed(2);
|
||||
transactionAmountElement.value = Math.max(feeGrandTotal - transactionGrandTotal, 0).toFixed(2);
|
||||
if (los.dynamicsGPIntegrationIsEnabled) {
|
||||
externalReceiptNumberElement = modalElement.querySelector('#lotOccupancyTransactionAdd--externalReceiptNumber');
|
||||
externalReceiptNumberElement = modalElement.querySelector(
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
'#lotOccupancyTransactionAdd--externalReceiptNumber');
|
||||
const externalReceiptNumberControlElement = externalReceiptNumberElement.closest('.control');
|
||||
externalReceiptNumberControlElement.classList.add('has-icons-right');
|
||||
externalReceiptNumberControlElement.insertAdjacentHTML('beforeend', '<span class="icon is-small is-right"></span>');
|
||||
|
|
@ -1709,12 +1706,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
var _a;
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
transactionAmountElement.focus();
|
||||
addCloseModalFunction = closeModalFunction;
|
||||
modalElement
|
||||
.querySelector('form')
|
||||
.addEventListener('submit', doAddTransaction);
|
||||
(_a = modalElement
|
||||
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAddTransaction);
|
||||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
|
|
|
|||
|
|
@ -311,9 +311,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
lotSelectCloseModalFunction();
|
||||
}
|
||||
function selectExistingLot(clickEvent) {
|
||||
var _a, _b;
|
||||
clickEvent.preventDefault();
|
||||
const selectedLotElement = clickEvent.currentTarget;
|
||||
renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName);
|
||||
renderSelectedLotAndClose((_a = selectedLotElement.dataset.lotId) !== null && _a !== void 0 ? _a : '', (_b = selectedLotElement.dataset.lotName) !== null && _b !== void 0 ? _b : '');
|
||||
}
|
||||
function searchLots() {
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
|
|
|
|||
|
|
@ -474,8 +474,8 @@ declare const exports: Record<string, unknown>
|
|||
const selectedLotElement = clickEvent.currentTarget as HTMLElement
|
||||
|
||||
renderSelectedLotAndClose(
|
||||
selectedLotElement.dataset.lotId!,
|
||||
selectedLotElement.dataset.lotName!
|
||||
selectedLotElement.dataset.lotId ?? '',
|
||||
selectedLotElement.dataset.lotName ?? ''
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"use strict";
|
||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable unicorn/prefer-module */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let lotOccupancyFees = exports.lotOccupancyFees;
|
||||
|
|
@ -14,15 +15,15 @@ function getFeeGrandTotal() {
|
|||
return feeGrandTotal;
|
||||
}
|
||||
function editLotOccupancyFeeQuantity(clickEvent) {
|
||||
const feeId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
|
||||
.feeId, 10);
|
||||
var _a, _b;
|
||||
const feeId = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.feeId) !== null && _b !== void 0 ? _b : '', 10);
|
||||
const fee = lotOccupancyFees.find((possibleFee) => {
|
||||
return possibleFee.feeId === feeId;
|
||||
});
|
||||
let updateCloseModalFunction;
|
||||
function doUpdateQuantity(formEvent) {
|
||||
formEvent.preventDefault();
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity', formEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`, formEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyFees = responseJSON.lotOccupancyFees;
|
||||
|
|
@ -40,11 +41,12 @@ function editLotOccupancyFeeQuantity(clickEvent) {
|
|||
}
|
||||
cityssm.openHtmlModal('lotOccupancy-editFeeQuantity', {
|
||||
onshow(modalElement) {
|
||||
var _a, _b;
|
||||
;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--lotOccupancyId').value = lotOccupancyId;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--feeId').value = fee.feeId.toString();
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = fee.quantity;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = (_a = fee.quantity) !== null && _a !== void 0 ? _a : 0;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = (_b = fee.quantityUnit) !== null && _b !== void 0 ? _b : '';
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
var _a;
|
||||
|
|
@ -62,7 +64,7 @@ function editLotOccupancyFeeQuantity(clickEvent) {
|
|||
function deleteLotOccupancyFee(clickEvent) {
|
||||
const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId;
|
||||
function doDelete() {
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`, {
|
||||
lotOccupancyId,
|
||||
feeId
|
||||
}, (rawResponseJSON) => {
|
||||
|
|
@ -92,7 +94,7 @@ function deleteLotOccupancyFee(clickEvent) {
|
|||
});
|
||||
}
|
||||
function renderLotOccupancyFees() {
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||
if (lotOccupancyFees.length === 0) {
|
||||
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
|
||||
<p class="message-body">There are no fees associated with this record.</p>
|
||||
|
|
@ -100,6 +102,7 @@ function renderLotOccupancyFees() {
|
|||
renderLotOccupancyTransactions();
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
lotOccupancyFeesContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
|
||||
<thead><tr>
|
||||
<th>Fee</th>
|
||||
|
|
@ -132,45 +135,41 @@ function renderLotOccupancyFees() {
|
|||
tableRowElement.dataset.feeId = lotOccupancyFee.feeId.toString();
|
||||
tableRowElement.dataset.includeQuantity =
|
||||
((_a = lotOccupancyFee.includeQuantity) !== null && _a !== void 0 ? _a : false) ? '1' : '0';
|
||||
tableRowElement.innerHTML =
|
||||
'<td colspan="' +
|
||||
(lotOccupancyFee.quantity === 1 ? '5' : '1') +
|
||||
'">' +
|
||||
cityssm.escapeHTML((_b = lotOccupancyFee.feeName) !== null && _b !== void 0 ? _b : '') +
|
||||
'<br />' +
|
||||
'<span class="tag">' +
|
||||
cityssm.escapeHTML((_c = lotOccupancyFee.feeCategory) !== null && _c !== void 0 ? _c : '') +
|
||||
'</span>' +
|
||||
'</td>' +
|
||||
(lotOccupancyFee.quantity === 1
|
||||
? ''
|
||||
: '<td class="has-text-right">$' +
|
||||
lotOccupancyFee.feeAmount.toFixed(2) +
|
||||
'</td>' +
|
||||
'<td>×</td>' +
|
||||
'<td class="has-text-right">' +
|
||||
lotOccupancyFee.quantity.toString() +
|
||||
'</td>' +
|
||||
'<td>=</td>') +
|
||||
'<td class="has-text-right">$' +
|
||||
(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2) +
|
||||
'</td>' +
|
||||
('<td class="is-hidden-print">' +
|
||||
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||
(((_d = lotOccupancyFee.includeQuantity) !== null && _d !== void 0 ? _d : false)
|
||||
? '<button class="button is-primary button--editQuantity"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span><span>Edit</span></button>'
|
||||
: '') +
|
||||
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">' +
|
||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
'</td>');
|
||||
(_e = tableRowElement
|
||||
.querySelector('.button--editQuantity')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyFeeQuantity);
|
||||
(_f = tableRowElement
|
||||
.querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyFee);
|
||||
(_g = lotOccupancyFeesContainerElement
|
||||
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
tableRowElement.innerHTML = `<td colspan="${lotOccupancyFee.quantity === 1 ? '5' : '1'}">
|
||||
${cityssm.escapeHTML((_b = lotOccupancyFee.feeName) !== null && _b !== void 0 ? _b : '')}<br />
|
||||
<span class="tag">${cityssm.escapeHTML((_c = lotOccupancyFee.feeCategory) !== null && _c !== void 0 ? _c : '')}</span>
|
||||
</td>
|
||||
${lotOccupancyFee.quantity === 1
|
||||
? ''
|
||||
: `<td class="has-text-right">
|
||||
$${(_d = lotOccupancyFee.feeAmount) === null || _d === void 0 ? void 0 : _d.toFixed(2)}
|
||||
</td>
|
||||
<td>×</td>
|
||||
<td class="has-text-right">${(_e = lotOccupancyFee.quantity) === null || _e === void 0 ? void 0 : _e.toString()}</td>
|
||||
<td>=</td>`}
|
||||
<td class="has-text-right">
|
||||
$${(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2)}
|
||||
</td>
|
||||
<td class="is-hidden-print">
|
||||
<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">
|
||||
${((_f = lotOccupancyFee.includeQuantity) !== null && _f !== void 0 ? _f : false)
|
||||
? `<button class="button is-primary button--editQuantity">
|
||||
<span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
|
||||
<span>Edit</span>
|
||||
</button>`
|
||||
: ''}
|
||||
<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>`;
|
||||
(_g = tableRowElement
|
||||
.querySelector('.button--editQuantity')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', editLotOccupancyFeeQuantity);
|
||||
(_h = tableRowElement
|
||||
.querySelector('.button--delete')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', deleteLotOccupancyFee);
|
||||
(_j = lotOccupancyFeesContainerElement
|
||||
.querySelector('tbody')) === null || _j === void 0 ? void 0 : _j.append(tableRowElement);
|
||||
feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity;
|
||||
taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity;
|
||||
}
|
||||
|
|
@ -193,7 +192,7 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
let feeFilterElement;
|
||||
let feeFilterResultsElement;
|
||||
function doAddFee(feeId, quantity = 1) {
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`, {
|
||||
lotOccupancyId,
|
||||
feeId,
|
||||
quantity
|
||||
|
|
@ -224,30 +223,31 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
}
|
||||
cityssm.openHtmlModal('lotOccupancy-setFeeQuantity', {
|
||||
onshow(modalElement) {
|
||||
var _a;
|
||||
;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit;
|
||||
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = (_a = fee.quantityUnit) !== null && _a !== void 0 ? _a : '';
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
var _a;
|
||||
quantityCloseModalFunction = closeModalFunction;
|
||||
quantityElement = modalElement.querySelector('#lotOccupancyFeeQuantity--quantity');
|
||||
modalElement
|
||||
.querySelector('form')
|
||||
.addEventListener('submit', doSetQuantity);
|
||||
(_a = modalElement
|
||||
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doSetQuantity);
|
||||
}
|
||||
});
|
||||
}
|
||||
function tryAddFee(clickEvent) {
|
||||
var _a;
|
||||
var _a, _b, _c;
|
||||
clickEvent.preventDefault();
|
||||
const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10);
|
||||
const feeCategoryId = Number.parseInt(clickEvent.currentTarget.dataset.feeCategoryId, 10);
|
||||
const feeId = Number.parseInt((_a = clickEvent.currentTarget.dataset.feeId) !== null && _a !== void 0 ? _a : '', 10);
|
||||
const feeCategoryId = Number.parseInt((_b = clickEvent.currentTarget.dataset.feeCategoryId) !== null && _b !== void 0 ? _b : '', 10);
|
||||
const feeCategory = feeCategories.find((currentFeeCategory) => {
|
||||
return currentFeeCategory.feeCategoryId === feeCategoryId;
|
||||
});
|
||||
const fee = feeCategory.fees.find((currentFee) => {
|
||||
return currentFee.feeId === feeId;
|
||||
});
|
||||
if ((_a = fee.includeQuantity) !== null && _a !== void 0 ? _a : false) {
|
||||
if ((_c = fee.includeQuantity) !== null && _c !== void 0 ? _c : false) {
|
||||
doSetQuantityAndAddFee(fee);
|
||||
}
|
||||
else {
|
||||
|
|
@ -266,11 +266,8 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
categoryContainerElement.className = 'container--feeCategory';
|
||||
categoryContainerElement.dataset.feeCategoryId =
|
||||
feeCategory.feeCategoryId.toString();
|
||||
categoryContainerElement.innerHTML =
|
||||
'<h4 class="title is-5 mt-2">' +
|
||||
cityssm.escapeHTML((_a = feeCategory.feeCategory) !== null && _a !== void 0 ? _a : '') +
|
||||
'</h4>' +
|
||||
'<div class="panel mb-5"></div>';
|
||||
categoryContainerElement.innerHTML = `<h4 class="title is-5 mt-2">${cityssm.escapeHTML((_a = feeCategory.feeCategory) !== null && _a !== void 0 ? _a : '')}</h4>
|
||||
<div class="panel mb-5"></div>`;
|
||||
let hasFees = false;
|
||||
for (const fee of feeCategory.fees) {
|
||||
// Don't include already applied fees that limit quantity
|
||||
|
|
@ -278,11 +275,7 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
continue;
|
||||
}
|
||||
let includeFee = true;
|
||||
const feeSearchString = (((_b = feeCategory.feeCategory) !== null && _b !== void 0 ? _b : '') +
|
||||
' ' +
|
||||
((_c = fee.feeName) !== null && _c !== void 0 ? _c : '') +
|
||||
' ' +
|
||||
((_d = fee.feeDescription) !== null && _d !== void 0 ? _d : '')).toLowerCase();
|
||||
const feeSearchString = `${(_b = feeCategory.feeCategory) !== null && _b !== void 0 ? _b : ''} ${(_c = fee.feeName) !== null && _c !== void 0 ? _c : ''} ${(_d = fee.feeDescription) !== null && _d !== void 0 ? _d : ''}`.toLowerCase();
|
||||
for (const filterStringPiece of filterStringPieces) {
|
||||
if (!feeSearchString.includes(filterStringPiece)) {
|
||||
includeFee = false;
|
||||
|
|
@ -299,15 +292,13 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
panelBlockElement.dataset.feeCategoryId =
|
||||
feeCategory.feeCategoryId.toString();
|
||||
panelBlockElement.href = '#';
|
||||
panelBlockElement.innerHTML =
|
||||
'<strong>' +
|
||||
cityssm.escapeHTML((_e = fee.feeName) !== null && _e !== void 0 ? _e : '') +
|
||||
'</strong><br />' +
|
||||
'<small>' +
|
||||
cityssm
|
||||
.escapeHTML((_f = fee.feeDescription) !== null && _f !== void 0 ? _f : '')
|
||||
.replace(/\n/g, '<br />') +
|
||||
'</small>';
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
panelBlockElement.innerHTML = `<strong>${cityssm.escapeHTML((_e = fee.feeName) !== null && _e !== void 0 ? _e : '')}</strong><br />
|
||||
<small>
|
||||
${cityssm
|
||||
.escapeHTML((_f = fee.feeDescription) !== null && _f !== void 0 ? _f : '')
|
||||
.replaceAll('\n', '<br />')}
|
||||
</small>`;
|
||||
panelBlockElement.addEventListener('click', tryAddFee);
|
||||
categoryContainerElement.querySelector('.panel').append(panelBlockElement);
|
||||
}
|
||||
|
|
@ -320,7 +311,7 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
onshow(modalElement) {
|
||||
feeFilterElement = modalElement.querySelector('#feeSelect--feeName');
|
||||
feeFilterResultsElement = modalElement.querySelector('#resultsContainer--feeSelect');
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetFees', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetFees`, {
|
||||
lotOccupancyId
|
||||
}, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
|
|
@ -354,15 +345,15 @@ function getTransactionGrandTotal() {
|
|||
return transactionGrandTotal;
|
||||
}
|
||||
function editLotOccupancyTransaction(clickEvent) {
|
||||
const transactionIndex = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
|
||||
.transactionIndex, 10);
|
||||
var _a, _b;
|
||||
const transactionIndex = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.transactionIndex) !== null && _b !== void 0 ? _b : '', 10);
|
||||
const transaction = lotOccupancyTransactions.find((possibleTransaction) => {
|
||||
return possibleTransaction.transactionIndex === transactionIndex;
|
||||
});
|
||||
let editCloseModalFunction;
|
||||
function doEdit(formEvent) {
|
||||
formEvent.preventDefault();
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyTransaction', formEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`, formEvent.currentTarget, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions;
|
||||
|
|
@ -380,15 +371,15 @@ function editLotOccupancyTransaction(clickEvent) {
|
|||
}
|
||||
cityssm.openHtmlModal('lotOccupancy-editTransaction', {
|
||||
onshow(modalElement) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
los.populateAliases(modalElement);
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--lotOccupancyId').value = lotOccupancyId;
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionIndex').value = transaction.transactionIndex.toString();
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionIndex').value = (_b = (_a = transaction.transactionIndex) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionAmount').value = transaction.transactionAmount.toFixed(2);
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--externalReceiptNumber').value = (_a = transaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionNote').value = (_b = transaction.transactionNote) !== null && _b !== void 0 ? _b : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionDateString').value = (_c = transaction.transactionDateString) !== null && _c !== void 0 ? _c : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionTimeString').value = (_d = transaction.transactionTimeString) !== null && _d !== void 0 ? _d : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--externalReceiptNumber').value = (_c = transaction.externalReceiptNumber) !== null && _c !== void 0 ? _c : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionNote').value = (_d = transaction.transactionNote) !== null && _d !== void 0 ? _d : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionDateString').value = (_e = transaction.transactionDateString) !== null && _e !== void 0 ? _e : '';
|
||||
modalElement.querySelector('#lotOccupancyTransactionEdit--transactionTimeString').value = (_f = transaction.transactionTimeString) !== null && _f !== void 0 ? _f : '';
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
var _a;
|
||||
|
|
@ -406,7 +397,7 @@ function editLotOccupancyTransaction(clickEvent) {
|
|||
function deleteLotOccupancyTransaction(clickEvent) {
|
||||
const transactionIndex = clickEvent.currentTarget.closest('.container--lotOccupancyTransaction').dataset.transactionIndex;
|
||||
function doDelete() {
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`, {
|
||||
lotOccupancyId,
|
||||
transactionIndex
|
||||
}, (rawResponseJSON) => {
|
||||
|
|
@ -436,16 +427,15 @@ function deleteLotOccupancyTransaction(clickEvent) {
|
|||
});
|
||||
}
|
||||
function renderLotOccupancyTransactions() {
|
||||
var _a, _b, _c, _d, _e;
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
if (lotOccupancyTransactions.length === 0) {
|
||||
lotOccupancyTransactionsContainerElement.innerHTML =
|
||||
'<div class="message ' +
|
||||
(lotOccupancyFees.length === 0 ? 'is-info' : 'is-warning') +
|
||||
'">' +
|
||||
'<p class="message-body">There are no transactions associated with this record.</p>' +
|
||||
'</div>';
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
lotOccupancyTransactionsContainerElement.innerHTML = `<div class="message ${lotOccupancyFees.length === 0 ? 'is-info' : 'is-warning'}">
|
||||
<p class="message-body">There are no transactions associated with this record.</p>
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
lotOccupancyTransactionsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
|
||||
<thead><tr>
|
||||
<th class="has-width-1">Date</th>
|
||||
|
|
@ -466,10 +456,10 @@ function renderLotOccupancyTransactions() {
|
|||
const tableRowElement = document.createElement('tr');
|
||||
tableRowElement.className = 'container--lotOccupancyTransaction';
|
||||
tableRowElement.dataset.transactionIndex =
|
||||
lotOccupancyTransaction.transactionIndex.toString();
|
||||
(_a = lotOccupancyTransaction.transactionIndex) === null || _a === void 0 ? void 0 : _a.toString();
|
||||
let externalReceiptNumberHTML = '';
|
||||
if (lotOccupancyTransaction.externalReceiptNumber !== '') {
|
||||
externalReceiptNumberHTML = cityssm.escapeHTML((_a = lotOccupancyTransaction.externalReceiptNumber) !== null && _a !== void 0 ? _a : '');
|
||||
externalReceiptNumberHTML = cityssm.escapeHTML((_b = lotOccupancyTransaction.externalReceiptNumber) !== null && _b !== void 0 ? _b : '');
|
||||
if (los.dynamicsGPIntegrationIsEnabled) {
|
||||
if (lotOccupancyTransaction.dynamicsGPDocument === undefined) {
|
||||
externalReceiptNumberHTML += ` <span data-tooltip="No Matching Document Found">
|
||||
|
|
@ -489,52 +479,50 @@ function renderLotOccupancyTransactions() {
|
|||
}
|
||||
externalReceiptNumberHTML += '<br />';
|
||||
}
|
||||
tableRowElement.innerHTML =
|
||||
'<td>' +
|
||||
((_b = lotOccupancyTransaction.transactionDateString) !== null && _b !== void 0 ? _b : '') +
|
||||
'</td>' +
|
||||
('<td>' +
|
||||
externalReceiptNumberHTML +
|
||||
'<small>' +
|
||||
cityssm.escapeHTML((_c = lotOccupancyTransaction.transactionNote) !== null && _c !== void 0 ? _c : '') +
|
||||
'</small>' +
|
||||
'</td>') +
|
||||
('<td class="has-text-right">$' +
|
||||
lotOccupancyTransaction.transactionAmount.toFixed(2) +
|
||||
'</td>') +
|
||||
('<td class="is-hidden-print">' +
|
||||
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||
'<button class="button is-primary button--edit" type="button">' +
|
||||
'<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>' +
|
||||
'<span>Edit</span>' +
|
||||
'</button>' +
|
||||
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Transaction" type="button">' +
|
||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
'</td>');
|
||||
(_d = tableRowElement
|
||||
.querySelector('.button--edit')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', editLotOccupancyTransaction);
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
tableRowElement.innerHTML = `<td>
|
||||
${cityssm.escapeHTML((_c = lotOccupancyTransaction.transactionDateString) !== null && _c !== void 0 ? _c : '')}
|
||||
</td>
|
||||
<td>
|
||||
${externalReceiptNumberHTML}
|
||||
<small>${cityssm.escapeHTML((_d = lotOccupancyTransaction.transactionNote) !== null && _d !== void 0 ? _d : '')}</small>
|
||||
</td>
|
||||
<td class="has-text-right">
|
||||
$${cityssm.escapeHTML(lotOccupancyTransaction.transactionAmount.toFixed(2))}
|
||||
</td>
|
||||
<td class="is-hidden-print">
|
||||
<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">
|
||||
<button class="button is-primary button--edit" type="button">
|
||||
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
|
||||
<span>Edit</span>
|
||||
</button>
|
||||
<button class="button is-danger is-light button--delete" data-tooltip="Delete Transaction" type="button">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>`;
|
||||
(_e = tableRowElement
|
||||
.querySelector('.button--delete')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancyTransaction);
|
||||
lotOccupancyTransactionsContainerElement
|
||||
.querySelector('tbody')
|
||||
.append(tableRowElement);
|
||||
.querySelector('.button--edit')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyTransaction);
|
||||
(_f = tableRowElement
|
||||
.querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyTransaction);
|
||||
(_g = lotOccupancyTransactionsContainerElement
|
||||
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
|
||||
}
|
||||
;
|
||||
lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = '$' + transactionGrandTotal.toFixed(2);
|
||||
const feeGrandTotal = getFeeGrandTotal();
|
||||
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
|
||||
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', '<div class="message is-warning">' +
|
||||
'<div class="message-body">' +
|
||||
'<div class="level">' +
|
||||
'<div class="level-left"><div class="level-item">Outstanding Balance</div></div>' +
|
||||
'<div class="level-right"><div class="level-item">$' +
|
||||
(feeGrandTotal - transactionGrandTotal).toFixed(2) +
|
||||
'</div></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `<div class="message is-warning">
|
||||
<div class="message-body">
|
||||
<div class="level">
|
||||
<div class="level-left">
|
||||
<div class="level-item">Outstanding Balance</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div></div>`);
|
||||
}
|
||||
}
|
||||
const addTransactionButtonElement = document.querySelector('#button--addTransaction');
|
||||
|
|
@ -544,7 +532,7 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
let addCloseModalFunction;
|
||||
function doAddTransaction(submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction', submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||
var _a;
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
|
|
@ -563,19 +551,18 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
}
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function dynamicsGP_refreshExternalReceiptNumberIcon() {
|
||||
var _a, _b;
|
||||
const externalReceiptNumber = externalReceiptNumberElement.value;
|
||||
const iconElement = externalReceiptNumberElement
|
||||
.closest('.control')
|
||||
.querySelector('.icon');
|
||||
const helpTextElement = externalReceiptNumberElement
|
||||
.closest('.field')
|
||||
.querySelector('.help');
|
||||
const iconElement = (_a = externalReceiptNumberElement
|
||||
.closest('.control')) === null || _a === void 0 ? void 0 : _a.querySelector('.icon');
|
||||
const helpTextElement = (_b = externalReceiptNumberElement
|
||||
.closest('.field')) === null || _b === void 0 ? void 0 : _b.querySelector('.help');
|
||||
if (externalReceiptNumber === '') {
|
||||
helpTextElement.innerHTML = ' ';
|
||||
iconElement.innerHTML = '<i class="fas fa-minus" aria-hidden="true"></i>';
|
||||
return;
|
||||
}
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument', {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`, {
|
||||
externalReceiptNumber
|
||||
}, (rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON;
|
||||
|
|
@ -611,7 +598,9 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
transactionAmountElement.max = Math.max(feeGrandTotal - transactionGrandTotal, 0).toFixed(2);
|
||||
transactionAmountElement.value = Math.max(feeGrandTotal - transactionGrandTotal, 0).toFixed(2);
|
||||
if (los.dynamicsGPIntegrationIsEnabled) {
|
||||
externalReceiptNumberElement = modalElement.querySelector('#lotOccupancyTransactionAdd--externalReceiptNumber');
|
||||
externalReceiptNumberElement = modalElement.querySelector(
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
'#lotOccupancyTransactionAdd--externalReceiptNumber');
|
||||
const externalReceiptNumberControlElement = externalReceiptNumberElement.closest('.control');
|
||||
externalReceiptNumberControlElement.classList.add('has-icons-right');
|
||||
externalReceiptNumberControlElement.insertAdjacentHTML('beforeend', '<span class="icon is-small is-right"></span>');
|
||||
|
|
@ -622,12 +611,12 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
}
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
var _a;
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
transactionAmountElement.focus();
|
||||
addCloseModalFunction = closeModalFunction;
|
||||
modalElement
|
||||
.querySelector('form')
|
||||
.addEventListener('submit', doAddTransaction);
|
||||
(_a = modalElement
|
||||
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doAddTransaction);
|
||||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable unicorn/prefer-module */
|
||||
|
||||
import type * as globalTypes from '../../types/globalTypes'
|
||||
import type * as recordTypes from '../../types/recordTypes'
|
||||
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
|
||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||
|
||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
|
||||
|
||||
import type { BulmaJS } from '@cityssm/bulma-js/types'
|
||||
import type * as globalTypes from '../../types/globalTypes.js'
|
||||
import type * as recordTypes from '../../types/recordTypes.js'
|
||||
|
||||
declare const cityssm: cityssmGlobal
|
||||
declare const bulmaJS: BulmaJS
|
||||
|
|
@ -14,7 +14,9 @@ declare const los: globalTypes.LOS
|
|||
|
||||
declare const lotOccupancyId: string
|
||||
|
||||
let lotOccupancyFees: recordTypes.LotOccupancyFee[] = exports.lotOccupancyFees
|
||||
declare const exports: Record<string, unknown>
|
||||
|
||||
let lotOccupancyFees = exports.lotOccupancyFees as recordTypes.LotOccupancyFee[]
|
||||
delete exports.lotOccupancyFees
|
||||
|
||||
const lotOccupancyFeesContainerElement = document.querySelector(
|
||||
|
|
@ -35,8 +37,8 @@ function getFeeGrandTotal(): number {
|
|||
|
||||
function editLotOccupancyFeeQuantity(clickEvent: Event): void {
|
||||
const feeId = Number.parseInt(
|
||||
(clickEvent.currentTarget as HTMLButtonElement).closest('tr')!.dataset
|
||||
.feeId!,
|
||||
(clickEvent.currentTarget as HTMLButtonElement).closest('tr')?.dataset
|
||||
.feeId ?? '',
|
||||
10
|
||||
)
|
||||
const fee = lotOccupancyFees.find((possibleFee) => {
|
||||
|
|
@ -49,7 +51,7 @@ function editLotOccupancyFeeQuantity(clickEvent: Event): void {
|
|||
formEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity',
|
||||
`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`,
|
||||
formEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as {
|
||||
|
|
@ -88,12 +90,12 @@ function editLotOccupancyFeeQuantity(clickEvent: Event): void {
|
|||
modalElement.querySelector(
|
||||
'#lotOccupancyFeeQuantity--quantity'
|
||||
) as HTMLInputElement
|
||||
).valueAsNumber = fee.quantity!
|
||||
).valueAsNumber = fee.quantity ?? 0
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#lotOccupancyFeeQuantity--quantityUnit'
|
||||
) as HTMLElement
|
||||
).textContent = fee.quantityUnit!
|
||||
).textContent = fee.quantityUnit ?? ''
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
|
|
@ -124,7 +126,7 @@ function deleteLotOccupancyFee(clickEvent: Event): void {
|
|||
|
||||
function doDelete(): void {
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyFee',
|
||||
`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`,
|
||||
{
|
||||
lotOccupancyId,
|
||||
feeId
|
||||
|
|
@ -133,11 +135,11 @@ function deleteLotOccupancyFee(clickEvent: Event): void {
|
|||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
errorMessage?: string
|
||||
lotOccupancyFees?: recordTypes.LotOccupancyFee[]
|
||||
lotOccupancyFees: recordTypes.LotOccupancyFee[]
|
||||
}
|
||||
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyFees = responseJSON.lotOccupancyFees!
|
||||
lotOccupancyFees = responseJSON.lotOccupancyFees
|
||||
renderLotOccupancyFees()
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
|
|
@ -172,6 +174,7 @@ function renderLotOccupancyFees(): void {
|
|||
return
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
lotOccupancyFeesContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
|
||||
<thead><tr>
|
||||
<th>Fee</th>
|
||||
|
|
@ -207,39 +210,39 @@ function renderLotOccupancyFees(): void {
|
|||
tableRowElement.dataset.includeQuantity =
|
||||
lotOccupancyFee.includeQuantity ?? false ? '1' : '0'
|
||||
|
||||
tableRowElement.innerHTML =
|
||||
'<td colspan="' +
|
||||
(lotOccupancyFee.quantity === 1 ? '5' : '1') +
|
||||
'">' +
|
||||
cityssm.escapeHTML(lotOccupancyFee.feeName ?? '') +
|
||||
'<br />' +
|
||||
'<span class="tag">' +
|
||||
cityssm.escapeHTML(lotOccupancyFee.feeCategory ?? '') +
|
||||
'</span>' +
|
||||
'</td>' +
|
||||
(lotOccupancyFee.quantity === 1
|
||||
? ''
|
||||
: '<td class="has-text-right">$' +
|
||||
lotOccupancyFee.feeAmount!.toFixed(2) +
|
||||
'</td>' +
|
||||
'<td>×</td>' +
|
||||
'<td class="has-text-right">' +
|
||||
lotOccupancyFee.quantity!.toString() +
|
||||
'</td>' +
|
||||
'<td>=</td>') +
|
||||
'<td class="has-text-right">$' +
|
||||
(lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!).toFixed(2) +
|
||||
'</td>' +
|
||||
('<td class="is-hidden-print">' +
|
||||
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||
(lotOccupancyFee.includeQuantity ?? false
|
||||
? '<button class="button is-primary button--editQuantity"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span><span>Edit</span></button>'
|
||||
: '') +
|
||||
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">' +
|
||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
'</td>')
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
tableRowElement.innerHTML = `<td colspan="${lotOccupancyFee.quantity === 1 ? '5' : '1'}">
|
||||
${cityssm.escapeHTML(lotOccupancyFee.feeName ?? '')}<br />
|
||||
<span class="tag">${cityssm.escapeHTML(lotOccupancyFee.feeCategory ?? '')}</span>
|
||||
</td>
|
||||
${
|
||||
lotOccupancyFee.quantity === 1
|
||||
? ''
|
||||
: `<td class="has-text-right">
|
||||
$${lotOccupancyFee.feeAmount?.toFixed(2)}
|
||||
</td>
|
||||
<td>×</td>
|
||||
<td class="has-text-right">${lotOccupancyFee.quantity?.toString()}</td>
|
||||
<td>=</td>`
|
||||
}
|
||||
<td class="has-text-right">
|
||||
$${(lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!).toFixed(2)}
|
||||
</td>
|
||||
<td class="is-hidden-print">
|
||||
<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">
|
||||
${
|
||||
lotOccupancyFee.includeQuantity ?? false
|
||||
? `<button class="button is-primary button--editQuantity">
|
||||
<span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
|
||||
<span>Edit</span>
|
||||
</button>`
|
||||
: ''
|
||||
}
|
||||
<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>`
|
||||
|
||||
tableRowElement
|
||||
.querySelector('.button--editQuantity')
|
||||
|
|
@ -296,7 +299,7 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
|
||||
function doAddFee(feeId: number, quantity: number | string = 1): void {
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doAddLotOccupancyFee',
|
||||
`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`,
|
||||
{
|
||||
lotOccupancyId,
|
||||
feeId,
|
||||
|
|
@ -306,11 +309,11 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
errorMessage?: string
|
||||
lotOccupancyFees?: recordTypes.LotOccupancyFee[]
|
||||
lotOccupancyFees: recordTypes.LotOccupancyFee[]
|
||||
}
|
||||
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyFees = responseJSON.lotOccupancyFees!
|
||||
lotOccupancyFees = responseJSON.lotOccupancyFees
|
||||
renderLotOccupancyFees()
|
||||
filterFees()
|
||||
} else {
|
||||
|
|
@ -340,7 +343,7 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
modalElement.querySelector(
|
||||
'#lotOccupancyFeeQuantity--quantityUnit'
|
||||
) as HTMLElement
|
||||
).textContent = fee.quantityUnit!
|
||||
).textContent = fee.quantityUnit ?? ''
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
quantityCloseModalFunction = closeModalFunction
|
||||
|
|
@ -350,8 +353,8 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
) as HTMLInputElement
|
||||
|
||||
modalElement
|
||||
.querySelector('form')!
|
||||
.addEventListener('submit', doSetQuantity)
|
||||
.querySelector('form')
|
||||
?.addEventListener('submit', doSetQuantity)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -360,11 +363,11 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
clickEvent.preventDefault()
|
||||
|
||||
const feeId = Number.parseInt(
|
||||
(clickEvent.currentTarget as HTMLElement).dataset.feeId!,
|
||||
(clickEvent.currentTarget as HTMLElement).dataset.feeId ?? '',
|
||||
10
|
||||
)
|
||||
const feeCategoryId = Number.parseInt(
|
||||
(clickEvent.currentTarget as HTMLElement).dataset.feeCategoryId!,
|
||||
(clickEvent.currentTarget as HTMLElement).dataset.feeCategoryId ?? '',
|
||||
10
|
||||
)
|
||||
|
||||
|
|
@ -399,11 +402,8 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
categoryContainerElement.dataset.feeCategoryId =
|
||||
feeCategory.feeCategoryId.toString()
|
||||
|
||||
categoryContainerElement.innerHTML =
|
||||
'<h4 class="title is-5 mt-2">' +
|
||||
cityssm.escapeHTML(feeCategory.feeCategory ?? '') +
|
||||
'</h4>' +
|
||||
'<div class="panel mb-5"></div>'
|
||||
categoryContainerElement.innerHTML = `<h4 class="title is-5 mt-2">${cityssm.escapeHTML(feeCategory.feeCategory ?? '')}</h4>
|
||||
<div class="panel mb-5"></div>`
|
||||
|
||||
let hasFees = false
|
||||
|
||||
|
|
@ -419,13 +419,8 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
|
||||
let includeFee = true
|
||||
|
||||
const feeSearchString = (
|
||||
(feeCategory.feeCategory ?? '') +
|
||||
' ' +
|
||||
(fee.feeName ?? '') +
|
||||
' ' +
|
||||
(fee.feeDescription ?? '')
|
||||
).toLowerCase()
|
||||
const feeSearchString =
|
||||
`${feeCategory.feeCategory ?? ''} ${fee.feeName ?? ''} ${fee.feeDescription ?? ''}`.toLowerCase()
|
||||
|
||||
for (const filterStringPiece of filterStringPieces) {
|
||||
if (!feeSearchString.includes(filterStringPiece)) {
|
||||
|
|
@ -447,15 +442,13 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
feeCategory.feeCategoryId.toString()
|
||||
panelBlockElement.href = '#'
|
||||
|
||||
panelBlockElement.innerHTML =
|
||||
'<strong>' +
|
||||
cityssm.escapeHTML(fee.feeName ?? '') +
|
||||
'</strong><br />' +
|
||||
'<small>' +
|
||||
cityssm
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
panelBlockElement.innerHTML = `<strong>${cityssm.escapeHTML(fee.feeName ?? '')}</strong><br />
|
||||
<small>
|
||||
${cityssm
|
||||
.escapeHTML(fee.feeDescription ?? '')
|
||||
.replace(/\n/g, '<br />') +
|
||||
'</small>'
|
||||
.replaceAll('\n', '<br />')}
|
||||
</small>`
|
||||
|
||||
panelBlockElement.addEventListener('click', tryAddFee)
|
||||
;(
|
||||
|
|
@ -471,14 +464,16 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
|
||||
cityssm.openHtmlModal('lotOccupancy-addFee', {
|
||||
onshow(modalElement) {
|
||||
feeFilterElement = modalElement.querySelector('#feeSelect--feeName')!
|
||||
feeFilterElement = modalElement.querySelector(
|
||||
'#feeSelect--feeName'
|
||||
) as HTMLInputElement
|
||||
|
||||
feeFilterResultsElement = modalElement.querySelector(
|
||||
'#resultsContainer--feeSelect'
|
||||
)!
|
||||
) as HTMLElement
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doGetFees',
|
||||
`${los.urlPrefix}/lotOccupancies/doGetFees`,
|
||||
{
|
||||
lotOccupancyId
|
||||
},
|
||||
|
|
@ -510,8 +505,8 @@ addFeeButtonElement.addEventListener('click', () => {
|
|||
})
|
||||
})
|
||||
|
||||
let lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[] =
|
||||
exports.lotOccupancyTransactions
|
||||
let lotOccupancyTransactions =
|
||||
exports.lotOccupancyTransactions as recordTypes.LotOccupancyTransaction[]
|
||||
delete exports.lotOccupancyTransactions
|
||||
|
||||
const lotOccupancyTransactionsContainerElement = document.querySelector(
|
||||
|
|
@ -530,8 +525,8 @@ function getTransactionGrandTotal(): number {
|
|||
|
||||
function editLotOccupancyTransaction(clickEvent: Event): void {
|
||||
const transactionIndex = Number.parseInt(
|
||||
(clickEvent.currentTarget as HTMLButtonElement).closest('tr')!.dataset
|
||||
.transactionIndex!,
|
||||
(clickEvent.currentTarget as HTMLButtonElement).closest('tr')?.dataset
|
||||
.transactionIndex ?? '',
|
||||
10
|
||||
)
|
||||
|
||||
|
|
@ -545,7 +540,7 @@ function editLotOccupancyTransaction(clickEvent: Event): void {
|
|||
formEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyTransaction',
|
||||
`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`,
|
||||
formEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as {
|
||||
|
|
@ -580,7 +575,7 @@ function editLotOccupancyTransaction(clickEvent: Event): void {
|
|||
modalElement.querySelector(
|
||||
'#lotOccupancyTransactionEdit--transactionIndex'
|
||||
) as HTMLInputElement
|
||||
).value = transaction.transactionIndex!.toString()
|
||||
).value = transaction.transactionIndex?.toString() ?? ''
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#lotOccupancyTransactionEdit--transactionAmount'
|
||||
|
|
@ -636,7 +631,7 @@ function deleteLotOccupancyTransaction(clickEvent: Event): void {
|
|||
|
||||
function doDelete(): void {
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doDeleteLotOccupancyTransaction',
|
||||
`${los.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`,
|
||||
{
|
||||
lotOccupancyId,
|
||||
transactionIndex
|
||||
|
|
@ -645,11 +640,11 @@ function deleteLotOccupancyTransaction(clickEvent: Event): void {
|
|||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
errorMessage?: string
|
||||
lotOccupancyTransactions?: recordTypes.LotOccupancyTransaction[]
|
||||
lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[]
|
||||
}
|
||||
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions!
|
||||
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions
|
||||
renderLotOccupancyTransactions()
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
|
|
@ -675,16 +670,15 @@ function deleteLotOccupancyTransaction(clickEvent: Event): void {
|
|||
|
||||
function renderLotOccupancyTransactions(): void {
|
||||
if (lotOccupancyTransactions.length === 0) {
|
||||
lotOccupancyTransactionsContainerElement.innerHTML =
|
||||
'<div class="message ' +
|
||||
(lotOccupancyFees.length === 0 ? 'is-info' : 'is-warning') +
|
||||
'">' +
|
||||
'<p class="message-body">There are no transactions associated with this record.</p>' +
|
||||
'</div>'
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
lotOccupancyTransactionsContainerElement.innerHTML = `<div class="message ${lotOccupancyFees.length === 0 ? 'is-info' : 'is-warning'}">
|
||||
<p class="message-body">There are no transactions associated with this record.</p>
|
||||
</div>`
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
lotOccupancyTransactionsContainerElement.innerHTML = `<table class="table is-fullwidth is-striped is-hoverable">
|
||||
<thead><tr>
|
||||
<th class="has-width-1">Date</th>
|
||||
|
|
@ -708,7 +702,7 @@ function renderLotOccupancyTransactions(): void {
|
|||
const tableRowElement = document.createElement('tr')
|
||||
tableRowElement.className = 'container--lotOccupancyTransaction'
|
||||
tableRowElement.dataset.transactionIndex =
|
||||
lotOccupancyTransaction.transactionIndex!.toString()
|
||||
lotOccupancyTransaction.transactionIndex?.toString()
|
||||
|
||||
let externalReceiptNumberHTML = ''
|
||||
|
||||
|
|
@ -744,30 +738,28 @@ function renderLotOccupancyTransactions(): void {
|
|||
externalReceiptNumberHTML += '<br />'
|
||||
}
|
||||
|
||||
tableRowElement.innerHTML =
|
||||
'<td>' +
|
||||
(lotOccupancyTransaction.transactionDateString ?? '') +
|
||||
'</td>' +
|
||||
('<td>' +
|
||||
externalReceiptNumberHTML +
|
||||
'<small>' +
|
||||
cityssm.escapeHTML(lotOccupancyTransaction.transactionNote ?? '') +
|
||||
'</small>' +
|
||||
'</td>') +
|
||||
('<td class="has-text-right">$' +
|
||||
lotOccupancyTransaction.transactionAmount.toFixed(2) +
|
||||
'</td>') +
|
||||
('<td class="is-hidden-print">' +
|
||||
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||
'<button class="button is-primary button--edit" type="button">' +
|
||||
'<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>' +
|
||||
'<span>Edit</span>' +
|
||||
'</button>' +
|
||||
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Transaction" type="button">' +
|
||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
'</td>')
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
tableRowElement.innerHTML = `<td>
|
||||
${cityssm.escapeHTML(lotOccupancyTransaction.transactionDateString ?? '')}
|
||||
</td>
|
||||
<td>
|
||||
${externalReceiptNumberHTML}
|
||||
<small>${cityssm.escapeHTML(lotOccupancyTransaction.transactionNote ?? '')}</small>
|
||||
</td>
|
||||
<td class="has-text-right">
|
||||
$${cityssm.escapeHTML(lotOccupancyTransaction.transactionAmount.toFixed(2))}
|
||||
</td>
|
||||
<td class="is-hidden-print">
|
||||
<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">
|
||||
<button class="button is-primary button--edit" type="button">
|
||||
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
|
||||
<span>Edit</span>
|
||||
</button>
|
||||
<button class="button is-danger is-light button--delete" data-tooltip="Delete Transaction" type="button">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>`
|
||||
|
||||
tableRowElement
|
||||
.querySelector('.button--edit')
|
||||
|
|
@ -778,8 +770,8 @@ function renderLotOccupancyTransactions(): void {
|
|||
?.addEventListener('click', deleteLotOccupancyTransaction)
|
||||
|
||||
lotOccupancyTransactionsContainerElement
|
||||
.querySelector('tbody')!
|
||||
.append(tableRowElement)
|
||||
.querySelector('tbody')
|
||||
?.append(tableRowElement)
|
||||
}
|
||||
|
||||
;(
|
||||
|
|
@ -793,16 +785,17 @@ function renderLotOccupancyTransactions(): void {
|
|||
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
|
||||
lotOccupancyTransactionsContainerElement.insertAdjacentHTML(
|
||||
'afterbegin',
|
||||
'<div class="message is-warning">' +
|
||||
'<div class="message-body">' +
|
||||
'<div class="level">' +
|
||||
'<div class="level-left"><div class="level-item">Outstanding Balance</div></div>' +
|
||||
'<div class="level-right"><div class="level-item">$' +
|
||||
(feeGrandTotal - transactionGrandTotal).toFixed(2) +
|
||||
'</div></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
`<div class="message is-warning">
|
||||
<div class="message-body">
|
||||
<div class="level">
|
||||
<div class="level-left">
|
||||
<div class="level-item">Outstanding Balance</div>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">$${cityssm.escapeHTML((feeGrandTotal - transactionGrandTotal).toFixed(2))}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div></div>`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -821,17 +814,17 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
submitEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction',
|
||||
`${los.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`,
|
||||
submitEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
errorMessage?: string
|
||||
lotOccupancyTransactions?: recordTypes.LotOccupancyTransaction[]
|
||||
lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[]
|
||||
}
|
||||
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions!
|
||||
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions
|
||||
addCloseModalFunction()
|
||||
renderLotOccupancyTransactions()
|
||||
} else {
|
||||
|
|
@ -850,12 +843,12 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
const externalReceiptNumber = externalReceiptNumberElement.value
|
||||
|
||||
const iconElement = externalReceiptNumberElement
|
||||
.closest('.control')!
|
||||
.querySelector('.icon') as HTMLElement
|
||||
.closest('.control')
|
||||
?.querySelector('.icon') as HTMLElement
|
||||
|
||||
const helpTextElement = externalReceiptNumberElement
|
||||
.closest('.field')!
|
||||
.querySelector('.help') as HTMLElement
|
||||
.closest('.field')
|
||||
?.querySelector('.help') as HTMLElement
|
||||
|
||||
if (externalReceiptNumber === '') {
|
||||
helpTextElement.innerHTML = ' '
|
||||
|
|
@ -864,7 +857,7 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
}
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument',
|
||||
`${los.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`,
|
||||
{
|
||||
externalReceiptNumber
|
||||
},
|
||||
|
|
@ -929,11 +922,12 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
|
||||
if (los.dynamicsGPIntegrationIsEnabled) {
|
||||
externalReceiptNumberElement = modalElement.querySelector(
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
'#lotOccupancyTransactionAdd--externalReceiptNumber'
|
||||
)!
|
||||
) as HTMLInputElement
|
||||
|
||||
const externalReceiptNumberControlElement =
|
||||
externalReceiptNumberElement.closest('.control')!
|
||||
externalReceiptNumberElement.closest('.control') as HTMLElement
|
||||
|
||||
externalReceiptNumberControlElement.classList.add('has-icons-right')
|
||||
|
||||
|
|
@ -968,8 +962,8 @@ addTransactionButtonElement.addEventListener('click', () => {
|
|||
addCloseModalFunction = closeModalFunction
|
||||
|
||||
modalElement
|
||||
.querySelector('form')!
|
||||
.addEventListener('submit', doAddTransaction)
|
||||
.querySelector('form')
|
||||
?.addEventListener('submit', doAddTransaction)
|
||||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
"use strict";
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
|
||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable unicorn/prefer-module */
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
||||
delete exports.lotOccupancyOccupants;
|
||||
function openEditLotOccupancyOccupant(clickEvent) {
|
||||
const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
|
||||
.lotOccupantIndex, 10);
|
||||
var _a, _b;
|
||||
const lotOccupantIndex = Number.parseInt((_b = (_a = clickEvent.currentTarget.closest('tr')) === null || _a === void 0 ? void 0 : _a.dataset.lotOccupantIndex) !== null && _b !== void 0 ? _b : '', 10);
|
||||
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
||||
return currentLotOccupancyOccupant.lotOccupantIndex === lotOccupantIndex;
|
||||
});
|
||||
|
|
@ -14,7 +15,7 @@ function openEditLotOccupancyOccupant(clickEvent) {
|
|||
let editCloseModalFunction;
|
||||
function editOccupant(submitEvent) {
|
||||
submitEvent.preventDefault();
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant', editFormElement, (rawResponseJSON) => {
|
||||
cityssm.postJSON(`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`, editFormElement, (rawResponseJSON) => {
|
||||
var _a;
|
||||
const responseJSON = rawResponseJSON;
|
||||
if (responseJSON.success) {
|
||||
|
|
@ -24,7 +25,7 @@ function openEditLotOccupancyOccupant(clickEvent) {
|
|||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
title: 'Error Updating ' + los.escapedAliases.Occupant,
|
||||
title: `Error Updating ${los.escapedAliases.Occupant}`,
|
||||
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
|
||||
contextualColorName: 'danger'
|
||||
});
|
||||
|
|
@ -65,7 +66,8 @@ function openEditLotOccupancyOccupant(clickEvent) {
|
|||
optionElement.selected = true;
|
||||
lotOccupantTypeSelectElement.append(optionElement);
|
||||
}
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = `<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
|
||||
`<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantName').value = lotOccupancyOccupant.occupantName;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantFamilyName').value = lotOccupancyOccupant.occupantFamilyName;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--occupantAddress1').value = lotOccupancyOccupant.occupantAddress1;
|
||||
|
|
@ -89,7 +91,8 @@ function openEditLotOccupancyOccupant(clickEvent) {
|
|||
var _a, _b;
|
||||
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML = `<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
modalElement.querySelector('#lotOccupancyOccupantEdit--fontAwesomeIconClass').innerHTML =
|
||||
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
.occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
|
||||
if (occupantCommentTitle === '') {
|
||||
|
|
@ -165,9 +168,12 @@ function renderLotOccupancyOccupants() {
|
|||
lotOccupancyOccupant.lotOccupantIndex.toString();
|
||||
tableRowElement.innerHTML =
|
||||
'<td>' +
|
||||
cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' && ((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === ''
|
||||
cityssm.escapeHTML(((_a = lotOccupancyOccupant.occupantName) !== null && _a !== void 0 ? _a : '') === '' &&
|
||||
((_b = lotOccupancyOccupant.occupantFamilyName) !== null && _b !== void 0 ? _b : '') === ''
|
||||
? '(No Name)'
|
||||
: lotOccupancyOccupant.occupantName + ' ' + lotOccupancyOccupant.occupantFamilyName) +
|
||||
: lotOccupancyOccupant.occupantName +
|
||||
' ' +
|
||||
lotOccupancyOccupant.occupantFamilyName) +
|
||||
'<br />' +
|
||||
('<span class="tag">' +
|
||||
'<i class="fas fa-fw fa-' +
|
||||
|
|
@ -390,7 +396,8 @@ else {
|
|||
var _a, _b;
|
||||
const fontAwesomeIconClass = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
.fontAwesomeIconClass) !== null && _a !== void 0 ? _a : 'user';
|
||||
modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML = `<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
modalElement.querySelector('#lotOccupancyOccupantAdd--fontAwesomeIconClass').innerHTML =
|
||||
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||
let occupantCommentTitle = (_b = lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
.occupantCommentTitle) !== null && _b !== void 0 ? _b : '';
|
||||
if (occupantCommentTitle === '') {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
|
||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable unicorn/prefer-module */
|
||||
|
||||
import type * as globalTypes from '../../types/globalTypes'
|
||||
import type * as recordTypes from '../../types/recordTypes'
|
||||
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
|
||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||
|
||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
|
||||
|
||||
import type { BulmaJS } from '@cityssm/bulma-js/types'
|
||||
import type * as globalTypes from '../../types/globalTypes.js'
|
||||
import type * as recordTypes from '../../types/recordTypes.js'
|
||||
|
||||
declare const cityssm: cityssmGlobal
|
||||
declare const bulmaJS: BulmaJS
|
||||
|
|
@ -16,14 +16,17 @@ declare const lotOccupancyId: string
|
|||
declare const isCreate: boolean
|
||||
declare const formElement: HTMLFormElement
|
||||
|
||||
let lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] =
|
||||
exports.lotOccupancyOccupants
|
||||
declare const exports: Record<string, unknown>
|
||||
|
||||
let lotOccupancyOccupants =
|
||||
exports.lotOccupancyOccupants as recordTypes.LotOccupancyOccupant[]
|
||||
|
||||
delete exports.lotOccupancyOccupants
|
||||
|
||||
function openEditLotOccupancyOccupant(clickEvent: Event): void {
|
||||
const lotOccupantIndex = Number.parseInt(
|
||||
(clickEvent.currentTarget as HTMLElement).closest('tr')!.dataset
|
||||
.lotOccupantIndex!,
|
||||
(clickEvent.currentTarget as HTMLElement).closest('tr')?.dataset
|
||||
.lotOccupantIndex ?? '',
|
||||
10
|
||||
)
|
||||
|
||||
|
|
@ -40,22 +43,22 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
|
|||
submitEvent.preventDefault()
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyOccupant',
|
||||
`${los.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`,
|
||||
editFormElement,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
errorMessage?: string
|
||||
lotOccupancyOccupants?: recordTypes.LotOccupancyOccupant[]
|
||||
lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[]
|
||||
}
|
||||
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyOccupants = responseJSON.lotOccupancyOccupants!
|
||||
lotOccupancyOccupants = responseJSON.lotOccupancyOccupants
|
||||
editCloseModalFunction()
|
||||
renderLotOccupancyOccupants()
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
title: 'Error Updating ' + los.escapedAliases.Occupant,
|
||||
title: `Error Updating ${los.escapedAliases.Occupant}`,
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
})
|
||||
|
|
@ -125,7 +128,8 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
|
|||
|
||||
modalElement.querySelector(
|
||||
'#lotOccupancyOccupantEdit--fontAwesomeIconClass'
|
||||
)!.innerHTML = `<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass!}" aria-hidden="true"></i>`
|
||||
)!.innerHTML =
|
||||
`<i class="fas fa-fw fa-${lotOccupancyOccupant.fontAwesomeIconClass!}" aria-hidden="true"></i>`
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#lotOccupancyOccupantEdit--occupantName'
|
||||
|
|
@ -201,7 +205,8 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void {
|
|||
|
||||
modalElement.querySelector(
|
||||
'#lotOccupancyOccupantEdit--fontAwesomeIconClass'
|
||||
)!.innerHTML = `<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`
|
||||
)!.innerHTML =
|
||||
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`
|
||||
|
||||
let occupantCommentTitle =
|
||||
lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
|
|
@ -307,9 +312,12 @@ function renderLotOccupancyOccupants(): void {
|
|||
tableRowElement.innerHTML =
|
||||
'<td>' +
|
||||
cityssm.escapeHTML(
|
||||
(lotOccupancyOccupant.occupantName ?? '') === '' && (lotOccupancyOccupant.occupantFamilyName ?? '') === ''
|
||||
(lotOccupancyOccupant.occupantName ?? '') === '' &&
|
||||
(lotOccupancyOccupant.occupantFamilyName ?? '') === ''
|
||||
? '(No Name)'
|
||||
: lotOccupancyOccupant.occupantName! + ' ' + lotOccupancyOccupant.occupantFamilyName!
|
||||
: lotOccupancyOccupant.occupantName! +
|
||||
' ' +
|
||||
lotOccupancyOccupant.occupantFamilyName!
|
||||
) +
|
||||
'<br />' +
|
||||
('<span class="tag">' +
|
||||
|
|
@ -630,7 +638,8 @@ document
|
|||
|
||||
modalElement.querySelector(
|
||||
'#lotOccupancyOccupantAdd--fontAwesomeIconClass'
|
||||
)!.innerHTML = `<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`
|
||||
)!.innerHTML =
|
||||
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`
|
||||
|
||||
let occupantCommentTitle =
|
||||
lotOccupantTypeIdElement.selectedOptions[0].dataset
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES6",
|
||||
"target": "ES2017",
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "Node",
|
||||
"isolatedModules": false,
|
||||
"declaration": true,
|
||||
"noImplicitAny": false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue