diff --git a/public-typescript/adminFees.ts b/public-typescript/adminFees.ts index 503becce..59564165 100644 --- a/public-typescript/adminFees.ts +++ b/public-typescript/adminFees.ts @@ -5,7 +5,12 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { LOS } from '../types/globalTypes.js' -import type * as recordTypes from '../types/recordTypes.js' +import type { + Fee, + FeeCategory, + LotType, + OccupancyType +} from '../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS @@ -18,13 +23,13 @@ declare const exports: Record '#container--feeCategories' ) as HTMLElement - let feeCategories = exports.feeCategories as recordTypes.FeeCategory[] + let feeCategories = exports.feeCategories as FeeCategory[] delete exports.feeCategories type ResponseJSON = | { success: true - feeCategories: recordTypes.FeeCategory[] + feeCategories: FeeCategory[] } | { success: false @@ -305,7 +310,7 @@ declare const exports: Record const feeCategory = feeCategories.find((currentFeeCategory) => { return currentFeeCategory.feeCategoryId === feeCategoryId - }) as recordTypes.FeeCategory + }) as FeeCategory let editCloseModalFunction: () => void @@ -506,7 +511,7 @@ declare const exports: Record '#feeAdd--occupancyTypeId' ) as HTMLSelectElement - for (const occupancyType of exports.occupancyTypes as recordTypes.OccupancyType[]) { + for (const occupancyType of exports.occupancyTypes as OccupancyType[]) { const optionElement = document.createElement('option') optionElement.value = occupancyType.occupancyTypeId.toString() optionElement.textContent = occupancyType.occupancyType @@ -517,7 +522,7 @@ declare const exports: Record '#feeAdd--lotTypeId' ) as HTMLSelectElement - for (const lotType of exports.lotTypes as recordTypes.LotType[]) { + for (const lotType of exports.lotTypes as LotType[]) { const optionElement = document.createElement('option') optionElement.value = lotType.lotTypeId.toString() optionElement.textContent = lotType.lotType @@ -627,11 +632,11 @@ declare const exports: Record const feeCategory = feeCategories.find((currentFeeCategory) => { return currentFeeCategory.feeCategoryId === feeCategoryId - }) as recordTypes.FeeCategory + }) as FeeCategory const fee = feeCategory.fees.find((currentFee) => { return currentFee.feeId === feeId - }) as recordTypes.Fee + }) as Fee let editCloseModalFunction: () => void let editModalElement: HTMLElement @@ -795,7 +800,7 @@ declare const exports: Record '#feeEdit--occupancyTypeId' ) as HTMLSelectElement - for (const occupancyType of exports.occupancyTypes as recordTypes.OccupancyType[]) { + for (const occupancyType of exports.occupancyTypes as OccupancyType[]) { const optionElement = document.createElement('option') optionElement.value = occupancyType.occupancyTypeId.toString() optionElement.textContent = occupancyType.occupancyType @@ -811,7 +816,7 @@ declare const exports: Record '#feeEdit--lotTypeId' ) as HTMLSelectElement - for (const lotType of exports.lotTypes as recordTypes.LotType[]) { + for (const lotType of exports.lotTypes as LotType[]) { const optionElement = document.createElement('option') optionElement.value = lotType.lotTypeId.toString() optionElement.textContent = lotType.lotType diff --git a/public-typescript/adminLotTypes.ts b/public-typescript/adminLotTypes.ts index 76f9569d..2039af1d 100644 --- a/public-typescript/adminLotTypes.ts +++ b/public-typescript/adminLotTypes.ts @@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { LOS } from '../types/globalTypes.js' -import type * as recordTypes from '../types/recordTypes.js' +import type { LotType, LotTypeField } from '../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS @@ -15,7 +15,7 @@ declare const exports: Record type ResponseJSON = | { success: true - lotTypes: recordTypes.LotType[] + lotTypes: LotType[] lotTypeFieldId?: number } | { @@ -29,7 +29,7 @@ type ResponseJSON = '#container--lotTypes' ) as HTMLElement - let lotTypes = exports.lotTypes as recordTypes.LotType[] + let lotTypes = exports.lotTypes as LotType[] delete exports.lotTypes const expandedLotTypes = new Set() @@ -121,7 +121,7 @@ type ResponseJSON = const lotType = lotTypes.find((currentLotType) => { return lotTypeId === currentLotType.lotTypeId - }) as recordTypes.LotType + }) as LotType let editCloseModalFunction: () => void @@ -266,13 +266,13 @@ type ResponseJSON = ): void { const lotType = lotTypes.find((currentLotType) => { return currentLotType.lotTypeId === lotTypeId - }) as recordTypes.LotType + }) as LotType const lotTypeField = (lotType.lotTypeFields ?? []).find( (currentLotTypeField) => { return currentLotTypeField.lotTypeFieldId === lotTypeFieldId } - ) as recordTypes.LotTypeField + ) as LotTypeField let minimumLengthElement: HTMLInputElement let maximumLengthElement: HTMLInputElement @@ -464,7 +464,7 @@ type ResponseJSON = function renderLotTypeFields( panelElement: HTMLElement, lotTypeId: number, - lotTypeFields: recordTypes.LotTypeField[] + lotTypeFields: LotTypeField[] ): void { if (lotTypeFields.length === 0) { // eslint-disable-next-line no-unsanitized/method diff --git a/public-typescript/adminOccupancyTypes.ts b/public-typescript/adminOccupancyTypes.ts index 1ee0208f..9d0f2f24 100644 --- a/public-typescript/adminOccupancyTypes.ts +++ b/public-typescript/adminOccupancyTypes.ts @@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { LOS } from '../types/globalTypes.js' -import type * as recordTypes from '../types/recordTypes.js' +import type { OccupancyType, OccupancyTypeField } from '../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS @@ -15,8 +15,8 @@ declare const exports: Record type ResponseJSON = | { success: true - occupancyTypes: recordTypes.OccupancyType[] - allOccupancyTypeFields: recordTypes.OccupancyTypeField[] + occupancyTypes: OccupancyType[] + allOccupancyTypeFields: OccupancyTypeField[] occupancyTypeFieldId?: number } | { @@ -34,11 +34,11 @@ type ResponseJSON = '#container--occupancyTypePrints' ) as HTMLElement - let occupancyTypes = exports.occupancyTypes as recordTypes.OccupancyType[] + let occupancyTypes = exports.occupancyTypes as OccupancyType[] delete exports.occupancyTypes let allOccupancyTypeFields = - exports.allOccupancyTypeFields as recordTypes.OccupancyTypeField[] + exports.allOccupancyTypeFields as OccupancyTypeField[] delete exports.allOccupancyTypeFields const expandedOccupancyTypes = new Set() @@ -78,8 +78,8 @@ type ResponseJSON = const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - occupancyTypes: recordTypes.OccupancyType[] - allOccupancyTypeFields: recordTypes.OccupancyTypeField[] + occupancyTypes: OccupancyType[] + allOccupancyTypeFields: OccupancyTypeField[] } if (responseJSON.success) { @@ -138,7 +138,7 @@ type ResponseJSON = const occupancyType = occupancyTypes.find((currentOccupancyType) => { return occupancyTypeId === currentOccupancyType.occupancyTypeId - }) as recordTypes.OccupancyType + }) as OccupancyType let editCloseModalFunction: () => void @@ -283,7 +283,7 @@ type ResponseJSON = occupancyTypeId: number, occupancyTypeFieldId: number ): void { - let occupancyType: recordTypes.OccupancyType | undefined + let occupancyType: OccupancyType | undefined if (occupancyTypeId) { occupancyType = occupancyTypes.find((currentOccupancyType) => { @@ -299,7 +299,7 @@ type ResponseJSON = return ( currentOccupancyTypeField.occupancyTypeFieldId === occupancyTypeFieldId ) - }) as recordTypes.OccupancyTypeField + }) as OccupancyTypeField let minimumLengthElement: HTMLInputElement let maximumLengthElement: HTMLInputElement @@ -498,7 +498,7 @@ type ResponseJSON = function renderOccupancyTypeFields( panelElement: HTMLElement, occupancyTypeId: number | undefined, - occupancyTypeFields: recordTypes.OccupancyTypeField[] + occupancyTypeFields: OccupancyTypeField[] ): void { if (occupancyTypeFields.length === 0) { // eslint-disable-next-line no-unsanitized/method diff --git a/public-typescript/lotEdit.ts b/public-typescript/lotEdit.ts index e44f8672..6a52850d 100644 --- a/public-typescript/lotEdit.ts +++ b/public-typescript/lotEdit.ts @@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { LOS } from '../types/globalTypes.js' -import type * as recordTypes from '../types/recordTypes.js' +import type { LotComment, LotTypeField } from '../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS @@ -153,7 +153,7 @@ declare const exports: Record }, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { - lotTypeFields: recordTypes.LotTypeField[] + lotTypeFields: LotTypeField[] } if (responseJSON.lotTypeFields.length === 0) { @@ -274,7 +274,7 @@ declare const exports: Record // Comments - let lotComments = exports.lotComments as recordTypes.LotComment[] + let lotComments = exports.lotComments as LotComment[] delete exports.lotComments function openEditLotComment(clickEvent: Event): void { @@ -286,7 +286,7 @@ declare const exports: Record const lotComment = lotComments.find((currentLotComment) => { return currentLotComment.lotCommentId === lotCommentId - }) as recordTypes.LotComment + }) as LotComment let editFormElement: HTMLFormElement let editCloseModalFunction: () => void @@ -301,7 +301,7 @@ declare const exports: Record const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotComments: recordTypes.LotComment[] + lotComments: LotComment[] } if (responseJSON.success) { @@ -397,7 +397,7 @@ declare const exports: Record const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotComments: recordTypes.LotComment[] + lotComments: LotComment[] } if (responseJSON.success) { @@ -502,7 +502,7 @@ declare const exports: Record (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean - lotComments: recordTypes.LotComment[] + lotComments: LotComment[] } if (responseJSON.success) { diff --git a/public-typescript/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit.js index 0bee6d3c..05374bda 100644 --- a/public-typescript/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit.js @@ -361,15 +361,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); submitEvent.preventDefault(); const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value; cityssm.postJSON(`${los.urlPrefix}/lots/doCreateLot`, submitEvent.currentTarget, (rawResponseJSON) => { - var _a; + var _a, _b; const responseJSON = rawResponseJSON; if (responseJSON.success) { - renderSelectedLotAndClose(responseJSON.lotId, lotName); + renderSelectedLotAndClose((_a = responseJSON.lotId) !== null && _a !== void 0 ? _a : '', lotName); } else { bulmaJS.alert({ title: `Error Creating ${los.escapedAliases.Lot}`, - message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', + message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '', contextualColorName: 'danger' }); } diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js index e4b34cd1..a2e957bd 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.js @@ -361,15 +361,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); submitEvent.preventDefault(); const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value; cityssm.postJSON(`${los.urlPrefix}/lots/doCreateLot`, submitEvent.currentTarget, (rawResponseJSON) => { - var _a; + var _a, _b; const responseJSON = rawResponseJSON; if (responseJSON.success) { - renderSelectedLotAndClose(responseJSON.lotId, lotName); + renderSelectedLotAndClose((_a = responseJSON.lotId) !== null && _a !== void 0 ? _a : '', lotName); } else { bulmaJS.alert({ title: `Error Creating ${los.escapedAliases.Lot}`, - message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '', + message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '', contextualColorName: 'danger' }); } diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts index 4045876f..f21c5105 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEdit.ts @@ -4,14 +4,14 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../../types/globalTypes.js' -import type * as recordTypes from '../../types/recordTypes.js' +import type { LOS } from '../../types/globalTypes.js' +import type { Lot, LotStatus, LotType, MapRecord, OccupancyTypeField, WorkOrderType } from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS declare const exports: Record ;(() => { - const los = (exports as Record).los as globalTypes.LOS + const los = exports.los as LOS const lotOccupancyId = ( document.querySelector('#lotOccupancy--lotOccupancyId') as HTMLInputElement @@ -250,7 +250,7 @@ declare const exports: Record ) as HTMLSelectElement const workOrderTypes = (exports as Record) - .workOrderTypes as recordTypes.WorkOrderType[] + .workOrderTypes as WorkOrderType[] if (workOrderTypes.length === 1) { workOrderTypeSelectElement.innerHTML = '' @@ -315,7 +315,7 @@ declare const exports: Record }, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { - occupancyTypeFields: recordTypes.OccupancyTypeField[] + occupancyTypeFields: OccupancyTypeField[] } if (responseJSON.occupancyTypeFields.length === 0) { @@ -490,7 +490,7 @@ declare const exports: Record (rawResponseJSON) => { const responseJSON = rawResponseJSON as { count: number - lots: recordTypes.Lot[] + lots: Lot[] } if (responseJSON.count === 0) { @@ -557,7 +557,7 @@ declare const exports: Record } if (responseJSON.success) { - renderSelectedLotAndClose(responseJSON.lotId!, lotName) + renderSelectedLotAndClose(responseJSON.lotId ?? '', lotName) } else { bulmaJS.alert({ title: `Error Creating ${los.escapedAliases.Lot}`, @@ -635,7 +635,7 @@ declare const exports: Record '#lotCreate--lotTypeId' ) as HTMLSelectElement - for (const lotType of exports.lotTypes as recordTypes.LotType[]) { + for (const lotType of exports.lotTypes as LotType[]) { const optionElement = document.createElement('option') optionElement.value = lotType.lotTypeId.toString() optionElement.textContent = lotType.lotType @@ -646,7 +646,7 @@ declare const exports: Record '#lotCreate--lotStatusId' ) as HTMLSelectElement - for (const lotStatus of exports.lotStatuses as recordTypes.LotStatus[]) { + for (const lotStatus of exports.lotStatuses as LotStatus[]) { const optionElement = document.createElement('option') optionElement.value = lotStatus.lotStatusId.toString() optionElement.textContent = lotStatus.lotStatus @@ -657,7 +657,7 @@ declare const exports: Record '#lotCreate--mapId' ) as HTMLSelectElement - for (const map of exports.maps as recordTypes.MapRecord[]) { + for (const map of exports.maps as MapRecord[]) { const optionElement = document.createElement('option') optionElement.value = map.mapId!.toString() optionElement.textContent = diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditComments.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditComments.ts index 7f108336..aeaefc2e 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditComments.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditComments.ts @@ -4,20 +4,19 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../../types/globalTypes.js' -import type * as recordTypes from '../../types/recordTypes.js' +import type { LOS } from '../../types/globalTypes.js' +import type { LotOccupancyComment } from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS -declare const los: globalTypes.LOS +declare const los: LOS declare const lotOccupancyId: string declare const exports: Record -let lotOccupancyComments = - exports.lotOccupancyComments as recordTypes.LotOccupancyComment[] +let lotOccupancyComments = exports.lotOccupancyComments as LotOccupancyComment[] delete exports.lotOccupancyComments function openEditLotOccupancyComment(clickEvent: Event): void { @@ -34,7 +33,7 @@ function openEditLotOccupancyComment(clickEvent: Event): void { lotOccupancyCommentId ) } - )! + ) as LotOccupancyComment let editFormElement: HTMLFormElement let editCloseModalFunction: () => void @@ -49,7 +48,7 @@ function openEditLotOccupancyComment(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyComments?: recordTypes.LotOccupancyComment[] + lotOccupancyComments?: LotOccupancyComment[] } if (responseJSON.success) { @@ -145,7 +144,7 @@ function deleteLotOccupancyComment(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyComments: recordTypes.LotOccupancyComment[] + lotOccupancyComments: LotOccupancyComment[] } if (responseJSON.success) { @@ -253,7 +252,7 @@ document.querySelector('#button--addComment')?.addEventListener('click', () => { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyComments: recordTypes.LotOccupancyComment[] + lotOccupancyComments: LotOccupancyComment[] } if (responseJSON.success) { diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts index 79c5d490..a058d931 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditFees.ts @@ -4,19 +4,25 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../../types/globalTypes.js' -import type * as recordTypes from '../../types/recordTypes.js' +import type { LOS } from '../../types/globalTypes.js' +import type { + DynamicsGPDocument, + Fee, + FeeCategory, + LotOccupancyFee, + LotOccupancyTransaction +} from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS -declare const los: globalTypes.LOS +declare const los: LOS declare const lotOccupancyId: string declare const exports: Record -let lotOccupancyFees = exports.lotOccupancyFees as recordTypes.LotOccupancyFee[] +let lotOccupancyFees = exports.lotOccupancyFees as LotOccupancyFee[] delete exports.lotOccupancyFees const lotOccupancyFeesContainerElement = document.querySelector( @@ -44,7 +50,7 @@ function editLotOccupancyFeeQuantity(clickEvent: Event): void { const fee = lotOccupancyFees.find((possibleFee) => { return possibleFee.feeId === feeId - }) as recordTypes.LotOccupancyFee + }) as LotOccupancyFee let updateCloseModalFunction: () => void @@ -57,7 +63,7 @@ function editLotOccupancyFeeQuantity(clickEvent: Event): void { (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean - lotOccupancyFees: recordTypes.LotOccupancyFee[] + lotOccupancyFees: LotOccupancyFee[] } if (responseJSON.success) { @@ -136,7 +142,7 @@ function deleteLotOccupancyFee(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyFees: recordTypes.LotOccupancyFee[] + lotOccupancyFees: LotOccupancyFee[] } if (responseJSON.success) { @@ -296,7 +302,7 @@ addFeeButtonElement.addEventListener('click', () => { return } - let feeCategories: recordTypes.FeeCategory[] + let feeCategories: FeeCategory[] let feeFilterElement: HTMLInputElement let feeFilterResultsElement: HTMLElement @@ -313,7 +319,7 @@ addFeeButtonElement.addEventListener('click', () => { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyFees: recordTypes.LotOccupancyFee[] + lotOccupancyFees: LotOccupancyFee[] } if (responseJSON.success) { @@ -331,7 +337,7 @@ addFeeButtonElement.addEventListener('click', () => { ) } - function doSetQuantityAndAddFee(fee: recordTypes.Fee): void { + function doSetQuantityAndAddFee(fee: Fee): void { let quantityElement: HTMLInputElement let quantityCloseModalFunction: () => void @@ -377,11 +383,11 @@ addFeeButtonElement.addEventListener('click', () => { const feeCategory = feeCategories.find((currentFeeCategory) => { return currentFeeCategory.feeCategoryId === feeCategoryId - }) as recordTypes.FeeCategory + }) as FeeCategory const fee = feeCategory.fees.find((currentFee) => { return currentFee.feeId === feeId - }) as recordTypes.Fee + }) as Fee if (fee.includeQuantity ?? false) { doSetQuantityAndAddFee(fee) @@ -485,7 +491,7 @@ addFeeButtonElement.addEventListener('click', () => { }, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { - feeCategories: recordTypes.FeeCategory[] + feeCategories: FeeCategory[] } feeCategories = responseJSON.feeCategories @@ -512,7 +518,7 @@ addFeeButtonElement.addEventListener('click', () => { }) let lotOccupancyTransactions = - exports.lotOccupancyTransactions as recordTypes.LotOccupancyTransaction[] + exports.lotOccupancyTransactions as LotOccupancyTransaction[] delete exports.lotOccupancyTransactions const lotOccupancyTransactionsContainerElement = document.querySelector( @@ -538,7 +544,7 @@ function editLotOccupancyTransaction(clickEvent: Event): void { const transaction = lotOccupancyTransactions.find((possibleTransaction) => { return possibleTransaction.transactionIndex === transactionIndex - }) as recordTypes.LotOccupancyTransaction + }) as LotOccupancyTransaction let editCloseModalFunction: () => void @@ -551,7 +557,7 @@ function editLotOccupancyTransaction(clickEvent: Event): void { (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean - lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[] + lotOccupancyTransactions: LotOccupancyTransaction[] } if (responseJSON.success) { @@ -646,7 +652,7 @@ function deleteLotOccupancyTransaction(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[] + lotOccupancyTransactions: LotOccupancyTransaction[] } if (responseJSON.success) { @@ -828,7 +834,7 @@ addTransactionButtonElement.addEventListener('click', () => { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[] + lotOccupancyTransactions: LotOccupancyTransaction[] } if (responseJSON.success) { @@ -872,7 +878,7 @@ addTransactionButtonElement.addEventListener('click', () => { (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean - dynamicsGPDocument?: recordTypes.DynamicsGPDocument + dynamicsGPDocument?: DynamicsGPDocument } if ( diff --git a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts index c9d4066d..a1ff656b 100644 --- a/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts +++ b/public-typescript/lotOccupancyEdit/lotOccupancyEditOccupants.ts @@ -4,13 +4,16 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' -import type * as globalTypes from '../../types/globalTypes.js' -import type * as recordTypes from '../../types/recordTypes.js' +import type { LOS } from '../../types/globalTypes.js' +import type { + LotOccupancyOccupant, + LotOccupantType +} from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS -declare const los: globalTypes.LOS +declare const los: LOS declare const lotOccupancyId: string declare const isCreate: boolean @@ -19,7 +22,7 @@ declare const formElement: HTMLFormElement declare const exports: Record let lotOccupancyOccupants = - exports.lotOccupancyOccupants as recordTypes.LotOccupancyOccupant[] + exports.lotOccupancyOccupants as LotOccupancyOccupant[] delete exports.lotOccupancyOccupants @@ -34,7 +37,7 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { (currentLotOccupancyOccupant) => { return currentLotOccupancyOccupant.lotOccupantIndex === lotOccupantIndex } - ) as recordTypes.LotOccupancyOccupant + ) as LotOccupancyOccupant let editFormElement: HTMLFormElement let editCloseModalFunction: () => void @@ -49,7 +52,7 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] + lotOccupancyOccupants: LotOccupancyOccupant[] } if (responseJSON.success) { @@ -87,7 +90,7 @@ function openEditLotOccupancyOccupant(clickEvent: Event): void { let lotOccupantTypeSelected = false - for (const lotOccupantType of exports.lotOccupantTypes as recordTypes.LotOccupantType[]) { + for (const lotOccupantType of exports.lotOccupantTypes as LotOccupantType[]) { const optionElement = document.createElement('option') optionElement.value = lotOccupantType.lotOccupantTypeId.toString() optionElement.textContent = lotOccupantType.lotOccupantType @@ -254,7 +257,7 @@ function deleteLotOccupancyOccupant(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] + lotOccupancyOccupants: LotOccupancyOccupant[] } if (responseJSON.success) { @@ -436,7 +439,7 @@ document let searchResultsElement: HTMLElement function addOccupant( - formOrObject: HTMLFormElement | recordTypes.LotOccupancyOccupant + formOrObject: HTMLFormElement | LotOccupancyOccupant ): void { cityssm.postJSON( `${los.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`, @@ -445,7 +448,7 @@ document const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] + lotOccupancyOccupants: LotOccupancyOccupant[] } if (responseJSON.success) { @@ -468,7 +471,7 @@ document addOccupant(addFormElement) } - let pastOccupantSearchResults: recordTypes.LotOccupancyOccupant[] = [] + let pastOccupantSearchResults: LotOccupancyOccupant[] = [] function addOccupantFromCopy(clickEvent: MouseEvent): void { clickEvent.preventDefault() @@ -527,7 +530,7 @@ document searchFormElement, (rawResponseJSON) => { const responseJSON = rawResponseJSON as { - occupants: recordTypes.LotOccupancyOccupant[] + occupants: LotOccupancyOccupant[] } pastOccupantSearchResults = responseJSON.occupants @@ -593,7 +596,7 @@ document '#lotOccupancyOccupantCopy--lotOccupantTypeId' ) as HTMLSelectElement - for (const lotOccupantType of exports.lotOccupantTypes as recordTypes.LotOccupantType[]) { + for (const lotOccupantType of exports.lotOccupantTypes as LotOccupantType[]) { const optionElement = document.createElement('option') optionElement.value = lotOccupantType.lotOccupantTypeId.toString() optionElement.textContent = lotOccupantType.lotOccupantType diff --git a/public-typescript/lotSearch.ts b/public-typescript/lotSearch.ts index d5459fa1..872a8710 100644 --- a/public-typescript/lotSearch.ts +++ b/public-typescript/lotSearch.ts @@ -4,7 +4,7 @@ import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { LOS } from '../types/globalTypes.js' -import type * as recordTypes from '../types/recordTypes.js' +import type { Lot } from '../types/recordTypes.js' declare const cityssm: cityssmGlobal @@ -32,7 +32,7 @@ declare const exports: Record const responseJSON = rawResponseJSON as { count: number offset: number - lots: recordTypes.Lot[] + lots: Lot[] } if (responseJSON.lots.length === 0) { diff --git a/public-typescript/lotView.ts b/public-typescript/lotView.ts index e42b0f27..f027e209 100644 --- a/public-typescript/lotView.ts +++ b/public-typescript/lotView.ts @@ -1,7 +1,7 @@ // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair /* eslint-disable unicorn/prefer-module */ -import type * as globalTypes from '../types/globalTypes.js' +import type { LOS } from '../types/globalTypes.js' declare const exports: Record ;(() => { @@ -9,7 +9,7 @@ declare const exports: Record document.querySelector('#lot--map') if (mapContainerElement !== null) { - ;(exports.los as globalTypes.LOS).highlightMap( + ;(exports.los as LOS).highlightMap( mapContainerElement, mapContainerElement.dataset.mapKey ?? '', 'success' diff --git a/public-typescript/workOrderEdit/workOrderEditComments.ts b/public-typescript/workOrderEdit/workOrderEditComments.ts index d885c2e9..5c689ce8 100644 --- a/public-typescript/workOrderEdit/workOrderEditComments.ts +++ b/public-typescript/workOrderEdit/workOrderEditComments.ts @@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js' import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { LOS } from '../../types/globalTypes.js' -import type * as recordTypes from '../../types/recordTypes.js' +import type { WorkOrderComment } from '../../types/recordTypes.js' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS @@ -17,7 +17,7 @@ declare const workOrderId: string declare const isCreate: boolean let workOrderComments = - exports.workOrderComments as recordTypes.WorkOrderComment[] + exports.workOrderComments as WorkOrderComment[] delete exports.workOrderComments function openEditWorkOrderComment(clickEvent: Event): void { @@ -29,7 +29,7 @@ function openEditWorkOrderComment(clickEvent: Event): void { const workOrderComment = workOrderComments.find((currentComment) => { return currentComment.workOrderCommentId === workOrderCommentId - }) as recordTypes.WorkOrderComment + }) as WorkOrderComment let editFormElement: HTMLFormElement let editCloseModalFunction: () => void @@ -44,7 +44,7 @@ function openEditWorkOrderComment(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - workOrderComments: recordTypes.WorkOrderComment[] + workOrderComments: WorkOrderComment[] } if (responseJSON.success) { @@ -138,7 +138,7 @@ function deleteWorkOrderComment(clickEvent: Event): void { const responseJSON = rawResponseJSON as { success: boolean errorMessage?: string - workOrderComments: recordTypes.WorkOrderComment[] + workOrderComments: WorkOrderComment[] } if (responseJSON.success) { @@ -243,7 +243,7 @@ function openAddCommentModal(): void { (rawResponseJSON) => { const responseJSON = rawResponseJSON as { success: boolean - workOrderComments: recordTypes.WorkOrderComment[] + workOrderComments: WorkOrderComment[] } if (responseJSON.success) { diff --git a/public-typescript/workOrderMilestoneCalendar.ts b/public-typescript/workOrderMilestoneCalendar.ts index f16a2cc5..20ffd078 100644 --- a/public-typescript/workOrderMilestoneCalendar.ts +++ b/public-typescript/workOrderMilestoneCalendar.ts @@ -4,7 +4,7 @@ import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { LOS } from '../types/globalTypes.js' -import type * as recordTypes from '../types/recordTypes.js' +import type { WorkOrderMilestone } from '../types/recordTypes.js' declare const cityssm: cityssmGlobal @@ -30,9 +30,7 @@ declare const exports: Record '#container--milestoneCalendar' ) as HTMLElement - function renderMilestones( - workOrderMilestones: recordTypes.WorkOrderMilestone[] - ): void { + function renderMilestones(workOrderMilestones: WorkOrderMilestone[]): void { if (workOrderMilestones.length === 0) { milestoneCalendarContainerElement.innerHTML = `

