deepsource-autofix-76c6eb20
Dan Gowans 2024-06-27 14:33:21 -04:00
parent c9bf3ab878
commit 1ca3ea0a51
19 changed files with 804 additions and 896 deletions

View File

@ -16,13 +16,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
}
"use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
let workOrderTypes = exports.workOrderTypes;
delete exports.workOrderTypes;
function updateWorkOrderType(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateWorkOrderType', submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateWorkOrderType`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
@ -41,11 +42,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
});
}
const deleteWorkOrderType = (clickEvent) => {
function deleteWorkOrderType(clickEvent) {
const tableRowElement = clickEvent.currentTarget.closest('tr');
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteWorkOrderType', {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteWorkOrderType`, {
workOrderTypeId
}, (rawResponseJSON) => {
var _a;
@ -83,16 +84,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
callbackFunction: doDelete
}
});
};
}
function moveWorkOrderType(clickEvent) {
const buttonElement = clickEvent.currentTarget;
const tableRowElement = buttonElement.closest('tr');
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
cityssm.postJSON(los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
? 'doMoveWorkOrderTypeUp'
: 'doMoveWorkOrderTypeDown'), {
: 'doMoveWorkOrderTypeDown'}`, {
workOrderTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
}, (rawResponseJSON) => {
@ -112,7 +111,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function renderWorkOrderTypes() {
var _a;
var _a, _b, _c;
const containerElement = document.querySelector('#container--workOrderTypes');
if (workOrderTypes.length === 0) {
containerElement.innerHTML = `<tr><td colspan="2">
@ -125,44 +124,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.workOrderTypeId =
workOrderType.workOrderTypeId.toString();
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="workOrderTypeId" type="hidden" value="' +
workOrderType.workOrderTypeId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="workOrderType" type="text" value="' +
cityssm.escapeHTML((_a = workOrderType.workOrderType) !== null && _a !== void 0 ? _a : '') +
'" maxlength="100" aria-label="Work Order Type" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderTypeUp', 'button--moveWorkOrderTypeDown', false) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>';
tableRowElement
.querySelector('form')
.addEventListener('submit', updateWorkOrderType);
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<form>
<input name="workOrderTypeId" type="hidden" value="${workOrderType.workOrderTypeId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="workOrderType" type="text"
value="${cityssm.escapeHTML((_a = workOrderType.workOrderType) !== null && _a !== void 0 ? _a : '')}" maxlength="100" aria-label="Work Order Type" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderTypeUp', 'button--moveWorkOrderTypeDown', false)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`;
(_b = tableRowElement
.querySelector('form')) === null || _b === void 0 ? void 0 : _b.addEventListener('submit', updateWorkOrderType);
tableRowElement.querySelector('.button--moveWorkOrderTypeUp').addEventListener('click', moveWorkOrderType);
tableRowElement.querySelector('.button--moveWorkOrderTypeDown').addEventListener('click', moveWorkOrderType);
tableRowElement
.querySelector('.button--deleteWorkOrderType')
.addEventListener('click', deleteWorkOrderType);
(_c = tableRowElement
.querySelector('.button--deleteWorkOrderType')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', deleteWorkOrderType);
containerElement.append(tableRowElement);
}
}
@ -170,19 +165,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
document.querySelector('#form--addWorkOrderType').addEventListener('submit', (submitEvent) => {
submitEvent.preventDefault();
const formElement = submitEvent.currentTarget;
cityssm.postJSON(los.urlPrefix + '/admin/doAddWorkOrderType', formElement, (rawResponseJSON) => {
var _a;
cityssm.postJSON(`${los.urlPrefix}/admin/doAddWorkOrderType`, formElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderTypes = responseJSON.workOrderTypes;
renderWorkOrderTypes();
formElement.reset();
formElement.querySelector('input').focus();
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
}
else {
bulmaJS.alert({
title: 'Error Adding Work Order Type',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}
@ -192,13 +187,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
// eslint-disable-next-line no-secrets/no-secrets
"use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
let workOrderMilestoneTypes = exports.workOrderMilestoneTypes;
delete exports.workOrderMilestoneTypes;
function updateWorkOrderMilestoneType(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateWorkOrderMilestoneType', submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateWorkOrderMilestoneType`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
@ -221,7 +217,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tableRowElement = clickEvent.currentTarget.closest('tr');
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteWorkOrderMilestoneType', {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteWorkOrderMilestoneType`, {
workOrderMilestoneTypeId
}, (rawResponseJSON) => {
var _a;
@ -264,11 +260,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
const buttonElement = clickEvent.currentTarget;
const tableRowElement = buttonElement.closest('tr');
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
cityssm.postJSON(los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
? 'doMoveWorkOrderMilestoneTypeUp'
: 'doMoveWorkOrderMilestoneTypeDown'), {
: 'doMoveWorkOrderMilestoneTypeDown'}`, {
workOrderMilestoneTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
}, (rawResponseJSON) => {
@ -288,6 +282,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function renderWorkOrderMilestoneTypes() {
var _a, _b;
const containerElement = document.querySelector('#container--workOrderMilestoneTypes');
if (workOrderMilestoneTypes.length === 0) {
containerElement.innerHTML = `<tr><td colspan="2">
@ -300,44 +295,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.workOrderMilestoneTypeId =
workOrderMilestoneType.workOrderMilestoneTypeId.toString();
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="workOrderMilestoneTypeId" type="hidden" value="' +
workOrderMilestoneType.workOrderMilestoneTypeId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="workOrderMilestoneType" type="text" value="' +
cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType) +
'" maxlength="100" aria-label="Work Order Milestone Type" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderMilestoneTypeUp', 'button--moveWorkOrderMilestoneTypeDown', false) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>';
tableRowElement
.querySelector('form')
.addEventListener('submit', updateWorkOrderMilestoneType);
// eslint-disable-next-line no-unsanitized/property, no-secrets/no-secrets
tableRowElement.innerHTML = `<td>
<form>
<input name="workOrderMilestoneTypeId" type="hidden" value="${workOrderMilestoneType.workOrderMilestoneTypeId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="workOrderMilestoneType" type="text"
value="${cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType)}" maxlength="100" aria-label="Work Order Milestone Type" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderMilestoneTypeUp', 'button--moveWorkOrderMilestoneTypeDown', false)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`;
(_a = tableRowElement
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateWorkOrderMilestoneType);
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeUp').addEventListener('click', moveWorkOrderMilestoneType);
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeDown').addEventListener('click', moveWorkOrderMilestoneType);
tableRowElement
.querySelector('.button--deleteWorkOrderMilestoneType')
.addEventListener('click', deleteWorkOrderMilestoneType);
(_b = tableRowElement
.querySelector('.button--deleteWorkOrderMilestoneType')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteWorkOrderMilestoneType);
containerElement.append(tableRowElement);
}
}
@ -345,19 +336,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
document.querySelector('#form--addWorkOrderMilestoneType').addEventListener('submit', (submitEvent) => {
submitEvent.preventDefault();
const formElement = submitEvent.currentTarget;
cityssm.postJSON(los.urlPrefix + '/admin/doAddWorkOrderMilestoneType', formElement, (rawResponseJSON) => {
var _a;
cityssm.postJSON(`${los.urlPrefix}/admin/doAddWorkOrderMilestoneType`, formElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes;
renderWorkOrderMilestoneTypes();
formElement.reset();
formElement.querySelector('input').focus();
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
}
else {
bulmaJS.alert({
title: 'Error Adding Work Order Milestone Type',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}
@ -366,25 +357,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
renderWorkOrderMilestoneTypes();
"use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
let lotStatuses = exports.lotStatuses;
delete exports.lotStatuses;
function updateLotStatus(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateLotStatus`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotStatuses = responseJSON.lotStatuses;
bulmaJS.alert({
message: los.escapedAliases.Lot + ' Status Updated Successfully',
message: `${los.escapedAliases.Lot} Status Updated Successfully`,
contextualColorName: 'success'
});
}
else {
bulmaJS.alert({
title: 'Error Updating ' + los.escapedAliases.Lot + ' Status',
title: `Error Updating ${los.escapedAliases.Lot} Status`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
@ -395,7 +387,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tableRowElement = clickEvent.currentTarget.closest('tr');
const lotStatusId = tableRowElement.dataset.lotStatusId;
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteLotStatus', {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotStatus`, {
lotStatusId
}, (rawResponseJSON) => {
var _a;
@ -409,7 +401,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
tableRowElement.remove();
}
bulmaJS.alert({
message: los.escapedAliases.Lot + ' Status Deleted Successfully',
message: `${los.escapedAliases.Lot} Status Deleted Successfully`,
contextualColorName: 'success'
});
}
@ -438,11 +430,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
const buttonElement = clickEvent.currentTarget;
const tableRowElement = buttonElement.closest('tr');
const lotStatusId = tableRowElement.dataset.lotStatusId;
cityssm.postJSON(los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
? 'doMoveLotStatusUp'
: 'doMoveLotStatusDown'), {
: 'doMoveLotStatusDown'}`, {
lotStatusId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
}, (rawResponseJSON) => {
@ -454,7 +444,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
else {
bulmaJS.alert({
title: 'Error Moving ' + los.escapedAliases.Lot + ' Status',
title: `Error Moving ${los.escapedAliases.Lot} Status`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
@ -462,8 +452,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function renderLotStatuses() {
var _a, _b;
const containerElement = document.querySelector('#container--lotStatuses');
if (lotStatuses.length === 0) {
// eslint-disable-next-line no-unsanitized/property
containerElement.innerHTML = `<tr><td colspan="2">
<div class="message is-warning"><p class="message-body">There are no active ${los.escapedAliases.lot} statuses.</p></div>
</td></tr>`;
@ -473,47 +465,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
for (const lotStatus of lotStatuses) {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString();
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="lotStatusId" type="hidden" value="' +
lotStatus.lotStatusId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="lotStatus" type="text"' +
(' value="' + cityssm.escapeHTML(lotStatus.lotStatus) + '"') +
(' aria-label="' +
cityssm.escapeHTML(exports.aliases.lot) +
' Status"') +
' maxlength="100" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML('button--moveLotStatusUp', 'button--moveLotStatusDown', false) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>';
tableRowElement
.querySelector('form')
.addEventListener('submit', updateLotStatus);
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<form>
<input name="lotStatusId" type="hidden" value="${lotStatus.lotStatusId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="lotStatus" type="text"
value="${cityssm.escapeHTML(lotStatus.lotStatus)}"
aria-label="${los.escapedAliases.Lot} Status" maxlength="100" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>\
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML('button--moveLotStatusUp', 'button--moveLotStatusDown', false)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`;
(_a = tableRowElement
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateLotStatus);
tableRowElement.querySelector('.button--moveLotStatusUp').addEventListener('click', moveLotStatus);
tableRowElement.querySelector('.button--moveLotStatusDown').addEventListener('click', moveLotStatus);
tableRowElement
.querySelector('.button--deleteLotStatus')
.addEventListener('click', deleteLotStatus);
(_b = tableRowElement
.querySelector('.button--deleteLotStatus')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteLotStatus);
containerElement.append(tableRowElement);
}
}
@ -521,19 +507,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
document.querySelector('#form--addLotStatus').addEventListener('submit', (submitEvent) => {
submitEvent.preventDefault();
const formElement = submitEvent.currentTarget;
cityssm.postJSON(los.urlPrefix + '/admin/doAddLotStatus', formElement, (rawResponseJSON) => {
var _a;
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotStatus`, formElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotStatuses = responseJSON.lotStatuses;
renderLotStatuses();
formElement.reset();
formElement.querySelector('input').focus();
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
}
else {
bulmaJS.alert({
title: `Error Adding ${los.escapedAliases.Lot} Status`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}
@ -543,13 +529,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
// eslint-disable-next-line no-secrets/no-secrets
"use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupantTypes = exports.lotOccupantTypes;
delete exports.lotOccupantTypes;
function updateLotOccupantType(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateLotOccupantType', submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateLotOccupantType`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
@ -572,7 +559,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tableRowElement = clickEvent.currentTarget.closest('tr');
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteLotOccupantType', {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotOccupantType`, {
lotOccupantTypeId
}, (rawResponseJSON) => {
var _a;
@ -615,11 +602,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
const buttonElement = clickEvent.currentTarget;
const tableRowElement = buttonElement.closest('tr');
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
cityssm.postJSON(los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
? 'doMoveLotOccupantTypeUp'
: 'doMoveLotOccupantTypeDown'), {
: 'doMoveLotOccupantTypeDown'}`, {
lotOccupantTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
}, (rawResponseJSON) => {
@ -639,8 +624,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
function renderLotOccupantTypes() {
var _a, _b;
const containerElement = document.querySelector('#container--lotOccupantTypes');
if (lotOccupantTypes.length === 0) {
// eslint-disable-next-line no-unsanitized/property
containerElement.innerHTML = `<tr><td colspan="3">
<div class="message is-warning">
<p class="message-body">There are no active ${los.escapedAliases.lot} ${los.escapedAliases.occupant} types.</p>
@ -653,98 +640,75 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotOccupantTypeId =
lotOccupantType.lotOccupantTypeId.toString();
const formId = 'form--lotOccupantType-' + lotOccupantType.lotOccupantTypeId.toString();
tableRowElement.innerHTML =
'<td>' +
('<div class="field">' +
'<div class="control">' +
'<input class="input" name="lotOccupantType" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.lotOccupantType) +
'"') +
(' form="' + formId + '"') +
(' aria-label="' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type"') +
' maxlength="100" required />' +
'</div>' +
'</div>') +
'</td>' +
'<td>' +
('<div class="field has-addons">' +
'<div class="control"><span class="button is-static">fa-</span></div>' +
'<div class="control">' +
'<input class="input" name="fontAwesomeIconClass" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
'"') +
(' form="' + formId + '"') +
' list="datalist--fontAwesomeIconClass"' +
' aria-label="Icon Name"' +
' maxlength="50" />' +
'</div>' +
'<div class="control"><span class="button is-static">' +
'<i class="fas fa-fw fa-' +
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
'"></i></span></div>' +
'</div>') +
'</td>' +
'<td>' +
('<div class="field">' +
'<div class="control">' +
'<input class="input" name="occupantCommentTitle" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.occupantCommentTitle) +
'"') +
(' form="' + formId + '"') +
(' aria-label="' + los.escapedAliases.Occupant + ' Comment Title"') +
' maxlength="50" />' +
'</div>' +
'</div>') +
'</td>' +
('<td>' +
('<form id="' + formId + '">') +
'<input name="lotOccupantTypeId" type="hidden"' +
(' value="' + lotOccupantType.lotOccupantTypeId.toString() + '"') +
' />' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</form>' +
'</td>') +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML('button--moveLotOccupantTypeUp', 'button--moveLotOccupantTypeDown', false) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteLotOccupantType"' +
' data-tooltip="Delete ' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type" type="button"' +
' aria-label="Delete ' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>';
const formId = `form--lotOccupantType-${lotOccupantType.lotOccupantTypeId.toString()}`;
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<div class="field">
<div class="control">
<input class="input" name="lotOccupantType" type="text"
value="${cityssm.escapeHTML(lotOccupantType.lotOccupantType)}"
form="${formId}"
aria-label="${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type" maxlength="100" required />
</div>
</div>
</td><td>
<div class="field has-addons">
<div class="control">
<span class="button is-static">fa-</span>
</div>
<div class="control">
<input class="input" name="fontAwesomeIconClass" type="text"
value="${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"
form="${formId}"
list="datalist--fontAwesomeIconClass" aria-label="Icon Name" maxlength="50" />
</div>
<div class="control">
<span class="button is-static">
<i class="fas fa-fw fa-${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"></i>
</span>
</div>
</div>
</td><td>
<div class="field">
<div class="control">
<input class="input" name="occupantCommentTitle" type="text"
value="${cityssm.escapeHTML(lotOccupantType.occupantCommentTitle)}"
form="${formId}"
aria-label="${los.escapedAliases.Occupant} Comment Title" maxlength="50" />
</div>
</div>
</td><td>
<form id="${formId}">
<input name="lotOccupantTypeId" type="hidden"
value="${lotOccupantType.lotOccupantTypeId.toString()}" />
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML('button--moveLotOccupantTypeUp', 'button--moveLotOccupantTypeDown', false)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteLotOccupantType"
data-tooltip="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type"
type="button"
aria-label="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`;
const fontAwesomeInputElement = tableRowElement.querySelector("input[name='fontAwesomeIconClass']");
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon);
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon);
tableRowElement
.querySelector('form')
.addEventListener('submit', updateLotOccupantType);
(_a = tableRowElement
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateLotOccupantType);
tableRowElement.querySelector('.button--moveLotOccupantTypeUp').addEventListener('click', moveLotOccupantType);
tableRowElement.querySelector('.button--moveLotOccupantTypeDown').addEventListener('click', moveLotOccupantType);
tableRowElement
.querySelector('.button--deleteLotOccupantType')
.addEventListener('click', deleteLotOccupantType);
(_b = tableRowElement
.querySelector('.button--deleteLotOccupantType')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteLotOccupantType);
containerElement.append(tableRowElement);
}
}
@ -752,19 +716,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
document.querySelector('#form--addLotOccupantType').addEventListener('submit', (submitEvent) => {
submitEvent.preventDefault();
const formElement = submitEvent.currentTarget;
cityssm.postJSON(los.urlPrefix + '/admin/doAddLotOccupantType', formElement, (rawResponseJSON) => {
var _a;
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotOccupantType`, formElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotOccupantTypes = responseJSON.lotOccupantTypes;
renderLotOccupantTypes();
formElement.reset();
formElement.querySelector('input').focus();
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
}
else {
bulmaJS.alert({
title: `Error Adding ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}

View File

@ -1,12 +1,12 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
import type * as globalTypes from '../../types/globalTypes.js'
import type { LOS } from '../../types/globalTypes.js'
declare const exports: Record<string, unknown>
;(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const los = exports.los as globalTypes.LOS
const los = exports.los as LOS
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function refreshFontAwesomeIcon(changeEvent: Event): void {

View File

@ -1,11 +1,12 @@
"use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
let lotOccupantTypes = exports.lotOccupantTypes;
delete exports.lotOccupantTypes;
function updateLotOccupantType(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateLotOccupantType', submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateLotOccupantType`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
@ -28,7 +29,7 @@ function deleteLotOccupantType(clickEvent) {
const tableRowElement = clickEvent.currentTarget.closest('tr');
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteLotOccupantType', {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotOccupantType`, {
lotOccupantTypeId
}, (rawResponseJSON) => {
var _a;
@ -71,11 +72,9 @@ function moveLotOccupantType(clickEvent) {
const buttonElement = clickEvent.currentTarget;
const tableRowElement = buttonElement.closest('tr');
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
cityssm.postJSON(los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
? 'doMoveLotOccupantTypeUp'
: 'doMoveLotOccupantTypeDown'), {
: 'doMoveLotOccupantTypeDown'}`, {
lotOccupantTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
}, (rawResponseJSON) => {
@ -95,8 +94,10 @@ function moveLotOccupantType(clickEvent) {
});
}
function renderLotOccupantTypes() {
var _a, _b;
const containerElement = document.querySelector('#container--lotOccupantTypes');
if (lotOccupantTypes.length === 0) {
// eslint-disable-next-line no-unsanitized/property
containerElement.innerHTML = `<tr><td colspan="3">
<div class="message is-warning">
<p class="message-body">There are no active ${los.escapedAliases.lot} ${los.escapedAliases.occupant} types.</p>
@ -109,98 +110,75 @@ function renderLotOccupantTypes() {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotOccupantTypeId =
lotOccupantType.lotOccupantTypeId.toString();
const formId = 'form--lotOccupantType-' + lotOccupantType.lotOccupantTypeId.toString();
tableRowElement.innerHTML =
'<td>' +
('<div class="field">' +
'<div class="control">' +
'<input class="input" name="lotOccupantType" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.lotOccupantType) +
'"') +
(' form="' + formId + '"') +
(' aria-label="' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type"') +
' maxlength="100" required />' +
'</div>' +
'</div>') +
'</td>' +
'<td>' +
('<div class="field has-addons">' +
'<div class="control"><span class="button is-static">fa-</span></div>' +
'<div class="control">' +
'<input class="input" name="fontAwesomeIconClass" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
'"') +
(' form="' + formId + '"') +
' list="datalist--fontAwesomeIconClass"' +
' aria-label="Icon Name"' +
' maxlength="50" />' +
'</div>' +
'<div class="control"><span class="button is-static">' +
'<i class="fas fa-fw fa-' +
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
'"></i></span></div>' +
'</div>') +
'</td>' +
'<td>' +
('<div class="field">' +
'<div class="control">' +
'<input class="input" name="occupantCommentTitle" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.occupantCommentTitle) +
'"') +
(' form="' + formId + '"') +
(' aria-label="' + los.escapedAliases.Occupant + ' Comment Title"') +
' maxlength="50" />' +
'</div>' +
'</div>') +
'</td>' +
('<td>' +
('<form id="' + formId + '">') +
'<input name="lotOccupantTypeId" type="hidden"' +
(' value="' + lotOccupantType.lotOccupantTypeId.toString() + '"') +
' />' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</form>' +
'</td>') +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML('button--moveLotOccupantTypeUp', 'button--moveLotOccupantTypeDown', false) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteLotOccupantType"' +
' data-tooltip="Delete ' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type" type="button"' +
' aria-label="Delete ' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>';
const formId = `form--lotOccupantType-${lotOccupantType.lotOccupantTypeId.toString()}`;
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<div class="field">
<div class="control">
<input class="input" name="lotOccupantType" type="text"
value="${cityssm.escapeHTML(lotOccupantType.lotOccupantType)}"
form="${formId}"
aria-label="${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type" maxlength="100" required />
</div>
</div>
</td><td>
<div class="field has-addons">
<div class="control">
<span class="button is-static">fa-</span>
</div>
<div class="control">
<input class="input" name="fontAwesomeIconClass" type="text"
value="${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"
form="${formId}"
list="datalist--fontAwesomeIconClass" aria-label="Icon Name" maxlength="50" />
</div>
<div class="control">
<span class="button is-static">
<i class="fas fa-fw fa-${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"></i>
</span>
</div>
</div>
</td><td>
<div class="field">
<div class="control">
<input class="input" name="occupantCommentTitle" type="text"
value="${cityssm.escapeHTML(lotOccupantType.occupantCommentTitle)}"
form="${formId}"
aria-label="${los.escapedAliases.Occupant} Comment Title" maxlength="50" />
</div>
</div>
</td><td>
<form id="${formId}">
<input name="lotOccupantTypeId" type="hidden"
value="${lotOccupantType.lotOccupantTypeId.toString()}" />
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML('button--moveLotOccupantTypeUp', 'button--moveLotOccupantTypeDown', false)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteLotOccupantType"
data-tooltip="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type"
type="button"
aria-label="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`;
const fontAwesomeInputElement = tableRowElement.querySelector("input[name='fontAwesomeIconClass']");
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon);
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon);
tableRowElement
.querySelector('form')
.addEventListener('submit', updateLotOccupantType);
(_a = tableRowElement
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateLotOccupantType);
tableRowElement.querySelector('.button--moveLotOccupantTypeUp').addEventListener('click', moveLotOccupantType);
tableRowElement.querySelector('.button--moveLotOccupantTypeDown').addEventListener('click', moveLotOccupantType);
tableRowElement
.querySelector('.button--deleteLotOccupantType')
.addEventListener('click', deleteLotOccupantType);
(_b = tableRowElement
.querySelector('.button--deleteLotOccupantType')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteLotOccupantType);
containerElement.append(tableRowElement);
}
}
@ -208,19 +186,19 @@ function renderLotOccupantTypes() {
document.querySelector('#form--addLotOccupantType').addEventListener('submit', (submitEvent) => {
submitEvent.preventDefault();
const formElement = submitEvent.currentTarget;
cityssm.postJSON(los.urlPrefix + '/admin/doAddLotOccupantType', formElement, (rawResponseJSON) => {
var _a;
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotOccupantType`, formElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotOccupantTypes = responseJSON.lotOccupantTypes;
renderLotOccupantTypes();
formElement.reset();
formElement.querySelector('input').focus();
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
}
else {
bulmaJS.alert({
title: `Error Adding ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}

View File

@ -1,25 +1,27 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
import type * as globalTypes from '../../types/globalTypes'
import type * as recordTypes from '../../types/recordTypes'
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
import type { BulmaJS } from '@cityssm/bulma-js/types'
import type { LOS } from '../../types/globalTypes.js'
import type { LotOccupantType } from '../../types/recordTypes.js'
declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
declare const los: globalTypes.LOS
declare const los: LOS
declare const exports: Record<string, unknown>
declare const refreshFontAwesomeIcon: (changeEvent: Event) => void
let lotOccupantTypes: recordTypes.LotOccupantType[] = exports.lotOccupantTypes
let lotOccupantTypes = exports.lotOccupantTypes as LotOccupantType[]
delete exports.lotOccupantTypes
type ResponseJSON =
| {
success: true
lotOccupantTypes: recordTypes.LotOccupantType[]
lotOccupantTypes: LotOccupantType[]
}
| {
success: false
@ -30,13 +32,13 @@ function updateLotOccupantType(submitEvent: SubmitEvent): void {
submitEvent.preventDefault()
cityssm.postJSON(
los.urlPrefix + '/admin/doUpdateLotOccupantType',
`${los.urlPrefix}/admin/doUpdateLotOccupantType`,
submitEvent.currentTarget,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
lotOccupantTypes = responseJSON.lotOccupantTypes!
lotOccupantTypes = responseJSON.lotOccupantTypes
bulmaJS.alert({
message: `${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type Updated Successfully`,
@ -56,13 +58,13 @@ function updateLotOccupantType(submitEvent: SubmitEvent): void {
function deleteLotOccupantType(clickEvent: Event): void {
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
'tr'
)!
) as HTMLTableRowElement
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId
function doDelete(): void {
cityssm.postJSON(
los.urlPrefix + '/admin/doDeleteLotOccupantType',
`${los.urlPrefix}/admin/doDeleteLotOccupantType`,
{
lotOccupantTypeId
},
@ -70,7 +72,7 @@ function deleteLotOccupantType(clickEvent: Event): void {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
lotOccupantTypes = responseJSON.lotOccupantTypes!
lotOccupantTypes = responseJSON.lotOccupantTypes
if (lotOccupantTypes.length === 0) {
renderLotOccupantTypes()
@ -109,16 +111,16 @@ function deleteLotOccupantType(clickEvent: Event): void {
function moveLotOccupantType(clickEvent: MouseEvent): void {
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
const tableRowElement = buttonElement.closest('tr')!
const tableRowElement = buttonElement.closest('tr') as HTMLTableRowElement
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId
cityssm.postJSON(
los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
`${los.urlPrefix}/admin/${
buttonElement.dataset.direction === 'up'
? 'doMoveLotOccupantTypeUp'
: 'doMoveLotOccupantTypeDown'),
: 'doMoveLotOccupantTypeDown'
}`,
{
lotOccupantTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
@ -127,7 +129,7 @@ function moveLotOccupantType(clickEvent: MouseEvent): void {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
lotOccupantTypes = responseJSON.lotOccupantTypes!
lotOccupantTypes = responseJSON.lotOccupantTypes
renderLotOccupantTypes()
} else {
bulmaJS.alert({
@ -146,6 +148,7 @@ function renderLotOccupantTypes(): void {
) as HTMLTableSectionElement
if (lotOccupantTypes.length === 0) {
// eslint-disable-next-line no-unsanitized/property
containerElement.innerHTML = `<tr><td colspan="3">
<div class="message is-warning">
<p class="message-body">There are no active ${los.escapedAliases.lot} ${los.escapedAliases.occupant} types.</p>
@ -163,104 +166,82 @@ function renderLotOccupantTypes(): void {
tableRowElement.dataset.lotOccupantTypeId =
lotOccupantType.lotOccupantTypeId.toString()
const formId =
'form--lotOccupantType-' + lotOccupantType.lotOccupantTypeId.toString()
const formId = `form--lotOccupantType-${lotOccupantType.lotOccupantTypeId.toString()}`
tableRowElement.innerHTML =
'<td>' +
('<div class="field">' +
'<div class="control">' +
'<input class="input" name="lotOccupantType" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.lotOccupantType) +
'"') +
(' form="' + formId + '"') +
(' aria-label="' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type"') +
' maxlength="100" required />' +
'</div>' +
'</div>') +
'</td>' +
'<td>' +
('<div class="field has-addons">' +
'<div class="control"><span class="button is-static">fa-</span></div>' +
'<div class="control">' +
'<input class="input" name="fontAwesomeIconClass" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
'"') +
(' form="' + formId + '"') +
' list="datalist--fontAwesomeIconClass"' +
' aria-label="Icon Name"' +
' maxlength="50" />' +
'</div>' +
'<div class="control"><span class="button is-static">' +
'<i class="fas fa-fw fa-' +
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
'"></i></span></div>' +
'</div>') +
'</td>' +
'<td>' +
('<div class="field">' +
'<div class="control">' +
'<input class="input" name="occupantCommentTitle" type="text"' +
(' value="' +
cityssm.escapeHTML(lotOccupantType.occupantCommentTitle) +
'"') +
(' form="' + formId + '"') +
(' aria-label="' + los.escapedAliases.Occupant + ' Comment Title"') +
' maxlength="50" />' +
'</div>' +
'</div>') +
'</td>' +
('<td>' +
('<form id="' + formId + '">') +
'<input name="lotOccupantTypeId" type="hidden"' +
(' value="' + lotOccupantType.lotOccupantTypeId.toString() + '"') +
' />' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</form>' +
'</td>') +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML(
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<div class="field">
<div class="control">
<input class="input" name="lotOccupantType" type="text"
value="${cityssm.escapeHTML(lotOccupantType.lotOccupantType)}"
form="${formId}"
aria-label="${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type" maxlength="100" required />
</div>
</div>
</td><td>
<div class="field has-addons">
<div class="control">
<span class="button is-static">fa-</span>
</div>
<div class="control">
<input class="input" name="fontAwesomeIconClass" type="text"
value="${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"
form="${formId}"
list="datalist--fontAwesomeIconClass" aria-label="Icon Name" maxlength="50" />
</div>
<div class="control">
<span class="button is-static">
<i class="fas fa-fw fa-${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"></i>
</span>
</div>
</div>
</td><td>
<div class="field">
<div class="control">
<input class="input" name="occupantCommentTitle" type="text"
value="${cityssm.escapeHTML(lotOccupantType.occupantCommentTitle)}"
form="${formId}"
aria-label="${los.escapedAliases.Occupant} Comment Title" maxlength="50" />
</div>
</div>
</td><td>
<form id="${formId}">
<input name="lotOccupantTypeId" type="hidden"
value="${lotOccupantType.lotOccupantTypeId.toString()}" />
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML(
'button--moveLotOccupantTypeUp',
'button--moveLotOccupantTypeDown',
false
) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteLotOccupantType"' +
' data-tooltip="Delete ' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type" type="button"' +
' aria-label="Delete ' +
los.escapedAliases.Lot +
' ' +
los.escapedAliases.Occupant +
' Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>'
)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteLotOccupantType"
data-tooltip="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type"
type="button"
aria-label="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`
const fontAwesomeInputElement = tableRowElement.querySelector(
"input[name='fontAwesomeIconClass']"
)!
) as HTMLInputElement
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon)
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon)
tableRowElement
.querySelector('form')!
.addEventListener('submit', updateLotOccupantType)
.querySelector('form')
?.addEventListener('submit', updateLotOccupantType)
;(
tableRowElement.querySelector(
'.button--moveLotOccupantTypeUp'
@ -273,8 +254,8 @@ function renderLotOccupantTypes(): void {
).addEventListener('click', moveLotOccupantType)
tableRowElement
.querySelector('.button--deleteLotOccupantType')!
.addEventListener('click', deleteLotOccupantType)
.querySelector('.button--deleteLotOccupantType')
?.addEventListener('click', deleteLotOccupantType)
containerElement.append(tableRowElement)
}
@ -287,16 +268,16 @@ function renderLotOccupantTypes(): void {
const formElement = submitEvent.currentTarget as HTMLFormElement
cityssm.postJSON(
los.urlPrefix + '/admin/doAddLotOccupantType',
`${los.urlPrefix}/admin/doAddLotOccupantType`,
formElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
lotOccupantTypes = responseJSON.lotOccupantTypes!
lotOccupantTypes = responseJSON.lotOccupantTypes
renderLotOccupantTypes()
formElement.reset()
formElement.querySelector('input')!.focus()
formElement.querySelector('input')?.focus()
} else {
bulmaJS.alert({
title: `Error Adding ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type`,

View File

@ -1,23 +1,24 @@
"use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
let lotStatuses = exports.lotStatuses;
delete exports.lotStatuses;
function updateLotStatus(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateLotStatus`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotStatuses = responseJSON.lotStatuses;
bulmaJS.alert({
message: los.escapedAliases.Lot + ' Status Updated Successfully',
message: `${los.escapedAliases.Lot} Status Updated Successfully`,
contextualColorName: 'success'
});
}
else {
bulmaJS.alert({
title: 'Error Updating ' + los.escapedAliases.Lot + ' Status',
title: `Error Updating ${los.escapedAliases.Lot} Status`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
@ -28,7 +29,7 @@ function deleteLotStatus(clickEvent) {
const tableRowElement = clickEvent.currentTarget.closest('tr');
const lotStatusId = tableRowElement.dataset.lotStatusId;
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteLotStatus', {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotStatus`, {
lotStatusId
}, (rawResponseJSON) => {
var _a;
@ -42,7 +43,7 @@ function deleteLotStatus(clickEvent) {
tableRowElement.remove();
}
bulmaJS.alert({
message: los.escapedAliases.Lot + ' Status Deleted Successfully',
message: `${los.escapedAliases.Lot} Status Deleted Successfully`,
contextualColorName: 'success'
});
}
@ -71,11 +72,9 @@ function moveLotStatus(clickEvent) {
const buttonElement = clickEvent.currentTarget;
const tableRowElement = buttonElement.closest('tr');
const lotStatusId = tableRowElement.dataset.lotStatusId;
cityssm.postJSON(los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
? 'doMoveLotStatusUp'
: 'doMoveLotStatusDown'), {
: 'doMoveLotStatusDown'}`, {
lotStatusId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
}, (rawResponseJSON) => {
@ -87,7 +86,7 @@ function moveLotStatus(clickEvent) {
}
else {
bulmaJS.alert({
title: 'Error Moving ' + los.escapedAliases.Lot + ' Status',
title: `Error Moving ${los.escapedAliases.Lot} Status`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
contextualColorName: 'danger'
});
@ -95,8 +94,10 @@ function moveLotStatus(clickEvent) {
});
}
function renderLotStatuses() {
var _a, _b;
const containerElement = document.querySelector('#container--lotStatuses');
if (lotStatuses.length === 0) {
// eslint-disable-next-line no-unsanitized/property
containerElement.innerHTML = `<tr><td colspan="2">
<div class="message is-warning"><p class="message-body">There are no active ${los.escapedAliases.lot} statuses.</p></div>
</td></tr>`;
@ -106,47 +107,41 @@ function renderLotStatuses() {
for (const lotStatus of lotStatuses) {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString();
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="lotStatusId" type="hidden" value="' +
lotStatus.lotStatusId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="lotStatus" type="text"' +
(' value="' + cityssm.escapeHTML(lotStatus.lotStatus) + '"') +
(' aria-label="' +
cityssm.escapeHTML(exports.aliases.lot) +
' Status"') +
' maxlength="100" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML('button--moveLotStatusUp', 'button--moveLotStatusDown', false) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>';
tableRowElement
.querySelector('form')
.addEventListener('submit', updateLotStatus);
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<form>
<input name="lotStatusId" type="hidden" value="${lotStatus.lotStatusId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="lotStatus" type="text"
value="${cityssm.escapeHTML(lotStatus.lotStatus)}"
aria-label="${los.escapedAliases.Lot} Status" maxlength="100" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>\
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML('button--moveLotStatusUp', 'button--moveLotStatusDown', false)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`;
(_a = tableRowElement
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateLotStatus);
tableRowElement.querySelector('.button--moveLotStatusUp').addEventListener('click', moveLotStatus);
tableRowElement.querySelector('.button--moveLotStatusDown').addEventListener('click', moveLotStatus);
tableRowElement
.querySelector('.button--deleteLotStatus')
.addEventListener('click', deleteLotStatus);
(_b = tableRowElement
.querySelector('.button--deleteLotStatus')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteLotStatus);
containerElement.append(tableRowElement);
}
}
@ -154,19 +149,19 @@ function renderLotStatuses() {
document.querySelector('#form--addLotStatus').addEventListener('submit', (submitEvent) => {
submitEvent.preventDefault();
const formElement = submitEvent.currentTarget;
cityssm.postJSON(los.urlPrefix + '/admin/doAddLotStatus', formElement, (rawResponseJSON) => {
var _a;
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotStatus`, formElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
lotStatuses = responseJSON.lotStatuses;
renderLotStatuses();
formElement.reset();
formElement.querySelector('input').focus();
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
}
else {
bulmaJS.alert({
title: `Error Adding ${los.escapedAliases.Lot} Status`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}

View File

@ -1,24 +1,25 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
import type * as globalTypes from '../../types/globalTypes'
import type * as recordTypes from '../../types/recordTypes'
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
import type { BulmaJS } from '@cityssm/bulma-js/types'
import type { LOS } from '../../types/globalTypes.js'
import type { LotStatus } from '../../types/recordTypes.js'
declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
declare const los: globalTypes.LOS
declare const los: LOS
declare const exports: Record<string, unknown>
let lotStatuses: recordTypes.LotStatus[] = exports.lotStatuses
let lotStatuses = exports.lotStatuses as LotStatus[]
delete exports.lotStatuses
type ResponseJSON =
| {
success: true
lotStatuses: recordTypes.LotStatus[]
lotStatuses: LotStatus[]
}
| {
success: false
@ -29,21 +30,21 @@ function updateLotStatus(submitEvent: SubmitEvent): void {
submitEvent.preventDefault()
cityssm.postJSON(
los.urlPrefix + '/admin/doUpdateLotStatus',
`${los.urlPrefix}/admin/doUpdateLotStatus`,
submitEvent.currentTarget,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
lotStatuses = responseJSON.lotStatuses!
lotStatuses = responseJSON.lotStatuses
bulmaJS.alert({
message: los.escapedAliases.Lot + ' Status Updated Successfully',
message: `${los.escapedAliases.Lot} Status Updated Successfully`,
contextualColorName: 'success'
})
} else {
bulmaJS.alert({
title: 'Error Updating ' + los.escapedAliases.Lot + ' Status',
title: `Error Updating ${los.escapedAliases.Lot} Status`,
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
@ -55,13 +56,13 @@ function updateLotStatus(submitEvent: SubmitEvent): void {
function deleteLotStatus(clickEvent: Event): void {
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
'tr'
)!
) as HTMLTableRowElement
const lotStatusId = tableRowElement.dataset.lotStatusId
function doDelete(): void {
cityssm.postJSON(
los.urlPrefix + '/admin/doDeleteLotStatus',
`${los.urlPrefix}/admin/doDeleteLotStatus`,
{
lotStatusId
},
@ -69,7 +70,7 @@ function deleteLotStatus(clickEvent: Event): void {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
lotStatuses = responseJSON.lotStatuses!
lotStatuses = responseJSON.lotStatuses
if (lotStatuses.length === 0) {
renderLotStatuses()
@ -78,7 +79,7 @@ function deleteLotStatus(clickEvent: Event): void {
}
bulmaJS.alert({
message: los.escapedAliases.Lot + ' Status Deleted Successfully',
message: `${los.escapedAliases.Lot} Status Deleted Successfully`,
contextualColorName: 'success'
})
} else {
@ -108,16 +109,16 @@ function deleteLotStatus(clickEvent: Event): void {
function moveLotStatus(clickEvent: MouseEvent): void {
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
const tableRowElement = buttonElement.closest('tr')!
const tableRowElement = buttonElement.closest('tr') as HTMLTableRowElement
const lotStatusId = tableRowElement.dataset.lotStatusId
cityssm.postJSON(
los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
`${los.urlPrefix}/admin/${
buttonElement.dataset.direction === 'up'
? 'doMoveLotStatusUp'
: 'doMoveLotStatusDown'),
: 'doMoveLotStatusDown'
}`,
{
lotStatusId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
@ -126,11 +127,11 @@ function moveLotStatus(clickEvent: MouseEvent): void {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
lotStatuses = responseJSON.lotStatuses!
lotStatuses = responseJSON.lotStatuses
renderLotStatuses()
} else {
bulmaJS.alert({
title: 'Error Moving ' + los.escapedAliases.Lot + ' Status',
title: `Error Moving ${los.escapedAliases.Lot} Status`,
message: responseJSON.errorMessage ?? '',
contextualColorName: 'danger'
})
@ -145,6 +146,7 @@ function renderLotStatuses(): void {
) as HTMLTableSectionElement
if (lotStatuses.length === 0) {
// eslint-disable-next-line no-unsanitized/property
containerElement.innerHTML = `<tr><td colspan="2">
<div class="message is-warning"><p class="message-body">There are no active ${los.escapedAliases.lot} statuses.</p></div>
</td></tr>`
@ -159,47 +161,43 @@ function renderLotStatuses(): void {
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString()
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="lotStatusId" type="hidden" value="' +
lotStatus.lotStatusId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="lotStatus" type="text"' +
(' value="' + cityssm.escapeHTML(lotStatus.lotStatus) + '"') +
(' aria-label="' +
cityssm.escapeHTML(exports.aliases.lot) +
' Status"') +
' maxlength="100" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML(
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<form>
<input name="lotStatusId" type="hidden" value="${lotStatus.lotStatusId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="lotStatus" type="text"
value="${cityssm.escapeHTML(lotStatus.lotStatus)}"
aria-label="${los.escapedAliases.Lot} Status" maxlength="100" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>\
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML(
'button--moveLotStatusUp',
'button--moveLotStatusDown',
false
) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>'
)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`
tableRowElement
.querySelector('form')!
.addEventListener('submit', updateLotStatus)
.querySelector('form')
?.addEventListener('submit', updateLotStatus)
;(
tableRowElement.querySelector(
'.button--moveLotStatusUp'
@ -212,8 +210,8 @@ function renderLotStatuses(): void {
).addEventListener('click', moveLotStatus)
tableRowElement
.querySelector('.button--deleteLotStatus')!
.addEventListener('click', deleteLotStatus)
.querySelector('.button--deleteLotStatus')
?.addEventListener('click', deleteLotStatus)
containerElement.append(tableRowElement)
}
@ -226,16 +224,16 @@ function renderLotStatuses(): void {
const formElement = submitEvent.currentTarget as HTMLFormElement
cityssm.postJSON(
los.urlPrefix + '/admin/doAddLotStatus',
`${los.urlPrefix}/admin/doAddLotStatus`,
formElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
lotStatuses = responseJSON.lotStatuses!
lotStatuses = responseJSON.lotStatuses
renderLotStatuses()
formElement.reset()
formElement.querySelector('input')!.focus()
formElement.querySelector('input')?.focus()
} else {
bulmaJS.alert({
title: `Error Adding ${los.escapedAliases.Lot} Status`,

View File

@ -1,11 +1,12 @@
"use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
let workOrderMilestoneTypes = exports.workOrderMilestoneTypes;
delete exports.workOrderMilestoneTypes;
function updateWorkOrderMilestoneType(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateWorkOrderMilestoneType', submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateWorkOrderMilestoneType`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
@ -28,7 +29,7 @@ function deleteWorkOrderMilestoneType(clickEvent) {
const tableRowElement = clickEvent.currentTarget.closest('tr');
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteWorkOrderMilestoneType', {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteWorkOrderMilestoneType`, {
workOrderMilestoneTypeId
}, (rawResponseJSON) => {
var _a;
@ -71,11 +72,9 @@ function moveWorkOrderMilestoneType(clickEvent) {
const buttonElement = clickEvent.currentTarget;
const tableRowElement = buttonElement.closest('tr');
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
cityssm.postJSON(los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
? 'doMoveWorkOrderMilestoneTypeUp'
: 'doMoveWorkOrderMilestoneTypeDown'), {
: 'doMoveWorkOrderMilestoneTypeDown'}`, {
workOrderMilestoneTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
}, (rawResponseJSON) => {
@ -95,6 +94,7 @@ function moveWorkOrderMilestoneType(clickEvent) {
});
}
function renderWorkOrderMilestoneTypes() {
var _a, _b;
const containerElement = document.querySelector('#container--workOrderMilestoneTypes');
if (workOrderMilestoneTypes.length === 0) {
containerElement.innerHTML = `<tr><td colspan="2">
@ -107,44 +107,40 @@ function renderWorkOrderMilestoneTypes() {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.workOrderMilestoneTypeId =
workOrderMilestoneType.workOrderMilestoneTypeId.toString();
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="workOrderMilestoneTypeId" type="hidden" value="' +
workOrderMilestoneType.workOrderMilestoneTypeId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="workOrderMilestoneType" type="text" value="' +
cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType) +
'" maxlength="100" aria-label="Work Order Milestone Type" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderMilestoneTypeUp', 'button--moveWorkOrderMilestoneTypeDown', false) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>';
tableRowElement
.querySelector('form')
.addEventListener('submit', updateWorkOrderMilestoneType);
// eslint-disable-next-line no-unsanitized/property, no-secrets/no-secrets
tableRowElement.innerHTML = `<td>
<form>
<input name="workOrderMilestoneTypeId" type="hidden" value="${workOrderMilestoneType.workOrderMilestoneTypeId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="workOrderMilestoneType" type="text"
value="${cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType)}" maxlength="100" aria-label="Work Order Milestone Type" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderMilestoneTypeUp', 'button--moveWorkOrderMilestoneTypeDown', false)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`;
(_a = tableRowElement
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateWorkOrderMilestoneType);
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeUp').addEventListener('click', moveWorkOrderMilestoneType);
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeDown').addEventListener('click', moveWorkOrderMilestoneType);
tableRowElement
.querySelector('.button--deleteWorkOrderMilestoneType')
.addEventListener('click', deleteWorkOrderMilestoneType);
(_b = tableRowElement
.querySelector('.button--deleteWorkOrderMilestoneType')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteWorkOrderMilestoneType);
containerElement.append(tableRowElement);
}
}
@ -152,19 +148,19 @@ function renderWorkOrderMilestoneTypes() {
document.querySelector('#form--addWorkOrderMilestoneType').addEventListener('submit', (submitEvent) => {
submitEvent.preventDefault();
const formElement = submitEvent.currentTarget;
cityssm.postJSON(los.urlPrefix + '/admin/doAddWorkOrderMilestoneType', formElement, (rawResponseJSON) => {
var _a;
cityssm.postJSON(`${los.urlPrefix}/admin/doAddWorkOrderMilestoneType`, formElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes;
renderWorkOrderMilestoneTypes();
formElement.reset();
formElement.querySelector('input').focus();
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
}
else {
bulmaJS.alert({
title: 'Error Adding Work Order Milestone Type',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}

View File

@ -1,25 +1,26 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
import type * as globalTypes from '../../types/globalTypes'
import type * as recordTypes from '../../types/recordTypes'
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
import type { BulmaJS } from '@cityssm/bulma-js/types'
import type { LOS } from '../../types/globalTypes.js'
import type { WorkOrderMilestoneType } from '../../types/recordTypes.js'
declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
declare const los: globalTypes.LOS
declare const los: LOS
declare const exports: Record<string, unknown>
let workOrderMilestoneTypes: recordTypes.WorkOrderMilestoneType[] =
exports.workOrderMilestoneTypes
let workOrderMilestoneTypes =
exports.workOrderMilestoneTypes as WorkOrderMilestoneType[]
delete exports.workOrderMilestoneTypes
type ResponseJSON =
| {
success: true
workOrderMilestoneTypes: recordTypes.WorkOrderMilestoneType[]
workOrderMilestoneTypes: WorkOrderMilestoneType[]
}
| {
success: false
@ -30,13 +31,13 @@ function updateWorkOrderMilestoneType(submitEvent: SubmitEvent): void {
submitEvent.preventDefault()
cityssm.postJSON(
los.urlPrefix + '/admin/doUpdateWorkOrderMilestoneType',
`${los.urlPrefix}/admin/doUpdateWorkOrderMilestoneType`,
submitEvent.currentTarget,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes!
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes
bulmaJS.alert({
message: 'Work Order Milestone Type Updated Successfully',
@ -56,14 +57,14 @@ function updateWorkOrderMilestoneType(submitEvent: SubmitEvent): void {
function deleteWorkOrderMilestoneType(clickEvent: Event): void {
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
'tr'
)!
) as HTMLTableRowElement
const workOrderMilestoneTypeId =
tableRowElement.dataset.workOrderMilestoneTypeId
function doDelete(): void {
cityssm.postJSON(
los.urlPrefix + '/admin/doDeleteWorkOrderMilestoneType',
`${los.urlPrefix}/admin/doDeleteWorkOrderMilestoneType`,
{
workOrderMilestoneTypeId
},
@ -71,7 +72,7 @@ function deleteWorkOrderMilestoneType(clickEvent: Event): void {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes!
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes
if (workOrderMilestoneTypes.length === 0) {
renderWorkOrderMilestoneTypes()
@ -110,17 +111,17 @@ function deleteWorkOrderMilestoneType(clickEvent: Event): void {
function moveWorkOrderMilestoneType(clickEvent: MouseEvent): void {
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
const tableRowElement = buttonElement.closest('tr')!
const tableRowElement = buttonElement.closest('tr') as HTMLTableRowElement
const workOrderMilestoneTypeId =
tableRowElement.dataset.workOrderMilestoneTypeId
cityssm.postJSON(
los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
`${los.urlPrefix}/admin/${
buttonElement.dataset.direction === 'up'
? 'doMoveWorkOrderMilestoneTypeUp'
: 'doMoveWorkOrderMilestoneTypeDown'),
: 'doMoveWorkOrderMilestoneTypeDown'
}`,
{
workOrderMilestoneTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
@ -129,7 +130,7 @@ function moveWorkOrderMilestoneType(clickEvent: MouseEvent): void {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes!
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes
renderWorkOrderMilestoneTypes()
} else {
bulmaJS.alert({
@ -163,44 +164,42 @@ function renderWorkOrderMilestoneTypes(): void {
tableRowElement.dataset.workOrderMilestoneTypeId =
workOrderMilestoneType.workOrderMilestoneTypeId.toString()
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="workOrderMilestoneTypeId" type="hidden" value="' +
workOrderMilestoneType.workOrderMilestoneTypeId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="workOrderMilestoneType" type="text" value="' +
cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType) +
'" maxlength="100" aria-label="Work Order Milestone Type" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML(
// eslint-disable-next-line no-unsanitized/property, no-secrets/no-secrets
tableRowElement.innerHTML = `<td>
<form>
<input name="workOrderMilestoneTypeId" type="hidden" value="${workOrderMilestoneType.workOrderMilestoneTypeId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="workOrderMilestoneType" type="text"
value="${cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType)}" maxlength="100" aria-label="Work Order Milestone Type" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML(
'button--moveWorkOrderMilestoneTypeUp',
'button--moveWorkOrderMilestoneTypeDown',
false
) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>'
)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`
tableRowElement
.querySelector('form')!
.addEventListener('submit', updateWorkOrderMilestoneType)
.querySelector('form')
?.addEventListener('submit', updateWorkOrderMilestoneType)
;(
tableRowElement.querySelector(
'.button--moveWorkOrderMilestoneTypeUp'
@ -213,8 +212,8 @@ function renderWorkOrderMilestoneTypes(): void {
).addEventListener('click', moveWorkOrderMilestoneType)
tableRowElement
.querySelector('.button--deleteWorkOrderMilestoneType')!
.addEventListener('click', deleteWorkOrderMilestoneType)
.querySelector('.button--deleteWorkOrderMilestoneType')
?.addEventListener('click', deleteWorkOrderMilestoneType)
containerElement.append(tableRowElement)
}
@ -227,16 +226,16 @@ function renderWorkOrderMilestoneTypes(): void {
const formElement = submitEvent.currentTarget as HTMLFormElement
cityssm.postJSON(
los.urlPrefix + '/admin/doAddWorkOrderMilestoneType',
`${los.urlPrefix}/admin/doAddWorkOrderMilestoneType`,
formElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes!
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes
renderWorkOrderMilestoneTypes()
formElement.reset()
formElement.querySelector('input')!.focus()
formElement.querySelector('input')?.focus()
} else {
bulmaJS.alert({
title: 'Error Adding Work Order Milestone Type',

View File

@ -1,11 +1,12 @@
"use strict";
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
let workOrderTypes = exports.workOrderTypes;
delete exports.workOrderTypes;
function updateWorkOrderType(submitEvent) {
submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateWorkOrderType', submitEvent.currentTarget, (rawResponseJSON) => {
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateWorkOrderType`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
@ -24,11 +25,11 @@ function updateWorkOrderType(submitEvent) {
}
});
}
const deleteWorkOrderType = (clickEvent) => {
function deleteWorkOrderType(clickEvent) {
const tableRowElement = clickEvent.currentTarget.closest('tr');
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
function doDelete() {
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteWorkOrderType', {
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteWorkOrderType`, {
workOrderTypeId
}, (rawResponseJSON) => {
var _a;
@ -66,16 +67,14 @@ const deleteWorkOrderType = (clickEvent) => {
callbackFunction: doDelete
}
});
};
}
function moveWorkOrderType(clickEvent) {
const buttonElement = clickEvent.currentTarget;
const tableRowElement = buttonElement.closest('tr');
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
cityssm.postJSON(los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
? 'doMoveWorkOrderTypeUp'
: 'doMoveWorkOrderTypeDown'), {
: 'doMoveWorkOrderTypeDown'}`, {
workOrderTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
}, (rawResponseJSON) => {
@ -95,7 +94,7 @@ function moveWorkOrderType(clickEvent) {
});
}
function renderWorkOrderTypes() {
var _a;
var _a, _b, _c;
const containerElement = document.querySelector('#container--workOrderTypes');
if (workOrderTypes.length === 0) {
containerElement.innerHTML = `<tr><td colspan="2">
@ -108,44 +107,40 @@ function renderWorkOrderTypes() {
const tableRowElement = document.createElement('tr');
tableRowElement.dataset.workOrderTypeId =
workOrderType.workOrderTypeId.toString();
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="workOrderTypeId" type="hidden" value="' +
workOrderType.workOrderTypeId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="workOrderType" type="text" value="' +
cityssm.escapeHTML((_a = workOrderType.workOrderType) !== null && _a !== void 0 ? _a : '') +
'" maxlength="100" aria-label="Work Order Type" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderTypeUp', 'button--moveWorkOrderTypeDown', false) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>';
tableRowElement
.querySelector('form')
.addEventListener('submit', updateWorkOrderType);
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<form>
<input name="workOrderTypeId" type="hidden" value="${workOrderType.workOrderTypeId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="workOrderType" type="text"
value="${cityssm.escapeHTML((_a = workOrderType.workOrderType) !== null && _a !== void 0 ? _a : '')}" maxlength="100" aria-label="Work Order Type" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderTypeUp', 'button--moveWorkOrderTypeDown', false)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`;
(_b = tableRowElement
.querySelector('form')) === null || _b === void 0 ? void 0 : _b.addEventListener('submit', updateWorkOrderType);
tableRowElement.querySelector('.button--moveWorkOrderTypeUp').addEventListener('click', moveWorkOrderType);
tableRowElement.querySelector('.button--moveWorkOrderTypeDown').addEventListener('click', moveWorkOrderType);
tableRowElement
.querySelector('.button--deleteWorkOrderType')
.addEventListener('click', deleteWorkOrderType);
(_c = tableRowElement
.querySelector('.button--deleteWorkOrderType')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', deleteWorkOrderType);
containerElement.append(tableRowElement);
}
}
@ -153,19 +148,19 @@ function renderWorkOrderTypes() {
document.querySelector('#form--addWorkOrderType').addEventListener('submit', (submitEvent) => {
submitEvent.preventDefault();
const formElement = submitEvent.currentTarget;
cityssm.postJSON(los.urlPrefix + '/admin/doAddWorkOrderType', formElement, (rawResponseJSON) => {
var _a;
cityssm.postJSON(`${los.urlPrefix}/admin/doAddWorkOrderType`, formElement, (rawResponseJSON) => {
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
workOrderTypes = responseJSON.workOrderTypes;
renderWorkOrderTypes();
formElement.reset();
formElement.querySelector('input').focus();
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
}
else {
bulmaJS.alert({
title: 'Error Adding Work Order Type',
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}

View File

@ -1,24 +1,25 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
import type * as globalTypes from '../../types/globalTypes'
import type * as recordTypes from '../../types/recordTypes'
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
import type { BulmaJS } from '@cityssm/bulma-js/types'
import type { LOS } from '../../types/globalTypes.js'
import type { WorkOrderType } from '../../types/recordTypes.js'
declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
declare const los: globalTypes.LOS
declare const los: LOS
declare const exports: Record<string, unknown>
let workOrderTypes: recordTypes.WorkOrderType[] = exports.workOrderTypes
let workOrderTypes = exports.workOrderTypes as WorkOrderType[]
delete exports.workOrderTypes
type ResponseJSON =
| {
success: true
workOrderTypes: recordTypes.WorkOrderType[]
workOrderTypes: WorkOrderType[]
}
| {
success: false
@ -29,13 +30,13 @@ function updateWorkOrderType(submitEvent: SubmitEvent): void {
submitEvent.preventDefault()
cityssm.postJSON(
los.urlPrefix + '/admin/doUpdateWorkOrderType',
`${los.urlPrefix}/admin/doUpdateWorkOrderType`,
submitEvent.currentTarget,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
workOrderTypes = responseJSON.workOrderTypes!
workOrderTypes = responseJSON.workOrderTypes
bulmaJS.alert({
message: 'Work Order Type Updated Successfully',
@ -52,16 +53,16 @@ function updateWorkOrderType(submitEvent: SubmitEvent): void {
)
}
const deleteWorkOrderType = (clickEvent: Event): void => {
function deleteWorkOrderType(clickEvent: Event): void {
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
'tr'
)!
) as HTMLTableRowElement
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId
function doDelete(): void {
cityssm.postJSON(
los.urlPrefix + '/admin/doDeleteWorkOrderType',
`${los.urlPrefix}/admin/doDeleteWorkOrderType`,
{
workOrderTypeId
},
@ -69,7 +70,7 @@ const deleteWorkOrderType = (clickEvent: Event): void => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
workOrderTypes = responseJSON.workOrderTypes!
workOrderTypes = responseJSON.workOrderTypes
if (workOrderTypes.length === 0) {
renderWorkOrderTypes()
@ -108,16 +109,16 @@ const deleteWorkOrderType = (clickEvent: Event): void => {
function moveWorkOrderType(clickEvent: MouseEvent): void {
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
const tableRowElement = buttonElement.closest('tr')!
const tableRowElement = buttonElement.closest('tr') as HTMLTableRowElement
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId
cityssm.postJSON(
los.urlPrefix +
'/admin/' +
(buttonElement.dataset.direction === 'up'
`${los.urlPrefix}/admin/${
buttonElement.dataset.direction === 'up'
? 'doMoveWorkOrderTypeUp'
: 'doMoveWorkOrderTypeDown'),
: 'doMoveWorkOrderTypeDown'
}`,
{
workOrderTypeId,
moveToEnd: clickEvent.shiftKey ? '1' : '0'
@ -126,7 +127,7 @@ function moveWorkOrderType(clickEvent: MouseEvent): void {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
workOrderTypes = responseJSON.workOrderTypes!
workOrderTypes = responseJSON.workOrderTypes
renderWorkOrderTypes()
} else {
bulmaJS.alert({
@ -160,44 +161,42 @@ function renderWorkOrderTypes(): void {
tableRowElement.dataset.workOrderTypeId =
workOrderType.workOrderTypeId.toString()
tableRowElement.innerHTML =
'<td>' +
'<form>' +
'<input name="workOrderTypeId" type="hidden" value="' +
workOrderType.workOrderTypeId.toString() +
'" />' +
('<div class="field has-addons">' +
'<div class="control">' +
'<input class="input" name="workOrderType" type="text" value="' +
cityssm.escapeHTML(workOrderType.workOrderType ?? '') +
'" maxlength="100" aria-label="Work Order Type" required />' +
'</div>' +
'<div class="control">' +
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
'</div>' +
'</div>') +
'</form>' +
'</td>' +
'<td class="is-nowrap">' +
'<div class="field is-grouped">' +
'<div class="control">' +
los.getMoveUpDownButtonFieldHTML(
// eslint-disable-next-line no-unsanitized/property
tableRowElement.innerHTML = `<td>
<form>
<input name="workOrderTypeId" type="hidden" value="${workOrderType.workOrderTypeId.toString()}" />
<div class="field has-addons">
<div class="control">
<input class="input" name="workOrderType" type="text"
value="${cityssm.escapeHTML(workOrderType.workOrderType ?? '')}" maxlength="100" aria-label="Work Order Type" required />
</div>
<div class="control">
<button class="button is-success" type="submit" aria-label="Save">
<i class="fas fa-save" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</td><td class="is-nowrap">
<div class="field is-grouped">
<div class="control">
${los.getMoveUpDownButtonFieldHTML(
'button--moveWorkOrderTypeUp',
'button--moveWorkOrderTypeDown',
false
) +
'</div>' +
'<div class="control">' +
'<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">' +
'<i class="fas fa-trash" aria-hidden="true"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</td>'
)}
</div>
<div class="control">
<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
</div>
</td>`
tableRowElement
.querySelector('form')!
.addEventListener('submit', updateWorkOrderType)
.querySelector('form')
?.addEventListener('submit', updateWorkOrderType)
;(
tableRowElement.querySelector(
'.button--moveWorkOrderTypeUp'
@ -210,8 +209,8 @@ function renderWorkOrderTypes(): void {
).addEventListener('click', moveWorkOrderType)
tableRowElement
.querySelector('.button--deleteWorkOrderType')!
.addEventListener('click', deleteWorkOrderType)
.querySelector('.button--deleteWorkOrderType')
?.addEventListener('click', deleteWorkOrderType)
containerElement.append(tableRowElement)
}
@ -224,16 +223,16 @@ function renderWorkOrderTypes(): void {
const formElement = submitEvent.currentTarget as HTMLFormElement
cityssm.postJSON(
los.urlPrefix + '/admin/doAddWorkOrderType',
`${los.urlPrefix}/admin/doAddWorkOrderType`,
formElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as ResponseJSON
if (responseJSON.success) {
workOrderTypes = responseJSON.workOrderTypes!
workOrderTypes = responseJSON.workOrderTypes
renderWorkOrderTypes()
formElement.reset()
formElement.querySelector('input')!.focus()
formElement.querySelector('input')?.focus()
} else {
bulmaJS.alert({
title: 'Error Adding Work Order Type',

View File

@ -1586,7 +1586,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
}
;
lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = `\$${transactionGrandTotal.toFixed(2)}`;
lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = `$${transactionGrandTotal.toFixed(2)}`;
const feeGrandTotal = getFeeGrandTotal();
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `<div class="message is-warning">

View File

@ -514,7 +514,7 @@ function renderLotOccupancyTransactions() {
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
}
;
lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = `\$${transactionGrandTotal.toFixed(2)}`;
lotOccupancyTransactionsContainerElement.querySelector('#lotOccupancyTransactions--grandTotal').textContent = `$${transactionGrandTotal.toFixed(2)}`;
const feeGrandTotal = getFeeGrandTotal();
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `<div class="message is-warning">

View File

@ -784,7 +784,7 @@ function renderLotOccupancyTransactions(): void {
lotOccupancyTransactionsContainerElement.querySelector(
'#lotOccupancyTransactions--grandTotal'
) as HTMLElement
).textContent = `\$${transactionGrandTotal.toFixed(2)}`
).textContent = `$${transactionGrandTotal.toFixed(2)}`
const feeGrandTotal = getFeeGrandTotal()

View File

@ -245,7 +245,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
addLot(lotId);
}
function renderRelatedOccupancies() {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
const occupanciesContainerElement = document.querySelector('#container--lotOccupancies');
document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent = workOrderLotOccupancies.length.toString();
if (workOrderLotOccupancies.length === 0) {
@ -311,14 +311,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
let occupantsHTML = '';
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
occupantsHTML += `<li class="has-tooltip-left"
data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType)}">
data-tooltip="${cityssm.escapeHTML((_c = occupant.lotOccupantType) !== null && _c !== void 0 ? _c : '')}">
<span class="fa-li">
<i class="fas fa-fw fa-${cityssm.escapeHTML(((_c = occupant.fontAwesomeIconClass) !== null && _c !== void 0 ? _c : '') === ''
<i class="fas fa-fw fa-${cityssm.escapeHTML(((_d = occupant.fontAwesomeIconClass) !== null && _d !== void 0 ? _d : '') === ''
? 'user'
: occupant.fontAwesomeIconClass)}" aria-label="${los.escapedAliases.Occupant}"></i>
: (_e = occupant.fontAwesomeIconClass) !== null && _e !== void 0 ? _e : '')}" aria-label="${los.escapedAliases.Occupant}"></i>
</span>
${cityssm.escapeHTML(occupant.occupantName)}
${cityssm.escapeHTML(occupant.occupantFamilyName)}
${cityssm.escapeHTML((_f = occupant.occupantName) !== null && _f !== void 0 ? _f : '')}
${cityssm.escapeHTML((_g = occupant.occupantFamilyName) !== null && _g !== void 0 ? _g : '')}
</li>`;
}
// eslint-disable-next-line no-unsanitized/method
@ -337,11 +337,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</td>`);
(_d = rowElement
.querySelector('.button--addLot')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', addLotFromLotOccupancy);
(_e = rowElement
.querySelector('.button--deleteLotOccupancy')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancy);
(_f = occupanciesContainerElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(rowElement);
(_h = rowElement
.querySelector('.button--addLot')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', addLotFromLotOccupancy);
(_j = rowElement
.querySelector('.button--deleteLotOccupancy')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', deleteLotOccupancy);
(_k = occupanciesContainerElement.querySelector('tbody')) === null || _k === void 0 ? void 0 : _k.append(rowElement);
}
}
function openEditLotStatus(clickEvent) {

View File

@ -4,15 +4,15 @@
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type * as globalTypes from '../../types/globalTypes.js'
import type * as recordTypes from '../../types/recordTypes.js'
import type { LOS } from '../../types/globalTypes.js'
import type { WorkOrderMilestone, WorkOrderMilestoneType } from '../../types/recordTypes.js'
declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
declare const exports: Record<string, unknown>
;(() => {
const los = exports.los as globalTypes.LOS
const los = exports.los as LOS
const workOrderId = (
document.querySelector('#workOrderEdit--workOrderId') as HTMLInputElement
@ -147,7 +147,7 @@ declare const exports: Record<string, unknown>
)
}
let workOrderMilestones: recordTypes.WorkOrderMilestone[]
let workOrderMilestones: WorkOrderMilestone[]
document
.querySelector('#button--closeWorkOrder')
@ -257,7 +257,7 @@ declare const exports: Record<string, unknown>
},
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
workOrderMilestones: recordTypes.WorkOrderMilestone[]
workOrderMilestones: WorkOrderMilestone[]
}
const workOrderMilestones = responseJSON.workOrderMilestones.filter(
@ -309,7 +309,7 @@ declare const exports: Record<string, unknown>
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
workOrderMilestones: recordTypes.WorkOrderMilestone[]
workOrderMilestones: WorkOrderMilestone[]
}
if (responseJSON.success) {
@ -340,7 +340,7 @@ declare const exports: Record<string, unknown>
const workOrderMilestone = workOrderMilestones.find((currentMilestone) => {
return currentMilestone.workOrderMilestoneId === workOrderMilestoneId
}) as recordTypes.WorkOrderMilestone
}) as WorkOrderMilestone
function doComplete(): void {
cityssm.postJSON(
@ -449,7 +449,7 @@ declare const exports: Record<string, unknown>
const workOrderMilestone = workOrderMilestones.find((currentMilestone) => {
return currentMilestone.workOrderMilestoneId === workOrderMilestoneId
}) as recordTypes.WorkOrderMilestone
}) as WorkOrderMilestone
let editCloseModalFunction: () => void
let workOrderMilestoneDateStringElement: HTMLInputElement
@ -464,7 +464,7 @@ declare const exports: Record<string, unknown>
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
workOrderMilestones?: recordTypes.WorkOrderMilestone[]
workOrderMilestones?: WorkOrderMilestone[]
}
processMilestoneResponse(responseJSON)
@ -494,7 +494,7 @@ declare const exports: Record<string, unknown>
let milestoneTypeFound = false
for (const milestoneType of exports.workOrderMilestoneTypes as recordTypes.WorkOrderMilestoneType[]) {
for (const milestoneType of exports.workOrderMilestoneTypes as WorkOrderMilestoneType[]) {
const optionElement = document.createElement('option')
optionElement.value =
@ -517,11 +517,15 @@ declare const exports: Record<string, unknown>
workOrderMilestone.workOrderMilestoneTypeId
) {
const optionElement = document.createElement('option')
optionElement.value =
workOrderMilestone.workOrderMilestoneTypeId.toString()
optionElement.textContent =
workOrderMilestone.workOrderMilestoneType ?? ''
optionElement.selected = true
milestoneTypeElement.append(optionElement)
}
@ -683,7 +687,7 @@ declare const exports: Record<string, unknown>
if (!isCreate) {
workOrderMilestones =
exports.workOrderMilestones as recordTypes.WorkOrderMilestone[]
exports.workOrderMilestones as WorkOrderMilestone[]
delete exports.workOrderMilestones
renderMilestones()
@ -710,7 +714,7 @@ declare const exports: Record<string, unknown>
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
workOrderMilestones?: recordTypes.WorkOrderMilestone[]
workOrderMilestones?: WorkOrderMilestone[]
}
processMilestoneResponse(responseJSON)
@ -755,7 +759,7 @@ declare const exports: Record<string, unknown>
'#milestoneAdd--workOrderMilestoneTypeId'
) as HTMLSelectElement
for (const milestoneType of exports.workOrderMilestoneTypes as recordTypes.WorkOrderMilestoneType[]) {
for (const milestoneType of exports.workOrderMilestoneTypes as WorkOrderMilestoneType[]) {
const optionElement = document.createElement('option')
optionElement.value =

View File

@ -91,7 +91,7 @@ function addLotFromLotOccupancy(clickEvent) {
addLot(lotId);
}
function renderRelatedOccupancies() {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
const occupanciesContainerElement = document.querySelector('#container--lotOccupancies');
document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent = workOrderLotOccupancies.length.toString();
if (workOrderLotOccupancies.length === 0) {
@ -157,14 +157,14 @@ function renderRelatedOccupancies() {
let occupantsHTML = '';
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
occupantsHTML += `<li class="has-tooltip-left"
data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType)}">
data-tooltip="${cityssm.escapeHTML((_c = occupant.lotOccupantType) !== null && _c !== void 0 ? _c : '')}">
<span class="fa-li">
<i class="fas fa-fw fa-${cityssm.escapeHTML(((_c = occupant.fontAwesomeIconClass) !== null && _c !== void 0 ? _c : '') === ''
<i class="fas fa-fw fa-${cityssm.escapeHTML(((_d = occupant.fontAwesomeIconClass) !== null && _d !== void 0 ? _d : '') === ''
? 'user'
: occupant.fontAwesomeIconClass)}" aria-label="${los.escapedAliases.Occupant}"></i>
: (_e = occupant.fontAwesomeIconClass) !== null && _e !== void 0 ? _e : '')}" aria-label="${los.escapedAliases.Occupant}"></i>
</span>
${cityssm.escapeHTML(occupant.occupantName)}
${cityssm.escapeHTML(occupant.occupantFamilyName)}
${cityssm.escapeHTML((_f = occupant.occupantName) !== null && _f !== void 0 ? _f : '')}
${cityssm.escapeHTML((_g = occupant.occupantFamilyName) !== null && _g !== void 0 ? _g : '')}
</li>`;
}
// eslint-disable-next-line no-unsanitized/method
@ -183,11 +183,11 @@ function renderRelatedOccupancies() {
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</td>`);
(_d = rowElement
.querySelector('.button--addLot')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', addLotFromLotOccupancy);
(_e = rowElement
.querySelector('.button--deleteLotOccupancy')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancy);
(_f = occupanciesContainerElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(rowElement);
(_h = rowElement
.querySelector('.button--addLot')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', addLotFromLotOccupancy);
(_j = rowElement
.querySelector('.button--deleteLotOccupancy')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', deleteLotOccupancy);
(_k = occupanciesContainerElement.querySelector('tbody')) === null || _k === void 0 ? void 0 : _k.append(rowElement);
}
}
function openEditLotStatus(clickEvent) {

View File

@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
import type { LOS } from '../../types/globalTypes.js'
import type * as recordTypes from '../../types/recordTypes.js'
import type { Lot, LotOccupancy, LotStatus } from '../../types/recordTypes.js'
declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
@ -15,11 +15,10 @@ declare const los: LOS
declare const workOrderId: string
let workOrderLots = exports.workOrderLots as recordTypes.Lot[]
let workOrderLots = exports.workOrderLots as Lot[]
delete exports.workOrderLots
let workOrderLotOccupancies =
exports.workOrderLotOccupancies as recordTypes.LotOccupancy[]
let workOrderLotOccupancies = exports.workOrderLotOccupancies as LotOccupancy[]
delete exports.workOrderLotOccupancies
function deleteLotOccupancy(clickEvent: Event): void {
@ -40,7 +39,7 @@ function deleteLotOccupancy(clickEvent: Event): void {
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
workOrderLotOccupancies: recordTypes.LotOccupancy[]
workOrderLotOccupancies: LotOccupancy[]
}
if (responseJSON.success) {
@ -82,7 +81,7 @@ function addLot(
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
workOrderLots: recordTypes.Lot[]
workOrderLots: Lot[]
}
if (responseJSON.success) {
@ -117,7 +116,7 @@ function addLotOccupancy(
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
workOrderLotOccupancies: recordTypes.LotOccupancy[]
workOrderLotOccupancies: LotOccupancy[]
}
if (responseJSON.success) {
@ -239,16 +238,16 @@ function renderRelatedOccupancies(): void {
for (const occupant of lotOccupancy.lotOccupancyOccupants!) {
occupantsHTML += `<li class="has-tooltip-left"
data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType!)}">
data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType ?? '')}">
<span class="fa-li">
<i class="fas fa-fw fa-${cityssm.escapeHTML(
(occupant.fontAwesomeIconClass ?? '') === ''
? 'user'
: occupant.fontAwesomeIconClass!
: occupant.fontAwesomeIconClass ?? ''
)}" aria-label="${los.escapedAliases.Occupant}"></i>
</span>
${cityssm.escapeHTML(occupant.occupantName!)}
${cityssm.escapeHTML(occupant.occupantFamilyName!)}
${cityssm.escapeHTML(occupant.occupantName ?? '')}
${cityssm.escapeHTML(occupant.occupantFamilyName ?? '')}
</li>`
}
@ -300,7 +299,7 @@ function openEditLotStatus(clickEvent: Event): void {
const lot = workOrderLots.find((possibleLot) => {
return possibleLot.lotId === lotId
}) as recordTypes.Lot
}) as Lot
let editCloseModalFunction: () => void
@ -314,7 +313,7 @@ function openEditLotStatus(clickEvent: Event): void {
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
workOrderLots: recordTypes.Lot[]
workOrderLots: Lot[]
}
if (responseJSON.success) {
@ -350,7 +349,7 @@ function openEditLotStatus(clickEvent: Event): void {
let lotStatusFound = false
for (const lotStatus of exports.lotStatuses as recordTypes.LotStatus[]) {
for (const lotStatus of exports.lotStatuses as LotStatus[]) {
const optionElement = document.createElement('option')
optionElement.value = lotStatus.lotStatusId.toString()
optionElement.textContent = lotStatus.lotStatus
@ -414,7 +413,7 @@ function deleteLot(clickEvent: Event): void {
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
workOrderLots: recordTypes.Lot[]
workOrderLots: Lot[]
}
if (responseJSON.success) {
@ -557,7 +556,7 @@ document
searchFormElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
lotOccupancies: recordTypes.LotOccupancy[]
lotOccupancies: LotOccupancy[]
}
if (responseJSON.lotOccupancies.length === 0) {
@ -745,7 +744,7 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => {
`${los.urlPrefix}/lots/doSearchLots`,
searchFormElement,
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as { lots: recordTypes.Lot[] }
const responseJSON = rawResponseJSON as { lots: Lot[] }
if (responseJSON.lots.length === 0) {
searchResultsContainerElement.innerHTML = `<div class="message is-info">
@ -817,7 +816,7 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => {
'#lotSearch--lotStatusId'
) as HTMLSelectElement
for (const lotStatus of exports.lotStatuses as recordTypes.LotStatus[]) {
for (const lotStatus of exports.lotStatuses as LotStatus[]) {
const optionElement = document.createElement('option')
optionElement.value = lotStatus.lotStatusId.toString()
optionElement.textContent = lotStatus.lotStatus

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long