include lotOccupancyId in result tables

deepsource-autofix-76c6eb20
Dan Gowans 2023-02-27 14:00:16 -05:00
parent 95fd36be87
commit 37984ed2f3
10 changed files with 690 additions and 643 deletions

View File

@ -7,8 +7,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
const searchResultsContainerElement = document.querySelector('#container--searchResults'); const searchResultsContainerElement = document.querySelector('#container--searchResults');
const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10); const limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10);
const offsetElement = document.querySelector('#searchFilter--offset'); const offsetElement = document.querySelector('#searchFilter--offset');
function renderLotOccupancies(responseJSON) { function renderLotOccupancies(rawResponseJSON) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
const responseJSON = rawResponseJSON;
if (responseJSON.lotOccupancies.length === 0) { if (responseJSON.lotOccupancies.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info"> searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body"> <p class="message-body">
@ -80,7 +81,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) + los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) +
'">' + '">' +
cityssm.escapeHTML(lotOccupancy.occupancyType) + cityssm.escapeHTML(lotOccupancy.occupancyType) +
'</a>' + '</a><br />' +
`<span class="is-size-7">#${lotOccupancy.lotOccupancyId}</span>` +
'</td>') + '</td>') +
('<td>' + ('<td>' +
(((_j = lotOccupancy.lotId) !== null && _j !== void 0 ? _j : -1) === -1 (((_j = lotOccupancy.lotId) !== null && _j !== void 0 ? _j : -1) === -1
@ -114,7 +116,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
'/print/' + '/print/' +
lotOccupancy.printEJS + lotOccupancy.printEJS +
'/?lotOccupancyId=' + '/?lotOccupancyId=' +
lotOccupancy.lotOccupancyId + lotOccupancy.lotOccupancyId.toString() +
'" target="_blank">' + '" target="_blank">' +
'<i class="fas fa-print" aria-label="Print"></i>' + '<i class="fas fa-print" aria-label="Print"></i>' +
'</a>' '</a>'

View File

@ -26,11 +26,13 @@ declare const cityssm: cityssmGlobal
'#searchFilter--offset' '#searchFilter--offset'
) as HTMLInputElement ) as HTMLInputElement
function renderLotOccupancies(responseJSON: { function renderLotOccupancies(rawResponseJSON: unknown): void {
const responseJSON = rawResponseJSON as {
count: number count: number
offset: number offset: number
lotOccupancies: recordTypes.LotOccupancy[] lotOccupancies: recordTypes.LotOccupancy[]
}): void { }
if (responseJSON.lotOccupancies.length === 0) { if (responseJSON.lotOccupancies.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info"> searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body"> <p class="message-body">
@ -128,7 +130,8 @@ declare const cityssm: cityssmGlobal
los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) + los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) +
'">' + '">' +
cityssm.escapeHTML(lotOccupancy.occupancyType as string) + cityssm.escapeHTML(lotOccupancy.occupancyType as string) +
'</a>' + '</a><br />' +
`<span class="is-size-7">#${lotOccupancy.lotOccupancyId!}</span>` +
'</td>') + '</td>') +
('<td>' + ('<td>' +
((lotOccupancy.lotId ?? -1) === -1 ((lotOccupancy.lotId ?? -1) === -1
@ -162,7 +165,7 @@ declare const cityssm: cityssmGlobal
'/print/' + '/print/' +
lotOccupancy.printEJS + lotOccupancy.printEJS +
'/?lotOccupancyId=' + '/?lotOccupancyId=' +
lotOccupancy.lotOccupancyId + lotOccupancy.lotOccupancyId!.toString() +
'" target="_blank">' + '" target="_blank">' +
'<i class="fas fa-print" aria-label="Print"></i>' + '<i class="fas fa-print" aria-label="Print"></i>' +
'</a>' '</a>'

View File

@ -150,8 +150,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLotOccupancy', { cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLotOccupancy', {
workOrderId, workOrderId,
lotOccupancyId lotOccupancyId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLotOccupancies = responseJSON.workOrderLotOccupancies; workOrderLotOccupancies = responseJSON.workOrderLotOccupancies;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -179,8 +180,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLot', { cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLot', {
workOrderId, workOrderId,
lotId lotId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots; workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -192,7 +194,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
contextualColorName: 'danger' contextualColorName: 'danger'
}); });
} }
if (callbackFunction) { if (callbackFunction !== undefined) {
callbackFunction(responseJSON.success); callbackFunction(responseJSON.success);
} }
}); });
@ -201,8 +203,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLotOccupancy', { cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLotOccupancy', {
workOrderId, workOrderId,
lotOccupancyId lotOccupancyId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLotOccupancies = responseJSON.workOrderLotOccupancies; workOrderLotOccupancies = responseJSON.workOrderLotOccupancies;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -214,7 +217,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
contextualColorName: 'danger' contextualColorName: 'danger'
}); });
} }
if (callbackFunction) { if (callbackFunction !== undefined) {
callbackFunction(responseJSON.success); callbackFunction(responseJSON.success);
} }
}); });
@ -271,7 +274,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) + los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) +
'">' + '">' +
cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') + cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') +
'</a>' + '</a><br />' +
`<span class="is-size-7">#${lotOccupancy.lotOccupancyId}</span>` +
'</td>'); '</td>');
if (lotOccupancy.lotId) { if (lotOccupancy.lotId) {
rowElement.insertAdjacentHTML('beforeend', '<td>' + rowElement.insertAdjacentHTML('beforeend', '<td>' +
@ -280,7 +284,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
? '' ? ''
: ' <button class="button is-small is-light is-success button--addLot"' + : ' <button class="button is-small is-light is-success button--addLot"' +
' data-lot-id="' + ' data-lot-id="' +
lotOccupancy.lotId + lotOccupancy.lotId.toString() +
'"' + '"' +
' data-tooltip="Add ' + ' data-tooltip="Add ' +
los.escapedAliases.Lot + los.escapedAliases.Lot +
@ -348,8 +352,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
let editCloseModalFunction; let editCloseModalFunction;
function doUpdateLotStatus(submitEvent) { function doUpdateLotStatus(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateLotStatus', submitEvent.currentTarget, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots; workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -411,8 +416,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLot', { cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLot', {
workOrderId, workOrderId,
lotId lotId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots; workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -468,21 +474,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') +
'</a>' + '</a>' +
'</td>' + '</td>' +
('<td>' + cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '') + '</td>') + `<td>${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')}</td>` +
('<td>' + cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '') + '</td>') + `<td>${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')}</td>` +
('<td>' + ('<td>' +
(lot.lotStatusId (lot.lotStatusId
? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '') ? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '')
: '<span class="has-text-grey">(No Status)</span>') + : '<span class="has-text-grey">(No Status)</span>') +
'</td>') + '</td>') +
('<td class="is-nowrap">' + `<td class="is-nowrap">
'<button class="button is-small is-light is-info button--editLotStatus" data-tooltip="Update Status" type="button">' + <button class="button is-small is-light is-info button--editLotStatus" data-tooltip="Update Status" type="button">
'<i class="fas fa-pencil-alt" aria-hidden="true"></i>' + <i class="fas fa-pencil-alt" aria-hidden="true"></i>
'</button>' + </button>
' <button class="button is-small is-light is-danger button--deleteLot" data-tooltip="Delete Relationship" type="button">' + <button class="button is-small is-light is-danger button--deleteLot" data-tooltip="Delete Relationship" type="button">
'<i class="fas fa-trash" aria-hidden="true"></i>' + <i class="fas fa-trash" aria-hidden="true"></i>
'</button>' + </button>
'</td>'); </td>`;
rowElement rowElement
.querySelector('.button--editLotStatus') .querySelector('.button--editLotStatus')
.addEventListener('click', openEditLotStatus); .addEventListener('click', openEditLotStatus);
@ -516,8 +522,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
searchResultsContainerElement.innerHTML = searchResultsContainerElement.innerHTML =
los.getLoadingParagraphHTML('Searching...'); los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFormElement, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFormElement, (rawResponseJSON) => {
var _a, _b; var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.lotOccupancies.length === 0) { if (responseJSON.lotOccupancies.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info"> searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no records that meet the search criteria.</p> <p class="message-body">There are no records that meet the search criteria.</p>
@ -540,15 +547,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
rowElement.className = 'container--lotOccupancy'; rowElement.className = 'container--lotOccupancy';
rowElement.dataset.lotOccupancyId = rowElement.dataset.lotOccupancyId =
lotOccupancy.lotOccupancyId.toString(); lotOccupancy.lotOccupancyId.toString();
rowElement.innerHTML = rowElement.innerHTML = `<td class="has-text-centered">
'<td class="has-text-centered">' + <button class="button is-small is-success button--addLotOccupancy" data-tooltip="Add" type="button" aria-label="Add">
'<button class="button is-small is-success button--addLotOccupancy" data-tooltip="Add" type="button" aria-label="Add">' + <i class="fas fa-plus" aria-hidden="true"></i>
'<i class="fas fa-plus" aria-hidden="true"></i>' + </button>
'</button>' + </td>
'</td>' + <td class="has-text-weight-bold">
('<td class="has-text-weight-bold">' + ${cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '')}
cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') + </td>`;
'</td>');
if (lotOccupancy.lotId) { if (lotOccupancy.lotId) {
rowElement.insertAdjacentHTML('beforeend', '<td>' + rowElement.insertAdjacentHTML('beforeend', '<td>' +
cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '') + cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '') +
@ -625,8 +631,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
searchResultsContainerElement.innerHTML = searchResultsContainerElement.innerHTML =
los.getLoadingParagraphHTML('Searching...'); los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFormElement, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFormElement, (rawResponseJSON) => {
var _a, _b, _c, _d; var _a, _b, _c, _d;
const responseJSON = rawResponseJSON;
if (responseJSON.lots.length === 0) { if (responseJSON.lots.length === 0) {
searchResultsContainerElement.innerHTML = searchResultsContainerElement.innerHTML =
'<div class="message is-info">' + '<div class="message is-info">' +

View File

@ -13,8 +13,9 @@ function deleteLotOccupancy(clickEvent) {
cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLotOccupancy', { cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLotOccupancy', {
workOrderId, workOrderId,
lotOccupancyId lotOccupancyId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLotOccupancies = responseJSON.workOrderLotOccupancies; workOrderLotOccupancies = responseJSON.workOrderLotOccupancies;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -42,8 +43,9 @@ function addLot(lotId, callbackFunction) {
cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLot', { cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLot', {
workOrderId, workOrderId,
lotId lotId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots; workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -55,7 +57,7 @@ function addLot(lotId, callbackFunction) {
contextualColorName: 'danger' contextualColorName: 'danger'
}); });
} }
if (callbackFunction) { if (callbackFunction !== undefined) {
callbackFunction(responseJSON.success); callbackFunction(responseJSON.success);
} }
}); });
@ -64,8 +66,9 @@ function addLotOccupancy(lotOccupancyId, callbackFunction) {
cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLotOccupancy', { cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLotOccupancy', {
workOrderId, workOrderId,
lotOccupancyId lotOccupancyId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLotOccupancies = responseJSON.workOrderLotOccupancies; workOrderLotOccupancies = responseJSON.workOrderLotOccupancies;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -77,7 +80,7 @@ function addLotOccupancy(lotOccupancyId, callbackFunction) {
contextualColorName: 'danger' contextualColorName: 'danger'
}); });
} }
if (callbackFunction) { if (callbackFunction !== undefined) {
callbackFunction(responseJSON.success); callbackFunction(responseJSON.success);
} }
}); });
@ -134,7 +137,8 @@ function renderRelatedOccupancies() {
los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) + los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) +
'">' + '">' +
cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') + cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') +
'</a>' + '</a><br />' +
`<span class="is-size-7">#${lotOccupancy.lotOccupancyId}</span>` +
'</td>'); '</td>');
if (lotOccupancy.lotId) { if (lotOccupancy.lotId) {
rowElement.insertAdjacentHTML('beforeend', '<td>' + rowElement.insertAdjacentHTML('beforeend', '<td>' +
@ -143,7 +147,7 @@ function renderRelatedOccupancies() {
? '' ? ''
: ' <button class="button is-small is-light is-success button--addLot"' + : ' <button class="button is-small is-light is-success button--addLot"' +
' data-lot-id="' + ' data-lot-id="' +
lotOccupancy.lotId + lotOccupancy.lotId.toString() +
'"' + '"' +
' data-tooltip="Add ' + ' data-tooltip="Add ' +
los.escapedAliases.Lot + los.escapedAliases.Lot +
@ -211,8 +215,9 @@ function openEditLotStatus(clickEvent) {
let editCloseModalFunction; let editCloseModalFunction;
function doUpdateLotStatus(submitEvent) { function doUpdateLotStatus(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateLotStatus', submitEvent.currentTarget, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots; workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -274,8 +279,9 @@ function deleteLot(clickEvent) {
cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLot', { cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLot', {
workOrderId, workOrderId,
lotId lotId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots; workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies(); renderRelatedLotsAndOccupancies();
@ -331,21 +337,21 @@ function renderRelatedLots() {
cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') + cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') +
'</a>' + '</a>' +
'</td>' + '</td>' +
('<td>' + cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '') + '</td>') + `<td>${cityssm.escapeHTML((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')}</td>` +
('<td>' + cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '') + '</td>') + `<td>${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')}</td>` +
('<td>' + ('<td>' +
(lot.lotStatusId (lot.lotStatusId
? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '') ? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '')
: '<span class="has-text-grey">(No Status)</span>') + : '<span class="has-text-grey">(No Status)</span>') +
'</td>') + '</td>') +
('<td class="is-nowrap">' + `<td class="is-nowrap">
'<button class="button is-small is-light is-info button--editLotStatus" data-tooltip="Update Status" type="button">' + <button class="button is-small is-light is-info button--editLotStatus" data-tooltip="Update Status" type="button">
'<i class="fas fa-pencil-alt" aria-hidden="true"></i>' + <i class="fas fa-pencil-alt" aria-hidden="true"></i>
'</button>' + </button>
' <button class="button is-small is-light is-danger button--deleteLot" data-tooltip="Delete Relationship" type="button">' + <button class="button is-small is-light is-danger button--deleteLot" data-tooltip="Delete Relationship" type="button">
'<i class="fas fa-trash" aria-hidden="true"></i>' + <i class="fas fa-trash" aria-hidden="true"></i>
'</button>' + </button>
'</td>'); </td>`;
rowElement rowElement
.querySelector('.button--editLotStatus') .querySelector('.button--editLotStatus')
.addEventListener('click', openEditLotStatus); .addEventListener('click', openEditLotStatus);
@ -379,8 +385,9 @@ function doAddLotOccupancy(clickEvent) {
} }
searchResultsContainerElement.innerHTML = searchResultsContainerElement.innerHTML =
los.getLoadingParagraphHTML('Searching...'); los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFormElement, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFormElement, (rawResponseJSON) => {
var _a, _b; var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.lotOccupancies.length === 0) { if (responseJSON.lotOccupancies.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info"> searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no records that meet the search criteria.</p> <p class="message-body">There are no records that meet the search criteria.</p>
@ -403,15 +410,14 @@ function doAddLotOccupancy(clickEvent) {
rowElement.className = 'container--lotOccupancy'; rowElement.className = 'container--lotOccupancy';
rowElement.dataset.lotOccupancyId = rowElement.dataset.lotOccupancyId =
lotOccupancy.lotOccupancyId.toString(); lotOccupancy.lotOccupancyId.toString();
rowElement.innerHTML = rowElement.innerHTML = `<td class="has-text-centered">
'<td class="has-text-centered">' + <button class="button is-small is-success button--addLotOccupancy" data-tooltip="Add" type="button" aria-label="Add">
'<button class="button is-small is-success button--addLotOccupancy" data-tooltip="Add" type="button" aria-label="Add">' + <i class="fas fa-plus" aria-hidden="true"></i>
'<i class="fas fa-plus" aria-hidden="true"></i>' + </button>
'</button>' + </td>
'</td>' + <td class="has-text-weight-bold">
('<td class="has-text-weight-bold">' + ${cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '')}
cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') + </td>`;
'</td>');
if (lotOccupancy.lotId) { if (lotOccupancy.lotId) {
rowElement.insertAdjacentHTML('beforeend', '<td>' + rowElement.insertAdjacentHTML('beforeend', '<td>' +
cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '') + cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '') +
@ -488,8 +494,9 @@ function doAddLot(clickEvent) {
} }
searchResultsContainerElement.innerHTML = searchResultsContainerElement.innerHTML =
los.getLoadingParagraphHTML('Searching...'); los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFormElement, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFormElement, (rawResponseJSON) => {
var _a, _b, _c, _d; var _a, _b, _c, _d;
const responseJSON = rawResponseJSON;
if (responseJSON.lots.length === 0) { if (responseJSON.lots.length === 0) {
searchResultsContainerElement.innerHTML = searchResultsContainerElement.innerHTML =
'<div class="message is-info">' + '<div class="message is-info">' +

View File

@ -35,11 +35,13 @@ function deleteLotOccupancy(clickEvent: Event): void {
workOrderId, workOrderId,
lotOccupancyId lotOccupancyId
}, },
(responseJSON: { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean success: boolean
errorMessage?: string errorMessage?: string
workOrderLotOccupancies?: recordTypes.LotOccupancy[] workOrderLotOccupancies?: recordTypes.LotOccupancy[]
}) => { }
if (responseJSON.success) { if (responseJSON.success) {
workOrderLotOccupancies = responseJSON.workOrderLotOccupancies! workOrderLotOccupancies = responseJSON.workOrderLotOccupancies!
renderRelatedLotsAndOccupancies() renderRelatedLotsAndOccupancies()
@ -67,7 +69,7 @@ function deleteLotOccupancy(clickEvent: Event): void {
function addLot( function addLot(
lotId: number | string, lotId: number | string,
callbackFunction?: (success?: boolean) => void callbackFunction?: (success: boolean) => void
): void { ): void {
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/workOrders/doAddWorkOrderLot', los.urlPrefix + '/workOrders/doAddWorkOrderLot',
@ -75,11 +77,13 @@ function addLot(
workOrderId, workOrderId,
lotId lotId
}, },
(responseJSON: { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean success: boolean
errorMessage?: string errorMessage?: string
workOrderLots?: recordTypes.Lot[] workOrderLots?: recordTypes.Lot[]
}) => { }
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots! workOrderLots = responseJSON.workOrderLots!
renderRelatedLotsAndOccupancies() renderRelatedLotsAndOccupancies()
@ -91,7 +95,7 @@ function addLot(
}) })
} }
if (callbackFunction) { if (callbackFunction !== undefined) {
callbackFunction(responseJSON.success) callbackFunction(responseJSON.success)
} }
} }
@ -108,11 +112,13 @@ function addLotOccupancy(
workOrderId, workOrderId,
lotOccupancyId lotOccupancyId
}, },
(responseJSON: { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean success: boolean
errorMessage?: string errorMessage?: string
workOrderLotOccupancies?: recordTypes.LotOccupancy[] workOrderLotOccupancies?: recordTypes.LotOccupancy[]
}) => { }
if (responseJSON.success) { if (responseJSON.success) {
workOrderLotOccupancies = responseJSON.workOrderLotOccupancies! workOrderLotOccupancies = responseJSON.workOrderLotOccupancies!
renderRelatedLotsAndOccupancies() renderRelatedLotsAndOccupancies()
@ -124,7 +130,7 @@ function addLotOccupancy(
}) })
} }
if (callbackFunction) { if (callbackFunction !== undefined) {
callbackFunction(responseJSON.success) callbackFunction(responseJSON.success)
} }
} }
@ -201,7 +207,8 @@ function renderRelatedOccupancies(): void {
los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) + los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) +
'">' + '">' +
cityssm.escapeHTML(lotOccupancy.occupancyType ?? '') + cityssm.escapeHTML(lotOccupancy.occupancyType ?? '') +
'</a>' + '</a><br />' +
`<span class="is-size-7">#${lotOccupancy.lotOccupancyId!}</span>` +
'</td>') '</td>')
if (lotOccupancy.lotId) { if (lotOccupancy.lotId) {
@ -213,7 +220,7 @@ function renderRelatedOccupancies(): void {
? '' ? ''
: ' <button class="button is-small is-light is-success button--addLot"' + : ' <button class="button is-small is-light is-success button--addLot"' +
' data-lot-id="' + ' data-lot-id="' +
lotOccupancy.lotId + lotOccupancy.lotId.toString() +
'"' + '"' +
' data-tooltip="Add ' + ' data-tooltip="Add ' +
los.escapedAliases.Lot + los.escapedAliases.Lot +
@ -310,11 +317,13 @@ function openEditLotStatus(clickEvent: Event): void {
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/workOrders/doUpdateLotStatus', los.urlPrefix + '/workOrders/doUpdateLotStatus',
submitEvent.currentTarget, submitEvent.currentTarget,
(responseJSON: { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean success: boolean
errorMessage?: string errorMessage?: string
workOrderLots?: recordTypes.Lot[] workOrderLots?: recordTypes.Lot[]
}) => { }
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots! workOrderLots = responseJSON.workOrderLots!
renderRelatedLotsAndOccupancies() renderRelatedLotsAndOccupancies()
@ -407,11 +416,13 @@ function deleteLot(clickEvent: Event): void {
workOrderId, workOrderId,
lotId lotId
}, },
(responseJSON: { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean success: boolean
errorMessage?: string errorMessage?: string
workOrderLots?: recordTypes.Lot[] workOrderLots?: recordTypes.Lot[]
}) => { }
if (responseJSON.success) { if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots! workOrderLots = responseJSON.workOrderLots!
renderRelatedLotsAndOccupancies() renderRelatedLotsAndOccupancies()
@ -481,21 +492,21 @@ function renderRelatedLots(): void {
cityssm.escapeHTML(lot.lotName ?? '') + cityssm.escapeHTML(lot.lotName ?? '') +
'</a>' + '</a>' +
'</td>' + '</td>' +
('<td>' + cityssm.escapeHTML(lot.mapName ?? '') + '</td>') + `<td>${cityssm.escapeHTML(lot.mapName ?? '')}</td>` +
('<td>' + cityssm.escapeHTML(lot.lotType ?? '') + '</td>') + `<td>${cityssm.escapeHTML(lot.lotType ?? '')}</td>` +
('<td>' + ('<td>' +
(lot.lotStatusId (lot.lotStatusId
? cityssm.escapeHTML(lot.lotStatus ?? '') ? cityssm.escapeHTML(lot.lotStatus ?? '')
: '<span class="has-text-grey">(No Status)</span>') + : '<span class="has-text-grey">(No Status)</span>') +
'</td>') + '</td>') +
('<td class="is-nowrap">' + `<td class="is-nowrap">
'<button class="button is-small is-light is-info button--editLotStatus" data-tooltip="Update Status" type="button">' + <button class="button is-small is-light is-info button--editLotStatus" data-tooltip="Update Status" type="button">
'<i class="fas fa-pencil-alt" aria-hidden="true"></i>' + <i class="fas fa-pencil-alt" aria-hidden="true"></i>
'</button>' + </button>
' <button class="button is-small is-light is-danger button--deleteLot" data-tooltip="Delete Relationship" type="button">' + <button class="button is-small is-light is-danger button--deleteLot" data-tooltip="Delete Relationship" type="button">
'<i class="fas fa-trash" aria-hidden="true"></i>' + <i class="fas fa-trash" aria-hidden="true"></i>
'</button>' + </button>
'</td>') </td>`
rowElement rowElement
.querySelector('.button--editLotStatus')! .querySelector('.button--editLotStatus')!
@ -545,7 +556,11 @@ document
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies',
searchFormElement, searchFormElement,
(responseJSON: { lotOccupancies: recordTypes.LotOccupancy[] }) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
lotOccupancies: recordTypes.LotOccupancy[]
}
if (responseJSON.lotOccupancies.length === 0) { if (responseJSON.lotOccupancies.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info"> searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no records that meet the search criteria.</p> <p class="message-body">There are no records that meet the search criteria.</p>
@ -572,15 +587,14 @@ document
rowElement.dataset.lotOccupancyId = rowElement.dataset.lotOccupancyId =
lotOccupancy.lotOccupancyId!.toString() lotOccupancy.lotOccupancyId!.toString()
rowElement.innerHTML = rowElement.innerHTML = `<td class="has-text-centered">
'<td class="has-text-centered">' + <button class="button is-small is-success button--addLotOccupancy" data-tooltip="Add" type="button" aria-label="Add">
'<button class="button is-small is-success button--addLotOccupancy" data-tooltip="Add" type="button" aria-label="Add">' + <i class="fas fa-plus" aria-hidden="true"></i>
'<i class="fas fa-plus" aria-hidden="true"></i>' + </button>
'</button>' + </td>
'</td>' + <td class="has-text-weight-bold">
('<td class="has-text-weight-bold">' + ${cityssm.escapeHTML(lotOccupancy.occupancyType ?? '')}
cityssm.escapeHTML(lotOccupancy.occupancyType ?? '') + </td>`
'</td>')
if (lotOccupancy.lotId) { if (lotOccupancy.lotId) {
rowElement.insertAdjacentHTML( rowElement.insertAdjacentHTML(
@ -715,7 +729,9 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => {
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lots/doSearchLots', los.urlPrefix + '/lots/doSearchLots',
searchFormElement, searchFormElement,
(responseJSON: { lots: recordTypes.Lot[] }) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as { lots: recordTypes.Lot[] }
if (responseJSON.lots.length === 0) { if (responseJSON.lots.length === 0) {
searchResultsContainerElement.innerHTML = searchResultsContainerElement.innerHTML =
'<div class="message is-info">' + '<div class="message is-info">' +

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -338,8 +338,6 @@
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<% if (isCreate) { %> <% if (isCreate) { %>
@ -396,7 +394,10 @@
<div class="panel-block is-block"> <div class="panel-block is-block">
<% if (lot.lotOccupancies.length === 0) { %> <% if (lot.lotOccupancies.length === 0) { %>
<div class="message is-info"> <div class="message is-info">
<p class="message-body">There are no <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> records asscociated with this <%= configFunctions.getProperty("aliases.lot") %>.</p> <p class="message-body">
There are no <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> records
asscociated with this <%= configFunctions.getProperty("aliases.lot") %>.
</p>
</div> </div>
<% } else { %> <% } else { %>
<table class="table is-fullwidth is-striped is-hoverable"> <table class="table is-fullwidth is-striped is-hoverable">
@ -424,7 +425,10 @@
<td> <td>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>"> <a class="has-text-weight-bold" href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %> <%= lotOccupancy.occupancyType %>
</a> </a><br />
<span class="is-size-7">
#<%= lotOccupancy.lotOccupancyId %>
</span>
</td> </td>
<td><%= lotOccupancy.occupancyStartDateString %></td> <td><%= lotOccupancy.occupancyStartDateString %></td>
<td> <td>

View File

@ -151,8 +151,10 @@
<div class="panel-block is-block"> <div class="panel-block is-block">
<% if (lot.lotOccupancies.length === 0) { %> <% if (lot.lotOccupancies.length === 0) { %>
<div class="message is-info"> <div class="message is-info">
<p class="message-body">There are no occupancy records asscociated with this <p class="message-body">
<%= configFunctions.getProperty("aliases.lot") %>.</p> There are no occupancy records asscociated with this
<%= configFunctions.getProperty("aliases.lot") %>.
</p>
</div> </div>
<% } else { %> <% } else { %>
<table class="table is-fullwidth is-striped is-hoverable"> <table class="table is-fullwidth is-striped is-hoverable">
@ -181,7 +183,8 @@
<a class="has-text-weight-bold" <a class="has-text-weight-bold"
href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>"> href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %> <%= lotOccupancy.occupancyType %>
</a> </a><br />
<span class="is-size-7">#<%= lotOccupancy.lotOccupancyId %></span>
</td> </td>
<td><%= lotOccupancy.occupancyStartDateString %></td> <td><%= lotOccupancy.occupancyStartDateString %></td>
<td> <td>

View File

@ -113,7 +113,9 @@
<% if (workOrder.workOrderCloseDate) { %> <% if (workOrder.workOrderCloseDate) { %>
<%= workOrder.workOrderCloseDateString %> <%= workOrder.workOrderCloseDateString %>
<% } else { %> <% } else { %>
<span class="has-text-grey">(No <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>)</span> <span class="has-text-grey">
(No <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>)
</span>
<% } %> <% } %>
</p> </p>
</div> </div>
@ -182,7 +184,10 @@
<a class="has-text-weight-bold" <a class="has-text-weight-bold"
href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>"> href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %> <%= lotOccupancy.occupancyType %>
</a> </a><br />
<span class="is-size-7">
#<%= lotOccupancy.lotOccupancyId %>
</span>
</td> </td>
<td> <td>
<% if (lotOccupancy.lotId) { %> <% if (lotOccupancy.lotId) { %>