linting
parent
c9bf3ab878
commit
1ca3ea0a51
|
|
@ -16,13 +16,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
`<i class="fas fa-fw fa-${fontAwesomeIconClass}" aria-hidden="true"></i>`;
|
||||||
}
|
}
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let workOrderTypes = exports.workOrderTypes;
|
let workOrderTypes = exports.workOrderTypes;
|
||||||
delete exports.workOrderTypes;
|
delete exports.workOrderTypes;
|
||||||
function updateWorkOrderType(submitEvent) {
|
function updateWorkOrderType(submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateWorkOrderType', submitEvent.currentTarget, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateWorkOrderType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
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 tableRowElement = clickEvent.currentTarget.closest('tr');
|
||||||
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
|
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteWorkOrderType', {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteWorkOrderType`, {
|
||||||
workOrderTypeId
|
workOrderTypeId
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -83,16 +84,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
function moveWorkOrderType(clickEvent) {
|
function moveWorkOrderType(clickEvent) {
|
||||||
const buttonElement = clickEvent.currentTarget;
|
const buttonElement = clickEvent.currentTarget;
|
||||||
const tableRowElement = buttonElement.closest('tr');
|
const tableRowElement = buttonElement.closest('tr');
|
||||||
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
|
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
|
||||||
cityssm.postJSON(los.urlPrefix +
|
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||||
'/admin/' +
|
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveWorkOrderTypeUp'
|
? 'doMoveWorkOrderTypeUp'
|
||||||
: 'doMoveWorkOrderTypeDown'), {
|
: 'doMoveWorkOrderTypeDown'}`, {
|
||||||
workOrderTypeId,
|
workOrderTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
|
|
@ -112,7 +111,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderWorkOrderTypes() {
|
function renderWorkOrderTypes() {
|
||||||
var _a;
|
var _a, _b, _c;
|
||||||
const containerElement = document.querySelector('#container--workOrderTypes');
|
const containerElement = document.querySelector('#container--workOrderTypes');
|
||||||
if (workOrderTypes.length === 0) {
|
if (workOrderTypes.length === 0) {
|
||||||
containerElement.innerHTML = `<tr><td colspan="2">
|
containerElement.innerHTML = `<tr><td colspan="2">
|
||||||
|
|
@ -125,44 +124,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const tableRowElement = document.createElement('tr');
|
const tableRowElement = document.createElement('tr');
|
||||||
tableRowElement.dataset.workOrderTypeId =
|
tableRowElement.dataset.workOrderTypeId =
|
||||||
workOrderType.workOrderTypeId.toString();
|
workOrderType.workOrderTypeId.toString();
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="workOrderTypeId" type="hidden" value="' +
|
<input name="workOrderTypeId" type="hidden" value="${workOrderType.workOrderTypeId.toString()}" />
|
||||||
workOrderType.workOrderTypeId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="workOrderType" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML((_a = workOrderType.workOrderType) !== null && _a !== void 0 ? _a : '')}" maxlength="100" aria-label="Work Order Type" required />
|
||||||
'<input class="input" name="workOrderType" type="text" value="' +
|
</div>
|
||||||
cityssm.escapeHTML((_a = workOrderType.workOrderType) !== null && _a !== void 0 ? _a : '') +
|
<div class="control">
|
||||||
'" maxlength="100" aria-label="Work Order Type" required />' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
'</div>' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
'<div class="control">' +
|
</button>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>') +
|
</form>
|
||||||
'</form>' +
|
</td><td class="is-nowrap">
|
||||||
'</td>' +
|
<div class="field is-grouped">
|
||||||
'<td class="is-nowrap">' +
|
<div class="control">
|
||||||
'<div class="field is-grouped">' +
|
${los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderTypeUp', 'button--moveWorkOrderTypeDown', false)}
|
||||||
'<div class="control">' +
|
</div>
|
||||||
los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderTypeUp', 'button--moveWorkOrderTypeDown', false) +
|
<div class="control">
|
||||||
'</div>' +
|
<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">
|
||||||
'<div class="control">' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">' +
|
</button>
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
</div>
|
||||||
'</button>' +
|
</div>
|
||||||
'</div>' +
|
</td>`;
|
||||||
'</div>' +
|
(_b = tableRowElement
|
||||||
'</td>';
|
.querySelector('form')) === null || _b === void 0 ? void 0 : _b.addEventListener('submit', updateWorkOrderType);
|
||||||
tableRowElement
|
|
||||||
.querySelector('form')
|
|
||||||
.addEventListener('submit', updateWorkOrderType);
|
|
||||||
tableRowElement.querySelector('.button--moveWorkOrderTypeUp').addEventListener('click', moveWorkOrderType);
|
tableRowElement.querySelector('.button--moveWorkOrderTypeUp').addEventListener('click', moveWorkOrderType);
|
||||||
tableRowElement.querySelector('.button--moveWorkOrderTypeDown').addEventListener('click', moveWorkOrderType);
|
tableRowElement.querySelector('.button--moveWorkOrderTypeDown').addEventListener('click', moveWorkOrderType);
|
||||||
tableRowElement
|
(_c = tableRowElement
|
||||||
.querySelector('.button--deleteWorkOrderType')
|
.querySelector('.button--deleteWorkOrderType')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', deleteWorkOrderType);
|
||||||
.addEventListener('click', deleteWorkOrderType);
|
|
||||||
containerElement.append(tableRowElement);
|
containerElement.append(tableRowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -170,19 +165,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
document.querySelector('#form--addWorkOrderType').addEventListener('submit', (submitEvent) => {
|
document.querySelector('#form--addWorkOrderType').addEventListener('submit', (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
const formElement = submitEvent.currentTarget;
|
const formElement = submitEvent.currentTarget;
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doAddWorkOrderType', formElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doAddWorkOrderType`, formElement, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a, _b;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderTypes = responseJSON.workOrderTypes;
|
workOrderTypes = responseJSON.workOrderTypes;
|
||||||
renderWorkOrderTypes();
|
renderWorkOrderTypes();
|
||||||
formElement.reset();
|
formElement.reset();
|
||||||
formElement.querySelector('input').focus();
|
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Adding Work Order Type',
|
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'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -192,13 +187,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
|
||||||
// eslint-disable-next-line no-secrets/no-secrets
|
// eslint-disable-next-line no-secrets/no-secrets
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let workOrderMilestoneTypes = exports.workOrderMilestoneTypes;
|
let workOrderMilestoneTypes = exports.workOrderMilestoneTypes;
|
||||||
delete exports.workOrderMilestoneTypes;
|
delete exports.workOrderMilestoneTypes;
|
||||||
function updateWorkOrderMilestoneType(submitEvent) {
|
function updateWorkOrderMilestoneType(submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateWorkOrderMilestoneType', submitEvent.currentTarget, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateWorkOrderMilestoneType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -221,7 +217,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
||||||
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
|
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteWorkOrderMilestoneType', {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteWorkOrderMilestoneType`, {
|
||||||
workOrderMilestoneTypeId
|
workOrderMilestoneTypeId
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -264,11 +260,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const buttonElement = clickEvent.currentTarget;
|
const buttonElement = clickEvent.currentTarget;
|
||||||
const tableRowElement = buttonElement.closest('tr');
|
const tableRowElement = buttonElement.closest('tr');
|
||||||
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
|
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
|
||||||
cityssm.postJSON(los.urlPrefix +
|
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||||
'/admin/' +
|
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveWorkOrderMilestoneTypeUp'
|
? 'doMoveWorkOrderMilestoneTypeUp'
|
||||||
: 'doMoveWorkOrderMilestoneTypeDown'), {
|
: 'doMoveWorkOrderMilestoneTypeDown'}`, {
|
||||||
workOrderMilestoneTypeId,
|
workOrderMilestoneTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
|
|
@ -288,6 +282,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderWorkOrderMilestoneTypes() {
|
function renderWorkOrderMilestoneTypes() {
|
||||||
|
var _a, _b;
|
||||||
const containerElement = document.querySelector('#container--workOrderMilestoneTypes');
|
const containerElement = document.querySelector('#container--workOrderMilestoneTypes');
|
||||||
if (workOrderMilestoneTypes.length === 0) {
|
if (workOrderMilestoneTypes.length === 0) {
|
||||||
containerElement.innerHTML = `<tr><td colspan="2">
|
containerElement.innerHTML = `<tr><td colspan="2">
|
||||||
|
|
@ -300,44 +295,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const tableRowElement = document.createElement('tr');
|
const tableRowElement = document.createElement('tr');
|
||||||
tableRowElement.dataset.workOrderMilestoneTypeId =
|
tableRowElement.dataset.workOrderMilestoneTypeId =
|
||||||
workOrderMilestoneType.workOrderMilestoneTypeId.toString();
|
workOrderMilestoneType.workOrderMilestoneTypeId.toString();
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property, no-secrets/no-secrets
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="workOrderMilestoneTypeId" type="hidden" value="' +
|
<input name="workOrderMilestoneTypeId" type="hidden" value="${workOrderMilestoneType.workOrderMilestoneTypeId.toString()}" />
|
||||||
workOrderMilestoneType.workOrderMilestoneTypeId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="workOrderMilestoneType" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType)}" maxlength="100" aria-label="Work Order Milestone Type" required />
|
||||||
'<input class="input" name="workOrderMilestoneType" type="text" value="' +
|
</div>
|
||||||
cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType) +
|
<div class="control">
|
||||||
'" maxlength="100" aria-label="Work Order Milestone Type" required />' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
'</div>' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
'<div class="control">' +
|
</button>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>') +
|
</form>
|
||||||
'</form>' +
|
</td><td class="is-nowrap">
|
||||||
'</td>' +
|
<div class="field is-grouped">
|
||||||
'<td class="is-nowrap">' +
|
<div class="control">
|
||||||
'<div class="field is-grouped">' +
|
${los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderMilestoneTypeUp', 'button--moveWorkOrderMilestoneTypeDown', false)}
|
||||||
'<div class="control">' +
|
</div>
|
||||||
los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderMilestoneTypeUp', 'button--moveWorkOrderMilestoneTypeDown', false) +
|
<div class="control">
|
||||||
'</div>' +
|
<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">
|
||||||
'<div class="control">' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">' +
|
</button>
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
</div>
|
||||||
'</button>' +
|
</div>
|
||||||
'</div>' +
|
</td>`;
|
||||||
'</div>' +
|
(_a = tableRowElement
|
||||||
'</td>';
|
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateWorkOrderMilestoneType);
|
||||||
tableRowElement
|
|
||||||
.querySelector('form')
|
|
||||||
.addEventListener('submit', updateWorkOrderMilestoneType);
|
|
||||||
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeUp').addEventListener('click', moveWorkOrderMilestoneType);
|
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeUp').addEventListener('click', moveWorkOrderMilestoneType);
|
||||||
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeDown').addEventListener('click', moveWorkOrderMilestoneType);
|
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeDown').addEventListener('click', moveWorkOrderMilestoneType);
|
||||||
tableRowElement
|
(_b = tableRowElement
|
||||||
.querySelector('.button--deleteWorkOrderMilestoneType')
|
.querySelector('.button--deleteWorkOrderMilestoneType')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteWorkOrderMilestoneType);
|
||||||
.addEventListener('click', deleteWorkOrderMilestoneType);
|
|
||||||
containerElement.append(tableRowElement);
|
containerElement.append(tableRowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -345,19 +336,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
document.querySelector('#form--addWorkOrderMilestoneType').addEventListener('submit', (submitEvent) => {
|
document.querySelector('#form--addWorkOrderMilestoneType').addEventListener('submit', (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
const formElement = submitEvent.currentTarget;
|
const formElement = submitEvent.currentTarget;
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doAddWorkOrderMilestoneType', formElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doAddWorkOrderMilestoneType`, formElement, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a, _b;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes;
|
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes;
|
||||||
renderWorkOrderMilestoneTypes();
|
renderWorkOrderMilestoneTypes();
|
||||||
formElement.reset();
|
formElement.reset();
|
||||||
formElement.querySelector('input').focus();
|
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Adding Work Order Milestone Type',
|
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'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -366,25 +357,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
renderWorkOrderMilestoneTypes();
|
renderWorkOrderMilestoneTypes();
|
||||||
|
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let lotStatuses = exports.lotStatuses;
|
let lotStatuses = exports.lotStatuses;
|
||||||
delete exports.lotStatuses;
|
delete exports.lotStatuses;
|
||||||
function updateLotStatus(submitEvent) {
|
function updateLotStatus(submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateLotStatus`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotStatuses = responseJSON.lotStatuses;
|
lotStatuses = responseJSON.lotStatuses;
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: los.escapedAliases.Lot + ' Status Updated Successfully',
|
message: `${los.escapedAliases.Lot} Status Updated Successfully`,
|
||||||
contextualColorName: 'success'
|
contextualColorName: 'success'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
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 : '',
|
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
|
||||||
contextualColorName: 'danger'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
|
|
@ -395,7 +387,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
||||||
const lotStatusId = tableRowElement.dataset.lotStatusId;
|
const lotStatusId = tableRowElement.dataset.lotStatusId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteLotStatus', {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotStatus`, {
|
||||||
lotStatusId
|
lotStatusId
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -409,7 +401,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
tableRowElement.remove();
|
tableRowElement.remove();
|
||||||
}
|
}
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: los.escapedAliases.Lot + ' Status Deleted Successfully',
|
message: `${los.escapedAliases.Lot} Status Deleted Successfully`,
|
||||||
contextualColorName: 'success'
|
contextualColorName: 'success'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -438,11 +430,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const buttonElement = clickEvent.currentTarget;
|
const buttonElement = clickEvent.currentTarget;
|
||||||
const tableRowElement = buttonElement.closest('tr');
|
const tableRowElement = buttonElement.closest('tr');
|
||||||
const lotStatusId = tableRowElement.dataset.lotStatusId;
|
const lotStatusId = tableRowElement.dataset.lotStatusId;
|
||||||
cityssm.postJSON(los.urlPrefix +
|
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||||
'/admin/' +
|
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveLotStatusUp'
|
? 'doMoveLotStatusUp'
|
||||||
: 'doMoveLotStatusDown'), {
|
: 'doMoveLotStatusDown'}`, {
|
||||||
lotStatusId,
|
lotStatusId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
|
|
@ -454,7 +444,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
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 : '',
|
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
|
||||||
contextualColorName: 'danger'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
|
|
@ -462,8 +452,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderLotStatuses() {
|
function renderLotStatuses() {
|
||||||
|
var _a, _b;
|
||||||
const containerElement = document.querySelector('#container--lotStatuses');
|
const containerElement = document.querySelector('#container--lotStatuses');
|
||||||
if (lotStatuses.length === 0) {
|
if (lotStatuses.length === 0) {
|
||||||
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
containerElement.innerHTML = `<tr><td colspan="2">
|
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>
|
<div class="message is-warning"><p class="message-body">There are no active ${los.escapedAliases.lot} statuses.</p></div>
|
||||||
</td></tr>`;
|
</td></tr>`;
|
||||||
|
|
@ -473,47 +465,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
for (const lotStatus of lotStatuses) {
|
for (const lotStatus of lotStatuses) {
|
||||||
const tableRowElement = document.createElement('tr');
|
const tableRowElement = document.createElement('tr');
|
||||||
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString();
|
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString();
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="lotStatusId" type="hidden" value="' +
|
<input name="lotStatusId" type="hidden" value="${lotStatus.lotStatusId.toString()}" />
|
||||||
lotStatus.lotStatusId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="lotStatus" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML(lotStatus.lotStatus)}"
|
||||||
'<input class="input" name="lotStatus" type="text"' +
|
aria-label="${los.escapedAliases.Lot} Status" maxlength="100" required />
|
||||||
(' value="' + cityssm.escapeHTML(lotStatus.lotStatus) + '"') +
|
</div>
|
||||||
(' aria-label="' +
|
<div class="control">
|
||||||
cityssm.escapeHTML(exports.aliases.lot) +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
' Status"') +
|
<i class="fas fa-save" aria-hidden="true"></i>\
|
||||||
' maxlength="100" required />' +
|
</button>
|
||||||
'</div>' +
|
</div>
|
||||||
'<div class="control">' +
|
</div>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</form>
|
||||||
'</div>' +
|
</td><td class="is-nowrap">
|
||||||
'</div>') +
|
<div class="field is-grouped">
|
||||||
'</form>' +
|
<div class="control">
|
||||||
'</td>' +
|
${los.getMoveUpDownButtonFieldHTML('button--moveLotStatusUp', 'button--moveLotStatusDown', false)}
|
||||||
'<td class="is-nowrap">' +
|
</div>
|
||||||
'<div class="field is-grouped">' +
|
<div class="control">
|
||||||
'<div class="control">' +
|
<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">
|
||||||
los.getMoveUpDownButtonFieldHTML('button--moveLotStatusUp', 'button--moveLotStatusDown', false) +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'</div>' +
|
</button>
|
||||||
'<div class="control">' +
|
</div>
|
||||||
'<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">' +
|
</div>
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
</td>`;
|
||||||
'</button>' +
|
(_a = tableRowElement
|
||||||
'</div>' +
|
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateLotStatus);
|
||||||
'</div>' +
|
|
||||||
'</td>';
|
|
||||||
tableRowElement
|
|
||||||
.querySelector('form')
|
|
||||||
.addEventListener('submit', updateLotStatus);
|
|
||||||
tableRowElement.querySelector('.button--moveLotStatusUp').addEventListener('click', moveLotStatus);
|
tableRowElement.querySelector('.button--moveLotStatusUp').addEventListener('click', moveLotStatus);
|
||||||
tableRowElement.querySelector('.button--moveLotStatusDown').addEventListener('click', moveLotStatus);
|
tableRowElement.querySelector('.button--moveLotStatusDown').addEventListener('click', moveLotStatus);
|
||||||
tableRowElement
|
(_b = tableRowElement
|
||||||
.querySelector('.button--deleteLotStatus')
|
.querySelector('.button--deleteLotStatus')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteLotStatus);
|
||||||
.addEventListener('click', deleteLotStatus);
|
|
||||||
containerElement.append(tableRowElement);
|
containerElement.append(tableRowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -521,19 +507,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
document.querySelector('#form--addLotStatus').addEventListener('submit', (submitEvent) => {
|
document.querySelector('#form--addLotStatus').addEventListener('submit', (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
const formElement = submitEvent.currentTarget;
|
const formElement = submitEvent.currentTarget;
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doAddLotStatus', formElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotStatus`, formElement, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a, _b;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotStatuses = responseJSON.lotStatuses;
|
lotStatuses = responseJSON.lotStatuses;
|
||||||
renderLotStatuses();
|
renderLotStatuses();
|
||||||
formElement.reset();
|
formElement.reset();
|
||||||
formElement.querySelector('input').focus();
|
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: `Error Adding ${los.escapedAliases.Lot} Status`,
|
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'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -543,13 +529,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
|
||||||
// eslint-disable-next-line no-secrets/no-secrets
|
// eslint-disable-next-line no-secrets/no-secrets
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let lotOccupantTypes = exports.lotOccupantTypes;
|
let lotOccupantTypes = exports.lotOccupantTypes;
|
||||||
delete exports.lotOccupantTypes;
|
delete exports.lotOccupantTypes;
|
||||||
function updateLotOccupantType(submitEvent) {
|
function updateLotOccupantType(submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateLotOccupantType', submitEvent.currentTarget, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateLotOccupantType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -572,7 +559,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
||||||
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
|
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteLotOccupantType', {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotOccupantType`, {
|
||||||
lotOccupantTypeId
|
lotOccupantTypeId
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -615,11 +602,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const buttonElement = clickEvent.currentTarget;
|
const buttonElement = clickEvent.currentTarget;
|
||||||
const tableRowElement = buttonElement.closest('tr');
|
const tableRowElement = buttonElement.closest('tr');
|
||||||
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
|
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
|
||||||
cityssm.postJSON(los.urlPrefix +
|
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||||
'/admin/' +
|
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveLotOccupantTypeUp'
|
? 'doMoveLotOccupantTypeUp'
|
||||||
: 'doMoveLotOccupantTypeDown'), {
|
: 'doMoveLotOccupantTypeDown'}`, {
|
||||||
lotOccupantTypeId,
|
lotOccupantTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
|
|
@ -639,8 +624,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderLotOccupantTypes() {
|
function renderLotOccupantTypes() {
|
||||||
|
var _a, _b;
|
||||||
const containerElement = document.querySelector('#container--lotOccupantTypes');
|
const containerElement = document.querySelector('#container--lotOccupantTypes');
|
||||||
if (lotOccupantTypes.length === 0) {
|
if (lotOccupantTypes.length === 0) {
|
||||||
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
containerElement.innerHTML = `<tr><td colspan="3">
|
containerElement.innerHTML = `<tr><td colspan="3">
|
||||||
<div class="message is-warning">
|
<div class="message is-warning">
|
||||||
<p class="message-body">There are no active ${los.escapedAliases.lot} ${los.escapedAliases.occupant} types.</p>
|
<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');
|
const tableRowElement = document.createElement('tr');
|
||||||
tableRowElement.dataset.lotOccupantTypeId =
|
tableRowElement.dataset.lotOccupantTypeId =
|
||||||
lotOccupantType.lotOccupantTypeId.toString();
|
lotOccupantType.lotOccupantTypeId.toString();
|
||||||
const formId = 'form--lotOccupantType-' + lotOccupantType.lotOccupantTypeId.toString();
|
const formId = `form--lotOccupantType-${lotOccupantType.lotOccupantTypeId.toString()}`;
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
('<div class="field">' +
|
<div class="field">
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<input class="input" name="lotOccupantType" type="text"' +
|
<input class="input" name="lotOccupantType" type="text"
|
||||||
(' value="' +
|
value="${cityssm.escapeHTML(lotOccupantType.lotOccupantType)}"
|
||||||
cityssm.escapeHTML(lotOccupantType.lotOccupantType) +
|
form="${formId}"
|
||||||
'"') +
|
aria-label="${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type" maxlength="100" required />
|
||||||
(' form="' + formId + '"') +
|
</div>
|
||||||
(' aria-label="' +
|
</div>
|
||||||
los.escapedAliases.Lot +
|
</td><td>
|
||||||
' ' +
|
<div class="field has-addons">
|
||||||
los.escapedAliases.Occupant +
|
<div class="control">
|
||||||
' Type"') +
|
<span class="button is-static">fa-</span>
|
||||||
' maxlength="100" required />' +
|
</div>
|
||||||
'</div>' +
|
<div class="control">
|
||||||
'</div>') +
|
<input class="input" name="fontAwesomeIconClass" type="text"
|
||||||
'</td>' +
|
value="${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"
|
||||||
'<td>' +
|
form="${formId}"
|
||||||
('<div class="field has-addons">' +
|
list="datalist--fontAwesomeIconClass" aria-label="Icon Name" maxlength="50" />
|
||||||
'<div class="control"><span class="button is-static">fa-</span></div>' +
|
</div>
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<input class="input" name="fontAwesomeIconClass" type="text"' +
|
<span class="button is-static">
|
||||||
(' value="' +
|
<i class="fas fa-fw fa-${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"></i>
|
||||||
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
|
</span>
|
||||||
'"') +
|
</div>
|
||||||
(' form="' + formId + '"') +
|
</div>
|
||||||
' list="datalist--fontAwesomeIconClass"' +
|
</td><td>
|
||||||
' aria-label="Icon Name"' +
|
<div class="field">
|
||||||
' maxlength="50" />' +
|
<div class="control">
|
||||||
'</div>' +
|
<input class="input" name="occupantCommentTitle" type="text"
|
||||||
'<div class="control"><span class="button is-static">' +
|
value="${cityssm.escapeHTML(lotOccupantType.occupantCommentTitle)}"
|
||||||
'<i class="fas fa-fw fa-' +
|
form="${formId}"
|
||||||
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
|
aria-label="${los.escapedAliases.Occupant} Comment Title" maxlength="50" />
|
||||||
'"></i></span></div>' +
|
</div>
|
||||||
'</div>') +
|
</div>
|
||||||
'</td>' +
|
</td><td>
|
||||||
'<td>' +
|
<form id="${formId}">
|
||||||
('<div class="field">' +
|
<input name="lotOccupantTypeId" type="hidden"
|
||||||
'<div class="control">' +
|
value="${lotOccupantType.lotOccupantTypeId.toString()}" />
|
||||||
'<input class="input" name="occupantCommentTitle" type="text"' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
(' value="' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
cityssm.escapeHTML(lotOccupantType.occupantCommentTitle) +
|
</button>
|
||||||
'"') +
|
</form>
|
||||||
(' form="' + formId + '"') +
|
</td><td class="is-nowrap">
|
||||||
(' aria-label="' + los.escapedAliases.Occupant + ' Comment Title"') +
|
<div class="field is-grouped">
|
||||||
' maxlength="50" />' +
|
<div class="control">
|
||||||
'</div>' +
|
${los.getMoveUpDownButtonFieldHTML('button--moveLotOccupantTypeUp', 'button--moveLotOccupantTypeDown', false)}
|
||||||
'</div>') +
|
</div>
|
||||||
'</td>' +
|
<div class="control">
|
||||||
('<td>' +
|
<button class="button is-danger is-light button--deleteLotOccupantType"
|
||||||
('<form id="' + formId + '">') +
|
data-tooltip="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type"
|
||||||
'<input name="lotOccupantTypeId" type="hidden"' +
|
type="button"
|
||||||
(' value="' + lotOccupantType.lotOccupantTypeId.toString() + '"') +
|
aria-label="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type">
|
||||||
' />' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</button>
|
||||||
'</form>' +
|
</div>
|
||||||
'</td>') +
|
</div>
|
||||||
'<td class="is-nowrap">' +
|
</td>`;
|
||||||
'<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']");
|
const fontAwesomeInputElement = tableRowElement.querySelector("input[name='fontAwesomeIconClass']");
|
||||||
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon);
|
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon);
|
||||||
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon);
|
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon);
|
||||||
tableRowElement
|
(_a = tableRowElement
|
||||||
.querySelector('form')
|
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateLotOccupantType);
|
||||||
.addEventListener('submit', updateLotOccupantType);
|
|
||||||
tableRowElement.querySelector('.button--moveLotOccupantTypeUp').addEventListener('click', moveLotOccupantType);
|
tableRowElement.querySelector('.button--moveLotOccupantTypeUp').addEventListener('click', moveLotOccupantType);
|
||||||
tableRowElement.querySelector('.button--moveLotOccupantTypeDown').addEventListener('click', moveLotOccupantType);
|
tableRowElement.querySelector('.button--moveLotOccupantTypeDown').addEventListener('click', moveLotOccupantType);
|
||||||
tableRowElement
|
(_b = tableRowElement
|
||||||
.querySelector('.button--deleteLotOccupantType')
|
.querySelector('.button--deleteLotOccupantType')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteLotOccupantType);
|
||||||
.addEventListener('click', deleteLotOccupantType);
|
|
||||||
containerElement.append(tableRowElement);
|
containerElement.append(tableRowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -752,19 +716,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
document.querySelector('#form--addLotOccupantType').addEventListener('submit', (submitEvent) => {
|
document.querySelector('#form--addLotOccupantType').addEventListener('submit', (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
const formElement = submitEvent.currentTarget;
|
const formElement = submitEvent.currentTarget;
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doAddLotOccupantType', formElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotOccupantType`, formElement, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a, _b;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupantTypes = responseJSON.lotOccupantTypes;
|
lotOccupantTypes = responseJSON.lotOccupantTypes;
|
||||||
renderLotOccupantTypes();
|
renderLotOccupantTypes();
|
||||||
formElement.reset();
|
formElement.reset();
|
||||||
formElement.querySelector('input').focus();
|
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: `Error Adding ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type`,
|
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'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||||
/* eslint-disable unicorn/prefer-module */
|
/* 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>
|
declare const exports: Record<string, unknown>
|
||||||
;(() => {
|
;(() => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// 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
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function refreshFontAwesomeIcon(changeEvent: Event): void {
|
function refreshFontAwesomeIcon(changeEvent: Event): void {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let lotOccupantTypes = exports.lotOccupantTypes;
|
let lotOccupantTypes = exports.lotOccupantTypes;
|
||||||
delete exports.lotOccupantTypes;
|
delete exports.lotOccupantTypes;
|
||||||
function updateLotOccupantType(submitEvent) {
|
function updateLotOccupantType(submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateLotOccupantType', submitEvent.currentTarget, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateLotOccupantType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -28,7 +29,7 @@ function deleteLotOccupantType(clickEvent) {
|
||||||
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
||||||
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
|
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteLotOccupantType', {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotOccupantType`, {
|
||||||
lotOccupantTypeId
|
lotOccupantTypeId
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -71,11 +72,9 @@ function moveLotOccupantType(clickEvent) {
|
||||||
const buttonElement = clickEvent.currentTarget;
|
const buttonElement = clickEvent.currentTarget;
|
||||||
const tableRowElement = buttonElement.closest('tr');
|
const tableRowElement = buttonElement.closest('tr');
|
||||||
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
|
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId;
|
||||||
cityssm.postJSON(los.urlPrefix +
|
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||||
'/admin/' +
|
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveLotOccupantTypeUp'
|
? 'doMoveLotOccupantTypeUp'
|
||||||
: 'doMoveLotOccupantTypeDown'), {
|
: 'doMoveLotOccupantTypeDown'}`, {
|
||||||
lotOccupantTypeId,
|
lotOccupantTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
|
|
@ -95,8 +94,10 @@ function moveLotOccupantType(clickEvent) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderLotOccupantTypes() {
|
function renderLotOccupantTypes() {
|
||||||
|
var _a, _b;
|
||||||
const containerElement = document.querySelector('#container--lotOccupantTypes');
|
const containerElement = document.querySelector('#container--lotOccupantTypes');
|
||||||
if (lotOccupantTypes.length === 0) {
|
if (lotOccupantTypes.length === 0) {
|
||||||
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
containerElement.innerHTML = `<tr><td colspan="3">
|
containerElement.innerHTML = `<tr><td colspan="3">
|
||||||
<div class="message is-warning">
|
<div class="message is-warning">
|
||||||
<p class="message-body">There are no active ${los.escapedAliases.lot} ${los.escapedAliases.occupant} types.</p>
|
<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');
|
const tableRowElement = document.createElement('tr');
|
||||||
tableRowElement.dataset.lotOccupantTypeId =
|
tableRowElement.dataset.lotOccupantTypeId =
|
||||||
lotOccupantType.lotOccupantTypeId.toString();
|
lotOccupantType.lotOccupantTypeId.toString();
|
||||||
const formId = 'form--lotOccupantType-' + lotOccupantType.lotOccupantTypeId.toString();
|
const formId = `form--lotOccupantType-${lotOccupantType.lotOccupantTypeId.toString()}`;
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
('<div class="field">' +
|
<div class="field">
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<input class="input" name="lotOccupantType" type="text"' +
|
<input class="input" name="lotOccupantType" type="text"
|
||||||
(' value="' +
|
value="${cityssm.escapeHTML(lotOccupantType.lotOccupantType)}"
|
||||||
cityssm.escapeHTML(lotOccupantType.lotOccupantType) +
|
form="${formId}"
|
||||||
'"') +
|
aria-label="${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type" maxlength="100" required />
|
||||||
(' form="' + formId + '"') +
|
</div>
|
||||||
(' aria-label="' +
|
</div>
|
||||||
los.escapedAliases.Lot +
|
</td><td>
|
||||||
' ' +
|
<div class="field has-addons">
|
||||||
los.escapedAliases.Occupant +
|
<div class="control">
|
||||||
' Type"') +
|
<span class="button is-static">fa-</span>
|
||||||
' maxlength="100" required />' +
|
</div>
|
||||||
'</div>' +
|
<div class="control">
|
||||||
'</div>') +
|
<input class="input" name="fontAwesomeIconClass" type="text"
|
||||||
'</td>' +
|
value="${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"
|
||||||
'<td>' +
|
form="${formId}"
|
||||||
('<div class="field has-addons">' +
|
list="datalist--fontAwesomeIconClass" aria-label="Icon Name" maxlength="50" />
|
||||||
'<div class="control"><span class="button is-static">fa-</span></div>' +
|
</div>
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<input class="input" name="fontAwesomeIconClass" type="text"' +
|
<span class="button is-static">
|
||||||
(' value="' +
|
<i class="fas fa-fw fa-${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"></i>
|
||||||
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
|
</span>
|
||||||
'"') +
|
</div>
|
||||||
(' form="' + formId + '"') +
|
</div>
|
||||||
' list="datalist--fontAwesomeIconClass"' +
|
</td><td>
|
||||||
' aria-label="Icon Name"' +
|
<div class="field">
|
||||||
' maxlength="50" />' +
|
<div class="control">
|
||||||
'</div>' +
|
<input class="input" name="occupantCommentTitle" type="text"
|
||||||
'<div class="control"><span class="button is-static">' +
|
value="${cityssm.escapeHTML(lotOccupantType.occupantCommentTitle)}"
|
||||||
'<i class="fas fa-fw fa-' +
|
form="${formId}"
|
||||||
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
|
aria-label="${los.escapedAliases.Occupant} Comment Title" maxlength="50" />
|
||||||
'"></i></span></div>' +
|
</div>
|
||||||
'</div>') +
|
</div>
|
||||||
'</td>' +
|
</td><td>
|
||||||
'<td>' +
|
<form id="${formId}">
|
||||||
('<div class="field">' +
|
<input name="lotOccupantTypeId" type="hidden"
|
||||||
'<div class="control">' +
|
value="${lotOccupantType.lotOccupantTypeId.toString()}" />
|
||||||
'<input class="input" name="occupantCommentTitle" type="text"' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
(' value="' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
cityssm.escapeHTML(lotOccupantType.occupantCommentTitle) +
|
</button>
|
||||||
'"') +
|
</form>
|
||||||
(' form="' + formId + '"') +
|
</td><td class="is-nowrap">
|
||||||
(' aria-label="' + los.escapedAliases.Occupant + ' Comment Title"') +
|
<div class="field is-grouped">
|
||||||
' maxlength="50" />' +
|
<div class="control">
|
||||||
'</div>' +
|
${los.getMoveUpDownButtonFieldHTML('button--moveLotOccupantTypeUp', 'button--moveLotOccupantTypeDown', false)}
|
||||||
'</div>') +
|
</div>
|
||||||
'</td>' +
|
<div class="control">
|
||||||
('<td>' +
|
<button class="button is-danger is-light button--deleteLotOccupantType"
|
||||||
('<form id="' + formId + '">') +
|
data-tooltip="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type"
|
||||||
'<input name="lotOccupantTypeId" type="hidden"' +
|
type="button"
|
||||||
(' value="' + lotOccupantType.lotOccupantTypeId.toString() + '"') +
|
aria-label="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type">
|
||||||
' />' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</button>
|
||||||
'</form>' +
|
</div>
|
||||||
'</td>') +
|
</div>
|
||||||
'<td class="is-nowrap">' +
|
</td>`;
|
||||||
'<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']");
|
const fontAwesomeInputElement = tableRowElement.querySelector("input[name='fontAwesomeIconClass']");
|
||||||
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon);
|
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon);
|
||||||
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon);
|
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon);
|
||||||
tableRowElement
|
(_a = tableRowElement
|
||||||
.querySelector('form')
|
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateLotOccupantType);
|
||||||
.addEventListener('submit', updateLotOccupantType);
|
|
||||||
tableRowElement.querySelector('.button--moveLotOccupantTypeUp').addEventListener('click', moveLotOccupantType);
|
tableRowElement.querySelector('.button--moveLotOccupantTypeUp').addEventListener('click', moveLotOccupantType);
|
||||||
tableRowElement.querySelector('.button--moveLotOccupantTypeDown').addEventListener('click', moveLotOccupantType);
|
tableRowElement.querySelector('.button--moveLotOccupantTypeDown').addEventListener('click', moveLotOccupantType);
|
||||||
tableRowElement
|
(_b = tableRowElement
|
||||||
.querySelector('.button--deleteLotOccupantType')
|
.querySelector('.button--deleteLotOccupantType')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteLotOccupantType);
|
||||||
.addEventListener('click', deleteLotOccupantType);
|
|
||||||
containerElement.append(tableRowElement);
|
containerElement.append(tableRowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -208,19 +186,19 @@ function renderLotOccupantTypes() {
|
||||||
document.querySelector('#form--addLotOccupantType').addEventListener('submit', (submitEvent) => {
|
document.querySelector('#form--addLotOccupantType').addEventListener('submit', (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
const formElement = submitEvent.currentTarget;
|
const formElement = submitEvent.currentTarget;
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doAddLotOccupantType', formElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotOccupantType`, formElement, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a, _b;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupantTypes = responseJSON.lotOccupantTypes;
|
lotOccupantTypes = responseJSON.lotOccupantTypes;
|
||||||
renderLotOccupantTypes();
|
renderLotOccupantTypes();
|
||||||
formElement.reset();
|
formElement.reset();
|
||||||
formElement.querySelector('input').focus();
|
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: `Error Adding ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type`,
|
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'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 { BulmaJS } from '@cityssm/bulma-js/types.js'
|
||||||
import type * as recordTypes from '../../types/recordTypes'
|
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||||
|
|
||||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
|
import type { LOS } from '../../types/globalTypes.js'
|
||||||
|
import type { LotOccupantType } from '../../types/recordTypes.js'
|
||||||
import type { BulmaJS } from '@cityssm/bulma-js/types'
|
|
||||||
|
|
||||||
declare const cityssm: cityssmGlobal
|
declare const cityssm: cityssmGlobal
|
||||||
declare const bulmaJS: BulmaJS
|
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
|
declare const refreshFontAwesomeIcon: (changeEvent: Event) => void
|
||||||
|
|
||||||
let lotOccupantTypes: recordTypes.LotOccupantType[] = exports.lotOccupantTypes
|
let lotOccupantTypes = exports.lotOccupantTypes as LotOccupantType[]
|
||||||
delete exports.lotOccupantTypes
|
delete exports.lotOccupantTypes
|
||||||
|
|
||||||
type ResponseJSON =
|
type ResponseJSON =
|
||||||
| {
|
| {
|
||||||
success: true
|
success: true
|
||||||
lotOccupantTypes: recordTypes.LotOccupantType[]
|
lotOccupantTypes: LotOccupantType[]
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
success: false
|
success: false
|
||||||
|
|
@ -30,13 +32,13 @@ function updateLotOccupantType(submitEvent: SubmitEvent): void {
|
||||||
submitEvent.preventDefault()
|
submitEvent.preventDefault()
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doUpdateLotOccupantType',
|
`${los.urlPrefix}/admin/doUpdateLotOccupantType`,
|
||||||
submitEvent.currentTarget,
|
submitEvent.currentTarget,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupantTypes = responseJSON.lotOccupantTypes!
|
lotOccupantTypes = responseJSON.lotOccupantTypes
|
||||||
|
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: `${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type Updated Successfully`,
|
message: `${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type Updated Successfully`,
|
||||||
|
|
@ -56,13 +58,13 @@ function updateLotOccupantType(submitEvent: SubmitEvent): void {
|
||||||
function deleteLotOccupantType(clickEvent: Event): void {
|
function deleteLotOccupantType(clickEvent: Event): void {
|
||||||
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
|
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
|
||||||
'tr'
|
'tr'
|
||||||
)!
|
) as HTMLTableRowElement
|
||||||
|
|
||||||
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId
|
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId
|
||||||
|
|
||||||
function doDelete(): void {
|
function doDelete(): void {
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doDeleteLotOccupantType',
|
`${los.urlPrefix}/admin/doDeleteLotOccupantType`,
|
||||||
{
|
{
|
||||||
lotOccupantTypeId
|
lotOccupantTypeId
|
||||||
},
|
},
|
||||||
|
|
@ -70,7 +72,7 @@ function deleteLotOccupantType(clickEvent: Event): void {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupantTypes = responseJSON.lotOccupantTypes!
|
lotOccupantTypes = responseJSON.lotOccupantTypes
|
||||||
|
|
||||||
if (lotOccupantTypes.length === 0) {
|
if (lotOccupantTypes.length === 0) {
|
||||||
renderLotOccupantTypes()
|
renderLotOccupantTypes()
|
||||||
|
|
@ -109,16 +111,16 @@ function deleteLotOccupantType(clickEvent: Event): void {
|
||||||
function moveLotOccupantType(clickEvent: MouseEvent): void {
|
function moveLotOccupantType(clickEvent: MouseEvent): void {
|
||||||
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
|
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
|
||||||
|
|
||||||
const tableRowElement = buttonElement.closest('tr')!
|
const tableRowElement = buttonElement.closest('tr') as HTMLTableRowElement
|
||||||
|
|
||||||
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId
|
const lotOccupantTypeId = tableRowElement.dataset.lotOccupantTypeId
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix +
|
`${los.urlPrefix}/admin/${
|
||||||
'/admin/' +
|
buttonElement.dataset.direction === 'up'
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveLotOccupantTypeUp'
|
? 'doMoveLotOccupantTypeUp'
|
||||||
: 'doMoveLotOccupantTypeDown'),
|
: 'doMoveLotOccupantTypeDown'
|
||||||
|
}`,
|
||||||
{
|
{
|
||||||
lotOccupantTypeId,
|
lotOccupantTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
|
|
@ -127,7 +129,7 @@ function moveLotOccupantType(clickEvent: MouseEvent): void {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupantTypes = responseJSON.lotOccupantTypes!
|
lotOccupantTypes = responseJSON.lotOccupantTypes
|
||||||
renderLotOccupantTypes()
|
renderLotOccupantTypes()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
|
|
@ -146,6 +148,7 @@ function renderLotOccupantTypes(): void {
|
||||||
) as HTMLTableSectionElement
|
) as HTMLTableSectionElement
|
||||||
|
|
||||||
if (lotOccupantTypes.length === 0) {
|
if (lotOccupantTypes.length === 0) {
|
||||||
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
containerElement.innerHTML = `<tr><td colspan="3">
|
containerElement.innerHTML = `<tr><td colspan="3">
|
||||||
<div class="message is-warning">
|
<div class="message is-warning">
|
||||||
<p class="message-body">There are no active ${los.escapedAliases.lot} ${los.escapedAliases.occupant} types.</p>
|
<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 =
|
tableRowElement.dataset.lotOccupantTypeId =
|
||||||
lotOccupantType.lotOccupantTypeId.toString()
|
lotOccupantType.lotOccupantTypeId.toString()
|
||||||
|
|
||||||
const formId =
|
const formId = `form--lotOccupantType-${lotOccupantType.lotOccupantTypeId.toString()}`
|
||||||
'form--lotOccupantType-' + lotOccupantType.lotOccupantTypeId.toString()
|
|
||||||
|
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
('<div class="field">' +
|
<div class="field">
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<input class="input" name="lotOccupantType" type="text"' +
|
<input class="input" name="lotOccupantType" type="text"
|
||||||
(' value="' +
|
value="${cityssm.escapeHTML(lotOccupantType.lotOccupantType)}"
|
||||||
cityssm.escapeHTML(lotOccupantType.lotOccupantType) +
|
form="${formId}"
|
||||||
'"') +
|
aria-label="${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type" maxlength="100" required />
|
||||||
(' form="' + formId + '"') +
|
</div>
|
||||||
(' aria-label="' +
|
</div>
|
||||||
los.escapedAliases.Lot +
|
</td><td>
|
||||||
' ' +
|
<div class="field has-addons">
|
||||||
los.escapedAliases.Occupant +
|
<div class="control">
|
||||||
' Type"') +
|
<span class="button is-static">fa-</span>
|
||||||
' maxlength="100" required />' +
|
</div>
|
||||||
'</div>' +
|
<div class="control">
|
||||||
'</div>') +
|
<input class="input" name="fontAwesomeIconClass" type="text"
|
||||||
'</td>' +
|
value="${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"
|
||||||
'<td>' +
|
form="${formId}"
|
||||||
('<div class="field has-addons">' +
|
list="datalist--fontAwesomeIconClass" aria-label="Icon Name" maxlength="50" />
|
||||||
'<div class="control"><span class="button is-static">fa-</span></div>' +
|
</div>
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<input class="input" name="fontAwesomeIconClass" type="text"' +
|
<span class="button is-static">
|
||||||
(' value="' +
|
<i class="fas fa-fw fa-${cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass)}"></i>
|
||||||
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
|
</span>
|
||||||
'"') +
|
</div>
|
||||||
(' form="' + formId + '"') +
|
</div>
|
||||||
' list="datalist--fontAwesomeIconClass"' +
|
</td><td>
|
||||||
' aria-label="Icon Name"' +
|
<div class="field">
|
||||||
' maxlength="50" />' +
|
<div class="control">
|
||||||
'</div>' +
|
<input class="input" name="occupantCommentTitle" type="text"
|
||||||
'<div class="control"><span class="button is-static">' +
|
value="${cityssm.escapeHTML(lotOccupantType.occupantCommentTitle)}"
|
||||||
'<i class="fas fa-fw fa-' +
|
form="${formId}"
|
||||||
cityssm.escapeHTML(lotOccupantType.fontAwesomeIconClass) +
|
aria-label="${los.escapedAliases.Occupant} Comment Title" maxlength="50" />
|
||||||
'"></i></span></div>' +
|
</div>
|
||||||
'</div>') +
|
</div>
|
||||||
'</td>' +
|
</td><td>
|
||||||
'<td>' +
|
<form id="${formId}">
|
||||||
('<div class="field">' +
|
<input name="lotOccupantTypeId" type="hidden"
|
||||||
'<div class="control">' +
|
value="${lotOccupantType.lotOccupantTypeId.toString()}" />
|
||||||
'<input class="input" name="occupantCommentTitle" type="text"' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
(' value="' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
cityssm.escapeHTML(lotOccupantType.occupantCommentTitle) +
|
</button>
|
||||||
'"') +
|
</form>
|
||||||
(' form="' + formId + '"') +
|
</td><td class="is-nowrap">
|
||||||
(' aria-label="' + los.escapedAliases.Occupant + ' Comment Title"') +
|
<div class="field is-grouped">
|
||||||
' maxlength="50" />' +
|
<div class="control">
|
||||||
'</div>' +
|
${los.getMoveUpDownButtonFieldHTML(
|
||||||
'</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--moveLotOccupantTypeUp',
|
||||||
'button--moveLotOccupantTypeDown',
|
'button--moveLotOccupantTypeDown',
|
||||||
false
|
false
|
||||||
) +
|
)}
|
||||||
'</div>' +
|
</div>
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<button class="button is-danger is-light button--deleteLotOccupantType"' +
|
<button class="button is-danger is-light button--deleteLotOccupantType"
|
||||||
' data-tooltip="Delete ' +
|
data-tooltip="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type"
|
||||||
los.escapedAliases.Lot +
|
type="button"
|
||||||
' ' +
|
aria-label="Delete ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type">
|
||||||
los.escapedAliases.Occupant +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
' Type" type="button"' +
|
</button>
|
||||||
' aria-label="Delete ' +
|
</div>
|
||||||
los.escapedAliases.Lot +
|
</div>
|
||||||
' ' +
|
</td>`
|
||||||
los.escapedAliases.Occupant +
|
|
||||||
' Type">' +
|
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
|
||||||
'</button>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>' +
|
|
||||||
'</td>'
|
|
||||||
|
|
||||||
const fontAwesomeInputElement = tableRowElement.querySelector(
|
const fontAwesomeInputElement = tableRowElement.querySelector(
|
||||||
"input[name='fontAwesomeIconClass']"
|
"input[name='fontAwesomeIconClass']"
|
||||||
)!
|
) as HTMLInputElement
|
||||||
|
|
||||||
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon)
|
fontAwesomeInputElement.addEventListener('keyup', refreshFontAwesomeIcon)
|
||||||
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon)
|
fontAwesomeInputElement.addEventListener('change', refreshFontAwesomeIcon)
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('form')!
|
.querySelector('form')
|
||||||
.addEventListener('submit', updateLotOccupantType)
|
?.addEventListener('submit', updateLotOccupantType)
|
||||||
;(
|
;(
|
||||||
tableRowElement.querySelector(
|
tableRowElement.querySelector(
|
||||||
'.button--moveLotOccupantTypeUp'
|
'.button--moveLotOccupantTypeUp'
|
||||||
|
|
@ -273,8 +254,8 @@ function renderLotOccupantTypes(): void {
|
||||||
).addEventListener('click', moveLotOccupantType)
|
).addEventListener('click', moveLotOccupantType)
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('.button--deleteLotOccupantType')!
|
.querySelector('.button--deleteLotOccupantType')
|
||||||
.addEventListener('click', deleteLotOccupantType)
|
?.addEventListener('click', deleteLotOccupantType)
|
||||||
|
|
||||||
containerElement.append(tableRowElement)
|
containerElement.append(tableRowElement)
|
||||||
}
|
}
|
||||||
|
|
@ -287,16 +268,16 @@ function renderLotOccupantTypes(): void {
|
||||||
const formElement = submitEvent.currentTarget as HTMLFormElement
|
const formElement = submitEvent.currentTarget as HTMLFormElement
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doAddLotOccupantType',
|
`${los.urlPrefix}/admin/doAddLotOccupantType`,
|
||||||
formElement,
|
formElement,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupantTypes = responseJSON.lotOccupantTypes!
|
lotOccupantTypes = responseJSON.lotOccupantTypes
|
||||||
renderLotOccupantTypes()
|
renderLotOccupantTypes()
|
||||||
formElement.reset()
|
formElement.reset()
|
||||||
formElement.querySelector('input')!.focus()
|
formElement.querySelector('input')?.focus()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: `Error Adding ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type`,
|
title: `Error Adding ${los.escapedAliases.Lot} ${los.escapedAliases.Occupant} Type`,
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,24 @@
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let lotStatuses = exports.lotStatuses;
|
let lotStatuses = exports.lotStatuses;
|
||||||
delete exports.lotStatuses;
|
delete exports.lotStatuses;
|
||||||
function updateLotStatus(submitEvent) {
|
function updateLotStatus(submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateLotStatus', submitEvent.currentTarget, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateLotStatus`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotStatuses = responseJSON.lotStatuses;
|
lotStatuses = responseJSON.lotStatuses;
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: los.escapedAliases.Lot + ' Status Updated Successfully',
|
message: `${los.escapedAliases.Lot} Status Updated Successfully`,
|
||||||
contextualColorName: 'success'
|
contextualColorName: 'success'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
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 : '',
|
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
|
||||||
contextualColorName: 'danger'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
|
|
@ -28,7 +29,7 @@ function deleteLotStatus(clickEvent) {
|
||||||
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
||||||
const lotStatusId = tableRowElement.dataset.lotStatusId;
|
const lotStatusId = tableRowElement.dataset.lotStatusId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteLotStatus', {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteLotStatus`, {
|
||||||
lotStatusId
|
lotStatusId
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -42,7 +43,7 @@ function deleteLotStatus(clickEvent) {
|
||||||
tableRowElement.remove();
|
tableRowElement.remove();
|
||||||
}
|
}
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: los.escapedAliases.Lot + ' Status Deleted Successfully',
|
message: `${los.escapedAliases.Lot} Status Deleted Successfully`,
|
||||||
contextualColorName: 'success'
|
contextualColorName: 'success'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -71,11 +72,9 @@ function moveLotStatus(clickEvent) {
|
||||||
const buttonElement = clickEvent.currentTarget;
|
const buttonElement = clickEvent.currentTarget;
|
||||||
const tableRowElement = buttonElement.closest('tr');
|
const tableRowElement = buttonElement.closest('tr');
|
||||||
const lotStatusId = tableRowElement.dataset.lotStatusId;
|
const lotStatusId = tableRowElement.dataset.lotStatusId;
|
||||||
cityssm.postJSON(los.urlPrefix +
|
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||||
'/admin/' +
|
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveLotStatusUp'
|
? 'doMoveLotStatusUp'
|
||||||
: 'doMoveLotStatusDown'), {
|
: 'doMoveLotStatusDown'}`, {
|
||||||
lotStatusId,
|
lotStatusId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
|
|
@ -87,7 +86,7 @@ function moveLotStatus(clickEvent) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
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 : '',
|
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
|
||||||
contextualColorName: 'danger'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
|
|
@ -95,8 +94,10 @@ function moveLotStatus(clickEvent) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderLotStatuses() {
|
function renderLotStatuses() {
|
||||||
|
var _a, _b;
|
||||||
const containerElement = document.querySelector('#container--lotStatuses');
|
const containerElement = document.querySelector('#container--lotStatuses');
|
||||||
if (lotStatuses.length === 0) {
|
if (lotStatuses.length === 0) {
|
||||||
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
containerElement.innerHTML = `<tr><td colspan="2">
|
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>
|
<div class="message is-warning"><p class="message-body">There are no active ${los.escapedAliases.lot} statuses.</p></div>
|
||||||
</td></tr>`;
|
</td></tr>`;
|
||||||
|
|
@ -106,47 +107,41 @@ function renderLotStatuses() {
|
||||||
for (const lotStatus of lotStatuses) {
|
for (const lotStatus of lotStatuses) {
|
||||||
const tableRowElement = document.createElement('tr');
|
const tableRowElement = document.createElement('tr');
|
||||||
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString();
|
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString();
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="lotStatusId" type="hidden" value="' +
|
<input name="lotStatusId" type="hidden" value="${lotStatus.lotStatusId.toString()}" />
|
||||||
lotStatus.lotStatusId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="lotStatus" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML(lotStatus.lotStatus)}"
|
||||||
'<input class="input" name="lotStatus" type="text"' +
|
aria-label="${los.escapedAliases.Lot} Status" maxlength="100" required />
|
||||||
(' value="' + cityssm.escapeHTML(lotStatus.lotStatus) + '"') +
|
</div>
|
||||||
(' aria-label="' +
|
<div class="control">
|
||||||
cityssm.escapeHTML(exports.aliases.lot) +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
' Status"') +
|
<i class="fas fa-save" aria-hidden="true"></i>\
|
||||||
' maxlength="100" required />' +
|
</button>
|
||||||
'</div>' +
|
</div>
|
||||||
'<div class="control">' +
|
</div>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</form>
|
||||||
'</div>' +
|
</td><td class="is-nowrap">
|
||||||
'</div>') +
|
<div class="field is-grouped">
|
||||||
'</form>' +
|
<div class="control">
|
||||||
'</td>' +
|
${los.getMoveUpDownButtonFieldHTML('button--moveLotStatusUp', 'button--moveLotStatusDown', false)}
|
||||||
'<td class="is-nowrap">' +
|
</div>
|
||||||
'<div class="field is-grouped">' +
|
<div class="control">
|
||||||
'<div class="control">' +
|
<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">
|
||||||
los.getMoveUpDownButtonFieldHTML('button--moveLotStatusUp', 'button--moveLotStatusDown', false) +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'</div>' +
|
</button>
|
||||||
'<div class="control">' +
|
</div>
|
||||||
'<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">' +
|
</div>
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
</td>`;
|
||||||
'</button>' +
|
(_a = tableRowElement
|
||||||
'</div>' +
|
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateLotStatus);
|
||||||
'</div>' +
|
|
||||||
'</td>';
|
|
||||||
tableRowElement
|
|
||||||
.querySelector('form')
|
|
||||||
.addEventListener('submit', updateLotStatus);
|
|
||||||
tableRowElement.querySelector('.button--moveLotStatusUp').addEventListener('click', moveLotStatus);
|
tableRowElement.querySelector('.button--moveLotStatusUp').addEventListener('click', moveLotStatus);
|
||||||
tableRowElement.querySelector('.button--moveLotStatusDown').addEventListener('click', moveLotStatus);
|
tableRowElement.querySelector('.button--moveLotStatusDown').addEventListener('click', moveLotStatus);
|
||||||
tableRowElement
|
(_b = tableRowElement
|
||||||
.querySelector('.button--deleteLotStatus')
|
.querySelector('.button--deleteLotStatus')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteLotStatus);
|
||||||
.addEventListener('click', deleteLotStatus);
|
|
||||||
containerElement.append(tableRowElement);
|
containerElement.append(tableRowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,19 +149,19 @@ function renderLotStatuses() {
|
||||||
document.querySelector('#form--addLotStatus').addEventListener('submit', (submitEvent) => {
|
document.querySelector('#form--addLotStatus').addEventListener('submit', (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
const formElement = submitEvent.currentTarget;
|
const formElement = submitEvent.currentTarget;
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doAddLotStatus', formElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doAddLotStatus`, formElement, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a, _b;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotStatuses = responseJSON.lotStatuses;
|
lotStatuses = responseJSON.lotStatuses;
|
||||||
renderLotStatuses();
|
renderLotStatuses();
|
||||||
formElement.reset();
|
formElement.reset();
|
||||||
formElement.querySelector('input').focus();
|
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: `Error Adding ${los.escapedAliases.Lot} Status`,
|
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'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 { BulmaJS } from '@cityssm/bulma-js/types.js'
|
||||||
import type * as recordTypes from '../../types/recordTypes'
|
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||||
|
|
||||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
|
import type { LOS } from '../../types/globalTypes.js'
|
||||||
|
import type { LotStatus } from '../../types/recordTypes.js'
|
||||||
import type { BulmaJS } from '@cityssm/bulma-js/types'
|
|
||||||
|
|
||||||
declare const cityssm: cityssmGlobal
|
declare const cityssm: cityssmGlobal
|
||||||
declare const bulmaJS: BulmaJS
|
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
|
delete exports.lotStatuses
|
||||||
|
|
||||||
type ResponseJSON =
|
type ResponseJSON =
|
||||||
| {
|
| {
|
||||||
success: true
|
success: true
|
||||||
lotStatuses: recordTypes.LotStatus[]
|
lotStatuses: LotStatus[]
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
success: false
|
success: false
|
||||||
|
|
@ -29,21 +30,21 @@ function updateLotStatus(submitEvent: SubmitEvent): void {
|
||||||
submitEvent.preventDefault()
|
submitEvent.preventDefault()
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doUpdateLotStatus',
|
`${los.urlPrefix}/admin/doUpdateLotStatus`,
|
||||||
submitEvent.currentTarget,
|
submitEvent.currentTarget,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotStatuses = responseJSON.lotStatuses!
|
lotStatuses = responseJSON.lotStatuses
|
||||||
|
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: los.escapedAliases.Lot + ' Status Updated Successfully',
|
message: `${los.escapedAliases.Lot} Status Updated Successfully`,
|
||||||
contextualColorName: 'success'
|
contextualColorName: 'success'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Updating ' + los.escapedAliases.Lot + ' Status',
|
title: `Error Updating ${los.escapedAliases.Lot} Status`,
|
||||||
message: responseJSON.errorMessage ?? '',
|
message: responseJSON.errorMessage ?? '',
|
||||||
contextualColorName: 'danger'
|
contextualColorName: 'danger'
|
||||||
})
|
})
|
||||||
|
|
@ -55,13 +56,13 @@ function updateLotStatus(submitEvent: SubmitEvent): void {
|
||||||
function deleteLotStatus(clickEvent: Event): void {
|
function deleteLotStatus(clickEvent: Event): void {
|
||||||
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
|
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
|
||||||
'tr'
|
'tr'
|
||||||
)!
|
) as HTMLTableRowElement
|
||||||
|
|
||||||
const lotStatusId = tableRowElement.dataset.lotStatusId
|
const lotStatusId = tableRowElement.dataset.lotStatusId
|
||||||
|
|
||||||
function doDelete(): void {
|
function doDelete(): void {
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doDeleteLotStatus',
|
`${los.urlPrefix}/admin/doDeleteLotStatus`,
|
||||||
{
|
{
|
||||||
lotStatusId
|
lotStatusId
|
||||||
},
|
},
|
||||||
|
|
@ -69,7 +70,7 @@ function deleteLotStatus(clickEvent: Event): void {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotStatuses = responseJSON.lotStatuses!
|
lotStatuses = responseJSON.lotStatuses
|
||||||
|
|
||||||
if (lotStatuses.length === 0) {
|
if (lotStatuses.length === 0) {
|
||||||
renderLotStatuses()
|
renderLotStatuses()
|
||||||
|
|
@ -78,7 +79,7 @@ function deleteLotStatus(clickEvent: Event): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: los.escapedAliases.Lot + ' Status Deleted Successfully',
|
message: `${los.escapedAliases.Lot} Status Deleted Successfully`,
|
||||||
contextualColorName: 'success'
|
contextualColorName: 'success'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -108,16 +109,16 @@ function deleteLotStatus(clickEvent: Event): void {
|
||||||
function moveLotStatus(clickEvent: MouseEvent): void {
|
function moveLotStatus(clickEvent: MouseEvent): void {
|
||||||
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
|
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
|
||||||
|
|
||||||
const tableRowElement = buttonElement.closest('tr')!
|
const tableRowElement = buttonElement.closest('tr') as HTMLTableRowElement
|
||||||
|
|
||||||
const lotStatusId = tableRowElement.dataset.lotStatusId
|
const lotStatusId = tableRowElement.dataset.lotStatusId
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix +
|
`${los.urlPrefix}/admin/${
|
||||||
'/admin/' +
|
buttonElement.dataset.direction === 'up'
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveLotStatusUp'
|
? 'doMoveLotStatusUp'
|
||||||
: 'doMoveLotStatusDown'),
|
: 'doMoveLotStatusDown'
|
||||||
|
}`,
|
||||||
{
|
{
|
||||||
lotStatusId,
|
lotStatusId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
|
|
@ -126,11 +127,11 @@ function moveLotStatus(clickEvent: MouseEvent): void {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotStatuses = responseJSON.lotStatuses!
|
lotStatuses = responseJSON.lotStatuses
|
||||||
renderLotStatuses()
|
renderLotStatuses()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Moving ' + los.escapedAliases.Lot + ' Status',
|
title: `Error Moving ${los.escapedAliases.Lot} Status`,
|
||||||
message: responseJSON.errorMessage ?? '',
|
message: responseJSON.errorMessage ?? '',
|
||||||
contextualColorName: 'danger'
|
contextualColorName: 'danger'
|
||||||
})
|
})
|
||||||
|
|
@ -145,6 +146,7 @@ function renderLotStatuses(): void {
|
||||||
) as HTMLTableSectionElement
|
) as HTMLTableSectionElement
|
||||||
|
|
||||||
if (lotStatuses.length === 0) {
|
if (lotStatuses.length === 0) {
|
||||||
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
containerElement.innerHTML = `<tr><td colspan="2">
|
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>
|
<div class="message is-warning"><p class="message-body">There are no active ${los.escapedAliases.lot} statuses.</p></div>
|
||||||
</td></tr>`
|
</td></tr>`
|
||||||
|
|
@ -159,47 +161,43 @@ function renderLotStatuses(): void {
|
||||||
|
|
||||||
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString()
|
tableRowElement.dataset.lotStatusId = lotStatus.lotStatusId.toString()
|
||||||
|
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="lotStatusId" type="hidden" value="' +
|
<input name="lotStatusId" type="hidden" value="${lotStatus.lotStatusId.toString()}" />
|
||||||
lotStatus.lotStatusId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="lotStatus" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML(lotStatus.lotStatus)}"
|
||||||
'<input class="input" name="lotStatus" type="text"' +
|
aria-label="${los.escapedAliases.Lot} Status" maxlength="100" required />
|
||||||
(' value="' + cityssm.escapeHTML(lotStatus.lotStatus) + '"') +
|
</div>
|
||||||
(' aria-label="' +
|
<div class="control">
|
||||||
cityssm.escapeHTML(exports.aliases.lot) +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
' Status"') +
|
<i class="fas fa-save" aria-hidden="true"></i>\
|
||||||
' maxlength="100" required />' +
|
</button>
|
||||||
'</div>' +
|
</div>
|
||||||
'<div class="control">' +
|
</div>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</form>
|
||||||
'</div>' +
|
</td><td class="is-nowrap">
|
||||||
'</div>') +
|
<div class="field is-grouped">
|
||||||
'</form>' +
|
<div class="control">
|
||||||
'</td>' +
|
${los.getMoveUpDownButtonFieldHTML(
|
||||||
'<td class="is-nowrap">' +
|
|
||||||
'<div class="field is-grouped">' +
|
|
||||||
'<div class="control">' +
|
|
||||||
los.getMoveUpDownButtonFieldHTML(
|
|
||||||
'button--moveLotStatusUp',
|
'button--moveLotStatusUp',
|
||||||
'button--moveLotStatusDown',
|
'button--moveLotStatusDown',
|
||||||
false
|
false
|
||||||
) +
|
)}
|
||||||
'</div>' +
|
</div>
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<button class="button is-danger is-light button--deleteLotStatus" data-tooltip="Delete Status" type="button" aria-label="Delete Status">' +
|
<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>' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'</button>' +
|
</button>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</td>'
|
</td>`
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('form')!
|
.querySelector('form')
|
||||||
.addEventListener('submit', updateLotStatus)
|
?.addEventListener('submit', updateLotStatus)
|
||||||
;(
|
;(
|
||||||
tableRowElement.querySelector(
|
tableRowElement.querySelector(
|
||||||
'.button--moveLotStatusUp'
|
'.button--moveLotStatusUp'
|
||||||
|
|
@ -212,8 +210,8 @@ function renderLotStatuses(): void {
|
||||||
).addEventListener('click', moveLotStatus)
|
).addEventListener('click', moveLotStatus)
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('.button--deleteLotStatus')!
|
.querySelector('.button--deleteLotStatus')
|
||||||
.addEventListener('click', deleteLotStatus)
|
?.addEventListener('click', deleteLotStatus)
|
||||||
|
|
||||||
containerElement.append(tableRowElement)
|
containerElement.append(tableRowElement)
|
||||||
}
|
}
|
||||||
|
|
@ -226,16 +224,16 @@ function renderLotStatuses(): void {
|
||||||
const formElement = submitEvent.currentTarget as HTMLFormElement
|
const formElement = submitEvent.currentTarget as HTMLFormElement
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doAddLotStatus',
|
`${los.urlPrefix}/admin/doAddLotStatus`,
|
||||||
formElement,
|
formElement,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotStatuses = responseJSON.lotStatuses!
|
lotStatuses = responseJSON.lotStatuses
|
||||||
renderLotStatuses()
|
renderLotStatuses()
|
||||||
formElement.reset()
|
formElement.reset()
|
||||||
formElement.querySelector('input')!.focus()
|
formElement.querySelector('input')?.focus()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: `Error Adding ${los.escapedAliases.Lot} Status`,
|
title: `Error Adding ${los.escapedAliases.Lot} Status`,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let workOrderMilestoneTypes = exports.workOrderMilestoneTypes;
|
let workOrderMilestoneTypes = exports.workOrderMilestoneTypes;
|
||||||
delete exports.workOrderMilestoneTypes;
|
delete exports.workOrderMilestoneTypes;
|
||||||
function updateWorkOrderMilestoneType(submitEvent) {
|
function updateWorkOrderMilestoneType(submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateWorkOrderMilestoneType', submitEvent.currentTarget, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateWorkOrderMilestoneType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -28,7 +29,7 @@ function deleteWorkOrderMilestoneType(clickEvent) {
|
||||||
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
||||||
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
|
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteWorkOrderMilestoneType', {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteWorkOrderMilestoneType`, {
|
||||||
workOrderMilestoneTypeId
|
workOrderMilestoneTypeId
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -71,11 +72,9 @@ function moveWorkOrderMilestoneType(clickEvent) {
|
||||||
const buttonElement = clickEvent.currentTarget;
|
const buttonElement = clickEvent.currentTarget;
|
||||||
const tableRowElement = buttonElement.closest('tr');
|
const tableRowElement = buttonElement.closest('tr');
|
||||||
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
|
const workOrderMilestoneTypeId = tableRowElement.dataset.workOrderMilestoneTypeId;
|
||||||
cityssm.postJSON(los.urlPrefix +
|
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||||
'/admin/' +
|
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveWorkOrderMilestoneTypeUp'
|
? 'doMoveWorkOrderMilestoneTypeUp'
|
||||||
: 'doMoveWorkOrderMilestoneTypeDown'), {
|
: 'doMoveWorkOrderMilestoneTypeDown'}`, {
|
||||||
workOrderMilestoneTypeId,
|
workOrderMilestoneTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
|
|
@ -95,6 +94,7 @@ function moveWorkOrderMilestoneType(clickEvent) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderWorkOrderMilestoneTypes() {
|
function renderWorkOrderMilestoneTypes() {
|
||||||
|
var _a, _b;
|
||||||
const containerElement = document.querySelector('#container--workOrderMilestoneTypes');
|
const containerElement = document.querySelector('#container--workOrderMilestoneTypes');
|
||||||
if (workOrderMilestoneTypes.length === 0) {
|
if (workOrderMilestoneTypes.length === 0) {
|
||||||
containerElement.innerHTML = `<tr><td colspan="2">
|
containerElement.innerHTML = `<tr><td colspan="2">
|
||||||
|
|
@ -107,44 +107,40 @@ function renderWorkOrderMilestoneTypes() {
|
||||||
const tableRowElement = document.createElement('tr');
|
const tableRowElement = document.createElement('tr');
|
||||||
tableRowElement.dataset.workOrderMilestoneTypeId =
|
tableRowElement.dataset.workOrderMilestoneTypeId =
|
||||||
workOrderMilestoneType.workOrderMilestoneTypeId.toString();
|
workOrderMilestoneType.workOrderMilestoneTypeId.toString();
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property, no-secrets/no-secrets
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="workOrderMilestoneTypeId" type="hidden" value="' +
|
<input name="workOrderMilestoneTypeId" type="hidden" value="${workOrderMilestoneType.workOrderMilestoneTypeId.toString()}" />
|
||||||
workOrderMilestoneType.workOrderMilestoneTypeId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="workOrderMilestoneType" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType)}" maxlength="100" aria-label="Work Order Milestone Type" required />
|
||||||
'<input class="input" name="workOrderMilestoneType" type="text" value="' +
|
</div>
|
||||||
cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType) +
|
<div class="control">
|
||||||
'" maxlength="100" aria-label="Work Order Milestone Type" required />' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
'</div>' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
'<div class="control">' +
|
</button>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>') +
|
</form>
|
||||||
'</form>' +
|
</td><td class="is-nowrap">
|
||||||
'</td>' +
|
<div class="field is-grouped">
|
||||||
'<td class="is-nowrap">' +
|
<div class="control">
|
||||||
'<div class="field is-grouped">' +
|
${los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderMilestoneTypeUp', 'button--moveWorkOrderMilestoneTypeDown', false)}
|
||||||
'<div class="control">' +
|
</div>
|
||||||
los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderMilestoneTypeUp', 'button--moveWorkOrderMilestoneTypeDown', false) +
|
<div class="control">
|
||||||
'</div>' +
|
<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">
|
||||||
'<div class="control">' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">' +
|
</button>
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
</div>
|
||||||
'</button>' +
|
</div>
|
||||||
'</div>' +
|
</td>`;
|
||||||
'</div>' +
|
(_a = tableRowElement
|
||||||
'</td>';
|
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', updateWorkOrderMilestoneType);
|
||||||
tableRowElement
|
|
||||||
.querySelector('form')
|
|
||||||
.addEventListener('submit', updateWorkOrderMilestoneType);
|
|
||||||
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeUp').addEventListener('click', moveWorkOrderMilestoneType);
|
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeUp').addEventListener('click', moveWorkOrderMilestoneType);
|
||||||
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeDown').addEventListener('click', moveWorkOrderMilestoneType);
|
tableRowElement.querySelector('.button--moveWorkOrderMilestoneTypeDown').addEventListener('click', moveWorkOrderMilestoneType);
|
||||||
tableRowElement
|
(_b = tableRowElement
|
||||||
.querySelector('.button--deleteWorkOrderMilestoneType')
|
.querySelector('.button--deleteWorkOrderMilestoneType')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', deleteWorkOrderMilestoneType);
|
||||||
.addEventListener('click', deleteWorkOrderMilestoneType);
|
|
||||||
containerElement.append(tableRowElement);
|
containerElement.append(tableRowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -152,19 +148,19 @@ function renderWorkOrderMilestoneTypes() {
|
||||||
document.querySelector('#form--addWorkOrderMilestoneType').addEventListener('submit', (submitEvent) => {
|
document.querySelector('#form--addWorkOrderMilestoneType').addEventListener('submit', (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
const formElement = submitEvent.currentTarget;
|
const formElement = submitEvent.currentTarget;
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doAddWorkOrderMilestoneType', formElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doAddWorkOrderMilestoneType`, formElement, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a, _b;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes;
|
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes;
|
||||||
renderWorkOrderMilestoneTypes();
|
renderWorkOrderMilestoneTypes();
|
||||||
formElement.reset();
|
formElement.reset();
|
||||||
formElement.querySelector('input').focus();
|
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Adding Work Order Milestone Type',
|
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'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 { BulmaJS } from '@cityssm/bulma-js/types.js'
|
||||||
import type * as recordTypes from '../../types/recordTypes'
|
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||||
|
|
||||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
|
import type { LOS } from '../../types/globalTypes.js'
|
||||||
|
import type { WorkOrderMilestoneType } from '../../types/recordTypes.js'
|
||||||
import type { BulmaJS } from '@cityssm/bulma-js/types'
|
|
||||||
|
|
||||||
declare const cityssm: cityssmGlobal
|
declare const cityssm: cityssmGlobal
|
||||||
declare const bulmaJS: BulmaJS
|
declare const bulmaJS: BulmaJS
|
||||||
|
|
||||||
declare const los: globalTypes.LOS
|
declare const los: LOS
|
||||||
|
declare const exports: Record<string, unknown>
|
||||||
|
|
||||||
let workOrderMilestoneTypes: recordTypes.WorkOrderMilestoneType[] =
|
let workOrderMilestoneTypes =
|
||||||
exports.workOrderMilestoneTypes
|
exports.workOrderMilestoneTypes as WorkOrderMilestoneType[]
|
||||||
delete exports.workOrderMilestoneTypes
|
delete exports.workOrderMilestoneTypes
|
||||||
|
|
||||||
type ResponseJSON =
|
type ResponseJSON =
|
||||||
| {
|
| {
|
||||||
success: true
|
success: true
|
||||||
workOrderMilestoneTypes: recordTypes.WorkOrderMilestoneType[]
|
workOrderMilestoneTypes: WorkOrderMilestoneType[]
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
success: false
|
success: false
|
||||||
|
|
@ -30,13 +31,13 @@ function updateWorkOrderMilestoneType(submitEvent: SubmitEvent): void {
|
||||||
submitEvent.preventDefault()
|
submitEvent.preventDefault()
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doUpdateWorkOrderMilestoneType',
|
`${los.urlPrefix}/admin/doUpdateWorkOrderMilestoneType`,
|
||||||
submitEvent.currentTarget,
|
submitEvent.currentTarget,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes!
|
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes
|
||||||
|
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: 'Work Order Milestone Type Updated Successfully',
|
message: 'Work Order Milestone Type Updated Successfully',
|
||||||
|
|
@ -56,14 +57,14 @@ function updateWorkOrderMilestoneType(submitEvent: SubmitEvent): void {
|
||||||
function deleteWorkOrderMilestoneType(clickEvent: Event): void {
|
function deleteWorkOrderMilestoneType(clickEvent: Event): void {
|
||||||
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
|
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
|
||||||
'tr'
|
'tr'
|
||||||
)!
|
) as HTMLTableRowElement
|
||||||
|
|
||||||
const workOrderMilestoneTypeId =
|
const workOrderMilestoneTypeId =
|
||||||
tableRowElement.dataset.workOrderMilestoneTypeId
|
tableRowElement.dataset.workOrderMilestoneTypeId
|
||||||
|
|
||||||
function doDelete(): void {
|
function doDelete(): void {
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doDeleteWorkOrderMilestoneType',
|
`${los.urlPrefix}/admin/doDeleteWorkOrderMilestoneType`,
|
||||||
{
|
{
|
||||||
workOrderMilestoneTypeId
|
workOrderMilestoneTypeId
|
||||||
},
|
},
|
||||||
|
|
@ -71,7 +72,7 @@ function deleteWorkOrderMilestoneType(clickEvent: Event): void {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes!
|
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes
|
||||||
|
|
||||||
if (workOrderMilestoneTypes.length === 0) {
|
if (workOrderMilestoneTypes.length === 0) {
|
||||||
renderWorkOrderMilestoneTypes()
|
renderWorkOrderMilestoneTypes()
|
||||||
|
|
@ -110,17 +111,17 @@ function deleteWorkOrderMilestoneType(clickEvent: Event): void {
|
||||||
function moveWorkOrderMilestoneType(clickEvent: MouseEvent): void {
|
function moveWorkOrderMilestoneType(clickEvent: MouseEvent): void {
|
||||||
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
|
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
|
||||||
|
|
||||||
const tableRowElement = buttonElement.closest('tr')!
|
const tableRowElement = buttonElement.closest('tr') as HTMLTableRowElement
|
||||||
|
|
||||||
const workOrderMilestoneTypeId =
|
const workOrderMilestoneTypeId =
|
||||||
tableRowElement.dataset.workOrderMilestoneTypeId
|
tableRowElement.dataset.workOrderMilestoneTypeId
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix +
|
`${los.urlPrefix}/admin/${
|
||||||
'/admin/' +
|
buttonElement.dataset.direction === 'up'
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveWorkOrderMilestoneTypeUp'
|
? 'doMoveWorkOrderMilestoneTypeUp'
|
||||||
: 'doMoveWorkOrderMilestoneTypeDown'),
|
: 'doMoveWorkOrderMilestoneTypeDown'
|
||||||
|
}`,
|
||||||
{
|
{
|
||||||
workOrderMilestoneTypeId,
|
workOrderMilestoneTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
|
|
@ -129,7 +130,7 @@ function moveWorkOrderMilestoneType(clickEvent: MouseEvent): void {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes!
|
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes
|
||||||
renderWorkOrderMilestoneTypes()
|
renderWorkOrderMilestoneTypes()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
|
|
@ -163,44 +164,42 @@ function renderWorkOrderMilestoneTypes(): void {
|
||||||
tableRowElement.dataset.workOrderMilestoneTypeId =
|
tableRowElement.dataset.workOrderMilestoneTypeId =
|
||||||
workOrderMilestoneType.workOrderMilestoneTypeId.toString()
|
workOrderMilestoneType.workOrderMilestoneTypeId.toString()
|
||||||
|
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property, no-secrets/no-secrets
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="workOrderMilestoneTypeId" type="hidden" value="' +
|
<input name="workOrderMilestoneTypeId" type="hidden" value="${workOrderMilestoneType.workOrderMilestoneTypeId.toString()}" />
|
||||||
workOrderMilestoneType.workOrderMilestoneTypeId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="workOrderMilestoneType" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType)}" maxlength="100" aria-label="Work Order Milestone Type" required />
|
||||||
'<input class="input" name="workOrderMilestoneType" type="text" value="' +
|
</div>
|
||||||
cityssm.escapeHTML(workOrderMilestoneType.workOrderMilestoneType) +
|
<div class="control">
|
||||||
'" maxlength="100" aria-label="Work Order Milestone Type" required />' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
'</div>' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
'<div class="control">' +
|
</button>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>') +
|
</form>
|
||||||
'</form>' +
|
</td><td class="is-nowrap">
|
||||||
'</td>' +
|
<div class="field is-grouped">
|
||||||
'<td class="is-nowrap">' +
|
<div class="control">
|
||||||
'<div class="field is-grouped">' +
|
${los.getMoveUpDownButtonFieldHTML(
|
||||||
'<div class="control">' +
|
|
||||||
los.getMoveUpDownButtonFieldHTML(
|
|
||||||
'button--moveWorkOrderMilestoneTypeUp',
|
'button--moveWorkOrderMilestoneTypeUp',
|
||||||
'button--moveWorkOrderMilestoneTypeDown',
|
'button--moveWorkOrderMilestoneTypeDown',
|
||||||
false
|
false
|
||||||
) +
|
)}
|
||||||
'</div>' +
|
</div>
|
||||||
'<div class="control">' +
|
<div class="control">
|
||||||
'<button class="button is-danger is-light button--deleteWorkOrderMilestoneType" data-tooltip="Delete Mielstone Type" type="button" aria-label="Delete Milestone Type">' +
|
<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>' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'</button>' +
|
</button>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</td>'
|
</td>`
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('form')!
|
.querySelector('form')
|
||||||
.addEventListener('submit', updateWorkOrderMilestoneType)
|
?.addEventListener('submit', updateWorkOrderMilestoneType)
|
||||||
;(
|
;(
|
||||||
tableRowElement.querySelector(
|
tableRowElement.querySelector(
|
||||||
'.button--moveWorkOrderMilestoneTypeUp'
|
'.button--moveWorkOrderMilestoneTypeUp'
|
||||||
|
|
@ -213,8 +212,8 @@ function renderWorkOrderMilestoneTypes(): void {
|
||||||
).addEventListener('click', moveWorkOrderMilestoneType)
|
).addEventListener('click', moveWorkOrderMilestoneType)
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('.button--deleteWorkOrderMilestoneType')!
|
.querySelector('.button--deleteWorkOrderMilestoneType')
|
||||||
.addEventListener('click', deleteWorkOrderMilestoneType)
|
?.addEventListener('click', deleteWorkOrderMilestoneType)
|
||||||
|
|
||||||
containerElement.append(tableRowElement)
|
containerElement.append(tableRowElement)
|
||||||
}
|
}
|
||||||
|
|
@ -227,16 +226,16 @@ function renderWorkOrderMilestoneTypes(): void {
|
||||||
const formElement = submitEvent.currentTarget as HTMLFormElement
|
const formElement = submitEvent.currentTarget as HTMLFormElement
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doAddWorkOrderMilestoneType',
|
`${los.urlPrefix}/admin/doAddWorkOrderMilestoneType`,
|
||||||
formElement,
|
formElement,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes!
|
workOrderMilestoneTypes = responseJSON.workOrderMilestoneTypes
|
||||||
renderWorkOrderMilestoneTypes()
|
renderWorkOrderMilestoneTypes()
|
||||||
formElement.reset()
|
formElement.reset()
|
||||||
formElement.querySelector('input')!.focus()
|
formElement.querySelector('input')?.focus()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Adding Work Order Milestone Type',
|
title: 'Error Adding Work Order Milestone Type',
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let workOrderTypes = exports.workOrderTypes;
|
let workOrderTypes = exports.workOrderTypes;
|
||||||
delete exports.workOrderTypes;
|
delete exports.workOrderTypes;
|
||||||
function updateWorkOrderType(submitEvent) {
|
function updateWorkOrderType(submitEvent) {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doUpdateWorkOrderType', submitEvent.currentTarget, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doUpdateWorkOrderType`, submitEvent.currentTarget, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -24,11 +25,11 @@ function updateWorkOrderType(submitEvent) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const deleteWorkOrderType = (clickEvent) => {
|
function deleteWorkOrderType(clickEvent) {
|
||||||
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
const tableRowElement = clickEvent.currentTarget.closest('tr');
|
||||||
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
|
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doDeleteWorkOrderType', {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doDeleteWorkOrderType`, {
|
||||||
workOrderTypeId
|
workOrderTypeId
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -66,16 +67,14 @@ const deleteWorkOrderType = (clickEvent) => {
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
function moveWorkOrderType(clickEvent) {
|
function moveWorkOrderType(clickEvent) {
|
||||||
const buttonElement = clickEvent.currentTarget;
|
const buttonElement = clickEvent.currentTarget;
|
||||||
const tableRowElement = buttonElement.closest('tr');
|
const tableRowElement = buttonElement.closest('tr');
|
||||||
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
|
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId;
|
||||||
cityssm.postJSON(los.urlPrefix +
|
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||||
'/admin/' +
|
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveWorkOrderTypeUp'
|
? 'doMoveWorkOrderTypeUp'
|
||||||
: 'doMoveWorkOrderTypeDown'), {
|
: 'doMoveWorkOrderTypeDown'}`, {
|
||||||
workOrderTypeId,
|
workOrderTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
}, (rawResponseJSON) => {
|
}, (rawResponseJSON) => {
|
||||||
|
|
@ -95,7 +94,7 @@ function moveWorkOrderType(clickEvent) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderWorkOrderTypes() {
|
function renderWorkOrderTypes() {
|
||||||
var _a;
|
var _a, _b, _c;
|
||||||
const containerElement = document.querySelector('#container--workOrderTypes');
|
const containerElement = document.querySelector('#container--workOrderTypes');
|
||||||
if (workOrderTypes.length === 0) {
|
if (workOrderTypes.length === 0) {
|
||||||
containerElement.innerHTML = `<tr><td colspan="2">
|
containerElement.innerHTML = `<tr><td colspan="2">
|
||||||
|
|
@ -108,44 +107,40 @@ function renderWorkOrderTypes() {
|
||||||
const tableRowElement = document.createElement('tr');
|
const tableRowElement = document.createElement('tr');
|
||||||
tableRowElement.dataset.workOrderTypeId =
|
tableRowElement.dataset.workOrderTypeId =
|
||||||
workOrderType.workOrderTypeId.toString();
|
workOrderType.workOrderTypeId.toString();
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="workOrderTypeId" type="hidden" value="' +
|
<input name="workOrderTypeId" type="hidden" value="${workOrderType.workOrderTypeId.toString()}" />
|
||||||
workOrderType.workOrderTypeId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="workOrderType" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML((_a = workOrderType.workOrderType) !== null && _a !== void 0 ? _a : '')}" maxlength="100" aria-label="Work Order Type" required />
|
||||||
'<input class="input" name="workOrderType" type="text" value="' +
|
</div>
|
||||||
cityssm.escapeHTML((_a = workOrderType.workOrderType) !== null && _a !== void 0 ? _a : '') +
|
<div class="control">
|
||||||
'" maxlength="100" aria-label="Work Order Type" required />' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
'</div>' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
'<div class="control">' +
|
</button>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>') +
|
</form>
|
||||||
'</form>' +
|
</td><td class="is-nowrap">
|
||||||
'</td>' +
|
<div class="field is-grouped">
|
||||||
'<td class="is-nowrap">' +
|
<div class="control">
|
||||||
'<div class="field is-grouped">' +
|
${los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderTypeUp', 'button--moveWorkOrderTypeDown', false)}
|
||||||
'<div class="control">' +
|
</div>
|
||||||
los.getMoveUpDownButtonFieldHTML('button--moveWorkOrderTypeUp', 'button--moveWorkOrderTypeDown', false) +
|
<div class="control">
|
||||||
'</div>' +
|
<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">
|
||||||
'<div class="control">' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'<button class="button is-danger is-light button--deleteWorkOrderType" data-tooltip="Delete Work Order Type" type="button" aria-label="Delete Work Order Type">' +
|
</button>
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
</div>
|
||||||
'</button>' +
|
</div>
|
||||||
'</div>' +
|
</td>`;
|
||||||
'</div>' +
|
(_b = tableRowElement
|
||||||
'</td>';
|
.querySelector('form')) === null || _b === void 0 ? void 0 : _b.addEventListener('submit', updateWorkOrderType);
|
||||||
tableRowElement
|
|
||||||
.querySelector('form')
|
|
||||||
.addEventListener('submit', updateWorkOrderType);
|
|
||||||
tableRowElement.querySelector('.button--moveWorkOrderTypeUp').addEventListener('click', moveWorkOrderType);
|
tableRowElement.querySelector('.button--moveWorkOrderTypeUp').addEventListener('click', moveWorkOrderType);
|
||||||
tableRowElement.querySelector('.button--moveWorkOrderTypeDown').addEventListener('click', moveWorkOrderType);
|
tableRowElement.querySelector('.button--moveWorkOrderTypeDown').addEventListener('click', moveWorkOrderType);
|
||||||
tableRowElement
|
(_c = tableRowElement
|
||||||
.querySelector('.button--deleteWorkOrderType')
|
.querySelector('.button--deleteWorkOrderType')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', deleteWorkOrderType);
|
||||||
.addEventListener('click', deleteWorkOrderType);
|
|
||||||
containerElement.append(tableRowElement);
|
containerElement.append(tableRowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -153,19 +148,19 @@ function renderWorkOrderTypes() {
|
||||||
document.querySelector('#form--addWorkOrderType').addEventListener('submit', (submitEvent) => {
|
document.querySelector('#form--addWorkOrderType').addEventListener('submit', (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
const formElement = submitEvent.currentTarget;
|
const formElement = submitEvent.currentTarget;
|
||||||
cityssm.postJSON(los.urlPrefix + '/admin/doAddWorkOrderType', formElement, (rawResponseJSON) => {
|
cityssm.postJSON(`${los.urlPrefix}/admin/doAddWorkOrderType`, formElement, (rawResponseJSON) => {
|
||||||
var _a;
|
var _a, _b;
|
||||||
const responseJSON = rawResponseJSON;
|
const responseJSON = rawResponseJSON;
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderTypes = responseJSON.workOrderTypes;
|
workOrderTypes = responseJSON.workOrderTypes;
|
||||||
renderWorkOrderTypes();
|
renderWorkOrderTypes();
|
||||||
formElement.reset();
|
formElement.reset();
|
||||||
formElement.querySelector('input').focus();
|
(_a = formElement.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Adding Work Order Type',
|
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'
|
contextualColorName: 'danger'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 { BulmaJS } from '@cityssm/bulma-js/types.js'
|
||||||
import type * as recordTypes from '../../types/recordTypes'
|
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||||
|
|
||||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
|
import type { LOS } from '../../types/globalTypes.js'
|
||||||
|
import type { WorkOrderType } from '../../types/recordTypes.js'
|
||||||
import type { BulmaJS } from '@cityssm/bulma-js/types'
|
|
||||||
|
|
||||||
declare const cityssm: cityssmGlobal
|
declare const cityssm: cityssmGlobal
|
||||||
declare const bulmaJS: BulmaJS
|
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
|
delete exports.workOrderTypes
|
||||||
|
|
||||||
type ResponseJSON =
|
type ResponseJSON =
|
||||||
| {
|
| {
|
||||||
success: true
|
success: true
|
||||||
workOrderTypes: recordTypes.WorkOrderType[]
|
workOrderTypes: WorkOrderType[]
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
success: false
|
success: false
|
||||||
|
|
@ -29,13 +30,13 @@ function updateWorkOrderType(submitEvent: SubmitEvent): void {
|
||||||
submitEvent.preventDefault()
|
submitEvent.preventDefault()
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doUpdateWorkOrderType',
|
`${los.urlPrefix}/admin/doUpdateWorkOrderType`,
|
||||||
submitEvent.currentTarget,
|
submitEvent.currentTarget,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderTypes = responseJSON.workOrderTypes!
|
workOrderTypes = responseJSON.workOrderTypes
|
||||||
|
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: 'Work Order Type Updated Successfully',
|
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(
|
const tableRowElement = (clickEvent.currentTarget as HTMLElement).closest(
|
||||||
'tr'
|
'tr'
|
||||||
)!
|
) as HTMLTableRowElement
|
||||||
|
|
||||||
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId
|
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId
|
||||||
|
|
||||||
function doDelete(): void {
|
function doDelete(): void {
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doDeleteWorkOrderType',
|
`${los.urlPrefix}/admin/doDeleteWorkOrderType`,
|
||||||
{
|
{
|
||||||
workOrderTypeId
|
workOrderTypeId
|
||||||
},
|
},
|
||||||
|
|
@ -69,7 +70,7 @@ const deleteWorkOrderType = (clickEvent: Event): void => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderTypes = responseJSON.workOrderTypes!
|
workOrderTypes = responseJSON.workOrderTypes
|
||||||
|
|
||||||
if (workOrderTypes.length === 0) {
|
if (workOrderTypes.length === 0) {
|
||||||
renderWorkOrderTypes()
|
renderWorkOrderTypes()
|
||||||
|
|
@ -108,16 +109,16 @@ const deleteWorkOrderType = (clickEvent: Event): void => {
|
||||||
function moveWorkOrderType(clickEvent: MouseEvent): void {
|
function moveWorkOrderType(clickEvent: MouseEvent): void {
|
||||||
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
|
const buttonElement = clickEvent.currentTarget as HTMLButtonElement
|
||||||
|
|
||||||
const tableRowElement = buttonElement.closest('tr')!
|
const tableRowElement = buttonElement.closest('tr') as HTMLTableRowElement
|
||||||
|
|
||||||
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId
|
const workOrderTypeId = tableRowElement.dataset.workOrderTypeId
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix +
|
`${los.urlPrefix}/admin/${
|
||||||
'/admin/' +
|
buttonElement.dataset.direction === 'up'
|
||||||
(buttonElement.dataset.direction === 'up'
|
|
||||||
? 'doMoveWorkOrderTypeUp'
|
? 'doMoveWorkOrderTypeUp'
|
||||||
: 'doMoveWorkOrderTypeDown'),
|
: 'doMoveWorkOrderTypeDown'
|
||||||
|
}`,
|
||||||
{
|
{
|
||||||
workOrderTypeId,
|
workOrderTypeId,
|
||||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||||
|
|
@ -126,7 +127,7 @@ function moveWorkOrderType(clickEvent: MouseEvent): void {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderTypes = responseJSON.workOrderTypes!
|
workOrderTypes = responseJSON.workOrderTypes
|
||||||
renderWorkOrderTypes()
|
renderWorkOrderTypes()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
|
|
@ -160,44 +161,42 @@ function renderWorkOrderTypes(): void {
|
||||||
tableRowElement.dataset.workOrderTypeId =
|
tableRowElement.dataset.workOrderTypeId =
|
||||||
workOrderType.workOrderTypeId.toString()
|
workOrderType.workOrderTypeId.toString()
|
||||||
|
|
||||||
tableRowElement.innerHTML =
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
'<td>' +
|
tableRowElement.innerHTML = `<td>
|
||||||
'<form>' +
|
<form>
|
||||||
'<input name="workOrderTypeId" type="hidden" value="' +
|
<input name="workOrderTypeId" type="hidden" value="${workOrderType.workOrderTypeId.toString()}" />
|
||||||
workOrderType.workOrderTypeId.toString() +
|
<div class="field has-addons">
|
||||||
'" />' +
|
<div class="control">
|
||||||
('<div class="field has-addons">' +
|
<input class="input" name="workOrderType" type="text"
|
||||||
'<div class="control">' +
|
value="${cityssm.escapeHTML(workOrderType.workOrderType ?? '')}" maxlength="100" aria-label="Work Order Type" required />
|
||||||
'<input class="input" name="workOrderType" type="text" value="' +
|
</div>
|
||||||
cityssm.escapeHTML(workOrderType.workOrderType ?? '') +
|
<div class="control">
|
||||||
'" maxlength="100" aria-label="Work Order Type" required />' +
|
<button class="button is-success" type="submit" aria-label="Save">
|
||||||
'</div>' +
|
<i class="fas fa-save" aria-hidden="true"></i>
|
||||||
'<div class="control">' +
|
</button>
|
||||||
'<button class="button is-success" type="submit" aria-label="Save"><i class="fas fa-save" aria-hidden="true"></i></button>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>') +
|
</form>
|
||||||
'</form>' +
|
</td><td class="is-nowrap">
|
||||||
'</td>' +
|
<div class="field is-grouped">
|
||||||
'<td class="is-nowrap">' +
|
<div class="control">
|
||||||
'<div class="field is-grouped">' +
|
${los.getMoveUpDownButtonFieldHTML(
|
||||||
'<div class="control">' +
|
|
||||||
los.getMoveUpDownButtonFieldHTML(
|
|
||||||
'button--moveWorkOrderTypeUp',
|
'button--moveWorkOrderTypeUp',
|
||||||
'button--moveWorkOrderTypeDown',
|
'button--moveWorkOrderTypeDown',
|
||||||
false
|
false
|
||||||
) +
|
)}
|
||||||
'</div>' +
|
</div>
|
||||||
'<div class="control">' +
|
<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">' +
|
<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>' +
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
'</button>' +
|
</button>
|
||||||
'</div>' +
|
</div>
|
||||||
'</div>' +
|
</div>
|
||||||
'</td>'
|
</td>`
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('form')!
|
.querySelector('form')
|
||||||
.addEventListener('submit', updateWorkOrderType)
|
?.addEventListener('submit', updateWorkOrderType)
|
||||||
;(
|
;(
|
||||||
tableRowElement.querySelector(
|
tableRowElement.querySelector(
|
||||||
'.button--moveWorkOrderTypeUp'
|
'.button--moveWorkOrderTypeUp'
|
||||||
|
|
@ -210,8 +209,8 @@ function renderWorkOrderTypes(): void {
|
||||||
).addEventListener('click', moveWorkOrderType)
|
).addEventListener('click', moveWorkOrderType)
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('.button--deleteWorkOrderType')!
|
.querySelector('.button--deleteWorkOrderType')
|
||||||
.addEventListener('click', deleteWorkOrderType)
|
?.addEventListener('click', deleteWorkOrderType)
|
||||||
|
|
||||||
containerElement.append(tableRowElement)
|
containerElement.append(tableRowElement)
|
||||||
}
|
}
|
||||||
|
|
@ -224,16 +223,16 @@ function renderWorkOrderTypes(): void {
|
||||||
const formElement = submitEvent.currentTarget as HTMLFormElement
|
const formElement = submitEvent.currentTarget as HTMLFormElement
|
||||||
|
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
los.urlPrefix + '/admin/doAddWorkOrderType',
|
`${los.urlPrefix}/admin/doAddWorkOrderType`,
|
||||||
formElement,
|
formElement,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as ResponseJSON
|
const responseJSON = rawResponseJSON as ResponseJSON
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
workOrderTypes = responseJSON.workOrderTypes!
|
workOrderTypes = responseJSON.workOrderTypes
|
||||||
renderWorkOrderTypes()
|
renderWorkOrderTypes()
|
||||||
formElement.reset()
|
formElement.reset()
|
||||||
formElement.querySelector('input')!.focus()
|
formElement.querySelector('input')?.focus()
|
||||||
} else {
|
} else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: 'Error Adding Work Order Type',
|
title: 'Error Adding Work Order Type',
|
||||||
|
|
|
||||||
|
|
@ -1586,7 +1586,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
|
.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();
|
const feeGrandTotal = getFeeGrandTotal();
|
||||||
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
|
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
|
||||||
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `<div class="message is-warning">
|
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `<div class="message is-warning">
|
||||||
|
|
|
||||||
|
|
@ -514,7 +514,7 @@ function renderLotOccupancyTransactions() {
|
||||||
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
|
.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();
|
const feeGrandTotal = getFeeGrandTotal();
|
||||||
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
|
if (feeGrandTotal.toFixed(2) !== transactionGrandTotal.toFixed(2)) {
|
||||||
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `<div class="message is-warning">
|
lotOccupancyTransactionsContainerElement.insertAdjacentHTML('afterbegin', `<div class="message is-warning">
|
||||||
|
|
|
||||||
|
|
@ -784,7 +784,7 @@ function renderLotOccupancyTransactions(): void {
|
||||||
lotOccupancyTransactionsContainerElement.querySelector(
|
lotOccupancyTransactionsContainerElement.querySelector(
|
||||||
'#lotOccupancyTransactions--grandTotal'
|
'#lotOccupancyTransactions--grandTotal'
|
||||||
) as HTMLElement
|
) as HTMLElement
|
||||||
).textContent = `\$${transactionGrandTotal.toFixed(2)}`
|
).textContent = `$${transactionGrandTotal.toFixed(2)}`
|
||||||
|
|
||||||
const feeGrandTotal = getFeeGrandTotal()
|
const feeGrandTotal = getFeeGrandTotal()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
addLot(lotId);
|
addLot(lotId);
|
||||||
}
|
}
|
||||||
function renderRelatedOccupancies() {
|
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');
|
const occupanciesContainerElement = document.querySelector('#container--lotOccupancies');
|
||||||
document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent = workOrderLotOccupancies.length.toString();
|
document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent = workOrderLotOccupancies.length.toString();
|
||||||
if (workOrderLotOccupancies.length === 0) {
|
if (workOrderLotOccupancies.length === 0) {
|
||||||
|
|
@ -311,14 +311,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let occupantsHTML = '';
|
let occupantsHTML = '';
|
||||||
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
|
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
|
||||||
occupantsHTML += `<li class="has-tooltip-left"
|
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">
|
<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'
|
? 'user'
|
||||||
: occupant.fontAwesomeIconClass)}" aria-label="${los.escapedAliases.Occupant}"></i>
|
: (_e = occupant.fontAwesomeIconClass) !== null && _e !== void 0 ? _e : '')}" aria-label="${los.escapedAliases.Occupant}"></i>
|
||||||
</span>
|
</span>
|
||||||
${cityssm.escapeHTML(occupant.occupantName)}
|
${cityssm.escapeHTML((_f = occupant.occupantName) !== null && _f !== void 0 ? _f : '')}
|
||||||
${cityssm.escapeHTML(occupant.occupantFamilyName)}
|
${cityssm.escapeHTML((_g = occupant.occupantFamilyName) !== null && _g !== void 0 ? _g : '')}
|
||||||
</li>`;
|
</li>`;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-unsanitized/method
|
// 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>
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>`);
|
</td>`);
|
||||||
(_d = rowElement
|
(_h = rowElement
|
||||||
.querySelector('.button--addLot')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', addLotFromLotOccupancy);
|
.querySelector('.button--addLot')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', addLotFromLotOccupancy);
|
||||||
(_e = rowElement
|
(_j = rowElement
|
||||||
.querySelector('.button--deleteLotOccupancy')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancy);
|
.querySelector('.button--deleteLotOccupancy')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', deleteLotOccupancy);
|
||||||
(_f = occupanciesContainerElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(rowElement);
|
(_k = occupanciesContainerElement.querySelector('tbody')) === null || _k === void 0 ? void 0 : _k.append(rowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function openEditLotStatus(clickEvent) {
|
function openEditLotStatus(clickEvent) {
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@
|
||||||
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
|
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.js'
|
||||||
|
|
||||||
import type * as globalTypes from '../../types/globalTypes.js'
|
import type { LOS } from '../../types/globalTypes.js'
|
||||||
import type * as recordTypes from '../../types/recordTypes.js'
|
import type { WorkOrderMilestone, WorkOrderMilestoneType } from '../../types/recordTypes.js'
|
||||||
|
|
||||||
declare const cityssm: cityssmGlobal
|
declare const cityssm: cityssmGlobal
|
||||||
declare const bulmaJS: BulmaJS
|
declare const bulmaJS: BulmaJS
|
||||||
|
|
||||||
declare const exports: Record<string, unknown>
|
declare const exports: Record<string, unknown>
|
||||||
;(() => {
|
;(() => {
|
||||||
const los = exports.los as globalTypes.LOS
|
const los = exports.los as LOS
|
||||||
|
|
||||||
const workOrderId = (
|
const workOrderId = (
|
||||||
document.querySelector('#workOrderEdit--workOrderId') as HTMLInputElement
|
document.querySelector('#workOrderEdit--workOrderId') as HTMLInputElement
|
||||||
|
|
@ -147,7 +147,7 @@ declare const exports: Record<string, unknown>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
let workOrderMilestones: recordTypes.WorkOrderMilestone[]
|
let workOrderMilestones: WorkOrderMilestone[]
|
||||||
|
|
||||||
document
|
document
|
||||||
.querySelector('#button--closeWorkOrder')
|
.querySelector('#button--closeWorkOrder')
|
||||||
|
|
@ -257,7 +257,7 @@ declare const exports: Record<string, unknown>
|
||||||
},
|
},
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
workOrderMilestones: recordTypes.WorkOrderMilestone[]
|
workOrderMilestones: WorkOrderMilestone[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const workOrderMilestones = responseJSON.workOrderMilestones.filter(
|
const workOrderMilestones = responseJSON.workOrderMilestones.filter(
|
||||||
|
|
@ -309,7 +309,7 @@ declare const exports: Record<string, unknown>
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
success: boolean
|
success: boolean
|
||||||
errorMessage?: string
|
errorMessage?: string
|
||||||
workOrderMilestones: recordTypes.WorkOrderMilestone[]
|
workOrderMilestones: WorkOrderMilestone[]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -340,7 +340,7 @@ declare const exports: Record<string, unknown>
|
||||||
|
|
||||||
const workOrderMilestone = workOrderMilestones.find((currentMilestone) => {
|
const workOrderMilestone = workOrderMilestones.find((currentMilestone) => {
|
||||||
return currentMilestone.workOrderMilestoneId === workOrderMilestoneId
|
return currentMilestone.workOrderMilestoneId === workOrderMilestoneId
|
||||||
}) as recordTypes.WorkOrderMilestone
|
}) as WorkOrderMilestone
|
||||||
|
|
||||||
function doComplete(): void {
|
function doComplete(): void {
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
|
|
@ -449,7 +449,7 @@ declare const exports: Record<string, unknown>
|
||||||
|
|
||||||
const workOrderMilestone = workOrderMilestones.find((currentMilestone) => {
|
const workOrderMilestone = workOrderMilestones.find((currentMilestone) => {
|
||||||
return currentMilestone.workOrderMilestoneId === workOrderMilestoneId
|
return currentMilestone.workOrderMilestoneId === workOrderMilestoneId
|
||||||
}) as recordTypes.WorkOrderMilestone
|
}) as WorkOrderMilestone
|
||||||
|
|
||||||
let editCloseModalFunction: () => void
|
let editCloseModalFunction: () => void
|
||||||
let workOrderMilestoneDateStringElement: HTMLInputElement
|
let workOrderMilestoneDateStringElement: HTMLInputElement
|
||||||
|
|
@ -464,7 +464,7 @@ declare const exports: Record<string, unknown>
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
success: boolean
|
success: boolean
|
||||||
errorMessage?: string
|
errorMessage?: string
|
||||||
workOrderMilestones?: recordTypes.WorkOrderMilestone[]
|
workOrderMilestones?: WorkOrderMilestone[]
|
||||||
}
|
}
|
||||||
|
|
||||||
processMilestoneResponse(responseJSON)
|
processMilestoneResponse(responseJSON)
|
||||||
|
|
@ -494,7 +494,7 @@ declare const exports: Record<string, unknown>
|
||||||
|
|
||||||
let milestoneTypeFound = false
|
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')
|
const optionElement = document.createElement('option')
|
||||||
|
|
||||||
optionElement.value =
|
optionElement.value =
|
||||||
|
|
@ -517,11 +517,15 @@ declare const exports: Record<string, unknown>
|
||||||
workOrderMilestone.workOrderMilestoneTypeId
|
workOrderMilestone.workOrderMilestoneTypeId
|
||||||
) {
|
) {
|
||||||
const optionElement = document.createElement('option')
|
const optionElement = document.createElement('option')
|
||||||
|
|
||||||
optionElement.value =
|
optionElement.value =
|
||||||
workOrderMilestone.workOrderMilestoneTypeId.toString()
|
workOrderMilestone.workOrderMilestoneTypeId.toString()
|
||||||
|
|
||||||
optionElement.textContent =
|
optionElement.textContent =
|
||||||
workOrderMilestone.workOrderMilestoneType ?? ''
|
workOrderMilestone.workOrderMilestoneType ?? ''
|
||||||
|
|
||||||
optionElement.selected = true
|
optionElement.selected = true
|
||||||
|
|
||||||
milestoneTypeElement.append(optionElement)
|
milestoneTypeElement.append(optionElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -683,7 +687,7 @@ declare const exports: Record<string, unknown>
|
||||||
|
|
||||||
if (!isCreate) {
|
if (!isCreate) {
|
||||||
workOrderMilestones =
|
workOrderMilestones =
|
||||||
exports.workOrderMilestones as recordTypes.WorkOrderMilestone[]
|
exports.workOrderMilestones as WorkOrderMilestone[]
|
||||||
delete exports.workOrderMilestones
|
delete exports.workOrderMilestones
|
||||||
|
|
||||||
renderMilestones()
|
renderMilestones()
|
||||||
|
|
@ -710,7 +714,7 @@ declare const exports: Record<string, unknown>
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
success: boolean
|
success: boolean
|
||||||
errorMessage?: string
|
errorMessage?: string
|
||||||
workOrderMilestones?: recordTypes.WorkOrderMilestone[]
|
workOrderMilestones?: WorkOrderMilestone[]
|
||||||
}
|
}
|
||||||
|
|
||||||
processMilestoneResponse(responseJSON)
|
processMilestoneResponse(responseJSON)
|
||||||
|
|
@ -755,7 +759,7 @@ declare const exports: Record<string, unknown>
|
||||||
'#milestoneAdd--workOrderMilestoneTypeId'
|
'#milestoneAdd--workOrderMilestoneTypeId'
|
||||||
) as HTMLSelectElement
|
) as HTMLSelectElement
|
||||||
|
|
||||||
for (const milestoneType of exports.workOrderMilestoneTypes as recordTypes.WorkOrderMilestoneType[]) {
|
for (const milestoneType of exports.workOrderMilestoneTypes as WorkOrderMilestoneType[]) {
|
||||||
const optionElement = document.createElement('option')
|
const optionElement = document.createElement('option')
|
||||||
|
|
||||||
optionElement.value =
|
optionElement.value =
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ function addLotFromLotOccupancy(clickEvent) {
|
||||||
addLot(lotId);
|
addLot(lotId);
|
||||||
}
|
}
|
||||||
function renderRelatedOccupancies() {
|
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');
|
const occupanciesContainerElement = document.querySelector('#container--lotOccupancies');
|
||||||
document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent = workOrderLotOccupancies.length.toString();
|
document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent = workOrderLotOccupancies.length.toString();
|
||||||
if (workOrderLotOccupancies.length === 0) {
|
if (workOrderLotOccupancies.length === 0) {
|
||||||
|
|
@ -157,14 +157,14 @@ function renderRelatedOccupancies() {
|
||||||
let occupantsHTML = '';
|
let occupantsHTML = '';
|
||||||
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
|
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
|
||||||
occupantsHTML += `<li class="has-tooltip-left"
|
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">
|
<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'
|
? 'user'
|
||||||
: occupant.fontAwesomeIconClass)}" aria-label="${los.escapedAliases.Occupant}"></i>
|
: (_e = occupant.fontAwesomeIconClass) !== null && _e !== void 0 ? _e : '')}" aria-label="${los.escapedAliases.Occupant}"></i>
|
||||||
</span>
|
</span>
|
||||||
${cityssm.escapeHTML(occupant.occupantName)}
|
${cityssm.escapeHTML((_f = occupant.occupantName) !== null && _f !== void 0 ? _f : '')}
|
||||||
${cityssm.escapeHTML(occupant.occupantFamilyName)}
|
${cityssm.escapeHTML((_g = occupant.occupantFamilyName) !== null && _g !== void 0 ? _g : '')}
|
||||||
</li>`;
|
</li>`;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-unsanitized/method
|
// eslint-disable-next-line no-unsanitized/method
|
||||||
|
|
@ -183,11 +183,11 @@ function renderRelatedOccupancies() {
|
||||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>`);
|
</td>`);
|
||||||
(_d = rowElement
|
(_h = rowElement
|
||||||
.querySelector('.button--addLot')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', addLotFromLotOccupancy);
|
.querySelector('.button--addLot')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', addLotFromLotOccupancy);
|
||||||
(_e = rowElement
|
(_j = rowElement
|
||||||
.querySelector('.button--deleteLotOccupancy')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', deleteLotOccupancy);
|
.querySelector('.button--deleteLotOccupancy')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', deleteLotOccupancy);
|
||||||
(_f = occupanciesContainerElement.querySelector('tbody')) === null || _f === void 0 ? void 0 : _f.append(rowElement);
|
(_k = occupanciesContainerElement.querySelector('tbody')) === null || _k === void 0 ? void 0 : _k.append(rowElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function openEditLotStatus(clickEvent) {
|
function openEditLotStatus(clickEvent) {
|
||||||
|
|
|
||||||
|
|
@ -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 { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||||
|
|
||||||
import type { LOS } from '../../types/globalTypes.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 cityssm: cityssmGlobal
|
||||||
declare const bulmaJS: BulmaJS
|
declare const bulmaJS: BulmaJS
|
||||||
|
|
@ -15,11 +15,10 @@ declare const los: LOS
|
||||||
|
|
||||||
declare const workOrderId: string
|
declare const workOrderId: string
|
||||||
|
|
||||||
let workOrderLots = exports.workOrderLots as recordTypes.Lot[]
|
let workOrderLots = exports.workOrderLots as Lot[]
|
||||||
delete exports.workOrderLots
|
delete exports.workOrderLots
|
||||||
|
|
||||||
let workOrderLotOccupancies =
|
let workOrderLotOccupancies = exports.workOrderLotOccupancies as LotOccupancy[]
|
||||||
exports.workOrderLotOccupancies as recordTypes.LotOccupancy[]
|
|
||||||
delete exports.workOrderLotOccupancies
|
delete exports.workOrderLotOccupancies
|
||||||
|
|
||||||
function deleteLotOccupancy(clickEvent: Event): void {
|
function deleteLotOccupancy(clickEvent: Event): void {
|
||||||
|
|
@ -40,7 +39,7 @@ function deleteLotOccupancy(clickEvent: Event): void {
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
success: boolean
|
success: boolean
|
||||||
errorMessage?: string
|
errorMessage?: string
|
||||||
workOrderLotOccupancies: recordTypes.LotOccupancy[]
|
workOrderLotOccupancies: LotOccupancy[]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -82,7 +81,7 @@ function addLot(
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
success: boolean
|
success: boolean
|
||||||
errorMessage?: string
|
errorMessage?: string
|
||||||
workOrderLots: recordTypes.Lot[]
|
workOrderLots: Lot[]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -117,7 +116,7 @@ function addLotOccupancy(
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
success: boolean
|
success: boolean
|
||||||
errorMessage?: string
|
errorMessage?: string
|
||||||
workOrderLotOccupancies: recordTypes.LotOccupancy[]
|
workOrderLotOccupancies: LotOccupancy[]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -239,16 +238,16 @@ function renderRelatedOccupancies(): void {
|
||||||
|
|
||||||
for (const occupant of lotOccupancy.lotOccupancyOccupants!) {
|
for (const occupant of lotOccupancy.lotOccupancyOccupants!) {
|
||||||
occupantsHTML += `<li class="has-tooltip-left"
|
occupantsHTML += `<li class="has-tooltip-left"
|
||||||
data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType!)}">
|
data-tooltip="${cityssm.escapeHTML(occupant.lotOccupantType ?? '')}">
|
||||||
<span class="fa-li">
|
<span class="fa-li">
|
||||||
<i class="fas fa-fw fa-${cityssm.escapeHTML(
|
<i class="fas fa-fw fa-${cityssm.escapeHTML(
|
||||||
(occupant.fontAwesomeIconClass ?? '') === ''
|
(occupant.fontAwesomeIconClass ?? '') === ''
|
||||||
? 'user'
|
? 'user'
|
||||||
: occupant.fontAwesomeIconClass!
|
: occupant.fontAwesomeIconClass ?? ''
|
||||||
)}" aria-label="${los.escapedAliases.Occupant}"></i>
|
)}" aria-label="${los.escapedAliases.Occupant}"></i>
|
||||||
</span>
|
</span>
|
||||||
${cityssm.escapeHTML(occupant.occupantName!)}
|
${cityssm.escapeHTML(occupant.occupantName ?? '')}
|
||||||
${cityssm.escapeHTML(occupant.occupantFamilyName!)}
|
${cityssm.escapeHTML(occupant.occupantFamilyName ?? '')}
|
||||||
</li>`
|
</li>`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -300,7 +299,7 @@ function openEditLotStatus(clickEvent: Event): void {
|
||||||
|
|
||||||
const lot = workOrderLots.find((possibleLot) => {
|
const lot = workOrderLots.find((possibleLot) => {
|
||||||
return possibleLot.lotId === lotId
|
return possibleLot.lotId === lotId
|
||||||
}) as recordTypes.Lot
|
}) as Lot
|
||||||
|
|
||||||
let editCloseModalFunction: () => void
|
let editCloseModalFunction: () => void
|
||||||
|
|
||||||
|
|
@ -314,7 +313,7 @@ function openEditLotStatus(clickEvent: Event): void {
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
success: boolean
|
success: boolean
|
||||||
errorMessage?: string
|
errorMessage?: string
|
||||||
workOrderLots: recordTypes.Lot[]
|
workOrderLots: Lot[]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -350,7 +349,7 @@ function openEditLotStatus(clickEvent: Event): void {
|
||||||
|
|
||||||
let lotStatusFound = false
|
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')
|
const optionElement = document.createElement('option')
|
||||||
optionElement.value = lotStatus.lotStatusId.toString()
|
optionElement.value = lotStatus.lotStatusId.toString()
|
||||||
optionElement.textContent = lotStatus.lotStatus
|
optionElement.textContent = lotStatus.lotStatus
|
||||||
|
|
@ -414,7 +413,7 @@ function deleteLot(clickEvent: Event): void {
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
success: boolean
|
success: boolean
|
||||||
errorMessage?: string
|
errorMessage?: string
|
||||||
workOrderLots: recordTypes.Lot[]
|
workOrderLots: Lot[]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
|
|
@ -557,7 +556,7 @@ document
|
||||||
searchFormElement,
|
searchFormElement,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as {
|
const responseJSON = rawResponseJSON as {
|
||||||
lotOccupancies: recordTypes.LotOccupancy[]
|
lotOccupancies: LotOccupancy[]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseJSON.lotOccupancies.length === 0) {
|
if (responseJSON.lotOccupancies.length === 0) {
|
||||||
|
|
@ -745,7 +744,7 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => {
|
||||||
`${los.urlPrefix}/lots/doSearchLots`,
|
`${los.urlPrefix}/lots/doSearchLots`,
|
||||||
searchFormElement,
|
searchFormElement,
|
||||||
(rawResponseJSON) => {
|
(rawResponseJSON) => {
|
||||||
const responseJSON = rawResponseJSON as { lots: recordTypes.Lot[] }
|
const responseJSON = rawResponseJSON as { lots: Lot[] }
|
||||||
|
|
||||||
if (responseJSON.lots.length === 0) {
|
if (responseJSON.lots.length === 0) {
|
||||||
searchResultsContainerElement.innerHTML = `<div class="message is-info">
|
searchResultsContainerElement.innerHTML = `<div class="message is-info">
|
||||||
|
|
@ -817,7 +816,7 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => {
|
||||||
'#lotSearch--lotStatusId'
|
'#lotSearch--lotStatusId'
|
||||||
) as HTMLSelectElement
|
) as HTMLSelectElement
|
||||||
|
|
||||||
for (const lotStatus of exports.lotStatuses as recordTypes.LotStatus[]) {
|
for (const lotStatus of exports.lotStatuses as LotStatus[]) {
|
||||||
const optionElement = document.createElement('option')
|
const optionElement = document.createElement('option')
|
||||||
optionElement.value = lotStatus.lotStatusId.toString()
|
optionElement.value = lotStatus.lotStatusId.toString()
|
||||||
optionElement.textContent = lotStatus.lotStatus
|
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
Loading…
Reference in New Issue