There are no milestones that meet the search criteria.

@@ -167,7 +165,7 @@ declare const exports: Record renderMilestones( ( responseJSON as { - workOrderMilestones: recordTypes.WorkOrderMilestone[] + workOrderMilestones: WorkOrderMilestone[] } ).workOrderMilestones ) diff --git a/public-typescript/workOrderSearch.js b/public-typescript/workOrderSearch.js index 702d7fe7..c1984184 100644 --- a/public-typescript/workOrderSearch.js +++ b/public-typescript/workOrderSearch.js @@ -41,7 +41,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); + : (_j = occupant.fontAwesomeIconClass) !== null && _j !== void 0 ? _j : '')}" aria-label="${los.escapedAliases.occupant}"> + ${cityssm.escapeHTML(((_k = occupant.occupantName) !== null && _k !== void 0 ? _k : '') === '' && ((_l = occupant.occupantFamilyName) !== null && _l !== void 0 ? _l : '') === '' ? '(No Name)' diff --git a/public-typescript/workOrderSearch.ts b/public-typescript/workOrderSearch.ts index 25e5ba05..0ef0b7e5 100644 --- a/public-typescript/workOrderSearch.ts +++ b/public-typescript/workOrderSearch.ts @@ -4,7 +4,7 @@ import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js' import type { LOS } from '../types/globalTypes.js' -import type * as recordTypes from '../types/recordTypes.js' +import type { WorkOrder } from '../types/recordTypes.js' declare const cityssm: cityssmGlobal @@ -37,7 +37,7 @@ declare const exports: Record const responseJSON = rawResponseJSON as { count: number offset: number - workOrders: recordTypes.WorkOrder[] + workOrders: WorkOrder[] } if (responseJSON.workOrders.length === 0) { @@ -79,7 +79,8 @@ declare const exports: Record (occupant.fontAwesomeIconClass ?? '') === '' ? 'user' : occupant.fontAwesomeIconClass ?? '' - )}" aria-label="${los.escapedAliases.occupant}"> + )}" aria-label="${los.escapedAliases.occupant}"> + ${cityssm.escapeHTML( (occupant.occupantName ?? '') === '' && (occupant.occupantFamilyName ?? '') === '' diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js index 102538fa..f8d8fb14 100644 --- a/public/javascripts/lotOccupancyEdit.min.js +++ b/public/javascripts/lotOccupancyEdit.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,n,c,o;const a=exports.los,l=document.querySelector("#lotOccupancy--lotOccupancyId").value,s=""===l;let i=s;function r(){var e;a.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.remove("is-light")}function u(){var e;a.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.add("is-light")}const d=document.querySelector("#form--lotOccupancy");d.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/${s?"doCreateLotOccupancy":"doUpdateLotOccupancy"}`,d,e=>{var t;const n=e;n.success?(u(),s||i?window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Saving ${a.escapedAliases.Occupancy}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const p=d.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",r);function m(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,{lotOccupancyId:l},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(S=document.querySelector("#button--copyLotOccupancy"))||void 0===S||S.addEventListener("click",e=>{e.preventDefault(),a.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${a.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:m}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${a.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`,{lotOccupancyId:l},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function n(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/workOrders/doCreateWorkOrder`,e.currentTarget,e=>{const n=e;n.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(n.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:n.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=l,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const n=e.querySelector("#workOrderCreate--workOrderTypeId"),c=exports.workOrderTypes;1===c.length&&(n.innerHTML="");for(const e of c){const c=document.createElement("option");c.value=e.workOrderTypeId.toString(),c.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",n.append(c)}},onshown(e,c){var o;t=c,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",n)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const y=document.querySelector("#lotOccupancy--occupancyTypeId");if(s){const e=document.querySelector("#container--lotOccupancyFields");y.addEventListener("change",()=>{""!==y.value?cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetOccupancyTypeFields`,{occupancyTypeId:y.value},t=>{var n,c;const o=t;if(0===o.occupancyTypeFields.length)return void(e.innerHTML=`
\n

