import{h as C}from"./moment-a9aaa855.js";import{_ as P}from"./FilterDropdown-9268f1dc.js";import{_ as $}from"./NoDataFound-bc81d7fa.js";import{_ as A}from"./Paginate-f61b79b2.js";import{s as R,A as T,h as b,c as n,a as r,b as t,F as p,r as _,j,t as e,i as B,g as D,o as a,n as h,k as d,u as f}from"./app-13978987.js";import{_ as L}from"./PageHeader-8c638686.js";import{_ as Y}from"./UserLayout-6a50516d.js";import"./SpinnerBtn-899a94c2.js";import"./dropdown-45d66330.js";const E={class:"container flex-grow p-4 sm:p-6"},F={class:"space-y-6"},I={class:"grid grid-cols-1 gap-8 sm:grid-cols-2 xl:grid-cols-3"},M={class:"flex items-center gap-3 p-5"},N={class:"flex flex-1 flex-col"},O={class:"text-sm tracking-wide text-slate-500"},V={class:"flex items-center justify-between gap-2"},q={class:"ml-auto w-80"},z={class:"table-responsive whitespace-nowrap rounded-primary"},S={class:"table"},G={key:0},H=["src"],J={class:"flex items-center gap-2"},K=["src"],Q={key:0,class:"badge badge-info"},U={key:1,class:"text-md rounded-full border bg-gray-100 px-3 py-1 dark:border-gray-400 dark:bg-gray-700 dark:text-white"},W=t("i",{class:"bx bx-like"},null,-1),X={key:0,class:"badge badge-info"},Z={key:1,class:"text-md rounded-full border bg-gray-100 px-3 py-1 dark:border-gray-400 dark:bg-gray-700 dark:text-white"},tt=t("i",{class:"bx bx-comment"},null,-1),st=D({layout:Y}),mt=Object.assign(st,{__name:"Analytics",props:["buttons","request","posts","type","totalPost","totalReactions","totalComments"],setup(o){const{textExcerpt:g}=R(),c=o,k=[{label:"Content",value:"content"},{label:"Platform",value:"platform",options:[{label:"Facebook",value:"facebook"},{label:"Twitter",value:"twitter"},{label:"Instagram",value:"instagram"},{label:"Linkedin",value:"linkedin"},{label:"tiktok",value:"tiktok"}]}],x=T(()=>[{title:"Total Posts",value:c.totalPost,icon:"bx bx-bar-chart-alt-2",classes:"bg-primary-500 text-primary-500"},{title:"Total Reactions",value:c.totalReactions,icon:"bx bx-like",classes:"text-success-500 bg-success-500"},{title:"Total Comments",value:c.totalComments,icon:"bx bx-comment-detail",classes:"text-warning-500 bg-warning-500"}]);return(l,m)=>{const y=b("Icon"),v=b("Link");return a(),n("main",E,[r(L,{title:"Analytics",buttons:o.buttons},null,8,["buttons"]),t("div",F,[t("section",I,[(a(!0),n(p,null,_(x.value,(s,i)=>(a(),n("div",{key:i,class:"card rounded-2xl"},[t("div",M,[t("div",{class:h(["flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-xl bg-opacity-10",s.classes])},[t("i",{class:h(["text-2xl",s.icon])},null,2)],2),t("div",N,[t("p",O,e(s.title),1),t("h5",null,e(s.value),1)])])]))),128))]),t("div",V,[r(v,{class:"btn btn-sm btn-primary text-center",href:l.route("user.analytics.index",{refresh:!0})},{default:j(()=>[r(y,{icon:"bx:refresh",class:"text-lg"}),t("span",null,e(l.trans("Refresh Analytics")),1)]),_:1},8,["href"]),t("div",q,[r(P,{options:k})])]),t("div",z,[t("table",S,[t("thead",null,[t("tr",null,[t("th",null,e(l.trans("Platform")),1),t("th",null,e(l.trans("Content")),1),t("th",null,e(l.trans("Publish Date")),1),t("th",null,e(l.trans("Reactions")),1),t("th",null,e(l.trans("Comments")),1)])]),o.posts.total?(a(),n("tbody",G,[(a(!0),n(p,null,_(o.posts.data,s=>{var i,u;return a(),n("tr",{key:s.id},[t("td",null,[t("img",{src:`/assets/svg/${s.platform}.svg`,class:"h-6"},null,8,H)]),t("td",null,[t("div",J,[t("img",{src:((u=(i=s.brand_post)==null?void 0:i.media)==null?void 0:u[0])??"/assets/images/no-photo-available.png",onError:m[0]||(m[0]=w=>w.target.src="/assets/images/no-photo-available.png"),class:"h-8 rounded border"},null,40,K),d(" "+e(f(g)(s.content,50)),1)])]),t("td",null,e(f(C)(s.published_at).format("DD MMM, YYYY h:mm A")),1),t("td",null,[s.platform=="linkedin"?(a(),n("div",Q,e(l.trans("not supported")),1)):(a(),n("span",U,[W,d(" "+e(s.reactions),1)]))]),t("td",null,[s.platform=="linkedin"?(a(),n("div",X,e(l.trans("not supported")),1)):(a(),n("span",Z,[tt,d(" "+e(s.comments),1)]))])])}),128))])):(a(),B($,{key:1,"for-table":"true"}))]),r(A,{links:o.posts.links},null,8,["links"])])])])}}});export{mt as default};
