1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[9086],{9086:(K,u,r)=>{r.r(u),r.d(u,{SummaryComponent:()=>d});var v=r(4398),y=r(6227),C=r.n(y),f=r(4624),b=r(9844),l=r(316),S=r(6497),I=r(6863),F=r(7269),U=r(9950),p=r(7659),G=r(180),R=r(4133),w=r(2197),h=r(7430);const g=["#42A5F5","#66BB6A","#FFA726","#26C6DA","#7E57C2"],j={plugins:{legend:{labels:{color:"#495057"}}},scales:{x:{ticks:{color:"#495057"},grid:{color:"#ebedef"}},y:{ticks:{color:"#495057"},grid:{color:"#ebedef"}}}},O={plugins:{legend:{labels:{color:"#495057"}}}};var T=r(8981),t=r(8559),$=r(3664),x=r(565),E=r(251);const Y=()=>({label:"Dashboard"}),M=()=>({label:"Summary"}),A=(n,a)=>[n,a];function k(n,a){1&n&&(t.j41(0,"h5",12),t.EFF(1,"Users per Acquisition source"),t.k0s())}function J(n,a){1&n&&(t.j41(0,"div",13),t.nrm(1,"span",14),t.k0s())}function P(n,a){if(1&n&&(t.j41(0,"div",17)(1,"div",18)(2,"div")(3,"h5",19),t.EFF(4),t.nI1(5,"titlecase"),t.k0s(),t.j41(6,"p",19),t.EFF(7),t.k0s()(),t.j41(8,"div"),t.nrm(9,"i"),t.k0s()()()),2&n){const e=a.$implicit;t.R7$(4),t.JRh(t.bMT(5,5,e.heading)),t.R7$(3),t.JRh(e.key),t.R7$(2),t.ZvI("",e.icon," fs-5")}}function V(n,a){if(1&n&&(t.j41(0,"div",15),t.DNE(1,P,10,7,"div",16),t.k0s()),2&n){const e=t.XpG();t.R7$(),t.Y8G("ngForOf",e.activities)}}function X(n,a){if(1&n&&(t.j41(0,"div",20)(1,"div",21)(2,"div",22),t.nrm(3,"p-chart",23),t.k0s()()()),2&n){const e=t.XpG();t.R7$(3),t.Y8G("data",e.userSummaryPerUtmChannel)("options",e.doughnutChartOptions)("responsive",!0)("height",e.doughnutChartHeight)}}function B(n,a){1&n&&(t.j41(0,"h5",12),t.EFF(1,"Overall User Growth"),t.k0s())}function N(n,a){1&n&&(t.j41(0,"div",13),t.nrm(1,"span",14),t.k0s())}function L(n,a){if(1&n&&(t.j41(0,"div",24)(1,"div",25)(2,"div",26)(3,"div",27),t.nrm(4,"p-chart",28),t.k0s()(),t.j41(5,"div",26)(6,"div",27),t.nrm(7,"p-chart",28),t.k0s()()()()),2&n){const e=t.XpG();t.R7$(4),t.Y8G("data",e.monthlyUserGrowth)("options",e.barChartOptions),t.R7$(3),t.Y8G("data",e.overallUserGrowth)("options",e.barChartOptions)}}class d extends I.v{constructor(a,e,s,i,o){super(e,a),this.authService=a,this.deviceService=e,this.adminService=s,this.toastService=i,this.datePipe=o,this.activities=[],this.filtered={},this.ploading=!0,this.cloading=!0,this.barChartOptions=j,this.doughnutChartOptions=O,this.filters=[{label:"Stylist",filterType:h.RJ.dropdown,data:[],displayKey:"stylist_name",filterKey:"stylist_id",filterId:"stylist"},{label:"Joined After",filterType:h.RJ.datepicker,filterId:"after_date"},{label:"Joined Before",filterType:h.RJ.datepicker,filterId:"before_date"}]}ngOnInit(){super.ngOnInit(),this.getFilterData()}getFilterData(){const a=this.filters.filter(e=>e.filterId).map(e=>e);this.adminService.getFilters([...a]).subscribe(({filters:e})=>{this.filters=C().cloneDeep(this.filters.map(s=>(s.filterId&&(s.data=e[s.filterId]),s)))})}getFilters(){return{...this.filtered,searchString:""}}getSummary(){this.ploading=!0,this.adminService.summary(this.filtered).subscribe({next:a=>{this.ploading=!1,this.cloading=!1,this.showUserSummary(a.users_summary),this.prepareBarChartsData(a),this.prepareUtmSummaryChartData(a.users_summary_per_utm_channels)},error:a=>{this.ploading=!1,this.cloading=!1;const e=(0,w.Yf)(a);this.toastService.error({message:e})}})}showUserSummary(a){this.activities=[];for(const e in a){const s=a[e];this.activities.push({heading:e.split("_").join(" "),key:s||0,icon:"bi bi-people-fill"})}}prepareUtmSummaryChartData(a){if(!a||!a.length)return void(this.userSummaryPerUtmChannel=null);const e=[],s=[],i=[];a.forEach((o,m)=>{e.push(o.users),s.push(o.utm_channel),i.push(g[m%g.length])}),this.userSummaryPerUtmChannel={datasets:[{data:e,backgroundColor:i,label:"Users"}],labels:s},this.doughnutChartHeight=e.length<6?"200px":"500px"}prepareBarChartsData(a){if(this.monthlyUserGrowth||!a.users_monthly_summary||!a.users_monthly_summary.length)return;const e=[],s=[],i=[],o=a.users_total_count;let m=0;
1a.users_monthly_summary.forEach(c=>{i.push(o-m),m+=parseInt(c.users)}),a.users_monthly_summary.reverse().forEach(c=>{e.push(this.toMonthLabel(c)),s.push(c.users)}),this.monthlyUserGrowth={labels:e,datasets:[{label:"Monthly User Growth",backgroundColor:"#42A5F5",data:s}]},this.overallUserGrowth={labels:e,datasets:[{label:"Overall User Growth",backgroundColor:"#42A5F5",data:i.reverse()}]}}toMonthLabel(a){const e=new Date;return e.setMonth(parseInt(a.txn_month)-1),e.setFullYear(parseInt(a.txn_year)),this.datePipe.transform(e,"MMM-yy")}onFilterValueChange(){this.getSummary()}static{this.\u0275fac=function(e){return new(e||d)(t.rXU($.u),t.rXU(x.Kg),t.rXU(E.z),t.rXU(p.fw),t.rXU(l.vh))}}static{this.\u0275cmp=t.VBU({type:d,selectors:[["app-summary"]],standalone:!0,features:[t.Jv_([p.fw]),t.Vt3,t.aNF],decls:15,vars:20,consts:[[1,"container-fluid","non-transparent-header","px-0"],[3,"items"],[1,"row","w-100","g-0","dashboard-summary-area"],[1,"always-collapsible-filter","card-plain","mb-0","p-0",3,"valueChange","filters","filtered","isAlwaysCollapsible","retainValues","filterId"],[1,"w-100","mt-4","q-page-container"],[1,"summary-view","position-relative"],["class","font-bold mb-0",4,"ngIf"],["class","text-center my-5 w-100",4,"ngIf"],["class","row row-cols-auto g-0 gap-4 pt-3 pb-4 px-0",4,"ngIf"],["class","card card-plain p-3 mb-0",4,"ngIf"],[1,"w-100","my-4","q-page-container"],["class","pt-3",4,"ngIf"],[1,"font-bold","mb-0"],[1,"text-center","my-5","w-100"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],[1,"row","row-cols-auto","g-0","gap-4","pt-3","pb-4","px-0"],["class","card card-plain p-3 mb-0 w-custom-card",4,"ngFor","ngForOf"],[1,"card","card-plain","p-3","mb-0","w-custom-card"],[1,"d-flex","justify-content-between","card-body"],[1,"card-text"],[1,"card","card-plain","p-3","mb-0"],[1,"row","g-0"],[1,"col-sm"],["type","doughnut",3,"data","options","responsive","height"],[1,"pt-3"],[1,"row","g-0","gap-4"],[1,"col-sm","card","card-plain","mb-0","p-0"],[1,"p-3"],["type","bar",2,"min-height","300px",3,"data","options"]],template:function(e,s){1&e&&(t.j41(0,"section",0),t.nrm(1,"uikit-breadcrumb",1),t.j41(2,"div",2)(3,"app-filters",3),t.bIt("valueChange",function(){return s.onFilterValueChange()}),t.k0s(),t.j41(4,"div",4)(5,"div",5),t.DNE(6,k,2,0,"h5",6)(7,J,2,0,"div",7)(8,V,2,1,"div",8)(9,X,4,4,"div",9),t.k0s()(),t.j41(10,"div",10)(11,"div",5),t.DNE(12,B,2,0,"h5",6)(13,N,2,0,"div",7)(14,L,8,4,"div",11),t.k0s()()()()),2&e&&(t.R7$(),t.Y8G("items",t.l_i(17,A,t.lJ4(15,Y),t.lJ4(16,M))),t.R7$(2),t.AVh("card",!(s.ploading||s.cloading)),t.Y8G("filters",s.filters)("filtered",s.filtered)("isAlwaysCollapsible",!0)("retainValues",!0)("filterId","sc-summary"),t.R7$(3),t.Y8G("ngIf",!s.ploading),t.R7$(),t.Y8G("ngIf",s.ploading),t.R7$(),t.Y8G("ngIf",!s.ploading),t.R7$(),t.Y8G("ngIf",!s.ploading&&s.userSummaryPerUtmChannel),t.R7$(3),t.Y8G("ngIf",!s.cloading),t.R7$(),t.Y8G("ngIf",s.cloading),t.R7$(),t.Y8G("ngIf",!s.cloading))},dependencies:[l.MD,l.Sq,l.bT,l.PV,S.G,G.k,h.Z1,T.E,U.h,f.F,f.X,R.R,p.rm],styles:[".w-custom-card[_ngcontent-%COMP%]{width:18rem}@media (max-width: 575px){.w-custom-card[_ngcontent-%COMP%]{width:100%!important}}.dashboard-summary-area[_ngcontent-%COMP%]{height:calc(100vh - 60px);overflow:auto;padding-right:1.4rem}"]})}}(0,v.Cg)([(0,F.S)(b.vQ.DEBOUNCE_INTERVAL)],d.prototype,"onFilterValueChange",null)}}]); 2//# sourceMappingURL=9086.90114b6db7a40de3.js.map
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.