text: "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").getAttribute("data-url-prefix"),t=document.querySelector("#form--filters"),n=document.querySelector("#filter--limit"),a=document.querySelector("#filter--offset"),s=document.querySelector("#container--events"),i=()=>{const c=Number.parseInt(n.value,10),r=Number.parseInt(a.value,10);s.innerHTML='<p class="has-text-centered has-text-grey-lighter"><i class="fas fa-3x fa-circle-notch fa-spin" aria-hidden="true"></i><br /><em>Loading events...</p>',cityssm.postJSON(e+"/events/doSearch",t,t=>{const n=t.events;if(0===n.length)return void(s.innerHTML='<div class="message is-info"><div class="message-body">Your search returned no results.</div></div>');const l=document.createElement("tbody");for(const t of n){const n=exports.config_licenceTypes[t.licenceTypeKey]||t.licenceTypeKey,a=e+"/events/"+t.licenceID.toString()+"/"+t.eventDate.toString(),s=document.createElement("tr");s.innerHTML='<td><a href="'+cityssm.escapeHTML(a)+'">'+t.eventDateString+"</a></td><td>"+cityssm.escapeHTML(t.externalLicenceNumber)+"<br /><small>Licence #"+t.licenceID.toString()+"</small></td><td>"+cityssm.escapeHTML(t.organizationName)+"</td><td>"+n+"<br /><small>"+cityssm.escapeHTML(t.licenceDetails)+"</small></td><td>"+(t.locationDisplayName?cityssm.escapeHTML(t.locationDisplayName):'<span class="has-text-grey">(No Location)</span>')+"<br /><small>"+t.startTimeString+(t.startTimeString===t.endTimeString?"":" to "+t.endTimeString)+'</small></td><td class="is-hidden-print has-text-right">'+(t.canUpdate?'<a class="button is-small" href="'+cityssm.escapeHTML(a)+'/edit"><span class="icon"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span><span>Edit</span></a>':"")+"</td>",l.append(s)}cityssm.clearElement(s);const o=document.createElement("table");if(o.className="table is-fullwidth is-striped is-hoverable has-sticky-header",o.innerHTML="<thead><tr><th>Event Date</th><th>Licence</th><th>Organization</th><th>Licence Type</th><th>Location</th><th></th></tr></thead>",o.append(l),s.append(o),s.insertAdjacentHTML("beforeend",'<div class="level is-block-print"><div class="level-left has-text-weight-bold">Displaying events '+(r+1).toString()+" to "+Math.min(c+r,t.count).toString()+" of "+t.count.toString()+"</div></div>"),c<t.count){const e=document.createElement("nav");if(e.className="level-right is-hidden-print",e.setAttribute("role","pagination"),e.setAttribute("aria-label","pagination"),r>0){const t=document.createElement("a");t.className="button",t.textContent="Previous",t.addEventListener("click",e=>{e.preventDefault(),a.value=Math.max(0,r-c).toString(),i()}),e.append(t)}if(c+r<t.count){const t=document.createElement("a");t.className="button ml-3",t.innerHTML='<span>Next Events</span><span class="icon"><i class="fas fa-chevron-right" aria-hidden="true"></i></span>',t.addEventListener("click",e=>{e.preventDefault(),a.value=(r+c).toString(),i()}),e.append(t)}s.querySelector(".level").append(e)}})},c=()=>{a.value="0",i()};t.addEventListener("submit",e=>{e.preventDefault()});const r=t.querySelectorAll(".input, .select select");for(const e of r)e.addEventListener("change",c);c()})();