PageSourceSearch

https://webeco.nait.ca/_nuxt/GWs9brHv.js

js nait.ca collected 2026-09-24 18:26:40 UTC 11,847 bytes, 1 lines download raw bytes

1import{_ as k,f as v,b as _,P as g,z as R,h as b,i as L,o as w,e as M,d as A,a as F,s as E}from"./DA0omcS5.js";import{B}from"./D0kmWC3z.js";import{E as $,f as I}from"./BVIzR_Dl.js";import{M as Y,P as H}from"./COG2vEVw.js";import"./Bfr2tT-T.js";import"./B_U8AUva.js";import"./CsjUQtjC.js";import"./Bfzrtnh5.js";import"./DceI1Gob.js";import"./DoDrT208.js";import"./CPwZKRhP.js";import"./DiTPAh0-.js";import"./CM5ZjMn1.js";import"./BB5pB_km.js";import"./fa2HzZCx.js";import"./jtXUx86f.js";import"./1WtSxS0n.js";import"./C6bwNlY_.js";import"./DmCqqObE.js";import"./CcvlrTL7.js";import"./D0Rv7CNB.js";import"./_l2EmW96.js";const j={name:"EventSearchPageGrid",components:{BaseSearchPage:B,EventCard:$,Pagination:H,ModalForm:Y},data(){return{EventCard:R($),defaultFilters:[{id:"keyword",fieldType:"text",labelType:"floating",labelText:"Keyword",placeholder:"Enter a keyword"},{id:"topic",fieldType:"multiselect",labelType:"floating",labelText:"Topic",placeholder:"Select a topic",fieldProps:{options:[]}},{id:"format",fieldType:"multiselect",labelType:"floating",labelText:"Format",placeholder:"Select a format",fieldProps:{options:[]}}],modalFormCategories:[{name:"Event Details",accordion:!1,fields:[{id:"keyword",fieldType:"text",labelType:"floating",labelText:"Keyword",placeholder:"Enter a keyword"},{id:"topic",fieldType:"multiselect",labelType:"floating",labelText:"Topic",fieldProps:{options:[]}},{id:"format",fieldType:"multiselect",labelType:"floating",labelText:"Format",fieldProps:{options:[]}},{fieldType:"daterangepicker",id:"date-range",labelText:"Date Range",labelType:"floating",labelPosition:"top",placeholder:"none",fieldProps:{disablePastDates:!0,isDisabled:!1,validationError:!1,placeholder:{start:"Start",end:"End"},zIndex:"z-[120]"}}]}],resetKey:0,filterQueryKeys:["keyword","topic","format","date-range"]}},async created(){try{const e=await I("event_topic",!0),t=await I("event_format",!0),a=(e||[]).map(n=>({label:n.label??n.name??n,value:n.value??n.name??n})),r=(t||[]).map(n=>({label:n.label??n.name??n,value:n.value??n.name??n})),i=this.defaultFilters.find(n=>n.id==="topic"),s=this.defaultFilters.find(n=>n.id==="format");i&&(i.fieldProps=i.fieldProps||{},i.fieldProps.options=a),s&&(s.fieldProps=s.fieldProps||{},s.fieldProps.options=r);const c=this.modalFormCategories.find(n=>n.name==="Event Details");if(c&&Array.isArray(c.fields)){const n=c.fields.find(l=>l.id==="topic"),o=c.fields.find(l=>l.id==="format");n&&(n.fieldProps=n.fieldProps||{},n.fieldProps.options=a),o&&(o.fieldProps=o.fieldProps||{},o.fieldProps.options=r)}}catch(e){console.error("taxonomy fetch failed",e)}},computed:{hasActiveFilters(){const e=(this._.provides[g]||this.$route)&&(this._.provides[g]||this.$route).query?(this._.provides[g]||this.$route).query:{};return this.filterQueryKeys.some(t=>{if(!(t in e))return!1;const a=e[t];let r;try{r=typeof a=="string"?JSON.parse(a):a}catch{r=a}if(t==="date-range"){if(!r)return!1;const i=r?.start??r?.Start??null,s=r?.end??r?.End??null;return!!(i&&String(i).trim()||s&&String(s).trim())}return Array.isArray(r)?r.length>0:typeof r=="string"?r.trim()!=="":!!r})}},methods:{generateNumericPages(e,t){const a=[];for(let r=1;r<=t;r++)a.push({text:String(r),link:`${r}`});return a},formatResultsText(e,t,a){if(!this.hasActiveFilters)return"";if(!a)return"No results found.";const r=(e-1)*t+1,i=Math.min(e*t,a);return`Displaying ${r}–${i} of ${a} result(s)`},onClearSearch(){this.$refs.eventsBase?.resetSearchQuery?.()},_coerceDate(e){if(!e)return null;const t=Array.isArray(e)?e[0]:e,a=t instanceof Date?t:new Date(t);return Number.isNaN(a.getTime())?null:a},_normalizeFirst(e){if(Array.isArray(e)){for(const t of e)if(t!=null&&t!=="")return t;return null}return e},_toUTCISOString(e){const t=this._coerceDate(e);return t?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())).toISOString():null},_endOfDay(e){const t=this._coerceDate(e);if(!t)return null;const a=new Date(t);return a.setHours(23,59,59,999),a},_parseDateRange(e){let t=this._normalizeFirst(e);
1if(typeof t=="string")try{t=JSON.parse(t)}catch{}t=this._normalizeFirst(t);const a=t?.start??t?.Start??null,r=t?.end??t?.End??null;return{start:this._coerceDate(a),end:this._coerceDate(r)}},constructEventQuery(e){const t=e.keyword||this.searchQueryObject?.keyword||(this._.provides[g]||this.$route)?.query?.keyword||"",a=t?`${t}*`:"*",r=[],i=e["date-range"]||this.searchQueryObject?.["date-range"]||(this._.provides[g]||this.$route)?.query?.["date-range"],{start:s,end:c}=this._parseDateRange(i),n=s?this._toUTCISOString(s):null,o=c?this._toUTCISOString(this._endOfDay(c)):null;if(n&&r.push(`startDateAndTime ge ${n}`),o&&r.push(`endDateAndTime le ${o}`),!n&&!o){const l=new Date;l.setUTCHours(0,0,0,0);const d=this._toUTCISOString(l);r.push(`(startDateAndTime ge ${d} or endDateAndTime ge ${d})`)}if(Array.isArray(e.topic)&&e.topic.length){const l=e.topic.map(d=>`t/name eq '${d}'`).join(" or ");r.push(`topic/any(t: ${l})`)}if(Array.isArray(e.format)&&e.format.length){const l=e.format.map(d=>`f eq '${d}'`).join(" or ");r.push(`format/name/any(f: ${l})`)}return{search:a,filter:r.length?r.join(" and "):null}},_ensureFutureFilter(e){const t=e||"",a=/startDateAndTime\s+(ge|gt)\s+/i.test(t),r=/endDateAndTime\s+(le|lt)\s+/i.test(t);if(a||r)return t||null;const i=new Date;i.setUTCHours(0,0,0,0);const s=new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString(),c=`(startDateAndTime ge ${s} or endDateAndTime ge ${s})`;return t?`${t} and ${c}`:c},async fetchEventResults({search:e,filter:t,page:a,pageSize:r}){window.__eventCache=window.__eventCache||{};const i=Date.now(),s=300*1,c=this._ensureFutureFilter(t),n=JSON.stringify({search:e,filter:c,page:a,pageSize:r});if(window.__eventCache[n]){const{data:m,timestamp:f}=window.__eventCache[n];if(i-f<s)return console.log("⚡ EVENT CACHE HIT"),m;delete window.__eventCache[n]}const o=L(),l={search:e,filter:c,count:!0,orderby:"startDateAndTime asc",skip:(a-1)*r,top:r,searchMode:"all",select:"title,teaser,startDateAndTime,endDateAndTime,location,format,topic,urlSlug,eventClassification,imageUrl"};console.log("CLIENT EVENT SEARCH CONFIG",{eventSearchIndex:o.public.eventSearchIndex,programSearchIndex:o.public.programSearchIndex,articleSearchIndex:o.public.articleSearchIndex,searchService:o.public.searchService});const d=await $fetch("/api/search/search",{method:"POST",body:l,query:{index:o.public.eventSearchIndex}}),u=d["@odata.count"]||d.count||0,T=Array.isArray(d?.value)?d.value:[];if(!this.gtmEnabled&&!this.hasUserInteracted&&this?.searchQueryObject){const m=this?.searchQueryObject||{},{start:f,end:y}=this._parseDateRange(m["date-range"]),C=h=>h?new Date(h).toISOString():"",x=h=>{if(!h)return"";const S=new Date(h),U=S.getFullYear(),N=String(S.getMonth()+1).padStart(2,"0"),O=String(S.getDate()).padStart(2,"0");return`${U}-${N}-${O}`},P={event:"event_search",search_term:m.keyword||"",search_topic:(m.topic||[]).join(", "),search_format:(m.format||[]).join(", "),search_date_start_iso:f?C(f):"",search_date_end_iso:y?C(this._endOfDay(y)):"",search_date_start:f?x(f):"",search_date_end:y?x(y):"",search_results_count:u};window.$gtm?.push?window.$gtm.push(P):window.dataLayer&&window.dataLayer.push(P)}const D={items:T,total:u};return window.__eventCache[n]={data:D,timestamp:i},D},mapEventToCard(e){const t=e.eventClassification==="event_series"?"View Event Series":"View Event",a=this._formatEventDate(e.startDateAndTime,e.endDateAndTime),r=[];return Array.isArray(e?.format?.name)&&e.format.name[0]&&r.push({type:"text",text:e.format.name[0]}),{layout:"vertical",cardColor:"grey",cardBorder:"none",buttonColor:"alternateYellow",eventData:{heading:e.title,text:this._truncate(this._stripHtml(e.teaser),200),headerSettings:{preheading:[{text:a,type:"text",iconName:"fa-regular fa-calendar"},e?.location?.name?{text:e.location.name,type:"text",iconName:"fa-solid fa-location-dot"}:null].filter(Boolean)},mediaImg:{imgSrc:e?.imageUrl?.url,imgAlt:e?.imageUrl?.description??e.title,imgTitle:e.title},videoURL:e.videoUrl,linkURL:this._getEventUrl(e),linkTarget:"_self",linkText:t,actions:[],footerItems:[...r,{type:"share",link:`${window.location.origin}${this._getEventUrl(e)}`}]}}},_getEventUrl(e){return`/events/${e?.urlSlug?.value||""}`},_stripHtml(e){if(!e)return"";const t=typeof window<"u"?document.createElement("div"):null;return t?(t.innerHTML=e,t.textContent||t.innerText||""):String(e).replace(/<[^>]*>/g,"")},_truncate(e,t){return e&&e.length>t?e.substring(0,t)+"...":e||""},_formatEventDate(e,t){const a=new Date(e);if(isNaN(a.getTime()))return"";const r=t?new Date(t):a,i={month:"short",day:"numeric"};return a.getFullYear()===r.getFullYear()&&a.getMonth()===r.getMonth()&&a.getDate()===r.getDate()?`${a.toLocaleDateString("en-US",i)}, ${a.getFullYear()}`:a.getFullYear()===r.getFullYear()?a.getMonth()===r.getMonth()?`${a.toLocaleDateString("en-US",i)} - ${r.getDate()}, ${a.getFullYear()}`:`${a.toLocaleDateString("en-US",i)} - ${r.toLocaleDateString("en-US",i)}, ${a.getFullYear()}`:`${a.toLocaleDateString("en-US",i)}, ${a.getFullYear()} - ${r.toLocaleDateString("en-US",i)}, ${r.getFullYear()}`}}},Q={class:"flex justify-between items-center w-full max-sm:flex-col gap-4"},q={class:"flex justify-between items-center w-full max-sm:flex-col gap-4"};function V(e,t,a,r,i,s){const c=b("Pagination"),n=b("BaseSearchPage");return w(),v(n,{showHeader:!0,header:{hierarchy:"L4",title:"Event Calendar",breadcrumbs:[{label:"Home",path:"https://www.nait.ca"},{label:"About NAIT",path:"https://www.nait.ca/nait/about"},{label:"Event Calendar",path:"https://www.nait.ca/events"}],teaser:"Discover upcoming events at NAIT and engage with the community.",bottomOverlap:"lg:pb-[6.5rem] md:pb-[5.25rem] pb-[5.75rem]"},seo:{title:"Event Calendar | NAIT",description:"Discover upcoming events at NAIT and engage with the community."},defaultFilters:i.defaultFilters,modalFormCategories:i.modalFormCategories,smartSearch:!1,enableAlp
1haPager:!1,showLayoutToggle:!1,serverPaging:!0,pageSize:12,constructSearchQuery:s.constructEventQuery,fetchFn:s.fetchEventResults,resultCardComponent:i.EventCard,mapRecordToGridProps:s.mapEventToCard,ref:"eventsBase",key:i.resetKey,gtmEventName:"event_search",gtmDebounceMs:500,showComparisonOverlay:!1},{"pager-top":_(({page:o,totalPages:l,totalCount:d,pageSize:u,onPageChange:p,resultsText:T})=>[A("div",Q,[F(c,{pagerStyle:"none",alignment:"left",resultsText:s.formatResultsText(o,u,d),clearSearch:s.hasActiveFilters,onClearSearch:s.onClearSearch},null,8,["resultsText","clearSearch","onClearSearch"]),d>u?(w(),v(c,{key:0,pagerStyle:"numeric",alignment:"right",showNumbers:"",firstPage:o>1?1:null,lastPage:o<l?l:null,prevPage:o>1?o-1:"",nextPage:o<l?o+1:"",numericPages:s.generateNumericPages(o,l),totalPages:l,currentPage:o,onPageChange:p},null,8,["firstPage","lastPage","prevPage","nextPage","numericPages","totalPages","currentPage","onPageChange"])):E("",!0)])]),"pager-bottom":_(({page:o,totalPages:l,totalCount:d,pageSize:u,onPageChange:p,resultsText:T})=>[A("div",q,[F(c,{pagerStyle:"none",alignment:"left",resultsText:s.formatResultsText(o,u,d),clearSearch:s.hasActiveFilters,onClearSearch:s.onClearSearch},null,8,["resultsText","clearSearch","onClearSearch"]),d>u?(w(),v(c,{key:0,pagerStyle:"numeric",alignment:"right",showNumbers:"",firstPage:o>1?1:null,lastPage:o<l?l:null,prevPage:o>1?o-1:"",nextPage:o<l?o+1:"",numericPages:s.generateNumericPages(o,l),totalPages:l,currentPage:o,onPageChange:p},null,8,["firstPage","lastPage","prevPage","nextPage","numericPages","totalPages","currentPage","onPageChange"])):E("",!0)])]),default:_(()=>[t[0]||(t[0]=M(" > ",-1))]),_:1},8,["defaultFilters","modalFormCategories","constructSearchQuery","fetchFn","resultCardComponent","mapRecordToGridProps"])}const ge=k(j,[["render",V]]);export{ge as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.