There are no additional fields for this ${a.escapedAliases.occupancy} type.

\n
`);e.innerHTML="";let l="";for(const t of o.occupancyTypeFields){l+=","+t.occupancyTypeFieldId.toString();const o=`lotOccupancyFieldValue_${t.occupancyTypeFieldId.toString()}`,a=`lotOccupancy--${o}`,s=document.createElement("div");if(s.className="field",s.innerHTML=`
`,s.querySelector("label").textContent=t.occupancyTypeField,""===(null!==(n=t.occupancyTypeFieldValues)&&void 0!==n?n:"")){const e=document.createElement("input");e.className="input",e.id=a,e.name=o,e.type="text",e.required=t.isRequired,e.minLength=t.minimumLength,e.maxLength=t.maximumLength,""!==(null!==(c=t.pattern)&&void 0!==c?c:"")&&(e.pattern=t.pattern),s.querySelector(".control").append(e)}else{s.querySelector(".control").innerHTML=`
\n \n
`;const e=s.querySelector("select");e.required=t.isRequired;const n=t.occupancyTypeFieldValues.split("\n");for(const t of n){const n=document.createElement("option");n.value=t,n.textContent=t,e.append(n)}}console.log(s),e.append(s)}e.insertAdjacentHTML("beforeend",``)}):e.innerHTML=`
\n

Select the ${a.escapedAliases.occupancy} type to load the available fields.

