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 limit = Number.parseInt(document.querySelector('#searchFilter--limit').value, 10);
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;
const responseJSON = rawResponseJSON;
if (responseJSON.lotOccupancies.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">
@ -80,7 +81,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) +
'">' +
cityssm.escapeHTML(lotOccupancy.occupancyType) +
'</a>' +
'</a><br />' +
`<span class="is-size-7">#${lotOccupancy.lotOccupancyId}</span>` +
'</td>') +
('<td>' +
(((_j = lotOccupancy.lotId) !== null && _j !== void 0 ? _j : -1) === -1
@ -114,7 +116,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
'/print/' +
lotOccupancy.printEJS +
'/?lotOccupancyId=' +
lotOccupancy.lotOccupancyId +
lotOccupancy.lotOccupancyId.toString() +
'" target="_blank">' +
'<i class="fas fa-print" aria-label="Print"></i>' +
'</a>'

View File

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

View File

@ -150,8 +150,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLotOccupancy', {
workOrderId,
lotOccupancyId
}, (responseJSON) => {
}, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderLotOccupancies = responseJSON.workOrderLotOccupancies;
renderRelatedLotsAndOccupancies();
@ -179,8 +180,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLot', {
workOrderId,
lotId
}, (responseJSON) => {
}, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies();
@ -192,7 +194,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
contextualColorName: 'danger'
});
}
if (callbackFunction) {
if (callbackFunction !== undefined) {
callbackFunction(responseJSON.success);
}
});
@ -201,8 +203,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderLotOccupancy', {
workOrderId,
lotOccupancyId
}, (responseJSON) => {
}, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderLotOccupancies = responseJSON.workOrderLotOccupancies;
renderRelatedLotsAndOccupancies();
@ -214,7 +217,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
contextualColorName: 'danger'
});
}
if (callbackFunction) {
if (callbackFunction !== undefined) {
callbackFunction(responseJSON.success);
}
});
@ -271,7 +274,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
los.getLotOccupancyURL(lotOccupancy.lotOccupancyId) +
'">' +
cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') +
'</a>' +
'</a><br />' +
`<span class="is-size-7">#${lotOccupancy.lotOccupancyId}</span>` +
'</td>');
if (lotOccupancy.lotId) {
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"' +
' data-lot-id="' +
lotOccupancy.lotId +
lotOccupancy.lotId.toString() +
'"' +
' data-tooltip="Add ' +
los.escapedAliases.Lot +
@ -348,8 +352,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
let editCloseModalFunction;
function doUpdateLotStatus(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateLotStatus', submitEvent.currentTarget, (responseJSON) => {
cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies();
@ -411,8 +416,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/workOrders/doDeleteWorkOrderLot', {
workOrderId,
lotId
}, (responseJSON) => {
}, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderLots = responseJSON.workOrderLots;
renderRelatedLotsAndOccupancies();
@ -468,21 +474,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.escapeHTML((_a = lot.lotName) !== null && _a !== void 0 ? _a : '') +
'</a>' +
'</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((_b = lot.mapName) !== null && _b !== void 0 ? _b : '')}</td>` +
`<td>${cityssm.escapeHTML((_c = lot.lotType) !== null && _c !== void 0 ? _c : '')}</td>` +
('<td>' +
(lot.lotStatusId
? cityssm.escapeHTML((_d = lot.lotStatus) !== null && _d !== void 0 ? _d : '')
: '<span class="has-text-grey">(No Status)</span>') +
'</td>') +
('<td class="is-nowrap">' +
'<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>' +
'</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>' +
'</button>' +
'</td>');
`<td class="is-nowrap">
<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>
</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>
</button>
</td>`;
rowElement
.querySelector('.button--editLotStatus')
.addEventListener('click', openEditLotStatus);
@ -516,8 +522,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
searchResultsContainerElement.innerHTML =
los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFormElement, (responseJSON) => {
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doSearchLotOccupancies', searchFormElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.lotOccupancies.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info">
<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.dataset.lotOccupancyId =
lotOccupancy.lotOccupancyId.toString();
rowElement.innerHTML =
'<td class="has-text-centered">' +
'<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>' +
'</button>' +
'</td>' +
('<td class="has-text-weight-bold">' +
cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '') +
'</td>');
rowElement.innerHTML = `<td class="has-text-centered">
<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>
</button>
</td>
<td class="has-text-weight-bold">
${cityssm.escapeHTML((_a = lotOccupancy.occupancyType) !== null && _a !== void 0 ? _a : '')}
</td>`;
if (lotOccupancy.lotId) {
rowElement.insertAdjacentHTML('beforeend', '<td>' +
cityssm.escapeHTML((_b = lotOccupancy.lotName) !== null && _b !== void 0 ? _b : '') +
@ -625,8 +631,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
searchResultsContainerElement.innerHTML =
los.getLoadingParagraphHTML('Searching...');
cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFormElement, (responseJSON) => {
cityssm.postJSON(los.urlPrefix + '/lots/doSearchLots', searchFormElement, (rawResponseJSON) => {
var _a, _b, _c, _d;
const responseJSON = rawResponseJSON;
if (responseJSON.lots.length === 0) {
searchResultsContainerElement.innerHTML =
'<div class="message is-info">' +

View File

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

View File

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

@ -4,26 +4,26 @@
<ul>
<li><a href="<%= urlPrefix %>/dashboard">Home</a></li>
<li>
<a href="<%= urlPrefix %>/lots">
<span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span>
<span><%= configFunctions.getProperty("aliases.lots") %></span>
</a>
<a href="<%= urlPrefix %>/lots">
<span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span>
<span><%= configFunctions.getProperty("aliases.lots") %></span>
</a>
</li>
<% if (!isCreate) { %>
<li>
<a href="<%= urlPrefix %>/lots/<%= lot.lotId %>" accesskey="v">
<%= lot.lotName %>
</a>
</li>
<li>
<a href="<%= urlPrefix %>/lots/<%= lot.lotId %>" accesskey="v">
<%= lot.lotName %>
</a>
</li>
<% } %>
<li class="is-active">
<a href="#" aria-current="page">
<% if (isCreate) { %>
Create a New <%= configFunctions.getProperty("aliases.lot") %>
<% } else { %>
Update <%= configFunctions.getProperty("aliases.lot") %>
<% } %>
</a>
<a href="#" aria-current="page">
<% if (isCreate) { %>
Create a New <%= configFunctions.getProperty("aliases.lot") %>
<% } else { %>
Update <%= configFunctions.getProperty("aliases.lot") %>
<% } %>
</a>
</li>
</ul>
</nav>
@ -49,20 +49,20 @@
<div class="level-item">
<div class="dropdown is-right is-up">
<div class="dropdown-trigger">
<button class="button" type="button">
<span>More Options</span>
<span class="icon is-small">
<i class="fas fa-angle-up" aria-hidden="true"></i>
</span>
</button>
<button class="button" type="button">
<span>More Options</span>
<span class="icon is-small">
<i class="fas fa-angle-up" aria-hidden="true"></i>
</span>
</button>
</div>
<div class="dropdown-menu">
<div class="dropdown-content">
<a class="dropdown-item" id="button--deleteLot" href="#">
<span class="icon is-small"><i class="fas fa-trash has-text-danger" aria-hidden="true"></i></span>
<span>Delete <%= configFunctions.getProperty("aliases.lot") %></span>
</a>
</div>
<div class="dropdown-content">
<a class="dropdown-item" id="button--deleteLot" href="#">
<span class="icon is-small"><i class="fas fa-trash has-text-danger" aria-hidden="true"></i></span>
<span>Delete <%= configFunctions.getProperty("aliases.lot") %></span>
</a>
</div>
</div>
</div>
</div>
@ -71,8 +71,8 @@
<button class="button is-primary" type="submit" form="form--lot">
<span class="icon is-small"><i class="fas fa-save" aria-hidden="true"></i></span>
<span>
<%= (isCreate ? "Create" : "Update") %>
<%= configFunctions.getProperty("aliases.lot") %>
<%= (isCreate ? "Create" : "Update") %>
<%= configFunctions.getProperty("aliases.lot") %>
</span>
</button>
</div>
@ -81,265 +81,263 @@
</div>
<form id="form--lot">
<input id="lot--lotId" name="lotId" type="hidden" value="<%= isCreate ? "" : lot.lotId %>" />
<input id="lot--lotId" name="lotId" type="hidden" value="<%= isCreate ? "" : lot.lotId %>" />
<div class="panel">
<div class="panel-block is-block">
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="lot--lotName">
<%= configFunctions.getProperty("aliases.lot") %> Name
</label>
<div class="control">
<input class="input" id="lot--lotName" name="lotName" value="<%= lot.lotName %>"
<% if (configFunctions.getProperty("settings.lot.lotNamePattern")) { %>
pattern="<%= configFunctions.getProperty("settings.lot.lotNamePattern").source %>"
<% } %>
maxlength="100"
required
accesskey="f"
<%= (isCreate ? " autofocus" : "") %> />
</div>
<% if (configFunctions.getProperty("settings.lot.lotNameHelpText")) { %>
<p class="help">
<%- configFunctions.getProperty("settings.lot.lotNameHelpText").replace(/\n/g, "<br />") %>
</p>
<% } %>
<div class="panel">
<div class="panel-block is-block">
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="lot--lotName">
<%= configFunctions.getProperty("aliases.lot") %> Name
</label>
<div class="control">
<input class="input" id="lot--lotName" name="lotName" value="<%= lot.lotName %>"
<% if (configFunctions.getProperty("settings.lot.lotNamePattern")) { %>
pattern="<%= configFunctions.getProperty("settings.lot.lotNamePattern").source %>"
<% } %>
maxlength="100"
required
accesskey="f"
<%= (isCreate ? " autofocus" : "") %> />
</div>
<% if (configFunctions.getProperty("settings.lot.lotNameHelpText")) { %>
<p class="help">
<%- configFunctions.getProperty("settings.lot.lotNameHelpText").replace(/\n/g, "<br />") %>
</p>
<% } %>
</div>
</div>
<div class="column">
<label class="label" for="lot--lotTypeId">
<%= configFunctions.getProperty("aliases.lot") %> Type
</label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select
<% if (!isCreate) { %>
class="is-readonly"
<% } %>
id="lot--lotTypeId" name="lotTypeId" required>
<% if (isCreate) { %>
<option value="">(No Type)</option>
<% } %>
<% let typeIsFound = false; %>
<% for (const lotType of lotTypes) { %>
<%
if (lot.lotTypeId === lotType.lotTypeId) {
typeIsFound = true;
}
%>
<option value="<%= lotType.lotTypeId %>"
<%= (lot.lotTypeId === lotType.lotTypeId ? " selected" : "") %>
<%= (!isCreate && lot.lotTypeId !== lotType.lotTypeId ? " disabled" : "") %>>
<%= lotType.lotType %>
</option>
<% } %>
<% if (lot.lotTypeId && !typeIsFound) { %>
<option value="<%= lot.lotTypeId %>" selected>
<%= lot.lotType %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<label class="label" for="lot--lotStatusId">
<%= configFunctions.getProperty("aliases.lot") %> Status
</label>
<div class="field">
<div class="control">
<div class="select is-fullwidth">
<select id="lot--lotStatusId" name="lotStatusId">
<option value="">(No Status)</option>
<% let statusIsFound = false; %>
<% for (const lotStatus of lotStatuses) { %>
<%
if (lot.lotStatusId === lotStatus.lotStatusId) {
statusIsFound = true;
}
%>
<option value="<%= lotStatus.lotStatusId %>"
<%= (lot.lotStatusId === lotStatus.lotStatusId ? " selected" : "") %>>
<%= lotStatus.lotStatus %>
</option>
<% } %>
<% if (lot.lotStatusId && !statusIsFound) { %>
<option value="<%= lot.lotStatusId %>" selected>
<%= lot.lotStatus %>
</option>
<% } %>
</select>
</div>
</div>
</div>
</div>
<div class="column">
<div id="container--lotFields">
<% if (isCreate) { %>
<div class="message is-info">
<p class="message-body">
Select the <%= configFunctions.getProperty("aliases.lot").toLowerCase() %> type to load the available fields.
</p>
</div>
<% } else if (lot.lotFields.length === 0) { %>
<div class="message is-info">
<p class="message-body">
The current <%= configFunctions.getProperty("aliases.lot").toLowerCase() %> type has no additional fields.
</p>
</div>
<% } else { %>
<% let lotTypeFieldIds = ""; %>
<% for (const lotField of lot.lotFields) { %>
<% lotTypeFieldIds += "," + lotField.lotTypeFieldId; %>
<div class="field">
<label class="label" for="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>">
<%= lotField.lotTypeField %>
</label>
<div class="control">
<% if (!lotField.lotTypeFieldValues || lotField.lotTypeFieldValues === "") { %>
<input class="input"
id="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>"
name="lotFieldValue_<%= lotField.lotTypeFieldId %>"
type="text"
value="<%= lotField.lotFieldValue %>"
<% if (lotField.pattern !== "") { %>
pattern="<%= lotField.pattern %>"
<% } %>
minlength="<%= lotField.minimumLength %>"
maxlength="<%= lotField.maximumLength %>"
<%= lotField.isRequired ? " required" : "" %> />
<% } else { %>
<%
const fieldValues = lotField.lotTypeFieldValues.split("\n");
let valueFound = false;
%>
<div class="select is-fullwidth">
<select id="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>"
name="lotFieldValue_<%= lotField.lotTypeFieldId %>">
<% if (!lotField.isRequired || lotField.lotFieldValue === "") { %>
<option value="">(Not Set)</option>
<% } %>
<% for (const fieldValue of fieldValues) { %>
<%
if (fieldValue === lotField.lotFieldValue) {
valueFound = true;
}
%>
<option value="<%= fieldValue %>"
<%= (fieldValue === lotField.lotFieldValue ? " selected" : "") %>>
<%= fieldValue %>
</option>
<% } %>
<% if (!valueFound && lotField.lotFieldValue !== "") { %>
<option value="<%= lotField.lotFieldValue %>" selected>
<%= lotField.lotFieldValue %>
</option>
<% } %>
</select>
</div>
<% } %>
</div>
</div>
<% } %>
<input id="lot--lotTypeFieldIds" name="lotTypeFieldIds" type="hidden" value="<%= lotTypeFieldIds.slice(1) %>" />
<% } %>
</div>
</div>
</div>
</div>
</div>
<div class="columns">
<div class="column">
<div class="panel">
<h2 class="panel-heading">Geographic Location</h2>
<div class="panel-block is-block">
<div class="field">
<label class="label" for="lot--lotLatitude">Latitude</label>
<div class="control">
<input class="input" id="lot--lotLatitude" name="lotLatitude" type="number" min="-90" max="90" step="0.00000001" value="<%= lot.lotLatitude %>" onwheel="return false" />
</div>
</div>
<div class="column">
<label class="label" for="lot--lotTypeId">
<%= configFunctions.getProperty("aliases.lot") %> Type
</label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select
<% if (!isCreate) { %>
class="is-readonly"
<% } %>
id="lot--lotTypeId" name="lotTypeId" required>
<% if (isCreate) { %>
<option value="">(No Type)</option>
<% } %>
<% let typeIsFound = false; %>
<% for (const lotType of lotTypes) { %>
<%
if (lot.lotTypeId === lotType.lotTypeId) {
typeIsFound = true;
}
%>
<option value="<%= lotType.lotTypeId %>"
<%= (lot.lotTypeId === lotType.lotTypeId ? " selected" : "") %>
<%= (!isCreate && lot.lotTypeId !== lotType.lotTypeId ? " disabled" : "") %>>
<%= lotType.lotType %>
</option>
<% } %>
<% if (lot.lotTypeId && !typeIsFound) { %>
<option value="<%= lot.lotTypeId %>" selected>
<%= lot.lotType %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<label class="label" for="lot--lotStatusId">
<%= configFunctions.getProperty("aliases.lot") %> Status
</label>
<div class="field">
<div class="control">
<div class="select is-fullwidth">
<select id="lot--lotStatusId" name="lotStatusId">
<option value="">(No Status)</option>
<% let statusIsFound = false; %>
<% for (const lotStatus of lotStatuses) { %>
<%
if (lot.lotStatusId === lotStatus.lotStatusId) {
statusIsFound = true;
}
%>
<option value="<%= lotStatus.lotStatusId %>"
<%= (lot.lotStatusId === lotStatus.lotStatusId ? " selected" : "") %>>
<%= lotStatus.lotStatus %>
</option>
<% } %>
<% if (lot.lotStatusId && !statusIsFound) { %>
<option value="<%= lot.lotStatusId %>" selected>
<%= lot.lotStatus %>
</option>
<% } %>
</select>
</div>
</div>
</div>
</div>
<div class="column">
<div id="container--lotFields">
<% if (isCreate) { %>
<div class="message is-info">
<p class="message-body">
Select the <%= configFunctions.getProperty("aliases.lot").toLowerCase() %> type to load the available fields.
</p>
</div>
<% } else if (lot.lotFields.length === 0) { %>
<div class="message is-info">
<p class="message-body">
The current <%= configFunctions.getProperty("aliases.lot").toLowerCase() %> type has no additional fields.
</p>
</div>
<% } else { %>
<% let lotTypeFieldIds = ""; %>
<% for (const lotField of lot.lotFields) { %>
<% lotTypeFieldIds += "," + lotField.lotTypeFieldId; %>
<div class="field">
<label class="label" for="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>">
<%= lotField.lotTypeField %>
</label>
<div class="control">
<% if (!lotField.lotTypeFieldValues || lotField.lotTypeFieldValues === "") { %>
<input class="input"
id="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>"
name="lotFieldValue_<%= lotField.lotTypeFieldId %>"
type="text"
value="<%= lotField.lotFieldValue %>"
<% if (lotField.pattern !== "") { %>
pattern="<%= lotField.pattern %>"
<% } %>
minlength="<%= lotField.minimumLength %>"
maxlength="<%= lotField.maximumLength %>"
<%= lotField.isRequired ? " required" : "" %> />
<% } else { %>
<%
const fieldValues = lotField.lotTypeFieldValues.split("\n");
let valueFound = false;
%>
<div class="select is-fullwidth">
<select id="lot--lotFieldValue_<%= lotField.lotTypeFieldId %>"
name="lotFieldValue_<%= lotField.lotTypeFieldId %>">
<% if (!lotField.isRequired || lotField.lotFieldValue === "") { %>
<option value="">(Not Set)</option>
<% } %>
<% for (const fieldValue of fieldValues) { %>
<%
if (fieldValue === lotField.lotFieldValue) {
valueFound = true;
}
%>
<option value="<%= fieldValue %>"
<%= (fieldValue === lotField.lotFieldValue ? " selected" : "") %>>
<%= fieldValue %>
</option>
<% } %>
<% if (!valueFound && lotField.lotFieldValue !== "") { %>
<option value="<%= lotField.lotFieldValue %>" selected>
<%= lotField.lotFieldValue %>
</option>
<% } %>
</select>
</div>
<% } %>
</div>
</div>
<% } %>
<input id="lot--lotTypeFieldIds" name="lotTypeFieldIds" type="hidden" value="<%= lotTypeFieldIds.slice(1) %>" />
<% } %>
<div class="field">
<label class="label" for="lot--lotLongitude">Longitude</label>
<div class="control">
<input class="input" id="lot--lotLongitude" name="lotLongitude" type="number" min="-180" max="180" step="0.00000001" value="<%= lot.lotLongitude %>" onwheel="return false" />
</div>
</div>
</div>
</div>
</div>
<div class="column">
<div class="panel">
<h2 class="panel-heading">Image</h2>
<div class="panel-block is-block">
<label class="label" for="lot--mapId"><%= configFunctions.getProperty("aliases.map") %></label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select
<% if (!isCreate) { %>
class="is-readonly"
<% } %>
id="lot--mapId" name="mapId">
<option value="" <%= (!isCreate && lot.mapId ? " disabled" : "") %>>
(No <%= configFunctions.getProperty("aliases.map") %> Selected)
</option>
<% let mapIsFound = false; %>
<% for (const map of maps) { %>
<%
if (lot.mapId === map.mapId) {
mapIsFound = true;
}
%>
<option value="<%= map.mapId %>"
<%= (lot.mapId === map.mapId ? " selected" : "") %>
<%= (!isCreate && lot.mapId !== map.mapId ? " disabled" : "") %>>
<%= map.mapName || "(No Name)" %>
</option>
<% } %>
<% if (lot.mapId && !mapIsFound) { %>
<option value="<%= lot.mapId %>" selected>
<%= lot.mapName %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="columns">
<div class="column">
<div class="panel">
<h2 class="panel-heading">Geographic Location</h2>
<div class="panel-block is-block">
<div class="field">
<label class="label" for="lot--lotLatitude">Latitude</label>
<div class="control">
<input class="input" id="lot--lotLatitude" name="lotLatitude" type="number" min="-90" max="90" step="0.00000001" value="<%= lot.lotLatitude %>" onwheel="return false" />
</div>
</div>
<div class="field">
<label class="label" for="lot--lotLongitude">Longitude</label>
<div class="control">
<input class="input" id="lot--lotLongitude" name="lotLongitude" type="number" min="-180" max="180" step="0.00000001" value="<%= lot.lotLongitude %>" onwheel="return false" />
</div>
</div>
</div>
</div>
</div>
<div class="column">
<div class="panel">
<h2 class="panel-heading">Image</h2>
<div class="panel-block is-block">
<label class="label" for="lot--mapId"><%= configFunctions.getProperty("aliases.map") %></label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select
<% if (!isCreate) { %>
class="is-readonly"
<% } %>
id="lot--mapId" name="mapId">
<option value="" <%= (!isCreate && lot.mapId ? " disabled" : "") %>>
(No <%= configFunctions.getProperty("aliases.map") %> Selected)
</option>
<% let mapIsFound = false; %>
<% for (const map of maps) { %>
<%
if (lot.mapId === map.mapId) {
mapIsFound = true;
}
%>
<option value="<%= map.mapId %>"
<%= (lot.mapId === map.mapId ? " selected" : "") %>
<%= (!isCreate && lot.mapId !== map.mapId ? " disabled" : "") %>>
<%= map.mapName || "(No Name)" %>
</option>
<% } %>
<% if (lot.mapId && !mapIsFound) { %>
<option value="<%= lot.mapId %>" selected>
<%= lot.mapName %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="field">
<label class="label" for="lot--mapKey">
<%= configFunctions.getProperty("aliases.map") %> SVG ID
</label>
<div class="control">
<input class="input" id="lot--mapKey" name="mapKey" value="<%= lot.mapKey %>" maxlength="100" pattern="^[\d\w-]*$" />
</div>
<p class="help">
<a href="https://cityssm.github.io/lot-occupancy-system/docs/mapImages.html" target="_blank" rel="noreferrer">
<i class="fa fa-question-circle" aria-hidden="true"></i>
What is the SVG ID?
</a>
</p>
</div>
</div>
</div>
</div>
<div class="field">
<label class="label" for="lot--mapKey">
<%= configFunctions.getProperty("aliases.map") %> SVG ID
</label>
<div class="control">
<input class="input" id="lot--mapKey" name="mapKey" value="<%= lot.mapKey %>" maxlength="100" pattern="^[\d\w-]*$" />
</div>
<p class="help">
<a href="https://cityssm.github.io/lot-occupancy-system/docs/mapImages.html" target="_blank" rel="noreferrer">
<i class="fa fa-question-circle" aria-hidden="true"></i>
What is the SVG ID?
</a>
</p>
</div>
</div>
</div>
</div>
</div>
</form>
<% if (isCreate) { %>
@ -350,26 +348,26 @@
</div>
<% } else { %>
<div class="panel">
<div class="panel-heading">
<div class="level is-mobile">
<div class="level-left">
<div class="level-item">
<h2 class="has-text-weight-bold is-size-5">
Comments
</h2>
</div>
</div>
<div class="level-right">
<div class="level-item">
<button class="button is-small is-success" id="lotComments--add" type="button">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add a Comment</span>
</button>
</div>
</div>
</div>
</div>
<div class="panel-block is-block" id="container--lotComments"></div>
<div class="panel-heading">
<div class="level is-mobile">
<div class="level-left">
<div class="level-item">
<h2 class="has-text-weight-bold is-size-5">
Comments
</h2>
</div>
</div>
<div class="level-right">
<div class="level-item">
<button class="button is-small is-success" id="lotComments--add" type="button">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add a Comment</span>
</button>
</div>
</div>
</div>
</div>
<div class="panel-block is-block" id="container--lotComments"></div>
</div>
<div class="panel">
@ -395,44 +393,50 @@
</div>
<div class="panel-block is-block">
<% if (lot.lotOccupancies.length === 0) { %>
<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>
</div>
<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>
</div>
<% } else { %>
<table class="table is-fullwidth is-striped is-hoverable">
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<tr>
<th class="has-width-10">&nbsp;</th>
<th><%= configFunctions.getProperty("aliases.occupancy") %> Type</th>
<th><%= configFunctions.getProperty("aliases.occupancyStartDate") %></th>
<th>End Date</th>
<th><%= configFunctions.getProperty("aliases.occupants") %></th>
</tr>
</tr>
</thead>
<tbody>
<% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %>
<% for (const lotOccupancy of lot.lotOccupancies) { %>
<% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %>
<% for (const lotOccupancy of lot.lotOccupancies) { %>
<% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %>
<tr>
<td class="has-text-centered">
<% if (isActive) { %>
<i class="fas fa-play" title="Current <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } else { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } %>
<% if (isActive) { %>
<i class="fas fa-play" title="Current <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } else { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } %>
</td>
<td>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %>
</a>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %>
</a><br />
<span class="is-size-7">
#<%= lotOccupancy.lotOccupancyId %>
</span>
</td>
<td><%= lotOccupancy.occupancyStartDateString %></td>
<td>
<% if (lotOccupancy.occupancyEndDate) { %>
<% if (lotOccupancy.occupancyEndDate) { %>
<%= lotOccupancy.occupancyEndDateString %>
<% } else { %>
<span class="has-text-grey">(No End Date)</span>
<% } %>
<% } else { %>
<span class="has-text-grey">(No End Date)</span>
<% } %>
</td>
<td>
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
@ -447,9 +451,9 @@
<% } %>
</td>
</tr>
<% } %>
<% } %>
</tbody>
</table>
</table>
<% } %>
</div>
</div>

View File

@ -30,29 +30,29 @@
<div class="level-right">
<div class="level-item">
<a class="button is-link is-outlined has-tooltip-left"
data-tooltip="Previous <%= configFunctions.getProperty("aliases.lot") %>"
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/previous"
accesskey=",">
<i class="fas fa-arrow-left" aria-hidden="true"></i>
<span class="sr-only">Previous <%= configFunctions.getProperty("aliases.lot") %></span>
data-tooltip="Previous <%= configFunctions.getProperty("aliases.lot") %>"
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/previous"
accesskey=",">
<i class="fas fa-arrow-left" aria-hidden="true"></i>
<span class="sr-only">Previous <%= configFunctions.getProperty("aliases.lot") %></span>
</a>
</div>
<div class="level-item">
<a class="button is-link has-tooltip-left"
data-tooltip="Next <%= configFunctions.getProperty("aliases.lot") %>"
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/next"
accesskey=".">
<span>Next</span>
<span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>
data-tooltip="Next <%= configFunctions.getProperty("aliases.lot") %>"
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/next"
accesskey=".">
<span>Next</span>
<span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>
</a>
</div>
<% if (user.userProperties.canUpdate) { %>
<div class="level-item">
<a class="button is-primary"
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/edit"
accesskey="e">
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Switch to Edit Mode</span>
href="<%= urlPrefix %>/lots/<%= lot.lotId %>/edit"
accesskey="e">
<span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span>
<span>Switch to Edit Mode</span>
</a>
</div>
<% } %>
@ -60,155 +60,158 @@
</div>
<div class="columns">
<div class="column">
<div class="panel">
<div class="panel-block is-block">
<div class="columns">
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getProperty("aliases.map") %></strong><br />
<a href="<%= urlPrefix %>/maps/<%= lot.mapId %>">
<%= lot.mapName || "(No Name)" %>
</a>
</p>
<p class="mb-2">
<strong><%= configFunctions.getProperty("aliases.lot") %> Type</strong><br />
<%= lot.lotType %>
</p>
<p>
<strong>Status</strong><br />
<%= lot.lotStatus %>
</p>
</div>
<% if (lot.lotFields.length > 0) { %>
<div class="column">
<% for (const lotField of lot.lotFields) { %>
<p class="mb-2">
<strong><%= lotField.lotTypeField %></strong><br />
<% if (lotField.lotFieldValue) { %>
<%= lotField.lotFieldValue %>
<% } else { %>
<span class="has-text-grey">(No Value)</span>
<% } %>
</p>
<% } %>
</div>
<% } %>
</div>
</div>
</div>
</div>
<% if (lot.mapSVG) { %>
<div class="column">
<div class="panel">
<div class="panel-block is-block">
<div class="columns">
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getProperty("aliases.map") %></strong><br />
<a href="<%= urlPrefix %>/maps/<%= lot.mapId %>">
<%= lot.mapName || "(No Name)" %>
</a>
</p>
<p class="mb-2">
<strong><%= configFunctions.getProperty("aliases.lot") %> Type</strong><br />
<%= lot.lotType %>
</p>
<p>
<strong>Status</strong><br />
<%= lot.lotStatus %>
</p>
</div>
<% if (lot.lotFields.length > 0) { %>
<div class="column">
<% for (const lotField of lot.lotFields) { %>
<p class="mb-2">
<strong><%= lotField.lotTypeField %></strong><br />
<% if (lotField.lotFieldValue) { %>
<%= lotField.lotFieldValue %>
<% } else { %>
<span class="has-text-grey">(No Value)</span>
<% } %>
</p>
<% } %>
</div>
<% } %>
</div>
</div>
</div>
<div class="panel">
<h2 class="panel-heading">Image</h2>
<div class="panel-block is-block">
<% const imageURL = urlPrefix + "/images/maps/" + lot.mapSVG %>
<div class="image" id="lot--map" data-map-key="<%= lot.mapKey %>">
<%- include('../public/images/maps/' + lot.mapSVG); -%>
</div>
</div>
</div>
</div>
<% if (lot.mapSVG) { %>
<div class="column">
<div class="panel">
<h2 class="panel-heading">Image</h2>
<div class="panel-block is-block">
<% const imageURL = urlPrefix + "/images/maps/" + lot.mapSVG %>
<div class="image" id="lot--map" data-map-key="<%= lot.mapKey %>">
<%- include('../public/images/maps/' + lot.mapSVG); -%>
</div>
</div>
</div>
</div>
<% } %>
<% } %>
</div>
<% if (lot.lotComments.length > 0) { %>
<div class="panel">
<h2 class="panel-heading">Comments</h2>
<div class="panel-block is-block">
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Commentor</th>
<th>Comment Date</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<% for (const lotComment of lot.lotComments) { %>
<tr>
<td><%= lotComment.recordCreate_userName %></td>
<td>
<%= lotComment.lotCommentDateString %>
<%= (lotComment.lotCommentTime === 0 ? "" : lotComment.lotCommentTimeString) %>
</td>
<td><%= lotComment.lotComment %></td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
<div class="panel">
<h2 class="panel-heading">Comments</h2>
<div class="panel-block is-block">
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Commentor</th>
<th>Comment Date</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<% for (const lotComment of lot.lotComments) { %>
<tr>
<td><%= lotComment.recordCreate_userName %></td>
<td>
<%= lotComment.lotCommentDateString %>
<%= (lotComment.lotCommentTime === 0 ? "" : lotComment.lotCommentTimeString) %>
</td>
<td><%= lotComment.lotComment %></td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
<% } %>
<div class="panel">
<h2 class="panel-heading">
<%= configFunctions.getProperty("aliases.occupancies") %>
<span class="tag"><%= lot.lotOccupancies.length %></span>
</h2>
<div class="panel-block is-block">
<% if (lot.lotOccupancies.length === 0) { %>
<div class="message is-info">
<p class="message-body">There are no occupancy records asscociated with this
<%= configFunctions.getProperty("aliases.lot") %>.</p>
</div>
<% } else { %>
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th class="has-width-10">&nbsp;</th>
<th><%= configFunctions.getProperty("aliases.occupancy") %> Type</th>
<th><%= configFunctions.getProperty("aliases.occupancyStartDate") %></th>
<th>End Date</th>
<th><%= configFunctions.getProperty("aliases.occupants") %></th>
</tr>
</thead>
<tbody>
<% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %>
<% for (const lotOccupancy of lot.lotOccupancies) { %>
<% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %>
<tr>
<td class="has-text-centered">
<% if (isActive) { %>
<i class="fas fa-play" title="Current <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } else { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } %>
</td>
<td>
<a class="has-text-weight-bold"
href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %>
</a>
</td>
<td><%= lotOccupancy.occupancyStartDateString %></td>
<td>
<% if (lotOccupancy.occupancyEndDate) { %>
<%= lotOccupancy.occupancyEndDateString %>
<% } else { %>
<span class="has-text-grey">(No End Date)</span>
<% } %>
</td>
<td>
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
<span class="has-text-grey">(No <%= configFunctions.getProperty("aliases.occupants") %>)</span>
<% } else { %>
<% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %>
<span class="has-tooltip-left" data-tooltip="<%= occupant.lotOccupantType %>">
<i class="fas fa-fw fa-<%= occupant.fontAwesomeIconClass || 'user' %>" aria-hidden="true"></i>
<%= occupant.occupantName + ' ' + occupant.occupantFamilyName %>
</span><br />
<% } %>
<% } %>
</td>
</tr>
<% } %>
</tbody>
</table>
<% } %>
</div>
<h2 class="panel-heading">
<%= configFunctions.getProperty("aliases.occupancies") %>
<span class="tag"><%= lot.lotOccupancies.length %></span>
</h2>
<div class="panel-block is-block">
<% if (lot.lotOccupancies.length === 0) { %>
<div class="message is-info">
<p class="message-body">
There are no occupancy records asscociated with this
<%= configFunctions.getProperty("aliases.lot") %>.
</p>
</div>
<% } else { %>
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th class="has-width-10">&nbsp;</th>
<th><%= configFunctions.getProperty("aliases.occupancy") %> Type</th>
<th><%= configFunctions.getProperty("aliases.occupancyStartDate") %></th>
<th>End Date</th>
<th><%= configFunctions.getProperty("aliases.occupants") %></th>
</tr>
</thead>
<tbody>
<% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %>
<% for (const lotOccupancy of lot.lotOccupancies) { %>
<% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %>
<tr>
<td class="has-text-centered">
<% if (isActive) { %>
<i class="fas fa-play" title="Current <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } else { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } %>
</td>
<td>
<a class="has-text-weight-bold"
href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %>
</a><br />
<span class="is-size-7">#<%= lotOccupancy.lotOccupancyId %></span>
</td>
<td><%= lotOccupancy.occupancyStartDateString %></td>
<td>
<% if (lotOccupancy.occupancyEndDate) { %>
<%= lotOccupancy.occupancyEndDateString %>
<% } else { %>
<span class="has-text-grey">(No End Date)</span>
<% } %>
</td>
<td>
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
<span class="has-text-grey">(No <%= configFunctions.getProperty("aliases.occupants") %>)</span>
<% } else { %>
<% for (const occupant of lotOccupancy.lotOccupancyOccupants) { %>
<span class="has-tooltip-left" data-tooltip="<%= occupant.lotOccupantType %>">
<i class="fas fa-fw fa-<%= occupant.fontAwesomeIconClass || 'user' %>" aria-hidden="true"></i>
<%= occupant.occupantName + ' ' + occupant.occupantFamilyName %>
</span><br />
<% } %>
<% } %>
</td>
</tr>
<% } %>
</tbody>
</table>
<% } %>
</div>
</div>
<%- include('_footerA'); -%>

View File

@ -89,34 +89,36 @@
<div class="panel">
<div class="panel-block is-block">
<div class="columns">
<div class="column">
<p class="mb-2">
<strong>Work Order Type</strong><br />
<%= workOrder.workOrderType %>
</p>
<p>
<strong>Description</strong><br />
<% if (workOrder.workOrderDescription) { %>
<%= workOrder.workOrderDescription %>
<% } else { %>
<span class="has-text-grey">(No Description)</span>
<% } %>
</p>
</div>
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getProperty("aliases.workOrderOpenDate") %></strong><br />
<%= workOrder.workOrderOpenDateString %>
</p>
<p>
<strong><%= configFunctions.getProperty("aliases.workOrderCloseDate") %></strong><br />
<% if (workOrder.workOrderCloseDate) { %>
<%= workOrder.workOrderCloseDateString %>
<% } else { %>
<span class="has-text-grey">(No <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>)</span>
<% } %>
</p>
</div>
<div class="column">
<p class="mb-2">
<strong>Work Order Type</strong><br />
<%= workOrder.workOrderType %>
</p>
<p>
<strong>Description</strong><br />
<% if (workOrder.workOrderDescription) { %>
<%= workOrder.workOrderDescription %>
<% } else { %>
<span class="has-text-grey">(No Description)</span>
<% } %>
</p>
</div>
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getProperty("aliases.workOrderOpenDate") %></strong><br />
<%= workOrder.workOrderOpenDateString %>
</p>
<p>
<strong><%= configFunctions.getProperty("aliases.workOrderCloseDate") %></strong><br />
<% if (workOrder.workOrderCloseDate) { %>
<%= workOrder.workOrderCloseDateString %>
<% } else { %>
<span class="has-text-grey">
(No <%= configFunctions.getProperty("aliases.workOrderCloseDate") %>)
</span>
<% } %>
</p>
</div>
</div>
</div>
</div>
@ -129,18 +131,18 @@
%>
<div class="tabs is-boxed">
<ul>
<li class="<%= (tabToSelect === "lotOccupancies" ? "is-active" : "") %>">
<a href="#relatedTab--lotOccupancies">
<span><%= configFunctions.getProperty("aliases.occupancies") %></span>
<span class="ml-2 tag"><%= workOrder.workOrderLotOccupancies.length %></span>
</a>
</li>
<li class="<%= (tabToSelect === "lots" ? "is-active" : "") %>">
<a href="#relatedTab--lots">
<span><%= configFunctions.getProperty("aliases.lots") %></span>
<span class="ml-2 tag"><%= workOrder.workOrderLots.length %></span>
</a>
</li>
<li class="<%= (tabToSelect === "lotOccupancies" ? "is-active" : "") %>">
<a href="#relatedTab--lotOccupancies">
<span><%= configFunctions.getProperty("aliases.occupancies") %></span>
<span class="ml-2 tag"><%= workOrder.workOrderLotOccupancies.length %></span>
</a>
</li>
<li class="<%= (tabToSelect === "lots" ? "is-active" : "") %>">
<a href="#relatedTab--lots">
<span><%= configFunctions.getProperty("aliases.lots") %></span>
<span class="ml-2 tag"><%= workOrder.workOrderLots.length %></span>
</a>
</li>
</ul>
</div>
<div class="tab-container">
@ -179,10 +181,13 @@
<% } %>
</td>
<td>
<a class="has-text-weight-bold"
href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %>
</a>
<a class="has-text-weight-bold"
href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %>
</a><br />
<span class="is-size-7">
#<%= lotOccupancy.lotOccupancyId %>
</span>
</td>
<td>
<% if (lotOccupancy.lotId) { %>