deepsource-autofix-76c6eb20
Dan Gowans 2023-02-28 09:59:05 -05:00
parent fb4e4cb202
commit ef727e9a39
7 changed files with 76 additions and 47 deletions

View File

@ -60,10 +60,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
function doDelete() { function doDelete() {
cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLot', { cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLot', {
lotId lotId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
cityssm.disableNavBlocker(); clearUnsavedChanges();
window.location.href = los.getLotURL(); window.location.href = los.getLotURL();
} }
else { else {
@ -98,8 +99,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
cityssm.postJSON(los.urlPrefix + '/lots/doGetLotTypeFields', { cityssm.postJSON(los.urlPrefix + '/lots/doGetLotTypeFields', {
lotTypeId: lotTypeIdElement.value lotTypeId: lotTypeIdElement.value
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.lotTypeFields.length === 0) { if (responseJSON.lotTypeFields.length === 0) {
lotFieldsContainerElement.innerHTML = `<div class="message is-info"> lotFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no additional fields for this ${los.escapedAliases.lot} type.</p> <p class="message-body">There are no additional fields for this ${los.escapedAliases.lot} type.</p>
@ -190,8 +192,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
let editCloseModalFunction; let editCloseModalFunction;
function editComment(submitEvent) { function editComment(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/lots/doUpdateLotComment', editFormElement, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/lots/doUpdateLotComment', editFormElement, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
lotComments = responseJSON.lotComments; lotComments = responseJSON.lotComments;
editCloseModalFunction(); editCloseModalFunction();
@ -241,8 +244,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLotComment', { cityssm.postJSON(los.urlPrefix + '/lots/doDeleteLotComment', {
lotId, lotId,
lotCommentId lotCommentId
}, (responseJSON) => { }, (rawResponseJSON) => {
var _a; var _a;
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
lotComments = responseJSON.lotComments; lotComments = responseJSON.lotComments;
renderLotComments(); renderLotComments();
@ -326,7 +330,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
let addCommentCloseModalFunction; let addCommentCloseModalFunction;
function doAddComment(formEvent) { function doAddComment(formEvent) {
formEvent.preventDefault(); formEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/lots/doAddLotComment', formEvent.currentTarget, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/lots/doAddLotComment', formEvent.currentTarget, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.success) { if (responseJSON.success) {
lotComments = responseJSON.lotComments; lotComments = responseJSON.lotComments;
renderLotComments(); renderLotComments();

View File

@ -92,9 +92,14 @@ declare const bulmaJS: BulmaJS
{ {
lotId lotId
}, },
(responseJSON: { success: boolean; errorMessage?: string }) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
}
if (responseJSON.success) { if (responseJSON.success) {
cityssm.disableNavBlocker() clearUnsavedChanges()
window.location.href = los.getLotURL() window.location.href = los.getLotURL()
} else { } else {
bulmaJS.alert({ bulmaJS.alert({
@ -143,7 +148,11 @@ declare const bulmaJS: BulmaJS
{ {
lotTypeId: lotTypeIdElement.value lotTypeId: lotTypeIdElement.value
}, },
(responseJSON: { lotTypeFields: recordTypes.LotTypeField[] }) => { (rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
lotTypeFields: recordTypes.LotTypeField[]
}
if (responseJSON.lotTypeFields.length === 0) { if (responseJSON.lotTypeFields.length === 0) {
lotFieldsContainerElement.innerHTML = `<div class="message is-info"> lotFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">There are no additional fields for this ${los.escapedAliases.lot} type.</p> <p class="message-body">There are no additional fields for this ${los.escapedAliases.lot} type.</p>
@ -280,11 +289,13 @@ declare const bulmaJS: BulmaJS
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lots/doUpdateLotComment', los.urlPrefix + '/lots/doUpdateLotComment',
editFormElement, editFormElement,
(responseJSON: { (rawResponseJSON) => {
success: boolean const responseJSON = rawResponseJSON as {
errorMessage?: string success: boolean
lotComments?: recordTypes.LotComment[] errorMessage?: string
}) => { lotComments?: recordTypes.LotComment[]
}
if (responseJSON.success) { if (responseJSON.success) {
lotComments = responseJSON.lotComments! lotComments = responseJSON.lotComments!
editCloseModalFunction() editCloseModalFunction()
@ -373,11 +384,13 @@ declare const bulmaJS: BulmaJS
lotId, lotId,
lotCommentId lotCommentId
}, },
(responseJSON: { (rawResponseJSON) => {
success: boolean const responseJSON = rawResponseJSON as {
errorMessage?: string success: boolean
lotComments: recordTypes.LotComment[] errorMessage?: string
}) => { lotComments: recordTypes.LotComment[]
}
if (responseJSON.success) { if (responseJSON.success) {
lotComments = responseJSON.lotComments lotComments = responseJSON.lotComments
renderLotComments() renderLotComments()
@ -478,10 +491,12 @@ declare const bulmaJS: BulmaJS
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/lots/doAddLotComment', los.urlPrefix + '/lots/doAddLotComment',
formEvent.currentTarget, formEvent.currentTarget,
(responseJSON: { (rawResponseJSON) => {
success: boolean const responseJSON = rawResponseJSON as {
lotComments?: recordTypes.LotComment[] success: boolean
}) => { lotComments?: recordTypes.LotComment[]
}
if (responseJSON.success) { if (responseJSON.success) {
lotComments = responseJSON.lotComments! lotComments = responseJSON.lotComments!
renderLotComments() renderLotComments()

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable spaced-comment, @typescript-eslint/indent, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b, _c; var _a, _b, _c;
@ -1011,7 +1011,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
let editCloseModalFunction; let editCloseModalFunction;
function doEdit(submitEvent) { function doEdit(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateWorkOrderMilestone', submitEvent.currentTarget, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateWorkOrderMilestone', submitEvent.currentTarget, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
processMilestoneResponse(responseJSON); processMilestoneResponse(responseJSON);
if (responseJSON.success) { if (responseJSON.success) {
editCloseModalFunction(); editCloseModalFunction();
@ -1169,7 +1170,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
const currentDateString = cityssm.dateToString(new Date()); const currentDateString = cityssm.dateToString(new Date());
function _doAdd() { function _doAdd() {
cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderMilestone', addFormElement, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderMilestone', addFormElement, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
processMilestoneResponse(responseJSON); processMilestoneResponse(responseJSON);
if (responseJSON.success) { if (responseJSON.success) {
addCloseModalFunction(); addCloseModalFunction();

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable spaced-comment, @typescript-eslint/indent, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b, _c; var _a, _b, _c;
@ -253,7 +253,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
let editCloseModalFunction; let editCloseModalFunction;
function doEdit(submitEvent) { function doEdit(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateWorkOrderMilestone', submitEvent.currentTarget, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/workOrders/doUpdateWorkOrderMilestone', submitEvent.currentTarget, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
processMilestoneResponse(responseJSON); processMilestoneResponse(responseJSON);
if (responseJSON.success) { if (responseJSON.success) {
editCloseModalFunction(); editCloseModalFunction();
@ -411,7 +412,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
const currentDateString = cityssm.dateToString(new Date()); const currentDateString = cityssm.dateToString(new Date());
function _doAdd() { function _doAdd() {
cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderMilestone', addFormElement, (responseJSON) => { cityssm.postJSON(los.urlPrefix + '/workOrders/doAddWorkOrderMilestone', addFormElement, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
processMilestoneResponse(responseJSON); processMilestoneResponse(responseJSON);
if (responseJSON.success) { if (responseJSON.success) {
addCloseModalFunction(); addCloseModalFunction();

View File

@ -1,4 +1,4 @@
/* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable spaced-comment, @typescript-eslint/indent, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types'
import type { BulmaJS } from '@cityssm/bulma-js/types' import type { BulmaJS } from '@cityssm/bulma-js/types'
@ -82,8 +82,9 @@ declare const bulmaJS: BulmaJS
) )
}) })
const inputElements: NodeListOf<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement> = const inputElements: NodeListOf<
workOrderFormElement.querySelectorAll('input, select, textarea') HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
> = workOrderFormElement.querySelectorAll('input, select, textarea')
for (const inputElement of inputElements) { for (const inputElement of inputElements) {
inputElement.addEventListener('change', setUnsavedChanges) inputElement.addEventListener('change', setUnsavedChanges)
@ -376,11 +377,13 @@ declare const bulmaJS: BulmaJS
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/workOrders/doUpdateWorkOrderMilestone', los.urlPrefix + '/workOrders/doUpdateWorkOrderMilestone',
submitEvent.currentTarget, submitEvent.currentTarget,
(responseJSON: { (rawResponseJSON) => {
success: boolean const responseJSON = rawResponseJSON as {
errorMessage?: string success: boolean
workOrderMilestones?: recordTypes.WorkOrderMilestone[] errorMessage?: string
}) => { workOrderMilestones?: recordTypes.WorkOrderMilestone[]
}
processMilestoneResponse(responseJSON) processMilestoneResponse(responseJSON)
if (responseJSON.success) { if (responseJSON.success) {
editCloseModalFunction() editCloseModalFunction()
@ -498,9 +501,9 @@ declare const bulmaJS: BulmaJS
('<div class="column is-narrow">' + ('<div class="column is-narrow">' +
(milestone.workOrderMilestoneCompletionDate (milestone.workOrderMilestoneCompletionDate
? '<span class="button is-static" data-tooltip="Completed ' + ? '<span class="button is-static" data-tooltip="Completed ' +
milestone.workOrderMilestoneCompletionDateString + milestone.workOrderMilestoneCompletionDateString! +
'" aria-label="Completed ' + '" aria-label="Completed ' +
milestone.workOrderMilestoneCompletionDateString + milestone.workOrderMilestoneCompletionDateString! +
'">' + '">' +
'<span class="icon is-small"><i class="fas fa-check" aria-hidden="true"></i></span>' + '<span class="icon is-small"><i class="fas fa-check" aria-hidden="true"></i></span>' +
'</span>' '</span>'
@ -518,7 +521,7 @@ declare const bulmaJS: BulmaJS
? '<span class="has-text-grey">(No Set Date)</span>' ? '<span class="has-text-grey">(No Set Date)</span>'
: milestone.workOrderMilestoneDateString) + : milestone.workOrderMilestoneDateString) +
(milestone.workOrderMilestoneTime (milestone.workOrderMilestoneTime
? ' ' + milestone.workOrderMilestoneTimeString ? ' ' + milestone.workOrderMilestoneTimeString!
: '') + : '') +
'<br />' + '<br />' +
'<span class="is-size-7">' + '<span class="is-size-7">' +
@ -600,11 +603,13 @@ declare const bulmaJS: BulmaJS
cityssm.postJSON( cityssm.postJSON(
los.urlPrefix + '/workOrders/doAddWorkOrderMilestone', los.urlPrefix + '/workOrders/doAddWorkOrderMilestone',
addFormElement, addFormElement,
(responseJSON: { (rawResponseJSON) => {
success: boolean const responseJSON = rawResponseJSON as {
errorMessage?: string success: boolean
workOrderMilestones?: recordTypes.WorkOrderMilestone[] errorMessage?: string
}) => { workOrderMilestones?: recordTypes.WorkOrderMilestone[]
}
processMilestoneResponse(responseJSON) processMilestoneResponse(responseJSON)
if (responseJSON.success) { if (responseJSON.success) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long