Vue.component("news-releases",{props:{searchQuery:String,defaultKeywords:String,searchFields:String,itemLimit:{type:Number,"default":5},showPaging:{type:Boolean,"default":!1},onlyRecentArticles:{type:Boolean,"default":!1},facetFields:{type:Array,"default":function(){return[]}}},data:function(){return{}},computed:{newsArticles(){return this.$store.state.results.search},totalResults(){return this.$store.state.results.totalCount},skipResults(){return this.$store.state.query.skip}},methods:{changePage(skipResults){this.$store.dispatch("skipResults",skipResults)}},created:function(){this.$store.dispatch("init",{context:{url:"/api/news-releases/search"},query:{userKeywords:this.searchQuery,defaultKeywords:this.defaultKeywords,itemLimit:this.itemLimit,facetFields:this.facetFields,otherSearchOptions:{onlyRecents:this.onlyRecentArticles}}})},template:`
<div>
	<news-article v-for="article in newsArticles" :key="article.id"
					:article="article"></news-article>
	<search-paging v-if="showPaging" class="my-5"
				:total-rows="totalResults"
				:start-row="skipResults"
				:row-limit="itemLimit"
				:page-limit="5"
				@change-page="changePage($event)"></search-paging>
</div>`});Vue.component("news-article",{props:{article:Object},computed:{formattedDate(){let articleDate=this.article.articleDate,formatted=null;if(articleDate){let date=new Date(articleDate);formatted=`${this.articleDayOfWeek}, ${this.articleMonth} ${date.getUTCDate()}, ${date.getUTCFullYear()}`}return formatted},articleDayOfWeek(){let articleDate=this.article.articleDate,day=null;if(articleDate){let date=new Date(articleDate);day=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][date.getUTCDay()]}return day},articleMonth(){let articleDate=this.article.articleDate,month=null;if(articleDate){let date=new Date(articleDate);month=["January","February","March","April","May","June","July","August","September","October","November","December"][date.getUTCMonth()]}return month}},template:`
<div class="mb-3">
    <a :href="article.link"><strong>{{ article.title }}</strong></a>
    <p><span v-if="formattedDate">{{ formattedDate }} - </span>{{ article.description }}</p>
</div>`});$("#news-release-search").length&&new Vue({el:"#news-release-search",router:Daktronics.Components.GetVueRouter(),store:makeSearchComponentStore(),computed:{searchQuery(){return this.$store.state.query.userKeywords}},methods:{updateUserSearchQuery(keywords){this.$store.dispatch("newKeywordQuery",keywords).then(()=>{$("#news-release-search input[type=text]").get(0).blur()})},restartSearch(){this.$store.dispatch("reset")}},created:function(){this.$store.commit("setRouter",this.$router)}});Daktronics.Components.RegisterVues(".news-releases",makeSearchComponentStore);