\n
`})}else{const e=y.value;y.addEventListener("change",()=>{y.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${a.escapedAliases.occupancy} type?\n\n This change affects the additional fields associated with this record, and may also affect the available fees.`,contextualColorName:"warning",okButton:{text:"Yes, Keep the Change",callbackFunction:()=>{i=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{y.value=e}}})})}const v=document.querySelector("#lotOccupancy--lotName");v.addEventListener("click",e=>{const t=e.currentTarget.value;let n,c,o,l;function s(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,r(),n()}function i(e){var t,n;e.preventDefault();const c=e.currentTarget;s(null!==(t=c.dataset.lotId)&&void 0!==t?t:"",null!==(n=c.dataset.lotName)&&void 0!==n?n:"")}function u(){l.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(`${a.urlPrefix}/lots/doSearchLots`,o,e=>{var t,n;const c=e;if(0===c.count)return void(l.innerHTML='
\n

No results.

\n
');const o=document.createElement("div");o.className="panel";for(const e of c.lots){const c=document.createElement("a");c.className="panel-block is-block",c.href="#",c.dataset.lotId=e.lotId.toString(),c.dataset.lotName=e.lotName,c.innerHTML=`
\n
\n ${cityssm.escapeHTML(null!==(t=e.lotName)&&void 0!==t?t:"")}
\n ${cityssm.escapeHTML(null!==(n=e.mapName)&&void 0!==n?n:"")}\n
\n
\n ${cityssm.escapeHTML(e.lotStatus)}
\n \n ${e.lotOccupancyCount>0?"Currently Occupied":""}\n \n
\n
`,c.addEventListener("click",i),o.append(c)}l.innerHTML="",l.append(o)})}function d(e){e.preventDefault();const t=c.querySelector("#lotCreate--lotName").value;cityssm.postJSON(`${a.urlPrefix}/lots/doCreateLot`,e.currentTarget,e=>{var n;const c=e;c.success?s(c.lotId,t):bulmaJS.alert({title:`Error Creating ${a.escapedAliases.Lot}`,message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-selectLot",{onshow(e){a.populateAliases(e)},onshown(e,a){var s,i;bulmaJS.toggleHtmlClipped(),c=e,n=a,bulmaJS.init(e);const r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const p=e.querySelector("#lotSelect--occupancyStatus");if(p.addEventListener("change",u),""!==t&&(p.value=""),o=e.querySelector("#form--lotSelect"),l=e.querySelector("#resultsContainer--lotSelect"),o.addEventListener("submit",e=>{e.preventDefault()}),u(),exports.lotNamePattern){const t=exports.lotNamePattern;e.querySelector("#lotCreate--lotName").pattern=t.source}const m=e.querySelector("#lotCreate--lotTypeId");for(const e of exports.lotTypes){const t=document.createElement("option");t.value=e.lotTypeId.toString(),t.textContent=e.lotType,m.append(t)}const y=e.querySelector("#lotCreate--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,y.append(t)}const v=e.querySelector("#lotCreate--mapId");for(const e of exports.maps){const t=document.createElement("option");t.value=e.mapId.toString(),t.textContent=""===(null!==(s=e.mapName)&&void 0!==s?s:"")?"(No Name)":null!==(i=e.mapName)&&void 0!==i?i:"",v.append(t)}e.querySelector("#form--lotCreate").addEventListener("submit",d)},onremoved(){bulmaJS.toggleHtmlClipped()}})}),null===(n=document.querySelector(".is-lot-view-button"))||void 0===n||n.addEventListener("click",()=>{const e=document.querySelector("#lotOccupancy--lotId").value;""===e?bulmaJS.alert({message:`No ${a.escapedAliases.lot} selected.`,contextualColorName:"info"}):window.open(`${a.urlPrefix}/lots/${e}`)}),null===(c=document.querySelector(".is-clear-lot-button"))||void 0===c||c.addEventListener("click",()=>{v.disabled?bulmaJS.alert({message:"You need to unlock the field before clearing it.",contextualColorName:"info"}):(v.value=`(No ${a.escapedAliases.Lot})`,document.querySelector("#lotOccupancy--lotId").value="",r())}),a.initializeDatePickers(d),null===(o=document.querySelector("#lotOccupancy--occupancyStartDateString"))||void 0===o||o.addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),a.initializeUnlockFieldButtons(d),Object.defineProperty(exports,"__esModule",{value:!0});let f=exports.lotOccupancyOccupants;function O(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotOccupantIndex)&&void 0!==n?n:"",10),o=f.find(e=>e.lotOccupantIndex===c);let s,i;function r(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`,s,e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,i(),h()):bulmaJS.alert({title:`Error Updating ${a.escapedAliases.Occupant}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow(e){var t,n,s,i,r,u,d,p,m,y,v,f,O,g,h,S;a.populateAliases(e),e.querySelector("#lotOccupancyOccupantEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyOccupantEdit--lotOccupantIndex").value=c.toString();const b=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");let C=!1;for(const e of exports.lotOccupantTypes){const t=document.createElement("option");t.value=e.lotOccupantTypeId.toString(),t.textContent=e.lotOccupantType,t.dataset.occupantCommentTitle=e.occupantCommentTitle,t.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,e.lotOccupantTypeId===o.lotOccupantTypeId&&(t.selected=!0,C=!0),b.append(t)}if(!C){const e=document.createElement("option");e.value=null!==(n=null===(t=o.lotOccupantTypeId)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",e.textContent=null!==(s=o.lotOccupantType)&&void 0!==s?s:"",e.dataset.occupantCommentTitle=o.occupantCommentTitle,e.dataset.fontAwesomeIconClass=o.fontAwesomeIconClass,e.selected=!0,b.append(e)}e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=``,e.querySelector("#lotOccupancyOccupantEdit--occupantName").value=null!==(r=o.occupantName)&&void 0!==r?r:"",e.querySelector("#lotOccupancyOccupantEdit--occupantFamilyName").value=null!==(u=o.occupantFamilyName)&&void 0!==u?u:"",e.querySelector("#lotOccupancyOccupantEdit--occupantAddress1").value=null!==(d=o.occupantAddress1)&&void 0!==d?d:"",e.querySelector("#lotOccupancyOccupantEdit--occupantAddress2").value=null!==(p=o.occupantAddress2)&&void 0!==p?p:"",e.querySelector("#lotOccupancyOccupantEdit--occupantCity").value=null!==(m=o.occupantCity)&&void 0!==m?m:"",e.querySelector("#lotOccupancyOccupantEdit--occupantProvince").value=null!==(y=o.occupantProvince)&&void 0!==y?y:"",e.querySelector("#lotOccupancyOccupantEdit--occupantPostalCode").value=null!==(v=o.occupantPostalCode)&&void 0!==v?v:"",e.querySelector("#lotOccupancyOccupantEdit--occupantPhoneNumber").value=null!==(f=o.occupantPhoneNumber)&&void 0!==f?f:"",e.querySelector("#lotOccupancyOccupantEdit--occupantEmailAddress").value=null!==(O=o.occupantEmailAddress)&&void 0!==O?O:"",e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=""===(null!==(g=o.occupantCommentTitle)&&void 0!==g?g:"")?"Comment":null!==(h=o.occupantCommentTitle)&&void 0!==h?h:"",e.querySelector("#lotOccupancyOccupantEdit--occupantComment").value=null!==(S=o.occupantComment)&&void 0!==S?S:""},onshown(e,t){bulmaJS.toggleHtmlClipped();const n=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");n.focus(),n.addEventListener("change",()=>{var t,c;const o=null!==(t=n.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==t?t:"user";e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=``;let a=null!==(c=n.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==c?c:"";""===a&&(a="Comment"),e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=a}),(s=e.querySelector("form")).addEventListener("submit",r),i=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function g(e){var t;const n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotOccupantIndex;bulmaJS.confirm({title:`Remove ${a.escapedAliases.Occupant}?`,message:`Are you sure you want to remove this ${a.escapedAliases.occupant}?`,okButton:{text:`Yes, Remove ${a.escapedAliases.Occupant}`,callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`,{lotOccupancyId:l,lotOccupantIndex:n},e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,h()):bulmaJS.alert({title:`Error Removing ${a.escapedAliases.Occupant}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function h(){var e,t,n,c,o,l,s,i,r,u,d,p,m,y,v,h,S,b,C,T,x,L,q;const N=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(N),0===f.length)return void(N.innerHTML=`
\n

There are no ${a.escapedAliases.occupants} associated with this record.

\n
`);const E=document.createElement("table");E.className="table is-fullwidth is-striped is-hoverable",E.innerHTML=`\n ${a.escapedAliases.Occupant}\n Address\n Other Contact\n Comment\n Options\n \n `;for(const N of f){const f=document.createElement("tr");f.dataset.lotOccupantIndex=null===(e=N.lotOccupantIndex)||void 0===e?void 0:e.toString(),f.innerHTML=`\n ${cityssm.escapeHTML(""===(null!==(t=N.occupantName)&&void 0!==t?t:"")&&""===(null!==(n=N.occupantFamilyName)&&void 0!==n?n:"")?"(No Name)":`${N.occupantName} ${N.occupantFamilyName}`)}
\n \n \n ${cityssm.escapeHTML(null!==(o=N.lotOccupantType)&&void 0!==o?o:"")}\n \n \n ${""===(null!==(l=N.occupantAddress1)&&void 0!==l?l:"")?"":`${cityssm.escapeHTML(null!==(s=N.occupantAddress1)&&void 0!==s?s:"")}
`}\n ${""===(null!==(i=N.occupantAddress2)&&void 0!==i?i:"")?"":`${cityssm.escapeHTML(null!==(r=N.occupantAddress2)&&void 0!==r?r:"")}
`}\n ${""===(null!==(u=N.occupantCity)&&void 0!==u?u:"")?"":`${cityssm.escapeHTML(null!==(d=N.occupantCity)&&void 0!==d?d:"")}, `}\n ${cityssm.escapeHTML(null!==(p=N.occupantProvince)&&void 0!==p?p:"")}
\n ${cityssm.escapeHTML(null!==(m=N.occupantPostalCode)&&void 0!==m?m:"")}\n \n ${""===(null!==(y=N.occupantPhoneNumber)&&void 0!==y?y:"")?"":`${cityssm.escapeHTML(null!==(v=N.occupantPhoneNumber)&&void 0!==v?v:"")}
`}\n ${""===(null!==(h=N.occupantEmailAddress)&&void 0!==h?h:"")?"":cityssm.escapeHTML(null!==(S=N.occupantEmailAddress)&&void 0!==S?S:"")}\n \n \n ${cityssm.escapeHTML(null!==(T=N.occupantComment)&&void 0!==T?T:"")}\n \n \n
\n \n \n
\n `,null===(x=f.querySelector(".button--edit"))||void 0===x||x.addEventListener("click",O),null===(L=f.querySelector(".button--delete"))||void 0===L||L.addEventListener("click",g),null===(q=E.querySelector("tbody"))||void 0===q||q.append(f)}N.append(E)}if(delete exports.lotOccupancyOccupants,s){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{var t;const n=d.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const t of n)t.disabled=""===e.value;let c=null!==(t=e.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),d.querySelector("#lotOccupancy--occupantCommentTitle").textContent=c})}else h();if(null===(S=document.querySelector("#button--addOccupant"))||void 0===S||S.addEventListener("click",()=>{let e,t,n,c;function o(t){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`,t,t=>{var n;const c=t;c.success?(f=c.lotOccupancyOccupants,e(),h()):bulmaJS.alert({title:`Error Adding ${a.escapedAliases.Occupant}`,message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function s(e){e.preventDefault(),o(t)}let i=[];function r(e){var t,n;e.preventDefault();const c=e.currentTarget,s=i[Number.parseInt(null!==(t=c.dataset.index)&&void 0!==t?t:"",10)],r=(null===(n=c.closest(".modal"))||void 0===n?void 0:n.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId")).value;""===r?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(s.lotOccupantTypeId=Number.parseInt(r,10),s.lotOccupancyId=Number.parseInt(l,10),o(s))}function u(e){e.preventDefault(),""!==n.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(c.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doSearchPastOccupants`,n,e=>{var t,n,o,a,l,s,u,d,p,m,y;i=e.occupants;const v=document.createElement("div");v.className="panel";for(const[e,c]of i.entries()){const i=document.createElement("a");i.className="panel-block is-block",i.href="#",i.dataset.index=e.toString(),i.innerHTML=`\n ${cityssm.escapeHTML(null!==(t=c.occupantName)&&void 0!==t?t:"")} ${cityssm.escapeHTML(null!==(n=c.occupantFamilyName)&&void 0!==n?n:"")}\n
\n
\n
\n ${cityssm.escapeHTML(null!==(o=c.occupantAddress1)&&void 0!==o?o:"")}
\n ${""===(null!==(a=c.occupantAddress2)&&void 0!==a?a:"")?"":`${cityssm.escapeHTML(null!==(l=c.occupantAddress2)&&void 0!==l?l:"")}
`}${cityssm.escapeHTML(null!==(s=c.occupantCity)&&void 0!==s?s:"")}, ${cityssm.escapeHTML(null!==(u=c.occupantProvince)&&void 0!==u?u:"")}
\n ${cityssm.escapeHTML(null!==(d=c.occupantPostalCode)&&void 0!==d?d:"")}\n
\n
\n ${""===(null!==(p=c.occupantPhoneNumber)&&void 0!==p?p:"")?"":`${cityssm.escapeHTML(null!==(m=c.occupantPhoneNumber)&&void 0!==m?m:"")}
`}\n ${cityssm.escapeHTML(null!==(y=c.occupantEmailAddress)&&void 0!==y?y:"")}
\n
\n
`,i.addEventListener("click",r),v.append(i)}c.innerHTML="",c.append(v)})):c.innerHTML='
\n

Enter a partial name or address in the search field above.

\n
'}cityssm.openHtmlModal("lotOccupancy-addOccupant",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyOccupantAdd--lotOccupancyId").value=l;const t=e.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId"),n=e.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId");for(const e of exports.lotOccupantTypes){const c=document.createElement("option");c.value=e.lotOccupantTypeId.toString(),c.textContent=e.lotOccupantType,c.dataset.occupantCommentTitle=e.occupantCommentTitle,c.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,t.append(c),n.append(c.cloneNode(!0))}e.querySelector("#lotOccupancyOccupantAdd--occupantCity").value=exports.occupantCityDefault,e.querySelector("#lotOccupancyOccupantAdd--occupantProvince").value=exports.occupantProvinceDefault},onshown(o,a){bulmaJS.toggleHtmlClipped(),bulmaJS.init(o);const l=o.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId");l.focus(),l.addEventListener("change",()=>{var e,t;const n=null!==(e=l.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==e?e:"user";o.querySelector("#lotOccupancyOccupantAdd--fontAwesomeIconClass").innerHTML=``;let c=null!==(t=l.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),o.querySelector("#lotOccupancyOccupantAdd--occupantCommentTitle").textContent=c}),(t=o.querySelector("#form--lotOccupancyOccupantAdd")).addEventListener("submit",s),c=o.querySelector("#lotOccupancyOccupantCopy--searchResults"),(n=o.querySelector("#form--lotOccupancyOccupantCopy")).addEventListener("submit",e=>{e.preventDefault()}),o.querySelector("#lotOccupancyOccupantCopy--searchFilter").addEventListener("change",u),e=a},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addOccupant").focus()}})}),!s){var S;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.lotOccupancyComments;function b(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10),s=e.find(e=>e.lotOccupancyCommentId===o);let i,r;function u(t){t.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyComment`,i,t=>{var n,c;const o=t;o.success?(e=null!==(n=o.lotOccupancyComments)&&void 0!==n?n:[],r(),T()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editComment",{onshow(e){var t,n,c,i;a.populateAliases(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value=o.toString(),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value=null!==(t=s.lotOccupancyComment)&&void 0!==t?t:"";const r=e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");r.value=null!==(n=s.lotOccupancyCommentDateString)&&void 0!==n?n:"";const u=cityssm.dateToString(new Date);r.max=s.lotOccupancyCommentDateString<=u?u:null!==(c=s.lotOccupancyCommentDateString)&&void 0!==c?c:"",e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value=null!==(i=s.lotOccupancyCommentTimeString)&&void 0!==i?i:""},onshown(e,t){bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus(),(i=e.querySelector("form")).addEventListener("submit",u),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function C(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyComment`,{lotOccupancyId:l,lotOccupancyCommentId:o},t=>{var n;const c=t;c.success?(e=c.lotOccupancyComments,T()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function T(){var t,n,c,o,a,l,s,i;const r=document.querySelector("#container--lotOccupancyComments");if(0===e.length)return void(r.innerHTML='
\n

There are no comments associated with this record.

\n
');const u=document.createElement("table");u.className="table is-fullwidth is-striped is-hoverable",u.innerHTML='\n Commentor\n Comment Date\n Comment\n Options\n \n ';for(const r of e){const e=document.createElement("tr");e.dataset.lotOccupancyCommentId=null===(t=r.lotOccupancyCommentId)||void 0===t?void 0:t.toString(),e.innerHTML=`${cityssm.escapeHTML(null!==(n=r.recordCreate_userName)&&void 0!==n?n:"")}\n \n ${cityssm.escapeHTML(null!==(c=r.lotOccupancyCommentDateString)&&void 0!==c?c:"")}\n ${cityssm.escapeHTML(0===r.lotOccupancyCommentTime?"":null!==(o=r.lotOccupancyCommentTimePeriodString)&&void 0!==o?o:"")}\n \n ${cityssm.escapeHTML(null!==(a=r.lotOccupancyComment)&&void 0!==a?a:"")}\n \n
\n \n \n
\n `,null===(l=e.querySelector(".button--edit"))||void 0===l||l.addEventListener("click",b),null===(s=e.querySelector(".button--delete"))||void 0===s||s.addEventListener("click",C),null===(i=u.querySelector("tbody"))||void 0===i||i.append(e)}r.innerHTML="",r.append(u)}delete exports.lotOccupancyComments,null===(S=document.querySelector("#button--addComment"))||void 0===S||S.addEventListener("click",()=>{let t,n;function c(c){c.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyComment`,t,t=>{var c;const o=t;o.success?(e=o.lotOccupancyComments,n(),T()):bulmaJS.alert({title:"Error Adding Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addComment",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyId").value=l},onshown(e,o){bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyComment").focus(),(t=e.querySelector("form")).addEventListener("submit",c),n=o},onremoved:()=>{bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addComment").focus()}})}),T(),Object.defineProperty(exports,"__esModule",{value:!0});let t=exports.lotOccupancyFees;delete exports.lotOccupancyFees;const n=document.querySelector("#container--lotOccupancyFees");function x(){var e,n,c;let o=0;for(const a of t)o+=((null!==(e=a.feeAmount)&&void 0!==e?e:0)+(null!==(n=a.taxAmount)&&void 0!==n?n:0))*(null!==(c=a.quantity)&&void 0!==c?c:0);return o}function L(e){var n,c;const o=Number.parseInt(null!==(c=null===(n=e.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.feeId)&&void 0!==c?c:"",10),s=t.find(e=>e.feeId===o);let i;function r(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`,e.currentTarget,e=>{const n=e;n.success?(t=n.lotOccupancyFees,N(),i()):bulmaJS.alert({title:"Error Updating Quantity",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editFeeQuantity",{onshow(e){var t,n;e.querySelector("#lotOccupancyFeeQuantity--lotOccupancyId").value=l,e.querySelector("#lotOccupancyFeeQuantity--feeId").value=s.feeId.toString(),e.querySelector("#lotOccupancyFeeQuantity--quantity").valueAsNumber=null!==(t=s.quantity)&&void 0!==t?t:0,e.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=null!==(n=s.quantityUnit)&&void 0!==n?n:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),i=t,e.querySelector("#lotOccupancyFeeQuantity--quantity").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",r)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function q(e){const n=e.currentTarget.closest(".container--lotOccupancyFee").dataset.feeId;bulmaJS.confirm({title:"Delete Fee",message:"Are you sure you want to delete this fee?",contextualColorName:"warning",okButton:{text:"Yes, Delete Fee",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`,{lotOccupancyId:l,feeId:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N()):bulmaJS.alert({title:"Error Deleting Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}}})}function N(){var e,c,o,a,l,s,i,r,u,d,p,m,y,v,f;if(0===t.length)return n.innerHTML='
\n

There are no fees associated with this record.

\n
',void M();n.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
';let O=0,g=0;for(const h of t){const t=document.createElement("tr");t.className="container--lotOccupancyFee",t.dataset.feeId=h.feeId.toString(),t.dataset.includeQuantity=null!==(e=h.includeQuantity)&&void 0!==e&&e?"1":"0",t.innerHTML=`\n ${cityssm.escapeHTML(null!==(c=h.feeName)&&void 0!==c?c:"")}
\n ${cityssm.escapeHTML(null!==(o=h.feeCategory)&&void 0!==o?o:"")}\n \n ${1===h.quantity?"":`\n $${null===(a=h.feeAmount)||void 0===a?void 0:a.toFixed(2)}\n \n ×\n ${null===(l=h.quantity)||void 0===l?void 0:l.toString()}\n =`}\n \n $${((null!==(s=h.feeAmount)&&void 0!==s?s:0)*(null!==(i=h.quantity)&&void 0!==i?i:0)).toFixed(2)}\n \n \n
\n ${null!==(r=h.includeQuantity)&&void 0!==r&&r?'':""}\n \n
\n `,null===(u=t.querySelector(".button--editQuantity"))||void 0===u||u.addEventListener("click",L),null===(d=t.querySelector(".button--delete"))||void 0===d||d.addEventListener("click",q),null===(p=n.querySelector("tbody"))||void 0===p||p.append(t),O+=(null!==(m=h.feeAmount)&&void 0!==m?m:0)*(null!==(y=h.quantity)&&void 0!==y?y:0),g+=(null!==(v=h.taxAmount)&&void 0!==v?v:0)*(null!==(f=h.quantity)&&void 0!==f?f:0)}n.querySelector("#lotOccupancyFees--feeAmountTotal").textContent=`$${O.toFixed(2)}`,n.querySelector("#lotOccupancyFees--taxAmountTotal").textContent=`$${g.toFixed(2)}`,n.querySelector("#lotOccupancyFees--grandTotal").textContent=`$${(O+g).toFixed(2)}`,M()}const c=document.querySelector("#button--addFee");c.addEventListener("click",()=>{if(a.hasUnsavedChanges())return void bulmaJS.alert({message:"Please save all unsaved changes before adding fees.",contextualColorName:"warning"});let e,o,s;function i(e,n=1){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`,{lotOccupancyId:l,feeId:e,quantity:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N(),u()):bulmaJS.alert({title:"Error Adding Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function r(t){var n,c,o;t.preventDefault();const a=Number.parseInt(null!==(n=t.currentTarget.dataset.feeId)&&void 0!==n?n:"",10),l=Number.parseInt(null!==(c=t.currentTarget.dataset.feeCategoryId)&&void 0!==c?c:"",10),s=e.find(e=>e.feeCategoryId===l).fees.find(e=>e.feeId===a);null!==(o=s.includeQuantity)&&void 0!==o&&o?function(e){let t,n;function c(c){c.preventDefault(),i(e.feeId,t.value),n()}cityssm.openHtmlModal("lotOccupancy-setFeeQuantity",{onshow(t){var n;t.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=null!==(n=e.quantityUnit)&&void 0!==n?n:""},onshown(e,o){var a;n=o,t=e.querySelector("#lotOccupancyFeeQuantity--quantity"),null===(a=e.querySelector("form"))||void 0===a||a.addEventListener("submit",c)}})}(s):i(a)}function u(){var t,c,a,l,i,u;const d=o.value.trim().toLowerCase().split(" ");s.innerHTML="";for(const o of e){const e=document.createElement("div");e.className="container--feeCategory",e.dataset.feeCategoryId=o.feeCategoryId.toString(),e.innerHTML=`

\n ${cityssm.escapeHTML(null!==(t=o.feeCategory)&&void 0!==t?t:"")}\n

\n
`;let p=!1;for(const t of o.fees){if(null!==n.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let s=!0;const m=`${null!==(c=o.feeCategory)&&void 0!==c?c:""} ${null!==(a=t.feeName)&&void 0!==a?a:""} ${null!==(l=t.feeDescription)&&void 0!==l?l:""}`.toLowerCase();for(const e of d)if(!m.includes(e)){s=!1;break}if(!s)continue;p=!0;const y=document.createElement("a");y.className="panel-block is-block container--fee",y.dataset.feeId=t.feeId.toString(),y.dataset.feeCategoryId=o.feeCategoryId.toString(),y.href="#",y.innerHTML=`${cityssm.escapeHTML(null!==(i=t.feeName)&&void 0!==i?i:"")}
\n \n ${cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replaceAll("\n","
")}\n
`,y.addEventListener("click",r),e.querySelector(".panel").append(y)}p&&s.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){o=t.querySelector("#feeSelect--feeName"),s=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetFees`,{lotOccupancyId:l},t=>{e=t.feeCategories,o.disabled=!1,o.addEventListener("keyup",u),o.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){N()},onremoved(){bulmaJS.toggleHtmlClipped(),c.focus()}})});let o=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const s=document.querySelector("#container--lotOccupancyTransactions");function E(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.transactionIndex)&&void 0!==n?n:"",10),s=o.find(e=>e.transactionIndex===c);let i;function r(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`,e.currentTarget,e=>{const t=e;t.success?(o=t.lotOccupancyTransactions,M(),i()):bulmaJS.alert({title:"Error Updating Transaction",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editTransaction",{onshow(e){var t,n,c,o,i,r;a.populateAliases(e),e.querySelector("#lotOccupancyTransactionEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyTransactionEdit--transactionIndex").value=null!==(n=null===(t=s.transactionIndex)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").value=s.transactionAmount.toFixed(2),e.querySelector("#lotOccupancyTransactionEdit--externalReceiptNumber").value=null!==(c=s.externalReceiptNumber)&&void 0!==c?c:"",e.querySelector("#lotOccupancyTransactionEdit--transactionNote").value=null!==(o=s.transactionNote)&&void 0!==o?o:"",e.querySelector("#lotOccupancyTransactionEdit--transactionDateString").value=null!==(i=s.transactionDateString)&&void 0!==i?i:"",e.querySelector("#lotOccupancyTransactionEdit--transactionTimeString").value=null!==(r=s.transactionTimeString)&&void 0!==r?r:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",r),i=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function $(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`,{lotOccupancyId:l,transactionIndex:t},e=>{var t;const n=e;n.success?(o=n.lotOccupancyTransactions,M()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function M(){var e,n,c,l,i,r,u;if(0===o.length)return void(s.innerHTML=`
\n

There are no transactions associated with this record.

\n
`);s.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n \n \n
Date${a.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`;let d=0;for(const t of o){d+=t.transactionAmount;const o=document.createElement("tr");o.className="container--lotOccupancyTransaction",o.dataset.transactionIndex=null===(e=t.transactionIndex)||void 0===e?void 0:e.toString();let p="";""!==t.externalReceiptNumber&&(p=cityssm.escapeHTML(null!==(n=t.externalReceiptNumber)&&void 0!==n?n:""),a.dynamicsGPIntegrationIsEnabled&&(void 0===t.dynamicsGPDocument?p+=' \n \n ':t.dynamicsGPDocument.documentTotal.toFixed(2)===t.transactionAmount.toFixed(2)?p+=' \n \n ':p+=` \n \n `),p+="
"),o.innerHTML=`\n ${cityssm.escapeHTML(null!==(c=t.transactionDateString)&&void 0!==c?c:"")}\n \n \n ${p}\n ${cityssm.escapeHTML(null!==(l=t.transactionNote)&&void 0!==l?l:"")}\n \n \n $${cityssm.escapeHTML(t.transactionAmount.toFixed(2))}\n \n \n
\n \n \n
\n `,null===(i=o.querySelector(".button--edit"))||void 0===i||i.addEventListener("click",E),null===(r=o.querySelector(".button--delete"))||void 0===r||r.addEventListener("click",$),null===(u=s.querySelector("tbody"))||void 0===u||u.append(o)}s.querySelector("#lotOccupancyTransactions--grandTotal").textContent=`$${d.toFixed(2)}`;const p=x();p.toFixed(2)!==d.toFixed(2)&&s.insertAdjacentHTML("afterbegin",`
\n
\n
\n
\n
Outstanding Balance
\n
\n
\n
\n $${cityssm.escapeHTML((p-d).toFixed(2))}\n
\n
\n
\n
`)}const i=document.querySelector("#button--addTransaction");i.addEventListener("click",()=>{let e,t,n;function c(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`,e.currentTarget,e=>{var t;const c=e;c.success?(o=c.lotOccupancyTransactions,n(),M()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function s(){var n,c;const o=t.value,l=null===(n=t.closest(".control"))||void 0===n?void 0:n.querySelector(".icon"),s=null===(c=t.closest(".field"))||void 0===c?void 0:c.querySelector(".help");if(""===o)return s.innerHTML=" ",void(l.innerHTML='');cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`,{externalReceiptNumber:o},t=>{const n=t;n.success&&void 0!==n.dynamicsGPDocument?e.valueAsNumber===n.dynamicsGPDocument.documentTotal?(s.textContent="Matching Document Found",l.innerHTML=''):(s.textContent=`Matching Document: $${n.dynamicsGPDocument.documentTotal.toFixed(2)}`,l.innerHTML=''):(s.textContent="No Matching Document Found",l.innerHTML='')})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow(n){a.populateAliases(n),n.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=l.toString();const c=x(),i=function(){let e=0;for(const t of o)e+=t.transactionAmount;return e}();if((e=n.querySelector("#lotOccupancyTransactionAdd--transactionAmount")).min=(-1*i).toFixed(2),e.max=Math.max(c-i,0).toFixed(2),e.value=Math.max(c-i,0).toFixed(2),a.dynamicsGPIntegrationIsEnabled){const c=(t=n.querySelector("#lotOccupancyTransactionAdd--externalReceiptNumber")).closest(".control");c.classList.add("has-icons-right"),c.insertAdjacentHTML("beforeend",''),c.insertAdjacentHTML("afterend",'

'),t.addEventListener("change",s),e.addEventListener("change",s),s()}},onshown(t,o){var a;bulmaJS.toggleHtmlClipped(),e.focus(),n=o,null===(a=t.querySelector("form"))||void 0===a||a.addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),i.focus()}})}),N()}})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t,n,c,o;const a=exports.los,l=document.querySelector("#lotOccupancy--lotOccupancyId").value,s=""===l;let i=s;function r(){var e;a.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.remove("is-light")}function u(){var e;a.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--lotOccupancy']"))||void 0===e||e.classList.add("is-light")}const d=document.querySelector("#form--lotOccupancy");d.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/${s?"doCreateLotOccupancy":"doUpdateLotOccupancy"}`,d,e=>{var t;const n=e;n.success?(u(),s||i?window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0,!0):bulmaJS.alert({message:`${a.escapedAliases.Occupancy} Updated Successfully`,contextualColorName:"success"})):bulmaJS.alert({title:`Error Saving ${a.escapedAliases.Occupancy}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const p=d.querySelectorAll("input, select");for(const e of p)e.addEventListener("change",r);function m(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doCopyLotOccupancy`,{lotOccupancyId:l},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL(n.lotOccupancyId,!0)):bulmaJS.alert({title:"Error Copying Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}null===(S=document.querySelector("#button--copyLotOccupancy"))||void 0===S||S.addEventListener("click",e=>{e.preventDefault(),a.hasUnsavedChanges()?bulmaJS.alert({title:"Unsaved Changes",message:"Please save all unsaved changes before continuing.",contextualColorName:"warning"}):bulmaJS.confirm({title:`Copy ${a.escapedAliases.Occupancy} Record as New`,message:"Are you sure you want to copy this record to a new record?",contextualColorName:"info",okButton:{text:"Yes, Copy",callbackFunction:m}})}),null===(e=document.querySelector("#button--deleteLotOccupancy"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:`Delete ${a.escapedAliases.Occupancy} Record`,message:"Are you sure you want to delete this record?",contextualColorName:"warning",okButton:{text:"Yes, Delete",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancy`,{lotOccupancyId:l},e=>{var t;const n=e;n.success?(u(),window.location.href=a.getLotOccupancyURL()):bulmaJS.alert({title:"Error Deleting Record",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}),null===(t=document.querySelector("#button--createWorkOrder"))||void 0===t||t.addEventListener("click",e=>{let t;function n(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/workOrders/doCreateWorkOrder`,e.currentTarget,e=>{const n=e;n.success?(t(),bulmaJS.confirm({title:"Work Order Created Successfully",message:"Would you like to open the work order now?",contextualColorName:"success",okButton:{text:"Yes, Open the Work Order",callbackFunction:()=>{window.location.href=a.getWorkOrderURL(n.workOrderId,!0)}}})):bulmaJS.alert({title:"Error Creating Work Order",message:n.errorMessage,contextualColorName:"danger"})})}e.preventDefault(),cityssm.openHtmlModal("lotOccupancy-createWorkOrder",{onshow(e){var t;e.querySelector("#workOrderCreate--lotOccupancyId").value=l,e.querySelector("#workOrderCreate--workOrderOpenDateString").value=cityssm.dateToString(new Date);const n=e.querySelector("#workOrderCreate--workOrderTypeId"),c=exports.workOrderTypes;1===c.length&&(n.innerHTML="");for(const e of c){const c=document.createElement("option");c.value=e.workOrderTypeId.toString(),c.textContent=null!==(t=e.workOrderType)&&void 0!==t?t:"",n.append(c)}},onshown(e,c){var o;t=c,bulmaJS.toggleHtmlClipped(),e.querySelector("#workOrderCreate--workOrderTypeId").focus(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",n)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--createWorkOrder").focus()}})});const y=document.querySelector("#lotOccupancy--occupancyTypeId");if(s){const e=document.querySelector("#container--lotOccupancyFields");y.addEventListener("change",()=>{""!==y.value?cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetOccupancyTypeFields`,{occupancyTypeId:y.value},t=>{var n,c;const o=t;if(0===o.occupancyTypeFields.length)return void(e.innerHTML=`
\n

There are no additional fields for this ${a.escapedAliases.occupancy} type.

\n
`);e.innerHTML="";let l="";for(const t of o.occupancyTypeFields){l+=","+t.occupancyTypeFieldId.toString();const o=`lotOccupancyFieldValue_${t.occupancyTypeFieldId.toString()}`,a=`lotOccupancy--${o}`,s=document.createElement("div");if(s.className="field",s.innerHTML=`
`,s.querySelector("label").textContent=t.occupancyTypeField,""===(null!==(n=t.occupancyTypeFieldValues)&&void 0!==n?n:"")){const e=document.createElement("input");e.className="input",e.id=a,e.name=o,e.type="text",e.required=t.isRequired,e.minLength=t.minimumLength,e.maxLength=t.maximumLength,""!==(null!==(c=t.pattern)&&void 0!==c?c:"")&&(e.pattern=t.pattern),s.querySelector(".control").append(e)}else{s.querySelector(".control").innerHTML=`
\n \n
`;const e=s.querySelector("select");e.required=t.isRequired;const n=t.occupancyTypeFieldValues.split("\n");for(const t of n){const n=document.createElement("option");n.value=t,n.textContent=t,e.append(n)}}console.log(s),e.append(s)}e.insertAdjacentHTML("beforeend",``)}):e.innerHTML=`
\n

Select the ${a.escapedAliases.occupancy} type to load the available fields.

\n
`})}else{const e=y.value;y.addEventListener("change",()=>{y.value!==e&&bulmaJS.confirm({title:"Confirm Change",message:`Are you sure you want to change the ${a.escapedAliases.occupancy} type?\n\n This change affects the additional fields associated with this record, and may also affect the available fees.`,contextualColorName:"warning",okButton:{text:"Yes, Keep the Change",callbackFunction:()=>{i=!0}},cancelButton:{text:"Revert the Change",callbackFunction:()=>{y.value=e}}})})}const v=document.querySelector("#lotOccupancy--lotName");v.addEventListener("click",e=>{const t=e.currentTarget.value;let n,c,o,l;function s(e,t){document.querySelector("#lotOccupancy--lotId").value=e.toString(),document.querySelector("#lotOccupancy--lotName").value=t,r(),n()}function i(e){var t,n;e.preventDefault();const c=e.currentTarget;s(null!==(t=c.dataset.lotId)&&void 0!==t?t:"",null!==(n=c.dataset.lotName)&&void 0!==n?n:"")}function u(){l.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(`${a.urlPrefix}/lots/doSearchLots`,o,e=>{var t,n;const c=e;if(0===c.count)return void(l.innerHTML='
\n

No results.

\n
');const o=document.createElement("div");o.className="panel";for(const e of c.lots){const c=document.createElement("a");c.className="panel-block is-block",c.href="#",c.dataset.lotId=e.lotId.toString(),c.dataset.lotName=e.lotName,c.innerHTML=`
\n
\n ${cityssm.escapeHTML(null!==(t=e.lotName)&&void 0!==t?t:"")}
\n ${cityssm.escapeHTML(null!==(n=e.mapName)&&void 0!==n?n:"")}\n
\n
\n ${cityssm.escapeHTML(e.lotStatus)}
\n \n ${e.lotOccupancyCount>0?"Currently Occupied":""}\n \n
\n
`,c.addEventListener("click",i),o.append(c)}l.innerHTML="",l.append(o)})}function d(e){e.preventDefault();const t=c.querySelector("#lotCreate--lotName").value;cityssm.postJSON(`${a.urlPrefix}/lots/doCreateLot`,e.currentTarget,e=>{var n,c;const o=e;o.success?s(null!==(n=o.lotId)&&void 0!==n?n:"",t):bulmaJS.alert({title:`Error Creating ${a.escapedAliases.Lot}`,message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-selectLot",{onshow(e){a.populateAliases(e)},onshown(e,a){var s,i;bulmaJS.toggleHtmlClipped(),c=e,n=a,bulmaJS.init(e);const r=e.querySelector("#lotSelect--lotName");""!==document.querySelector("#lotOccupancy--lotId").value&&(r.value=t),r.focus(),r.addEventListener("change",u);const p=e.querySelector("#lotSelect--occupancyStatus");if(p.addEventListener("change",u),""!==t&&(p.value=""),o=e.querySelector("#form--lotSelect"),l=e.querySelector("#resultsContainer--lotSelect"),o.addEventListener("submit",e=>{e.preventDefault()}),u(),exports.lotNamePattern){const t=exports.lotNamePattern;e.querySelector("#lotCreate--lotName").pattern=t.source}const m=e.querySelector("#lotCreate--lotTypeId");for(const e of exports.lotTypes){const t=document.createElement("option");t.value=e.lotTypeId.toString(),t.textContent=e.lotType,m.append(t)}const y=e.querySelector("#lotCreate--lotStatusId");for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,y.append(t)}const v=e.querySelector("#lotCreate--mapId");for(const e of exports.maps){const t=document.createElement("option");t.value=e.mapId.toString(),t.textContent=""===(null!==(s=e.mapName)&&void 0!==s?s:"")?"(No Name)":null!==(i=e.mapName)&&void 0!==i?i:"",v.append(t)}e.querySelector("#form--lotCreate").addEventListener("submit",d)},onremoved(){bulmaJS.toggleHtmlClipped()}})}),null===(n=document.querySelector(".is-lot-view-button"))||void 0===n||n.addEventListener("click",()=>{const e=document.querySelector("#lotOccupancy--lotId").value;""===e?bulmaJS.alert({message:`No ${a.escapedAliases.lot} selected.`,contextualColorName:"info"}):window.open(`${a.urlPrefix}/lots/${e}`)}),null===(c=document.querySelector(".is-clear-lot-button"))||void 0===c||c.addEventListener("click",()=>{v.disabled?bulmaJS.alert({message:"You need to unlock the field before clearing it.",contextualColorName:"info"}):(v.value=`(No ${a.escapedAliases.Lot})`,document.querySelector("#lotOccupancy--lotId").value="",r())}),a.initializeDatePickers(d),null===(o=document.querySelector("#lotOccupancy--occupancyStartDateString"))||void 0===o||o.addEventListener("change",()=>{const e=document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;e.min=document.querySelector("#lotOccupancy--occupancyStartDateString").value,e.refresh()}),a.initializeUnlockFieldButtons(d),Object.defineProperty(exports,"__esModule",{value:!0});let f=exports.lotOccupancyOccupants;function O(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotOccupantIndex)&&void 0!==n?n:"",10),o=f.find(e=>e.lotOccupantIndex===c);let s,i;function r(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyOccupant`,s,e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,i(),h()):bulmaJS.alert({title:`Error Updating ${a.escapedAliases.Occupant}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editOccupant",{onshow(e){var t,n,s,i,r,u,d,p,m,y,v,f,O,g,h,S;a.populateAliases(e),e.querySelector("#lotOccupancyOccupantEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyOccupantEdit--lotOccupantIndex").value=c.toString();const b=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");let C=!1;for(const e of exports.lotOccupantTypes){const t=document.createElement("option");t.value=e.lotOccupantTypeId.toString(),t.textContent=e.lotOccupantType,t.dataset.occupantCommentTitle=e.occupantCommentTitle,t.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,e.lotOccupantTypeId===o.lotOccupantTypeId&&(t.selected=!0,C=!0),b.append(t)}if(!C){const e=document.createElement("option");e.value=null!==(n=null===(t=o.lotOccupantTypeId)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",e.textContent=null!==(s=o.lotOccupantType)&&void 0!==s?s:"",e.dataset.occupantCommentTitle=o.occupantCommentTitle,e.dataset.fontAwesomeIconClass=o.fontAwesomeIconClass,e.selected=!0,b.append(e)}e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=``,e.querySelector("#lotOccupancyOccupantEdit--occupantName").value=null!==(r=o.occupantName)&&void 0!==r?r:"",e.querySelector("#lotOccupancyOccupantEdit--occupantFamilyName").value=null!==(u=o.occupantFamilyName)&&void 0!==u?u:"",e.querySelector("#lotOccupancyOccupantEdit--occupantAddress1").value=null!==(d=o.occupantAddress1)&&void 0!==d?d:"",e.querySelector("#lotOccupancyOccupantEdit--occupantAddress2").value=null!==(p=o.occupantAddress2)&&void 0!==p?p:"",e.querySelector("#lotOccupancyOccupantEdit--occupantCity").value=null!==(m=o.occupantCity)&&void 0!==m?m:"",e.querySelector("#lotOccupancyOccupantEdit--occupantProvince").value=null!==(y=o.occupantProvince)&&void 0!==y?y:"",e.querySelector("#lotOccupancyOccupantEdit--occupantPostalCode").value=null!==(v=o.occupantPostalCode)&&void 0!==v?v:"",e.querySelector("#lotOccupancyOccupantEdit--occupantPhoneNumber").value=null!==(f=o.occupantPhoneNumber)&&void 0!==f?f:"",e.querySelector("#lotOccupancyOccupantEdit--occupantEmailAddress").value=null!==(O=o.occupantEmailAddress)&&void 0!==O?O:"",e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=""===(null!==(g=o.occupantCommentTitle)&&void 0!==g?g:"")?"Comment":null!==(h=o.occupantCommentTitle)&&void 0!==h?h:"",e.querySelector("#lotOccupancyOccupantEdit--occupantComment").value=null!==(S=o.occupantComment)&&void 0!==S?S:""},onshown(e,t){bulmaJS.toggleHtmlClipped();const n=e.querySelector("#lotOccupancyOccupantEdit--lotOccupantTypeId");n.focus(),n.addEventListener("change",()=>{var t,c;const o=null!==(t=n.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==t?t:"user";e.querySelector("#lotOccupancyOccupantEdit--fontAwesomeIconClass").innerHTML=``;let a=null!==(c=n.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==c?c:"";""===a&&(a="Comment"),e.querySelector("#lotOccupancyOccupantEdit--occupantCommentTitle").textContent=a}),(s=e.querySelector("form")).addEventListener("submit",r),i=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function g(e){var t;const n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.lotOccupantIndex;bulmaJS.confirm({title:`Remove ${a.escapedAliases.Occupant}?`,message:`Are you sure you want to remove this ${a.escapedAliases.occupant}?`,okButton:{text:`Yes, Remove ${a.escapedAliases.Occupant}`,callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyOccupant`,{lotOccupancyId:l,lotOccupantIndex:n},e=>{var t;const n=e;n.success?(f=n.lotOccupancyOccupants,h()):bulmaJS.alert({title:`Error Removing ${a.escapedAliases.Occupant}`,message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function h(){var e,t,n,c,o,l,s,i,r,u,d,p,m,y,v,h,S,b,C,T,x,L,q;const N=document.querySelector("#container--lotOccupancyOccupants");if(cityssm.clearElement(N),0===f.length)return void(N.innerHTML=`
\n

There are no ${a.escapedAliases.occupants} associated with this record.

\n
`);const E=document.createElement("table");E.className="table is-fullwidth is-striped is-hoverable",E.innerHTML=`\n ${a.escapedAliases.Occupant}\n Address\n Other Contact\n Comment\n Options\n \n `;for(const N of f){const f=document.createElement("tr");f.dataset.lotOccupantIndex=null===(e=N.lotOccupantIndex)||void 0===e?void 0:e.toString(),f.innerHTML=`\n ${cityssm.escapeHTML(""===(null!==(t=N.occupantName)&&void 0!==t?t:"")&&""===(null!==(n=N.occupantFamilyName)&&void 0!==n?n:"")?"(No Name)":`${N.occupantName} ${N.occupantFamilyName}`)}
\n \n \n ${cityssm.escapeHTML(null!==(o=N.lotOccupantType)&&void 0!==o?o:"")}\n \n \n ${""===(null!==(l=N.occupantAddress1)&&void 0!==l?l:"")?"":`${cityssm.escapeHTML(null!==(s=N.occupantAddress1)&&void 0!==s?s:"")}
`}\n ${""===(null!==(i=N.occupantAddress2)&&void 0!==i?i:"")?"":`${cityssm.escapeHTML(null!==(r=N.occupantAddress2)&&void 0!==r?r:"")}
`}\n ${""===(null!==(u=N.occupantCity)&&void 0!==u?u:"")?"":`${cityssm.escapeHTML(null!==(d=N.occupantCity)&&void 0!==d?d:"")}, `}\n ${cityssm.escapeHTML(null!==(p=N.occupantProvince)&&void 0!==p?p:"")}
\n ${cityssm.escapeHTML(null!==(m=N.occupantPostalCode)&&void 0!==m?m:"")}\n \n ${""===(null!==(y=N.occupantPhoneNumber)&&void 0!==y?y:"")?"":`${cityssm.escapeHTML(null!==(v=N.occupantPhoneNumber)&&void 0!==v?v:"")}
`}\n ${""===(null!==(h=N.occupantEmailAddress)&&void 0!==h?h:"")?"":cityssm.escapeHTML(null!==(S=N.occupantEmailAddress)&&void 0!==S?S:"")}\n \n \n ${cityssm.escapeHTML(null!==(T=N.occupantComment)&&void 0!==T?T:"")}\n \n \n
\n \n \n
\n `,null===(x=f.querySelector(".button--edit"))||void 0===x||x.addEventListener("click",O),null===(L=f.querySelector(".button--delete"))||void 0===L||L.addEventListener("click",g),null===(q=E.querySelector("tbody"))||void 0===q||q.append(f)}N.append(E)}if(delete exports.lotOccupancyOccupants,s){const e=document.querySelector("#lotOccupancy--lotOccupantTypeId");e.addEventListener("change",()=>{var t;const n=d.querySelectorAll("[data-table='LotOccupancyOccupant']");for(const t of n)t.disabled=""===e.value;let c=null!==(t=e.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),d.querySelector("#lotOccupancy--occupantCommentTitle").textContent=c})}else h();if(null===(S=document.querySelector("#button--addOccupant"))||void 0===S||S.addEventListener("click",()=>{let e,t,n,c;function o(t){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyOccupant`,t,t=>{var n;const c=t;c.success?(f=c.lotOccupancyOccupants,e(),h()):bulmaJS.alert({title:`Error Adding ${a.escapedAliases.Occupant}`,message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function s(e){e.preventDefault(),o(t)}let i=[];function r(e){var t,n;e.preventDefault();const c=e.currentTarget,s=i[Number.parseInt(null!==(t=c.dataset.index)&&void 0!==t?t:"",10)],r=(null===(n=c.closest(".modal"))||void 0===n?void 0:n.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId")).value;""===r?bulmaJS.alert({title:`No ${a.escapedAliases.Occupant} Type Selected`,message:`Select a type to apply to the newly added ${a.escapedAliases.occupant}.`,contextualColorName:"warning"}):(s.lotOccupantTypeId=Number.parseInt(r,10),s.lotOccupancyId=Number.parseInt(l,10),o(s))}function u(e){e.preventDefault(),""!==n.querySelector("#lotOccupancyOccupantCopy--searchFilter").value?(c.innerHTML=a.getLoadingParagraphHTML("Searching..."),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doSearchPastOccupants`,n,e=>{var t,n,o,a,l,s,u,d,p,m,y;i=e.occupants;const v=document.createElement("div");v.className="panel";for(const[e,c]of i.entries()){const i=document.createElement("a");i.className="panel-block is-block",i.href="#",i.dataset.index=e.toString(),i.innerHTML=`\n ${cityssm.escapeHTML(null!==(t=c.occupantName)&&void 0!==t?t:"")} ${cityssm.escapeHTML(null!==(n=c.occupantFamilyName)&&void 0!==n?n:"")}\n
\n
\n
\n ${cityssm.escapeHTML(null!==(o=c.occupantAddress1)&&void 0!==o?o:"")}
\n ${""===(null!==(a=c.occupantAddress2)&&void 0!==a?a:"")?"":`${cityssm.escapeHTML(null!==(l=c.occupantAddress2)&&void 0!==l?l:"")}
`}${cityssm.escapeHTML(null!==(s=c.occupantCity)&&void 0!==s?s:"")}, ${cityssm.escapeHTML(null!==(u=c.occupantProvince)&&void 0!==u?u:"")}
\n ${cityssm.escapeHTML(null!==(d=c.occupantPostalCode)&&void 0!==d?d:"")}\n
\n
\n ${""===(null!==(p=c.occupantPhoneNumber)&&void 0!==p?p:"")?"":`${cityssm.escapeHTML(null!==(m=c.occupantPhoneNumber)&&void 0!==m?m:"")}
`}\n ${cityssm.escapeHTML(null!==(y=c.occupantEmailAddress)&&void 0!==y?y:"")}
\n
\n
`,i.addEventListener("click",r),v.append(i)}c.innerHTML="",c.append(v)})):c.innerHTML='
\n

Enter a partial name or address in the search field above.

\n
'}cityssm.openHtmlModal("lotOccupancy-addOccupant",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyOccupantAdd--lotOccupancyId").value=l;const t=e.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId"),n=e.querySelector("#lotOccupancyOccupantCopy--lotOccupantTypeId");for(const e of exports.lotOccupantTypes){const c=document.createElement("option");c.value=e.lotOccupantTypeId.toString(),c.textContent=e.lotOccupantType,c.dataset.occupantCommentTitle=e.occupantCommentTitle,c.dataset.fontAwesomeIconClass=e.fontAwesomeIconClass,t.append(c),n.append(c.cloneNode(!0))}e.querySelector("#lotOccupancyOccupantAdd--occupantCity").value=exports.occupantCityDefault,e.querySelector("#lotOccupancyOccupantAdd--occupantProvince").value=exports.occupantProvinceDefault},onshown(o,a){bulmaJS.toggleHtmlClipped(),bulmaJS.init(o);const l=o.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId");l.focus(),l.addEventListener("change",()=>{var e,t;const n=null!==(e=l.selectedOptions[0].dataset.fontAwesomeIconClass)&&void 0!==e?e:"user";o.querySelector("#lotOccupancyOccupantAdd--fontAwesomeIconClass").innerHTML=``;let c=null!==(t=l.selectedOptions[0].dataset.occupantCommentTitle)&&void 0!==t?t:"";""===c&&(c="Comment"),o.querySelector("#lotOccupancyOccupantAdd--occupantCommentTitle").textContent=c}),(t=o.querySelector("#form--lotOccupancyOccupantAdd")).addEventListener("submit",s),c=o.querySelector("#lotOccupancyOccupantCopy--searchResults"),(n=o.querySelector("#form--lotOccupancyOccupantCopy")).addEventListener("submit",e=>{e.preventDefault()}),o.querySelector("#lotOccupancyOccupantCopy--searchFilter").addEventListener("change",u),e=a},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addOccupant").focus()}})}),!s){var S;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.lotOccupancyComments;function b(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10),s=e.find(e=>e.lotOccupancyCommentId===o);let i,r;function u(t){t.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyComment`,i,t=>{var n,c;const o=t;o.success?(e=null!==(n=o.lotOccupancyComments)&&void 0!==n?n:[],r(),T()):bulmaJS.alert({title:"Error Updating Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editComment",{onshow(e){var t,n,c,i;a.populateAliases(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value=o.toString(),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value=null!==(t=s.lotOccupancyComment)&&void 0!==t?t:"";const r=e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");r.value=null!==(n=s.lotOccupancyCommentDateString)&&void 0!==n?n:"";const u=cityssm.dateToString(new Date);r.max=s.lotOccupancyCommentDateString<=u?u:null!==(c=s.lotOccupancyCommentDateString)&&void 0!==c?c:"",e.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value=null!==(i=s.lotOccupancyCommentTimeString)&&void 0!==i?i:""},onshown(e,t){bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus(),(i=e.querySelector("form")).addEventListener("submit",u),r=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function C(t){var n,c;const o=Number.parseInt(null!==(c=null===(n=t.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.lotOccupancyCommentId)&&void 0!==c?c:"",10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyComment`,{lotOccupancyId:l,lotOccupancyCommentId:o},t=>{var n;const c=t;c.success?(e=c.lotOccupancyComments,T()):bulmaJS.alert({title:"Error Removing Comment",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}},contextualColorName:"warning"})}function T(){var t,n,c,o,a,l,s,i;const r=document.querySelector("#container--lotOccupancyComments");if(0===e.length)return void(r.innerHTML='
\n

There are no comments associated with this record.

\n
');const u=document.createElement("table");u.className="table is-fullwidth is-striped is-hoverable",u.innerHTML='\n Commentor\n Comment Date\n Comment\n Options\n \n ';for(const r of e){const e=document.createElement("tr");e.dataset.lotOccupancyCommentId=null===(t=r.lotOccupancyCommentId)||void 0===t?void 0:t.toString(),e.innerHTML=`${cityssm.escapeHTML(null!==(n=r.recordCreate_userName)&&void 0!==n?n:"")}\n \n ${cityssm.escapeHTML(null!==(c=r.lotOccupancyCommentDateString)&&void 0!==c?c:"")}\n ${cityssm.escapeHTML(0===r.lotOccupancyCommentTime?"":null!==(o=r.lotOccupancyCommentTimePeriodString)&&void 0!==o?o:"")}\n \n ${cityssm.escapeHTML(null!==(a=r.lotOccupancyComment)&&void 0!==a?a:"")}\n \n
\n \n \n
\n `,null===(l=e.querySelector(".button--edit"))||void 0===l||l.addEventListener("click",b),null===(s=e.querySelector(".button--delete"))||void 0===s||s.addEventListener("click",C),null===(i=u.querySelector("tbody"))||void 0===i||i.append(e)}r.innerHTML="",r.append(u)}delete exports.lotOccupancyComments,null===(S=document.querySelector("#button--addComment"))||void 0===S||S.addEventListener("click",()=>{let t,n;function c(c){c.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyComment`,t,t=>{var c;const o=t;o.success?(e=o.lotOccupancyComments,n(),T()):bulmaJS.alert({title:"Error Adding Comment",message:null!==(c=o.errorMessage)&&void 0!==c?c:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-addComment",{onshow(e){a.populateAliases(e),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyId").value=l},onshown(e,o){bulmaJS.toggleHtmlClipped(),e.querySelector("#lotOccupancyCommentAdd--lotOccupancyComment").focus(),(t=e.querySelector("form")).addEventListener("submit",c),n=o},onremoved:()=>{bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addComment").focus()}})}),T(),Object.defineProperty(exports,"__esModule",{value:!0});let t=exports.lotOccupancyFees;delete exports.lotOccupancyFees;const n=document.querySelector("#container--lotOccupancyFees");function x(){var e,n,c;let o=0;for(const a of t)o+=((null!==(e=a.feeAmount)&&void 0!==e?e:0)+(null!==(n=a.taxAmount)&&void 0!==n?n:0))*(null!==(c=a.quantity)&&void 0!==c?c:0);return o}function L(e){var n,c;const o=Number.parseInt(null!==(c=null===(n=e.currentTarget.closest("tr"))||void 0===n?void 0:n.dataset.feeId)&&void 0!==c?c:"",10),s=t.find(e=>e.feeId===o);let i;function r(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyFeeQuantity`,e.currentTarget,e=>{const n=e;n.success?(t=n.lotOccupancyFees,N(),i()):bulmaJS.alert({title:"Error Updating Quantity",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editFeeQuantity",{onshow(e){var t,n;e.querySelector("#lotOccupancyFeeQuantity--lotOccupancyId").value=l,e.querySelector("#lotOccupancyFeeQuantity--feeId").value=s.feeId.toString(),e.querySelector("#lotOccupancyFeeQuantity--quantity").valueAsNumber=null!==(t=s.quantity)&&void 0!==t?t:0,e.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=null!==(n=s.quantityUnit)&&void 0!==n?n:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),i=t,e.querySelector("#lotOccupancyFeeQuantity--quantity").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",r)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function q(e){const n=e.currentTarget.closest(".container--lotOccupancyFee").dataset.feeId;bulmaJS.confirm({title:"Delete Fee",message:"Are you sure you want to delete this fee?",contextualColorName:"warning",okButton:{text:"Yes, Delete Fee",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyFee`,{lotOccupancyId:l,feeId:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N()):bulmaJS.alert({title:"Error Deleting Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}}})}function N(){var e,c,o,a,l,s,i,r,u,d,p,m,y,v,f;if(0===t.length)return n.innerHTML='
\n

There are no fees associated with this record.

\n
',void M();n.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
FeeUnit Cost×QuantityequalsTotalOptions
Subtotal
Tax
Grand Total
';let O=0,g=0;for(const h of t){const t=document.createElement("tr");t.className="container--lotOccupancyFee",t.dataset.feeId=h.feeId.toString(),t.dataset.includeQuantity=null!==(e=h.includeQuantity)&&void 0!==e&&e?"1":"0",t.innerHTML=`\n ${cityssm.escapeHTML(null!==(c=h.feeName)&&void 0!==c?c:"")}
\n ${cityssm.escapeHTML(null!==(o=h.feeCategory)&&void 0!==o?o:"")}\n \n ${1===h.quantity?"":`\n $${null===(a=h.feeAmount)||void 0===a?void 0:a.toFixed(2)}\n \n ×\n ${null===(l=h.quantity)||void 0===l?void 0:l.toString()}\n =`}\n \n $${((null!==(s=h.feeAmount)&&void 0!==s?s:0)*(null!==(i=h.quantity)&&void 0!==i?i:0)).toFixed(2)}\n \n \n
\n ${null!==(r=h.includeQuantity)&&void 0!==r&&r?'':""}\n \n
\n `,null===(u=t.querySelector(".button--editQuantity"))||void 0===u||u.addEventListener("click",L),null===(d=t.querySelector(".button--delete"))||void 0===d||d.addEventListener("click",q),null===(p=n.querySelector("tbody"))||void 0===p||p.append(t),O+=(null!==(m=h.feeAmount)&&void 0!==m?m:0)*(null!==(y=h.quantity)&&void 0!==y?y:0),g+=(null!==(v=h.taxAmount)&&void 0!==v?v:0)*(null!==(f=h.quantity)&&void 0!==f?f:0)}n.querySelector("#lotOccupancyFees--feeAmountTotal").textContent=`$${O.toFixed(2)}`,n.querySelector("#lotOccupancyFees--taxAmountTotal").textContent=`$${g.toFixed(2)}`,n.querySelector("#lotOccupancyFees--grandTotal").textContent=`$${(O+g).toFixed(2)}`,M()}const c=document.querySelector("#button--addFee");c.addEventListener("click",()=>{if(a.hasUnsavedChanges())return void bulmaJS.alert({message:"Please save all unsaved changes before adding fees.",contextualColorName:"warning"});let e,o,s;function i(e,n=1){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyFee`,{lotOccupancyId:l,feeId:e,quantity:n},e=>{var n;const c=e;c.success?(t=c.lotOccupancyFees,N(),u()):bulmaJS.alert({title:"Error Adding Fee",message:null!==(n=c.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"})})}function r(t){var n,c,o;t.preventDefault();const a=Number.parseInt(null!==(n=t.currentTarget.dataset.feeId)&&void 0!==n?n:"",10),l=Number.parseInt(null!==(c=t.currentTarget.dataset.feeCategoryId)&&void 0!==c?c:"",10),s=e.find(e=>e.feeCategoryId===l).fees.find(e=>e.feeId===a);null!==(o=s.includeQuantity)&&void 0!==o&&o?function(e){let t,n;function c(c){c.preventDefault(),i(e.feeId,t.value),n()}cityssm.openHtmlModal("lotOccupancy-setFeeQuantity",{onshow(t){var n;t.querySelector("#lotOccupancyFeeQuantity--quantityUnit").textContent=null!==(n=e.quantityUnit)&&void 0!==n?n:""},onshown(e,o){var a;n=o,t=e.querySelector("#lotOccupancyFeeQuantity--quantity"),null===(a=e.querySelector("form"))||void 0===a||a.addEventListener("submit",c)}})}(s):i(a)}function u(){var t,c,a,l,i,u;const d=o.value.trim().toLowerCase().split(" ");s.innerHTML="";for(const o of e){const e=document.createElement("div");e.className="container--feeCategory",e.dataset.feeCategoryId=o.feeCategoryId.toString(),e.innerHTML=`

\n ${cityssm.escapeHTML(null!==(t=o.feeCategory)&&void 0!==t?t:"")}\n

\n
`;let p=!1;for(const t of o.fees){if(null!==n.querySelector(`.container--lotOccupancyFee[data-fee-id='${t.feeId}'][data-include-quantity='0']`))continue;let s=!0;const m=`${null!==(c=o.feeCategory)&&void 0!==c?c:""} ${null!==(a=t.feeName)&&void 0!==a?a:""} ${null!==(l=t.feeDescription)&&void 0!==l?l:""}`.toLowerCase();for(const e of d)if(!m.includes(e)){s=!1;break}if(!s)continue;p=!0;const y=document.createElement("a");y.className="panel-block is-block container--fee",y.dataset.feeId=t.feeId.toString(),y.dataset.feeCategoryId=o.feeCategoryId.toString(),y.href="#",y.innerHTML=`${cityssm.escapeHTML(null!==(i=t.feeName)&&void 0!==i?i:"")}
\n \n ${cityssm.escapeHTML(null!==(u=t.feeDescription)&&void 0!==u?u:"").replaceAll("\n","
")}\n
`,y.addEventListener("click",r),e.querySelector(".panel").append(y)}p&&s.append(e)}}cityssm.openHtmlModal("lotOccupancy-addFee",{onshow(t){o=t.querySelector("#feeSelect--feeName"),s=t.querySelector("#resultsContainer--feeSelect"),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetFees`,{lotOccupancyId:l},t=>{e=t.feeCategories,o.disabled=!1,o.addEventListener("keyup",u),o.focus(),u()})},onshown(){bulmaJS.toggleHtmlClipped()},onhidden(){N()},onremoved(){bulmaJS.toggleHtmlClipped(),c.focus()}})});let o=exports.lotOccupancyTransactions;delete exports.lotOccupancyTransactions;const s=document.querySelector("#container--lotOccupancyTransactions");function E(e){var t,n;const c=Number.parseInt(null!==(n=null===(t=e.currentTarget.closest("tr"))||void 0===t?void 0:t.dataset.transactionIndex)&&void 0!==n?n:"",10),s=o.find(e=>e.transactionIndex===c);let i;function r(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doUpdateLotOccupancyTransaction`,e.currentTarget,e=>{const t=e;t.success?(o=t.lotOccupancyTransactions,M(),i()):bulmaJS.alert({title:"Error Updating Transaction",message:"Please try again.",contextualColorName:"danger"})})}cityssm.openHtmlModal("lotOccupancy-editTransaction",{onshow(e){var t,n,c,o,i,r;a.populateAliases(e),e.querySelector("#lotOccupancyTransactionEdit--lotOccupancyId").value=l,e.querySelector("#lotOccupancyTransactionEdit--transactionIndex").value=null!==(n=null===(t=s.transactionIndex)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").value=s.transactionAmount.toFixed(2),e.querySelector("#lotOccupancyTransactionEdit--externalReceiptNumber").value=null!==(c=s.externalReceiptNumber)&&void 0!==c?c:"",e.querySelector("#lotOccupancyTransactionEdit--transactionNote").value=null!==(o=s.transactionNote)&&void 0!==o?o:"",e.querySelector("#lotOccupancyTransactionEdit--transactionDateString").value=null!==(i=s.transactionDateString)&&void 0!==i?i:"",e.querySelector("#lotOccupancyTransactionEdit--transactionTimeString").value=null!==(r=s.transactionTimeString)&&void 0!==r?r:""},onshown(e,t){var n;bulmaJS.toggleHtmlClipped(),a.initializeDatePickers(e),e.querySelector("#lotOccupancyTransactionEdit--transactionAmount").focus(),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",r),i=t},onremoved(){bulmaJS.toggleHtmlClipped()}})}function $(e){const t=e.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;bulmaJS.confirm({title:"Delete Trasnaction",message:"Are you sure you want to delete this transaction?",contextualColorName:"warning",okButton:{text:"Yes, Delete Transaction",callbackFunction:function(){cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doDeleteLotOccupancyTransaction`,{lotOccupancyId:l,transactionIndex:t},e=>{var t;const n=e;n.success?(o=n.lotOccupancyTransactions,M()):bulmaJS.alert({title:"Error Deleting Transaction",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}}})}function M(){var e,n,c,l,i,r,u;if(0===o.length)return void(s.innerHTML=`
\n

There are no transactions associated with this record.

\n
`);s.innerHTML=`\n \n \n \n \n \n \n \n \n \n \n \n \n
Date${a.escapedAliases.ExternalReceiptNumber}AmountOptions
Transaction Total
`;let d=0;for(const t of o){d+=t.transactionAmount;const o=document.createElement("tr");o.className="container--lotOccupancyTransaction",o.dataset.transactionIndex=null===(e=t.transactionIndex)||void 0===e?void 0:e.toString();let p="";""!==t.externalReceiptNumber&&(p=cityssm.escapeHTML(null!==(n=t.externalReceiptNumber)&&void 0!==n?n:""),a.dynamicsGPIntegrationIsEnabled&&(void 0===t.dynamicsGPDocument?p+=' \n \n ':t.dynamicsGPDocument.documentTotal.toFixed(2)===t.transactionAmount.toFixed(2)?p+=' \n \n ':p+=` \n \n `),p+="
"),o.innerHTML=`\n ${cityssm.escapeHTML(null!==(c=t.transactionDateString)&&void 0!==c?c:"")}\n \n \n ${p}\n ${cityssm.escapeHTML(null!==(l=t.transactionNote)&&void 0!==l?l:"")}\n \n \n $${cityssm.escapeHTML(t.transactionAmount.toFixed(2))}\n \n \n
\n \n \n
\n `,null===(i=o.querySelector(".button--edit"))||void 0===i||i.addEventListener("click",E),null===(r=o.querySelector(".button--delete"))||void 0===r||r.addEventListener("click",$),null===(u=s.querySelector("tbody"))||void 0===u||u.append(o)}s.querySelector("#lotOccupancyTransactions--grandTotal").textContent=`$${d.toFixed(2)}`;const p=x();p.toFixed(2)!==d.toFixed(2)&&s.insertAdjacentHTML("afterbegin",`
\n
\n
\n
\n
Outstanding Balance
\n
\n
\n
\n $${cityssm.escapeHTML((p-d).toFixed(2))}\n
\n
\n
\n
`)}const i=document.querySelector("#button--addTransaction");i.addEventListener("click",()=>{let e,t,n;function c(e){e.preventDefault(),cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doAddLotOccupancyTransaction`,e.currentTarget,e=>{var t;const c=e;c.success?(o=c.lotOccupancyTransactions,n(),M()):bulmaJS.confirm({title:"Error Adding Transaction",message:null!==(t=c.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function s(){var n,c;const o=t.value,l=null===(n=t.closest(".control"))||void 0===n?void 0:n.querySelector(".icon"),s=null===(c=t.closest(".field"))||void 0===c?void 0:c.querySelector(".help");if(""===o)return s.innerHTML=" ",void(l.innerHTML='');cityssm.postJSON(`${a.urlPrefix}/lotOccupancies/doGetDynamicsGPDocument`,{externalReceiptNumber:o},t=>{const n=t;n.success&&void 0!==n.dynamicsGPDocument?e.valueAsNumber===n.dynamicsGPDocument.documentTotal?(s.textContent="Matching Document Found",l.innerHTML=''):(s.textContent=`Matching Document: $${n.dynamicsGPDocument.documentTotal.toFixed(2)}`,l.innerHTML=''):(s.textContent="No Matching Document Found",l.innerHTML='')})}cityssm.openHtmlModal("lotOccupancy-addTransaction",{onshow(n){a.populateAliases(n),n.querySelector("#lotOccupancyTransactionAdd--lotOccupancyId").value=l.toString();const c=x(),i=function(){let e=0;for(const t of o)e+=t.transactionAmount;return e}();if((e=n.querySelector("#lotOccupancyTransactionAdd--transactionAmount")).min=(-1*i).toFixed(2),e.max=Math.max(c-i,0).toFixed(2),e.value=Math.max(c-i,0).toFixed(2),a.dynamicsGPIntegrationIsEnabled){const c=(t=n.querySelector("#lotOccupancyTransactionAdd--externalReceiptNumber")).closest(".control");c.classList.add("has-icons-right"),c.insertAdjacentHTML("beforeend",''),c.insertAdjacentHTML("afterend",'

'),t.addEventListener("change",s),e.addEventListener("change",s),s()}},onshown(t,o){var a;bulmaJS.toggleHtmlClipped(),e.focus(),n=o,null===(a=t.querySelector("form"))||void 0===a||a.addEventListener("submit",c)},onremoved(){bulmaJS.toggleHtmlClipped(),i.focus()}})}),N()}})(); \ No newline at end of file diff --git a/public/javascripts/workOrderSearch.min.js b/public/javascripts/workOrderSearch.min.js index 6cdb4e56..1e90c023 100644 --- a/public/javascripts/workOrderSearch.min.js +++ b/public/javascripts/workOrderSearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=exports.workOrderPrints,s=document.querySelector("#form--searchFilters");e.initializeDatePickers(s);const a=document.querySelector("#container--searchResults"),n=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),r=document.querySelector("#searchFilter--offset");function o(s){var r,o,l,i,u,p,f,m,h,v,O,k,$,b,w,y,g,L,M,N;const T=s;if(0===T.workOrders.length)return void(a.innerHTML='
\n

There are no work orders that meet the search criteria.

\n
');const S=document.createElement("tbody");for(const s of T.workOrders){let a="";for(const t of null!==(r=s.workOrderLots)&&void 0!==r?r:[])a+=`
  • \n \n \n \n ${cityssm.escapeHTML(""===(null!==(l=t.lotName)&&void 0!==l?l:"")?`(No ${e.escapedAliases.Lot} Name)`:null!==(i=t.lotName)&&void 0!==i?i:"")}\n
  • `;for(const t of null!==(u=s.workOrderLotOccupancies)&&void 0!==u?u:[])for(const s of null!==(p=t.lotOccupancyOccupants)&&void 0!==p?p:[])a+=`
  • \n \n \n ${cityssm.escapeHTML(""===(null!==(v=s.occupantName)&&void 0!==v?v:"")&&""===(null!==(O=s.occupantFamilyName)&&void 0!==O?O:"")?"(No Name)":`${s.occupantName} ${s.occupantFamilyName}`)}\n
  • `;S.insertAdjacentHTML("beforeend",`\n \n \n ${""===(null===(k=s.workOrderNumber)||void 0===k?void 0:k.trim())?"(No Number)":cityssm.escapeHTML(null!==($=s.workOrderNumber)&&void 0!==$?$:"")}\n \n \n ${cityssm.escapeHTML(null!==(b=s.workOrderType)&&void 0!==b?b:"")}
    \n \n ${cityssm.escapeHTML(null!==(w=s.workOrderDescription)&&void 0!==w?w:"")}\n \n \n ${""===a?"":`
      ${a}
    `}\n \n
      \n
    • \n \n \n \n ${s.workOrderOpenDateString}\n
    • \n
    • \n \n \n \n ${s.workOrderCloseDate?s.workOrderCloseDateString:`(No ${e.escapedAliases.WorkOrderCloseDate})`}\n
    • \n
    \n \n ${0===s.workOrderMilestoneCount?"-":`${(null!==(y=s.workOrderMilestoneCompletionCount)&&void 0!==y?y:"").toString()}\n /\n ${(null!==(g=s.workOrderMilestoneCount)&&void 0!==g?g:"").toString()}`}\n \n ${t.length>0?`\n \n \n \n `:""}`)}a.innerHTML=`\n \n \n \n \n \n \n ${t.length>0?'':""}\n \n
    Work Order NumberDescriptionRelatedDateProgress
    `,a.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(n,T.offset,T.count)),null===(L=a.querySelector("table"))||void 0===L||L.append(S),null===(M=a.querySelector("button[data-page='previous']"))||void 0===M||M.addEventListener("click",c),null===(N=a.querySelector("button[data-page='next']"))||void 0===N||N.addEventListener("click",d)}function l(){a.innerHTML=e.getLoadingParagraphHTML("Loading Work Orders..."),cityssm.postJSON(`${e.urlPrefix}/workOrders/doSearchWorkOrders`,s,o)}function i(){r.value="0",l()}function c(){r.value=Math.max(Number.parseInt(r.value,10)-n,0).toString(),l()}function d(){r.value=(Number.parseInt(r.value,10)+n).toString(),l()}const u=s.querySelectorAll("input, select");for(const e of u)e.addEventListener("change",i);s.addEventListener("submit",e=>{e.preventDefault()}),l()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=exports.workOrderPrints,s=document.querySelector("#form--searchFilters");e.initializeDatePickers(s);const a=document.querySelector("#container--searchResults"),n=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),r=document.querySelector("#searchFilter--offset");function o(s){var r,o,l,i,u,p,f,m,h,v,O,k,$,b,w,y,g,L,M,N;const T=s;if(0===T.workOrders.length)return void(a.innerHTML='
    \n

    There are no work orders that meet the search criteria.

    \n
    ');const S=document.createElement("tbody");for(const s of T.workOrders){let a="";for(const t of null!==(r=s.workOrderLots)&&void 0!==r?r:[])a+=`
  • \n \n \n \n ${cityssm.escapeHTML(""===(null!==(l=t.lotName)&&void 0!==l?l:"")?`(No ${e.escapedAliases.Lot} Name)`:null!==(i=t.lotName)&&void 0!==i?i:"")}\n
  • `;for(const t of null!==(u=s.workOrderLotOccupancies)&&void 0!==u?u:[])for(const s of null!==(p=t.lotOccupancyOccupants)&&void 0!==p?p:[])a+=`
  • \n \n \n \n ${cityssm.escapeHTML(""===(null!==(v=s.occupantName)&&void 0!==v?v:"")&&""===(null!==(O=s.occupantFamilyName)&&void 0!==O?O:"")?"(No Name)":`${s.occupantName} ${s.occupantFamilyName}`)}\n
  • `;S.insertAdjacentHTML("beforeend",`\n \n ${t.length>0?``:""}`)}a.innerHTML=`
    \n \n ${""===(null===(k=s.workOrderNumber)||void 0===k?void 0:k.trim())?"(No Number)":cityssm.escapeHTML(null!==($=s.workOrderNumber)&&void 0!==$?$:"")}\n \n \n ${cityssm.escapeHTML(null!==(b=s.workOrderType)&&void 0!==b?b:"")}
    \n \n ${cityssm.escapeHTML(null!==(w=s.workOrderDescription)&&void 0!==w?w:"")}\n \n
    \n ${""===a?"":`
      ${a}
    `}\n
    \n
      \n
    • \n \n \n \n ${s.workOrderOpenDateString}\n
    • \n
    • \n \n \n \n ${s.workOrderCloseDate?s.workOrderCloseDateString:`(No ${e.escapedAliases.WorkOrderCloseDate})`}\n
    • \n
    \n
    \n ${0===s.workOrderMilestoneCount?"-":`${(null!==(y=s.workOrderMilestoneCompletionCount)&&void 0!==y?y:"").toString()}\n /\n ${(null!==(g=s.workOrderMilestoneCount)&&void 0!==g?g:"").toString()}`}\n \n \n \n \n
    \n \n \n \n \n \n \n ${t.length>0?'':""}\n \n
    Work Order NumberDescriptionRelatedDateProgress
    `,a.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(n,T.offset,T.count)),null===(L=a.querySelector("table"))||void 0===L||L.append(S),null===(M=a.querySelector("button[data-page='previous']"))||void 0===M||M.addEventListener("click",c),null===(N=a.querySelector("button[data-page='next']"))||void 0===N||N.addEventListener("click",d)}function l(){a.innerHTML=e.getLoadingParagraphHTML("Loading Work Orders..."),cityssm.postJSON(`${e.urlPrefix}/workOrders/doSearchWorkOrders`,s,o)}function i(){r.value="0",l()}function c(){r.value=Math.max(Number.parseInt(r.value,10)-n,0).toString(),l()}function d(){r.value=(Number.parseInt(r.value,10)+n).toString(),l()}const u=s.querySelectorAll("input, select");for(const e of u)e.addEventListener("change",i);s.addEventListener("submit",e=>{e.preventDefault()}),l()})(); \ No newline at end of file