`
rowElement
- .querySelector('.button--addLot')!
- .addEventListener('click', doAddLot)
+ .querySelector('.button--addLot')
+ ?.addEventListener('click', doAddLot)
searchResultsContainerElement
- .querySelector('tbody')!
- .append(rowElement)
+ .querySelector('tbody')
+ ?.append(rowElement)
}
}
)
@@ -782,7 +802,7 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => {
onshow(modalElement) {
los.populateAliases(modalElement)
- searchFormElement = modalElement.querySelector('form')!
+ searchFormElement = modalElement.querySelector('form') as HTMLFormElement
searchResultsContainerElement = modalElement.querySelector(
'#resultsContainer--lotAdd'
@@ -817,8 +837,8 @@ document.querySelector('#button--addLot')?.addEventListener('click', () => {
lotNameElement.focus()
modalElement
- .querySelector('#lotSearch--lotStatusId')!
- .addEventListener('change', doSearch)
+ .querySelector('#lotSearch--lotStatusId')
+ ?.addEventListener('change', doSearch)
searchFormElement.addEventListener('submit', doSearch)
},
diff --git a/public/javascripts/lotOccupancyEdit.min.js b/public/javascripts/lotOccupancyEdit.min.js
index 910363fc..67d40b48 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=`
`;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 ';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=`
';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=`
`)}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(),$()):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 `;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 ';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=`
';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=`
`,s.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(a,h.offset,h.count)),null===(d=s.querySelector("table"))||void 0===d||d.append(m),null===(u=s.querySelector("button[data-page='previous']"))||void 0===u||u.addEventListener("click",c),null===(p=s.querySelector("button[data-page='next']"))||void 0===p||p.addEventListener("click",i)}function o(){s.innerHTML=e.getLoadingParagraphHTML(`Loading ${e.escapedAliases.Lots}...`),cityssm.postJSON(e.urlPrefix+"/lots/doSearchLots",t,r)}function l(){n.value="0",o()}function c(){n.value=Math.max(Number.parseInt(n.value,10)-a,0).toString(),o()}function i(){n.value=(Number.parseInt(n.value,10)+a).toString(),o()}const d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault()}),o()})();
\ No newline at end of file
+"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),n=document.querySelector("#searchFilter--offset");function r(t){var n,r,o,l,d,u,p;const h=t;if(0===h.lots.length)return void(s.innerHTML=`
\n
There are no ${e.escapedAliases.lots} that meet the search criteria.
\n
`);const m=document.createElement("tbody");for(const t of h.lots)m.insertAdjacentHTML("beforeend",`
`,s.insertAdjacentHTML("beforeend",e.getSearchResultsPagerHTML(a,h.offset,h.count)),null===(d=s.querySelector("table"))||void 0===d||d.append(m),null===(u=s.querySelector("button[data-page='previous']"))||void 0===u||u.addEventListener("click",c),null===(p=s.querySelector("button[data-page='next']"))||void 0===p||p.addEventListener("click",i)}function o(){s.innerHTML=e.getLoadingParagraphHTML(`Loading ${e.escapedAliases.Lots}...`),cityssm.postJSON(`${e.urlPrefix}/lots/doSearchLots`,t,r)}function l(){n.value="0",o()}function c(){n.value=Math.max(Number.parseInt(n.value,10)-a,0).toString(),o()}function i(){n.value=(Number.parseInt(n.value,10)+a).toString(),o()}const d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault()}),o()})();
\ No newline at end of file
diff --git a/public/javascripts/workOrderEdit.min.js b/public/javascripts/workOrderEdit.min.js
index 1597f0d4..12a993dc 100644
--- a/public/javascripts/workOrderEdit.min.js
+++ b/public/javascripts/workOrderEdit.min.js
@@ -1 +1 @@
-"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t;const o=exports.los,r=document.querySelector("#workOrderEdit--workOrderId").value,n=""===r,s=document.querySelector("#form--workOrderEdit");function a(){var e;o.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--workOrderEdit']"))||void 0===e||e.classList.remove("is-light")}function l(){var e;o.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--workOrderEdit']"))||void 0===e||e.classList.add("is-light")}o.initializeDatePickers(null===(S=s.querySelector("#workOrderEdit--workOrderOpenDateString"))||void 0===S?void 0:S.closest(".field")),o.initializeUnlockFieldButtons(s),s.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/${n?"doCreateWorkOrder":"doUpdateWorkOrder"}`,e.currentTarget,e=>{var t;const r=e;r.success?(l(),n?window.location.href=o.getWorkOrderURL(r.workOrderId,!0):bulmaJS.alert({message:"Work Order Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating Work Order",message:null!==(t=r.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const i=s.querySelectorAll("input, select, textarea");for(const e of i)e.addEventListener("change",a);function d(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doCloseWorkOrder`,{workOrderId:r},e=>{var t;const n=e;n.success?(l(),window.location.href=o.getWorkOrderURL(r)):bulmaJS.alert({title:"Error Closing Work Order",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function c(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doDeleteWorkOrder`,{workOrderId:r},e=>{var t;const r=e;r.success?(l(),window.location.href=`${o.urlPrefix}/workOrders`):bulmaJS.alert({title:"Error Deleting Work Order",message:null!==(t=r.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}let u;if(null===(m=document.querySelector("#button--closeWorkOrder"))||void 0===m||m.addEventListener("click",()=>{u.some(e=>!e.workOrderMilestoneCompletionDate)?bulmaJS.alert({title:"Outstanding Milestones",message:"You cannot close a work order with outstanding milestones.\n Either complete the outstanding milestones, or remove them from the work order.",contextualColorName:"warning"}):bulmaJS.confirm({title:"Close Work Order",message:o.hasUnsavedChanges()?"Are you sure you want to close this work order with unsaved changes?":"Are you sure you want to close this work order?",contextualColorName:o.hasUnsavedChanges()?"warning":"info",okButton:{text:"Yes, Close Work Order",callbackFunction:d}})}),null===(e=document.querySelector("#button--deleteWorkOrder"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete Work Order",message:"Are you sure you want to delete this work order?",contextualColorName:"warning",okButton:{text:"Yes, Delete Work Order",callbackFunction:c}})}),!n){var m;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.workOrderLots;delete exports.workOrderLots;let t=exports.workOrderLotOccupancies;function p(e){const n=e.currentTarget.closest(".container--lotOccupancy").dataset.lotOccupancyId;bulmaJS.confirm({title:`Delete ${o.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${o.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/workOrders/doDeleteWorkOrderLotOccupancy",{workOrderId:r,lotOccupancyId:n},e=>{var o;const r=e;r.success?(t=r.workOrderLotOccupancies,k()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=r.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})}function y(t,n){cityssm.postJSON(o.urlPrefix+"/workOrders/doAddWorkOrderLot",{workOrderId:r,lotId:t},t=>{var r;const s=t;s.success?(e=s.workOrderLots,k()):bulmaJS.alert({title:`Error Adding ${o.escapedAliases.Lot}`,message:null!==(r=s.errorMessage)&&void 0!==r?r:"",contextualColorName:"danger"}),void 0!==n&&n(s.success)})}function O(e){y(e.currentTarget.dataset.lotId)}function h(t){const n=Number.parseInt(t.currentTarget.closest(".container--lot").dataset.lotId,10),s=e.find(e=>e.lotId===n);let a;function l(t){t.preventDefault(),cityssm.postJSON(o.urlPrefix+"/workOrders/doUpdateLotStatus",t.currentTarget,t=>{var o;const r=t;r.success?(e=r.workOrderLots,k(),a()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=r.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lot-editLotStatus",{onshow(e){o.populateAliases(e),e.querySelector("#lotStatusEdit--lotId").value=n.toString(),e.querySelector("#lotStatusEdit--lotName").value=s.lotName;const t=e.querySelector("#lotStatusEdit--lotStatusId");let a=!1;for(const e of exports.lotStatuses){const o=document.createElement("option");o.value=e.lotStatusId.toString(),o.textContent=e.lotStatus,e.lotStatusId===s.lotStatusId&&(a=!0),t.append(o)}if(!a&&s.lotStatusId){const e=document.createElement("option");e.value=s.lotStatusId.toString(),e.textContent=s.lotStatus,t.append(e)}s.lotStatusId&&(t.value=s.lotStatusId.toString()),e.querySelector("form").insertAdjacentHTML("beforeend",``)},onshown(e,t){a=t,bulmaJS.toggleHtmlClipped(),e.querySelector("form").addEventListener("submit",l)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function g(t){const n=t.currentTarget.closest(".container--lot").dataset.lotId;bulmaJS.confirm({title:`Delete ${o.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${o.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/workOrders/doDeleteWorkOrderLot",{workOrderId:r,lotId:n},t=>{var o;const r=t;r.success?(e=r.workOrderLots,k()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=r.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})}function k(){!function(){var r,n,s,a;const l=document.querySelector("#container--lotOccupancies");if(document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent=t.length.toString(),0===t.length)return void(l.innerHTML=`
\n
There are no ${o.escapedAliases.occupancies} associated with this work order.
\n
`);l.innerHTML=`
\n
\n
\n
${o.escapedAliases.Occupancy} Type
\n
${o.escapedAliases.Lot}
\n
${o.escapedAliases.OccupancyStartDate}
\n
End Date
\n
${o.escapedAliases.Occupants}
\n
\n
\n \n
`;const i=cityssm.dateToString(new Date);for(const d of t){const t=document.createElement("tr");t.className="container--lotOccupancy",t.dataset.lotOccupancyId=d.lotOccupancyId.toString();const c=!(d.occupancyEndDate&&d.occupancyEndDateStringd.lotId===e.lotId);t.innerHTML='
`;for(const e of s.lotOccupancies){const s=document.createElement("tr");s.className="container--lotOccupancy",s.dataset.lotOccupancyId=e.lotOccupancyId.toString(),s.innerHTML=`
"+(e.occupancyEndDate?e.occupancyEndDateString:'(No End Date)')+"
"+(0===e.lotOccupancyOccupants.length?`(No ${cityssm.escapeHTML(o.escapedAliases.Occupants)})`:cityssm.escapeHTML(e.lotOccupancyOccupants[0].occupantName+" "+e.lotOccupancyOccupants[0].occupantFamilyName)+(e.lotOccupancyOccupants.length>1?" plus "+(e.lotOccupancyOccupants.length-1).toString():""))+"
',n.querySelector(".button--edit").addEventListener("click",b),n.querySelector(".button--delete").addEventListener("click",M),r.querySelector("tbody").append(n)}o.innerHTML="",o.append(r)}function T(e){for(const t of e.querySelectorAll(".panel-block"))t.remove()}function C(e,t){T(t),t.insertAdjacentHTML("beforeend",`
`),cityssm.postJSON(`${o.urlPrefix}/workOrders/doGetWorkOrderMilestones`,{workOrderMilestoneDateFilter:"date",workOrderMilestoneDateString:e},o=>{var n,s,a,l;const i=o.workOrderMilestones.filter(e=>e.workOrderId.toString()!==r);T(t);for(const e of i)t.insertAdjacentHTML("beforeend",`
\n There are no milestones on other work orders scheduled for\n ${cityssm.escapeHTML(e)}.\n
\n
\n
`)})}function I(e){var t;const o=e;o.success?(u=o.workOrderMilestones,A()):bulmaJS.alert({title:"Error Reopening Milestone",message:null!==(t=o.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})}function x(e){var t;e.preventDefault();const n=cityssm.dateToString(new Date),s=Number.parseInt(null!==(t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId)&&void 0!==t?t:"",10),a=u.find(e=>e.workOrderMilestoneId===s);bulmaJS.confirm({title:"Complete Milestone",message:`Are you sure you want to complete this milestone?\n ${void 0!==a.workOrderMilestoneDateString&&""!==a.workOrderMilestoneDateString&&a.workOrderMilestoneDateString>n?" Note that this milestone is expected to be completed in the future.":""}`,messageIsHtml:!0,contextualColorName:"warning",okButton:{text:"Yes, Complete Milestone",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doCompleteWorkOrderMilestone`,{workOrderId:r,workOrderMilestoneId:s},I)}}})}function E(e){e.preventDefault();const t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Reopen Milestone",message:"Are you sure you want to remove the completion status from this milestone, and reopen it?",contextualColorName:"warning",okButton:{text:"Yes, Reopen Milestone",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/workOrders/doReopenWorkOrderMilestone",{workOrderId:r,workOrderMilestoneId:t},I)}}})}function D(e){e.preventDefault();const t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Delete Milestone",message:"Are you sure you want to delete this milestone?",contextualColorName:"warning",okButton:{text:"Yes, Delete Milestone",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doDeleteWorkOrderMilestone`,{workOrderMilestoneId:t,workOrderId:r},I)}}})}function q(e){var t;e.preventDefault();const n=Number.parseInt(null!==(t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId)&&void 0!==t?t:"",10),s=u.find(e=>e.workOrderMilestoneId===n);let a,l;function i(e){e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/doUpdateWorkOrderMilestone`,e.currentTarget,e=>{const t=e;I(t),t.success&&a()})}cityssm.openHtmlModal("workOrder-editMilestone",{onshow(e){var t,o,n,a,i,d;e.querySelector("#milestoneEdit--workOrderId").value=r,e.querySelector("#milestoneEdit--workOrderMilestoneId").value=null!==(o=null===(t=s.workOrderMilestoneId)||void 0===t?void 0:t.toString())&&void 0!==o?o:"";const c=e.querySelector("#milestoneEdit--workOrderMilestoneTypeId");let u=!1;for(const e of exports.workOrderMilestoneTypes){const t=document.createElement("option");t.value=e.workOrderMilestoneTypeId.toString(),t.textContent=e.workOrderMilestoneType,e.workOrderMilestoneTypeId===s.workOrderMilestoneTypeId&&(t.selected=!0,u=!0),c.append(t)}if(!u&&s.workOrderMilestoneTypeId){const e=document.createElement("option");e.value=s.workOrderMilestoneTypeId.toString(),e.textContent=null!==(n=s.workOrderMilestoneType)&&void 0!==n?n:"",e.selected=!0,c.append(e)}(l=e.querySelector("#milestoneEdit--workOrderMilestoneDateString")).value=null!==(a=s.workOrderMilestoneDateString)&&void 0!==a?a:"",s.workOrderMilestoneTime&&(e.querySelector("#milestoneEdit--workOrderMilestoneTimeString").value=null!==(i=s.workOrderMilestoneTimeString)&&void 0!==i?i:""),e.querySelector("#milestoneEdit--workOrderMilestoneDescription").value=null!==(d=s.workOrderMilestoneDescription)&&void 0!==d?d:""},onshown(e,t){var r;a=t,bulmaJS.toggleHtmlClipped(),o.initializeDatePickers(e),null===(r=e.querySelector("form"))||void 0===r||r.addEventListener("submit",i);const n=document.querySelector("#milestoneEdit--conflictingMilestonesPanel");l.addEventListener("change",()=>{C(l.value,n)}),C(l.value,n)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function A(){var e,t,o,r,n,s,a;const l=document.querySelector("#panel--milestones"),i=l.querySelectorAll(".panel-block");for(const e of i)e.remove();for(const i of u){const d=document.createElement("div");d.className="panel-block is-block container--milestone",d.dataset.workOrderMilestoneId=null===(e=i.workOrderMilestoneId)||void 0===e?void 0:e.toString(),d.innerHTML='
'+(i.workOrderMilestoneCompletionDate?'':'')+'
'+(i.workOrderMilestoneTypeId?""+cityssm.escapeHTML(null!==(t=i.workOrderMilestoneType)&&void 0!==t?t:"")+" ":"")+(0===i.workOrderMilestoneDate?'(No Set Date)':i.workOrderMilestoneDateString)+(i.workOrderMilestoneTime?" "+i.workOrderMilestoneTimePeriodString:"")+' '+cityssm.escapeHTML(null!==(o=i.workOrderMilestoneDescription)&&void 0!==o?o:"")+'
',null===(r=d.querySelector(".button--reopenMilestone"))||void 0===r||r.addEventListener("click",E),null===(n=d.querySelector(".button--editMilestone"))||void 0===n||n.addEventListener("click",q),null===(s=d.querySelector(".button--completeMilestone"))||void 0===s||s.addEventListener("click",x),null===(a=d.querySelector(".button--deleteMilestone"))||void 0===a||a.addEventListener("click",D),l.append(d)}bulmaJS.init(l)}delete exports.workOrderComments,null===(S=document.querySelector("#workOrderComments--add"))||void 0===S||S.addEventListener("click",function(){let e;function t(t){t.preventDefault(),cityssm.postJSON(o.urlPrefix+"/workOrders/doAddWorkOrderComment",t.currentTarget,t=>{t.success&&(f=t.workOrderComments,L(),e())})}cityssm.openHtmlModal("workOrder-addComment",{onshow(e){o.populateAliases(e),e.querySelector("#workOrderCommentAdd--workOrderId").value=r,e.querySelector("form").addEventListener("submit",t)},onshown(t,o){bulmaJS.toggleHtmlClipped(),e=o,t.querySelector("#workOrderCommentAdd--workOrderComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#workOrderComments--add").focus()}})}),n||L(),n||(u=exports.workOrderMilestones,delete exports.workOrderMilestones,A(),null===(t=document.querySelector("#button--addMilestone"))||void 0===t||t.addEventListener("click",()=>{let e,t,n;function s(r){r&&r.preventDefault();const s=cityssm.dateToString(new Date);function a(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doAddWorkOrderMilestone`,e,e=>{const t=e;I(t),t.success&&n()})}const l=t.value;""!==l&&l{C(t.value,l)}),C(t.value,l)},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#button--addMilestone").focus()}})}))})();
\ No newline at end of file
+"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e,t;const o=exports.los,n=document.querySelector("#workOrderEdit--workOrderId").value,r=""===n,s=document.querySelector("#form--workOrderEdit");function a(){var e;o.setUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--workOrderEdit']"))||void 0===e||e.classList.remove("is-light")}function l(){var e;o.clearUnsavedChanges(),null===(e=document.querySelector("button[type='submit'][form='form--workOrderEdit']"))||void 0===e||e.classList.add("is-light")}o.initializeDatePickers(null===(S=s.querySelector("#workOrderEdit--workOrderOpenDateString"))||void 0===S?void 0:S.closest(".field")),o.initializeUnlockFieldButtons(s),s.addEventListener("submit",e=>{e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/${r?"doCreateWorkOrder":"doUpdateWorkOrder"}`,e.currentTarget,e=>{var t;const n=e;n.success?(l(),r?window.location.href=o.getWorkOrderURL(n.workOrderId,!0):bulmaJS.alert({message:"Work Order Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating Work Order",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})});const i=s.querySelectorAll("input, select, textarea");for(const e of i)e.addEventListener("change",a);function d(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doCloseWorkOrder`,{workOrderId:n},e=>{var t;const r=e;r.success?(l(),window.location.href=o.getWorkOrderURL(n)):bulmaJS.alert({title:"Error Closing Work Order",message:null!==(t=r.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}function c(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doDeleteWorkOrder`,{workOrderId:n},e=>{var t;const n=e;n.success?(l(),window.location.href=`${o.urlPrefix}/workOrders`):bulmaJS.alert({title:"Error Deleting Work Order",message:null!==(t=n.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})})}let u;if(null===(m=document.querySelector("#button--closeWorkOrder"))||void 0===m||m.addEventListener("click",()=>{u.some(e=>!e.workOrderMilestoneCompletionDate)?bulmaJS.alert({title:"Outstanding Milestones",message:"You cannot close a work order with outstanding milestones.\n Either complete the outstanding milestones, or remove them from the work order.",contextualColorName:"warning"}):bulmaJS.confirm({title:"Close Work Order",message:o.hasUnsavedChanges()?"Are you sure you want to close this work order with unsaved changes?":"Are you sure you want to close this work order?",contextualColorName:o.hasUnsavedChanges()?"warning":"info",okButton:{text:"Yes, Close Work Order",callbackFunction:d}})}),null===(e=document.querySelector("#button--deleteWorkOrder"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete Work Order",message:"Are you sure you want to delete this work order?",contextualColorName:"warning",okButton:{text:"Yes, Delete Work Order",callbackFunction:c}})}),!r){var m;Object.defineProperty(exports,"__esModule",{value:!0});let e=exports.workOrderLots;delete exports.workOrderLots;let t=exports.workOrderLotOccupancies;function p(e){const r=e.currentTarget.closest(".container--lotOccupancy").dataset.lotOccupancyId;bulmaJS.confirm({title:`Delete ${o.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${o.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doDeleteWorkOrderLotOccupancy`,{workOrderId:n,lotOccupancyId:r},e=>{var o;const n=e;n.success?(t=n.workOrderLotOccupancies,g()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=n.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})}function y(t,r){cityssm.postJSON(`${o.urlPrefix}/workOrders/doAddWorkOrderLot`,{workOrderId:n,lotId:t},t=>{var n;const s=t;s.success?(e=s.workOrderLots,g()):bulmaJS.alert({title:`Error Adding ${o.escapedAliases.Lot}`,message:null!==(n=s.errorMessage)&&void 0!==n?n:"",contextualColorName:"danger"}),void 0!==r&&r(s.success)})}function v(e){var t;y(null!==(t=e.currentTarget.dataset.lotId)&&void 0!==t?t:"")}function O(t){var r;const s=Number.parseInt(null!==(r=t.currentTarget.closest(".container--lot").dataset.lotId)&&void 0!==r?r:"",10),a=e.find(e=>e.lotId===s);let l;function i(t){t.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/doUpdateLotStatus`,t.currentTarget,t=>{var o;const n=t;n.success?(e=n.workOrderLots,g(),l()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=n.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}cityssm.openHtmlModal("lot-editLotStatus",{onshow(e){var t,r,l;o.populateAliases(e),e.querySelector("#lotStatusEdit--lotId").value=s.toString(),e.querySelector("#lotStatusEdit--lotName").value=null!==(t=a.lotName)&&void 0!==t?t:"";const i=e.querySelector("#lotStatusEdit--lotStatusId");let d=!1;for(const e of exports.lotStatuses){const t=document.createElement("option");t.value=e.lotStatusId.toString(),t.textContent=e.lotStatus,e.lotStatusId===a.lotStatusId&&(d=!0),i.append(t)}if(!d&&a.lotStatusId){const e=document.createElement("option");e.value=a.lotStatusId.toString(),e.textContent=null!==(r=a.lotStatus)&&void 0!==r?r:"",i.append(e)}a.lotStatusId&&(i.value=a.lotStatusId.toString()),null===(l=e.querySelector("form"))||void 0===l||l.insertAdjacentHTML("beforeend",``)},onshown(e,t){var o;l=t,bulmaJS.toggleHtmlClipped(),null===(o=e.querySelector("form"))||void 0===o||o.addEventListener("submit",i)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function h(t){const r=t.currentTarget.closest(".container--lot").dataset.lotId;bulmaJS.confirm({title:`Delete ${o.escapedAliases.Occupancy} Relationship`,message:`Are you sure you want to remove the relationship to this ${o.escapedAliases.occupancy} record from this work order? Note that the record will remain.`,contextualColorName:"warning",okButton:{text:"Yes, Delete Relationship",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doDeleteWorkOrderLot`,{workOrderId:n,lotId:r},t=>{var o;const n=t;n.success?(e=n.workOrderLots,g()):bulmaJS.alert({title:"Error Deleting Relationship",message:null!==(o=n.errorMessage)&&void 0!==o?o:"",contextualColorName:"danger"})})}}})}function g(){!function(){var n,r,s,a,l,i;const d=document.querySelector("#container--lotOccupancies");if(document.querySelector(".tabs a[href='#relatedTab--lotOccupancies'] .tag").textContent=t.length.toString(),0===t.length)return void(d.innerHTML=`
\n
There are no ${o.escapedAliases.occupancies} associated with this work order.
\n
`);d.innerHTML=`
\n
\n
\n
${o.escapedAliases.Occupancy} Type
\n
${o.escapedAliases.Lot}
\n
${o.escapedAliases.OccupancyStartDate}
\n
End Date
\n
${o.escapedAliases.Occupants}
\n
\n
\n \n
`;const c=cityssm.dateToString(new Date);for(const u of t){const t=document.createElement("tr");t.className="container--lotOccupancy",t.dataset.lotOccupancyId=u.lotOccupancyId.toString();const m=!(u.occupancyEndDate&&u.occupancyEndDateStringu.lotId===e.lotId);t.innerHTML=`
`;for(const e of l.lotOccupancies){const l=document.createElement("tr");l.className="container--lotOccupancy",l.dataset.lotOccupancyId=e.lotOccupancyId.toString(),l.innerHTML=`
';for(const a of f){const i=document.createElement("tr");i.dataset.workOrderCommentId=null===(e=a.workOrderCommentId)||void 0===e?void 0:e.toString(),i.innerHTML=`
`,null===(n=i.querySelector(".button--edit"))||void 0===n||n.addEventListener("click",b),null===(r=i.querySelector(".button--delete"))||void 0===r||r.addEventListener("click",M),null===(s=l.querySelector("tbody"))||void 0===s||s.append(i)}a.innerHTML="",a.append(l)}function T(e){for(const t of e.querySelectorAll(".panel-block"))t.remove()}function C(e,t){T(t),t.insertAdjacentHTML("beforeend",`
`),cityssm.postJSON(`${o.urlPrefix}/workOrders/doGetWorkOrderMilestones`,{workOrderMilestoneDateFilter:"date",workOrderMilestoneDateString:e},o=>{var r,s,a,l;const i=o.workOrderMilestones.filter(e=>e.workOrderId.toString()!==n);T(t);for(const e of i)t.insertAdjacentHTML("beforeend",`
\n There are no milestones on other work orders scheduled for\n ${cityssm.escapeHTML(e)}.\n
\n
\n
`)})}function $(e){var t;const o=e;o.success?(u=o.workOrderMilestones,q()):bulmaJS.alert({title:"Error Reopening Milestone",message:null!==(t=o.errorMessage)&&void 0!==t?t:"",contextualColorName:"danger"})}function I(e){var t;e.preventDefault();const r=cityssm.dateToString(new Date),s=Number.parseInt(null!==(t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId)&&void 0!==t?t:"",10),a=u.find(e=>e.workOrderMilestoneId===s);bulmaJS.confirm({title:"Complete Milestone",message:`Are you sure you want to complete this milestone?\n ${void 0!==a.workOrderMilestoneDateString&&""!==a.workOrderMilestoneDateString&&a.workOrderMilestoneDateString>r?" Note that this milestone is expected to be completed in the future.":""}`,messageIsHtml:!0,contextualColorName:"warning",okButton:{text:"Yes, Complete Milestone",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doCompleteWorkOrderMilestone`,{workOrderId:n,workOrderMilestoneId:s},$)}}})}function x(e){e.preventDefault();const t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Reopen Milestone",message:"Are you sure you want to remove the completion status from this milestone, and reopen it?",contextualColorName:"warning",okButton:{text:"Yes, Reopen Milestone",callbackFunction:function(){cityssm.postJSON(o.urlPrefix+"/workOrders/doReopenWorkOrderMilestone",{workOrderId:n,workOrderMilestoneId:t},$)}}})}function E(e){e.preventDefault();const t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId;bulmaJS.confirm({title:"Delete Milestone",message:"Are you sure you want to delete this milestone?",contextualColorName:"warning",okButton:{text:"Yes, Delete Milestone",callbackFunction:function(){cityssm.postJSON(`${o.urlPrefix}/workOrders/doDeleteWorkOrderMilestone`,{workOrderMilestoneId:t,workOrderId:n},$)}}})}function D(e){var t;e.preventDefault();const r=Number.parseInt(null!==(t=e.currentTarget.closest(".container--milestone").dataset.workOrderMilestoneId)&&void 0!==t?t:"",10),s=u.find(e=>e.workOrderMilestoneId===r);let a,l;function i(e){e.preventDefault(),cityssm.postJSON(`${o.urlPrefix}/workOrders/doUpdateWorkOrderMilestone`,e.currentTarget,e=>{const t=e;$(t),t.success&&a()})}cityssm.openHtmlModal("workOrder-editMilestone",{onshow(e){var t,o,r,a,i,d;e.querySelector("#milestoneEdit--workOrderId").value=n,e.querySelector("#milestoneEdit--workOrderMilestoneId").value=null!==(o=null===(t=s.workOrderMilestoneId)||void 0===t?void 0:t.toString())&&void 0!==o?o:"";const c=e.querySelector("#milestoneEdit--workOrderMilestoneTypeId");let u=!1;for(const e of exports.workOrderMilestoneTypes){const t=document.createElement("option");t.value=e.workOrderMilestoneTypeId.toString(),t.textContent=e.workOrderMilestoneType,e.workOrderMilestoneTypeId===s.workOrderMilestoneTypeId&&(t.selected=!0,u=!0),c.append(t)}if(!u&&s.workOrderMilestoneTypeId){const e=document.createElement("option");e.value=s.workOrderMilestoneTypeId.toString(),e.textContent=null!==(r=s.workOrderMilestoneType)&&void 0!==r?r:"",e.selected=!0,c.append(e)}(l=e.querySelector("#milestoneEdit--workOrderMilestoneDateString")).value=null!==(a=s.workOrderMilestoneDateString)&&void 0!==a?a:"",s.workOrderMilestoneTime&&(e.querySelector("#milestoneEdit--workOrderMilestoneTimeString").value=null!==(i=s.workOrderMilestoneTimeString)&&void 0!==i?i:""),e.querySelector("#milestoneEdit--workOrderMilestoneDescription").value=null!==(d=s.workOrderMilestoneDescription)&&void 0!==d?d:""},onshown(e,t){var n;a=t,bulmaJS.toggleHtmlClipped(),o.initializeDatePickers(e),null===(n=e.querySelector("form"))||void 0===n||n.addEventListener("submit",i);const r=document.querySelector("#milestoneEdit--conflictingMilestonesPanel");l.addEventListener("change",()=>{C(l.value,r)}),C(l.value,r)},onremoved(){bulmaJS.toggleHtmlClipped()}})}function q(){var e,t,o,n,r,s,a;const l=document.querySelector("#panel--milestones"),i=l.querySelectorAll(".panel-block");for(const e of i)e.remove();for(const i of u){const d=document.createElement("div");d.className="panel-block is-block container--milestone",d.dataset.workOrderMilestoneId=null===(e=i.workOrderMilestoneId)||void 0===e?void 0:e.toString(),d.innerHTML=`