(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3372],{57976:function(e,r,t){"use strict";var a=t(64836);r.Z=void 0;var n=a(t(64938)),o=t(85893);r.Z=(0,n.default)((0,o.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert")},78445:function(e,r,t){"use strict";t.d(r,{Z:function(){return Z}});var a=t(63366),n=t(87462),o=t(67294),i=t(86010),l=t(58510),s=t(15861),d=t(71657),c=t(90948),u=t(1977),h=t(8027);function getCardHeaderUtilityClass(e){return(0,h.ZP)("MuiCardHeader",e)}let f=(0,u.Z)("MuiCardHeader",["root","avatar","action","content","title","subheader"]);var m=t(85893);let g=["action","avatar","className","component","disableTypography","subheader","subheaderTypographyProps","title","titleTypographyProps"],useUtilityClasses=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"],avatar:["avatar"],action:["action"],content:["content"],title:["title"],subheader:["subheader"]},getCardHeaderUtilityClass,r)},b=(0,c.ZP)("div",{name:"MuiCardHeader",slot:"Root",overridesResolver:(e,r)=>(0,n.Z)({[`& .${f.title}`]:r.title,[`& .${f.subheader}`]:r.subheader},r.root)})({display:"flex",alignItems:"center",padding:16}),p=(0,c.ZP)("div",{name:"MuiCardHeader",slot:"Avatar",overridesResolver:(e,r)=>r.avatar})({display:"flex",flex:"0 0 auto",marginRight:16}),v=(0,c.ZP)("div",{name:"MuiCardHeader",slot:"Action",overridesResolver:(e,r)=>r.action})({flex:"0 0 auto",alignSelf:"flex-start",marginTop:-4,marginRight:-8,marginBottom:-4}),x=(0,c.ZP)("div",{name:"MuiCardHeader",slot:"Content",overridesResolver:(e,r)=>r.content})({flex:"1 1 auto"}),C=o.forwardRef(function(e,r){let t=(0,d.Z)({props:e,name:"MuiCardHeader"}),{action:o,avatar:l,className:c,component:u="div",disableTypography:h=!1,subheader:f,subheaderTypographyProps:C,title:Z,titleTypographyProps:y}=t,j=(0,a.Z)(t,g),w=(0,n.Z)({},t,{component:u,disableTypography:h}),k=useUtilityClasses(w),P=Z;null==P||P.type===s.Z||h||(P=(0,m.jsx)(s.Z,(0,n.Z)({variant:l?"body2":"h5",className:k.title,component:"span",display:"block"},y,{children:P})));let S=f;return null==S||S.type===s.Z||h||(S=(0,m.jsx)(s.Z,(0,n.Z)({variant:l?"body2":"body1",className:k.subheader,color:"text.secondary",component:"span",display:"block"},C,{children:S}))),(0,m.jsxs)(b,(0,n.Z)({className:(0,i.Z)(k.root,c),as:u,ref:r,ownerState:w},j,{children:[l&&(0,m.jsx)(p,{className:k.avatar,ownerState:w,children:l}),(0,m.jsxs)(x,{className:k.content,ownerState:w,children:[P,S]}),o&&(0,m.jsx)(v,{className:k.action,ownerState:w,children:o})]}))});var Z=C},88441:function(e,r,t){"use strict";var a=t(63366),n=t(87462),o=t(67294),i=t(86010),l=t(58510),s=t(70917),d=t(41796),c=t(98216),u=t(2734),h=t(90948),f=t(71657),m=t(28962),g=t(85893);let b=["className","color","value","valueBuffer","variant"],_=e=>e,p,v,x,C,Z,y,j=(0,s.F4)(p||(p=_`
  0% {
    left: -35%;
    right: 100%;
  }

  60% {
    left: 100%;
    right: -90%;
  }

  100% {
    left: 100%;
    right: -90%;
  }
`)),w=(0,s.F4)(v||(v=_`
  0% {
    left: -200%;
    right: 100%;
  }

  60% {
    left: 107%;
    right: -8%;
  }

  100% {
    left: 107%;
    right: -8%;
  }
`)),k=(0,s.F4)(x||(x=_`
  0% {
    opacity: 1;
    background-position: 0 -23px;
  }

  60% {
    opacity: 0;
    background-position: 0 -23px;
  }

  100% {
    opacity: 1;
    background-position: -200px -23px;
  }
`)),useUtilityClasses=e=>{let{classes:r,variant:t,color:a}=e,n={root:["root",`color${(0,c.Z)(a)}`,t],dashed:["dashed",`dashedColor${(0,c.Z)(a)}`],bar1:["bar",`barColor${(0,c.Z)(a)}`,("indeterminate"===t||"query"===t)&&"bar1Indeterminate","determinate"===t&&"bar1Determinate","buffer"===t&&"bar1Buffer"],bar2:["bar","buffer"!==t&&`barColor${(0,c.Z)(a)}`,"buffer"===t&&`color${(0,c.Z)(a)}`,("indeterminate"===t||"query"===t)&&"bar2Indeterminate","buffer"===t&&"bar2Buffer"]};return(0,l.Z)(n,m.E,r)},getColorShade=(e,r)=>"inherit"===r?"currentColor":e.vars?e.vars.palette.LinearProgress[`${r}Bg`]:"light"===e.palette.mode?(0,d.$n)(e.palette[r].main,.62):(0,d._j)(e.palette[r].main,.5),P=(0,h.ZP)("span",{name:"MuiLinearProgress",slot:"Root",overridesResolver:(e,r)=>{let{ownerState:t}=e;return[r.root,r[`color${(0,c.Z)(t.color)}`],r[t.variant]]}})(({ownerState:e,theme:r})=>(0,n.Z)({position:"relative",overflow:"hidden",display:"block",height:4,zIndex:0,"@media print":{colorAdjust:"exact"},backgroundColor:getColorShade(r,e.color)},"inherit"===e.color&&"buffer"!==e.variant&&{backgroundColor:"none","&::before":{content:'""',position:"absolute",left:0,top:0,right:0,bottom:0,backgroundColor:"currentColor",opacity:.3}},"buffer"===e.variant&&{backgroundColor:"transparent"},"query"===e.variant&&{transform:"rotate(180deg)"})),S=(0,h.ZP)("span",{name:"MuiLinearProgress",slot:"Dashed",overridesResolver:(e,r)=>{let{ownerState:t}=e;return[r.dashed,r[`dashedColor${(0,c.Z)(t.color)}`]]}})(({ownerState:e,theme:r})=>{let t=getColorShade(r,e.color);return(0,n.Z)({position:"absolute",marginTop:0,height:"100%",width:"100%"},"inherit"===e.color&&{opacity:.3},{backgroundImage:`radial-gradient(${t} 0%, ${t} 16%, transparent 42%)`,backgroundSize:"10px 10px",backgroundPosition:"0 -23px"})},(0,s.iv)(C||(C=_`
    animation: ${0} 3s infinite linear;
  `),k)),N=(0,h.ZP)("span",{name:"MuiLinearProgress",slot:"Bar1",overridesResolver:(e,r)=>{let{ownerState:t}=e;return[r.bar,r[`barColor${(0,c.Z)(t.color)}`],("indeterminate"===t.variant||"query"===t.variant)&&r.bar1Indeterminate,"determinate"===t.variant&&r.bar1Determinate,"buffer"===t.variant&&r.bar1Buffer]}})(({ownerState:e,theme:r})=>(0,n.Z)({width:"100%",position:"absolute",left:0,bottom:0,top:0,transition:"transform 0.2s linear",transformOrigin:"left",backgroundColor:"inherit"===e.color?"currentColor":(r.vars||r).palette[e.color].main},"determinate"===e.variant&&{transition:"transform .4s linear"},"buffer"===e.variant&&{zIndex:1,transition:"transform .4s linear"}),({ownerState:e})=>("indeterminate"===e.variant||"query"===e.variant)&&(0,s.iv)(Z||(Z=_`
      width: auto;
      animation: ${0} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
    `),j)),M=(0,h.ZP)("span",{name:"MuiLinearProgress",slot:"Bar2",overridesResolver:(e,r)=>{let{ownerState:t}=e;return[r.bar,r[`barColor${(0,c.Z)(t.color)}`],("indeterminate"===t.variant||"query"===t.variant)&&r.bar2Indeterminate,"buffer"===t.variant&&r.bar2Buffer]}})(({ownerState:e,theme:r})=>(0,n.Z)({width:"100%",position:"absolute",left:0,bottom:0,top:0,transition:"transform 0.2s linear",transformOrigin:"left"},"buffer"!==e.variant&&{backgroundColor:"inherit"===e.color?"currentColor":(r.vars||r).palette[e.color].main},"inherit"===e.color&&{opacity:.3},"buffer"===e.variant&&{backgroundColor:getColorShade(r,e.color),transition:"transform .4s linear"}),({ownerState:e})=>("indeterminate"===e.variant||"query"===e.variant)&&(0,s.iv)(y||(y=_`
      width: auto;
      animation: ${0} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
    `),w)),$=o.forwardRef(function(e,r){let t=(0,f.Z)({props:e,name:"MuiLinearProgress"}),{className:o,color:l="primary",value:s,valueBuffer:d,variant:c="indeterminate"}=t,h=(0,a.Z)(t,b),m=(0,n.Z)({},t,{color:l,variant:c}),p=useUtilityClasses(m),v=(0,u.Z)(),x={},C={bar1:{},bar2:{}};if(("determinate"===c||"buffer"===c)&&void 0!==s){x["aria-valuenow"]=Math.round(s),x["aria-valuemin"]=0,x["aria-valuemax"]=100;let e=s-100;"rtl"===v.direction&&(e=-e),C.bar1.transform=`translateX(${e}%)`}if("buffer"===c&&void 0!==d){let e=(d||0)-100;"rtl"===v.direction&&(e=-e),C.bar2.transform=`translateX(${e}%)`}return(0,g.jsxs)(P,(0,n.Z)({className:(0,i.Z)(p.root,o),ownerState:m,role:"progressbar"},x,{ref:r},h,{children:["buffer"===c?(0,g.jsx)(S,{className:p.dashed,ownerState:m}):null,(0,g.jsx)(N,{className:p.bar1,ownerState:m,style:C.bar1}),"determinate"===c?null:(0,g.jsx)(M,{className:p.bar2,ownerState:m,style:C.bar2})]}))});r.Z=$},28962:function(e,r,t){"use strict";t.d(r,{E:function(){return getLinearProgressUtilityClass}});var a=t(1977),n=t(8027);function getLinearProgressUtilityClass(e){return(0,n.ZP)("MuiLinearProgress",e)}let o=(0,a.Z)("MuiLinearProgress",["root","colorPrimary","colorSecondary","determinate","indeterminate","buffer","query","dashed","dashedColorPrimary","dashedColorSecondary","bar","barColorPrimary","barColorSecondary","bar1Indeterminate","bar1Determinate","bar1Buffer","bar2Indeterminate","bar2Buffer"]);r.Z=o},93790:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboards/admin/AdminAnalyticsProject",function(){return t(38633)}])},38633:function(e,r,t){"use strict";t.r(r);var a=t(85893),n=t(67294),o=t(99226),i=t(66242),l=t(15861),s=t(78445),d=t(63580),c=t(88441),u=t(34386),h=t(93946),f=t(38333),m=t(18972),g=t(57976),b=t(87066),p=t(13004),v=t(81406),x=t(42412);let getInitials=e=>{let r=e.split(" "),t=r[0]?r[0][0]:"",a=r[1]?r[1][0]:"";return"".concat(t).concat(a)},renderName=e=>{let r=getInitials(e.organizationName||"Unknown Organization");return(r.charAt(0),e.avatar)?(0,a.jsx)(p.Z,{src:e.avatar,sx:{mr:2.5,width:38,height:38}}):(0,a.jsx)(p.Z,{skin:"light",color:e.avatarColor||"primary",sx:{mr:2.5,width:38,height:38,fontWeight:"600",fontSize:e=>e.typography.body1.fontSize,backgroundColor:"#F1F1F1"},children:r})};r.default=e=>{let{state:r}=e,[t,p]=(0,n.useState)(null),[C,Z]=(0,n.useState)(!1),[y,j]=(0,n.useState)(""),[w,k]=(0,n.useState)("week"),[P,S]=(0,n.useState)(null);(0,n.useEffect)(()=>{let fetchData=async()=>{Z(!0);let e=localStorage.getItem("userData"),t=JSON.parse(e);if(null!==t){var a;null===(a=t[0])||void 0===a||a.organizationKeyId}let n=window.localStorage.getItem(x.Z.storageTokenKeyName);try{let e=await b.Z.get("".concat(v.Ao,"/api/admin-dashboard/organizations?time=").concat(w,"&states=").concat(r.map(e=>e.value).join(",")),{headers:{Authorization:"Bearer ".concat(n)}});p(e.data),Z(!1)}catch(e){console.error("Error fetching data:",e),Z(!1)}};(r.length>0||0===r.length)&&fetchData()},[y,w,r]);let N=[{flex:.1,field:"organizationName",minWidth:220,headerName:"Organization Name",renderCell:e=>{let{row:r}=e,{organizationName:t}=r;return(0,a.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center"},children:[renderName(r),(0,a.jsx)(o.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,a.jsx)(u.Z,{title:t,arrow:!0,children:(0,a.jsx)(l.Z,{noWrap:!0,sx:{color:"text.secondary",fontWeight:500},children:t})})})]})}},{flex:.1,minWidth:105,field:"customerCount",headerName:"Customer Count",renderCell:e=>{let{row:r}=e;return(0,a.jsx)(l.Z,{sx:{color:"text.secondary"},children:r.orderCount})}},{flex:.1,minWidth:105,field:"orderCount",headerName:"Order Count",renderCell:e=>{let{row:r}=e;return(0,a.jsx)(l.Z,{sx:{color:"text.secondary"},children:r.orderCount})}},{flex:.1,minWidth:105,field:"revenueAmount",headerName:"Revenue Amount",renderCell:e=>{let{row:r}=e;return(0,a.jsx)(l.Z,{sx:{color:"text.secondary"},children:r.revenueAmount})}}],handleClose=()=>{S(null)},handleOptionChange=e=>{k(e),handleClose()};return t?(0,a.jsxs)(i.Z,{sx:{height:"430px",display:"flex",flexDirection:"column"},children:[(0,a.jsx)(s.Z,{title:"Organization",subheader:"Top Revenue Organizations",titleTypographyProps:{sx:{mb:[2,0]}},action:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.Z,{size:"small",sx:{color:"text.disabled"},onClick:e=>{S(e.currentTarget)},children:(0,a.jsx)(g.Z,{})}),(0,a.jsxs)(f.Z,{anchorEl:P,open:!!P,onClose:handleClose,children:[(0,a.jsx)(m.Z,{onClick:()=>handleOptionChange("week"),children:"Week"}),(0,a.jsx)(m.Z,{onClick:()=>handleOptionChange("month"),children:"Month"}),(0,a.jsx)(m.Z,{onClick:()=>handleOptionChange("six month"),children:"Six Month"}),(0,a.jsx)(m.Z,{onClick:()=>handleOptionChange("year"),children:"Year"})]})]}),sx:{py:4,flexDirection:["column","row"],"& .MuiCardHeader-action":{m:0},alignItems:["flex-start","center"]}}),C?(0,a.jsx)(c.Z,{sx:{height:4}}):(0,a.jsx)(d._,{autoHeight:!0,rowHeight:60,rows:t,columns:N,getRowId:e=>e.organizationId,pagination:!1,pageSize:t.length})]}):null}}},function(e){e.O(0,[6125,3580,9774,2888,179],function(){return e(e.s=93790)}),_N_E=e.O()}]);