"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,e=document.querySelector("main").dataset.urlPrefix,o=document.querySelector("#lot--lotId").value,l=""===o,s=document.querySelector("#form--lot");s.addEventListener("submit",t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/"+(l?"doCreateLot":"doUpdateLot"),s,t=>{t.success?l?window.location.href=e+"/lots/"+t.lotId+"/edit":bulmaJS.alert({message:exports.aliases.lot+" Updated Successfully",contextualColorName:"success"}):bulmaJS.alert({title:"Error Updating "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}),t.initializeUnlockFieldButtons(s),l||document.querySelector("#button--deleteLot").addEventListener("click",t=>{t.preventDefault();bulmaJS.confirm({title:"Delete "+exports.aliases.lot,message:"Are you sure you want to delete this "+exports.aliases.lot.toLowerCase()+"?",contextualColorName:"warning",okButton:{text:"Yes, Delete "+exports.aliases.lot,callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLot",{lotId:o},t=>{t.success?(cityssm.disableNavBlocker(),window.location.href=e+"/lots/?t="+Date.now()):bulmaJS.alert({title:"Error Deleting "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}}})});let n=exports.lotComments;delete exports.lotComments;const r=l=>{const s=Number.parseInt(l.currentTarget.closest("tr").dataset.lotCommentId,10),r=n.find(t=>t.lotCommentId===s);let a,i;const d=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doUpdateLotComment",a,t=>{t.success?(n=t.lotComments,i(),m()):bulmaJS.alert({title:"Error Updating Comment",message:t.errorMessage,contextualColorName:"danger"})})};cityssm.openHtmlModal("lot-editComment",{onshow:e=>{t.populateAliases(e),e.querySelector("#lotCommentEdit--lotId").value=o,e.querySelector("#lotCommentEdit--lotCommentId").value=s.toString(),e.querySelector("#lotCommentEdit--lotComment").value=r.lotComment,e.querySelector("#lotCommentEdit--lotCommentDateString").value=r.lotCommentDateString,e.querySelector("#lotCommentEdit--lotCommentTimeString").value=r.lotCommentTimeString},onshown:(e,o)=>{bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),t.initializeTimePickers(e),e.querySelector("#lotCommentEdit--lotComment").focus(),(a=e.querySelector("form")).addEventListener("submit",d),i=o},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})},a=t=>{const l=Number.parseInt(t.currentTarget.closest("tr").dataset.lotCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLotComment",{lotId:o,lotCommentId:l},t=>{t.success?(n=t.lotComments,m()):bulmaJS.alert({title:"Error Removing Comment",message:t.errorMessage,contextualColorName:"danger"})})}},contextualColorName:"warning"})},m=()=>{const t=document.querySelector("#container--lotComments");if(0===n.length)return void(t.innerHTML='
');const e=document.createElement("table");e.className="table is-fullwidth is-striped is-hoverable",e.innerHTML='