1"use strict";(globalThis.__LOADABLE_LOADED_CHUNKS__=globalThis.__LOADABLE_LOADED_CHUNKS__||[]).push([[4460],{49370(t,e,a){a.r(e),a.d(e,{SupplierStatsChart:()=>E,default:()=>w});var r=a(41594),o=a.n(r),i=a(98483),l=a(3602),s=a(22224),n=a.n(s),d=a(22078),g=a(67564),p=a(28363),_=a(62023),c=a(83751),h=a(23637),u=a(13404),y=a(84685),x=a(63988);const m=[..._.JJ];m[0]=l.colors.special1,m[1]=l.colors.cta,m[2]=l.colors.primary;const b=m.map(_.o),T=t=>{let{title:e,highlightText:a,options:r=[],value:i=null,onChange:s=null}=t;const[n,d]=o().useState(i);return(0,x.jsxs)("span",{"data-test-name":"TitleSelect",style:{color:"#0f3d51",fontSize:"1em"},children:[e," ",a,(0,x.jsxs)(l.Toggle,{style:{marginLeft:"2px"},children:[(0,x.jsx)(l.ToggleLink,{selected:n==r[0].value,onClick:t=>{d(r[0].value),s&&s(r[0].value)},children:r[0].label}),(0,x.jsx)(l.ToggleLink,{selected:n==r[1].value,onClick:t=>{d(r[1].value),s&&s(r[1].value)},children:r[1].label})]})]})};function S(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:g,isLoading:_,formatNumberType:h,totals_by:m,group_by:b,chartOptions:S,statsData:v,showPopup:f,isSparkline:$,totalsChart:j,titleSelect:I}=t,C=n().get(v,"totals_by_totals.data",!1),L=n().get(v,"totals_by_tenants_count.years",!1),P=o().useMemo(()=>{const t=n().map(n().values(e),t=>{const e={...t},a=C[t.group_by];return a?L.map((r,o)=>{let i=o+1;if(n().has(t,`y${i}`)){const r=0==t[`y${i}_totals`]?0:"tenants_count"===m?0==t[`y${i}_tenant_counts`]?0:(0,d.LI)(parseFloat(a[`y${i}_tenant_counts`]/t[`y${i}_tenant_counts`]),2).toFixed(2):(0,d.LI)(parseFloat(a[`y${i}_totals`]/t[`y${i}_totals`]),2).toFixed(2);e[`y${i}_percentage`]=r,e.totals_percentage=r,e.group_by_percentage=t.group_by,e[`y${i}_totals_percentage`]=r,e[`y${i}_group_by_percentage`]=t[`y${i}_group_by`],e[`company_y${i}`]=a[`y${i}`],e[`company_y${i}_totals`]="tenants_count"===m?a[`y${i}_tenant_counts`]:a[`y${i}_totals`],e[`company_y${i}_group_by`]=a[`y${i}_group_by`]}}):(e.y1_percentage=0,e.y2_percentage=0,e.y3_percentage=0),e});return{data:"month"===b?n().orderBy(t,[t=>p.US.indexOf(t.group_by.split(" ")[0])]):"quarter"===b?n().orderBy(t,[t=>p.GM.indexOf(t.group_by.split(" ")[0]),t=>t.group_by.split(" ")[1]],["asc","desc"]):t}},[f,e,C,m,a]);return(0,x.jsx)(x.Fragment,{children:(0,x.jsx)(u.Ay,{id:r,colSizes:i,components:{Title:I?(0,x.jsx)(T,{title:s,...I}):(0,x.jsx)(u.Pl,{startText:s})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:_?"center":"initial"},children:_?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"bar",data:P.data,height:$?"220px":"280px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,totals_by:m,group_by:b,formatNumberType:h,fileName:s}),onChartReady:j({isSparkline:!1,thisYr:!1,isPercentage:!0})}):null})})})}function v(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:d,isLoading:p,formatNumberType:h,totals_by:m,group_by:b,chartOptions:T,show_previous:S,prevHighlightText:v}=t,f=o().useMemo(()=>{const t=n().orderBy(n().map(n().filter(e,t=>t.gr1_totals),t=>({year:"year"===b?t.gr1:t.gr1_group_by.split(" ")[2],group_by:t.gr1,totals:n().parseInt(t.gr1_totals),[`${m}_name`]:t[`gr1_${m}_name`],[`${m}_id`]:t[`gr1_${m}_id`],...t.gr1_subData&&{gr_subData:t.gr1_subData}})),[t=>parseInt(t.totals)],["desc"]),a=n().orderBy(n().map(n().filter(e,t=>t.gr2_totals),t=>({year:"year"===b?t.gr2:t.gr2_group_by.split(" ")[2],group_by:t.gr2,totals:n().parseInt(t.gr2_totals),[`${m}_name`]:t[`gr2_${m}_name`],[`${m}_id`]:t[`gr2_${m}_id`],...t.gr2_subData&&{gr_subData:t.gr2_subData}})),[t=>parseInt(t.totals)],["desc"]),r=t.findIndex(t=>"Others"===t[`${m}_name`]),o=a.findIndex(t=>"Others"===t[`${m}_name`]);return{current:[...r>-1?t.slice(0,r):[],...r>-1?t.slice(r+1):t,...r>-1?[t[r]]:[]],prev:[...o>-1?a.slice(0,o):[],...o>-1?a.slice(o+1):a,...o>-1?[a[o]]:[]]}},[e,a]);return(0,x.jsxs)(u.Ay,{"data-test-name":"TopDistributorsChart",colSizes:{xs:12,lg:12},children:[(0,x.jsx)(u.Ay,{id:r,colSizes:i,boxStyle:{boxShadow:"none"},components:{Title:(0,x.jsx)(u.Pl,{startText:s,endText:d})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:p?"center":"initial"}
1,children:p?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"pie",data:f.current,height:"480px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,formatNumberType:h,totals_by:m,group_by:b,onlyValTransform:!0,fileName:s+"_"+d}),onChartReady:(t,e)=>(0,_.pF)(t,{data:e,value:"totals",category:`${m}_name`,showSliceLabel:!1,legendScrollable:!0,clickableLegend:!1,mousePointer:!0,onClickLegend:t=>{const e=t.target.dataItem&&t.target.dataItem.dataContext&&t.target.dataItem.dataContext._dataContext?t.target.dataItem.dataContext._dataContext.tenant_id:"";"tenant"===m&&e&&"others"!==e.toLowerCase()&&g.x.open(`/distributor.php?id=${e}`,"_blank")},onClickSlice:t=>{const e=t.target.dataItem&&t.target.dataItem.dataContext?t.target.dataItem.dataContext.tenant_id:"";"tenant"===m&&e&&"others"!==e.toLowerCase()&&g.x.open(`/distributor.php?id=${e}`,"_blank")},...T})}):null})}),S?(0,x.jsx)(u.Ay,{id:r+"prev",colSizes:i,boxStyle:{boxShadow:"none"},components:{Title:(0,x.jsx)(u.Pl,{color:"cta",startText:s,endText:v})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:p?"center":"initial"},children:p?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"pie",data:f.prev,height:"480px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r+"prev",formatNumberType:h,totals_by:m,group_by:b,onlyValTransform:!0,fileName:s+"_"+v}),onChartReady:(t,e)=>(0,_.pF)(t,{data:e,value:"totals",category:`${m}_name`,showSliceLabel:!1,legendScrollable:!0,mousePointer:!0,onClickLegend:t=>{const e=t.target.dataItem&&t.target.dataItem.dataContext&&t.target.dataItem.dataContext._dataContext?t.target.dataItem.dataContext._dataContext.tenant_id:"";"tenant"===m&&e&&"others"!==e.toLowerCase()&&g.x.open(`/distributor.php?id=${e}`,"_blank")},onClickSlice:t=>{const e=t.target.dataItem&&t.target.dataItem.dataContext?t.target.dataItem.dataContext.tenant_id:"";"tenant"===m&&e&&"others"!==e.toLowerCase()&&g.x.open(`/distributor.php?id=${e}`,"_blank")},...T})}):null})}):null]})}function f(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:d,isLoading:g,formatNumberType:p,totals_by:h,group_by:m,chartOptions:b,show_previous:T,prevHighlightText:S}=t,v=o().useMemo(()=>{const t=n().orderBy(n().map(n().filter(e,t=>t.gr1_totals),t=>({year:"year"===m?t.gr1:t.gr1_group_by.split(" ")[2],group_by:t.gr1,totals:n().parseInt(t.gr1_totals),[`${h}_name`]:t[`gr1_${h}_name`],[`${h}_id`]:t[`gr1_${h}_id`],...t.gr1_subData&&{gr_subData:t.gr1_subData}})),[t=>parseInt(t.totals)],["desc"]),a=n().orderBy(n().map(n().filter(e,t=>t.gr2_totals),t=>({year:"year"===m?t.gr2:t.gr2_group_by.split(" ")[2],group_by:t.gr2,totals:n().parseInt(t.gr2_totals),[`${h}_name`]:t[`gr2_${h}_name`],[`${h}_id`]:t[`gr2_${h}_id`],...t.gr2_subData&&{gr_subData:t.gr2_subData}})),[t=>parseInt(t.totals)],["desc"]),r=t.findIndex(t=>"Others"===t[`${h}_name`]),o=a.findIndex(t=>"Others"===t[`${h}_name`]);return{current:[...r>-1?t.slice(0,r):[],...r>-1?t.slice(r+1):t,...r>-1?[t[r]]:[]],prev:[...o>-1?a.slice(0,o):[],...o>-1?a.slice(o+1):a,...o>-1?[a[o]]:[]]}},[e,a]);return(0,x.jsxs)(u.Ay,{"data-test-name":"TopIndustriesChart",colSizes:{xs:12,lg:12},children:[(0,x.jsx)(u.Ay,{id:r,colSizes:i,boxStyle:{boxShadow:"none"},components:{Title:(0,x.jsx)(u.Pl,{startText:s,endText:d})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:g?"center":"initial"},children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"pie",data:v.current,height:"480px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,formatNumberType:p,totals_by:h,group_by:m,onlyValTransform:!0,fileName:s+"_"+d}),onChartReady:(t,e)=>(0,_.pF)(t,{data:e,value:"totals",category:`${h}_name`,showSliceLabel:!1,legendScrollable:!0,clickableLegend:!1,mousePointer:!0,...b})}):null})}),T?(0,x.jsx)(u.Ay,{id:r+"prev",colSizes:i,boxStyle:{boxShadow:"none"},components:{Title:(0,x.jsx)(u.Pl,{color:"cta",startText:s,endText:S})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:g?"center":"initial"},children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"pie",data:v.prev,height:"480px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r+"prev",formatNumberType:p,totals_by:h,group_by:m,onlyValTransform:!0,fileName:s+"_"+S}),onChartReady:(t,e)=>(0,_.pF)(t,{data:e,value:"totals",category:`${h}_name`,showSliceLabel:!1,legendScrollable:!0,mousePointer:!0,...b})}):null})}):null]})}function $(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:d,isLoading:g,formatNumberType:p,totals_by:h,group_by:m,chartOptions:b,show_previous:T,prevHighlightText:S}=t,v=o().useMemo(()=>{const t=n().orderBy(n().map(n().filter(e,t=>t.gr1_totals),t=>({year:"year"===m?t.gr1:t.gr1_group_by.split(" ")[2],group_by:t.gr1,totals:n().parseInt(t.gr1_totals),[`${h}
1_name`]:t[`gr1_${h}_name`],[`${h}_id`]:t[`gr1_${h}_id`],...t.gr1_subData&&{gr_subData:t.gr1_subData}})),[t=>parseInt(t.totals)],["desc"]),a=n().orderBy(n().map(n().filter(e,t=>t.gr2_totals),t=>({year:"year"===m?t.gr2:t.gr2_group_by.split(" ")[2],group_by:t.gr2,totals:n().parseInt(t.gr2_totals),[`${h}_name`]:t[`gr2_${h}_name`],[`${h}_id`]:t[`gr2_${h}_id`],...t.gr2_subData&&{gr_subData:t.gr2_subData}})),[t=>parseInt(t.totals)],["desc"]),r=t.findIndex(t=>"Others"===t[`${h}_name`]),o=a.findIndex(t=>"Others"===t[`${h}_name`]);return{current:[...r>-1?t.slice(0,r):[],...r>-1?t.slice(r+1):t,...r>-1?[t[r]]:[]],prev:[...o>-1?a.slice(0,o):[],...o>-1?a.slice(o+1):a,...o>-1?[a[o]]:[]]}},[e,a]);return(0,x.jsxs)(u.Ay,{"data-test-name":"TopEventsChart",colSizes:{xs:12,lg:12},children:[(0,x.jsx)(u.Ay,{id:r,colSizes:i,boxStyle:{boxShadow:"none"},components:{Title:(0,x.jsx)(u.Pl,{startText:s,endText:d})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:g?"center":"initial"},children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"pie",data:v.current,height:"480px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,formatNumberType:p,totals_by:h,group_by:m,onlyValTransform:!0,fileName:s+"_"+d}),onChartReady:(t,e)=>(0,_.pF)(t,{data:e,value:"totals",category:`${h}_name`,showSliceLabel:!1,legendScrollable:!0,clickableLegend:!1,mousePointer:!0,...b})}):null})}),T?(0,x.jsx)(u.Ay,{id:r+"prev",colSizes:i,boxStyle:{boxShadow:"none"},components:{Title:(0,x.jsx)(u.Pl,{color:"cta",startText:s,endText:S})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:g?"center":"initial"},children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"pie",data:v.prev,height:"480px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r+"prev",formatNumberType:p,totals_by:h,group_by:m,onlyValTransform:!0,fileName:s+"_"+S}),onChartReady:(t,e)=>(0,_.pF)(t,{data:e,value:"totals",category:`${h}_name`,showSliceLabel:!1,legendScrollable:!0,mousePointer:!0,...b})}):null})}):null]})}function j(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:d,isLoading:h,formatNumberType:m,totals_by:b,group_by:S,chartOptions:v,tenant_id:f,show_previous:$,prevHighlightText:j,titleSelect:I,showSidepanel:C,getSidepanelData:L}=t,P=o().useMemo(()=>({current:n().orderBy(n().filter(e||[],t=>t.gr1_totals&&"Others"!==t[`gr1_${b}_name`]),[t=>parseInt(t.gr1_totals)],["asc"]),prev:n().orderBy(n().filter(e||[],t=>t.gr2_totals&&"Others"!==t[`gr2_${b}_name`]),[t=>parseInt(t.gr2_totals)],["asc"])}),[e,b,f,a]),E={};return E[`gr1_${b}_max`]=P.current.length>0?Math.ceil(P.current[P.current.length-1].gr1_totals):0,E[`gr2_${b}_max`]=P.prev.length>0?Math.ceil(P.prev[P.prev.length-1].gr2_totals):0,E[`gr_${b}_max`]=E[`gr1_${b}_max`]>E[`gr2_${b}_max`]?E[`gr1_${b}_max`]:E[`gr2_${b}_max`],(0,x.jsxs)(u.Ay,{"data-test-name":"TopRepsChart",colSizes:{xs:12,lg:12},components:{Title:I&&"product"!==b?(0,x.jsx)(T,{title:"Top Reps",...I}):null},children:[(0,x.jsx)(u.Ay,{id:r,colSizes:i,boxHeight:{height:h?"":"480px"},boxStyle:{boxShadow:"none",overflowY:e&&P.current.length>=7?"auto":"hidden"},components:{Title:(0,x.jsx)(u.Pl,{startText:"product"===b?s:d,endText:"product"===b?d:""})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:h?"center":"initial"},children:h?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"bar",data:P.current,height:(0,p.xj)(P.current.length<=3?3:P.current.length+1,1,1400,20)+"px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,totals_by:b,group_by:S,formatNumberType:m,fileName:"product"===b?s+"_"+d:"Top Reps_"+d}),onChartReady:(t,e)=>(0,_.xg)(t,{data:e,valueX:"gr1_totals",valueY:`gr1_${b}_id`,valueText:"product"===b?`Â Â Â {gr1_${b}_name}`:`Â Â Â {gr1_${b}_name} - {gr1_tenant_name}`,imgField:"gr1_img_src",imgHeight:50,imgWidth:50,fontSize:13,differentOpacity:!0,tooltipPointerOrientation:"down",tooltipText:"{tooltipText}",insideBarLabelText:"{valueX}",mousePointer:!0,scaleMax:E[`gr_${b}_max`],autoAdjustHeight:!0,hideValueAxis:!0,onHit:t=>{const e=t.target.dataItem.dataContext;C&&L?C(L(e,"gr1")):e&&e[`gr1_${b}_id`]&&1==e.isActive&&g.x.open(`/user.php?id=${e[`gr1_${b}_id`]}`,"_blank")},...v})}):null})}),$?(0,x.jsx)(u.Ay,{id:r+"prev",colSizes:i,boxHeight:{height:h?"":"480px"},boxStyle:{boxShadow:"none",overflowY:e&&P.prev.length>=7?"auto":"hidden"},components:{Title:(0,x.jsx)(u.Pl,{startText:"product"===b?s:j,endText:"product"===b?j:""})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:h?"center":"initial"}
1,children:h?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"bar",data:P.prev,height:(0,p.xj)(P.prev.length<=3?3:P.prev.length+1,1,1400,20)+"px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r+"prev",totals_by:b,group_by:S,formatNumberType:m,fileName:"product"===b?s+"_"+j:"Top Reps_"+j}),onChartReady:(t,e)=>(0,_.xg)(t,{data:e,valueX:"gr2_totals",valueY:`gr2_${b}_id`,valueText:"product"===b?`Â Â Â {gr2_${b}_name}`:`Â Â Â {gr2_${b}_name} - {gr2_tenant_name}`,imgField:"gr2_img_src",imgHeight:50,imgWidth:50,fontSize:13,tooltipPointerOrientation:"down",differentOpacity:!0,tooltipText:"{tooltipText}",mousePointer:!0,insideBarLabelText:"{valueX}",scaleMax:E[`gr_${b}_max`],hideValueAxis:!0,autoAdjustHeight:!0,onHit:t=>{const e=t.target.dataItem.dataContext;C&&L?C(L(e,"gr2")):e&&e[`gr2_${b}_id`]&&1==e.isActive&&g.x.open(`/user.php?id=${e[`gr2_${b}_id`]}`,"_blank")},...v})}):null})}):null]})}function I(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:d,isLoading:h,formatNumberType:m,totals_by:b,group_by:S,chartOptions:v,tenant_id:f,show_previous:$,prevHighlightText:j,titleSelect:I,showSidepanel:C,getSidepanelData:L}=t,P=o().useMemo(()=>({current:n().orderBy(n().filter(e||[],t=>t.gr1_totals&&"Others"!==t[`gr1_${b}_name`]),[t=>parseInt(t.gr1_totals)],["asc"]),prev:n().orderBy(n().filter(e||[],t=>t.gr2_totals&&"Others"!==t[`gr2_${b}_name`]),[t=>parseInt(t.gr2_totals)],["asc"])}),[e,b,f,a]),E={};return E[`gr1_${b}_max`]=P.current.length>0?Math.ceil(P.current[P.current.length-1].gr1_totals):0,E[`gr2_${b}_max`]=P.prev.length>0?Math.ceil(P.prev[P.prev.length-1].gr2_totals):0,E[`gr_${b}_max`]=E[`gr1_${b}_max`]>E[`gr2_${b}_max`]?E[`gr1_${b}_max`]:E[`gr2_${b}_max`],(0,x.jsxs)(u.Ay,{"data-test-name":"TopQuotingPreSalesRepsChart",colSizes:{xs:12,lg:12},components:{Title:I&&"product"!==b?(0,x.jsx)(T,{title:"Top Quoting Reps",...I}):null},children:[(0,x.jsx)(u.Ay,{id:r,colSizes:i,boxHeight:{height:h?"":"480px"},boxStyle:{boxShadow:"none",overflowY:e&&P.current.length>=7?"auto":"hidden"},components:{Title:(0,x.jsx)(u.Pl,{startText:"product"===b?s:d,endText:"product"===b?d:""})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:h?"center":"initial"},children:h?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"bar",data:P.current,height:(0,p.xj)(P.current.length<=3?3:P.current.length+1,1,1400,20)+"px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,totals_by:b,group_by:S,formatNumberType:m,fileName:"product"===b?s+"_"+d:"Top Reps_"+d}),onChartReady:(t,e)=>(0,_.xg)(t,{data:e,valueX:"gr1_totals",valueY:`gr1_${b}_id`,valueText:"product"===b?`Â Â Â {gr1_${b}_name}`:`Â Â Â {gr1_${b}_name} - {gr1_tenant_name}`,imgField:"gr1_img_src",imgHeight:50,imgWidth:50,fontSize:13,differentOpacity:!0,tooltipPointerOrientation:"down",tooltipText:"{tooltipText}",insideBarLabelText:"{valueX}",mousePointer:!0,scaleMax:E[`gr_${b}_max`],autoAdjustHeight:!0,hideValueAxis:!0,onHit:t=>{const e=t.target.dataItem.dataContext;C&&L?C(L(e,"gr1")):e&&e[`gr1_${b}_id`]&&1==e.isActive&&g.x.open(`/user.php?id=${e[`gr1_${b}_id`]}`,"_blank")},...v})}):null})}),$?(0,x.jsx)(u.Ay,{id:r+"prev",colSizes:i,boxHeight:{height:h?"":"480px"},boxStyle:{boxShadow:"none",overflowY:e&&P.prev.length>=7?"auto":"hidden"},components:{Title:(0,x.jsx)(u.Pl,{startText:"product"===b?s:j,endText:"product"===b?j:""})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:h?"center":"initial"},children:h?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"bar",data:P.prev,height:(0,p.xj)(P.prev.length<=3?3:P.prev.length+1,1,1400,20)+"px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r+"prev",totals_by:b,group_by:S,formatNumberType:m,fileName:"product"===b?s+"_"+j:"Top Reps_"+j}),onChartReady:(t,e)=>(0,_.xg)(t,{data:e,valueX:"gr2_totals",valueY:`gr2_${b}_id`,valueText:"product"===b?`Â Â Â {gr2_${b}_name}`:`Â Â Â {gr2_${b}_name} - {gr2_tenant_name}`,imgField:"gr2_img_src",imgHeight:50,imgWidth:50,fontSize:13,tooltipPointerOrientation:"down",differentOpacity:!0,tooltipText:"{tooltipText}",mousePointer:!0,insideBarLabelText:"{valueX}",scaleMax:E[`gr_${b}_max`],hideValueAxis:!0,autoAdjustHeight:!0,onHit:t=>{const e=t.target.dataItem.dataContext;C&&L?C(L(e,"gr2")):e&&e[`gr2_${b}_id`]&&1==e.isActive&&g.x.open(`/user.php?id=${e[`gr2_${b}_id`]}`,"_blank")},...v})}):null})}):null]})}function C(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:d,isLoading:g,formatNumberType:_,totals_by:h,group_by:m,chartOptions:b,isSparkline:T,totalsChart:S}=t,v=("quarter"===m?(p.II,p.vW):("year"===m||p.US[p.Ej],p.vW),o().useMemo(()=>{const t="year"===m?n().values(e):n().filter(n().values(e),t=>{const e=void 0!==t.y1||null!==t.y1||""!==t.y1?t.y1_group_by:t.y2_group_by;return"month"===m?p.US.indexOf(e)<=p.Ej:"quarter"!==m||p.GM.indexOf(e)+1<=p.II});return{data:"month"===m?n().orderBy(t,[t=>p.US.indexOf(t.group_by.split(" ")[0])]):"quarter"===m?n().orderBy(t,[t=>p.GM.indexOf(t.group_by.split(" ")[0])]):t}},[e,m,a]));return(0,x.jsx)(u.Ay,{"data-test-name":"PurchaseOrdersChart",id:r,colSizes:i,components:{Title:(0,x.jsx)(u.Pl,{startText:s})},children:(0,x.jsx)(l.Col,{xs:12,style:{textAlign:g?"center":"initial"}
1,children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"bar",height:T?"140px":"300px",width:"100%",data:v.data,onChartReady:S({isSparkline:T,thisYr:!1}),isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,totals_by:h,group_by:m,formatNumberType:_,fileName:s})}):null})})}function L(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:d,isLoading:g,formatNumberType:p,totals_by:h,group_by:m,chartOptions:b,show_previous:T}=t,S=o().useMemo(()=>({current:n().orderBy(n().map(n().filter(e,t=>t.gr1_totals),t=>({year:"year"===m?t.gr1:t.gr1_group_by.split(" ")[2],group_by:t.gr1,totals:n().parseInt(t.gr1_totals),[`${h}_name`]:t[`gr1_${h}_name`]})),[t=>parseInt(t.totals)],["desc"]),prev:n().orderBy(n().map(n().filter(e,t=>t.gr2_totals),t=>({year:"year"===m?t.gr2:t.gr2_group_by.split(" ")[2],group_by:t.gr2,totals:n().parseInt(t.gr2_totals),[`${h}_name`]:t[`gr2_${h}_name`]})),[t=>parseInt(t.totals)],["desc"])}),[e,h,a]);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(u.Ay,{id:r,colSizes:i,components:{Title:(0,x.jsx)(u.Pl,{startText:s,endText:d})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:g?"center":"initial"},children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"pie",data:S.current,height:"480px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,formatNumberType:p,totals_by:h,group_by:m,onlyValTransform:!0,fileName:s+"_"+d}),onChartReady:(t,e)=>(0,_.rl)(t,{data:e,value:"totals",category:`${h}_name`,radius:50,...b})}):null})}),T?(0,x.jsx)(u.Ay,{id:r+"prev",colSizes:i,components:{Title:(0,x.jsx)(u.Pl,{startText:s,endText:prevHighlightText})},children:(0,x.jsx)(l.Col,{xs:!0,style:{textAlign:g?"center":"initial"},children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"pie",data:S.current,height:"480px",isExportable:!0,modifyExport:(0,c.Jm)({cardId:r+"prev",formatNumberType:p,totals_by:h,group_by:m,onlyValTransform:!0,fileName:s+"_"+d}),onChartReady:(t,e)=>(0,_.rl)(t,{data:e,value:"totals",category:`${h}_name`,radius:50,...b})}):null})}):null]})}function P(t){const{chartData:e,division_id:a,cardId:r,colSizes:i,title:s,highlightText:d,isLoading:g,formatNumberType:p,totals_by:h,group_by:m,chartOptions:b,show_previous:T,prevHighlightText:S}=t,v=o().useMemo(()=>({current:n().orderBy(n().map(n().filter(e||[],t=>t.gr1_totals&&"Others"!==t[`gr1_${h}_name`]&&n().has(t,`gr1_${h}_name`)),t=>({year:"year"===m?t.gr1:t.gr1_group_by.split(" ")[2],group_by:t.gr1,totals:n().parseInt(t.gr1_totals),[`${h}_name`]:t[`gr1_${h}_name`],img_src:t.gr1_img_src})),[t=>parseInt(t.totals)],["desc"]),prev:n().orderBy(n().map(n().filter(e||[],t=>t.gr2_totals&&"Others"!==t[`gr2_${h}_name`]&&n().has(t,`gr2_${h}_name`)),t=>({year:"year"===m?t.gr2:t.gr2_group_by.split(" ")[2],group_by:t.gr2,totals:n().parseInt(t.gr2_totals),[`${h}_name`]:t[`gr2_${h}_name`],img_src:t.gr2_img_src})),[t=>parseInt(t.totals)],["desc"])}),[e,h,tenant_id,a]);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(u.Ay,{id:r,colSizes:i,components:{Title:(0,x.jsx)(u.Pl,{startText:s,endText:d})},children:(0,x.jsx)(l.Col,{xs:!0,style:{maxHeight:400,overflow:"auto",textAlign:g?"center":"initial"},children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"bar",width:v.current&&v.current.length>1?70*v.current.length+"px":"100%",height:"380px",data:v.current,isExportable:!0,modifyExport:(0,c.Jm)({cardId:r,formatNumberType:p,totals_by:h,group_by:m,onlyValTransform:!0,fileName:s+"_"+S}),onChartReady:(t,e)=>(0,_.Hu)(t,{data:e,valueY:"totals",valueX:`${h}_name`,imgField:"img_src",imgHeight:50,imgWidth:50,fontSize:13,tooltipText:"{group_by}: [bold]{valueY.value}",...b})}):null})}),T?(0,x.jsx)(u.Ay,{id:r+"prev",colSizes:i,components:{Title:(0,x.jsx)(u.Pl,{color:"cta",startText:s,endText:S})},children:(0,x.jsx)(l.Col,{xs:!0,style:{maxHeight:400,overflow:"auto",textAlign:g?"center":"initial"},children:g?(0,x.jsx)(l.Loading,{height:40}):e?(0,x.jsx)(y.t1,{type:"bar",width:v.prev&&v.prev.length>1?70*v.prev.length+"px":"100%",height:"380px",data:v.prev,isExportable:!0,modifyExport:(0,c.Jm)({cardId:r+"prev",formatNumberType:p,totals_by:h,group_by:m,onlyValTransform:!0,fileName:s+"_"+S}),onChartReady:(t,e)=>(0,_.Hu)(t,{data:e,valueY:"totals",valueX:`${h}_name`,imgField:"img_src",imgHeight:50,imgWidth:50,fontSize:13,tooltipText:"{group_by}: [bold]{valueY.value}",...b})}):null})}):null]})}function E(t){let{type:e,showPopup:a,totals_by:r="totals",group_by:o="year",colSizes:l={xs:12,lg:6},tenant_id:s,division_id:d,...g}=t;const c=(0,i.d4)(h.H$),u=(0,i.d4)(h.Sk),y=(0,i.d4)(h.eX),m=(0,i.d4)(h.RJ),T="quarter"===o?"Q"+p.II:"month"===o?p.hZ[p.Ej]:p.vW,E="quarter"===o?"Q"+p.qc:"month"===o?p.hZ[p.uH]:p.vW-1,w=["tags","tenants_count"].includes(r)?"percentage":["order_rep","order_client_rep"].includes(r)&&!e.includes("SUPPLIER_PRESALES")?"roundedCurrency":e.includes("SUPPLIER_POS")?"currency":"number",O={formatNumber:(0,_.qT)(w)},A=function(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"")||(t.includes("SUPPLIER_POS")?"tenant"===e?"Top Distributors - ":"order_rep"===e?"Top Order Reps":"order_client_rep"===e?"Top Client Reps":"tags"===e?"Tagged Purchase Orders":"tenants_count"===e?"Percentage of Distributors with POs":"Purchase Orders":t.includes("SUPPLIER_EVENTS")?"tenant"===e?"Distributor Engagement - ":"product"===e?"Most Quoted Products - ":"tags"===e?"Tagged Engagement":"industry"===e?"Projects by Client Industry - ":"events"===e?"Projects by Event Type - ":"tenants_count"===e?"Percentage of Distributors Engaged":"Engagement":t.includes("SUPPLIER_PRODUCTS")?"Most Sold Products - ":"")}(e,r,g.title||""),D=e.includes("SUPPLIER_POS")?c:e.includes("SUPPLIER_EVENTS")?u:e.includes("SUPPLIER_PRODUCTS")?y:e.includes("SUPPLIER_PRESALES")?m:{},N=n().get(D,`totals_by_${r}.data`,!1),R=e+g.chart_type+o+r,z=(0,i.d4)(t=>{let{dashboard:a}=t;return a.loading[`${e}_${r}_${o}`]||a.loading.supplierStats}),H=t=>{let{thisYr:e=!1,isSparkline:a=!1,isPercentage:i=!1,...l}=t;const s=i?_.Fs:_.i3,d=e?"year"==o?[p.vW+"",p.vW-1+""]:[p.vW+""]:n().sortBy(D[`totals_by_${r}`].years);return(t,r)=>s(t,{chartColors:[...b],isSparkline:a,cursorLineX:!1,cursorLineY:!1,xAxes:[{category:"year"==o?"year":i?"y2_group_by":"categoryX",title:n().get(n().find(p.i9,o),"label",""),showGrid:i,showAxis:!0,showTitle:!0,showLabel:!0,cursorTooltipEnabled:!1,cellStartLocation:i?.5:.1,cellEndLocation:i?.6:.9,maxWidth:70,darkerGridLines:!0}],yAxes:[{cursorTooltipEnabled:!0,title:i?"Total Percent":"Total",renderOutside:!0,min:0,max:i?1:void 0,strictMinMax:!0,showGrid:i,showAxis:i,showTitle:i,showLabel:!0,cursorTooltipEnabled:!1,keepSelection:!0,darkerGridLines:!0}],series:i&&"year"==o?[{categoryX:"group_by_percentage",valueY:"totals_percentage",name:"Years",tooltipText:("year"==o?"":"{year} - ")+"{categoryX}: [bold]{valueY}",strokeWidth:0,fillPropertyOpacity:"opacity"}]:"year"==o?[{categoryX:"year",valueY:"totals",name:"Years",strokeWidth:0,tooltipText:"{year}: [bold]{valueY}",fillPropertyOpacity:"opacity",fillDifferentColors:!0}]:d.map((t,a)=>({categoryX:`y${e?a+1:d.length-a}_group_by${i?"_percentage":""}`,valueY:`y${e?a+1:d.length-a}_totals${i?"_percentage":""}`,name:t,tooltipText:("year"==o?"":"{year} - ")+"{categoryX}: [bold]{valueY}",strokeWidth:0,fillPropertyOpacity:"opacity"})),tooltipText:("year"==o?"":"{year} - ")+"{categoryX}: [bold]{valueY}",legend:"year"!==o,isLegendCheckbox:!0,isSupplierDashboardPoChart:!0,...O,...l})},k=n().get(g,"isSparkline",!1);return"totals"===r&&"bar"===g.chart_type?(0,x.jsx)(C,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,isSparkline:k,totalsChart:H}):["tags","tenants_count"].includes(r)&&"line"==g.chart_type?(0,x.jsx)(S,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,statsData:D,showPopup:a,isSparkline:k,totalsChart:H,titleSelect:g.titleSelect}):r&&"bar_bullet"===g.chart_type&&"SUPPLIER_PRESALES"!==e&&"SUPPLIER_PRODUCTS"!==e?(0,x.jsx)(j,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,show_previous:g.show_previous,prevHighlightText:E,titleSelect:g.titleSelect,showSidepanel:g.showSidepanel,getSidepanelData:g.getSidepanelData}):"SUPPLIER_PRESALES"!=e&&"SUPPLIER_PRODUCTS"!=e||"bar_bullet"!==g.chart_type?r&&"donut"===g.chart_type?(0,x.jsx)(L,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,show_previous:g.show_previous}):"industry"===r&&"pie"===g.chart_type?(0,x.jsx)(f,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,show_previous:g.show_previous,prevHighlightText:E}):"events"===r&&"pie"===g.chart_type?(0,x.jsx)($,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,show_previous:g.show_previous,prevHighlightText:E}):"tenant"===r&&"pie"===g.chart_type?(0,x.jsx)(v,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,show_previous:g.show_previous,prevHighlightText:E}):r&&"bar_bullet_vertical"===g.chart_type?(0,x.jsx)(P,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,show_previous:g.show_previous,prevHighlightText:E}):null:(0,x.jsx)(I,{"data-test-name":"SupplierStatsChart",chartData:N,division_id:d,cardId:R,colSizes:l,title:A,highlightText:T,isLoading:z,formatNumberType:w,totals_by:r,group_by:o,chartOptions:O,show_previous:g.show_previous,prevHighlightText:E,titleSelect:g.titleSelect,showSidepanel:g.showSidepanel,getSidepanelData:g.getSidepanelData})}const w=E}}]); 2//# sourceMappingURL=SupplierCharts.36c01cc9.chunk.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.