1import{u as j}from"./utils_mixin-rpdCk6M7.js";import M from"./WorthKnowing-lLWEW8xO.js";import{N as D,P as A,d as a,e as c,k as m,E as p,f as e,m as k,I as g,Q as J,i as _,j as I,n as u,q as y,T as W,L as S,M as C,D as v,p as L,F as N,G as b,H as z,J as P}from"./main-CUr-Q8DI.js";import{N as V}from"./Journalists.vue_vue_type_style_index_0_scoped_7a9ac536_lang-BHH77sh9.js";import{_ as E}from"./_plugin-vue_export-helper-DlAUqK2U.js";const F={name:"AddJournalistModal",mixins:[j],inject:["WP"],data(){return{errorInfo:"",name:this.isLoggedIn()?this.WP.user.name.split(" ",1)[0]:"",description:"",email:this.isLoggedIn()?this.WP.user.email:"",nameError:!1,emailError:!1,descriptionError:!1,clickOutside:{handler:s=>{this.$emit("closed")},events:["touchend","mousedown"]}}},methods:{addJournalist(){if(this.errorInfo="",this.name===""){this.nameError=!0,this.errorInfo="Podaj swoje imiÄ!";return}if(this.description===""){this.descriptionError=!0,this.errorInfo="Wpisz treÅÄ wiadomoÅci!";return}if(this.email===""||!this.isEmail(this.email)){this.emailError=!0,this.errorInfo="Podaj poprawny adres email!";return}axios.post(this.WP.slowAjaxUrl,{endpoint:"api_send_journalist_proposition",name:this.name,description:this.description,email:this.email}).then(s=>{s.status===200&&(this.closeModal(),this.addInternalNotification(new D().setContent("ZgÅoszenie zostaÅo wysÅane")))})},isEmail(s){let t=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;return!!s.match(t)},closeModal(){this.$emit("closed")}}},w=s=>(S("data-v-58e69e8e"),s=s(),C(),s),T={class:"z-backdrop fixed left-0 top-0 w-full h-full outline-none overflow-y-overlay !bg-black/40 xl:px-0",ref:"backdrop"},Y={class:"col-span-2 border-b-[1px] border-[#1F2733] flex items-center py-3 text-[16px] font-medium !-mx-2 px-3"},B={class:"col-span-2 text-left"},U=w(()=>e("label",{for:"user-name",class:"bet-element-header"},"ImiÄ",-1)),O={class:"col-span-2 text-left"},q=w(()=>e("label",{for:"description",class:"bet-element-header"},"Opis",-1)),Z={class:"col-span-2 text-left"},K=w(()=>e("label",{for:"email",class:"bet-element-header"},[k("Podaj email "),e("span",{class:"text-zt-red"},"*")],-1)),G=w(()=>e("span",{class:"text-[14px]"}," WYÅLIJ ",-1)),H=[G],$={key:0,class:"text-xs font-[500] text-zt-red"};function Q(s,t,r,f,o,n){const d=A("click-outside");return a(),c("div",T,[m((a(),c("form",{class:p(["mx-auto modal-mobile overflow-y-auto fixed bg-zt-normal rounded-md gap-x-[16px] gap-y-[20px] grid px-4 shadow-zt bottom-0 w-full pb-2 xl:grid-cols-2 xl:top-[80px] xl:!relative xl:max-w-[624px] xl:overflow-y-visible",[s.window.PHP.visibleAdminBar?"!xl:top-[112px]":""]])},[e("div",Y,[k(" Zaproponuj nowego dziennikarza "),e("div",{class:"x-close-modal",onClick:t[0]||(t[0]=l=>s.$emit("closed"))})]),e("div",B,[U,m(e("input",{onInput:t[1]||(t[1]=l=>o.nameError=!1),required:"",class:p(["bet-element",{"text-zt-red placeholder:text-zt-red":o.nameError}]),type:"text",id:"user-name",placeholder:"Wprowadź swoje imiÄ","onUpdate:modelValue":t[2]||(t[2]=l=>o.name=l),maxlength:"100"},null,34),[[g,o.name]])]),e("div",O,[q,m(e("textarea",{onInput:t[3]||(t[3]=l=>o.descriptionError=!1),required:"",class:p(["bet-element py-4",{"text-zt-red placeholder:text-zt-red":o.descriptionError}]),type:"text",rows:"5",id:"description","onUpdate:modelValue":t[4]||(t[4]=l=>o.description=l),maxlength:"255",placeholder:"Dodaj tekst"},null,34),[[g,o.description]])]),e("div",Z,[K,m(e("input",{onInput:t[5]||(t[5]=l=>o.emailError=!1),required:"",class:p(["bet-element",{"text-zt-red placeholder:text-zt-red":o.emailError}]),type:"email",id:"email","onUpdate:modelValue":t[6]||(t[6]=l=>o.email=l),maxlength:"50",placeholder:"Wprowadź adres e-mail"},null,34),[[g,o.email]])]),e("button",{class:"w-[330px] zt-button mx-auto h-[40px] mt-2 flex shrink-0 items-center justify-center rounded-md zt-hover col-span-2",onClick:t[7]||(t[7]=J((...l)=>n.addJournalist&&n.addJournalist(...l),["prevent"]))},H),e("div",{class:p(["col-span-2 text-center",{"pb-2":o.errorInfo}])},[e("div",null,[_(W,null,{default:I(()=>
1[o.errorInfo!==""?(a(),c("span",$,u(o.errorInfo),1)):y("",!0)]),_:1})])],2)],2)),[[d,o.clickOutside]])],512)}const R=E(F,[["render",Q],["__scopeId","data-v-58e69e8e"]]),X={name:"Journalists",components:{NewCounterModal:V,AddJournalistModal:R,WorthKnowing:M},inject:["WP"],mixins:[j],data(){return{showAddJournalistModal:!1,firstSort:!0,loading:!0,selectedYear:"",years:[],journalists:{},filtering:{type:"DESC",param:"follows"}}},computed:{journalistsToShow(){if(this.loading)return;let s=this.journalists[`${this.selectedYear}`];return this.sort(s).filter(t=>t.follows!==null&&t.follows!=="0")}},mounted(){this.initializeScrollbar(".os");const s=new Date().getFullYear(),t=2020;for(let r=t;r<=s;r++)this.years.push(r);this.loading=!0,axios.post(this.WP.ajaxUrl,{endpoint:"api_get_journalists_years"}).then(r=>{this.years=r.data.data,this.selectedYear=this.years[this.years.length-1];let f=[];for(let o=0;o<this.years.length;o++)axios.post(this.WP.ajaxUrl,{endpoint:"api_get_journalists_follows",year:this.years[o]}).then(n=>{if(f[`${this.years[o]}`]=n.data.data,Object.keys(f).length===this.years.length){for(let d=1;d<this.years.length;d++)for(let l=0;l<f[`${this.years[d]}`].length;l++){const i=f[`${this.years[d]}`][l]?.follows,h=f[`${this.years[d]-1}`][l]?.follows;f[`${this.years[d]}`][l].change=this.calculateDiff(h,i)}this.journalists=f,this.loading=!1}})})},methods:{formatNumber(s){return Number(s).toLocaleString("en-US").replace(/,/g," ")},calculateDiff(s,t){if(this.selectedYear!=="2020"&&!(s===null||t===null))return(t-s)/s*100},changeFiltering(s){if(this.firstSort&&this.filtering.param!==s){this.filtering.param=s,this.filtering.type="DESC";return}this.filtering.param=s,this.filtering.type==="ASC"?this.filtering.type="DESC":this.filtering.type="ASC"},sort(s){return this.filtering.type==="DESC"?this.filtering.param==="change"?s.sort((t,r)=>this.compareValues(r.change,t.change)):this.filtering.param==="follows"&&s.sort((t,r)=>this.compareValues(r.follows,t.follows)):this.filtering.type==="ASC"&&(this.filtering.param==="change"?s.sort((t,r)=>this.compareValues(t.change,r.change)):this.filtering.param==="follows"&&s.sort((t,r)=>this.compareValues(t.follows,r.follows))),s},compareValues(s,t){return typeof s>"u"&&typeof t>"u"?0:typeof s>"u"?-1:typeof t>"u"?1:s-t},openAddJournalistModal(){this.showAddJournalistModal=!0}}},x=s=>(S("data-v-7a9ac536"),s=s(),C(),s),ee={class:"mb-10 mt-6 relative"},te={class:"flex flex-col w-full justify-center items-center mb-7"},se=x(()=>e("div",{class:"mt-9 mb-4"},[e("span",{class:"font-[500]"},"Wybierz sezon:")],-1)),oe=["value"],ie={class:"overflow-x-auto os pb-[10px]"},le={class:"mx-auto min-w-[470px] xl:w-[861px] xl:min-w-[0px]"},re={class:"flex w-full border border-zt-light rounded-zt text-left px-[9px] py-[10px] font-semibold text-[14px] xl:px-[20px] xl:text-[15px] xl:text-center"},ne=x(()=>e("div",{class:"w-[10%] text-center xl:w-2/12"},[e("span",null,"L.p")],-1)),ae=x(()=>e("div",{class:"w-[32%] pl-2 xl:w-3/12 xl:pl-0"},[e("span",{class:"z-10"},"ImiÄ i nazwisko")],-1)),de={class:"w-[28%] cursor-pointer text-center xl:w-4/12"},ce=x(()=>e("path",{d:"M3 4L0.401924 0.25L5.59808 0.25L3 4Z",fill:"#D9D9D9"},null,-1)),pe=[ce],fe={class:"w-[30%] cursor-pointer text-center xl:w-3/12"},ue=x(()=>e("path",{d:"M3 4L0.401924 0.25L5.59808 0.25L3 4Z",fill:"#D9D9D9"},null,-1)),he=[ue],me={class:"mt-1.5 overflow-x-auto text-[14px] xl:text-[16px]"},xe={class:"flex items-center text-left px-[9px] py-[10px] bg-zt-light/35 rounded-zt border border-zt-light xl:px-[20px] xl:text-center"},we={class:"w-[10%] text-center xl:w-2/12 xl:pl-0"},ge={class:"w-[32%] pl-2 xl:w-3/12 xl:pl-0 xl:text-center"},_e={class:"w-[28%] flex xl:justify-center xl:w-4/12"},ye={class:"z-50 relative"},ve={class:""},be={class:"w-[30%] flex justify-center xl:justify-center xl:w-3/12"},ze={class:"z-50 relative"},je={class:"flex w-full justify-center items-center pt-3"};function ke(s,t,r,f,o,n){const d=v("AddJournalistModal"),l=v("WorthKnowing");return a(),c("div",ee,[o.showAddJournalistModal?(a(),L(d,{key:0,onClosed:t[0]||(t[0]=i=>o.showAddJournalistModal=!1)})):y("",!0),e("div",null,[_(l,{"prop-title":"Informacja","prop-content":"Lista dotyczy kont na Twitterze powiÄ
zanych ze sportem"})]),e("div",te,[se,e("div",null,[m(e("select",{"onUpdate:modelValue":t[1]||(t[1]=i=>
1o.selectedYear=i),class:"w-[332px] cursor-pointer rounded-zt text-center text-white bg-[#3A4B64] py-1 border border-[#31425A]"},[(a(!0),c(b,null,z(o.years,i=>(a(),c("option",{value:i},u(i-1)+"/"+u(i.toString().slice(2)),9,oe))),256))],512),[[N,o.selectedYear,void 0,{number:!0}]])])]),e("div",ie,[e("div",le,[e("div",re,[ne,ae,e("div",de,[e("span",{onClick:t[2]||(t[2]=i=>n.changeFiltering("follows"))},"ObserwujÄ cych "),(a(),c("svg",{class:p(["inline-block",o.filtering.type==="ASC"&&o.filtering.param==="follows"?"rotate-180":""]),width:"6",height:"4",viewBox:"0 0 6 4",fill:"none",xmlns:"http://www.w3.org/2000/svg"},pe,2))]),e("div",fe,[e("span",{onClick:t[3]||(t[3]=i=>n.changeFiltering("change"))},"Przyrost roczny"),(a(),c("svg",{class:p(["inline-block ml-1",o.filtering.type==="ASC"&&o.filtering.param==="change"?"rotate-180":""]),width:"6",height:"4",viewBox:"0 0 6 4",fill:"none",xmlns:"http://www.w3.org/2000/svg"},he,2))])]),e("div",me,[_(P,{name:"fade"},{default:I(()=>[o.loading?y("",!0):(a(!0),c(b,{key:0},z(n.journalistsToShow,(i,h)=>(a(),c("div",{key:i.id,class:p(["py-[6px] flex gap-y-3 w-full flex-col overflow-y-hidden",[h===0?"pt-0 mt-[6px]":"",h===n.journalistsToShow.length-1?"pb-0 mb-[6px]":""]])},[e("div",xe,[e("div",we,[e("span",null,u(h+1),1)]),e("div",ge,[e("span",null,u(i.first_name)+" "+u(i.last_name),1)]),e("div",_e,[e("div",{class:p(["w-[70%] mx-auto flex justify-center xl:justify-center xl:w-[100px]",o.filtering.param==="follows"?"progress":""])},[e("div",ye,[e("span",ve,u(i.follows?n.formatNumber(i.follows):"Brak danych"),1)])],2)]),e("div",be,[e("div",{class:p(["w-[120px] flex justify-center xl:justify-center",o.filtering.param==="change"?"progress":""])},[e("div",ze,[e("span",null,u(i.change!==void 0?i.change.toFixed(2)+"%":"Brak danych"),1)])],2)])])],2))),128))]),_:1})])])]),e("div",je,[e("button",{class:"zt-button uppercase",onClick:t[4]||(t[4]=(...i)=>n.openAddJournalistModal&&n.openAddJournalistModal(...i))}," Dodaj nowych ")])])}const De=E(X,[["render",ke],["__scopeId","data-v-7a9ac536"]]);export{De as default}; 2//# sourceMappingURL=Journalists-DbJwD2GB.js.map
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.