import{_ as C}from"./question-c35b46bb.js";import{a as $,A as V,k as l,x as j,C as D,r as a,o as e,q as n,d,e as G,f as m,c as r,v as x,F as R,n as z,w as f,j as M,t as b}from"./index-0c00d6f8.js";const H={class:"h-full flex flex-col"},J={class:"bg-white rounded-3xl h-full shadow-[0_7px_6px_0px,rgba(#B1B1B11A)] md:p-7 flex-1 flex flex-col"},K={key:0,class:"h-full flex flex-col items-center justify-center space-y-6"},O={class:"text-center"},P={class:"mt-4 font-semibold text-text text-center"},Q={key:1,class:"mt-4 font-semibold text-text text-center"},Y={__name:"index",setup(U){const{t:c}=$(),s=V(),u=l(null),k=[{path:"/",imgIcon:"menu-setup.svg",name:c("TITLES.home")},{path:"/news-letters",imgIcon:"",name:c("LABELS.newsLetter")}],o=l(!0),i=l([]),w=[{text:c("LABELS.email"),align:"start",sortable:!1,value:"email"}],_=l(null);function v(){u.value=null,o.value=!0,M.get("news-letter",{params:{keyword:s.query.keyword||"",page:+s.query.page||1}}).then(t=>{i.value=t.data.data,_.value=t.data.meta,o.value=!1}).catch(t=>{o.value=!1,u.value=t.response})}j(()=>{s.query.keyword&&(p.value=!0),v()});const p=l(!1);return D(()=>s.query,()=>{s.query.keyword&&(p.value=!0),v()}),(t,h)=>{var y,g;const L=a("breadcrumbs"),B=a("base-filter"),E=a("Loader"),S=a("NotFound"),q=a("GlobalError"),N=a("loader"),A=a("small-details-card"),F=a("data-table"),I=a("base-pagination");return e(),n("div",H,[d(L,{items:k,title:G(c)("LABELS.newsLetter"),back:"/",class:"mb-7"},null,8,["title"]),m("div",J,[i.value.length||p.value?(e(),r(B,{key:0,name:"newsLetter",inputs:[],icon:"fas fa-plus",keyword:!1})):x("",!0),o.value?(e(),r(E,{key:1})):(e(),n(R,{key:2},[((y=u.value)==null?void 0:y.status)===404?(e(),r(S,{key:0})):((g=u.value)==null?void 0:g.status)===500?(e(),r(q,{key:1})):(e(),n("div",{key:2,class:z(i.value.length?"":"h-full")},[d(F,{headers:w,items:i.value,loading:o.value,"hide-footer":""},{loading:f(()=>[d(N,{class:"py-7"})]),"empty-message":f(()=>[t.$route.query.keyword?(e(),n("h3",Q,b(t.$t("TITLES.No Search result")),1)):(e(),n("div",K,[m("div",O,[h[0]||(h[0]=m("img",{class:"mx-auto",src:C,alt:""},null,-1)),m("h3",P,b(t.$t("TITLES.No have been Found",{name:t.$t("LABELS.newsLetter")})),1)])]))]),"item-email":f(({email:T})=>[d(A,{title:T},null,8,["title"])]),_:1},8,["items","loading"])],2))],64))]),_.value?(e(),r(I,{key:0,item:_.value},null,8,["item"])):x("",!0)])}}};export{Y as default};
