import{_ as f,o as t,c as r,a as s,d as P,i as o,f as v,E as S,F as y,r as m,n as h,b as p,t as u,k as C,w as b,v as T,N}from"./entry.DPwc-EV0.js";import{_ as F}from"./WebPager-CC-Z5TOR.mjs";import"./Pager-DoE47wmp.mjs";const W={props:{processing:{type:Boolean}}},B={class:"web-processing-spinner"},V={key:0,class:"spinner"};function D(n,i,a,g,d,c){const _=v;return t(),r("div",B,[a.processing?(t(),r("div",V,[s("div",null,[P(_,{icon:"ei:spinner-3",width:100,"icon-color":n.$ss.baseStyles.primaryColor},null,8,["icon-color"])])])):o("",!0)])}const L=f(W,[["render",D]]),$={props:{templates:{type:Array,required:!0},showPager:{type:Boolean,default:!1}},data(){return{currTemplates:this.templates,currPage:1,processing:!1}},computed:{useConvertUtcTimeToLocalDate(){return S},itemsPerPage(){return 20}},methods:{hasNextPage(n){var i,a;return(a=(i=n==null?void 0:n.campaigns)==null?void 0:i.pageInfo)==null?void 0:a.hasNextPage},async getPage(n,i){this.processing=!0;const a={templateId:this.currTemplates[n].id,omedaStatus:["Sent","Sending"],sortOrder:"desc",limit:this.itemsPerPage,skip:(i-1)*this.itemsPerPage,hideOnWeb:!1},g=await this.$gql.queryStream("getNewsletterCampaignStream",a);g.error?this.currTemplates[0].campaigns={items:[]}:(this.currTemplates[n].campaigns={...g.data},this.currPage=i),this.processing=!1}}},E={class:"web-newsletter-campaigns-wrapper"},M={key:0,style:{maxWidth:"630px"}},q=["src"],U={key:1,style:{maxWidth:"630px"}},z=["src"],I={key:2},O={style:{height:"75px",width:"calc(100% - 250px)",padding:"5px 10px"}},j=["src"],A={class:"campaigns"},R=["href"],G={class:"date"},H={class:"actions"},J=["href"],K={key:0,class:"divider"},Q=["href"];function X(n,i,a,g,d,c){const _=L,w=F,k=N;return t(),r("div",E,[s("div",{class:T(["web-newsletter-campaigns",d.currTemplates.length>1?"multi":""])},[(t(!0),r(y,null,m(d.currTemplates,(e,x)=>(t(),r("div",{key:e.id,class:"template"},[s("div",{class:"content",style:h({fontFamily:n.$ss.primaryFontFamily})},[a.showPager?(t(),p(_,{key:0,processing:d.processing},null,8,["processing"])):o("",!0),s("div",{class:"heading",style:h({backgroundColor:e.header.backgroundColor})},[e.header.headerStyle.style===1?(t(),r("div",M,[s("img",{src:e.header.headerStyle.style1Settings.image,style:{maxWidth:"100%"}},null,8,q)])):o("",!0),e.header.headerStyle.style===2?(t(),r("div",U,[s("img",{src:e.header.headerStyle.style2Settings.image,style:{maxWidth:"100%"}},null,8,z)])):o("",!0),e.header.headerStyle.style===3?(t(),r("div",I,[s("table",{style:h({width:"100%",backgroundColor:e.header.backgroundColor})},[s("tr",null,[s("td",O,[s("h1",{style:h({color:e.header.headerStyle.style3Settings.nameColor,fontFamily:e.styles.primaryFontFamily})},u(e.name),5)]),s("td",{style:h({height:"75px",padding:"10px",width:"120px",background:e.header.headerStyle.style3Settings.logoBackgroundColor})},[s("img",{src:e.header.headerStyle.style3Settings.image,width:120},null,8,j)],4)])],4)])):o("",!0)],4),s("div",A,[(t(!0),r(y,null,m(e.campaigns.items,l=>(t(),r("div",{key:l.id,class:"campaign"},[s("a",{target:"_blank",href:`/newsletter/${l.id}`,class:"link"},[s("span",G,u(c.useConvertUtcTimeToLocalDate(l.deploymentDate,"MMM d, yyyy")),1),C(u(l.subject),1)],8,R)]))),128))]),P(k,null,{default:b(()=>[a.showPager&&e.campaigns.totalCount>c.itemsPerPage?(t(),p(w,{key:0,"active-page":d.currPage,"total-count":e.campaigns.totalCount,"items-per-page":c.itemsPerPage,onChangeValue:l=>c.getPage(x,l)},null,8,["active-page","total-count","items-per-page","onChangeValue"])):o("",!0)]),_:2},1024),s("div",H,[s("a",{href:`/latest-newsletter/${e.id}`,target:"_blank"},"Latest Edition",8,J),!a.showPager&&c.hasNextPage(e)?(t(),r("span",K,"|")):o("",!0),!a.showPager&&c.hasNextPage(e)?(t(),r("a",{key:1,href:`/newsletters/${e.id}`},"View More",8,Q)):o("",!0)])],4)]))),128))],2)])}const se=f($,[["render",X]]);export{se as default};