1import{n as w,r as u,c as C,d as o,j as A,o as U,ah as W,l as G,bm as P,L as F,z as H,R as E,F as V,E as X,q as z,w as j,I as J,aJ as R,Z}from"./index-C3PRlZvS.js";import{C as K}from"./ClientUserTypeResource-ClIkkToe.js";import{P as B}from"./PageHeader-PLupPr9R.js";import{C as N}from"./ClientLink-CuuBmMiC.js";import{m as O}from"./minMax-DTTmkLd-.js";import{i as Q}from"./interactionBody-CdF1MRHC.js";import{i as tt}from"./isBetween-BuJE6P9G.js";const et={__name:"ClientsWithoutInteractions",props:["date","users","interactionTypes"],setup(_){const t=_,e=u([]),a=u(7),s=[{text:"3+ Days",value:3},{text:"5+ Days",value:5},{text:"7+ Days",value:7},{text:"15+ Days",value:15}],n=u(0),i=u(!1),r=[{text:"Client",value:"name"},{text:"Account Manager",value:"accountManager"},{text:"Last Interaction Date",value:"lastInteractionDate"}],g=C(()=>o(t.date).startOf("month").format("YYYY-MM-DD")===o().startOf("month").format("YYYY-MM-DD")),d=C(()=>[{id:0,name:"All Types"}].concat(t.interactionTypes)),f=C(()=>{const h=e.value.map(y=>{var c;let m=y.interactions.filter(l=>n.value===0?!0:l.interactionTypeId===n.value);const v=A.maxBy(m,"publishedAt");y.lastInteractionDate=v?o(v.publishedAt).format("MM/DD/YYYY"):"N/A",m=m.filter(l=>g.value?o(l.publishedAt).isAfter(o().subtract(a.value,"day")):!0),y.alert=m.length===0;const p=((c=y.ClientUsers.find(l=>l.clientUserTypeId===1))==null?void 0:c.user)||null;return y.accountManager=p?p.fullName:"Not assigned",y}).filter(y=>y.alert);return A.orderBy(h,["name"],["asc"])});async function D(){i.value=!0,e.value=[],e.value=await W.getInteractionsActivityReport(t.date,!0).then(h=>h.data),i.value=!1}function k(h){return h.alert?"activityAlert":""}return U(async()=>{await D()}),{__sfc:!0,props:t,clients:e,days:a,options:s,interactionTypeId:n,loading:i,headers:r,isCurrentMonth:g,allInteractionTypes:d,formattedClients:f,fetchData:D,rowClass:k,ClientLink:N}}};var at=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("section",[e("v-container",[e("v-row",{},[e("v-col",{attrs:{lg:"12",md:"12"}},[e("v-card",{attrs:{flat:""}},[e("v-toolbar",{attrs:{flat:""}},[e("v-toolbar-title",[e("div",{staticClass:"text-lg-h4 font-weight-bold flex items-center"},[e("span",[t._v("Clients Without Interactions")]),a.isCurrentMonth?e("v-select",{staticClass:"w-40 ml-2",attrs:{items:a.options,"hide-details":"",filled:""},model:{value:a.days,callback:function(s){a.days=s},expression:"days"}}):t._e()],1)]),e("v-spacer"),e("div",[e("v-autocomplete",{attrs:{items:a.allInteractionTypes,"item-value":"id","item-text":"name",label:"Interaction Type","hide-details":"",filled:""},model:{value:a.interactionTypeId,callback:function(s){a.interactionTypeId=s},expression:"interactionTypeId"}})],1)],1)],1)],1)],1),e("v-divider"),e("v-row",{staticClass:"ps-1"},[e("v-col",{staticClass:"mb-2",attrs:{lg:"12",md:"12"}},[e("v-card",{staticClass:"p-6 elevation-custom"},[e("v-data-table",{attrs:{loading:a.loading,items:a.formattedClients,headers:a.headers,"item-class":a.rowClass,"hide-default-footer":"","disable-pagination":""},scopedSlots:t._u([{key:"item.name",fn:function({item:s}){return[e(a.ClientLink,{key:`client-${s.name}`,attrs:{client:s}})]}}])})],1)],1)],1)],1)],1)},st=[],nt=w(et,at,st,!1,null,null);const ot=nt.exports,rt={__name:"ClientsWithoutLogsTable",props:["items","loading","date","message","typeId"],setup(_){const t=_;o.extend(G);const e=[{text:"Client",value:"name"},{text:"User",value:"user"},{text:"Last Note Created",value:"logDate",sortable:!1}];function a(i){return i.lastLog===null||i.daysSince>14?"bg-red-300":null}function s(i){return i?`Last log created/associated for this client: ${i}`:"No log created for the selected month"}function n(i){const r=i[`last_activity_by_type_${t.typeId}`];return r?o(r.logged_at).format("LL"):"No log created"}return{__sfc:!0,props:t,headers:e,rowClass:a,showTime:s,showLastActivity:n,ClientLink:N}}};var lt=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("div",[e("v-data-table",{staticClass:"clients-without-logs",attrs:{"disable-pagination":!0,"no-data-text":t.message?t.message:"$vuetify.noD
1ataText","hide-default-footer":!0,headers:a.headers,loading:t.loading,items:t.items,"item-class":a.rowClass},scopedSlots:t._u([{key:"item.name",fn:function({item:s}){return[e(a.ClientLink,{key:`client-${s.name}`,attrs:{client:s}})]}},{key:"item.logDate",fn:function({item:s}){return[e("v-tooltip",{attrs:{left:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e("p",t._g({},n),[t._v(" "+t._s(a.showLastActivity(s))+" ")])]}}],null,!0)},[e("span",[t._v(t._s(a.showTime(s.logDate)))])])]}}])})],1)},it=[],ct=w(rt,lt,it,!1,null,null);const ut=ct.exports,dt={__name:"ClientsWithoutLogsIndex",props:["data","loading","typeId","activityTypes","date"],setup(_){const t=_;o.extend(G),o.extend(O);const e=u(0),a=u(!0),s=u(!0);function n(d){e.value=0;const{checkLastXDays:f,departmentId:D}=t.activityTypes.find(v=>v.id===t.typeId),k=d.map(v=>{const p={...v},c=v.ClientUsers.find(T=>T.ClientUserType.defaultActivityTypeId===t.typeId);c&&c.user?p.user=c.user.fullName:p.user="-";let l=v.activities[t.typeId].map(T=>o(T.loggedAt));return s.value&&(l=l.filter(T=>T.isSame(o(t.date),"month"))),l.length>0?(p.lastLog=o.max(l).format("MM/DD/YYYY"),p.lastLogFormatted=o.max(l).format("LLL"),p.logDate=o.max(l).format("LLL"),p.daysSince=o().diff(o(p.lastLog),"day")):(p.lastLog=null,p.logDate=null,p.daysSince=null),p}),h=[],y=[],m=v=>v.sort((p,c)=>p.lastLog===null?c.lastLog===null?0:1:c.lastLog===null?-1:!p.daysSince||!c.daysSince?p.daysSince-c.daysSince:c.daysSince-p.daysSince);for(const v of k)typeof v.daysSince=="number"&&v.daysSince<=f&&v.user!=="-"&&(D===4||v.budget[D]>0)&&h.push(v),(v.daysSince>f||v.lastLog===null)&&v.user!=="-"&&(D===4||v.budget[D]>0)&&y.push(v);return e.value=y.length,a.value?[...m(y),...m(h)]:m(y)}const i=C(()=>t.data.length>0&&t.typeId?n(t.data):[]),r=C(()=>t.typeId?null:"Please choose an Activity Type "),g=C(()=>t.typeId?t.activityTypes.find(d=>d.id===t.typeId).checkLastXDays:0);return{__sfc:!0,props:t,totalClientsWithoutLog:e,selectAll:a,selectedMonthOnly:s,formatItems:n,formattedItems:i,message:r,lastXDays:g,ClientsWithoutLogsTable:ut}}};var vt=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("section",{staticClass:"reports"},[e("v-container",[e("v-row",{},[e("v-col",{attrs:{lg:"12",md:"12"}},[e("v-card",{attrs:{flat:""}},[e("v-toolbar",{attrs:{flat:""}},[e("v-toolbar-title",[e("span",{staticClass:"text-lg-h4 font-weight-bold"},[t._v(" Clients Without Logs "+t._s(a.lastXDays)+"+ Days ")])]),e("v-spacer"),e("span",{staticClass:"text-lg-h5 font-weight-bold"},[t._v(" Total Clients w/o Log: "+t._s(a.totalClientsWithoutLog)+" ")])],1)],1)],1)],1),e("v-divider"),e("v-row",{staticClass:"ps-1"},[e("v-col",{staticClass:"mb-2",attrs:{lg:"12",md:"12"}},[e("v-card",{staticClass:"pa-1 elevation-custom"},[e("div",{staticClass:"p-3 flex items-center space-x-4"},[e("v-checkbox",{attrs:{color:"primary"},scopedSlots:t._u([{key:"label",fn:function(){return[t._v(" Include Clients with Logs "),e("small",[t._v("(At the bottom of the list)")])]},proxy:!0}]),model:{value:a.selectAll,callback:function(s){a.selectAll=s},expression:"selectAll"}}),e("v-checkbox",{attrs:{color:"primary"},scopedSlots:t._u([{key:"label",fn:function(){return[e("v-tooltip",{attrs:{bottom:""},scopedSlots:t._u([{key:"activator",fn:function({on:s}){return[e("p",t._g({staticClass:"pt-3"},s),[t._v("Include Logs from Selected Month Only")])]}}])},[e("span",[t._v(" If unchecked, logs in last 15 days will be included even if they are not from the selected month. ")])])]},proxy:!0}]),model:{value:a.selectedMonthOnly,callback:function(s){a.selectedMonthOnly=s},expression:"selectedMonthOnly"}})],1),e(a.ClientsWithoutLogsTable,{attrs:{typeId:t.typeId,items:a.formattedItems,loading:t.loading,message:a.message}})],1)],1)],1)],1)],1)},ft=[],pt=w(dt,vt,ft,!1,null,null);const mt=pt.exports,_t={__name:"InteractionsDialog",props:{interactions:{type:Array,required:!0},showClient:{type:Boolean,required:!1,default:!1}},emits:["close"],setup(_,{emit:t}){const e=_,a=C(()=>{const r=[];return e.showClient&&r.push({text:"Client",value:"client.name"}),r.concat([{text:"Published At",value:"publishedAt",width:175},{text:"User",value:"user"}
1,{text:"Type",value:"interactionType.name"},{text:"Interaction",value:"body"}])}),s=C(()=>e.interactions.map(r=>({...r,key:`${r.clientId}-${r.id}`})));function n(){t("close")}function i(r){return`${o(r).format("MMMM DD,YYYY")} at ${o(r).format("h:mm a")}`}return{__sfc:!0,props:e,emit:t,headers:a,computedInteractions:s,closeDialog:n,showTime:i,interactionBodyHtml:Q}}};var gt=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("v-card",{staticClass:"p-6"},[e("v-data-table",{attrs:{"disable-pagination":!0,"hide-default-footer":!0,"sort-by":["publishedAt"],"sort-desc":[!0],"fixed-header":"",headers:a.headers,items:a.computedInteractions,"item-key":"key"},scopedSlots:t._u([{key:"item.publishedAt",fn:function({item:s}){return[e("v-tooltip",{attrs:{left:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e("p",t._g({},n),[t._v(" "+t._s(s.publishedAt)+" ")])]}}],null,!0)},[e("span",[t._v(t._s(a.showTime(s.publishedAt)))])])]}},{key:"item.user",fn:function({item:s}){return[t._v(" "+t._s(s.user.fullName)+" ")]}},{key:"item.body",fn:function({item:s}){return[e("div",{staticClass:"ql-snow"},[e("div",{staticClass:"ql-editor ql-readonly",domProps:{innerHTML:t._s(a.interactionBodyHtml(s.body))}})])]}}])}),e("v-card-actions",[e("v-spacer"),e("v-btn",{on:{click:a.closeDialog}},[t._v("Close")])],1)],1)},yt=[],ht=w(_t,gt,yt,!1,null,null);const q=ht.exports,Dt={__name:"OverviewTable",props:["date","items","loading","headers","baseHeaders","serviceGroup"],setup(_){const t=_;o.extend(P);const e=u(!1),a=u(!1),s=u(!1),n=u({}),i=u([]),r=u([]),g=C(()=>{let m=[];return t.serviceGroup==="SEM"||t.serviceGroup==="SEO"?m=t.headers.filter(v=>v.text.includes(t.serviceGroup)):t.serviceGroup==="Premium Video"||t.serviceGroup==="Premium Display"?m=t.headers.filter(v=>v.text.includes("Video")):t.serviceGroup==="Connected TV / OTT"?m=t.headers.filter(v=>v.text.includes("CTV")):t.serviceGroup==="Social Media"&&(m=t.headers.filter(v=>v.text.includes("Social"))),m.length>0?t.baseHeaders.concat(m):t.headers});function d(m,v){i.value=m.activities[v].filter(p=>o(p.loggedAt).format("YYYY-MM")===t.date).map(p=>(p.createdDate=o(p.createdAt).from(o()),p)),a.value=!0}function f(m){r.value=m.interactions,s.value=!0}function D(m){n.value=m,e.value=!0}function k(){e.value=!1,a.value=!1,n.value={},i.value=[]}function h(){r.value=[],s.value=!1}function y(m){return`${o(m).format("MMMM DD,YYYY")} at ${o(m).format("h:mm a")}`}return{__sfc:!0,props:t,teamDialog:e,notesDialog:a,interactionsDialog:s,selectedClient:n,selectedNotes:i,selectedInteractions:r,filteredHeaders:g,showNotesDialog:d,showInteractionsDialog:f,showTeamDialog:D,closeDialog:k,closeInteractionsDialog:h,showTime:y,formatDate:H,downloadSecureAsset:F,ClientLink:N,InteractionsDialog:q}}};var xt=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("div",[e("v-data-table",{attrs:{"disable-pagination":!0,"hide-default-footer":!0,headers:a.filteredHeaders,loading:t.loading,items:t.items},scopedSlots:t._u([t._l(t.headers,function(s,n){return{key:`item.${s.value}`,fn:function({item:i}){return[s.value==="name"?[e(a.ClientLink,{key:`client-${n}`,staticClass:"fit",attrs:{client:i}})]:s.value==="users"?[e("v-btn",{key:n,attrs:{icon:""},on:{click:function(r){return a.showTeamDialog(i)}}},[e("v-icon",{attrs:{small:""}},[t._v("fas fa-eye")])],1)]:s.value==="totalInteractions"?[e("v-btn",{key:`${n}-interactions`,attrs:{text:""},on:{click:function(r){return a.showInteractionsDialog(i)}}},[t._v(" "+t._s(i[s.value])+" ")])]:s.value==="lastInteractionDate"?[t._v(" "+t._s(i.lastInteractionDate)+" ")]:s.isDays?[e("span",{key:`isDay-${n}`,staticClass:"fit"},[t._v(t._s(i[s.day]))])]:s.isTotal?[e("v-btn",{key:n,attrs:{text:""},on:{click:function(r){return a.showNotesDialog(i,s.typeId)}}},[t._v(" "+t._s(i[s.value])+" ")])]:t._e()]}}})],null,!0)}),e("v-dialog",{attrs:{"max-width":"700"},model:{value:a.teamDialog,callback:function(s){a.teamDialog=s},expression:"teamDialog"}},[e("v-card",[a.selectedClient.ClientUsers?e("v-simple-table",{scopedSlots:t._u([{key:"default",fn:function(){return[e("thead",[e("tr",[e("th",{staticClass:"text-left"},[e("h5",[t._v("Name")])]),e("th",{staticClass:"text-left"}
1,[e("h5",[t._v("Role")])])])]),e("tbody",t._l(a.selectedClient.ClientUsers,function(s){var n;return e("tr",{key:s.id},[e("td",[e("span",{staticClass:"mb-2"},[t._v(t._s((n=s.user)==null?void 0:n.fullName))])]),e("td",[e("span",{staticClass:"mb-2"},[t._v(t._s(s.ClientUserType.name))])])])}),0)]},proxy:!0}],null,!1,775281503)}):t._e(),e("v-card-actions",[e("v-spacer"),e("v-btn",{on:{click:a.closeDialog}},[t._v("Close")])],1)],1)],1),e("v-dialog",{attrs:{"max-width":"1000"},model:{value:a.notesDialog,callback:function(s){a.notesDialog=s},expression:"notesDialog"}},[e("v-card",{staticClass:"py-3"},[e("v-data-table",{attrs:{height:"650","disable-pagination":!0,"hide-default-footer":!0,"sort-by":["loggedAt"],"sort-desc":[!0],"fixed-header":"",headers:[{text:"Date",value:"loggedAt",width:130},{text:"Category",value:"category"},{text:"Created",value:"createdAt"},{text:"Notes",value:"body"}],items:a.selectedNotes},scopedSlots:t._u([{key:"item.loggedAt",fn:function({item:s}){return[e("v-tooltip",{attrs:{left:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e("p",t._g({},n),[t._v(" "+t._s(a.formatDate(s.loggedAt,"YYYY-MM-DD"))+" ")])]}}],null,!0)},[e("span",[t._v(t._s(a.showTime(s.loggedAt)))])])]}},{key:"item.category",fn:function({item:s}){return[t._v(" "+t._s(s.ClientActivityCategory.name)+" ")]}},{key:"item.createdAt",fn:function({item:s}){return[e("v-tooltip",{attrs:{left:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e("p",t._g({},n),[t._v(" "+t._s(s.createdDate)+" ")])]}}],null,!0)},[e("span",[t._v(t._s(a.showTime(s.createdAt)))])])]}},{key:"item.body",fn:function({item:s}){return[e("div",{domProps:{innerHTML:t._s(s.body)}}),s.attachments.length>0?[e("br"),e("v-chip-group",t._l(s.attachments,function(n){return e("v-chip",{key:n.id,staticClass:"px-5",attrs:{color:"primary","text-color":"white"},on:{click:function(i){return a.downloadSecureAsset(n)}}},[e("v-icon",{attrs:{left:"",small:""}},[t._v("fas fa-download")]),t._v(" "+t._s(n.label||n.filename)+" ")],1)}),1)]:t._e()]}}])}),e("v-card-actions",[e("v-spacer"),e("v-btn",{on:{click:a.closeDialog}},[t._v("Close")])],1)],1)],1),e("v-dialog",{attrs:{"max-width":"1000"},model:{value:a.interactionsDialog,callback:function(s){a.interactionsDialog=s},expression:"interactionsDialog"}},[e(a.InteractionsDialog,{attrs:{interactions:a.selectedInteractions},on:{close:a.closeInteractionsDialog}})],1)],1)},It=[],bt=w(Dt,xt,It,!1,null,null);const Ct=bt.exports,Tt={__name:"OverviewIndex",props:["date","data","loading","activityTypes"],setup(_){const t=_;o.extend(P);const e=[{text:"Client",value:"name"},{text:"Users",value:"users",sortable:!1}],a=u("All"),s=u([]),n=C(()=>{const g=o();let{data:d}=t;return a.value!=="All"&&(d=d.filter(f=>f.budgets.find(D=>{var k,h;return((h=(k=D==null?void 0:D.Service)==null?void 0:k.serviceGroup)==null?void 0:h.name)===a.value}))),d.map(f=>(t.activityTypes.forEach(D=>{const k=f.activities[D.id]||[],h=f[`last_activity_by_type_${D.id}`];if(h){const y=o(h.logged_at);f[`last${D.id}`]=y.from(g),f[`date${D.id}`]=y.format("YYYY-MM-DD")}else f[`date${D.id}`]="Never",f[`last${D.id}`]="Never";f[`total${D.id}`]=k.filter(y=>o(y.loggedAt).format("YYYY-MM")===o(t.date).format("YYYY-MM")).length}),f.totalInteractions=f.interactions.length,f.lastInteractionDate=f.lastInteraction?o(f.lastInteraction.published_at).format("MM/DD/YYYY"):"Never",f))}),i=C(()=>{const g=[...e];return g.push({text:"Last Interaction",value:"lastInteractionDate"}),t.activityTypes.length>0&&(t.activityTypes.forEach(d=>{g.push({text:`Last ${d.name}`,value:`date${d.id}`,day:`last${d.id}`,isDays:!0})}),g.push({text:"Total Interactions",value:"totalInteractions"}),t.activityTypes.forEach(d=>{g.push({text:`Total ${d.name} Notes`,value:`total${d.id}`,isTotal:!0,typeId:d.id})})),g});async function r(){const g=await E.getServiceGroupList(!1).then(d=>d.data);s.value.push("All"),g.forEach(d=>{s.value.push(d.name)})}return r(),{__sfc:!0,props:t,headers:e,serviceGroup:a,serviceGroups:s,formattedItems:n,computedHeaders:i,getServiceGroups:r,PageHeader:B,OverviewTable:Ct}}};var kt=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("section",{staticClass:"reports"},[e("v-container",[e(a.PageHeader,{attrs:{"sub-header":""},scopedSlots:t._u([{key:"right",fn:function(){return[e("v-select",{attrs:{label:"Service Group",items:a.serviceGroups,filled:"","hide-details":""},model:{value:a.serviceGroup,callback:function(s){a.serviceGroup=s},expression:"serviceGroup"}})]},proxy:!0}])},[t._v(" Client Activity Report (MTD) ")]),e("v-divider"),e("v-row",{staticClass:"ps-1"},[e("v-col",{staticClass:"mb-2",attrs:{lg:"12",md:"12"}},[e("v-card",{staticClass:"pa-1 elevation-custom"},[e(a.OverviewTable,{attrs:{date:t.date,headers:a.computedHeaders,"base-headers":a.headers,items:a.formattedItems,serviceGroup:a.serviceGroup,loading:t.loading}})],1)],1)],1)],1)],1)},Mt=[],wt=w(Tt,kt,Mt,!1,null,null);const Yt=wt.exports,At={__name:"ClientDialog",props:["user"],emits:["close"],setup(_,{emit:t}){const e=_,a=C(()=>{var n;return((n=e.user)==null?void 0:n.clients.map(i=>{const r=e.user.interactions.filter(g=>g.clientId===i.id);return{clientName:i.name,lastInteractionDate:r.length>0?o(A.maxBy(r,"publishedAt").publishedAt).format("MM/DD/YYYY"):"Never"}}))||[]});function s(){t("close")}return{__sfc:!0,props:e,emit:t,clients:a,closeDialog:s}}};var $t=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("v-card",{staticClass:"p-6"},[e("v-data-table",{attrs:{"disable-pagination":!0,"hide-default-footer":!0,"sort-by":["name"],"sort-desc":[!0],"fixed-header":"",headers:[{text:"Client",value:"clientName"},{text:"Last Interaction",value:"lastInteractionDate"}],items:a.clients}}),e("v-card-actions",[e("v-spacer"),e("v-btn",{on:{click:a.closeDialog}},[t._v("Close")])],1)],1)},Lt=[],St=w(At,$t,Lt,!1,null,null);const Rt=St.exports,Pt={__name:"UserInteractionsPerformance",props:["date","interactionTypes","userTypes"],setup(_){const t=_,e=u(!1),a=u([]),s=[{text:"User",value:"fullName"},{text:"# of Clients",value:"numberOfClients",align:"center"},{text:"Total Interactions",value:"totalInteractions",align:"center"},{text:"Avg. Interactions",value:"avgInteractions",align:"center"},{text:"Last Interaction Date",value:"lastInteractionDate"}],n=u(0),i=u(1),r=u(!1),g=u(!1),d=u(null),f=u([]),D=C(()=>[{id:0,name:"All Types"}].concat(t.interactionTypes)),k=C(()=>[{id:0,name:"All Users"}].concat(t.userTypes)),h=C(()=>o(t.date).startOf("month").format("YYYY-MM-DD")===o().startOf("month").format("YYYY-MM-DD")),y=C(()=>{let x=A.cloneDeep(a.value);return i.value>0&&(x=x.filter(I=>I.userTypeIds.includes(i.value))),x.map(I=>{let M=I.interactions;n.value>0&&(M=M.filter(L=>L.interactionTypeId===n.value)),i.value>0&&(I.clients=I.clients.filter(L=>L.ClientUsers.find(S=>S.clientUserTypeId===i.value&&S.userId===I.id))),I.interactions=M,I.numberOfClients=I.clients.length,I.totalInteractions=I.interactions.length,I.avgInteractions=A.round(I.totalInteractions/(I.numberOfClients||1),1);const Y=A.maxBy(I.interactions,"publishedAt");return I.lastInteractionDate=Y?o(Y.publishedAt).format("MM/DD/YYYY"):"Never",I.daysSinceLastInteraction=Y?o().diff(Y.publishedAt,"day"):0,I})});async function m(){e.value=!0,a.value=[],a.value=await W.getUserInteractionPerformanceReport(t.date).then(x=>x.data),e.value=!1}function v(x){return x.lastInteractionDate==="Never"||h.value&&x.daysSince>14?"activityAlert":""}function p(x){d.value=x,r.value=!0}function c(){d.value=null,r.value=!1}function l(x){f.value=x.interactions,g.value=!0}function T(){f.value=[],g.value=!1}return U(async()=>{await m()}),{__sfc:!0,props:t,loading:e,users:a,headers:s,interactionTypeId:n,userTypeId:i,clientsDialog:r,interactionsDialog:g,selectedUser:d,selectedInteractions:f,allInteractionTypes:D,allUserTypes:k,isCurrentMonth:h,formattedUsers:y,fetchData:m,rowClass:v,showClientsDialog:p,closeClientsDialog:c,showInteractionsDialog:l,closeInteractionsDialog:T,InteractionsDialog:q,ClientDialog:Rt}}};var Nt=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("section",[e("v-container",[e("v-row",{},[e("v-col",{attrs:{lg:"12",md:"12"}},[e("v-card",{attrs:{flat:""}},[e("v-toolbar",{attrs:{flat:""}},[e("v-toolbar-title",[e("div",{staticClass:"text-lg-h4 font-weight-bold flex items-center"},[e("span",[t._v("User Performance (By Interactions)")])])]),e("v-spacer"),e("div",{staticClass:"flex items-center"},[e("v-autocomplete",{attrs:{items:a.allUserTypes,"item-value":"id","item-text":"name",label:"User Type","hide-details":"",filled:""},model:{value:a.userTypeId,callback:function(s){a.userTypeId=s},expression:"userTypeId"}}),e("v-autocomplete",{staticClass:"ml-3",attrs:{items:a.allInteractionTypes,"item-value":"id","item-text":"name",label:"Interaction Type","hide-details":"",filled:""},model:{value:a.interactionTypeId,callback:function(s){a.interactionTypeId=s},expression:"interactionTypeId"}})],1)],1)],1)],1)],1),e("v-divider"),e("v-row",{staticClass:"ps-1"},[e("v-col",{staticClass:"mb-2",attrs:{lg:"12",md:"12"}},[e("v-card",{staticClass:"p-6 elevation-custom"},[e("v-data-table",{attrs:{loading:a.loading,items:a.formattedUsers,headers:a.headers,"item-class":a.rowClass,"hide-default-footer":"","disable-pagination":""},scopedSlots:t._u([{key:"item.numberOfClients",fn:function({item:s}){return[e("v-btn",{attrs:{text:""},on:{click:function(n){return a.showClientsDialog(s)}}},[t._v(" "+t._s(s.numberOfClients)+" ")])]}},{key:"item.totalInteractions",fn:function({item:s}){return[e("v-btn",{attrs:{text:""},on:{click:function(n){return a.showInteractionsDialog(s)}}},[t._v(" "+t._s(s.totalInteractions)+" ")])]}}])})],1)],1)],1)],1),e("v-dialog",{attrs:{"max-width":"1000"},model:{value:a.interactionsDialog,callback:function(s){a.interactionsDialog=s},expression:"interactionsDialog"}},[e(a.InteractionsDialog,{attrs:{interactions:a.selectedInteractions,"show-client":!0},on:{close:a.closeInteractionsDialog}})],1),e("v-dialog",{attrs:{"max-width":"1000"},model:{value:a.clientsDialog,callback:function(s){a.clientsDialog=s},expression:"clientsDialog"}},[e(a.ClientDialog,{attrs:{user:a.selectedUser},on:{close:a.closeClientsDialog}})],1)],1)},Ot=[],Ut=w(Pt,Nt,Ot,!1,null,null);const Wt=Ut.exports,Gt={__name:"UserPerformanceTable",props:["items","loading","headers","date","message"],setup(_){const t=_;o.extend(O),o.extend(P);const e=u(!1),a=u(!1),s=u(!1),n=u(null),i=u([]),r=u(null),g=C(()=>n.value?n.value.clients.map(c=>{const l={...c},T=n.value.activities.filter(x=>x.clientId===l.id);if(T.length>0){const x=T.map(Y=>o(Y.createdAt)),I=o.max(x);let M;o(t.date).isSame(o(),"month")?M=o():M=o(t.date).endOf("month"),l.logDate=I.format("MM-DD-YY"),l.lastLog=I.from(M)}else l.logDate="Never",l.lastLog="Never";return l}):[]),d=C(()=>n.value?n.value.activities.map(c=>{const l={...c};l.client?(l.name=l.client.name,l.ClientActivityAssociatedStores.forEac
1h(x=>{const I=i.value.find(M=>M.id===x.clientId);l.name=`${l.name},${I.name}`})):(l.name=i.value.find(x=>x.id===l.clientId).name,l.ClientActivityAssociatedStores.forEach(x=>{const I=i.value.find(M=>M.id===x.clientId);l.name=`${l.name},${I}`}));let T;return o(t.date).isSame(o(),"month")?T=o():T=o(t.date).endOf("month"),l.logDate=o(l.loggedAt).from(T),l.createdDate=o(l.createdAt).from(T),l}):[]),f=C(()=>n.value&&r.value?n.value.reports[r.value].map(c=>{const l={...c},T=i.value.find(x=>x.id===l.clientId);return l.client=T?T.name:"",l.reportMonth=o(l.month).format("MMMM YYYY"),l.date=o(l.month).format("MM-DD-YY"),l}):[]);function D(c){n.value=c,e.value=!0}function k(c){n.value=c,a.value=!0}function h(c,l){n.value=c,r.value=l,s.value=!0}function y(){n.value=null,a.value=!1,s.value=!1,e.value=!1}function m(c){return c.lastLog==="Never"||c.daysSince>14?"bg-red-300":""}function v(c,l){return c!=="Never"?l?`${o(c).format("MMMM DD,YYYY")} at ${o(c).format("h:mm a")}`:`${o(c).format("MMMM DD,YYYY")} at ${o(c).format("h:mm a")}`:c}async function p(){i.value=await X.getClientList({withFields:["id","name"]}).then(c=>c.data)}return p(),{__sfc:!0,props:t,clientsDialog:e,notesDialog:a,reportsDialog:s,dialogItem:n,clients:i,reportType:r,clientItems:g,notesItems:d,reportsItems:f,showClientsDialog:D,showNotesDialog:k,showReportsDialog:h,closeDialog:y,rowClasses:m,showTime:v,init:p,formatDate:H,formatPercentage:V,downloadSecureAsset:F}}};var Ft=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("div",[e("v-data-table",{staticClass:"userPerformance",attrs:{"disable-pagination":!0,"hide-default-footer":!0,headers:t.headers,"no-data-text":t.message?t.message:"No data available",loading:t.loading,items:t.items,"item-class":a.rowClasses},scopedSlots:t._u([{key:"item.user",fn:function({item:s}){return[t._v(t._s(s.fullName))]}},{key:"item.clientTotal",fn:function({item:s}){return[e("v-btn",{attrs:{text:""},on:{click:function(n){return a.showClientsDialog(s)}}},[t._v(" "+t._s(s.clientTotal)+" ")])]}},{key:"item.activityTotal",fn:function({item:s}){return[e("v-btn",{attrs:{text:""},on:{click:function(n){return a.showNotesDialog(s)}}},[t._v(" "+t._s(s.activityTotal)+" ")])]}},{key:"item.midMonthReportsTotal",fn:function({item:s}){return[e("v-btn",{attrs:{text:""},on:{click:function(n){return a.showReportsDialog(s,"midMonthReports")}}},[t._v(" "+t._s(s.midMonthReportsTotal)+" ("+t._s(a.formatPercentage(s.midMonthReportsTotal/s.clientTotal*100))+") ")])]}},{key:"item.endOfMonthReportsTotal",fn:function({item:s}){return[e("v-btn",{attrs:{text:""},on:{click:function(n){return a.showReportsDialog(s,"endOfMonthReports")}}},[t._v(" "+t._s(s.endOfMonthReportsTotal)+" ("+t._s(a.formatPercentage(s.endOfMonthReportsTotal/s.clientTotal*100))+") ")])]}},{key:"item.logDate",fn:function({item:s}){return[e("v-tooltip",{attrs:{left:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e("span",t._g({},n),[t._v(" "+t._s(s.lastLog)+" ")])]}}],null,!0)},[e("span",[t._v(t._s(a.showTime(s.logDate)))])])]}}])}),e("v-dialog",{attrs:{"max-width":"700"},model:{value:a.clientsDialog,callback:function(s){a.clientsDialog=s},expression:"clientsDialog"}},[e("v-card",[e("v-data-table",{attrs:{height:"600","disable-pagination":!0,"hide-default-footer":!0,"fixed-header":"","sort-by":"name",headers:[{text:"Client",value:"name"},{text:"Last Log",value:"logDate"}],items:a.clientItems},scopedSlots:t._u([{key:"item.logDate",fn:function({item:s}){return[e("v-tooltip",{attrs:{left:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e("span",t._g({},n),[t._v(" "+t._s(s.lastLog)+" ")])]}}],null,!0)},[e("span",[t._v(t._s(s.logDate))])])]}}])}),e("v-card-actions",[e("v-spacer"),e("v-btn",{on:{click:a.closeDialog}},[t._v("Close")])],1)],1)],1),e("v-dialog",{attrs:{"max-width":"1000"},model:{value:a.notesDialog,callback:function(s){a.notesDialog=s},expression:"notesDialog"}},[e("v-card",{staticClass:"py-3"},[e("v-data-table",{attrs:{height:"650","disable-pagination":!0,"hide-default-footer":!0,"sort-by":["createdAt"],"item-key":"index","sort-desc":[!0],"fixed-header":"",headers:[{text:"Client",value:"name"},{text:"Date",value:"loggedAt"},{text:"Category",value:"category"},{text:"Created",value:"createdAt"},{text:"Notes",value:"body"}],items:a.notesItems},scopedSlots:t._u([{key:"item.loggedAt",fn:function({item:s}){return[e("v-tooltip",{attrs:{left:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e("span",t._g({},n),[t._v(" "+t._s(s.logDate)+" ")])]}}],null,!0)},[e("span",[t._v(t._s(a.showTime(s.loggedAt,!0)))])])]}},{key:"item.category",fn:function({item:s}){return[t._v(" "+t._s(s.ClientActivityCategory.name)+" ")]}},{key:"item.createdAt",fn:function({item:s}){return[e("v-tooltip",{attrs:{left:""},scopedSlots:t._u([{key:"activator",fn:function({on:n}){return[e("span",t._g({},n),[t._v(" "+t._s(s.createdDate)+" ")])]}}],null,!0)},[e("span",[t._v(t._s(a.showTime(s.createdAt)))])])]}}
1,{key:"item.body",fn:function({item:s}){return[e("div",{domProps:{innerHTML:t._s(s.body)}}),s.attachments.length>0?[e("br"),e("v-chip-group",t._l(s.attachments,function(n){return e("v-chip",{key:n.id,staticClass:"px-5",attrs:{color:"primary","text-color":"white"},on:{click:function(i){return a.downloadSecureAsset(n)}}},[e("v-icon",{attrs:{left:"",small:""}},[t._v("fas fa-download")]),t._v(" "+t._s(n.label||n.filename)+" ")],1)}),1)]:t._e()]}}])}),e("v-card-actions",[e("v-spacer"),e("v-btn",{on:{click:a.closeDialog}},[t._v("Close")])],1)],1)],1),e("v-dialog",{attrs:{"max-width":"60%"},model:{value:a.reportsDialog,callback:function(s){a.reportsDialog=s},expression:"reportsDialog"}},[e("v-card",[e("v-data-table",{attrs:{height:"600","disable-pagination":!0,"hide-default-footer":!0,"sort-by":"createdAt","sort-desc":!0,"fixed-header":"",headers:[{text:"Date Sent",value:"createdAt"},{text:"Client",value:"client"},{text:"Report Month",value:"reportMonth"}],items:a.reportsItems},scopedSlots:t._u([{key:"item.createdAt",fn:function({item:s}){return[t._v(" "+t._s(a.formatDate(s.createdAt,"MMMM DD, YYYY"))+" ")]}}])}),e("v-card-actions",[e("v-spacer"),e("v-btn",{on:{click:a.closeDialog}},[t._v("Close")])],1)],1)],1)],1)},Ht=[],Bt=w(Gt,Ft,Ht,!1,null,null);const qt=Bt.exports,Et={__name:"UserPerformanceIndex",props:["users","loading","date","typeId"],setup(_){const t=_;o.extend(tt),o.extend(O);const e=[{text:"User",value:"user",sortable:!1},{text:"# of Clients",value:"clientTotal"},{text:"Total Notes",value:"activityTotal"},{text:"Avg. Notes",value:"averageNotes"},{text:"Mid Month Reports Sent",value:"midMonthReportsTotal"},{text:"End of Month Reports Sent",value:"endOfMonthReportsTotal"},{text:"Last Note Created",value:"logDate"}];function a(i){return i.map(r=>{r.clientTotal=r.clients.length,r.reports.midMonthReports=A.uniqBy(r.reports.midMonthReports,"clientId"),r.reports.endOfMonthReports=A.uniqBy(r.reports.endOfMonthReports,"clientId"),r.midMonthReportsTotal=r.reports.midMonthReports.length,r.endOfMonthReportsTotal=r.reports.endOfMonthReports.length,r.activityTotal=r.activities.filter(d=>o(d.loggedAt).isBetween(o(t.date).startOf("month").startOf("day").format("YYYY-MM-DD HH:mm"),o(t.date).endOf("month").endOf("day").format("YYYY-MM-DD HH:mm"),null,"[)")).length,r.averageNotes=Math.round(r.activityTotal/r.filteredNumberOfClients*10)/10;const g=r.activities.map(d=>o(d.loggedAt));if(g.length>0){const d=o.max(g);let f;o(t.date).isSame(o(),"month")?f=o():f=o(t.date),r.lastLog=d.format("MM/DD/YYYY"),r.logDate=d,r.daysSince=f.diff(d,"day")}else r.logDate="Never",r.lastLog="Never";return r})}const s=C(()=>t.loading?[]:a(t.users)),n=C(()=>t.typeId?null:"Please choose an Activity Type ");return{__sfc:!0,props:t,headers:e,formatItems:a,formattedItems:s,message:n,UserPerformanceTable:qt}}};var Vt=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("section",{staticClass:"reports"},[e("v-container",[e("v-row",{},[e("v-col",{attrs:{lg:"12",md:"12"}},[e("v-card",{attrs:{flat:""}},[e("v-toolbar",{attrs:{flat:""}},[e("v-toolbar-title",[e("span",{staticClass:"text-lg-h4 font-weight-bold"},[t._v("User Performance (MTD)")])]),e("v-spacer")],1)],1)],1)],1),e("v-divider"),e("v-row",{staticClass:"ps-1"},[e("v-col",{staticClass:"mb-2",attrs:{lg:"12",md:"12"}},[e("v-card",{staticClass:"pa-1 elevation-custom"},[e(a.UserPerformanceTable,{attrs:{headers:a.headers,date:t.date,items:a.formattedItems,loading:t.loading,message:a.message}})],1)],1)],1)],1)],1)},Xt=[],zt=w(Et,Vt,Xt,!1,null,null);const jt=zt.exports,Jt={__name:"ClientActivityReport",setup(_){const{requiredTextRule:t}=z(),e=u({}),a=(b,$)=>{b?e.value[$]=b:delete e.value[$]},s=b=>e.value[b],n=u(0),i=u(!0),r=u(!1),g=u([]),d=u([]),f=u([]),D=u([]),k=u([]),h=u({reportDate:o().format("YYYY-MM"),typeId:null}),y=u([{title:"Overview",component:Yt,key:"overviewIndex"},{title:"User Performance",component:jt,key:"userPerformanceIndex"},{title:"User Perf. (Interactions)",component:Wt,key:"userInteractionsPerformance"},{title:"Clients Without Logs",component:mt,key:"clientsWithoutLogsIndex"},{title:"Clients Without Interactions",component:ot,key:"clientsWithoutInteractions"}]),m=u(!1);function v(b){h.value.reportDate=b,m.value=!1}function p(b){return b==="userPerformanceIndex"}function c(b){return b==="clientsWithoutLogsIndex"}function l(b){return b==="clientsWithoutInteractions"}function T(b){return b==="userInteractionsPerformance"}function x(){g.value=[],D.value=[]}
1async function I(){const{key:b}=y.value[n.value];if(l(b)||T(b)){s(b).fetchData();return}r.value=!0,x(),p(b)?h.value.typeId&&(D.value=await R.getUserPerformance(h.value.reportDate,h.value.typeId).then($=>$.data)):await R.getClientActivityReport(h.value.reportDate,!0).then($=>{g.value=$.data,m.value=!0}),r.value=!1}const M=C(()=>n.value&&(p(y.value[n.value].key)||c(y.value[n.value].key))),Y=C(()=>n.value&&c(y.value[n.value].key)),L=C(()=>!!(r.value||n.value&&p(y.value[n.value].key)&&!h.value.typeId));j(()=>h.value.reportDate,()=>{x()});async function S(){await Promise.all([R.getActivityTypes().then(b=>{d.value=b.data}),Z.getInteractionTypes().then(b=>{f.value=b.data}),K.getUserTypesList().then(b=>{k.value=b.data})])}return S(),{__sfc:!0,requiredTextRule:t,templateRefs:e,setTemplateRef:a,getTemplateRef:s,currentItem:n,valid:i,loading:r,clientReport:g,activityTypes:d,interactionTypes:f,users:D,userTypes:k,filter:h,items:y,hideButton:m,applyReportDate:v,isUserPerformanceReport:p,isClientWithoutLogsReport:c,isClientWithoutInteractionsReport:l,isUserInteractionPerformanceReport:T,resetData:x,fetchInitialData:I,canSelectActivities:M,isClientWithoutLogsTabSelected:Y,buttonDisabled:L,init:S,PageHeader:B,DatePickerField:J}}};var Zt=function(){var t=this,e=t._self._c,a=t._self._setupProxy;return e("section",[e(a.PageHeader,{scopedSlots:t._u([{key:"right",fn:function(){return[e("v-form",{ref:"form",model:{value:a.valid,callback:function(s){a.valid=s},expression:"valid"}},[e("div",{staticClass:"flex flex-col md:flex-row items-center space-x-3 space-y-3 md:space-y-0"},[a.canSelectActivities?e("div",[e("v-autocomplete",{attrs:{outlined:"",items:a.activityTypes,clearable:"",rules:a.requiredTextRule,disabled:a.loading,"item-value":"id","item-text":"name",label:"Activity Type","hide-details":""},model:{value:a.filter.typeId,callback:function(s){t.$set(a.filter,"typeId",s)},expression:"filter.typeId"}})],1):t._e(),e("div",[e(a.DatePickerField,{attrs:{menu:"",value:a.filter.reportDate,type:"month",label:"Select Month",filled:"",rules:a.requiredTextRule,disabled:a.loading,"prepend-inner-icon":"event","hide-details":""},on:{input:a.applyReportDate}})],1),!a.isClientWithoutLogsTabSelected||!a.hideButton?e("div",[e("v-btn",{attrs:{large:"",color:"primary",disabled:a.buttonDisabled},on:{click:function(s){return a.fetchInitialData()}}},[t._v(" Load Report ")])],1):t._e()])])]},proxy:!0}])},[t._v(" Activity Reports ")]),e("v-divider"),e("div",{staticClass:"p-6"},[e("v-tabs",{attrs:{"show-arrows":"","slider-color":"blue"},model:{value:a.currentItem,callback:function(s){a.currentItem=s},expression:"currentItem"}},[t._l(a.items,function(s){return e("v-tab",{key:s.title},[e("span",{staticClass:"text-lg font-weight-bold whitespace-nowrap"},[t._v(t._s(s.title))])])}),e("v-tabs-items",{model:{value:a.currentItem,callback:function(s){a.currentItem=s},expression:"currentItem"}},t._l(a.items,function(s){return e("v-tab-item",{key:s.title,staticClass:"p-1"},[e("v-card",{staticClass:"mt-1"},[e(s.component,{ref:n=>a.setTemplateRef(n,s.key),refInFor:!0,tag:"component",attrs:{date:a.filter.reportDate,typeId:a.filter.typeId,loading:a.loading,data:a.clientReport,activityTypes:a.activityTypes,interactionTypes:a.interactionTypes,users:a.users,"user-types":a.userTypes}})],1)],1)}),1)],2)],1)],1)},Kt=[],Qt=w(Jt,Zt,Kt,!1,null,null);const le=Qt.exports;export{le 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.