1import{a5 as O,d6 as $,o as Y,b as c,g as A,w as p,e as R,F as j,m as q,bZ as W,h as _,t as w,bY as J,c as S,r as f,Q as k,ay as Q,G as Z,aC as L,a as H,j as C,I as K,f as D,y as I,v as T,e4 as X,U as P,Y as F,a3 as ee,J as te,D as ae,B as se,C as ne,aW as oe,aL as re,V as ue}from"./index-DUWew8AW.js";import{L as le}from"./LeadResource-DbbuwAFO.js";const ie={__name:"DashboardTabsNavigation",setup(G){const u=O(),{isSEO:V,isSEM:o,isSocial:h,isFulfillment:g,isAccountManagement:r,isProgrammatic:d,isDepartmentManager:b}=$(),{can:l}=Q(),U=f(0);function B(t){var x;const n=u.hasRoute(t)?(x=u.resolve({name:t}).meta)==null?void 0:x.requiredPermission:void 0;if(!n)return!0;const[e,v]=n.split("#");return l(v,e)}const y=S(()=>{const t=[],n=k.getters["authorization/isEmployee"],e=k.getters["authorization/currentUserDepartmentIds"],v=e.length===1&&V(e[0]);return n&&t.push({name:"Alerts",route:"dashboard.alerts"}),!v&&!e.some(o)&&!e.some(h)&&t.push({name:"General",route:"dashboard.index"}),e.some(g)&&!e.some(o)&&!e.some(h)&&t.push({name:"Pacing",route:"dashboard.pacing"}),e.some(r)&&t.push({name:"Account Management",route:"dashboard.account-management"}),e.some(o)&&t.push({name:"SEM",route:"dashboard.sem"}),(e.some(r)||e.some(o))&&t.push({name:"SEM Budget Insights",route:"dashboard.sem-budget-insights"}),e.some(h)&&t.push({name:"Social",route:"dashboard.social"}),e.some(d)&&t.push({name:"Programmatic",route:"dashboard.programmatic"}),e.some(V)&&(t.push({name:"SEO",route:"dashboard.seo"}),t.push({name:"SEO Strategies",route:"dashboard.seo-strategies"})),e.some(b)&&t.push({name:"Team",route:"dashboard.team"}),e.some(r)&&t.push({name:"Monthly Deliverables",route:"dashboard.monthly-deliverables"}),k.getters["authorization/isClientUser"]&&t.push({name:"SEM Budget Insights",route:"dashboard.sem-budget-insights-client-view"}),t.filter(E=>B(E.route))});function M(t){u.currentRoute.value.name!==t.route&&u.push({name:t.route})}return Y(()=>{const t=u.currentRoute.value.name,n=y.value.findIndex(e=>e.route===t);if(n===-1&&t==="dashboard.index"&&y.value.length){u.replace({name:y.value[0].route});return}U.value=n}),(t,n)=>(c(),A(J,{modelValue:U.value,"onUpdate:modelValue":n[0]||(n[0]=e=>U.value=e),"show-arrows":"",color:"white",class:"px-2"},{default:p(()=>[(c(!0),R(j,null,q(y.value,e=>(c(),A(W,{onClick:v=>M(e),key:e.name,class:"min-w-0"},{default:p(()=>[_(w(e.name),1)]),_:2},1032,["onClick"]))),128))]),_:1},8,["modelValue"]))}},ce={key:0},de={key:0},me={class:"profile-content"},he={__name:"Dashboard",setup(G){const u=O(),{isNotPDFUser:V}=X(),o=f(null),h=f([]),g=f(null),r=f(!1),d=f(null),b=f([]),l=S(()=>k.getters["authorization/currentUser"]),U=S(()=>{var a,s;return((s=(a=l.value)==null?void 0:a.UserType)==null?void 0:s.name)==="Employee"}),B=S(()=>{var a;return(a=l.value)==null?void 0:a.fullName}),y=S(()=>{var a;return((a=o.value)==null?void 0:a.length)||0}),M=S(()=>F.sumBy(o.value||[],"activeBudget"));function t(a){u.push({name:a})}async function n(a=null){var s;await P.getAuthorizedClients((s=l.value)==null?void 0:s.id,a).then(m=>{h.value=m.data.clients,k.dispatch("authorization/setClients",m.data)})}async function e(){if(!l.value)return;const a=await P.getAdditionalSupportClients(l.value.id).then(i=>i.data),s=a.map(i=>i.id),m=[];o.value=F.sortBy(h.value.filter(i=>{var N;return s.includes(i.id)?((N=i.ClientUsers)==null?void 0:N.some(z=>z.userId===l.value.id&&z.clientUserTypeId===1))?(m.push(i.id),!0):!1:!0}),"name"),g.value=a.filter(i=>!m.includes(i.id))}async function v(){await n(),await e()}async function x(){var s;const a=(s=l.value)==null?void 0:s.id;a&&await le.getUserLeads(a).then(m=>{b.value=m.data})}async function E(){r.value=!1,await v(),r.value=!0}return Z(l,async a=>{d.value&&a&&d.value.abort(),o.value=null,g.value=null,V.value&&(r.value=!1,await v(),r.value=!0)}),Y(async()=>{L.on("getAllClients",E);try{V.value&&(d.value=new AbortController,await n(d.value.signal),await e(),d.value=null),r.value=!0,await x()}catch{r.value=!0}}),H(()=>{d.value&&d.value.abort(),L.off("getAllClients",E)}),(a,s)=>{const m=ee("RouterView");return c(),R("section",null,[C(K,{tile:"",flat:"",class:"border-none"},{default:p(()=>[C(te,{color:"primary",height:"150",flat:""},{extension:p(()=>[(c(),A(ie,{key:I(u).currentRoute.value.name}))]),default:p(()=>[C(ae,{class:"px-6"},{default:p(()=>[C(se,null,{default:p(()=>[C(ne,{xs:12,lg:7,cols:12},{default:p(()=>[s[3]||(s[3]=D("h3",null,"Dashboard",-1)),r.value?(c(),R("p",ce,[_(" Welcome, "+w(B.value||"")+"! ",1),U.value?(c(),R("span",de,[_(" You manage "+w(y.value)+" clients and ",1),D("strong",null,w(I(oe)(M.value)),1),s[1]||(s[1]=_(" in total monthly revenue. ",-1))])):T("",!0)])):(c(),A(re,{key:1,type:"sentences"})),b.value.length>0?(c(),R("p",{key:2,onClick:s[0]||(s[0]=i=>t("leads.index")),class:"cursor-pointer items-center inline"},[C(ue,{class:"animate-pulse",color:"error"},{default:p(()=>[...s[2]||(s[2]=[_("fa fa-exclamation-triangle",-1)])]),_:1}),_(" You have "+w(b.value.length)+" opportunit"+w(b.value.length>1?"ies":"y")+' assigned to you. Click here to visit "Opportunities" page for details. ',1)])):T("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),D("section",me,[o.value&&g.value?(c(),A(m,{key:I(u).currentRoute.value.name,myClients:o.value,additionalSupp
1ortClients:g.value},null,8,["myClients","additionalSupportClients"])):T("",!0)])])}}};export{he as default};
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.