@zydon/common 2.9.80 → 2.9.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-OZTGZSNN.js +14 -0
- package/dist/chunk-OZTGZSNN.js.map +1 -0
- package/dist/components/Analytics/OverviewAnalytics/index.d.ts +4 -2
- package/dist/components/Analytics/OverviewAnalytics/index.js +10 -10
- package/dist/components/Analytics/OverviewAnalytics/index.js.map +1 -1
- package/dist/components/Analytics/PartnerAnalysis/index.js +1 -1
- package/dist/components/Analytics/index.d.ts +6 -1
- package/dist/components/Analytics/index.js +1 -1
- package/dist/types/overviewAnalytics.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunk-RTXMZGBW.js +0 -14
- package/dist/chunk-RTXMZGBW.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { a as a$1 } from './chunk-FMFS42U2.js';
|
|
2
|
+
import a from '@mui/material/Box';
|
|
3
|
+
import f from '@mui/material/Card';
|
|
4
|
+
import b from '@mui/material/CardHeader';
|
|
5
|
+
import y from '@mui/material/Checkbox';
|
|
6
|
+
import t from '@mui/material/Stack';
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
8
|
+
import g from '@mui/material/Typography';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var w=styled(f)(({theme:o})=>({width:"100%",border:`1px solid ${o.palette.divider}`,boxShadow:"none",overflow:"visible"})),k=styled(b)(({theme:o})=>({[o.breakpoints.down("sm")]:{flexWrap:"wrap",gap:o.spacing(2),"& .MuiCardHeader-action":{width:"100%"}}})),S=styled(t)({position:"relative",width:"100%",overflow:"visible","& .recharts-wrapper, & .recharts-wrapper *":{outline:"none !important",boxShadow:"none !important",WebkitTapHighlightColor:"transparent"}}),v=styled(a)(({theme:o})=>({backgroundColor:o.palette.background.paper,border:"1px solid",borderColor:o.palette.divider,borderRadius:o.shape.borderRadius,padding:o.spacing(1.5),boxShadow:o.shadows[3]})),T=styled(a)(({theme:o})=>({width:"100%",height:"1px",backgroundColor:o.palette.divider,marginBottom:o.spacing(1.5)})),D=styled(a,{shouldForwardProp:o=>o!=="dotColor"})(({dotColor:o})=>({width:10,height:10,borderRadius:"50%",backgroundColor:o})),I=styled(t)({flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:16,marginTop:16}),H=styled(t)({flexDirection:"row",alignItems:"center",cursor:"pointer"}),R=styled(y,{shouldForwardProp:o=>o!=="checkboxColor"})(({checkboxColor:o})=>({color:o,"&.Mui-checked":{color:o},padding:4})),A=styled(t)({flexDirection:"row",alignItems:"flex-start",gap:32,marginBottom:24,flexWrap:"wrap"}),E=styled(a)(({theme:o})=>({width:"1px",height:40,backgroundColor:o.palette.divider,alignSelf:"center"})),P=styled(t)({minHeight:350,alignItems:"center",justifyContent:"center",gap:12});var W=({title:o="Nenhum dado dispon\xEDvel ainda",description:e="Assim que houver registros, os dados ser\xE3o exibidos aqui."})=>jsxs(t,{minHeight:300,alignItems:"center",justifyContent:"center",gap:1.5,children:[jsx(a$1,{icon:"CALENDAR_TODAY",width:60,color:"text.secondary"}),jsxs(t,{textAlign:"center",children:[jsx(g,{variant:"subtitle1",children:o}),jsx(g,{variant:"body2",color:"text.secondary",children:e})]})]}),J=W;var L=o=>{let{x:e,y:d,payload:i,tickFormatter:l,index:C=0,maxChars:s=10}=o;if(e==null||d==null||!i)return null;let n=l?l(i.value,C):i.value,u=n.length>s?`${n.slice(0,s)}...`:n;return jsx("g",{transform:`translate(${e},${d})`,children:jsx("text",{x:0,y:0,dy:4,textAnchor:"end",fill:"#637381",fontSize:11,transform:"rotate(-45)",children:u})})},U=L;
|
|
12
|
+
|
|
13
|
+
export { w as a, k as b, S as c, v as d, T as e, D as f, I as g, H as h, R as i, A as j, E as k, P as l, J as m, U as n };
|
|
14
|
+
//# sourceMappingURL=chunk-OZTGZSNN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Analytics/ChartStyles/styles.ts","../src/components/Analytics/EmptyState/index.tsx","../src/components/Analytics/RotatedTick/index.tsx"],"names":["Box","MuiCard","MuiCardHeader","MuiCheckbox","Stack","styled","ChartCard","theme","ChartCardHeader","ChartWrapper","TooltipContainer","TooltipDivider","TooltipDot","prop","dotColor","LegendContainer","LegendItem","ColoredCheckbox","checkboxColor","SummaryStack","SummaryDivider","EmptyStateContainer","Typography","jsx","jsxs","EmptyState","title","description","Icon_default","EmptyState_default","RotatedTick","props","x","y","payload","tickFormatter","index","maxChars","raw","label","RotatedTick_default"],"mappings":"wCAAA,OAAOA,MAAS,oBAChB,OAAOC,MAAa,qBACpB,OAAOC,MAAmB,2BAC1B,OAAOC,MAAiB,yBACxB,OAAOC,MAAW,sBAClB,OAAS,UAAAC,MAAc,uBAEhB,IAAMC,EAAYD,EAAOJ,CAAO,EAAE,CAAC,CAAE,MAAAM,CAAM,KAAO,CACvD,MAAO,OAEP,OAAQ,aAAaA,EAAM,QAAQ,UAEnC,UAAW,OACX,SAAU,SACZ,EAAE,EAEWC,EAAkBH,EAAOH,CAAa,EAAE,CAAC,CAAE,MAAAK,CAAM,KAAO,CACnE,CAACA,EAAM,YAAY,KAAK,IAAI,CAAC,EAAG,CAC9B,SAAU,OACV,IAAKA,EAAM,QAAQ,CAAC,EAEpB,0BAA2B,CACzB,MAAO,MACT,CACF,CACF,EAAE,EAEWE,EAAeJ,EAAOD,CAAK,EAAE,CACxC,SAAU,WACV,MAAO,OACP,SAAU,UAEV,6CAA8C,CAC5C,QAAS,kBACT,UAAW,kBACX,wBAAyB,aAC3B,CACF,CAAC,EAEYM,EAAmBL,EAAOL,CAAG,EAAE,CAAC,CAAE,MAAAO,CAAM,KAAO,CAC1D,gBAAiBA,EAAM,QAAQ,WAAW,MAC1C,OAAQ,YACR,YAAaA,EAAM,QAAQ,QAC3B,aAAcA,EAAM,MAAM,aAC1B,QAASA,EAAM,QAAQ,GAAG,EAC1B,U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,8DAChB,IAEIH,EAACpB,EAAA,CACC,UAAW,IACX,WAAW,SACX,eAAe,SACf,IAAK,IAEL,UAAAmB,EAACK,EAAA,CAAK,KAAK,iBAAiB,MAAO,GAAI,MAAM,iBAAiB,EAE9DJ,EAACpB,EAAA,CAAM,UAAU,SACf,UAAAmB,EAACD,EAAA,CAAW,QAAQ,YAAa,SAAAI,EAAM,EAEvCH,EAACD,EAAA,CAAW,QAAQ,QAAQ,MAAM,iBAC/B,SAAAK,EACH,GACF,GACF,EAIGE,EAAQJ,EClBT,cAAAF,MAAA,oBAXN,IAAMO,EAAeC,GAA4B,CAC/C,GAAM,CAAE,EAAAC,EAAG,EAAAC,EAAG,QAAAC,EAAS,cAAAC,EAAe,MAAAC,EAAQ,EAAG,SAAAC,EAAW,EAAG,EAAIN,EACnE,GAAIC,GAAK,MAAQC,GAAK,MAAQ,CAACC,EAAS,OAAO,KAE/C,IAAMI,EAAMH,EACRA,EAAcD,EAAQ,MAAOE,CAAK,EAClCF,EAAQ,MACNK,EAAQD,EAAI,OAASD,EAAW,GAAGC,EAAI,MAAM,EAAGD,CAAQ,OAASC,EAEvE,OACEf,EAAC,KAAE,UAAW,aAAaS,KAAKC,KAC9B,SAAAV,EAAC,QACC,EAAG,EACH,EAAG,EACH,GAAI,EACJ,WAAW,MACX,KAAK,UACL,SAAU,GACV,UAAU,cAET,SAAAgB,EACH,EACF,CAEJ,EAEOC,EAAQV","sourcesContent":["import Box from '@mui/material/Box';\nimport MuiCard from '@mui/material/Card';\nimport MuiCardHeader from '@mui/material/CardHeader';\nimport MuiCheckbox from '@mui/material/Checkbox';\nimport Stack from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\n\nexport const ChartCard = styled(MuiCard)(({ theme }) => ({\n width: '100%',\n\n border: `1px solid ${theme.palette.divider}`,\n\n boxShadow: 'none',\n overflow: 'visible',\n}));\n\nexport const ChartCardHeader = styled(MuiCardHeader)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n flexWrap: 'wrap',\n gap: theme.spacing(2),\n\n '& .MuiCardHeader-action': {\n width: '100%',\n },\n },\n}));\n\nexport const ChartWrapper = styled(Stack)({\n position: 'relative',\n width: '100%',\n overflow: 'visible',\n\n '& .recharts-wrapper, & .recharts-wrapper *': {\n outline: 'none !important',\n boxShadow: 'none !important',\n WebkitTapHighlightColor: 'transparent',\n },\n});\n\nexport const TooltipContainer = styled(Box)(({ theme }) => ({\n backgroundColor: theme.palette.background.paper,\n border: '1px solid',\n borderColor: theme.palette.divider,\n borderRadius: theme.shape.borderRadius,\n padding: theme.spacing(1.5),\n boxShadow: theme.shadows[3],\n}));\n\nexport const TooltipDivider = styled(Box)(({ theme }) => ({\n width: '100%',\n height: '1px',\n backgroundColor: theme.palette.divider,\n marginBottom: theme.spacing(1.5),\n}));\n\nexport const TooltipDot = styled(Box, {\n shouldForwardProp: prop => prop !== 'dotColor',\n})<{ dotColor: string }>(({ dotColor }) => ({\n width: 10,\n height: 10,\n borderRadius: '50%',\n backgroundColor: dotColor,\n}));\n\nexport const LegendContainer = styled(Stack)({\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n marginTop: 16,\n});\n\nexport const LegendItem = styled(Stack)({\n flexDirection: 'row',\n alignItems: 'center',\n cursor: 'pointer',\n});\n\nexport const ColoredCheckbox = styled(MuiCheckbox, {\n shouldForwardProp: prop => prop !== 'checkboxColor',\n})<{ checkboxColor: string }>(({ checkboxColor }) => ({\n color: checkboxColor,\n '&.Mui-checked': { color: checkboxColor },\n padding: 4,\n}));\n\nexport const SummaryStack = styled(Stack)({\n flexDirection: 'row',\n alignItems: 'flex-start',\n gap: 32,\n marginBottom: 24,\n flexWrap: 'wrap',\n});\n\nexport const SummaryDivider = styled(Box)(({ theme }) => ({\n width: '1px',\n height: 40,\n backgroundColor: theme.palette.divider,\n alignSelf: 'center',\n}));\n\nexport const EmptyStateContainer = styled(Stack)({\n minHeight: 350,\n alignItems: 'center',\n justifyContent: 'center',\n gap: 12,\n});\n","import Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport Icon from 'components/Icon';\n\nimport { EmptyStateProps } from './props';\n\nconst EmptyState = ({\n title = 'Nenhum dado disponível ainda',\n description = 'Assim que houver registros, os dados serão exibidos aqui.',\n}: EmptyStateProps) => {\n return (\n <Stack\n minHeight={300}\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={1.5}\n >\n <Icon icon=\"CALENDAR_TODAY\" width={60} color=\"text.secondary\" />\n\n <Stack textAlign=\"center\">\n <Typography variant=\"subtitle1\">{title}</Typography>\n\n <Typography variant=\"body2\" color=\"text.secondary\">\n {description}\n </Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default EmptyState;\n","import { RotatedTickProps } from './props';\n\nconst RotatedTick = (props: RotatedTickProps) => {\n const { x, y, payload, tickFormatter, index = 0, maxChars = 10 } = props;\n if (x == null || y == null || !payload) return null;\n\n const raw = tickFormatter\n ? tickFormatter(payload.value, index)\n : payload.value;\n const label = raw.length > maxChars ? `${raw.slice(0, maxChars)}...` : raw;\n\n return (\n <g transform={`translate(${x},${y})`}>\n <text\n x={0}\n y={0}\n dy={4}\n textAnchor=\"end\"\n fill=\"#637381\"\n fontSize={11}\n transform=\"rotate(-45)\"\n >\n {label}\n </text>\n </g>\n );\n};\n\nexport default RotatedTick;\n"]}
|
|
@@ -15,7 +15,7 @@ interface OrdersByTypeProps {
|
|
|
15
15
|
|
|
16
16
|
declare const OrdersByType: ({ data, isFetching, viewMode, selectedYear, DetailComponent, }: OrdersByTypeProps) => react_jsx_runtime.JSX.Element;
|
|
17
17
|
|
|
18
|
-
declare const OverviewDetail: ({ open, onClose, title, viewMode, selectedYear, totalValue, periodLabel, suffix, rows, total, isLoading, isFetching, page, perPage, onSearch, onPaginationChange, buildPartnerLink, mobileItemSlot, }: OverviewDetailProps) => react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare const OverviewDetail: ({ open, onClose, title, viewMode, selectedYear, totalValue, periodLabel, suffix, rows, total, isLoading, isFetching, page, perPage, onSearch, onPaginationChange, buildPartnerLink, mobileItemSlot, hideStatus, }: OverviewDetailProps) => react_jsx_runtime.JSX.Element;
|
|
19
19
|
|
|
20
20
|
declare const useOverviewDetailState: (label: string, viewMode: ViewMode) => {
|
|
21
21
|
page: number;
|
|
@@ -42,9 +42,11 @@ interface SalesEvolutionProps {
|
|
|
42
42
|
selectedYear: number;
|
|
43
43
|
editGoalAction?: ReactNode;
|
|
44
44
|
DetailComponent?: ComponentType<OverviewDetailBaseProps>;
|
|
45
|
+
hideGoal?: boolean;
|
|
46
|
+
emptyMessage?: string;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
declare const SalesEvolution: ({ data, isFetching, kpis, viewMode, selectedYear, editGoalAction, DetailComponent, }: SalesEvolutionProps) => react_jsx_runtime.JSX.Element;
|
|
49
|
+
declare const SalesEvolution: ({ data, isFetching, kpis, viewMode, selectedYear, editGoalAction, DetailComponent, hideGoal, emptyMessage, }: SalesEvolutionProps) => react_jsx_runtime.JSX.Element;
|
|
48
50
|
|
|
49
51
|
interface SalesForecastProps {
|
|
50
52
|
data: SalesForecastDashboardSeriesItem[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b, c, d as d$3 } from '../../../chunk-FYG3YWFZ.js';
|
|
2
|
-
import { a, m, c as c$1, n } from '../../../chunk-
|
|
2
|
+
import { a, m, c as c$1, n } from '../../../chunk-OZTGZSNN.js';
|
|
3
3
|
import { a as a$2 } from '../../../chunk-Q2R3X4EB.js';
|
|
4
4
|
import { a as a$8 } from '../../../chunk-DRGARBKB.js';
|
|
5
5
|
import { a as a$7 } from '../../../chunk-NDX5YJV7.js';
|
|
@@ -31,19 +31,19 @@ import '../../../chunk-LQRRMVFN.js';
|
|
|
31
31
|
import '../../../chunk-Y66XXBB3.js';
|
|
32
32
|
import { a as a$6 } from '../../../chunk-HFDGIEZC.js';
|
|
33
33
|
import { useState, useCallback, useMemo, useRef } from 'react';
|
|
34
|
-
import
|
|
35
|
-
import
|
|
34
|
+
import yt from '@mui/material/CardContent';
|
|
35
|
+
import gt from '@mui/material/CardHeader';
|
|
36
36
|
import L from '@mui/material/Stack';
|
|
37
37
|
import { ResponsiveContainer, BarChart, CartesianGrid, XAxis, YAxis, Tooltip, Bar, ComposedChart, Line } from 'recharts';
|
|
38
38
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
39
|
+
import be from '@mui/material/Divider';
|
|
40
|
+
import T from '@mui/material/Typography';
|
|
41
|
+
import Je from '@mui/material/Checkbox';
|
|
42
|
+
import Ze from '@mui/material/FormControlLabel';
|
|
43
|
+
import Lt from '@mui/material/Link';
|
|
44
44
|
import { styled, alpha } from '@mui/material/styles';
|
|
45
45
|
|
|
46
|
-
var te={orders:"#22C55E",quotations:"#0EA5E9"};var qo=({x:e=0,y:o=0,width:t=0,height:r=0,index:a,activeBarIndex:i})=>i!==a?null:jsx("rect",{x:e-6,y:o,width:t+12,height:r+6,fill:"#919EAB",opacity:.16,rx:6}),ze=qo;var Ko=({x:e=0,y:o=0,width:t=0,index:r=0,data:a,visibleSeries:i,isMonthly:n,shouldRotateLabels:l})=>{if(!n||l)return null;let c=a[r];if(!c)return null;let s=0;return i.orders&&(s+=c.order_count??0),i.quotations&&(s+=c.quotation_count??0),s?jsx("text",{x:e+t/2,y:o-8,textAnchor:"middle",fontSize:11,fill:"#212B36",children:s}):null},Fe=Ko;var Xo=({active:e,payload:o,label:t,viewMode:r})=>{if(!e||!o?.length)return null;let a=r==="DAILY",i=String(t),n=i.split("-");if(n.length>=2){let s=parseInt(n[1],10)-1,m=b[s];a&&n.length===3?i=`${parseInt(n[2],10)} de ${m} de ${n[0]}`:a||(i=`${m} de ${n[0]}`);}let l=o[0].payload,c=[{name:"Vendas",count:l.order_count??0,value:l.order_value??0,color:o.find(s=>s.dataKey==="order_count")?.color??"#22C55E"},{name:"Or\xE7amentos",count:l.quotation_count??0,value:l.quotation_value??0,color:o.find(s=>s.dataKey==="quotation_count")?.color??"#0EA5E9"}];return jsxs(a$8,{minWidth:{xs:"auto",sm:300},p:1,gap:1,children:[jsx(M,{variant:"body2",color:"text.secondary",children:i}),jsx(ye,{}),jsx(L,{children:c.map((s,m)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:2,"data-testid":`tooltip-item-${m}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:s.color}),jsx(M,{variant:"body2",noWrap:!0,children:s.name})]}),jsxs(M,{variant:"body2",color:"text.disabled",noWrap:!0,children:[s.count," ",s.count===1?"pedido":"pedidos","\u2002",jsx(M,{component:"span",variant:"body2",color:"text.primary",children:h(s.value)})]})]},s.name))})]})},uo=Xo;var nt=({data:e,viewMode:o,visibleSeries:t,activeBarIndex:r,onMouseMove:a,onMouseLeave:i,onBarClick:n$1})=>{let l=o==="MONTHLY",[c$2,s]=useState(0),m=useRef(null),p=useCallback(u=>{m.current&&(m.current.disconnect(),m.current=null),u&&(s(u.clientWidth),m.current=new ResizeObserver(()=>s(u.clientWidth)),m.current.observe(u));},[]),d=useMemo(()=>!l||c$2===0||e.length===0?!1:(c$2-60)/e.length<80,[l,c$2,e.length]),y=useMemo(()=>e.some(u=>(u.order_count??0)>0),[e]),v=useMemo(()=>e.some(u=>(u.quotation_count??0)>0),[e]),k=useMemo(()=>{if(!e.length)return [0,1];let u=Math.max(...e.map(g=>(g.order_count??0)+(g.quotation_count??0)));return [0,u>0?u*1.15:1]},[e]),S=useMemo(()=>{let[,u]=k,g=u/6;return [...new Set(Array.from({length:7},(R,x)=>Math.round(g*x)))]},[k]),h=t.quotations&&v,b=t.orders&&y&&!h,P=useMemo(()=>l?c:d$3,[l]);return jsx(c$1,{ref:p,children:jsx(ResponsiveContainer,{width:"100%",height:250,children:jsxs(BarChart,{data:e,margin:{top:20,right:10,bottom:d?-90:0,left:20},barCategoryGap:"20%",style:{cursor:"pointer"},onMouseMove:a,onMouseLeave:i,onClick:u=>{u?.activeTooltipIndex!=null&&n$1?.(Number(u.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...d&&{interval:0,height:120},tick:d?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:P}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:u=>d$1(u),domain:k,ticks:S}),jsx(Tooltip,{content:jsx(uo,{viewMode:o}),cursor:!1}),jsx(Bar,{dataKey:"order_count",name:"Vendas",fill:te.orders,stackId:"orders",maxBarSize:48,isAnimationActive:!1,hide:!t.orders,background:jsx(ze,{activeBarIndex:r}),radius:b?[4,4,0,0]:void 0,...b&&{label:{position:"top",fontSize:11,fill:"#212B36",content:jsx(Fe,{data:e,visibleSeries:t,isMonthly:l,shouldRotateLabels:d})}}}),jsx(Bar,{dataKey:"quotation_count",name:"Or\xE7amentos",fill:te.quotations,stackId:"orders",maxBarSize:48,isAnimationActive:!1,hide:!t.quotations,radius:h?[4,4,0,0]:void 0,...!t.orders&&{background:jsx(ze,{activeBarIndex:r})},...h&&{label:{position:"top",fontSize:11,fill:"#212B36",content:jsx(Fe,{data:e,visibleSeries:t,isMonthly:l,shouldRotateLabels:d})}}})]})})})},yo=nt;var ct=({visibleSeries:e,onToggleSerie:o})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ue,{control:jsx(Qe,{checked:e.orders,onChange:()=>o("orders"),sx:{"&.Mui-checked":{color:te.orders}}}),label:"Vendas"}),jsx(Ue,{control:jsx(Qe,{checked:e.quotations,onChange:()=>o("quotations"),sx:{"&.Mui-checked":{color:te.quotations}}}),label:"Or\xE7amentos"})]}),bo=ct;var mt=({ordersTotal:e,quotationsTotal:o,isMonthly:t})=>{let r=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[r&&jsx(ye,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsx(M,{variant:"body2",color:"text.secondary",children:t?"Vendas no ano":"Vendas no m\xEAs"}),jsxs(M,{variant:"subtitle2",children:[e," vendas"]})]}),jsx(ye,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsx(M,{variant:"body2",color:"text.secondary",children:t?"Or\xE7amentos no ano":"Or\xE7amentos no m\xEAs"}),jsxs(M,{variant:"subtitle2",children:[o," or\xE7amentos"]})]})]})},Ve=mt;var ht=({data:e,isFetching:o,viewMode:t,selectedYear:r,DetailComponent:a$3})=>{let i=t==="MONTHLY",[n,l]=useState({orders:!0,quotations:!0}),[c,s]=useState(null),[m$1,p]=useState(!1),[d,y]=useState(""),[v,k]=useState(0),S=useCallback(R=>{l(x=>({...x,[R]:!x[R]}));},[]),h=useCallback(R=>{R?.activeTooltipIndex!=null&&s(Number(R.activeTooltipIndex));},[]),b=useCallback(()=>s(null),[]),P=useCallback(R=>{let x=e[R];x&&(y(x.label),k(x.order_value),p(!0));},[e]),u=useCallback(()=>{p(!1);},[]),g=useMemo(()=>{let R=e.reduce((D,$)=>D+($.order_count??0),0),x=e.reduce((D,$)=>D+($.quotation_count??0),0);return {ordersTotal:R,quotationsTotal:x}},[e]);return jsxs(Fragment,{children:[jsxs(a,{children:[jsx(ut,{title:"Quantidade de pedidos por tipo"}),jsx(ft,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(Ve,{isMonthly:i,ordersTotal:g.ordersTotal,quotationsTotal:g.quotationsTotal})}),jsx(a$2,{active:o,children:jsx(yo,{data:e,viewMode:t,visibleSeries:n,activeBarIndex:c,onMouseMove:h,onMouseLeave:b,onBarClick:P})}),jsx(bo,{visibleSeries:n,onToggleSerie:S}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(Ve,{isMonthly:i,ordersTotal:g.ordersTotal,quotationsTotal:g.quotationsTotal})})]})})})]}),d&&a$3&&jsx(a$3,{open:m$1,onClose:u,label:d,viewMode:t,selectedYear:r,totalValue:v})]})},yt=ht;var vt=({title:e,viewMode:o,selectedYear:t,periodLabel:r})=>jsxs(L,{width:"100%",minWidth:0,overflow:"hidden",children:[jsx(M,{variant:"subtitle1",noWrap:!0,children:"Detalhes do relat\xF3rio"}),jsxs(L,{direction:"row",alignItems:"center",columnGap:1.5,rowGap:0,flexWrap:"wrap",children:[jsx(M,{variant:"body2",color:"text.secondary",flexShrink:0,children:e}),"\u2022",jsx(M,{variant:"body2",flexShrink:0,children:b$2[o]}),"\u2022",jsx(M,{variant:"body2",flexShrink:0,children:t}),"\u2022",jsx(M,{variant:"body2",color:"text.secondary",noWrap:!0,children:r})]})]}),ko=vt;var Mo=styled(ye)(()=>({height:30,alignSelf:"center",borderStyle:"dashed"})),Lo=styled(L)(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",padding:e.spacing(2),gap:e.spacing(1),color:e.palette.text.primary,"& a":{textDecoration:"none"},"&+div":{borderTop:`1px dashed ${alpha(e.palette.grey[500],.2)}`}}));var Tt=e=>jsx(L,{justifyContent:"center",height:1,children:jsx(M,{variant:"body2",color:"text.primary",children:e.id})}),Mt=(e,o)=>jsx(L,{justifyContent:"center",height:1,children:e?.partner?.id&&o?jsx(kt,{component:"a",href:o(e.partner.id),target:"_blank",rel:"noopener noreferrer",variant:"subtitle2",sx:{textDecoration:"underline"},noWrap:!0,children:e.partner?.name||"-"}):jsx(M,{variant:"body2",color:"text.primary",noWrap:!0,children:e.partner?.name||"-"})}),Lt=e=>jsx(L,{justifyContent:"center",height:1,children:jsx(M,{variant:"body2",color:"text.primary",children:h(e.total_value)})}),Dt=e=>jsx(L,{justifyContent:"center",height:1,children:e.negotiation_date?jsx(M,{variant:"body2",color:"text.primary",children:d$2(e.negotiation_date,"DD/MM/YYYY")}):"-"}),wt=e=>jsx(L,{justifyContent:"center",height:1,children:e.status||"-"}),Bt=e=>jsx(Lo,{children:jsxs(L,{gap:1,children:[jsxs(L,{children:[jsx(M,{variant:"body2",color:"text.secondary",children:"Pedido"}),jsx(M,{variant:"subtitle2",color:"text.primary",children:e.id})]}),jsxs(L,{children:[jsx(M,{variant:"body2",color:"text.secondary",children:"Cliente"}),jsx(M,{variant:"subtitle2",color:"primary.main",children:e.partner?.name||"-"})]}),jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsxs(L,{flex:1,overflow:"hidden",children:[jsx(M,{variant:"body2",color:"text.secondary",noWrap:!0,children:"Valor do pedido"}),jsx(M,{variant:"subtitle2",color:"text.primary",noWrap:!0,children:h(e.total_value)})]}),jsx(ye,{orientation:"vertical",flexItem:!0,sx:{borderStyle:"dashed",mx:3}}),jsxs(L,{flex:1,overflow:"hidden",children:[jsx(M,{variant:"body2",color:"text.secondary",noWrap:!0,children:"Data"}),jsx(M,{variant:"subtitle2",color:"text.primary",noWrap:!0,children:e.negotiation_date?d$2(e.negotiation_date,"DD/MM/YYYY"):"-"})]})]}),jsxs(L,{gap:.5,children:[jsx(M,{variant:"body2",color:"text.secondary",children:"Status"}),jsx(M,{variant:"subtitle2",color:"text.primary",children:e.status||"-"})]})]})},e.id),Pt=({open:e,onClose:o,title:t,viewMode:r,selectedYear:a,totalValue:i,periodLabel:n,suffix:l,rows:c,total:s,isLoading:m,isFetching:p,page:d$1,perPage:y,onSearch:v,onPaginationChange:k,buildPartnerLink:S,mobileItemSlot:h$1})=>{let b=b$1("down","sm"),P=jsxs(L,{gap:3,children:[jsxs(L,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",gap:2,children:[jsxs(L,{minWidth:0,direction:"row",alignItems:"center",gap:3,flexWrap:"wrap",children:[jsxs(L,{children:[jsxs(M,{variant:"body2",color:"text.secondary",children:["Vendas ",l]}),jsx(M,{variant:"subtitle2",color:"text.primary",children:h(i)})]}),jsx(Mo,{orientation:"vertical",flexItem:!0}),jsxs(L,{children:[jsxs(M,{variant:"body2",color:"text.secondary",children:["Qtd. de pedidos ",l]}),jsx(M,{variant:"subtitle2",color:"text.primary",children:s})]})]}),jsx(a$3,{size:"small",placeholder:"Buscar",onSearch:v,trigger:"change",iconPosition:"start",sx:{minWidth:200}})]}),jsx(d,{title:"Pedidos",header:jsx(Fragment,{}),headerProps:{p:0},columns:[{field:"external_id",headerName:"Pedido",flex:1,renderCell:({row:g})=>Tt(g)},{field:"partner_name",headerName:"Cliente",flex:1,renderCell:({row:g})=>Mt(g,S)},{field:"total_value",headerName:"Valor do pedido",flex:1,renderCell:({row:g})=>Lt(g)},{field:"created_at",headerName:"Data",flex:1,renderCell:({row:g})=>Dt(g)},{field:"last_status",headerName:"Status",flex:1,renderCell:({row:g})=>wt(g)}],rows:c,rowCount:s,mobileRender:g=>h$1?h$1(g):Bt(g),loading:m,fetching:p,paginationModel:{page:d$1,pageSize:y},onPaginationChange:k,paginationMode:"server",disableRowSelectionOnClick:!0,disableColumnMenu:!0,containerProps:{height:400}})]}),u=jsx(ko,{title:t,viewMode:r,selectedYear:a,periodLabel:n});return b?jsx(a$4,{open:e,onClose:o,headerTitle:u,headerProps:{direction:"row-reverse",sx:{"& > :last-child":{minWidth:0,overflow:"hidden"}}},children:P}):jsx(a$5,{open:e,onClose:o,maxWidth:"lg",dialogTitle:u,dialogTitleProps:{sx:{flex:1,overflow:"hidden"}},fullWidth:!0,children:P})},Rt=Pt;var Ee=(e,o)=>{let t=e.split("-");if(o==="DAILY"&&t.length===3){let n=`${t[0]}-${t[1]}-${t[2]}`;return {startDate:n,endDate:n}}let r=parseInt(t[0],10),a=parseInt(t[1],10),i=new Date(r,a,0).getDate();return {startDate:`${t[0]}-${t[1]}-01`,endDate:`${t[0]}-${t[1]}-${String(i).padStart(2,"0")}`}},Ne=(e,o)=>{let t=e.split("-"),r=parseInt(t[1],10)-1,a=b[r]??"";if(o==="DAILY"&&t.length===3){let i=parseInt(t[2],10);return `${a} - Dia ${i}`}return a},$e=e=>e==="MONTHLY"?"no m\xEAs":"no dia";var zt=(e,o)=>{let{page:t,perPage:r,search:a,handlePaginationModelChange:i,handleSearch:n}=a$6(),{startDate:l,endDate:c}=useMemo(()=>Ee(e,o),[e,o]),s=useMemo(()=>Ne(e,o),[e,o]),m=$e(o),p=useMemo(()=>({page:t,perPage:r,...a?{search:a}:{},filter:{operator:"AND",groups:[{operator:"AND",conditionals:[{fieldName:"negotiationDate",conditional:"GREATER_THAN_OR_EQUAL",value:[`${l}T00:00:00`]},{fieldName:"negotiationDate",conditional:"LESS_THAN_OR_EQUAL",value:[`${c}T23:59:59`]}]}]}}),[c,t,r,a,l]),d=useCallback((y,v)=>{i({page:y,pageSize:v});},[i]);return {page:t,perPage:r,periodLabel:s,suffix:m,queryParams:p,handleSearch:n,handlePaginationChange:d}},Ft=zt;var T={sales:"#22C55E",forecast:"#F59E0B",goal:"#212B36"};var At=({x:e=0,y:o=0,width:t=0,height:r=0,index:a,activeBarIndex:i})=>i!==a?null:jsx("rect",{x:e-6,y:o,width:t+6*2,height:r+6,fill:T.sales,opacity:.16,rx:6}),Me=At;var _t=({active:e,payload:o,label:t,viewMode:r})=>{if(!e||!o?.length)return null;let a=r==="DAILY",i=o[0].payload,n=Number(i.realized)||0,l=Number(i.forecast)||0,c=Number(i.goal)||0,s=c>0?n/c*100:0,m=c>n?c-n:0,p=a?"no dia":"no m\xEAs",d=a?"di\xE1ria":"mensal",y=String(t),v=y.split("-");if(v.length>=2){let S=parseInt(v[1],10)-1,h=b[S];a&&v.length===3?y=`${parseInt(v[2],10)} de ${h} de ${v[0]}`:a||(y=`${h} de ${v[0]}`);}let k=[{name:`Realizado ${p}`,value:h(n),color:T.sales},{name:`Previsto ${p}`,value:h(l),color:T.forecast},{name:`Meta ${d}`,value:h(c),color:T.goal},{name:"Atingimento",value:`${s.toFixed(0)}%`,color:"#00B8D9"},{name:`GAP ${p}`,value:h(m),color:"#FF5630"}];return jsxs(a$8,{minWidth:{xs:"auto",sm:400},p:1,gap:1,children:[jsx(M,{variant:"body2",color:"text.secondary",children:y}),jsx(ye,{}),jsx(L,{children:k.map((S,h)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:3,"data-testid":`tooltip-item-${h}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:S.color}),jsx(M,{variant:"body2",noWrap:!0,children:S.name})]}),jsx(M,{variant:"body2",children:S.value})]},h))})]})},De=_t;var Qt=({data:e,visibleSeries:o,yDomain:t,yTicks:r,viewMode:a,activeBarIndex:i,onMouseMove:n,onMouseLeave:l,onBarClick:c})=>{let s=useCallback(m=>d$1(m),[]);return jsx(ResponsiveContainer,{width:"100%",height:350,children:jsxs(ComposedChart,{data:e,margin:{top:20,right:10,bottom:0,left:20},style:{cursor:"pointer"},onMouseMove:n,onMouseLeave:l,onClick:m=>{m?.activeTooltipIndex!=null&&c?.(Number(m.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:d$3}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:s,domain:t,ticks:r}),jsx(Tooltip,{content:jsx(De,{viewMode:a})}),jsx(Bar,{dataKey:"realized",fill:"transparent",isAnimationActive:!1,background:jsx(Me,{activeBarIndex:i})}),o.goal&&jsx(Line,{dataKey:"goal",name:"Meta",stroke:T.goal,strokeWidth:2,strokeDasharray:"8 4",dot:!1,isAnimationActive:!1}),o.realized&&jsx(Line,{dataKey:"realized",name:"Vendas",stroke:T.sales,strokeWidth:2,dot:{fill:T.sales,r:4,strokeWidth:0},isAnimationActive:!1}),o.forecast&&jsx(Line,{dataKey:"forecast",name:"Previsto",stroke:T.forecast,strokeWidth:2,strokeDasharray:"6 3",dot:{fill:T.forecast,r:4,strokeWidth:0},isAnimationActive:!1})]})})},Do=Qt;var ar=({data:e,visibleSeries:o,yDomain:t,yTicks:r,shouldRotateLabels:a,activeBarIndex:i,onMouseMove:n$1,onMouseLeave:l,onBarClick:c$1,viewMode:s})=>{let m=useMemo(()=>a?!1:{position:"top",fontSize:12,fill:"#212B36",formatter:p=>h(Number(p))},[a]);return jsx(ResponsiveContainer,{width:"100%",height:300,children:jsxs(ComposedChart,{data:e,margin:{top:20,right:10,bottom:a?-90:0,left:20},barCategoryGap:"20%",style:{cursor:"pointer"},onMouseMove:n$1,onMouseLeave:l,onClick:p=>{p?.activeTooltipIndex!=null&&c$1?.(Number(p.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...a&&{interval:0,height:120},tick:a?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:c}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:p=>d$1(p),domain:t,ticks:r}),jsx(Tooltip,{content:jsx(De,{viewMode:s})}),o.goal&&jsx(Line,{dataKey:"goal",name:"Meta",stroke:T.goal,strokeWidth:2,strokeDasharray:"8 4",dot:!1,isAnimationActive:!1}),o.realized&&jsx(Bar,{dataKey:"realized",name:"Vendas",fill:T.sales,maxBarSize:48,isAnimationActive:!1,radius:[4,4,0,0],background:jsx(Me,{activeBarIndex:i}),label:m}),o.forecast&&jsx(Line,{dataKey:"forecast",name:"Previsto",stroke:T.forecast,strokeWidth:2,strokeDasharray:"6 3",dot:{fill:T.forecast,r:4,strokeWidth:0},isAnimationActive:!1})]})})},Bo=ar;var lr=({data:e,viewMode:o,visibleSeries:t,yDomain:r,yTicks:a,formatYAxis:i,onBarClick:n})=>{let[l,c]=useState(null),[s,m]=useState(0),p=useRef(null),d=o==="MONTHLY",y=useMemo(()=>!d||s===0||e.length===0?!1:(s-60)/e.length<60,[s,e.length,d]),v=useCallback(()=>c(null),[]),k=useCallback(h=>{h?.activeTooltipIndex!=null&&c(Number(h.activeTooltipIndex));},[]),S=useCallback(h=>{p.current&&(p.current.disconnect(),p.current=null),h&&(m(h.clientWidth),p.current=new ResizeObserver(()=>m(h.clientWidth)),p.current.observe(h));},[]);return d?jsx(c$1,{ref:S,children:jsx(Bo,{data:e,visibleSeries:t,yDomain:r,yTicks:a,formatYAxis:i,shouldRotateLabels:y,activeBarIndex:l,onMouseMove:k,onMouseLeave:v,onBarClick:n,viewMode:o})}):jsx(c$1,{ref:S,children:jsx(Do,{data:e,visibleSeries:t,yDomain:r,yTicks:a,formatYAxis:i,viewMode:o,activeBarIndex:l,onMouseMove:k,onMouseLeave:v,onBarClick:n})})},Ro=lr;var pr=({visibleSeries:e,onToggleSerie:o})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ue,{control:jsx(Qe,{checked:e.realized,onChange:()=>o("realized"),sx:{"&.Mui-checked":{color:T.sales}}}),label:"Vendas"}),jsx(Ue,{control:jsx(Qe,{checked:e.forecast,onChange:()=>o("forecast"),sx:{"&.Mui-checked":{color:T.forecast}}}),label:"Previsto"}),jsx(Ue,{control:jsx(Qe,{checked:e.goal,onChange:()=>o("goal"),sx:{"&.Mui-checked":{color:T.goal}}}),label:"Meta"})]}),Oo=pr;var dr=({kpis:e,isMonthly:o,editGoalAction:t})=>{let r=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[r&&jsx(ye,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsxs(M,{variant:"body2",color:"text.secondary",children:["Previsto no ",o?"ano":"m\xEAs"]}),jsx(M,{variant:"subtitle2",children:h(e?.forecast)})]}),jsx(ye,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsxs(M,{variant:"body2",color:"text.secondary",children:["Realizado no ",o?"ano":"m\xEAs"]}),jsx(M,{variant:"subtitle2",children:h(e?.realized)})]}),jsx(ye,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsxs(L,{direction:"row",alignItems:"center",gap:3,children:[jsxs(M,{variant:"body2",color:"text.secondary",children:["Meta ",o?"anual":"mensal"]}),t]}),jsx(M,{variant:"subtitle2",children:h(e?.goal)})]}),jsx(ye,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsx(M,{variant:"body2",color:"text.secondary",children:"Atingimento"}),jsx(M,{variant:"subtitle2",children:c$2(e?.achievement??0,{maximumFractionDigits:2,minimumFractionDigits:2})})]}),jsx(ye,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsxs(L,{direction:"row",gap:.5,children:[jsxs(M,{variant:"body2",color:"text.secondary",children:["GAP do ",o?"ano":"m\xEAs"]}),jsx(a$7,{text:"Diferen\xE7a entre o valor realizado e a meta. Um GAP significa que as vendas ainda est\xE3o abaixo do objetivo definido para o per\xEDodo.",width:18,arrow:!0,sx:{mt:-.1}})]}),jsx(M,{variant:"subtitle2",children:h(e?.gap)})]})]})},Xe=dr;var hr=({data:e,isFetching:o,kpis:t,viewMode:r,selectedYear:a$3,editGoalAction:i,DetailComponent:n})=>{let[l,c]=useState({realized:!0,forecast:!0,goal:!0}),[s,m$1]=useState(!1),[p,d]=useState(""),[y,v]=useState(0),k=r==="MONTHLY",S=useMemo(()=>{if(!e.length)return [0,1];let x=e.flatMap($=>[Number($.realized)||0,Number($.forecast)||0,Number($.goal)||0]),D=Math.max(...x);return [0,D>0?D*1.15:1]},[e]),h=useMemo(()=>{let[,x]=S,D=x/6,$=Array.from({length:7},(Gr,Go)=>Math.round(D*Go));return [...new Set($)]},[S]),b=useCallback(x=>{c(D=>({...D,[x]:!D[x]}));},[]),P=useCallback(x=>b(x),[b]),u=useCallback(x=>{let D=e[x];D&&(d(D.label),v(D.realized),m$1(!0));},[e]),g=useCallback(()=>{m$1(!1);},[]),R=useCallback(x=>d$1(x),[]);return jsxs(Fragment,{children:[jsxs(a,{children:[jsx(ut,{title:"Evolu\xE7\xE3o de vendas"}),jsx(ft,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(Xe,{kpis:t,isMonthly:k,editGoalAction:i})}),jsx(a$2,{active:o,children:jsx(Ro,{data:e,viewMode:r,visibleSeries:l,yDomain:S,yTicks:h,formatYAxis:R,onBarClick:u})}),jsx(Oo,{visibleSeries:l,onToggleSerie:P}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(Xe,{kpis:t,isMonthly:k,editGoalAction:i})})]})})})]}),p&&n&&jsx(n,{open:s,onClose:g,label:p,viewMode:r,selectedYear:a$3,totalValue:y})]})},yr=hr;var se={realized:"#22C55E",forecast:"#F59E0B"};var vr=({x:e=0,y:o=0,width:t=0,height:r=0,index:a,activeBarIndex:i})=>i!==a?null:jsx("rect",{x:e-6,y:o,width:t+12,height:r+6,fill:"#919EAB",opacity:.16,rx:6}),zo=vr;var Sr=({x:e=0,y:o=0,width:t=0,height:r=0,index:a,activeBarIndex:i,bothRendered:n})=>i!==a?null:jsx("rect",{x:e-6,y:o,width:n?t*2+4+12:t+12,height:r+6,fill:"#919EAB",opacity:.16,rx:6}),Fo=Sr;var kr=({active:e,payload:o,label:t,viewMode:r})=>{if(!e||!o?.length)return null;let a=r==="DAILY",i=String(t),n=i.split("-");if(n.length>=2){let l=parseInt(n[1],10)-1,c=b[l];a&&n.length===3?i=`${parseInt(n[2],10)} de ${c} de ${n[0]}`:a||(i=`${c} de ${n[0]}`);}return jsxs(a$8,{minWidth:{xs:"auto",sm:200},p:1,gap:1,children:[jsx(M,{variant:"body2",color:"text.secondary",children:i}),jsx(ye,{}),jsx(L,{children:o.map((l,c)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:3,"data-testid":`tooltip-item-${c}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:l.color}),jsx(M,{variant:"body2",noWrap:!0,children:l.name})]}),jsx(M,{variant:"body2",children:h(l.value)})]},l.name))})]})},Ao=kr;var Ir=({data:e,viewMode:o,visibleSeries:t,activeBarIndex:r,onMouseMove:a,onMouseLeave:i})=>{let n$1=o==="MONTHLY",[l,c$2]=useState(0),s=useRef(null),m=useCallback(b=>{s.current&&(s.current.disconnect(),s.current=null),b&&(c$2(b.clientWidth),s.current=new ResizeObserver(()=>c$2(b.clientWidth)),s.current.observe(b));},[]),p=useMemo(()=>!n$1||l===0||e.length===0?!1:(l-60)/e.length<80,[n$1,l,e.length]),d=useMemo(()=>e.some(b=>b.realized_value>0),[e]),y=useMemo(()=>e.some(b=>b.forecast_value>0),[e]),v=useMemo(()=>{if(!e.length)return [0,1];let b=e.flatMap(u=>[u.realized_value,u.forecast_value]),P=Math.max(...b);return [0,P>0?P*1.15:1]},[e]),k=useMemo(()=>{let[,b]=v,P=b/6;return [...new Set(Array.from({length:7},(u,g)=>Math.round(P*g)))]},[v]),S=useMemo(()=>n$1?c:d$3,[n$1]),h=t.realized&&d&&t.forecast&&y;return jsx(c$1,{ref:m,children:jsx(ResponsiveContainer,{width:"100%",height:250,children:jsxs(BarChart,{data:e,margin:{top:20,right:10,bottom:p?-90:0,left:20},barCategoryGap:"20%",barGap:4,onMouseMove:a,onMouseLeave:i,children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...p&&{interval:0,height:120},tick:p?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:S}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:b=>d$1(b),domain:v,ticks:k}),jsx(Tooltip,{content:jsx(Ao,{viewMode:o}),cursor:!1}),t.realized&&d&&jsx(Bar,{dataKey:"realized_value",name:"Realizado",fill:se.realized,maxBarSize:32,isAnimationActive:!1,radius:[4,4,0,0],background:jsx(Fo,{activeBarIndex:r,bothRendered:h})}),t.forecast&&y&&jsx(Bar,{dataKey:"forecast_value",name:"Previsto",fill:se.forecast,maxBarSize:32,isAnimationActive:!1,radius:[4,4,0,0],...!t.realized&&{background:jsx(zo,{activeBarIndex:r})}})]})})})},Wo=Ir;var Ar=({visibleSeries:e,onToggleSerie:o})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ue,{control:jsx(Qe,{checked:e.realized,onChange:()=>o("realized"),sx:{"&.Mui-checked":{color:se.realized}}}),label:"Realizado"}),jsx(Ue,{control:jsx(Qe,{checked:e.forecast,onChange:()=>o("forecast"),sx:{"&.Mui-checked":{color:se.forecast}}}),label:"Previsto"})]}),No=Ar;var Wr=({totalForecast:e,totalRealized:o,percentage:t,isMonthly:r})=>{let a=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[a&&jsx(ye,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsx(M,{variant:"body2",color:"text.secondary",children:r?"Total previsto no ano":"Total previsto no m\xEAs"}),jsx(M,{variant:"subtitle2",children:h(e)})]}),jsx(ye,{orientation:a?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:a?"solid":"dashed"}}),jsxs(L,{children:[jsx(M,{variant:"body2",color:"text.secondary",children:r?"Total realizado no ano":"Total realizado no m\xEAs"}),jsx(M,{variant:"subtitle2",children:h(o)})]}),jsx(ye,{orientation:a?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:a?"solid":"dashed"}}),jsxs(L,{children:[jsx(M,{variant:"body2",color:"text.secondary",children:"Atingimento"}),jsxs(M,{variant:"subtitle2",children:[t,"%"]})]})]})},to=Wr;var $r=({data:e,viewMode:o,isFetching:t})=>{let r=o==="MONTHLY",[a$3,i]=useState({realized:!0,forecast:!0}),[n,l]=useState(null),c=useCallback(d=>{i(y=>({...y,[d]:!y[d]}));},[]),s=useCallback(d=>{d?.activeTooltipIndex!=null&&l(Number(d.activeTooltipIndex));},[]),m$1=useCallback(()=>l(null),[]),p=useMemo(()=>{let d=e.reduce((k,S)=>k+(S.realized_value??0),0),y=e.reduce((k,S)=>k+(S.forecast_value??0),0),v=y>0?Math.round(d/y*100):0;return {totalRealized:d,totalForecast:y,percentage:v}},[e]);return jsxs(a,{children:[jsx(ut,{title:"Previsto vs. Realizado (Positiva\xE7\xE3o)"}),jsx(ft,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(to,{totalForecast:p.totalForecast,totalRealized:p.totalRealized,percentage:p.percentage,isMonthly:r})}),jsx(a$2,{active:t,children:jsx(Wo,{data:e,viewMode:o,visibleSeries:a$3,activeBarIndex:n,onMouseMove:s,onMouseLeave:m$1})}),jsx(No,{visibleSeries:a$3,onToggleSerie:c}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(to,{totalForecast:p.totalForecast,totalRealized:p.totalRealized,percentage:p.percentage,isMonthly:r})})]})})})]})},Yr=$r;
|
|
46
|
+
var te={orders:"#22C55E",quotations:"#0EA5E9"};var Qo=({x:e=0,y:o=0,width:t=0,height:a=0,index:r,activeBarIndex:i})=>i!==r?null:jsx("rect",{x:e-6,y:o,width:t+12,height:a+6,fill:"#919EAB",opacity:.16,rx:6}),Ve=Qo;var Xo=({x:e=0,y:o=0,width:t=0,index:a=0,data:r,visibleSeries:i,isMonthly:l,shouldRotateLabels:n})=>{if(!l||n)return null;let m=r[a];if(!m)return null;let s=0;return i.orders&&(s+=m.order_count??0),i.quotations&&(s+=m.quotation_count??0),s?jsx("text",{x:e+t/2,y:o-8,textAnchor:"middle",fontSize:11,fill:"#212B36",children:s}):null},We=Xo;var jo=({active:e,payload:o,label:t,viewMode:a})=>{if(!e||!o?.length)return null;let r=a==="DAILY",i=String(t),l=i.split("-");if(l.length>=2){let s=parseInt(l[1],10)-1,f=b[s];r&&l.length===3?i=`${parseInt(l[2],10)} de ${f} de ${l[0]}`:r||(i=`${f} de ${l[0]}`);}let n=o[0].payload,m=[{name:"Vendas",count:n.order_count??0,value:n.order_value??0,color:o.find(s=>s.dataKey==="order_count")?.color??"#22C55E"},{name:"Or\xE7amentos",count:n.quotation_count??0,value:n.quotation_value??0,color:o.find(s=>s.dataKey==="quotation_count")?.color??"#0EA5E9"}];return jsxs(a$8,{minWidth:{xs:"auto",sm:300},p:1,gap:1,children:[jsx(T,{variant:"body2",color:"text.secondary",children:i}),jsx(be,{}),jsx(L,{children:m.map((s,f)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:2,"data-testid":`tooltip-item-${f}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:s.color}),jsx(T,{variant:"body2",noWrap:!0,children:s.name})]}),jsxs(T,{variant:"body2",color:"text.disabled",noWrap:!0,children:[s.count," ",s.count===1?"pedido":"pedidos","\u2002",jsx(T,{component:"span",variant:"body2",color:"text.primary",children:h(s.value)})]})]},s.name))})]})},vo=jo;var ct=({data:e,viewMode:o,visibleSeries:t,activeBarIndex:a,onMouseMove:r,onMouseLeave:i,onBarClick:l})=>{let n$1=o==="MONTHLY",[m,s]=useState(0),f=useRef(null),d=useCallback(h=>{f.current&&(f.current.disconnect(),f.current=null),h&&(s(h.clientWidth),f.current=new ResizeObserver(()=>s(h.clientWidth)),f.current.observe(h));},[]),c$2=useMemo(()=>!n$1||m===0||e.length===0?!1:(m-60)/e.length<80,[n$1,m,e.length]),y=useMemo(()=>e.some(h=>(h.order_count??0)>0),[e]),S=useMemo(()=>e.some(h=>(h.quotation_count??0)>0),[e]),g=useMemo(()=>{if(!e.length)return [0,1];let h=Math.max(...e.map(M=>(M.order_count??0)+(M.quotation_count??0)));return [0,h>0?h*1.15:1]},[e]),k=useMemo(()=>{let[,h]=g,M=h/6;return [...new Set(Array.from({length:7},(v,O)=>Math.round(M*O)))]},[g]),x=t.quotations&&S,p=t.orders&&y&&!x,D=useMemo(()=>n$1?c:d$3,[n$1]);return jsx(c$1,{ref:d,children:jsx(ResponsiveContainer,{width:"100%",height:250,children:jsxs(BarChart,{data:e,margin:{top:20,right:10,bottom:c$2?-90:0,left:20},barCategoryGap:"20%",style:{cursor:"pointer"},onMouseMove:r,onMouseLeave:i,onClick:h=>{h?.activeTooltipIndex!=null&&l?.(Number(h.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...c$2&&{interval:0,height:120},tick:c$2?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:D}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:h=>d$1(h),domain:g,ticks:k}),jsx(Tooltip,{content:jsx(vo,{viewMode:o}),cursor:!1}),jsx(Bar,{dataKey:"order_count",name:"Vendas",fill:te.orders,stackId:"orders",maxBarSize:48,isAnimationActive:!1,hide:!t.orders,background:jsx(Ve,{activeBarIndex:a}),radius:p?[4,4,0,0]:void 0,...p&&{label:{position:"top",fontSize:11,fill:"#212B36",content:jsx(We,{data:e,visibleSeries:t,isMonthly:n$1,shouldRotateLabels:c$2})}}}),jsx(Bar,{dataKey:"quotation_count",name:"Or\xE7amentos",fill:te.quotations,stackId:"orders",maxBarSize:48,isAnimationActive:!1,hide:!t.quotations,radius:x?[4,4,0,0]:void 0,...!t.orders&&{background:jsx(Ve,{activeBarIndex:a})},...x&&{label:{position:"top",fontSize:11,fill:"#212B36",content:jsx(We,{data:e,visibleSeries:t,isMonthly:n$1,shouldRotateLabels:c$2})}}})]})})})},So=ct;var dt=({visibleSeries:e,onToggleSerie:o})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ze,{control:jsx(Je,{checked:e.orders,onChange:()=>o("orders"),sx:{"&.Mui-checked":{color:te.orders}}}),label:"Vendas"}),jsx(Ze,{control:jsx(Je,{checked:e.quotations,onChange:()=>o("quotations"),sx:{"&.Mui-checked":{color:te.quotations}}}),label:"Or\xE7amentos"})]}),ko=dt;var ut=({ordersTotal:e,quotationsTotal:o,isMonthly:t})=>{let a=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[a&&jsx(be,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsx(T,{variant:"body2",color:"text.secondary",children:t?"Vendas no ano":"Vendas no m\xEAs"}),jsxs(T,{variant:"subtitle2",children:[e," vendas"]})]}),jsx(be,{orientation:a?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:a?"solid":"dashed"}}),jsxs(L,{children:[jsx(T,{variant:"body2",color:"text.secondary",children:t?"Or\xE7amentos no ano":"Or\xE7amentos no m\xEAs"}),jsxs(T,{variant:"subtitle2",children:[o," or\xE7amentos"]})]})]})},_e=ut;var vt=({data:e,isFetching:o,viewMode:t,selectedYear:a$3,DetailComponent:r})=>{let i=t==="MONTHLY",[l,n]=useState({orders:!0,quotations:!0}),[m$1,s]=useState(null),[f,d]=useState(!1),[c,y]=useState(""),[S,g]=useState(0),k=useCallback(v=>{n(O=>({...O,[v]:!O[v]}));},[]),x=useCallback(v=>{v?.activeTooltipIndex!=null&&s(Number(v.activeTooltipIndex));},[]),p=useCallback(()=>s(null),[]),D=useCallback(v=>{let O=e[v];O&&(y(O.label),g(O.order_value),d(!0));},[e]),h=useCallback(()=>{d(!1);},[]),M=useMemo(()=>{let v=e.reduce((me,de)=>me+(de.order_count??0),0),O=e.reduce((me,de)=>me+(de.quotation_count??0),0);return {ordersTotal:v,quotationsTotal:O}},[e]);return jsxs(Fragment,{children:[jsxs(a,{children:[jsx(gt,{title:"Quantidade de pedidos por tipo"}),jsx(yt,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(_e,{isMonthly:i,ordersTotal:M.ordersTotal,quotationsTotal:M.quotationsTotal})}),jsx(a$2,{active:o,children:jsx(So,{data:e,viewMode:t,visibleSeries:l,activeBarIndex:m$1,onMouseMove:x,onMouseLeave:p,onBarClick:D})}),jsx(ko,{visibleSeries:l,onToggleSerie:k}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(_e,{isMonthly:i,ordersTotal:M.ordersTotal,quotationsTotal:M.quotationsTotal})})]})})})]}),c&&r&&jsx(r,{open:f,onClose:h,label:c,viewMode:t,selectedYear:a$3,totalValue:S})]})},bt=vt;var xt=({title:e,viewMode:o,selectedYear:t,periodLabel:a})=>jsxs(L,{width:"100%",minWidth:0,overflow:"hidden",children:[jsx(T,{variant:"subtitle1",noWrap:!0,children:"Detalhes do relat\xF3rio"}),jsxs(L,{direction:"row",alignItems:"center",columnGap:1.5,rowGap:0,flexWrap:"wrap",children:[jsx(T,{variant:"body2",color:"text.secondary",flexShrink:0,children:e}),"\u2022",jsx(T,{variant:"body2",flexShrink:0,children:b$2[o]}),"\u2022",jsx(T,{variant:"body2",flexShrink:0,children:t}),"\u2022",jsx(T,{variant:"body2",color:"text.secondary",noWrap:!0,children:a})]})]}),Do=xt;var Bo=styled(be)(()=>({height:30,alignSelf:"center",borderStyle:"dashed"})),Po=styled(L)(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",padding:e.spacing(2),gap:e.spacing(1),color:e.palette.text.primary,"& a":{textDecoration:"none"},"&+div":{borderTop:`1px dashed ${alpha(e.palette.grey[500],.2)}`}}));var Dt=e=>jsx(L,{justifyContent:"center",height:1,children:jsx(T,{variant:"body2",color:"text.primary",children:e.id})}),wt=(e,o)=>jsx(L,{justifyContent:"center",height:1,children:e?.partner?.id&&o?jsx(Lt,{component:"a",href:o(e.partner.id),target:"_blank",rel:"noopener noreferrer",variant:"subtitle2",sx:{textDecoration:"underline"},noWrap:!0,children:e.partner?.name||"-"}):jsx(T,{variant:"body2",color:"text.primary",noWrap:!0,children:e.partner?.name||"-"})}),Bt=e=>jsx(L,{justifyContent:"center",height:1,children:jsx(T,{variant:"body2",color:"text.primary",children:h(e.total_value)})}),Pt=e=>jsx(L,{justifyContent:"center",height:1,children:e.negotiation_date?jsx(T,{variant:"body2",color:"text.primary",children:d$2(e.negotiation_date,"DD/MM/YYYY")}):"-"}),Rt=e=>jsx(L,{justifyContent:"center",height:1,children:e.status||"-"}),Ot=(e,o)=>jsx(Po,{children:jsxs(L,{gap:1,children:[jsxs(L,{children:[jsx(T,{variant:"body2",color:"text.secondary",children:"Pedido"}),jsx(T,{variant:"subtitle2",color:"text.primary",children:e.id})]}),jsxs(L,{children:[jsx(T,{variant:"body2",color:"text.secondary",children:"Cliente"}),jsx(T,{variant:"subtitle2",color:"primary.main",children:e.partner?.name||"-"})]}),jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsxs(L,{flex:1,overflow:"hidden",children:[jsx(T,{variant:"body2",color:"text.secondary",noWrap:!0,children:"Valor do pedido"}),jsx(T,{variant:"subtitle2",color:"text.primary",noWrap:!0,children:h(e.total_value)})]}),jsx(be,{orientation:"vertical",flexItem:!0,sx:{borderStyle:"dashed",mx:3}}),jsxs(L,{flex:1,overflow:"hidden",children:[jsx(T,{variant:"body2",color:"text.secondary",noWrap:!0,children:"Data"}),jsx(T,{variant:"subtitle2",color:"text.primary",noWrap:!0,children:e.negotiation_date?d$2(e.negotiation_date,"DD/MM/YYYY"):"-"})]})]}),!o&&jsxs(L,{gap:.5,children:[jsx(T,{variant:"body2",color:"text.secondary",children:"Status"}),jsx(T,{variant:"subtitle2",color:"text.primary",children:e.status||"-"})]})]})},e.id),It=({open:e,onClose:o,title:t,viewMode:a,selectedYear:r,totalValue:i,periodLabel:l,suffix:n,rows:m,total:s,isLoading:f,isFetching:d$1,page:c,perPage:y,onSearch:S,onPaginationChange:g,buildPartnerLink:k,mobileItemSlot:x,hideStatus:p})=>{let D=b$1("down","sm"),h$1=jsxs(L,{gap:3,children:[jsxs(L,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",gap:2,children:[jsxs(L,{minWidth:0,direction:"row",alignItems:"center",gap:3,flexWrap:"wrap",children:[jsxs(L,{children:[jsxs(T,{variant:"body2",color:"text.secondary",children:["Vendas ",n]}),jsx(T,{variant:"subtitle2",color:"text.primary",children:h(i)})]}),jsx(Bo,{orientation:"vertical",flexItem:!0}),jsxs(L,{children:[jsxs(T,{variant:"body2",color:"text.secondary",children:["Qtd. de pedidos ",n]}),jsx(T,{variant:"subtitle2",color:"text.primary",children:s})]})]}),jsx(a$3,{size:"small",placeholder:"Buscar",onSearch:S,trigger:"change",iconPosition:"start",sx:{minWidth:200}})]}),jsx(d,{title:"Pedidos",header:jsx(Fragment,{}),headerProps:{p:0},columns:[{field:"external_id",headerName:"Pedido",flex:1,renderCell:({row:v})=>Dt(v)},{field:"partner_name",headerName:"Cliente",flex:1,renderCell:({row:v})=>wt(v,k)},{field:"total_value",headerName:"Valor do pedido",flex:1,renderCell:({row:v})=>Bt(v)},{field:"created_at",headerName:"Data",flex:1,renderCell:({row:v})=>Pt(v)},...p?[]:[{field:"last_status",headerName:"Status",flex:1,renderCell:({row:v})=>Rt(v)}]],rows:m,rowCount:s,mobileRender:v=>x?x(v):Ot(v,p),loading:f,fetching:d$1,paginationModel:{page:c,pageSize:y},onPaginationChange:g,paginationMode:"server",disableRowSelectionOnClick:!0,disableColumnMenu:!0,containerProps:{height:400}})]}),M=jsx(Do,{title:t,viewMode:a,selectedYear:r,periodLabel:l});return D?jsx(a$4,{open:e,onClose:o,headerTitle:M,headerProps:{direction:"row-reverse",sx:{"& > :last-child":{minWidth:0,overflow:"hidden"}}},children:h$1}):jsx(a$5,{open:e,onClose:o,maxWidth:"lg",dialogTitle:M,dialogTitleProps:{sx:{flex:1,overflow:"hidden"}},fullWidth:!0,children:h$1})},zt=It;var Ye=(e,o)=>{let t=e.split("-");if(o==="DAILY"&&t.length===3){let l=`${t[0]}-${t[1]}-${t[2]}`;return {startDate:l,endDate:l}}let a=parseInt(t[0],10),r=parseInt(t[1],10),i=new Date(a,r,0).getDate();return {startDate:`${t[0]}-${t[1]}-01`,endDate:`${t[0]}-${t[1]}-${String(i).padStart(2,"0")}`}},Ge=(e,o)=>{let t=e.split("-"),a=parseInt(t[1],10)-1,r=b[a]??"";if(o==="DAILY"&&t.length===3){let i=parseInt(t[2],10);return `${r} - Dia ${i}`}return r},qe=e=>e==="MONTHLY"?"no m\xEAs":"no dia";var Vt=(e,o)=>{let{page:t,perPage:a,search:r,handlePaginationModelChange:i,handleSearch:l}=a$6(),{startDate:n,endDate:m}=useMemo(()=>Ye(e,o),[e,o]),s=useMemo(()=>Ge(e,o),[e,o]),f=qe(o),d=useMemo(()=>({page:t,perPage:a,...r?{search:r}:{},filter:{operator:"AND",groups:[{operator:"AND",conditionals:[{fieldName:"negotiationDate",conditional:"GREATER_THAN_OR_EQUAL",value:[`${n}T00:00:00`]},{fieldName:"negotiationDate",conditional:"LESS_THAN_OR_EQUAL",value:[`${m}T23:59:59`]}]}]}}),[m,t,a,r,n]),c=useCallback((y,S)=>{i({page:y,pageSize:S});},[i]);return {page:t,perPage:a,periodLabel:s,suffix:f,queryParams:d,handleSearch:l,handlePaginationChange:c}},Wt=Vt;var C={sales:"#22C55E",forecast:"#F59E0B",goal:"#212B36"};var Et=({x:e=0,y:o=0,width:t=0,height:a=0,index:r,activeBarIndex:i})=>i!==r?null:jsx("rect",{x:e-6,y:o,width:t+6*2,height:a+6,fill:C.sales,opacity:.16,rx:6}),we=Et;var $t=({active:e,payload:o,label:t,viewMode:a,hideGoal:r})=>{if(!e||!o?.length)return null;let i=a==="DAILY",l=o[0].payload,n=Number(l.realized)||0,m=Number(l.forecast)||0,s=Number(l.goal)||0,f=s>0?n/s*100:0,d=s>n?s-n:0,c=i?"no dia":"no m\xEAs",y=i?"di\xE1ria":"mensal",S=String(t),g=S.split("-");if(g.length>=2){let x=parseInt(g[1],10)-1,p=b[x];i&&g.length===3?S=`${parseInt(g[2],10)} de ${p} de ${g[0]}`:i||(S=`${p} de ${g[0]}`);}let k=[{name:`Realizado ${c}`,value:h(n),color:C.sales},{name:`Previsto ${c}`,value:h(m),color:C.forecast},...r?[]:[{name:`Meta ${y}`,value:h(s),color:C.goal},{name:"Atingimento",value:`${f.toFixed(0)}%`,color:"#00B8D9"},{name:`GAP ${c}`,value:h(d),color:"#FF5630"}]];return jsxs(a$8,{minWidth:{xs:"auto",sm:400},p:1,gap:1,children:[jsx(T,{variant:"body2",color:"text.secondary",children:S}),jsx(be,{}),jsx(L,{children:k.map((x,p)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:3,"data-testid":`tooltip-item-${p}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:x.color}),jsx(T,{variant:"body2",noWrap:!0,children:x.name})]}),jsx(T,{variant:"body2",children:x.value})]},p))})]})},Pe=$t;var Jt=({data:e,visibleSeries:o,yDomain:t,yTicks:a,viewMode:r,activeBarIndex:i,onMouseMove:l,onMouseLeave:n,onBarClick:m,hideGoal:s})=>{let f=useCallback(d=>d$1(d),[]);return jsx(ResponsiveContainer,{width:"100%",height:350,children:jsxs(ComposedChart,{data:e,margin:{top:20,right:10,bottom:0,left:20},style:{cursor:"pointer"},onMouseMove:l,onMouseLeave:n,onClick:d=>{d?.activeTooltipIndex!=null&&m?.(Number(d.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:d$3}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:f,domain:t,ticks:a}),jsx(Tooltip,{content:jsx(Pe,{viewMode:r,hideGoal:s})}),jsx(Bar,{dataKey:"realized",fill:"transparent",isAnimationActive:!1,background:jsx(we,{activeBarIndex:i})}),o.goal&&jsx(Line,{dataKey:"goal",name:"Meta",stroke:C.goal,strokeWidth:2,strokeDasharray:"8 4",dot:!1,isAnimationActive:!1}),o.realized&&jsx(Line,{dataKey:"realized",name:"Vendas",stroke:C.sales,strokeWidth:2,dot:{fill:C.sales,r:4,strokeWidth:0},isAnimationActive:!1}),o.forecast&&jsx(Line,{dataKey:"forecast",name:"Previsto",stroke:C.forecast,strokeWidth:2,strokeDasharray:"6 3",dot:{fill:C.forecast,r:4,strokeWidth:0},isAnimationActive:!1})]})})},Ro=Jt;var sr=({data:e,visibleSeries:o,yDomain:t,yTicks:a,shouldRotateLabels:r,activeBarIndex:i,onMouseMove:l,onMouseLeave:n$1,onBarClick:m,viewMode:s,hideGoal:f})=>{let d=useMemo(()=>r?!1:{position:"top",fontSize:12,fill:"#212B36",formatter:c=>h(Number(c))},[r]);return jsx(ResponsiveContainer,{width:"100%",height:300,children:jsxs(ComposedChart,{data:e,margin:{top:20,right:10,bottom:r?-90:0,left:20},barCategoryGap:"20%",style:{cursor:"pointer"},onMouseMove:l,onMouseLeave:n$1,onClick:c=>{c?.activeTooltipIndex!=null&&m?.(Number(c.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...r&&{interval:0,height:120},tick:r?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:c}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:c=>d$1(c),domain:t,ticks:a}),jsx(Tooltip,{content:jsx(Pe,{viewMode:s,hideGoal:f})}),o.goal&&jsx(Line,{dataKey:"goal",name:"Meta",stroke:C.goal,strokeWidth:2,strokeDasharray:"8 4",dot:!1,isAnimationActive:!1}),o.realized&&jsx(Bar,{dataKey:"realized",name:"Vendas",fill:C.sales,maxBarSize:48,isAnimationActive:!1,radius:[4,4,0,0],background:jsx(we,{activeBarIndex:i}),label:d}),o.forecast&&jsx(Line,{dataKey:"forecast",name:"Previsto",stroke:C.forecast,strokeWidth:2,strokeDasharray:"6 3",dot:{fill:C.forecast,r:4,strokeWidth:0},isAnimationActive:!1})]})})},Io=sr;var mr=({data:e,viewMode:o,visibleSeries:t,yDomain:a,yTicks:r,formatYAxis:i,onBarClick:l,hideGoal:n})=>{let[m,s]=useState(null),[f,d]=useState(0),c=useRef(null),y=o==="MONTHLY",S=useMemo(()=>!y||f===0||e.length===0?!1:(f-60)/e.length<60,[f,e.length,y]),g=useCallback(()=>s(null),[]),k=useCallback(p=>{p?.activeTooltipIndex!=null&&s(Number(p.activeTooltipIndex));},[]),x=useCallback(p=>{c.current&&(c.current.disconnect(),c.current=null),p&&(d(p.clientWidth),c.current=new ResizeObserver(()=>d(p.clientWidth)),c.current.observe(p));},[]);return y?jsx(c$1,{ref:x,children:jsx(Io,{data:e,visibleSeries:t,yDomain:a,yTicks:r,formatYAxis:i,shouldRotateLabels:S,activeBarIndex:m,onMouseMove:k,onMouseLeave:g,onBarClick:l,viewMode:o,hideGoal:n})}):jsx(c$1,{ref:x,children:jsx(Ro,{data:e,visibleSeries:t,yDomain:a,yTicks:r,formatYAxis:i,viewMode:o,activeBarIndex:m,onMouseMove:k,onMouseLeave:g,onBarClick:l,hideGoal:n})})},Fo=mr;var fr=({visibleSeries:e,onToggleSerie:o,hideGoal:t})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ze,{control:jsx(Je,{checked:e.realized,onChange:()=>o("realized"),sx:{"&.Mui-checked":{color:C.sales}}}),label:"Vendas"}),jsx(Ze,{control:jsx(Je,{checked:e.forecast,onChange:()=>o("forecast"),sx:{"&.Mui-checked":{color:C.forecast}}}),label:"Previsto"}),!t&&jsx(Ze,{control:jsx(Je,{checked:e.goal,onChange:()=>o("goal"),sx:{"&.Mui-checked":{color:C.goal}}}),label:"Meta"})]}),Ao=fr;var hr=({kpis:e,isMonthly:o,editGoalAction:t,hideGoal:a})=>{let r=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[r&&jsx(be,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsxs(T,{variant:"body2",color:"text.secondary",children:["Previsto no ",o?"ano":"m\xEAs"]}),jsx(T,{variant:"subtitle2",children:h(e?.forecast)})]}),jsx(be,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsxs(T,{variant:"body2",color:"text.secondary",children:["Realizado no ",o?"ano":"m\xEAs"]}),jsx(T,{variant:"subtitle2",children:h(e?.realized)})]}),!a&&jsx(be,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),!a&&jsxs(L,{children:[jsxs(L,{direction:"row",alignItems:"center",gap:3,children:[jsxs(T,{variant:"body2",color:"text.secondary",children:["Meta ",o?"anual":"mensal"]}),t]}),jsx(T,{variant:"subtitle2",children:h(e?.goal)})]}),!a&&jsx(be,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),!a&&jsxs(L,{children:[jsx(T,{variant:"body2",color:"text.secondary",children:"Atingimento"}),jsx(T,{variant:"subtitle2",children:c$2(e?.achievement??0,{maximumFractionDigits:2,minimumFractionDigits:2})})]}),!a&&jsx(be,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),!a&&jsxs(L,{children:[jsxs(L,{direction:"row",gap:.5,children:[jsxs(T,{variant:"body2",color:"text.secondary",children:["GAP do ",o?"ano":"m\xEAs"]}),jsx(a$7,{text:"Diferen\xE7a entre o valor realizado e a meta. Um GAP significa que as vendas ainda est\xE3o abaixo do objetivo definido para o per\xEDodo.",width:18,arrow:!0,sx:{mt:-.1}})]}),jsx(T,{variant:"subtitle2",children:h(e?.gap)})]})]})},je=hr;var vr=({data:e,isFetching:o,kpis:t,viewMode:a$3,selectedYear:r,editGoalAction:i,DetailComponent:l,hideGoal:n,emptyMessage:m$1})=>{let[s,f]=useState({realized:!0,forecast:!0,goal:!0}),[d,c]=useState(!1),[y,S]=useState(""),[g,k]=useState(0),x=a$3==="MONTHLY",p=useMemo(()=>m$1!=null&&e.every(w=>!Number(w.realized)),[e,m$1]),D=useMemo(()=>{if(!e.length)return [0,1];let w=e.flatMap(fe=>[Number(fe.realized)||0,Number(fe.forecast)||0,Number(fe.goal)||0]),V=Math.max(...w);return [0,V>0?V*1.15:1]},[e]),h=useMemo(()=>{let[,w]=D,V=w/6,fe=Array.from({length:7},(Kr,Ko)=>Math.round(V*Ko));return [...new Set(fe)]},[D]),M=useCallback(w=>{f(V=>({...V,[w]:!V[w]}));},[]),v=useCallback(w=>M(w),[M]),O=useCallback(w=>{let V=e[w];V&&(S(V.label),k(V.realized),c(!0));},[e]),me=useCallback(()=>{c(!1);},[]),de=useCallback(w=>d$1(w),[]);return jsxs(Fragment,{children:[jsxs(a,{children:[jsx(gt,{title:"Evolu\xE7\xE3o de vendas"}),jsx(yt,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(je,{kpis:t,isMonthly:x,editGoalAction:i,hideGoal:n})}),p?jsx(m,{title:m$1,description:"Troque a origem do pedido ou o per\xEDodo selecionado."}):jsx(a$2,{active:o,children:jsx(Fo,{data:e,viewMode:a$3,visibleSeries:n?{...s,goal:!1}:s,yDomain:D,yTicks:h,formatYAxis:de,onBarClick:O,hideGoal:n})}),!p&&jsx(Ao,{visibleSeries:s,onToggleSerie:v,hideGoal:n}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(je,{kpis:t,isMonthly:x,editGoalAction:i,hideGoal:n})})]})})})]}),y&&l&&jsx(l,{open:d,onClose:me,label:y,viewMode:a$3,selectedYear:r,totalValue:g})]})},br=vr;var se={realized:"#22C55E",forecast:"#F59E0B"};var xr=({x:e=0,y:o=0,width:t=0,height:a=0,index:r,activeBarIndex:i})=>i!==r?null:jsx("rect",{x:e-6,y:o,width:t+12,height:a+6,fill:"#919EAB",opacity:.16,rx:6}),Vo=xr;var kr=({x:e=0,y:o=0,width:t=0,height:a=0,index:r,activeBarIndex:i,bothRendered:l})=>i!==r?null:jsx("rect",{x:e-6,y:o,width:l?t*2+4+12:t+12,height:a+6,fill:"#919EAB",opacity:.16,rx:6}),Wo=kr;var Lr=({active:e,payload:o,label:t,viewMode:a})=>{if(!e||!o?.length)return null;let r=a==="DAILY",i=String(t),l=i.split("-");if(l.length>=2){let n=parseInt(l[1],10)-1,m=b[n];r&&l.length===3?i=`${parseInt(l[2],10)} de ${m} de ${l[0]}`:r||(i=`${m} de ${l[0]}`);}return jsxs(a$8,{minWidth:{xs:"auto",sm:200},p:1,gap:1,children:[jsx(T,{variant:"body2",color:"text.secondary",children:i}),jsx(be,{}),jsx(L,{children:o.map((n,m)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:3,"data-testid":`tooltip-item-${m}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:n.color}),jsx(T,{variant:"body2",noWrap:!0,children:n.name})]}),jsx(T,{variant:"body2",children:h(n.value)})]},n.name))})]})},Eo=Lr;var Ar=({data:e,viewMode:o,visibleSeries:t,activeBarIndex:a,onMouseMove:r,onMouseLeave:i})=>{let l=o==="MONTHLY",[n$1,m]=useState(0),s=useRef(null),f=useCallback(p=>{s.current&&(s.current.disconnect(),s.current=null),p&&(m(p.clientWidth),s.current=new ResizeObserver(()=>m(p.clientWidth)),s.current.observe(p));},[]),d=useMemo(()=>!l||n$1===0||e.length===0?!1:(n$1-60)/e.length<80,[l,n$1,e.length]),c$2=useMemo(()=>e.some(p=>p.realized_value>0),[e]),y=useMemo(()=>e.some(p=>p.forecast_value>0),[e]),S=useMemo(()=>{if(!e.length)return [0,1];let p=e.flatMap(h=>[h.realized_value,h.forecast_value]),D=Math.max(...p);return [0,D>0?D*1.15:1]},[e]),g=useMemo(()=>{let[,p]=S,D=p/6;return [...new Set(Array.from({length:7},(h,M)=>Math.round(D*M)))]},[S]),k=useMemo(()=>l?c:d$3,[l]),x=t.realized&&c$2&&t.forecast&&y;return jsx(c$1,{ref:f,children:jsx(ResponsiveContainer,{width:"100%",height:250,children:jsxs(BarChart,{data:e,margin:{top:20,right:10,bottom:d?-90:0,left:20},barCategoryGap:"20%",barGap:4,onMouseMove:r,onMouseLeave:i,children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...d&&{interval:0,height:120},tick:d?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:k}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:p=>d$1(p),domain:S,ticks:g}),jsx(Tooltip,{content:jsx(Eo,{viewMode:o}),cursor:!1}),t.realized&&c$2&&jsx(Bar,{dataKey:"realized_value",name:"Realizado",fill:se.realized,maxBarSize:32,isAnimationActive:!1,radius:[4,4,0,0],background:jsx(Wo,{activeBarIndex:a,bothRendered:x})}),t.forecast&&y&&jsx(Bar,{dataKey:"forecast_value",name:"Previsto",fill:se.forecast,maxBarSize:32,isAnimationActive:!1,radius:[4,4,0,0],...!t.realized&&{background:jsx(Vo,{activeBarIndex:a})}})]})})})},No=Ar;var Er=({visibleSeries:e,onToggleSerie:o})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ze,{control:jsx(Je,{checked:e.realized,onChange:()=>o("realized"),sx:{"&.Mui-checked":{color:se.realized}}}),label:"Realizado"}),jsx(Ze,{control:jsx(Je,{checked:e.forecast,onChange:()=>o("forecast"),sx:{"&.Mui-checked":{color:se.forecast}}}),label:"Previsto"})]}),Go=Er;var Nr=({totalForecast:e,totalRealized:o,percentage:t,isMonthly:a})=>{let r=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[r&&jsx(be,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsx(T,{variant:"body2",color:"text.secondary",children:a?"Total previsto no ano":"Total previsto no m\xEAs"}),jsx(T,{variant:"subtitle2",children:h(e)})]}),jsx(be,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsx(T,{variant:"body2",color:"text.secondary",children:a?"Total realizado no ano":"Total realizado no m\xEAs"}),jsx(T,{variant:"subtitle2",children:h(o)})]}),jsx(be,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsx(T,{variant:"body2",color:"text.secondary",children:"Atingimento"}),jsxs(T,{variant:"subtitle2",children:[t,"%"]})]})]})},no=Nr;var qr=({data:e,viewMode:o,isFetching:t})=>{let a$3=o==="MONTHLY",[r,i]=useState({realized:!0,forecast:!0}),[l,n]=useState(null),m$1=useCallback(c=>{i(y=>({...y,[c]:!y[c]}));},[]),s=useCallback(c=>{c?.activeTooltipIndex!=null&&n(Number(c.activeTooltipIndex));},[]),f=useCallback(()=>n(null),[]),d=useMemo(()=>{let c=e.reduce((g,k)=>g+(k.realized_value??0),0),y=e.reduce((g,k)=>g+(k.forecast_value??0),0),S=y>0?Math.round(c/y*100):0;return {totalRealized:c,totalForecast:y,percentage:S}},[e]);return jsxs(a,{children:[jsx(gt,{title:"Previsto vs. Realizado (Positiva\xE7\xE3o)"}),jsx(yt,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(no,{totalForecast:d.totalForecast,totalRealized:d.totalRealized,percentage:d.percentage,isMonthly:a$3})}),jsx(a$2,{active:t,children:jsx(No,{data:e,viewMode:o,visibleSeries:r,activeBarIndex:l,onMouseMove:s,onMouseLeave:f})}),jsx(Go,{visibleSeries:r,onToggleSerie:m$1}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(no,{totalForecast:d.totalForecast,totalRealized:d.totalRealized,percentage:d.percentage,isMonthly:a$3})})]})})})]})},Hr=qr;
|
|
47
47
|
|
|
48
|
-
export {
|
|
48
|
+
export { bt as OrdersByType, zt as OverviewDetail, br as SalesEvolution, Hr as SalesForecast, Ye as getDateRange, Ge as getPeriodLabel, qe as getPeriodSuffix, Wt as useOverviewDetailState };
|
|
49
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Chart/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/props.ts","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Chart/BarBackground.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Chart/BarLabel.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Chart/Tooltip.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Legend.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Summary.tsx","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/Header.tsx","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/styles.ts","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/useOverviewDetailState.ts","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/utils.ts","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/DailyView.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/props.ts","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/BarBackground.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/Tooltip.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/MonthlyView.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Legend.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Summary.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Chart/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/props.ts","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Chart/BarBackground.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Chart/RealizedBackground.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Chart/Tooltip.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Legend.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Summary.tsx"],"names":["useCallback","useMemo","useState","CardContent","CardHeader","Stack","useRef","Bar","BarChart","CartesianGrid","ResponsiveContainer","Tooltip","XAxis","YAxis","COLORS","jsx","BarBackground","x","y","width","height","index","activeBarIndex","BarBackground_default","BarLabel","data","visibleSeries","isMonthly","shouldRotateLabels","item","total","BarLabel_default","Divider","Typography","jsxs","OrdersByTypeTooltip","active","payload","label","viewMode","isDaily","formattedLabel","parts","monthIndex","month","MONTH_FULL_LABELS","items","p","SimpleCard_default","entry","fCurrencyBRL","Tooltip_default","Chart","onMouseMove","onMouseLeave","onBarClick","containerWidth","setContainerWidth","observerRef","wrapperRefCallback","node","hasOrderData","d","hasQuotationData","yDomain","maxTotal","yTicks","max","step","_","i","quotationsOnTop","ordersIsTop","tickFormatter","formatMonthLabel","formatDayLabel","ChartWrapper","state","RotatedTick_default","v","fShortenNumber","Chart_default","Checkbox","FormControlLabel","OrdersByTypeLegend","onToggleSerie","Legend_default","Summary","ordersTotal","quotationsTotal","isMobile","useResponsive_default","Summary_default","Fragment","OrdersByType","isFetching","selectedYear","DetailComponent","setVisibleSeries","setActiveBarIndex","detailOpen","setDetailOpen","selectedLabel","setSelectedLabel","selectedTotalValue","setSelectedTotalValue","handleToggleSerie","serie","prev","handleMouseMove","handleMouseLeave","handleBarClick","handleDetailClose","totals","acc","ChartCard","Result_default","EmptyState_default","ChartLoading_default","OrdersByType_default","Link","Header","title","periodLabel","VIEW_MODE_LABELS","Header_default","MuiDivider","alpha","styled","StyledDivider","MobileItemContainer","theme","getOrderId","order","getPartnerName","buildPartnerLink","getOrderValue","getOrderDate","fDate","getOrderStatus","getDefaultMobileRender","OverviewDetail","open","onClose","totalValue","suffix","rows","isLoading","page","perPage","onSearch","onPaginationChange","mobileItemSlot","content","SearchInput_default","DataView_default","row","header","Drawer_default","Modal_default","OverviewDetail_default","getDateRange","date","year","lastDay","getPeriodLabel","monthName","day","getPeriodSuffix","useOverviewDetailState","search","handlePaginationModelChange","handleSearch","useDatagrid_default","startDate","endDate","queryParams","handlePaginationChange","newPage","rowsPerPage","useOverviewDetailState_default","ComposedChart","Line","SalesEvolutionTooltip","realized","forecast","goal","achievement","gap","timeUnitStr","goalStr","DailyChart","formatYAxis","DailyView_default","MonthlyChart","barLabelConfig","value","MonthlyView_default","SalesEvolutionChart","SalesEvolutionLegend","kpis","editGoalAction","fPercent","InfoCircle_default","SalesEvolution","values","ticks","handleToggleSeries","key","toggle","SalesEvolution_default","RealizedBackground","bothRendered","RealizedBackground_default","SalesForecastTooltip","ForecastChart","hasRealizedData","hasForecastData","SalesForecastLegend","SalesForecastSummary","totalForecast","totalRealized","percentage","SalesForecast","SalesForecast_default"],"mappings":"g1CAAA,OAAS,eAAAA,GAAa,WAAAC,GAAS,YAAAC,OAAgB,QAC/C,OAAOC,OAAiB,4BACxB,OAAOC,OAAgB,2BACvB,OAAOC,OAAW,sBCHlB,OAAuB,eAAAL,GAAa,WAAAC,GAAS,UAAAK,GAAQ,YAAAJ,OAAgB,QACrE,OACE,OAAAK,GACA,YAAAC,GACA,iBAAAC,GACA,uBAAAC,GACA,WAAAC,GACA,SAAAC,GACA,SAAAC,OACK,WCuBA,IAAMC,GAAS,CACpB,OAAQ,UACR,WAAY,SACd,ECtBI,cAAAC,OAAA,oBAXJ,IAAMC,GAAgB,CAAC,CACrB,EAAAC,EAAI,EACJ,EAAAC,EAAI,EACJ,MAAAC,EAAQ,EACR,OAAAC,EAAS,EACT,MAAAC,EACA,eAAAC,CACF,IACMA,IAAmBD,EAAc,KAGnCN,GAAC,QACC,EAAGE,EAAI,EACP,EAAGC,EACH,MAAOC,EAAQ,GACf,OAAQC,EAAS,EACjB,KAAK,UACL,QAAS,IACT,GAAI,EACN,EAIGG,GAAQP,GCFX,cAAAD,OAAA,oBArBJ,IAAMS,GAAW,CAAC,CAChB,EAAAP,EAAI,EACJ,EAAAC,EAAI,EACJ,MAAAC,EAAQ,EACR,MAAAE,EAAQ,EACR,KAAAI,EACA,cAAAC,EACA,UAAAC,EACA,mBAAAC,CACF,IAAqB,CACnB,GAAI,CAACD,GAAaC,EAAoB,OAAO,KAE7C,IAAMC,EAAOJ,EAAKJ,CAAK,EACvB,GAAI,CAACQ,EAAM,OA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rF,IAASqF,GAAOrF,EAAK,gBAAkB,GAC7C,CACF,EAEM+L,EAAgBnM,EAAK,OACzB,CAACyF,EAAKrF,IAASqF,GAAOrF,EAAK,gBAAkB,GAC7C,CACF,EAEMiM,EACJF,EAAgB,EAAI,KAAK,MAAOC,EAAgBD,EAAiB,GAAG,EAAI,EAC1E,MAAO,CAAE,cAAAC,EAAe,cAAAD,EAAe,WAAAE,CAAW,CACpD,EAAG,CAACrM,CAAI,CAAC,EAET,OACES,GAACiF,EAAA,CACC,UAAApG,EAACX,GAAA,CAAW,MAAM,6CAAuC,EAEzDW,EAACZ,GAAA,CACC,SAAAY,EAACqG,EAAA,CAAO,QAAS3F,EAAK,SAAW,EAAG,MAAOV,EAACsG,EAAA,EAAW,EACrD,SAAAnF,GAAC7B,GAAA,CAAM,IAAK,EACV,UAAAU,EAACV,GAAA,CAAM,QAAS,CAAE,GAAI,OAAQ,GAAI,OAAQ,EACxC,SAAAU,EAAC6E,GAAA,CACC,cAAeqB,EAAO,cACtB,cAAeA,EAAO,cACtB,WAAYA,EAAO,WACnB,UAAWtF,EACb,EACF,EAEAZ,EAACuG,EAAA,CAAa,OAAQvB,EACpB,SAAAhF,EAACkE,GAAA,CACC,KAAMxD,EACN,SAAUc,EACV,cAAeb,EACf,eAAgBJ,EAChB,YAAauF,EACb,aAAcC,EAChB,EACF,EAEA/F,EAACuE,GAAA,CACC,cAAe5D,EACf,cAAegF,EACjB,EAEA3F,EAACV,GAAA,CAAM,QAAS,CAAE,GAAI,QAAS,GAAI,MAAO,EACxC,SAAAU,EAAC6E,GAAA,CACC,cAAeqB,EAAO,cACtB,cAAeA,EAAO,cACtB,WAAYA,EAAO,WACnB,UAAWtF,EACb,EACF,GACF,EACF,EACF,GACF,CAEJ,EAEOqM,GAAQD","sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport CardContent from '@mui/material/CardContent';\nimport CardHeader from '@mui/material/CardHeader';\nimport Stack from '@mui/material/Stack';\nimport { CategoricalChartFunc } from 'recharts/types/chart/types';\n\nimport ChartLoading from 'components/Analytics/ChartLoading';\nimport { ChartCard } from 'components/Analytics/ChartStyles';\nimport EmptyState from 'components/Analytics/EmptyState';\nimport Result from 'components/Result';\nimport { ViewMode } from 'utils/analytics';\n\nimport Chart from './Chart';\nimport Legend from './Legend';\nimport { OrdersByTypeProps, VisibleSeries } from './props';\nimport Summary from './Summary';\n\nconst OrdersByType = ({\n data,\n isFetching,\n viewMode,\n selectedYear,\n DetailComponent,\n}: OrdersByTypeProps) => {\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const [visibleSeries, setVisibleSeries] = useState<VisibleSeries>({\n orders: true,\n quotations: true,\n });\n\n const [activeBarIndex, setActiveBarIndex] = useState<number | null>(null);\n\n const [detailOpen, setDetailOpen] = useState(false);\n const [selectedLabel, setSelectedLabel] = useState('');\n const [selectedTotalValue, setSelectedTotalValue] = useState(0);\n\n const handleToggleSerie = useCallback((serie: keyof VisibleSeries) => {\n setVisibleSeries(prev => ({ ...prev, [serie]: !prev[serie] }));\n }, []);\n\n const handleMouseMove = useCallback<CategoricalChartFunc>(state => {\n if (state?.activeTooltipIndex != null) {\n setActiveBarIndex(Number(state.activeTooltipIndex));\n }\n }, []);\n\n const handleMouseLeave = useCallback<CategoricalChartFunc>(\n () => setActiveBarIndex(null),\n [],\n );\n\n const handleBarClick = useCallback(\n (index: number) => {\n const item = data[index];\n if (!item) return;\n setSelectedLabel(item.label);\n setSelectedTotalValue(item.order_value);\n setDetailOpen(true);\n },\n [data],\n );\n\n const handleDetailClose = useCallback(() => {\n setDetailOpen(false);\n }, []);\n\n const totals = useMemo(() => {\n const ordersTotal = data.reduce(\n (acc, item) => acc + (item.order_count ?? 0),\n 0,\n );\n const quotationsTotal = data.reduce(\n (acc, item) => acc + (item.quotation_count ?? 0),\n 0,\n );\n return { ordersTotal, quotationsTotal };\n }, [data]);\n\n return (\n <>\n <ChartCard>\n <CardHeader title=\"Quantidade de pedidos por tipo\" />\n\n <CardContent>\n <Result isEmpty={data.length === 0} empty={<EmptyState />}>\n <Stack gap={3}>\n <Stack display={{ xs: 'none', md: 'block' }}>\n <Summary\n isMonthly={isMonthly}\n ordersTotal={totals.ordersTotal}\n quotationsTotal={totals.quotationsTotal}\n />\n </Stack>\n\n <ChartLoading active={isFetching}>\n <Chart\n data={data}\n viewMode={viewMode}\n visibleSeries={visibleSeries}\n activeBarIndex={activeBarIndex}\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n onBarClick={handleBarClick}\n />\n </ChartLoading>\n\n <Legend\n visibleSeries={visibleSeries}\n onToggleSerie={handleToggleSerie}\n />\n\n <Stack display={{ xs: 'block', md: 'none' }}>\n <Summary\n isMonthly={isMonthly}\n ordersTotal={totals.ordersTotal}\n quotationsTotal={totals.quotationsTotal}\n />\n </Stack>\n </Stack>\n </Result>\n </CardContent>\n </ChartCard>\n\n {selectedLabel && DetailComponent && (\n <DetailComponent\n open={detailOpen}\n onClose={handleDetailClose}\n label={selectedLabel}\n viewMode={viewMode}\n selectedYear={selectedYear}\n totalValue={selectedTotalValue}\n />\n )}\n </>\n );\n};\n\nexport default OrdersByType;\n","import { ReactElement, useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Bar,\n BarChart,\n CartesianGrid,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { ChartWrapper } from 'components/Analytics/ChartStyles';\nimport RotatedTick from 'components/Analytics/RotatedTick';\nimport { ViewMode } from 'utils/analytics';\nimport { formatDayLabel, formatMonthLabel } from 'utils/chart';\nimport { fShortenNumber } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport BarBackground from './BarBackground';\nimport BarLabel from './BarLabel';\nimport { ChartProps } from './props';\nimport OrdersByTypeTooltip from './Tooltip';\n\nconst Chart = ({\n data,\n viewMode,\n visibleSeries,\n activeBarIndex,\n onMouseMove,\n onMouseLeave,\n onBarClick,\n}: ChartProps) => {\n const isMonthly = viewMode === ViewMode.MONTHLY;\n const [containerWidth, setContainerWidth] = useState(0);\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const wrapperRefCallback = useCallback((node: HTMLDivElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n if (node) {\n setContainerWidth(node.clientWidth);\n observerRef.current = new ResizeObserver(() =>\n setContainerWidth(node.clientWidth),\n );\n observerRef.current.observe(node);\n }\n }, []);\n\n const shouldRotateLabels = useMemo(() => {\n if (!isMonthly) return false;\n if (containerWidth === 0 || data.length === 0) return false;\n const slotPerBar = (containerWidth - 60) / data.length;\n return slotPerBar < 80;\n }, [isMonthly, containerWidth, data.length]);\n\n const hasOrderData = useMemo(\n () => data.some(d => (d.order_count ?? 0) > 0),\n [data],\n );\n\n const hasQuotationData = useMemo(\n () => data.some(d => (d.quotation_count ?? 0) > 0),\n [data],\n );\n\n const yDomain = useMemo((): [number, number] => {\n if (!data.length) return [0, 1];\n const maxTotal = Math.max(\n ...data.map(d => (d.order_count ?? 0) + (d.quotation_count ?? 0)),\n );\n return [0, maxTotal > 0 ? maxTotal * 1.15 : 1];\n }, [data]);\n\n const yTicks = useMemo(() => {\n const [, max] = yDomain;\n const step = max / 6;\n return [\n ...new Set(Array.from({ length: 7 }, (_, i) => Math.round(step * i))),\n ];\n }, [yDomain]);\n\n const quotationsOnTop = visibleSeries.quotations && hasQuotationData;\n\n const ordersIsTop = visibleSeries.orders && hasOrderData && !quotationsOnTop;\n\n const tickFormatter = useMemo(\n () => (isMonthly ? formatMonthLabel : formatDayLabel),\n [isMonthly],\n );\n\n return (\n <ChartWrapper ref={wrapperRefCallback}>\n <ResponsiveContainer width=\"100%\" height={250}>\n <BarChart\n data={data}\n margin={{\n top: 20,\n right: 10,\n bottom: shouldRotateLabels ? -90 : 0,\n left: 20,\n }}\n barCategoryGap=\"20%\"\n style={{ cursor: 'pointer' }}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n onClick={state => {\n if (state?.activeTooltipIndex != null) {\n onBarClick?.(Number(state.activeTooltipIndex));\n }\n }}\n >\n <CartesianGrid\n vertical={false}\n strokeDasharray=\"3 3\"\n stroke=\"#F4F6F8\"\n />\n\n <XAxis\n dataKey=\"label\"\n axisLine={false}\n tickLine={false}\n {...(shouldRotateLabels && { interval: 0, height: 120 })}\n tick={\n shouldRotateLabels ? (\n <RotatedTick />\n ) : (\n { fontSize: 12, fill: '#637381' }\n )\n }\n tickFormatter={tickFormatter}\n />\n\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={(v: number) => fShortenNumber(v)}\n domain={yDomain}\n ticks={yTicks}\n />\n\n <Tooltip\n content={<OrdersByTypeTooltip viewMode={viewMode} />}\n cursor={false}\n />\n\n <Bar\n dataKey=\"order_count\"\n name=\"Vendas\"\n fill={COLORS.orders}\n stackId=\"orders\"\n maxBarSize={48}\n isAnimationActive={false}\n hide={!visibleSeries.orders}\n background={<BarBackground activeBarIndex={activeBarIndex} />}\n radius={ordersIsTop ? [4, 4, 0, 0] : undefined}\n {...(ordersIsTop && {\n label: {\n position: 'top' as const,\n fontSize: 11,\n fill: '#212B36',\n content: (\n <BarLabel\n data={data}\n visibleSeries={visibleSeries}\n isMonthly={isMonthly}\n shouldRotateLabels={shouldRotateLabels}\n />\n ) as unknown as ReactElement,\n },\n })}\n />\n\n <Bar\n dataKey=\"quotation_count\"\n name=\"Orçamentos\"\n fill={COLORS.quotations}\n stackId=\"orders\"\n maxBarSize={48}\n isAnimationActive={false}\n hide={!visibleSeries.quotations}\n radius={quotationsOnTop ? [4, 4, 0, 0] : undefined}\n {...(!visibleSeries.orders && {\n background: <BarBackground activeBarIndex={activeBarIndex} />,\n })}\n {...(quotationsOnTop && {\n label: {\n position: 'top' as const,\n fontSize: 11,\n fill: '#212B36',\n content: (\n <BarLabel\n data={data}\n visibleSeries={visibleSeries}\n isMonthly={isMonthly}\n shouldRotateLabels={shouldRotateLabels}\n />\n ) as unknown as ReactElement,\n },\n })}\n />\n </BarChart>\n </ResponsiveContainer>\n </ChartWrapper>\n );\n};\n\nexport default Chart;\n","import { ComponentType } from 'react';\n\nimport {\n OverviewDetailBaseProps,\n QuotationDashboardSeriesItem,\n} from 'types/overviewAnalytics';\nimport { ViewMode } from 'utils/analytics';\n\nexport interface OrdersByTypeProps {\n data: QuotationDashboardSeriesItem[];\n isFetching?: boolean;\n viewMode: ViewMode;\n selectedYear: number;\n DetailComponent?: ComponentType<OverviewDetailBaseProps>;\n}\n\nexport interface VisibleSeries {\n orders: boolean;\n quotations: boolean;\n}\n\nexport interface SummaryProps {\n isMonthly: boolean;\n ordersTotal: number;\n quotationsTotal: number;\n}\n\nexport interface LegendProps {\n visibleSeries: VisibleSeries;\n onToggleSerie: (serie: keyof VisibleSeries) => void;\n}\n\nexport const COLORS = {\n orders: '#22C55E',\n quotations: '#0EA5E9',\n} as const;\n","import { BarBackgroundComponentProps } from './props';\n\nconst BarBackground = ({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n index,\n activeBarIndex,\n}: BarBackgroundComponentProps) => {\n if (activeBarIndex !== index) return null;\n\n return (\n <rect\n x={x - 6}\n y={y}\n width={width + 12}\n height={height + 6}\n fill=\"#919EAB\"\n opacity={0.16}\n rx={6}\n />\n );\n};\n\nexport default BarBackground;\n","import { BarLabelProps } from './props';\n\nconst BarLabel = ({\n x = 0,\n y = 0,\n width = 0,\n index = 0,\n data,\n visibleSeries,\n isMonthly,\n shouldRotateLabels,\n}: BarLabelProps) => {\n if (!isMonthly || shouldRotateLabels) return null;\n\n const item = data[index];\n if (!item) return null;\n\n let total = 0;\n if (visibleSeries.orders) total += item.order_count ?? 0;\n if (visibleSeries.quotations) total += item.quotation_count ?? 0;\n if (!total) return null;\n\n return (\n <text\n x={x + width / 2}\n y={y - 8}\n textAnchor=\"middle\"\n fontSize={11}\n fill=\"#212B36\"\n >\n {total}\n </text>\n );\n};\n\nexport default BarLabel;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport SimpleCard from 'components/SimpleCard';\nimport { ViewMode } from 'utils/analytics';\nimport { MONTH_FULL_LABELS } from 'utils/chart';\nimport { fCurrencyBRL } from 'utils/formatNumber';\n\nimport { CustomTooltipProps } from './props';\n\nconst OrdersByTypeTooltip = ({\n active,\n payload,\n label,\n viewMode,\n}: CustomTooltipProps) => {\n if (!active || !payload?.length) return null;\n\n const isDaily = viewMode === ViewMode.DAILY;\n\n let formattedLabel = String(label);\n const parts = formattedLabel.split('-');\n\n if (parts.length >= 2) {\n const monthIndex = parseInt(parts[1], 10) - 1;\n const month = MONTH_FULL_LABELS[monthIndex];\n\n if (isDaily && parts.length === 3) {\n formattedLabel = `${parseInt(parts[2], 10)} de ${month} de ${parts[0]}`;\n } else if (!isDaily) {\n formattedLabel = `${month} de ${parts[0]}`;\n }\n }\n\n const data = payload[0].payload;\n\n const items = [\n {\n name: 'Vendas',\n count: data.order_count ?? 0,\n value: data.order_value ?? 0,\n color: payload.find(p => p.dataKey === 'order_count')?.color ?? '#22C55E',\n },\n {\n name: 'Orçamentos',\n count: data.quotation_count ?? 0,\n value: data.quotation_value ?? 0,\n color:\n payload.find(p => p.dataKey === 'quotation_count')?.color ?? '#0EA5E9',\n },\n ];\n\n return (\n <SimpleCard minWidth={{ xs: 'auto', sm: 300 }} p={1} gap={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {formattedLabel}\n </Typography>\n\n <Divider />\n\n <Stack>\n {items.map((entry, index) => (\n <Stack\n key={entry.name}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap={2}\n data-testid={`tooltip-item-${index}`}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack\n width={6}\n height={6}\n borderRadius=\"50%\"\n bgcolor={entry.color}\n />\n\n <Typography variant=\"body2\" noWrap>\n {entry.name}\n </Typography>\n </Stack>\n\n <Typography variant=\"body2\" color=\"text.disabled\" noWrap>\n {entry.count} {entry.count === 1 ? 'pedido' : 'pedidos'} \n <Typography component=\"span\" variant=\"body2\" color=\"text.primary\">\n {fCurrencyBRL(entry.value)}\n </Typography>\n </Typography>\n </Stack>\n ))}\n </Stack>\n </SimpleCard>\n );\n};\n\nexport default OrdersByTypeTooltip;\n","import Checkbox from '@mui/material/Checkbox';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Stack from '@mui/material/Stack';\n\nimport { COLORS, LegendProps } from './props';\n\nconst OrdersByTypeLegend = ({ visibleSeries, onToggleSerie }: LegendProps) => (\n <Stack direction=\"row\" justifyContent=\"center\" flexWrap=\"wrap\" gap={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.orders}\n onChange={() => onToggleSerie('orders')}\n sx={{ '&.Mui-checked': { color: COLORS.orders } }}\n />\n }\n label=\"Vendas\"\n />\n\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.quotations}\n onChange={() => onToggleSerie('quotations')}\n sx={{ '&.Mui-checked': { color: COLORS.quotations } }}\n />\n }\n label=\"Orçamentos\"\n />\n </Stack>\n);\n\nexport default OrdersByTypeLegend;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport useResponsive from 'hooks/useResponsive';\n\nimport { SummaryProps } from './props';\n\nconst Summary = ({ ordersTotal, quotationsTotal, isMonthly }: SummaryProps) => {\n const isMobile = useResponsive('down', 'md');\n\n return (\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n alignItems={{ xs: 'flex-start', md: 'center' }}\n flexWrap=\"wrap\"\n gap={3}\n >\n {isMobile && (\n <Divider\n orientation=\"horizontal\"\n flexItem\n sx={{\n borderStyle: 'dashed',\n mx: -3,\n }}\n />\n )}\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {isMonthly ? 'Vendas no ano' : 'Vendas no mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">{ordersTotal} vendas</Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {isMonthly ? 'Orçamentos no ano' : 'Orçamentos no mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {quotationsTotal} orçamentos\n </Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default Summary;\n","import Divider from '@mui/material/Divider';\nimport Link from '@mui/material/Link';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\nimport { GridRenderCellParams } from '@mui/x-data-grid-premium';\n\nimport DataView from 'components/DataView';\nimport Drawer from 'components/Drawer';\nimport Modal from 'components/Modal';\nimport SearchInput from 'components/SearchInput';\nimport useResponsive from 'hooks/useResponsive';\nimport { OverviewDetailOrder } from 'types/overviewAnalytics';\nimport { fCurrencyBRL } from 'utils/formatNumber';\nimport { fDate } from 'utils/formatTime';\n\nimport Header from './Header';\nimport { OverviewDetailProps } from './props';\nimport { MobileItemContainer, StyledDivider } from './styles';\n\nconst getOrderId = (order: OverviewDetailOrder) => (\n <Stack justifyContent=\"center\" height={1}>\n <Typography variant=\"body2\" color=\"text.primary\">\n {order.id}\n </Typography>\n </Stack>\n);\n\nconst getPartnerName = (\n order: OverviewDetailOrder,\n buildPartnerLink?: (partnerId: string) => string,\n) => (\n <Stack justifyContent=\"center\" height={1}>\n {order?.partner?.id && buildPartnerLink ? (\n <Link\n component=\"a\"\n href={buildPartnerLink(order.partner.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n variant=\"subtitle2\"\n sx={{ textDecoration: 'underline' }}\n noWrap\n >\n {order.partner?.name || '-'}\n </Link>\n ) : (\n <Typography variant=\"body2\" color=\"text.primary\" noWrap>\n {order.partner?.name || '-'}\n </Typography>\n )}\n </Stack>\n);\n\nconst getOrderValue = (order: OverviewDetailOrder) => (\n <Stack justifyContent=\"center\" height={1}>\n <Typography variant=\"body2\" color=\"text.primary\">\n {fCurrencyBRL(order.total_value)}\n </Typography>\n </Stack>\n);\n\nconst getOrderDate = (order: OverviewDetailOrder) => (\n <Stack justifyContent=\"center\" height={1}>\n {order.negotiation_date ? (\n <Typography variant=\"body2\" color=\"text.primary\">\n {fDate(order.negotiation_date, 'DD/MM/YYYY')}\n </Typography>\n ) : (\n '-'\n )}\n </Stack>\n);\n\nconst getOrderStatus = (order: OverviewDetailOrder) => (\n <Stack justifyContent=\"center\" height={1}>\n {order.status || '-'}\n </Stack>\n);\n\nconst getDefaultMobileRender = (order: OverviewDetailOrder) => (\n <MobileItemContainer key={order.id}>\n <Stack gap={1}>\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Pedido\n </Typography>\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {order.id}\n </Typography>\n </Stack>\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Cliente\n </Typography>\n <Typography variant=\"subtitle2\" color=\"primary.main\">\n {order.partner?.name || '-'}\n </Typography>\n </Stack>\n\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack flex={1} overflow=\"hidden\">\n <Typography variant=\"body2\" color=\"text.secondary\" noWrap>\n Valor do pedido\n </Typography>\n <Typography variant=\"subtitle2\" color=\"text.primary\" noWrap>\n {fCurrencyBRL(order.total_value)}\n </Typography>\n </Stack>\n\n <Divider\n orientation=\"vertical\"\n flexItem\n sx={{ borderStyle: 'dashed', mx: 3 }}\n />\n\n <Stack flex={1} overflow=\"hidden\">\n <Typography variant=\"body2\" color=\"text.secondary\" noWrap>\n Data\n </Typography>\n <Typography variant=\"subtitle2\" color=\"text.primary\" noWrap>\n {order.negotiation_date\n ? fDate(order.negotiation_date, 'DD/MM/YYYY')\n : '-'}\n </Typography>\n </Stack>\n </Stack>\n\n <Stack gap={0.5}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Status\n </Typography>\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {order.status || '-'}\n </Typography>\n </Stack>\n </Stack>\n </MobileItemContainer>\n);\n\nconst OverviewDetail = ({\n open,\n onClose,\n title,\n viewMode,\n selectedYear,\n totalValue,\n periodLabel,\n suffix,\n rows,\n total,\n isLoading,\n isFetching,\n page,\n perPage,\n onSearch,\n onPaginationChange,\n buildPartnerLink,\n mobileItemSlot,\n}: OverviewDetailProps) => {\n const isMobile = useResponsive('down', 'sm');\n\n const content = (\n <Stack gap={3}>\n <Stack\n direction={{ xs: 'column', sm: 'row' }}\n justifyContent=\"space-between\"\n gap={2}\n >\n <Stack\n minWidth={0}\n direction=\"row\"\n alignItems=\"center\"\n gap={3}\n flexWrap=\"wrap\"\n >\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Vendas {suffix}\n </Typography>\n\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {fCurrencyBRL(totalValue)}\n </Typography>\n </Stack>\n\n <StyledDivider orientation=\"vertical\" flexItem />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Qtd. de pedidos {suffix}\n </Typography>\n\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {total}\n </Typography>\n </Stack>\n </Stack>\n\n <SearchInput\n size=\"small\"\n placeholder=\"Buscar\"\n onSearch={onSearch}\n trigger=\"change\"\n iconPosition=\"start\"\n sx={{ minWidth: 200 }}\n />\n </Stack>\n\n <DataView\n title=\"Pedidos\"\n header={<></>}\n headerProps={{ p: 0 }}\n columns={[\n {\n field: 'external_id',\n headerName: 'Pedido',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) => getOrderId(row),\n },\n {\n field: 'partner_name',\n headerName: 'Cliente',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) =>\n getPartnerName(row, buildPartnerLink),\n },\n {\n field: 'total_value',\n headerName: 'Valor do pedido',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) => getOrderValue(row),\n },\n {\n field: 'created_at',\n headerName: 'Data',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) => getOrderDate(row),\n },\n {\n field: 'last_status',\n headerName: 'Status',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) => getOrderStatus(row),\n },\n ]}\n rows={rows}\n rowCount={total}\n mobileRender={(data: OverviewDetailOrder) =>\n mobileItemSlot ? mobileItemSlot(data) : getDefaultMobileRender(data)\n }\n loading={isLoading}\n fetching={isFetching}\n paginationModel={{ page, pageSize: perPage }}\n onPaginationChange={onPaginationChange}\n paginationMode=\"server\"\n disableRowSelectionOnClick\n disableColumnMenu\n containerProps={{ height: 400 }}\n />\n </Stack>\n );\n\n const header = (\n <Header\n title={title}\n viewMode={viewMode}\n selectedYear={selectedYear}\n periodLabel={periodLabel}\n />\n );\n\n if (isMobile) {\n return (\n <Drawer\n open={open}\n onClose={onClose}\n headerTitle={header}\n headerProps={{\n direction: 'row-reverse',\n sx: { '& > :last-child': { minWidth: 0, overflow: 'hidden' } },\n }}\n >\n {content}\n </Drawer>\n );\n }\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n maxWidth=\"lg\"\n dialogTitle={header}\n dialogTitleProps={{ sx: { flex: 1, overflow: 'hidden' } }}\n fullWidth\n >\n {content}\n </Modal>\n );\n};\n\nexport default OverviewDetail;\n","import Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport { VIEW_MODE_LABELS } from 'utils/analytics';\n\nimport { DetailHeaderProps } from './props';\n\nconst Header = ({\n title,\n viewMode,\n selectedYear,\n periodLabel,\n}: DetailHeaderProps) => {\n return (\n <Stack width=\"100%\" minWidth={0} overflow=\"hidden\">\n <Typography variant=\"subtitle1\" noWrap>\n Detalhes do relatório\n </Typography>\n\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n columnGap={1.5}\n rowGap={0}\n flexWrap=\"wrap\"\n >\n <Typography variant=\"body2\" color=\"text.secondary\" flexShrink={0}>\n {title}\n </Typography>\n •\n <Typography variant=\"body2\" flexShrink={0}>\n {VIEW_MODE_LABELS[viewMode]}\n </Typography>\n •\n <Typography variant=\"body2\" flexShrink={0}>\n {selectedYear}\n </Typography>\n •\n <Typography variant=\"body2\" color=\"text.secondary\" noWrap>\n {periodLabel}\n </Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default Header;\n","import MuiDivider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport { alpha, styled } from '@mui/material/styles';\n\nexport const StyledDivider = styled(MuiDivider)(() => ({\n height: 30,\n alignSelf: 'center',\n\n borderStyle: 'dashed',\n}));\n\nexport const MobileItemContainer = styled(Stack)(({ theme }) => ({\n position: 'relative',\n\n display: 'flex',\n flexDirection: 'column',\n padding: theme.spacing(2),\n gap: theme.spacing(1),\n color: theme.palette.text.primary,\n\n '& a': {\n textDecoration: 'none',\n },\n\n '&+div': {\n borderTop: `1px dashed ${alpha(theme.palette.grey[500], 0.2)}`,\n },\n}));\n","import { useCallback, useMemo } from 'react';\n\nimport useDatagrid from 'hooks/useDatagrid';\nimport { Filter, GridQuery } from 'types/filter';\nimport { ViewMode } from 'utils/analytics';\n\nimport { getDateRange, getPeriodLabel, getPeriodSuffix } from './utils';\n\nconst useOverviewDetailState = (label: string, viewMode: ViewMode) => {\n const { page, perPage, search, handlePaginationModelChange, handleSearch } =\n useDatagrid();\n\n const { startDate, endDate } = useMemo(\n () => getDateRange(label, viewMode),\n [label, viewMode],\n );\n\n const periodLabel = useMemo(\n () => getPeriodLabel(label, viewMode),\n [label, viewMode],\n );\n\n const suffix = getPeriodSuffix(viewMode);\n\n const queryParams = useMemo((): GridQuery => {\n return {\n page,\n perPage,\n ...(search ? { search } : {}),\n filter: {\n operator: 'AND',\n groups: [\n {\n operator: 'AND',\n conditionals: [\n {\n fieldName: 'negotiationDate',\n conditional: 'GREATER_THAN_OR_EQUAL',\n value: [`${startDate}T00:00:00`],\n },\n {\n fieldName: 'negotiationDate',\n conditional: 'LESS_THAN_OR_EQUAL',\n value: [`${endDate}T23:59:59`],\n },\n ],\n },\n ],\n } as Filter,\n };\n }, [endDate, page, perPage, search, startDate]);\n\n const handlePaginationChange = useCallback(\n (newPage: number, rowsPerPage: number) => {\n handlePaginationModelChange({ page: newPage, pageSize: rowsPerPage });\n },\n [handlePaginationModelChange],\n );\n\n return {\n page,\n perPage,\n periodLabel,\n suffix,\n queryParams,\n handleSearch,\n handlePaginationChange,\n };\n};\n\nexport default useOverviewDetailState;\n","import { ViewMode } from 'utils/analytics';\nimport { MONTH_FULL_LABELS } from 'utils/chart';\n\nexport const getDateRange = (\n label: string,\n viewMode: ViewMode,\n): { startDate: string; endDate: string } => {\n const parts = label.split('-');\n\n if (viewMode === ViewMode.DAILY && parts.length === 3) {\n const date = `${parts[0]}-${parts[1]}-${parts[2]}`;\n return { startDate: date, endDate: date };\n }\n\n const year = parseInt(parts[0], 10);\n const month = parseInt(parts[1], 10);\n const lastDay = new Date(year, month, 0).getDate();\n\n return {\n startDate: `${parts[0]}-${parts[1]}-01`,\n endDate: `${parts[0]}-${parts[1]}-${String(lastDay).padStart(2, '0')}`,\n };\n};\n\nexport const getPeriodLabel = (label: string, viewMode: ViewMode): string => {\n const parts = label.split('-');\n const monthIndex = parseInt(parts[1], 10) - 1;\n const monthName = MONTH_FULL_LABELS[monthIndex] ?? '';\n\n if (viewMode === ViewMode.DAILY && parts.length === 3) {\n const day = parseInt(parts[2], 10);\n return `${monthName} - Dia ${day}`;\n }\n\n return monthName;\n};\n\nexport const getPeriodSuffix = (viewMode: ViewMode): string =>\n viewMode === ViewMode.MONTHLY ? 'no mês' : 'no dia';\n","import { useCallback, useMemo, useState } from 'react';\nimport CardContent from '@mui/material/CardContent';\nimport CardHeader from '@mui/material/CardHeader';\nimport Stack from '@mui/material/Stack';\n\nimport ChartLoading from 'components/Analytics/ChartLoading';\nimport { ChartCard } from 'components/Analytics/ChartStyles';\nimport EmptyState from 'components/Analytics/EmptyState';\nimport Result from 'components/Result';\nimport { ViewMode } from 'utils/analytics';\nimport { fShortenNumber } from 'utils/formatNumber';\n\nimport SalesEvolutionChart from './Chart';\nimport SalesEvolutionLegend from './Legend';\nimport { SalesEvolutionProps, SeriesVisibility } from './props';\nimport SalesEvolutionSummary from './Summary';\n\nconst SalesEvolution = ({\n data,\n isFetching,\n kpis,\n viewMode,\n selectedYear,\n editGoalAction,\n DetailComponent,\n}: SalesEvolutionProps) => {\n const [visibleSeries, setVisibleSeries] = useState<SeriesVisibility>({\n realized: true,\n forecast: true,\n goal: true,\n });\n\n const [detailOpen, setDetailOpen] = useState(false);\n const [selectedLabel, setSelectedLabel] = useState('');\n const [selectedTotalValue, setSelectedTotalValue] = useState(0);\n\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const yDomain = useMemo((): [number, number] => {\n if (!data.length) return [0, 1];\n\n const values = data.flatMap(item => [\n Number(item.realized) || 0,\n Number(item.forecast) || 0,\n Number(item.goal) || 0,\n ]);\n\n const max = Math.max(...values);\n\n return [0, max > 0 ? max * 1.15 : 1];\n }, [data]);\n\n const yTicks = useMemo(() => {\n const [, max] = yDomain;\n\n const step = max / 6;\n\n const ticks = Array.from({ length: 7 }, (_, i) => Math.round(step * i));\n\n return [...new Set(ticks)];\n }, [yDomain]);\n\n const handleToggleSeries = useCallback((key: keyof SeriesVisibility) => {\n setVisibleSeries(prev => ({ ...prev, [key]: !prev[key] }));\n }, []);\n\n const handleToggleSerie = useCallback(\n (toggle: string) => handleToggleSeries(toggle as keyof SeriesVisibility),\n [handleToggleSeries],\n );\n\n const handleBarClick = useCallback(\n (index: number) => {\n const item = data[index];\n if (!item) return;\n setSelectedLabel(item.label);\n setSelectedTotalValue(item.realized);\n setDetailOpen(true);\n },\n [data],\n );\n\n const handleDetailClose = useCallback(() => {\n setDetailOpen(false);\n }, []);\n\n const formatYAxis = useCallback((v: number) => fShortenNumber(v), []);\n\n return (\n <>\n <ChartCard>\n <CardHeader title=\"Evolução de vendas\" />\n\n <CardContent>\n <Result isEmpty={data.length === 0} empty={<EmptyState />}>\n <Stack gap={3}>\n <Stack display={{ xs: 'none', md: 'block' }}>\n <SalesEvolutionSummary\n kpis={kpis}\n isMonthly={isMonthly}\n editGoalAction={editGoalAction}\n />\n </Stack>\n\n <ChartLoading active={isFetching}>\n <SalesEvolutionChart\n data={data}\n viewMode={viewMode}\n visibleSeries={visibleSeries}\n yDomain={yDomain}\n yTicks={yTicks}\n formatYAxis={formatYAxis}\n onBarClick={handleBarClick}\n />\n </ChartLoading>\n\n <SalesEvolutionLegend\n visibleSeries={visibleSeries}\n onToggleSerie={handleToggleSerie}\n />\n\n <Stack display={{ xs: 'block', md: 'none' }}>\n <SalesEvolutionSummary\n kpis={kpis}\n isMonthly={isMonthly}\n editGoalAction={editGoalAction}\n />\n </Stack>\n </Stack>\n </Result>\n </CardContent>\n </ChartCard>\n\n {selectedLabel && DetailComponent && (\n <DetailComponent\n open={detailOpen}\n onClose={handleDetailClose}\n label={selectedLabel}\n viewMode={viewMode}\n selectedYear={selectedYear}\n totalValue={selectedTotalValue}\n />\n )}\n </>\n );\n};\n\nexport default SalesEvolution;\n","import { useCallback, useMemo, useRef, useState } from 'react';\nimport { CategoricalChartFunc } from 'recharts/types/chart/types';\n\nimport { ChartWrapper } from 'components/Analytics/ChartStyles';\nimport { ViewMode } from 'utils/analytics';\n\nimport DailyChart from './DailyView';\nimport MonthlyChart from './MonthlyView';\nimport { SalesEvolutionChartProps } from './props';\n\nconst SalesEvolutionChart = ({\n data,\n viewMode,\n visibleSeries,\n yDomain,\n yTicks,\n formatYAxis,\n onBarClick,\n}: SalesEvolutionChartProps) => {\n const [activeBarIndex, setActiveBarIndex] = useState<number | null>(null);\n const [containerWidth, setContainerWidth] = useState(0);\n\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const shouldRotateLabels = useMemo(() => {\n if (!isMonthly || containerWidth === 0 || data.length === 0) return false;\n\n const slotPerBar = (containerWidth - 60) / data.length;\n\n return slotPerBar < 60;\n }, [containerWidth, data.length, isMonthly]);\n\n const handleMouseLeave = useCallback<CategoricalChartFunc>(\n () => setActiveBarIndex(null),\n [],\n );\n\n const handleMouseMove = useCallback<CategoricalChartFunc>(state => {\n if (state?.activeTooltipIndex != null) {\n setActiveBarIndex(Number(state.activeTooltipIndex));\n }\n }, []);\n\n const wrapperRefCallback = useCallback((node: HTMLDivElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n\n if (node) {\n setContainerWidth(node.clientWidth);\n\n observerRef.current = new ResizeObserver(() =>\n setContainerWidth(node.clientWidth),\n );\n observerRef.current.observe(node);\n }\n }, []);\n\n if (isMonthly) {\n return (\n <ChartWrapper ref={wrapperRefCallback}>\n <MonthlyChart\n data={data}\n visibleSeries={visibleSeries}\n yDomain={yDomain}\n yTicks={yTicks}\n formatYAxis={formatYAxis}\n shouldRotateLabels={shouldRotateLabels}\n activeBarIndex={activeBarIndex}\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n onBarClick={onBarClick}\n viewMode={viewMode}\n />\n </ChartWrapper>\n );\n }\n\n return (\n <ChartWrapper ref={wrapperRefCallback}>\n <DailyChart\n data={data}\n visibleSeries={visibleSeries}\n yDomain={yDomain}\n yTicks={yTicks}\n formatYAxis={formatYAxis}\n viewMode={viewMode}\n activeBarIndex={activeBarIndex}\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n onBarClick={onBarClick}\n />\n </ChartWrapper>\n );\n};\n\nexport default SalesEvolutionChart;\n","import { useCallback } from 'react';\nimport {\n Bar,\n CartesianGrid,\n ComposedChart,\n Line,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { formatDayLabel } from 'utils/chart';\nimport { fShortenNumber } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport BarBackground from './BarBackground';\nimport { DailyChartProps } from './props';\nimport SalesEvolutionTooltip from './Tooltip';\n\nconst DailyChart = ({\n data,\n visibleSeries,\n yDomain,\n yTicks,\n viewMode,\n activeBarIndex,\n onMouseMove,\n onMouseLeave,\n onBarClick,\n}: DailyChartProps) => {\n const formatYAxis = useCallback((v: number) => fShortenNumber(v), []);\n\n return (\n <ResponsiveContainer width=\"100%\" height={350}>\n <ComposedChart\n data={data}\n margin={{ top: 20, right: 10, bottom: 0, left: 20 }}\n style={{ cursor: 'pointer' }}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n onClick={state => {\n if (state?.activeTooltipIndex != null) {\n onBarClick?.(Number(state.activeTooltipIndex));\n }\n }}\n >\n <CartesianGrid\n vertical={false}\n strokeDasharray=\"3 3\"\n stroke=\"#F4F6F8\"\n />\n\n <XAxis\n dataKey=\"label\"\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={formatDayLabel}\n />\n\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={formatYAxis}\n domain={yDomain}\n ticks={yTicks}\n />\n\n <Tooltip content={<SalesEvolutionTooltip viewMode={viewMode} />} />\n\n <Bar\n dataKey=\"realized\"\n fill=\"transparent\"\n isAnimationActive={false}\n background={<BarBackground activeBarIndex={activeBarIndex} />}\n />\n\n {visibleSeries.goal && (\n <Line\n dataKey=\"goal\"\n name=\"Meta\"\n stroke={COLORS.goal}\n strokeWidth={2}\n strokeDasharray=\"8 4\"\n dot={false}\n isAnimationActive={false}\n />\n )}\n\n {visibleSeries.realized && (\n <Line\n dataKey=\"realized\"\n name=\"Vendas\"\n stroke={COLORS.sales}\n strokeWidth={2}\n dot={{\n fill: COLORS.sales,\n r: 4,\n strokeWidth: 0,\n }}\n isAnimationActive={false}\n />\n )}\n\n {visibleSeries.forecast && (\n <Line\n dataKey=\"forecast\"\n name=\"Previsto\"\n stroke={COLORS.forecast}\n strokeWidth={2}\n strokeDasharray=\"6 3\"\n dot={{\n fill: COLORS.forecast,\n r: 4,\n strokeWidth: 0,\n }}\n isAnimationActive={false}\n />\n )}\n </ComposedChart>\n </ResponsiveContainer>\n );\n};\n\nexport default DailyChart;\n","import { ReactNode } from 'react';\nimport { ComponentType } from 'react';\n\nimport {\n OverviewDetailBaseProps,\n RevenueGoalDashboardKpis,\n RevenueGoalDashboardSeriesItem,\n} from 'types/overviewAnalytics';\nimport { ViewMode } from 'utils/analytics';\n\nexport interface SalesEvolutionProps {\n data: RevenueGoalDashboardSeriesItem[];\n kpis?: RevenueGoalDashboardKpis;\n isFetching?: boolean;\n viewMode: ViewMode;\n selectedYear: number;\n editGoalAction?: ReactNode;\n DetailComponent?: ComponentType<OverviewDetailBaseProps>;\n}\n\nexport interface SeriesVisibility {\n realized: boolean;\n forecast: boolean;\n goal: boolean;\n}\n\nexport interface SummaryProps {\n kpis?: RevenueGoalDashboardKpis;\n isMonthly: boolean;\n editGoalAction?: ReactNode;\n}\n\nexport interface LegendProps {\n visibleSeries: SeriesVisibility;\n onToggleSerie: (toggle: keyof SeriesVisibility) => void;\n}\n\nexport const COLORS = {\n sales: '#22C55E',\n forecast: '#F59E0B',\n goal: '#212B36',\n} as const;\n","import { COLORS } from '../props';\n\nimport { BarBackgroundComponentProps } from './props';\n\nconst BarBackground = ({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n index,\n activeBarIndex,\n}: BarBackgroundComponentProps) => {\n if (activeBarIndex !== index) return null;\n\n return (\n <rect\n x={x - 6}\n y={y}\n width={width + 6 * 2}\n height={height + 6}\n fill={COLORS.sales}\n opacity={0.16}\n rx={6}\n />\n );\n};\n\nexport default BarBackground;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport SimpleCard from 'components/SimpleCard';\nimport { ViewMode } from 'utils/analytics';\nimport { MONTH_FULL_LABELS } from 'utils/chart';\nimport { fCurrencyBRL } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport { CustomTooltipProps, TooltipDataItem } from './props';\n\nconst SalesEvolutionTooltip = ({\n active,\n payload,\n label,\n viewMode,\n}: CustomTooltipProps) => {\n if (!active || !payload?.length) return null;\n\n const isDaily = viewMode === ViewMode.DAILY;\n\n const data = payload[0].payload as TooltipDataItem;\n const realized = Number(data.realized) || 0;\n const forecast = Number(data.forecast) || 0;\n const goal = Number(data.goal) || 0;\n\n const achievement = goal > 0 ? (realized / goal) * 100 : 0;\n const gap = goal > realized ? goal - realized : 0;\n\n const timeUnitStr = isDaily ? 'no dia' : 'no mês';\n const goalStr = isDaily ? 'diária' : 'mensal';\n\n let formattedLabel = String(label);\n const parts = formattedLabel.split('-');\n\n if (parts.length >= 2) {\n const monthIndex = parseInt(parts[1], 10) - 1;\n const month = MONTH_FULL_LABELS[monthIndex];\n\n if (isDaily && parts.length === 3) {\n formattedLabel = `${parseInt(parts[2], 10)} de ${month} de ${parts[0]}`;\n } else if (!isDaily) {\n formattedLabel = `${month} de ${parts[0]}`;\n }\n }\n\n const items = [\n {\n name: `Realizado ${timeUnitStr}`,\n value: fCurrencyBRL(realized),\n color: COLORS.sales,\n },\n {\n name: `Previsto ${timeUnitStr}`,\n value: fCurrencyBRL(forecast),\n color: COLORS.forecast,\n },\n {\n name: `Meta ${goalStr}`,\n value: fCurrencyBRL(goal),\n color: COLORS.goal,\n },\n {\n name: 'Atingimento',\n value: `${achievement.toFixed(0)}%`,\n color: '#00B8D9',\n },\n {\n name: `GAP ${timeUnitStr}`,\n value: fCurrencyBRL(gap),\n color: '#FF5630',\n },\n ];\n\n return (\n <SimpleCard minWidth={{ xs: 'auto', sm: 400 }} p={1} gap={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {formattedLabel}\n </Typography>\n\n <Divider />\n\n <Stack>\n {items.map((entry, index) => (\n <Stack\n key={index}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap={3}\n data-testid={`tooltip-item-${index}`}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack\n width={6}\n height={6}\n borderRadius=\"50%\"\n bgcolor={entry.color}\n />\n\n <Typography variant=\"body2\" noWrap>\n {entry.name}\n </Typography>\n </Stack>\n\n <Typography variant=\"body2\">{entry.value}</Typography>\n </Stack>\n ))}\n </Stack>\n </SimpleCard>\n );\n};\n\nexport default SalesEvolutionTooltip;\n","import { useMemo } from 'react';\nimport {\n Bar,\n CartesianGrid,\n ComposedChart,\n Line,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport RotatedTick from 'components/Analytics/RotatedTick';\nimport { formatMonthLabel } from 'utils/chart';\nimport { fCurrencyBRL, fShortenNumber } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport BarBackground from './BarBackground';\nimport { MonthlyChartProps } from './props';\nimport SalesEvolutionTooltip from './Tooltip';\n\nconst MonthlyChart = ({\n data,\n visibleSeries,\n yDomain,\n yTicks,\n shouldRotateLabels,\n activeBarIndex,\n onMouseMove,\n onMouseLeave,\n onBarClick,\n viewMode,\n}: MonthlyChartProps) => {\n const barLabelConfig = useMemo(\n () =>\n shouldRotateLabels\n ? false\n : {\n position: 'top' as const,\n fontSize: 12,\n fill: '#212B36',\n formatter: (value: unknown) => fCurrencyBRL(Number(value)),\n },\n [shouldRotateLabels],\n );\n\n return (\n <ResponsiveContainer width=\"100%\" height={300}>\n <ComposedChart\n data={data}\n margin={{\n top: 20,\n right: 10,\n bottom: shouldRotateLabels ? -90 : 0,\n left: 20,\n }}\n barCategoryGap=\"20%\"\n style={{ cursor: 'pointer' }}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n onClick={state => {\n if (state?.activeTooltipIndex != null) {\n onBarClick?.(Number(state.activeTooltipIndex));\n }\n }}\n >\n <CartesianGrid\n vertical={false}\n strokeDasharray=\"3 3\"\n stroke=\"#F4F6F8\"\n />\n\n <XAxis\n dataKey=\"label\"\n axisLine={false}\n tickLine={false}\n {...(shouldRotateLabels && { interval: 0, height: 120 })}\n tick={\n shouldRotateLabels ? (\n <RotatedTick />\n ) : (\n { fontSize: 12, fill: '#637381' }\n )\n }\n tickFormatter={formatMonthLabel}\n />\n\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={(v: number) => fShortenNumber(v)}\n domain={yDomain}\n ticks={yTicks}\n />\n\n <Tooltip content={<SalesEvolutionTooltip viewMode={viewMode} />} />\n\n {visibleSeries.goal && (\n <Line\n dataKey=\"goal\"\n name=\"Meta\"\n stroke={COLORS.goal}\n strokeWidth={2}\n strokeDasharray=\"8 4\"\n dot={false}\n isAnimationActive={false}\n />\n )}\n\n {visibleSeries.realized && (\n <Bar\n dataKey=\"realized\"\n name=\"Vendas\"\n fill={COLORS.sales}\n maxBarSize={48}\n isAnimationActive={false}\n radius={[4, 4, 0, 0]}\n background={<BarBackground activeBarIndex={activeBarIndex} />}\n label={barLabelConfig}\n />\n )}\n\n {visibleSeries.forecast && (\n <Line\n dataKey=\"forecast\"\n name=\"Previsto\"\n stroke={COLORS.forecast}\n strokeWidth={2}\n strokeDasharray=\"6 3\"\n dot={{\n fill: COLORS.forecast,\n r: 4,\n strokeWidth: 0,\n }}\n isAnimationActive={false}\n />\n )}\n </ComposedChart>\n </ResponsiveContainer>\n );\n};\n\nexport default MonthlyChart;\n","import Checkbox from '@mui/material/Checkbox';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Stack from '@mui/material/Stack';\n\nimport { COLORS, LegendProps } from './props';\n\nconst SalesEvolutionLegend = ({\n visibleSeries,\n onToggleSerie,\n}: LegendProps) => (\n <Stack direction=\"row\" justifyContent=\"center\" flexWrap=\"wrap\" gap={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.realized}\n onChange={() => onToggleSerie('realized')}\n sx={{ '&.Mui-checked': { color: COLORS.sales } }}\n />\n }\n label=\"Vendas\"\n />\n\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.forecast}\n onChange={() => onToggleSerie('forecast')}\n sx={{ '&.Mui-checked': { color: COLORS.forecast } }}\n />\n }\n label=\"Previsto\"\n />\n\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.goal}\n onChange={() => onToggleSerie('goal')}\n sx={{ '&.Mui-checked': { color: COLORS.goal } }}\n />\n }\n label=\"Meta\"\n />\n </Stack>\n);\n\nexport default SalesEvolutionLegend;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport InfoCircle from 'components/InfoCircle';\nimport useResponsive from 'hooks/useResponsive';\nimport { fCurrencyBRL, fPercent } from 'utils/formatNumber';\n\nimport { SummaryProps } from './props';\n\nconst Summary = ({ kpis, isMonthly, editGoalAction }: SummaryProps) => {\n const isMobile = useResponsive('down', 'md');\n\n return (\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n alignItems={{ xs: 'flex-start', md: 'center' }}\n flexWrap=\"wrap\"\n gap={3}\n >\n {isMobile && (\n <Divider\n orientation=\"horizontal\"\n flexItem\n sx={{\n borderStyle: 'dashed',\n mx: -3,\n }}\n />\n )}\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Previsto no {isMonthly ? 'ano' : 'mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fCurrencyBRL(kpis?.forecast)}\n </Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Realizado no {isMonthly ? 'ano' : 'mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fCurrencyBRL(kpis?.realized)}\n </Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Stack direction=\"row\" alignItems=\"center\" gap={3}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Meta {isMonthly ? 'anual' : 'mensal'}\n </Typography>\n\n {editGoalAction}\n </Stack>\n\n <Typography variant=\"subtitle2\">{fCurrencyBRL(kpis?.goal)}</Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Atingimento\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fPercent(kpis?.achievement ?? 0, {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n })}\n </Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Stack direction=\"row\" gap={0.5}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n GAP do {isMonthly ? 'ano' : 'mês'}\n </Typography>\n\n <InfoCircle\n text=\"Diferença entre o valor realizado e a meta. Um GAP significa que as vendas ainda estão abaixo do objetivo definido para o período.\"\n width={18}\n arrow\n sx={{ mt: -0.1 }}\n />\n </Stack>\n\n <Typography variant=\"subtitle2\">{fCurrencyBRL(kpis?.gap)}</Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default Summary;\n","import { useCallback, useMemo, useState } from 'react';\nimport CardContent from '@mui/material/CardContent';\nimport CardHeader from '@mui/material/CardHeader';\nimport Stack from '@mui/material/Stack';\nimport { CategoricalChartFunc } from 'recharts/types/chart/types';\n\nimport ChartLoading from 'components/Analytics/ChartLoading';\nimport { ChartCard } from 'components/Analytics/ChartStyles';\nimport EmptyState from 'components/Analytics/EmptyState';\nimport Result from 'components/Result';\nimport { ViewMode } from 'utils/analytics';\n\nimport ForecastChart from './Chart';\nimport SalesForecastLegend from './Legend';\nimport { SalesForecastProps, VisibleSeries } from './props';\nimport SalesForecastSummary from './Summary';\n\nconst SalesForecast = ({ data, viewMode, isFetching }: SalesForecastProps) => {\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const [visibleSeries, setVisibleSeries] = useState<VisibleSeries>({\n realized: true,\n forecast: true,\n });\n const [activeBarIndex, setActiveBarIndex] = useState<number | null>(null);\n\n const handleToggleSerie = useCallback((serie: keyof VisibleSeries) => {\n setVisibleSeries(prev => ({ ...prev, [serie]: !prev[serie] }));\n }, []);\n\n const handleMouseMove = useCallback<CategoricalChartFunc>(state => {\n if (state?.activeTooltipIndex != null) {\n setActiveBarIndex(Number(state.activeTooltipIndex));\n }\n }, []);\n\n const handleMouseLeave = useCallback<CategoricalChartFunc>(\n () => setActiveBarIndex(null),\n [],\n );\n\n const totals = useMemo(() => {\n const totalRealized = data.reduce(\n (acc, item) => acc + (item.realized_value ?? 0),\n 0,\n );\n\n const totalForecast = data.reduce(\n (acc, item) => acc + (item.forecast_value ?? 0),\n 0,\n );\n\n const percentage =\n totalForecast > 0 ? Math.round((totalRealized / totalForecast) * 100) : 0;\n return { totalRealized, totalForecast, percentage };\n }, [data]);\n\n return (\n <ChartCard>\n <CardHeader title=\"Previsto vs. Realizado (Positivação)\" />\n\n <CardContent>\n <Result isEmpty={data.length === 0} empty={<EmptyState />}>\n <Stack gap={3}>\n <Stack display={{ xs: 'none', md: 'block' }}>\n <SalesForecastSummary\n totalForecast={totals.totalForecast}\n totalRealized={totals.totalRealized}\n percentage={totals.percentage}\n isMonthly={isMonthly}\n />\n </Stack>\n\n <ChartLoading active={isFetching}>\n <ForecastChart\n data={data}\n viewMode={viewMode}\n visibleSeries={visibleSeries}\n activeBarIndex={activeBarIndex}\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n />\n </ChartLoading>\n\n <SalesForecastLegend\n visibleSeries={visibleSeries}\n onToggleSerie={handleToggleSerie}\n />\n\n <Stack display={{ xs: 'block', md: 'none' }}>\n <SalesForecastSummary\n totalForecast={totals.totalForecast}\n totalRealized={totals.totalRealized}\n percentage={totals.percentage}\n isMonthly={isMonthly}\n />\n </Stack>\n </Stack>\n </Result>\n </CardContent>\n </ChartCard>\n );\n};\n\nexport default SalesForecast;\n","import { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Bar,\n BarChart,\n CartesianGrid,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { ChartWrapper } from 'components/Analytics/ChartStyles';\nimport RotatedTick from 'components/Analytics/RotatedTick';\nimport { ViewMode } from 'utils/analytics';\nimport { formatDayLabel, formatMonthLabel } from 'utils/chart';\nimport { fShortenNumber } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport BarBackground from './BarBackground';\nimport { ChartProps } from './props';\nimport RealizedBackground from './RealizedBackground';\nimport SalesForecastTooltip from './Tooltip';\n\nconst ForecastChart = ({\n data,\n viewMode,\n visibleSeries,\n activeBarIndex,\n onMouseMove,\n onMouseLeave,\n}: ChartProps) => {\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const [containerWidth, setContainerWidth] = useState(0);\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const wrapperRefCallback = useCallback((node: HTMLDivElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n if (node) {\n setContainerWidth(node.clientWidth);\n observerRef.current = new ResizeObserver(() =>\n setContainerWidth(node.clientWidth),\n );\n observerRef.current.observe(node);\n }\n }, []);\n\n const shouldRotateLabels = useMemo(() => {\n if (!isMonthly) return false;\n if (containerWidth === 0 || data.length === 0) return false;\n const slotPerBar = (containerWidth - 60) / data.length;\n return slotPerBar < 80;\n }, [isMonthly, containerWidth, data.length]);\n\n const hasRealizedData = useMemo(\n () => data.some(item => item.realized_value > 0),\n [data],\n );\n\n const hasForecastData = useMemo(\n () => data.some(item => item.forecast_value > 0),\n [data],\n );\n\n const yDomain = useMemo((): [number, number] => {\n if (!data.length) return [0, 1];\n const values = data.flatMap(item => [\n item.realized_value,\n item.forecast_value,\n ]);\n const max = Math.max(...values);\n return [0, max > 0 ? max * 1.15 : 1];\n }, [data]);\n\n const yTicks = useMemo(() => {\n const [, max] = yDomain;\n const step = max / 6;\n return [\n ...new Set(Array.from({ length: 7 }, (_, i) => Math.round(step * i))),\n ];\n }, [yDomain]);\n\n const tickFormatter = useMemo(\n () => (isMonthly ? formatMonthLabel : formatDayLabel),\n [isMonthly],\n );\n\n const bothRendered =\n visibleSeries.realized &&\n hasRealizedData &&\n visibleSeries.forecast &&\n hasForecastData;\n\n return (\n <ChartWrapper ref={wrapperRefCallback}>\n <ResponsiveContainer width=\"100%\" height={250}>\n <BarChart\n data={data}\n margin={{\n top: 20,\n right: 10,\n bottom: shouldRotateLabels ? -90 : 0,\n left: 20,\n }}\n barCategoryGap=\"20%\"\n barGap={4}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n >\n <CartesianGrid\n vertical={false}\n strokeDasharray=\"3 3\"\n stroke=\"#F4F6F8\"\n />\n\n <XAxis\n dataKey=\"label\"\n axisLine={false}\n tickLine={false}\n {...(shouldRotateLabels && { interval: 0, height: 120 })}\n tick={\n shouldRotateLabels ? (\n <RotatedTick />\n ) : (\n { fontSize: 12, fill: '#637381' }\n )\n }\n tickFormatter={tickFormatter}\n />\n\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={(v: number) => fShortenNumber(v)}\n domain={yDomain}\n ticks={yTicks}\n />\n\n <Tooltip\n content={<SalesForecastTooltip viewMode={viewMode} />}\n cursor={false}\n />\n\n {visibleSeries.realized && hasRealizedData && (\n <Bar\n dataKey=\"realized_value\"\n name=\"Realizado\"\n fill={COLORS.realized}\n maxBarSize={32}\n isAnimationActive={false}\n radius={[4, 4, 0, 0]}\n background={\n <RealizedBackground\n activeBarIndex={activeBarIndex}\n bothRendered={bothRendered}\n />\n }\n />\n )}\n\n {visibleSeries.forecast && hasForecastData && (\n <Bar\n dataKey=\"forecast_value\"\n name=\"Previsto\"\n fill={COLORS.forecast}\n maxBarSize={32}\n isAnimationActive={false}\n radius={[4, 4, 0, 0]}\n {...(!visibleSeries.realized && {\n background: <BarBackground activeBarIndex={activeBarIndex} />,\n })}\n />\n )}\n </BarChart>\n </ResponsiveContainer>\n </ChartWrapper>\n );\n};\n\nexport default ForecastChart;\n","import { SalesForecastDashboardSeriesItem } from 'types/overviewAnalytics';\nimport { ViewMode } from 'utils/analytics';\n\nexport interface SalesForecastProps {\n data: SalesForecastDashboardSeriesItem[];\n isFetching?: boolean;\n viewMode: ViewMode;\n}\n\nexport interface VisibleSeries {\n realized: boolean;\n forecast: boolean;\n}\n\nexport interface SummaryProps {\n totalForecast: number;\n totalRealized: number;\n percentage: number;\n isMonthly: boolean;\n}\n\nexport interface LegendProps {\n visibleSeries: VisibleSeries;\n onToggleSerie: (serie: keyof VisibleSeries) => void;\n}\n\nexport const COLORS = {\n realized: '#22C55E',\n forecast: '#F59E0B',\n} as const;\n","import { BarBackgroundComponentProps } from './props';\n\nconst BarBackground = ({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n index,\n activeBarIndex,\n}: BarBackgroundComponentProps) => {\n if (activeBarIndex !== index) return null;\n\n return (\n <rect\n x={x - 6}\n y={y}\n width={width + 12}\n height={height + 6}\n fill=\"#919EAB\"\n opacity={0.16}\n rx={6}\n />\n );\n};\n\nexport default BarBackground;\n","import { RealizedBackgroundProps } from './props';\n\nconst RealizedBackground = ({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n index,\n activeBarIndex,\n bothRendered,\n}: RealizedBackgroundProps) => {\n if (activeBarIndex !== index) return null;\n\n return (\n <rect\n x={x - 6}\n y={y}\n width={bothRendered ? width * 2 + 4 + 12 : width + 12}\n height={height + 6}\n fill=\"#919EAB\"\n opacity={0.16}\n rx={6}\n />\n );\n};\n\nexport default RealizedBackground;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport SimpleCard from 'components/SimpleCard';\nimport { ViewMode } from 'utils/analytics';\nimport { MONTH_FULL_LABELS } from 'utils/chart';\nimport { fCurrencyBRL } from 'utils/formatNumber';\n\nimport { CustomTooltipProps } from './props';\n\nconst SalesForecastTooltip = ({\n active,\n payload,\n label,\n viewMode,\n}: CustomTooltipProps) => {\n if (!active || !payload?.length) return null;\n\n const isDaily = viewMode === ViewMode.DAILY;\n\n let formattedLabel = String(label);\n const parts = formattedLabel.split('-');\n\n if (parts.length >= 2) {\n const monthIndex = parseInt(parts[1], 10) - 1;\n const month = MONTH_FULL_LABELS[monthIndex];\n\n if (isDaily && parts.length === 3) {\n formattedLabel = `${parseInt(parts[2], 10)} de ${month} de ${parts[0]}`;\n } else if (!isDaily) {\n formattedLabel = `${month} de ${parts[0]}`;\n }\n }\n\n return (\n <SimpleCard minWidth={{ xs: 'auto', sm: 200 }} p={1} gap={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {formattedLabel}\n </Typography>\n\n <Divider />\n\n <Stack>\n {payload.map((entry, index) => (\n <Stack\n key={entry.name}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap={3}\n data-testid={`tooltip-item-${index}`}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack\n width={6}\n height={6}\n borderRadius=\"50%\"\n bgcolor={entry.color}\n />\n\n <Typography variant=\"body2\" noWrap>\n {entry.name}\n </Typography>\n </Stack>\n\n <Typography variant=\"body2\">{fCurrencyBRL(entry.value)}</Typography>\n </Stack>\n ))}\n </Stack>\n </SimpleCard>\n );\n};\n\nexport default SalesForecastTooltip;\n","import Checkbox from '@mui/material/Checkbox';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Stack from '@mui/material/Stack';\n\nimport { COLORS, LegendProps } from './props';\n\nconst SalesForecastLegend = ({ visibleSeries, onToggleSerie }: LegendProps) => (\n <Stack direction=\"row\" justifyContent=\"center\" flexWrap=\"wrap\" gap={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.realized}\n onChange={() => onToggleSerie('realized')}\n sx={{ '&.Mui-checked': { color: COLORS.realized } }}\n />\n }\n label=\"Realizado\"\n />\n\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.forecast}\n onChange={() => onToggleSerie('forecast')}\n sx={{ '&.Mui-checked': { color: COLORS.forecast } }}\n />\n }\n label=\"Previsto\"\n />\n </Stack>\n);\n\nexport default SalesForecastLegend;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport useResponsive from 'hooks/useResponsive';\nimport { fCurrencyBRL } from 'utils/formatNumber';\n\nimport { SummaryProps } from './props';\n\nconst SalesForecastSummary = ({\n totalForecast,\n totalRealized,\n percentage,\n isMonthly,\n}: SummaryProps) => {\n const isMobile = useResponsive('down', 'md');\n\n return (\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n alignItems={{ xs: 'flex-start', md: 'center' }}\n flexWrap=\"wrap\"\n gap={3}\n >\n {isMobile && (\n <Divider\n orientation=\"horizontal\"\n flexItem\n sx={{\n borderStyle: 'dashed',\n mx: -3,\n }}\n />\n )}\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {isMonthly ? 'Total previsto no ano' : 'Total previsto no mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fCurrencyBRL(totalForecast)}\n </Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {isMonthly ? 'Total realizado no ano' : 'Total realizado no mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fCurrencyBRL(totalRealized)}\n </Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Atingimento\n </Typography>\n\n <Typography variant=\"subtitle2\">{percentage}%</Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default SalesForecastSummary;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Chart/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/props.ts","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Chart/BarBackground.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Chart/BarLabel.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Chart/Tooltip.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Legend.tsx","../../../../src/components/Analytics/OverviewAnalytics/OrdersByType/Summary.tsx","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/Header.tsx","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/styles.ts","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/useOverviewDetailState.ts","../../../../src/components/Analytics/OverviewAnalytics/OverviewDetail/utils.ts","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/DailyView.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/props.ts","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/BarBackground.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/Tooltip.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Chart/MonthlyView.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Legend.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesEvolution/Summary.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Chart/index.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/props.ts","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Chart/BarBackground.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Chart/RealizedBackground.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Chart/Tooltip.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Legend.tsx","../../../../src/components/Analytics/OverviewAnalytics/SalesForecast/Summary.tsx"],"names":["useCallback","useMemo","useState","CardContent","CardHeader","Stack","useRef","Bar","BarChart","CartesianGrid","ResponsiveContainer","Tooltip","XAxis","YAxis","COLORS","jsx","BarBackground","x","y","width","height","index","activeBarIndex","BarBackground_default","BarLabel","data","visibleSeries","isMonthly","shouldRotateLabels","item","total","BarLabel_default","Divider","Typography","jsxs","OrdersByTypeTooltip","active","payload","label","viewMode","isDaily","formattedLabel","parts","monthIndex","month","MONTH_FULL_LABELS","items","p","SimpleCard_default","entry","fCurrencyBRL","Tooltip_default","Chart","onMouseMove","onMouseLeave","onBarClick","containerWidth","setContainerWidth","observerRef","wrapperRefCallback","node","hasOrderData","d","hasQuotationData","yDomain","maxTotal","yTicks","max","step","_","i","quotationsOnTop","ordersIsTop","tickFormatter","formatMonthLabel","formatDayLabel","ChartWrapper","state","RotatedTick_default","v","fShortenNumber","Chart_default","Checkbox","FormControlLabel","OrdersByTypeLegend","onToggleSerie","Legend_default","Summary","ordersTotal","quotationsTotal","isMobile","useResponsive_default","Summary_default","Fragment","OrdersByType","isFetching","selectedYear","DetailComponent","setVisibleSeries","setActiveBarIndex","detailOpen","setDetailOpen","selectedLabel","setSelectedLabel","selectedTotalValue","setSelectedTotalValue","handleToggleSerie","serie","prev","handleMouseMove","handleMouseLeave","handleBarClick","handleDetailClose","totals","acc","ChartCard","Result_default","EmptyState_default","ChartLoading_default","OrdersByType_default","Link","Header","title","periodLabel","VIEW_MODE_LABELS","Header_default","MuiDivider","alpha","styled","StyledDivider","MobileItemContainer","theme","getOrderId","order","getPartnerName","buildPartnerLink","getOrderValue","getOrderDate","fDate","getOrderStatus","getDefaultMobileRender","hideStatus","OverviewDetail","open","onClose","totalValue","suffix","rows","isLoading","page","perPage","onSearch","onPaginationChange","mobileItemSlot","content","SearchInput_default","DataView_default","row","header","Drawer_default","Modal_default","OverviewDetail_default","getDateRange","date","year","lastDay","getPeriodLabel","monthName","day","getPeriodSuffix","useOverviewDetailState","search","handlePaginationModelChange","handleSearch","useDatagrid_default","startDate","endDate","queryParams","handlePaginationChange","newPage","rowsPerPage","useOverviewDetailState_default","ComposedChart","Line","SalesEvolutionTooltip","hideGoal","realized","forecast","goal","achievement","gap","timeUnitStr","goalStr","DailyChart","formatYAxis","DailyView_default","MonthlyChart","barLabelConfig","value","MonthlyView_default","SalesEvolutionChart","SalesEvolutionLegend","kpis","editGoalAction","fPercent","InfoCircle_default","SalesEvolution","emptyMessage","hasEmptyMessage","values","ticks","handleToggleSeries","key","toggle","SalesEvolution_default","RealizedBackground","bothRendered","RealizedBackground_default","SalesForecastTooltip","ForecastChart","hasRealizedData","hasForecastData","SalesForecastLegend","SalesForecastSummary","totalForecast","totalRealized","percentage","SalesForecast","SalesForecast_default"],"mappings":"g1CAAA,OAAS,eAAAA,GAAa,WAAAC,GAAS,YAAAC,OAAgB,QAC/C,OAAOC,OAAiB,4BACxB,OAAOC,OAAgB,2BACvB,OAAOC,OAAW,sBCHlB,OAAuB,eAAAL,GAAa,WAAAC,GAAS,UAAAK,GAAQ,YAAAJ,OAAgB,QACrE,OACE,OAAAK,GACA,YAAAC,GACA,iBAAAC,GACA,uBAAAC,GACA,WAAAC,GACA,SAAAC,GACA,SAAAC,OACK,WCuBA,IAAMC,GAAS,CACpB,OAAQ,UACR,WAAY,SACd,ECtBI,cAAAC,OAAA,oBAXJ,IAAMC,GAAgB,CAAC,CACrB,EAAAC,EAAI,EACJ,EAAAC,EAAI,EACJ,MAAAC,EAAQ,EACR,OAAAC,EAAS,EACT,MAAAC,EACA,eAAAC,CACF,IACMA,IAAmBD,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,GAC7C,CACF,EAEMqM,EACJF,EAAgB,EAAI,KAAK,MAAOC,EAAgBD,EAAiB,GAAG,EAAI,EAC1E,MAAO,CAAE,cAAAC,EAAe,cAAAD,EAAe,WAAAE,CAAW,CACpD,EAAG,CAACzM,CAAI,CAAC,EAET,OACES,GAACiF,EAAA,CACC,UAAApG,EAACX,GAAA,CAAW,MAAM,6CAAuC,EAEzDW,EAACZ,GAAA,CACC,SAAAY,EAACqG,EAAA,CAAO,QAAS3F,EAAK,SAAW,EAAG,MAAOV,EAACsG,EAAA,EAAW,EACrD,SAAAnF,GAAC7B,GAAA,CAAM,IAAK,EACV,UAAAU,EAACV,GAAA,CAAM,QAAS,CAAE,GAAI,OAAQ,GAAI,OAAQ,EACxC,SAAAU,EAAC6E,GAAA,CACC,cAAeqB,EAAO,cACtB,cAAeA,EAAO,cACtB,WAAYA,EAAO,WACnB,UAAWtF,EACb,EACF,EAEAZ,EAACuG,EAAA,CAAa,OAAQvB,EACpB,SAAAhF,EAACkE,GAAA,CACC,KAAMxD,EACN,SAAUc,EACV,cAAeb,EACf,eAAgBJ,EAChB,YAAauF,EACb,aAAcC,EAChB,EACF,EAEA/F,EAACuE,GAAA,CACC,cAAe5D,EACf,cAAegF,EACjB,EAEA3F,EAACV,GAAA,CAAM,QAAS,CAAE,GAAI,QAAS,GAAI,MAAO,EACxC,SAAAU,EAAC6E,GAAA,CACC,cAAeqB,EAAO,cACtB,cAAeA,EAAO,cACtB,WAAYA,EAAO,WACnB,UAAWtF,EACb,EACF,GACF,EACF,EACF,GACF,CAEJ,EAEOyM,GAAQD","sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport CardContent from '@mui/material/CardContent';\nimport CardHeader from '@mui/material/CardHeader';\nimport Stack from '@mui/material/Stack';\nimport { CategoricalChartFunc } from 'recharts/types/chart/types';\n\nimport ChartLoading from 'components/Analytics/ChartLoading';\nimport { ChartCard } from 'components/Analytics/ChartStyles';\nimport EmptyState from 'components/Analytics/EmptyState';\nimport Result from 'components/Result';\nimport { ViewMode } from 'utils/analytics';\n\nimport Chart from './Chart';\nimport Legend from './Legend';\nimport { OrdersByTypeProps, VisibleSeries } from './props';\nimport Summary from './Summary';\n\nconst OrdersByType = ({\n data,\n isFetching,\n viewMode,\n selectedYear,\n DetailComponent,\n}: OrdersByTypeProps) => {\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const [visibleSeries, setVisibleSeries] = useState<VisibleSeries>({\n orders: true,\n quotations: true,\n });\n\n const [activeBarIndex, setActiveBarIndex] = useState<number | null>(null);\n\n const [detailOpen, setDetailOpen] = useState(false);\n const [selectedLabel, setSelectedLabel] = useState('');\n const [selectedTotalValue, setSelectedTotalValue] = useState(0);\n\n const handleToggleSerie = useCallback((serie: keyof VisibleSeries) => {\n setVisibleSeries(prev => ({ ...prev, [serie]: !prev[serie] }));\n }, []);\n\n const handleMouseMove = useCallback<CategoricalChartFunc>(state => {\n if (state?.activeTooltipIndex != null) {\n setActiveBarIndex(Number(state.activeTooltipIndex));\n }\n }, []);\n\n const handleMouseLeave = useCallback<CategoricalChartFunc>(\n () => setActiveBarIndex(null),\n [],\n );\n\n const handleBarClick = useCallback(\n (index: number) => {\n const item = data[index];\n if (!item) return;\n setSelectedLabel(item.label);\n setSelectedTotalValue(item.order_value);\n setDetailOpen(true);\n },\n [data],\n );\n\n const handleDetailClose = useCallback(() => {\n setDetailOpen(false);\n }, []);\n\n const totals = useMemo(() => {\n const ordersTotal = data.reduce(\n (acc, item) => acc + (item.order_count ?? 0),\n 0,\n );\n const quotationsTotal = data.reduce(\n (acc, item) => acc + (item.quotation_count ?? 0),\n 0,\n );\n return { ordersTotal, quotationsTotal };\n }, [data]);\n\n return (\n <>\n <ChartCard>\n <CardHeader title=\"Quantidade de pedidos por tipo\" />\n\n <CardContent>\n <Result isEmpty={data.length === 0} empty={<EmptyState />}>\n <Stack gap={3}>\n <Stack display={{ xs: 'none', md: 'block' }}>\n <Summary\n isMonthly={isMonthly}\n ordersTotal={totals.ordersTotal}\n quotationsTotal={totals.quotationsTotal}\n />\n </Stack>\n\n <ChartLoading active={isFetching}>\n <Chart\n data={data}\n viewMode={viewMode}\n visibleSeries={visibleSeries}\n activeBarIndex={activeBarIndex}\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n onBarClick={handleBarClick}\n />\n </ChartLoading>\n\n <Legend\n visibleSeries={visibleSeries}\n onToggleSerie={handleToggleSerie}\n />\n\n <Stack display={{ xs: 'block', md: 'none' }}>\n <Summary\n isMonthly={isMonthly}\n ordersTotal={totals.ordersTotal}\n quotationsTotal={totals.quotationsTotal}\n />\n </Stack>\n </Stack>\n </Result>\n </CardContent>\n </ChartCard>\n\n {selectedLabel && DetailComponent && (\n <DetailComponent\n open={detailOpen}\n onClose={handleDetailClose}\n label={selectedLabel}\n viewMode={viewMode}\n selectedYear={selectedYear}\n totalValue={selectedTotalValue}\n />\n )}\n </>\n );\n};\n\nexport default OrdersByType;\n","import { ReactElement, useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Bar,\n BarChart,\n CartesianGrid,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { ChartWrapper } from 'components/Analytics/ChartStyles';\nimport RotatedTick from 'components/Analytics/RotatedTick';\nimport { ViewMode } from 'utils/analytics';\nimport { formatDayLabel, formatMonthLabel } from 'utils/chart';\nimport { fShortenNumber } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport BarBackground from './BarBackground';\nimport BarLabel from './BarLabel';\nimport { ChartProps } from './props';\nimport OrdersByTypeTooltip from './Tooltip';\n\nconst Chart = ({\n data,\n viewMode,\n visibleSeries,\n activeBarIndex,\n onMouseMove,\n onMouseLeave,\n onBarClick,\n}: ChartProps) => {\n const isMonthly = viewMode === ViewMode.MONTHLY;\n const [containerWidth, setContainerWidth] = useState(0);\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const wrapperRefCallback = useCallback((node: HTMLDivElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n if (node) {\n setContainerWidth(node.clientWidth);\n observerRef.current = new ResizeObserver(() =>\n setContainerWidth(node.clientWidth),\n );\n observerRef.current.observe(node);\n }\n }, []);\n\n const shouldRotateLabels = useMemo(() => {\n if (!isMonthly) return false;\n if (containerWidth === 0 || data.length === 0) return false;\n const slotPerBar = (containerWidth - 60) / data.length;\n return slotPerBar < 80;\n }, [isMonthly, containerWidth, data.length]);\n\n const hasOrderData = useMemo(\n () => data.some(d => (d.order_count ?? 0) > 0),\n [data],\n );\n\n const hasQuotationData = useMemo(\n () => data.some(d => (d.quotation_count ?? 0) > 0),\n [data],\n );\n\n const yDomain = useMemo((): [number, number] => {\n if (!data.length) return [0, 1];\n const maxTotal = Math.max(\n ...data.map(d => (d.order_count ?? 0) + (d.quotation_count ?? 0)),\n );\n return [0, maxTotal > 0 ? maxTotal * 1.15 : 1];\n }, [data]);\n\n const yTicks = useMemo(() => {\n const [, max] = yDomain;\n const step = max / 6;\n return [\n ...new Set(Array.from({ length: 7 }, (_, i) => Math.round(step * i))),\n ];\n }, [yDomain]);\n\n const quotationsOnTop = visibleSeries.quotations && hasQuotationData;\n\n const ordersIsTop = visibleSeries.orders && hasOrderData && !quotationsOnTop;\n\n const tickFormatter = useMemo(\n () => (isMonthly ? formatMonthLabel : formatDayLabel),\n [isMonthly],\n );\n\n return (\n <ChartWrapper ref={wrapperRefCallback}>\n <ResponsiveContainer width=\"100%\" height={250}>\n <BarChart\n data={data}\n margin={{\n top: 20,\n right: 10,\n bottom: shouldRotateLabels ? -90 : 0,\n left: 20,\n }}\n barCategoryGap=\"20%\"\n style={{ cursor: 'pointer' }}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n onClick={state => {\n if (state?.activeTooltipIndex != null) {\n onBarClick?.(Number(state.activeTooltipIndex));\n }\n }}\n >\n <CartesianGrid\n vertical={false}\n strokeDasharray=\"3 3\"\n stroke=\"#F4F6F8\"\n />\n\n <XAxis\n dataKey=\"label\"\n axisLine={false}\n tickLine={false}\n {...(shouldRotateLabels && { interval: 0, height: 120 })}\n tick={\n shouldRotateLabels ? (\n <RotatedTick />\n ) : (\n { fontSize: 12, fill: '#637381' }\n )\n }\n tickFormatter={tickFormatter}\n />\n\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={(v: number) => fShortenNumber(v)}\n domain={yDomain}\n ticks={yTicks}\n />\n\n <Tooltip\n content={<OrdersByTypeTooltip viewMode={viewMode} />}\n cursor={false}\n />\n\n <Bar\n dataKey=\"order_count\"\n name=\"Vendas\"\n fill={COLORS.orders}\n stackId=\"orders\"\n maxBarSize={48}\n isAnimationActive={false}\n hide={!visibleSeries.orders}\n background={<BarBackground activeBarIndex={activeBarIndex} />}\n radius={ordersIsTop ? [4, 4, 0, 0] : undefined}\n {...(ordersIsTop && {\n label: {\n position: 'top' as const,\n fontSize: 11,\n fill: '#212B36',\n content: (\n <BarLabel\n data={data}\n visibleSeries={visibleSeries}\n isMonthly={isMonthly}\n shouldRotateLabels={shouldRotateLabels}\n />\n ) as unknown as ReactElement,\n },\n })}\n />\n\n <Bar\n dataKey=\"quotation_count\"\n name=\"Orçamentos\"\n fill={COLORS.quotations}\n stackId=\"orders\"\n maxBarSize={48}\n isAnimationActive={false}\n hide={!visibleSeries.quotations}\n radius={quotationsOnTop ? [4, 4, 0, 0] : undefined}\n {...(!visibleSeries.orders && {\n background: <BarBackground activeBarIndex={activeBarIndex} />,\n })}\n {...(quotationsOnTop && {\n label: {\n position: 'top' as const,\n fontSize: 11,\n fill: '#212B36',\n content: (\n <BarLabel\n data={data}\n visibleSeries={visibleSeries}\n isMonthly={isMonthly}\n shouldRotateLabels={shouldRotateLabels}\n />\n ) as unknown as ReactElement,\n },\n })}\n />\n </BarChart>\n </ResponsiveContainer>\n </ChartWrapper>\n );\n};\n\nexport default Chart;\n","import { ComponentType } from 'react';\n\nimport {\n OverviewDetailBaseProps,\n QuotationDashboardSeriesItem,\n} from 'types/overviewAnalytics';\nimport { ViewMode } from 'utils/analytics';\n\nexport interface OrdersByTypeProps {\n data: QuotationDashboardSeriesItem[];\n isFetching?: boolean;\n viewMode: ViewMode;\n selectedYear: number;\n DetailComponent?: ComponentType<OverviewDetailBaseProps>;\n}\n\nexport interface VisibleSeries {\n orders: boolean;\n quotations: boolean;\n}\n\nexport interface SummaryProps {\n isMonthly: boolean;\n ordersTotal: number;\n quotationsTotal: number;\n}\n\nexport interface LegendProps {\n visibleSeries: VisibleSeries;\n onToggleSerie: (serie: keyof VisibleSeries) => void;\n}\n\nexport const COLORS = {\n orders: '#22C55E',\n quotations: '#0EA5E9',\n} as const;\n","import { BarBackgroundComponentProps } from './props';\n\nconst BarBackground = ({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n index,\n activeBarIndex,\n}: BarBackgroundComponentProps) => {\n if (activeBarIndex !== index) return null;\n\n return (\n <rect\n x={x - 6}\n y={y}\n width={width + 12}\n height={height + 6}\n fill=\"#919EAB\"\n opacity={0.16}\n rx={6}\n />\n );\n};\n\nexport default BarBackground;\n","import { BarLabelProps } from './props';\n\nconst BarLabel = ({\n x = 0,\n y = 0,\n width = 0,\n index = 0,\n data,\n visibleSeries,\n isMonthly,\n shouldRotateLabels,\n}: BarLabelProps) => {\n if (!isMonthly || shouldRotateLabels) return null;\n\n const item = data[index];\n if (!item) return null;\n\n let total = 0;\n if (visibleSeries.orders) total += item.order_count ?? 0;\n if (visibleSeries.quotations) total += item.quotation_count ?? 0;\n if (!total) return null;\n\n return (\n <text\n x={x + width / 2}\n y={y - 8}\n textAnchor=\"middle\"\n fontSize={11}\n fill=\"#212B36\"\n >\n {total}\n </text>\n );\n};\n\nexport default BarLabel;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport SimpleCard from 'components/SimpleCard';\nimport { ViewMode } from 'utils/analytics';\nimport { MONTH_FULL_LABELS } from 'utils/chart';\nimport { fCurrencyBRL } from 'utils/formatNumber';\n\nimport { CustomTooltipProps } from './props';\n\nconst OrdersByTypeTooltip = ({\n active,\n payload,\n label,\n viewMode,\n}: CustomTooltipProps) => {\n if (!active || !payload?.length) return null;\n\n const isDaily = viewMode === ViewMode.DAILY;\n\n let formattedLabel = String(label);\n const parts = formattedLabel.split('-');\n\n if (parts.length >= 2) {\n const monthIndex = parseInt(parts[1], 10) - 1;\n const month = MONTH_FULL_LABELS[monthIndex];\n\n if (isDaily && parts.length === 3) {\n formattedLabel = `${parseInt(parts[2], 10)} de ${month} de ${parts[0]}`;\n } else if (!isDaily) {\n formattedLabel = `${month} de ${parts[0]}`;\n }\n }\n\n const data = payload[0].payload;\n\n const items = [\n {\n name: 'Vendas',\n count: data.order_count ?? 0,\n value: data.order_value ?? 0,\n color: payload.find(p => p.dataKey === 'order_count')?.color ?? '#22C55E',\n },\n {\n name: 'Orçamentos',\n count: data.quotation_count ?? 0,\n value: data.quotation_value ?? 0,\n color:\n payload.find(p => p.dataKey === 'quotation_count')?.color ?? '#0EA5E9',\n },\n ];\n\n return (\n <SimpleCard minWidth={{ xs: 'auto', sm: 300 }} p={1} gap={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {formattedLabel}\n </Typography>\n\n <Divider />\n\n <Stack>\n {items.map((entry, index) => (\n <Stack\n key={entry.name}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap={2}\n data-testid={`tooltip-item-${index}`}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack\n width={6}\n height={6}\n borderRadius=\"50%\"\n bgcolor={entry.color}\n />\n\n <Typography variant=\"body2\" noWrap>\n {entry.name}\n </Typography>\n </Stack>\n\n <Typography variant=\"body2\" color=\"text.disabled\" noWrap>\n {entry.count} {entry.count === 1 ? 'pedido' : 'pedidos'} \n <Typography component=\"span\" variant=\"body2\" color=\"text.primary\">\n {fCurrencyBRL(entry.value)}\n </Typography>\n </Typography>\n </Stack>\n ))}\n </Stack>\n </SimpleCard>\n );\n};\n\nexport default OrdersByTypeTooltip;\n","import Checkbox from '@mui/material/Checkbox';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Stack from '@mui/material/Stack';\n\nimport { COLORS, LegendProps } from './props';\n\nconst OrdersByTypeLegend = ({ visibleSeries, onToggleSerie }: LegendProps) => (\n <Stack direction=\"row\" justifyContent=\"center\" flexWrap=\"wrap\" gap={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.orders}\n onChange={() => onToggleSerie('orders')}\n sx={{ '&.Mui-checked': { color: COLORS.orders } }}\n />\n }\n label=\"Vendas\"\n />\n\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.quotations}\n onChange={() => onToggleSerie('quotations')}\n sx={{ '&.Mui-checked': { color: COLORS.quotations } }}\n />\n }\n label=\"Orçamentos\"\n />\n </Stack>\n);\n\nexport default OrdersByTypeLegend;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport useResponsive from 'hooks/useResponsive';\n\nimport { SummaryProps } from './props';\n\nconst Summary = ({ ordersTotal, quotationsTotal, isMonthly }: SummaryProps) => {\n const isMobile = useResponsive('down', 'md');\n\n return (\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n alignItems={{ xs: 'flex-start', md: 'center' }}\n flexWrap=\"wrap\"\n gap={3}\n >\n {isMobile && (\n <Divider\n orientation=\"horizontal\"\n flexItem\n sx={{\n borderStyle: 'dashed',\n mx: -3,\n }}\n />\n )}\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {isMonthly ? 'Vendas no ano' : 'Vendas no mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">{ordersTotal} vendas</Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {isMonthly ? 'Orçamentos no ano' : 'Orçamentos no mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {quotationsTotal} orçamentos\n </Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default Summary;\n","import Divider from '@mui/material/Divider';\nimport Link from '@mui/material/Link';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\nimport { GridRenderCellParams } from '@mui/x-data-grid-premium';\n\nimport DataView from 'components/DataView';\nimport Drawer from 'components/Drawer';\nimport Modal from 'components/Modal';\nimport SearchInput from 'components/SearchInput';\nimport useResponsive from 'hooks/useResponsive';\nimport { OverviewDetailOrder } from 'types/overviewAnalytics';\nimport { fCurrencyBRL } from 'utils/formatNumber';\nimport { fDate } from 'utils/formatTime';\n\nimport Header from './Header';\nimport { OverviewDetailProps } from './props';\nimport { MobileItemContainer, StyledDivider } from './styles';\n\nconst getOrderId = (order: OverviewDetailOrder) => (\n <Stack justifyContent=\"center\" height={1}>\n <Typography variant=\"body2\" color=\"text.primary\">\n {order.id}\n </Typography>\n </Stack>\n);\n\nconst getPartnerName = (\n order: OverviewDetailOrder,\n buildPartnerLink?: (partnerId: string) => string,\n) => (\n <Stack justifyContent=\"center\" height={1}>\n {order?.partner?.id && buildPartnerLink ? (\n <Link\n component=\"a\"\n href={buildPartnerLink(order.partner.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n variant=\"subtitle2\"\n sx={{ textDecoration: 'underline' }}\n noWrap\n >\n {order.partner?.name || '-'}\n </Link>\n ) : (\n <Typography variant=\"body2\" color=\"text.primary\" noWrap>\n {order.partner?.name || '-'}\n </Typography>\n )}\n </Stack>\n);\n\nconst getOrderValue = (order: OverviewDetailOrder) => (\n <Stack justifyContent=\"center\" height={1}>\n <Typography variant=\"body2\" color=\"text.primary\">\n {fCurrencyBRL(order.total_value)}\n </Typography>\n </Stack>\n);\n\nconst getOrderDate = (order: OverviewDetailOrder) => (\n <Stack justifyContent=\"center\" height={1}>\n {order.negotiation_date ? (\n <Typography variant=\"body2\" color=\"text.primary\">\n {fDate(order.negotiation_date, 'DD/MM/YYYY')}\n </Typography>\n ) : (\n '-'\n )}\n </Stack>\n);\n\nconst getOrderStatus = (order: OverviewDetailOrder) => (\n <Stack justifyContent=\"center\" height={1}>\n {order.status || '-'}\n </Stack>\n);\n\nconst getDefaultMobileRender = (\n order: OverviewDetailOrder,\n hideStatus?: boolean,\n) => (\n <MobileItemContainer key={order.id}>\n <Stack gap={1}>\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Pedido\n </Typography>\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {order.id}\n </Typography>\n </Stack>\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Cliente\n </Typography>\n <Typography variant=\"subtitle2\" color=\"primary.main\">\n {order.partner?.name || '-'}\n </Typography>\n </Stack>\n\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack flex={1} overflow=\"hidden\">\n <Typography variant=\"body2\" color=\"text.secondary\" noWrap>\n Valor do pedido\n </Typography>\n <Typography variant=\"subtitle2\" color=\"text.primary\" noWrap>\n {fCurrencyBRL(order.total_value)}\n </Typography>\n </Stack>\n\n <Divider\n orientation=\"vertical\"\n flexItem\n sx={{ borderStyle: 'dashed', mx: 3 }}\n />\n\n <Stack flex={1} overflow=\"hidden\">\n <Typography variant=\"body2\" color=\"text.secondary\" noWrap>\n Data\n </Typography>\n <Typography variant=\"subtitle2\" color=\"text.primary\" noWrap>\n {order.negotiation_date\n ? fDate(order.negotiation_date, 'DD/MM/YYYY')\n : '-'}\n </Typography>\n </Stack>\n </Stack>\n\n {!hideStatus && (\n <Stack gap={0.5}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Status\n </Typography>\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {order.status || '-'}\n </Typography>\n </Stack>\n )}\n </Stack>\n </MobileItemContainer>\n);\n\nconst OverviewDetail = ({\n open,\n onClose,\n title,\n viewMode,\n selectedYear,\n totalValue,\n periodLabel,\n suffix,\n rows,\n total,\n isLoading,\n isFetching,\n page,\n perPage,\n onSearch,\n onPaginationChange,\n buildPartnerLink,\n mobileItemSlot,\n hideStatus,\n}: OverviewDetailProps) => {\n const isMobile = useResponsive('down', 'sm');\n\n const content = (\n <Stack gap={3}>\n <Stack\n direction={{ xs: 'column', sm: 'row' }}\n justifyContent=\"space-between\"\n gap={2}\n >\n <Stack\n minWidth={0}\n direction=\"row\"\n alignItems=\"center\"\n gap={3}\n flexWrap=\"wrap\"\n >\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Vendas {suffix}\n </Typography>\n\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {fCurrencyBRL(totalValue)}\n </Typography>\n </Stack>\n\n <StyledDivider orientation=\"vertical\" flexItem />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Qtd. de pedidos {suffix}\n </Typography>\n\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {total}\n </Typography>\n </Stack>\n </Stack>\n\n <SearchInput\n size=\"small\"\n placeholder=\"Buscar\"\n onSearch={onSearch}\n trigger=\"change\"\n iconPosition=\"start\"\n sx={{ minWidth: 200 }}\n />\n </Stack>\n\n <DataView\n title=\"Pedidos\"\n header={<></>}\n headerProps={{ p: 0 }}\n columns={[\n {\n field: 'external_id',\n headerName: 'Pedido',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) => getOrderId(row),\n },\n {\n field: 'partner_name',\n headerName: 'Cliente',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) =>\n getPartnerName(row, buildPartnerLink),\n },\n {\n field: 'total_value',\n headerName: 'Valor do pedido',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) => getOrderValue(row),\n },\n {\n field: 'created_at',\n headerName: 'Data',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) => getOrderDate(row),\n },\n ...(hideStatus\n ? []\n : [\n {\n field: 'last_status',\n headerName: 'Status',\n flex: 1,\n renderCell: ({ row }: GridRenderCellParams) =>\n getOrderStatus(row),\n },\n ]),\n ]}\n rows={rows}\n rowCount={total}\n mobileRender={(data: OverviewDetailOrder) =>\n mobileItemSlot\n ? mobileItemSlot(data)\n : getDefaultMobileRender(data, hideStatus)\n }\n loading={isLoading}\n fetching={isFetching}\n paginationModel={{ page, pageSize: perPage }}\n onPaginationChange={onPaginationChange}\n paginationMode=\"server\"\n disableRowSelectionOnClick\n disableColumnMenu\n containerProps={{ height: 400 }}\n />\n </Stack>\n );\n\n const header = (\n <Header\n title={title}\n viewMode={viewMode}\n selectedYear={selectedYear}\n periodLabel={periodLabel}\n />\n );\n\n if (isMobile) {\n return (\n <Drawer\n open={open}\n onClose={onClose}\n headerTitle={header}\n headerProps={{\n direction: 'row-reverse',\n sx: { '& > :last-child': { minWidth: 0, overflow: 'hidden' } },\n }}\n >\n {content}\n </Drawer>\n );\n }\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n maxWidth=\"lg\"\n dialogTitle={header}\n dialogTitleProps={{ sx: { flex: 1, overflow: 'hidden' } }}\n fullWidth\n >\n {content}\n </Modal>\n );\n};\n\nexport default OverviewDetail;\n","import Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport { VIEW_MODE_LABELS } from 'utils/analytics';\n\nimport { DetailHeaderProps } from './props';\n\nconst Header = ({\n title,\n viewMode,\n selectedYear,\n periodLabel,\n}: DetailHeaderProps) => {\n return (\n <Stack width=\"100%\" minWidth={0} overflow=\"hidden\">\n <Typography variant=\"subtitle1\" noWrap>\n Detalhes do relatório\n </Typography>\n\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n columnGap={1.5}\n rowGap={0}\n flexWrap=\"wrap\"\n >\n <Typography variant=\"body2\" color=\"text.secondary\" flexShrink={0}>\n {title}\n </Typography>\n •\n <Typography variant=\"body2\" flexShrink={0}>\n {VIEW_MODE_LABELS[viewMode]}\n </Typography>\n •\n <Typography variant=\"body2\" flexShrink={0}>\n {selectedYear}\n </Typography>\n •\n <Typography variant=\"body2\" color=\"text.secondary\" noWrap>\n {periodLabel}\n </Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default Header;\n","import MuiDivider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport { alpha, styled } from '@mui/material/styles';\n\nexport const StyledDivider = styled(MuiDivider)(() => ({\n height: 30,\n alignSelf: 'center',\n\n borderStyle: 'dashed',\n}));\n\nexport const MobileItemContainer = styled(Stack)(({ theme }) => ({\n position: 'relative',\n\n display: 'flex',\n flexDirection: 'column',\n padding: theme.spacing(2),\n gap: theme.spacing(1),\n color: theme.palette.text.primary,\n\n '& a': {\n textDecoration: 'none',\n },\n\n '&+div': {\n borderTop: `1px dashed ${alpha(theme.palette.grey[500], 0.2)}`,\n },\n}));\n","import { useCallback, useMemo } from 'react';\n\nimport useDatagrid from 'hooks/useDatagrid';\nimport { Filter, GridQuery } from 'types/filter';\nimport { ViewMode } from 'utils/analytics';\n\nimport { getDateRange, getPeriodLabel, getPeriodSuffix } from './utils';\n\nconst useOverviewDetailState = (label: string, viewMode: ViewMode) => {\n const { page, perPage, search, handlePaginationModelChange, handleSearch } =\n useDatagrid();\n\n const { startDate, endDate } = useMemo(\n () => getDateRange(label, viewMode),\n [label, viewMode],\n );\n\n const periodLabel = useMemo(\n () => getPeriodLabel(label, viewMode),\n [label, viewMode],\n );\n\n const suffix = getPeriodSuffix(viewMode);\n\n const queryParams = useMemo((): GridQuery => {\n return {\n page,\n perPage,\n ...(search ? { search } : {}),\n filter: {\n operator: 'AND',\n groups: [\n {\n operator: 'AND',\n conditionals: [\n {\n fieldName: 'negotiationDate',\n conditional: 'GREATER_THAN_OR_EQUAL',\n value: [`${startDate}T00:00:00`],\n },\n {\n fieldName: 'negotiationDate',\n conditional: 'LESS_THAN_OR_EQUAL',\n value: [`${endDate}T23:59:59`],\n },\n ],\n },\n ],\n } as Filter,\n };\n }, [endDate, page, perPage, search, startDate]);\n\n const handlePaginationChange = useCallback(\n (newPage: number, rowsPerPage: number) => {\n handlePaginationModelChange({ page: newPage, pageSize: rowsPerPage });\n },\n [handlePaginationModelChange],\n );\n\n return {\n page,\n perPage,\n periodLabel,\n suffix,\n queryParams,\n handleSearch,\n handlePaginationChange,\n };\n};\n\nexport default useOverviewDetailState;\n","import { ViewMode } from 'utils/analytics';\nimport { MONTH_FULL_LABELS } from 'utils/chart';\n\nexport const getDateRange = (\n label: string,\n viewMode: ViewMode,\n): { startDate: string; endDate: string } => {\n const parts = label.split('-');\n\n if (viewMode === ViewMode.DAILY && parts.length === 3) {\n const date = `${parts[0]}-${parts[1]}-${parts[2]}`;\n return { startDate: date, endDate: date };\n }\n\n const year = parseInt(parts[0], 10);\n const month = parseInt(parts[1], 10);\n const lastDay = new Date(year, month, 0).getDate();\n\n return {\n startDate: `${parts[0]}-${parts[1]}-01`,\n endDate: `${parts[0]}-${parts[1]}-${String(lastDay).padStart(2, '0')}`,\n };\n};\n\nexport const getPeriodLabel = (label: string, viewMode: ViewMode): string => {\n const parts = label.split('-');\n const monthIndex = parseInt(parts[1], 10) - 1;\n const monthName = MONTH_FULL_LABELS[monthIndex] ?? '';\n\n if (viewMode === ViewMode.DAILY && parts.length === 3) {\n const day = parseInt(parts[2], 10);\n return `${monthName} - Dia ${day}`;\n }\n\n return monthName;\n};\n\nexport const getPeriodSuffix = (viewMode: ViewMode): string =>\n viewMode === ViewMode.MONTHLY ? 'no mês' : 'no dia';\n","import { useCallback, useMemo, useState } from 'react';\nimport CardContent from '@mui/material/CardContent';\nimport CardHeader from '@mui/material/CardHeader';\nimport Stack from '@mui/material/Stack';\n\nimport ChartLoading from 'components/Analytics/ChartLoading';\nimport { ChartCard } from 'components/Analytics/ChartStyles';\nimport EmptyState from 'components/Analytics/EmptyState';\nimport Result from 'components/Result';\nimport { ViewMode } from 'utils/analytics';\nimport { fShortenNumber } from 'utils/formatNumber';\n\nimport SalesEvolutionChart from './Chart';\nimport SalesEvolutionLegend from './Legend';\nimport { SalesEvolutionProps, SeriesVisibility } from './props';\nimport SalesEvolutionSummary from './Summary';\n\nconst SalesEvolution = ({\n data,\n isFetching,\n kpis,\n viewMode,\n selectedYear,\n editGoalAction,\n DetailComponent,\n hideGoal,\n emptyMessage,\n}: SalesEvolutionProps) => {\n const [visibleSeries, setVisibleSeries] = useState<SeriesVisibility>({\n realized: true,\n forecast: true,\n goal: true,\n });\n\n const [detailOpen, setDetailOpen] = useState(false);\n const [selectedLabel, setSelectedLabel] = useState('');\n const [selectedTotalValue, setSelectedTotalValue] = useState(0);\n\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const hasEmptyMessage = useMemo(\n () =>\n emptyMessage != null &&\n data.every(item => !Number(item.realized)),\n [data, emptyMessage],\n );\n\n const yDomain = useMemo((): [number, number] => {\n if (!data.length) return [0, 1];\n\n const values = data.flatMap(item => [\n Number(item.realized) || 0,\n Number(item.forecast) || 0,\n Number(item.goal) || 0,\n ]);\n\n const max = Math.max(...values);\n\n return [0, max > 0 ? max * 1.15 : 1];\n }, [data]);\n\n const yTicks = useMemo(() => {\n const [, max] = yDomain;\n\n const step = max / 6;\n\n const ticks = Array.from({ length: 7 }, (_, i) => Math.round(step * i));\n\n return [...new Set(ticks)];\n }, [yDomain]);\n\n const handleToggleSeries = useCallback((key: keyof SeriesVisibility) => {\n setVisibleSeries(prev => ({ ...prev, [key]: !prev[key] }));\n }, []);\n\n const handleToggleSerie = useCallback(\n (toggle: string) => handleToggleSeries(toggle as keyof SeriesVisibility),\n [handleToggleSeries],\n );\n\n const handleBarClick = useCallback(\n (index: number) => {\n const item = data[index];\n if (!item) return;\n setSelectedLabel(item.label);\n setSelectedTotalValue(item.realized);\n setDetailOpen(true);\n },\n [data],\n );\n\n const handleDetailClose = useCallback(() => {\n setDetailOpen(false);\n }, []);\n\n const formatYAxis = useCallback((v: number) => fShortenNumber(v), []);\n\n return (\n <>\n <ChartCard>\n <CardHeader title=\"Evolução de vendas\" />\n\n <CardContent>\n <Result isEmpty={data.length === 0} empty={<EmptyState />}>\n <Stack gap={3}>\n <Stack display={{ xs: 'none', md: 'block' }}>\n <SalesEvolutionSummary\n kpis={kpis}\n isMonthly={isMonthly}\n editGoalAction={editGoalAction}\n hideGoal={hideGoal}\n />\n </Stack>\n\n {hasEmptyMessage ? (\n <EmptyState\n title={emptyMessage}\n description=\"Troque a origem do pedido ou o período selecionado.\"\n />\n ) : (\n <ChartLoading active={isFetching}>\n <SalesEvolutionChart\n data={data}\n viewMode={viewMode}\n visibleSeries={\n hideGoal ? { ...visibleSeries, goal: false } : visibleSeries\n }\n yDomain={yDomain}\n yTicks={yTicks}\n formatYAxis={formatYAxis}\n onBarClick={handleBarClick}\n hideGoal={hideGoal}\n />\n </ChartLoading>\n )}\n\n {!hasEmptyMessage && (\n <SalesEvolutionLegend\n visibleSeries={visibleSeries}\n onToggleSerie={handleToggleSerie}\n hideGoal={hideGoal}\n />\n )}\n\n <Stack display={{ xs: 'block', md: 'none' }}>\n <SalesEvolutionSummary\n kpis={kpis}\n isMonthly={isMonthly}\n editGoalAction={editGoalAction}\n hideGoal={hideGoal}\n />\n </Stack>\n </Stack>\n </Result>\n </CardContent>\n </ChartCard>\n\n {selectedLabel && DetailComponent && (\n <DetailComponent\n open={detailOpen}\n onClose={handleDetailClose}\n label={selectedLabel}\n viewMode={viewMode}\n selectedYear={selectedYear}\n totalValue={selectedTotalValue}\n />\n )}\n </>\n );\n};\n\nexport default SalesEvolution;\n","import { useCallback, useMemo, useRef, useState } from 'react';\nimport { CategoricalChartFunc } from 'recharts/types/chart/types';\n\nimport { ChartWrapper } from 'components/Analytics/ChartStyles';\nimport { ViewMode } from 'utils/analytics';\n\nimport DailyChart from './DailyView';\nimport MonthlyChart from './MonthlyView';\nimport { SalesEvolutionChartProps } from './props';\n\nconst SalesEvolutionChart = ({\n data,\n viewMode,\n visibleSeries,\n yDomain,\n yTicks,\n formatYAxis,\n onBarClick,\n hideGoal,\n}: SalesEvolutionChartProps) => {\n const [activeBarIndex, setActiveBarIndex] = useState<number | null>(null);\n const [containerWidth, setContainerWidth] = useState(0);\n\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const shouldRotateLabels = useMemo(() => {\n if (!isMonthly || containerWidth === 0 || data.length === 0) return false;\n\n const slotPerBar = (containerWidth - 60) / data.length;\n\n return slotPerBar < 60;\n }, [containerWidth, data.length, isMonthly]);\n\n const handleMouseLeave = useCallback<CategoricalChartFunc>(\n () => setActiveBarIndex(null),\n [],\n );\n\n const handleMouseMove = useCallback<CategoricalChartFunc>(state => {\n if (state?.activeTooltipIndex != null) {\n setActiveBarIndex(Number(state.activeTooltipIndex));\n }\n }, []);\n\n const wrapperRefCallback = useCallback((node: HTMLDivElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n\n if (node) {\n setContainerWidth(node.clientWidth);\n\n observerRef.current = new ResizeObserver(() =>\n setContainerWidth(node.clientWidth),\n );\n observerRef.current.observe(node);\n }\n }, []);\n\n if (isMonthly) {\n return (\n <ChartWrapper ref={wrapperRefCallback}>\n <MonthlyChart\n data={data}\n visibleSeries={visibleSeries}\n yDomain={yDomain}\n yTicks={yTicks}\n formatYAxis={formatYAxis}\n shouldRotateLabels={shouldRotateLabels}\n activeBarIndex={activeBarIndex}\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n onBarClick={onBarClick}\n viewMode={viewMode}\n hideGoal={hideGoal}\n />\n </ChartWrapper>\n );\n }\n\n return (\n <ChartWrapper ref={wrapperRefCallback}>\n <DailyChart\n data={data}\n visibleSeries={visibleSeries}\n yDomain={yDomain}\n yTicks={yTicks}\n formatYAxis={formatYAxis}\n viewMode={viewMode}\n activeBarIndex={activeBarIndex}\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n onBarClick={onBarClick}\n hideGoal={hideGoal}\n />\n </ChartWrapper>\n );\n};\n\nexport default SalesEvolutionChart;\n","import { useCallback } from 'react';\nimport {\n Bar,\n CartesianGrid,\n ComposedChart,\n Line,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { formatDayLabel } from 'utils/chart';\nimport { fShortenNumber } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport BarBackground from './BarBackground';\nimport { DailyChartProps } from './props';\nimport SalesEvolutionTooltip from './Tooltip';\n\nconst DailyChart = ({\n data,\n visibleSeries,\n yDomain,\n yTicks,\n viewMode,\n activeBarIndex,\n onMouseMove,\n onMouseLeave,\n onBarClick,\n hideGoal,\n}: DailyChartProps) => {\n const formatYAxis = useCallback((v: number) => fShortenNumber(v), []);\n\n return (\n <ResponsiveContainer width=\"100%\" height={350}>\n <ComposedChart\n data={data}\n margin={{ top: 20, right: 10, bottom: 0, left: 20 }}\n style={{ cursor: 'pointer' }}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n onClick={state => {\n if (state?.activeTooltipIndex != null) {\n onBarClick?.(Number(state.activeTooltipIndex));\n }\n }}\n >\n <CartesianGrid\n vertical={false}\n strokeDasharray=\"3 3\"\n stroke=\"#F4F6F8\"\n />\n\n <XAxis\n dataKey=\"label\"\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={formatDayLabel}\n />\n\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={formatYAxis}\n domain={yDomain}\n ticks={yTicks}\n />\n\n <Tooltip\n content={\n <SalesEvolutionTooltip\n viewMode={viewMode}\n hideGoal={hideGoal}\n />\n }\n />\n\n <Bar\n dataKey=\"realized\"\n fill=\"transparent\"\n isAnimationActive={false}\n background={<BarBackground activeBarIndex={activeBarIndex} />}\n />\n\n {visibleSeries.goal && (\n <Line\n dataKey=\"goal\"\n name=\"Meta\"\n stroke={COLORS.goal}\n strokeWidth={2}\n strokeDasharray=\"8 4\"\n dot={false}\n isAnimationActive={false}\n />\n )}\n\n {visibleSeries.realized && (\n <Line\n dataKey=\"realized\"\n name=\"Vendas\"\n stroke={COLORS.sales}\n strokeWidth={2}\n dot={{\n fill: COLORS.sales,\n r: 4,\n strokeWidth: 0,\n }}\n isAnimationActive={false}\n />\n )}\n\n {visibleSeries.forecast && (\n <Line\n dataKey=\"forecast\"\n name=\"Previsto\"\n stroke={COLORS.forecast}\n strokeWidth={2}\n strokeDasharray=\"6 3\"\n dot={{\n fill: COLORS.forecast,\n r: 4,\n strokeWidth: 0,\n }}\n isAnimationActive={false}\n />\n )}\n </ComposedChart>\n </ResponsiveContainer>\n );\n};\n\nexport default DailyChart;\n","import { ReactNode } from 'react';\nimport { ComponentType } from 'react';\n\nimport {\n OverviewDetailBaseProps,\n RevenueGoalDashboardKpis,\n RevenueGoalDashboardSeriesItem,\n} from 'types/overviewAnalytics';\nimport { ViewMode } from 'utils/analytics';\n\nexport interface SalesEvolutionProps {\n data: RevenueGoalDashboardSeriesItem[];\n kpis?: RevenueGoalDashboardKpis;\n isFetching?: boolean;\n viewMode: ViewMode;\n selectedYear: number;\n editGoalAction?: ReactNode;\n DetailComponent?: ComponentType<OverviewDetailBaseProps>;\n hideGoal?: boolean;\n emptyMessage?: string;\n}\n\nexport interface SeriesVisibility {\n realized: boolean;\n forecast: boolean;\n goal: boolean;\n}\n\nexport interface SummaryProps {\n kpis?: RevenueGoalDashboardKpis;\n isMonthly: boolean;\n editGoalAction?: ReactNode;\n hideGoal?: boolean;\n}\n\nexport interface LegendProps {\n visibleSeries: SeriesVisibility;\n onToggleSerie: (toggle: keyof SeriesVisibility) => void;\n hideGoal?: boolean;\n}\n\nexport const COLORS = {\n sales: '#22C55E',\n forecast: '#F59E0B',\n goal: '#212B36',\n} as const;\n","import { COLORS } from '../props';\n\nimport { BarBackgroundComponentProps } from './props';\n\nconst BarBackground = ({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n index,\n activeBarIndex,\n}: BarBackgroundComponentProps) => {\n if (activeBarIndex !== index) return null;\n\n return (\n <rect\n x={x - 6}\n y={y}\n width={width + 6 * 2}\n height={height + 6}\n fill={COLORS.sales}\n opacity={0.16}\n rx={6}\n />\n );\n};\n\nexport default BarBackground;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport SimpleCard from 'components/SimpleCard';\nimport { ViewMode } from 'utils/analytics';\nimport { MONTH_FULL_LABELS } from 'utils/chart';\nimport { fCurrencyBRL } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport { CustomTooltipProps, TooltipDataItem } from './props';\n\nconst SalesEvolutionTooltip = ({\n active,\n payload,\n label,\n viewMode,\n hideGoal,\n}: CustomTooltipProps) => {\n if (!active || !payload?.length) return null;\n\n const isDaily = viewMode === ViewMode.DAILY;\n\n const data = payload[0].payload as TooltipDataItem;\n const realized = Number(data.realized) || 0;\n const forecast = Number(data.forecast) || 0;\n const goal = Number(data.goal) || 0;\n\n const achievement = goal > 0 ? (realized / goal) * 100 : 0;\n const gap = goal > realized ? goal - realized : 0;\n\n const timeUnitStr = isDaily ? 'no dia' : 'no mês';\n const goalStr = isDaily ? 'diária' : 'mensal';\n\n let formattedLabel = String(label);\n const parts = formattedLabel.split('-');\n\n if (parts.length >= 2) {\n const monthIndex = parseInt(parts[1], 10) - 1;\n const month = MONTH_FULL_LABELS[monthIndex];\n\n if (isDaily && parts.length === 3) {\n formattedLabel = `${parseInt(parts[2], 10)} de ${month} de ${parts[0]}`;\n } else if (!isDaily) {\n formattedLabel = `${month} de ${parts[0]}`;\n }\n }\n\n const items = [\n {\n name: `Realizado ${timeUnitStr}`,\n value: fCurrencyBRL(realized),\n color: COLORS.sales,\n },\n {\n name: `Previsto ${timeUnitStr}`,\n value: fCurrencyBRL(forecast),\n color: COLORS.forecast,\n },\n ...(hideGoal\n ? []\n : [\n {\n name: `Meta ${goalStr}`,\n value: fCurrencyBRL(goal),\n color: COLORS.goal,\n },\n {\n name: 'Atingimento',\n value: `${achievement.toFixed(0)}%`,\n color: '#00B8D9',\n },\n {\n name: `GAP ${timeUnitStr}`,\n value: fCurrencyBRL(gap),\n color: '#FF5630',\n },\n ]),\n ];\n\n return (\n <SimpleCard minWidth={{ xs: 'auto', sm: 400 }} p={1} gap={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {formattedLabel}\n </Typography>\n\n <Divider />\n\n <Stack>\n {items.map((entry, index) => (\n <Stack\n key={index}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap={3}\n data-testid={`tooltip-item-${index}`}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack\n width={6}\n height={6}\n borderRadius=\"50%\"\n bgcolor={entry.color}\n />\n\n <Typography variant=\"body2\" noWrap>\n {entry.name}\n </Typography>\n </Stack>\n\n <Typography variant=\"body2\">{entry.value}</Typography>\n </Stack>\n ))}\n </Stack>\n </SimpleCard>\n );\n};\n\nexport default SalesEvolutionTooltip;\n","import { useMemo } from 'react';\nimport {\n Bar,\n CartesianGrid,\n ComposedChart,\n Line,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport RotatedTick from 'components/Analytics/RotatedTick';\nimport { formatMonthLabel } from 'utils/chart';\nimport { fCurrencyBRL, fShortenNumber } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport BarBackground from './BarBackground';\nimport { MonthlyChartProps } from './props';\nimport SalesEvolutionTooltip from './Tooltip';\n\nconst MonthlyChart = ({\n data,\n visibleSeries,\n yDomain,\n yTicks,\n shouldRotateLabels,\n activeBarIndex,\n onMouseMove,\n onMouseLeave,\n onBarClick,\n viewMode,\n hideGoal,\n}: MonthlyChartProps) => {\n const barLabelConfig = useMemo(\n () =>\n shouldRotateLabels\n ? false\n : {\n position: 'top' as const,\n fontSize: 12,\n fill: '#212B36',\n formatter: (value: unknown) => fCurrencyBRL(Number(value)),\n },\n [shouldRotateLabels],\n );\n\n return (\n <ResponsiveContainer width=\"100%\" height={300}>\n <ComposedChart\n data={data}\n margin={{\n top: 20,\n right: 10,\n bottom: shouldRotateLabels ? -90 : 0,\n left: 20,\n }}\n barCategoryGap=\"20%\"\n style={{ cursor: 'pointer' }}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n onClick={state => {\n if (state?.activeTooltipIndex != null) {\n onBarClick?.(Number(state.activeTooltipIndex));\n }\n }}\n >\n <CartesianGrid\n vertical={false}\n strokeDasharray=\"3 3\"\n stroke=\"#F4F6F8\"\n />\n\n <XAxis\n dataKey=\"label\"\n axisLine={false}\n tickLine={false}\n {...(shouldRotateLabels && { interval: 0, height: 120 })}\n tick={\n shouldRotateLabels ? (\n <RotatedTick />\n ) : (\n { fontSize: 12, fill: '#637381' }\n )\n }\n tickFormatter={formatMonthLabel}\n />\n\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={(v: number) => fShortenNumber(v)}\n domain={yDomain}\n ticks={yTicks}\n />\n\n <Tooltip\n content={\n <SalesEvolutionTooltip\n viewMode={viewMode}\n hideGoal={hideGoal}\n />\n }\n />\n\n {visibleSeries.goal && (\n <Line\n dataKey=\"goal\"\n name=\"Meta\"\n stroke={COLORS.goal}\n strokeWidth={2}\n strokeDasharray=\"8 4\"\n dot={false}\n isAnimationActive={false}\n />\n )}\n\n {visibleSeries.realized && (\n <Bar\n dataKey=\"realized\"\n name=\"Vendas\"\n fill={COLORS.sales}\n maxBarSize={48}\n isAnimationActive={false}\n radius={[4, 4, 0, 0]}\n background={<BarBackground activeBarIndex={activeBarIndex} />}\n label={barLabelConfig}\n />\n )}\n\n {visibleSeries.forecast && (\n <Line\n dataKey=\"forecast\"\n name=\"Previsto\"\n stroke={COLORS.forecast}\n strokeWidth={2}\n strokeDasharray=\"6 3\"\n dot={{\n fill: COLORS.forecast,\n r: 4,\n strokeWidth: 0,\n }}\n isAnimationActive={false}\n />\n )}\n </ComposedChart>\n </ResponsiveContainer>\n );\n};\n\nexport default MonthlyChart;\n","import Checkbox from '@mui/material/Checkbox';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Stack from '@mui/material/Stack';\n\nimport { COLORS, LegendProps } from './props';\n\nconst SalesEvolutionLegend = ({\n visibleSeries,\n onToggleSerie,\n hideGoal,\n}: LegendProps) => (\n <Stack direction=\"row\" justifyContent=\"center\" flexWrap=\"wrap\" gap={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.realized}\n onChange={() => onToggleSerie('realized')}\n sx={{ '&.Mui-checked': { color: COLORS.sales } }}\n />\n }\n label=\"Vendas\"\n />\n\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.forecast}\n onChange={() => onToggleSerie('forecast')}\n sx={{ '&.Mui-checked': { color: COLORS.forecast } }}\n />\n }\n label=\"Previsto\"\n />\n\n {!hideGoal && (\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.goal}\n onChange={() => onToggleSerie('goal')}\n sx={{ '&.Mui-checked': { color: COLORS.goal } }}\n />\n }\n label=\"Meta\"\n />\n )}\n </Stack>\n);\n\nexport default SalesEvolutionLegend;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport InfoCircle from 'components/InfoCircle';\nimport useResponsive from 'hooks/useResponsive';\nimport { fCurrencyBRL, fPercent } from 'utils/formatNumber';\n\nimport { SummaryProps } from './props';\n\nconst Summary = ({ kpis, isMonthly, editGoalAction, hideGoal }: SummaryProps) => {\n const isMobile = useResponsive('down', 'md');\n\n return (\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n alignItems={{ xs: 'flex-start', md: 'center' }}\n flexWrap=\"wrap\"\n gap={3}\n >\n {isMobile && (\n <Divider\n orientation=\"horizontal\"\n flexItem\n sx={{\n borderStyle: 'dashed',\n mx: -3,\n }}\n />\n )}\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Previsto no {isMonthly ? 'ano' : 'mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fCurrencyBRL(kpis?.forecast)}\n </Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Realizado no {isMonthly ? 'ano' : 'mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fCurrencyBRL(kpis?.realized)}\n </Typography>\n </Stack>\n\n {!hideGoal && (\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n )}\n\n {!hideGoal && (\n <Stack>\n <Stack direction=\"row\" alignItems=\"center\" gap={3}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Meta {isMonthly ? 'anual' : 'mensal'}\n </Typography>\n\n {editGoalAction}\n </Stack>\n\n <Typography variant=\"subtitle2\">{fCurrencyBRL(kpis?.goal)}</Typography>\n </Stack>\n )}\n\n {!hideGoal && (\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n )}\n\n {!hideGoal && (\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Atingimento\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fPercent(kpis?.achievement ?? 0, {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n })}\n </Typography>\n </Stack>\n )}\n\n {!hideGoal && (\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n )}\n\n {!hideGoal && (\n <Stack>\n <Stack direction=\"row\" gap={0.5}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n GAP do {isMonthly ? 'ano' : 'mês'}\n </Typography>\n\n <InfoCircle\n text=\"Diferença entre o valor realizado e a meta. Um GAP significa que as vendas ainda estão abaixo do objetivo definido para o período.\"\n width={18}\n arrow\n sx={{ mt: -0.1 }}\n />\n </Stack>\n\n <Typography variant=\"subtitle2\">{fCurrencyBRL(kpis?.gap)}</Typography>\n </Stack>\n )}\n </Stack>\n );\n};\n\nexport default Summary;\n","import { useCallback, useMemo, useState } from 'react';\nimport CardContent from '@mui/material/CardContent';\nimport CardHeader from '@mui/material/CardHeader';\nimport Stack from '@mui/material/Stack';\nimport { CategoricalChartFunc } from 'recharts/types/chart/types';\n\nimport ChartLoading from 'components/Analytics/ChartLoading';\nimport { ChartCard } from 'components/Analytics/ChartStyles';\nimport EmptyState from 'components/Analytics/EmptyState';\nimport Result from 'components/Result';\nimport { ViewMode } from 'utils/analytics';\n\nimport ForecastChart from './Chart';\nimport SalesForecastLegend from './Legend';\nimport { SalesForecastProps, VisibleSeries } from './props';\nimport SalesForecastSummary from './Summary';\n\nconst SalesForecast = ({ data, viewMode, isFetching }: SalesForecastProps) => {\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const [visibleSeries, setVisibleSeries] = useState<VisibleSeries>({\n realized: true,\n forecast: true,\n });\n const [activeBarIndex, setActiveBarIndex] = useState<number | null>(null);\n\n const handleToggleSerie = useCallback((serie: keyof VisibleSeries) => {\n setVisibleSeries(prev => ({ ...prev, [serie]: !prev[serie] }));\n }, []);\n\n const handleMouseMove = useCallback<CategoricalChartFunc>(state => {\n if (state?.activeTooltipIndex != null) {\n setActiveBarIndex(Number(state.activeTooltipIndex));\n }\n }, []);\n\n const handleMouseLeave = useCallback<CategoricalChartFunc>(\n () => setActiveBarIndex(null),\n [],\n );\n\n const totals = useMemo(() => {\n const totalRealized = data.reduce(\n (acc, item) => acc + (item.realized_value ?? 0),\n 0,\n );\n\n const totalForecast = data.reduce(\n (acc, item) => acc + (item.forecast_value ?? 0),\n 0,\n );\n\n const percentage =\n totalForecast > 0 ? Math.round((totalRealized / totalForecast) * 100) : 0;\n return { totalRealized, totalForecast, percentage };\n }, [data]);\n\n return (\n <ChartCard>\n <CardHeader title=\"Previsto vs. Realizado (Positivação)\" />\n\n <CardContent>\n <Result isEmpty={data.length === 0} empty={<EmptyState />}>\n <Stack gap={3}>\n <Stack display={{ xs: 'none', md: 'block' }}>\n <SalesForecastSummary\n totalForecast={totals.totalForecast}\n totalRealized={totals.totalRealized}\n percentage={totals.percentage}\n isMonthly={isMonthly}\n />\n </Stack>\n\n <ChartLoading active={isFetching}>\n <ForecastChart\n data={data}\n viewMode={viewMode}\n visibleSeries={visibleSeries}\n activeBarIndex={activeBarIndex}\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n />\n </ChartLoading>\n\n <SalesForecastLegend\n visibleSeries={visibleSeries}\n onToggleSerie={handleToggleSerie}\n />\n\n <Stack display={{ xs: 'block', md: 'none' }}>\n <SalesForecastSummary\n totalForecast={totals.totalForecast}\n totalRealized={totals.totalRealized}\n percentage={totals.percentage}\n isMonthly={isMonthly}\n />\n </Stack>\n </Stack>\n </Result>\n </CardContent>\n </ChartCard>\n );\n};\n\nexport default SalesForecast;\n","import { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Bar,\n BarChart,\n CartesianGrid,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { ChartWrapper } from 'components/Analytics/ChartStyles';\nimport RotatedTick from 'components/Analytics/RotatedTick';\nimport { ViewMode } from 'utils/analytics';\nimport { formatDayLabel, formatMonthLabel } from 'utils/chart';\nimport { fShortenNumber } from 'utils/formatNumber';\n\nimport { COLORS } from '../props';\n\nimport BarBackground from './BarBackground';\nimport { ChartProps } from './props';\nimport RealizedBackground from './RealizedBackground';\nimport SalesForecastTooltip from './Tooltip';\n\nconst ForecastChart = ({\n data,\n viewMode,\n visibleSeries,\n activeBarIndex,\n onMouseMove,\n onMouseLeave,\n}: ChartProps) => {\n const isMonthly = viewMode === ViewMode.MONTHLY;\n\n const [containerWidth, setContainerWidth] = useState(0);\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const wrapperRefCallback = useCallback((node: HTMLDivElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n if (node) {\n setContainerWidth(node.clientWidth);\n observerRef.current = new ResizeObserver(() =>\n setContainerWidth(node.clientWidth),\n );\n observerRef.current.observe(node);\n }\n }, []);\n\n const shouldRotateLabels = useMemo(() => {\n if (!isMonthly) return false;\n if (containerWidth === 0 || data.length === 0) return false;\n const slotPerBar = (containerWidth - 60) / data.length;\n return slotPerBar < 80;\n }, [isMonthly, containerWidth, data.length]);\n\n const hasRealizedData = useMemo(\n () => data.some(item => item.realized_value > 0),\n [data],\n );\n\n const hasForecastData = useMemo(\n () => data.some(item => item.forecast_value > 0),\n [data],\n );\n\n const yDomain = useMemo((): [number, number] => {\n if (!data.length) return [0, 1];\n const values = data.flatMap(item => [\n item.realized_value,\n item.forecast_value,\n ]);\n const max = Math.max(...values);\n return [0, max > 0 ? max * 1.15 : 1];\n }, [data]);\n\n const yTicks = useMemo(() => {\n const [, max] = yDomain;\n const step = max / 6;\n return [\n ...new Set(Array.from({ length: 7 }, (_, i) => Math.round(step * i))),\n ];\n }, [yDomain]);\n\n const tickFormatter = useMemo(\n () => (isMonthly ? formatMonthLabel : formatDayLabel),\n [isMonthly],\n );\n\n const bothRendered =\n visibleSeries.realized &&\n hasRealizedData &&\n visibleSeries.forecast &&\n hasForecastData;\n\n return (\n <ChartWrapper ref={wrapperRefCallback}>\n <ResponsiveContainer width=\"100%\" height={250}>\n <BarChart\n data={data}\n margin={{\n top: 20,\n right: 10,\n bottom: shouldRotateLabels ? -90 : 0,\n left: 20,\n }}\n barCategoryGap=\"20%\"\n barGap={4}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n >\n <CartesianGrid\n vertical={false}\n strokeDasharray=\"3 3\"\n stroke=\"#F4F6F8\"\n />\n\n <XAxis\n dataKey=\"label\"\n axisLine={false}\n tickLine={false}\n {...(shouldRotateLabels && { interval: 0, height: 120 })}\n tick={\n shouldRotateLabels ? (\n <RotatedTick />\n ) : (\n { fontSize: 12, fill: '#637381' }\n )\n }\n tickFormatter={tickFormatter}\n />\n\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 12, fill: '#637381' }}\n tickFormatter={(v: number) => fShortenNumber(v)}\n domain={yDomain}\n ticks={yTicks}\n />\n\n <Tooltip\n content={<SalesForecastTooltip viewMode={viewMode} />}\n cursor={false}\n />\n\n {visibleSeries.realized && hasRealizedData && (\n <Bar\n dataKey=\"realized_value\"\n name=\"Realizado\"\n fill={COLORS.realized}\n maxBarSize={32}\n isAnimationActive={false}\n radius={[4, 4, 0, 0]}\n background={\n <RealizedBackground\n activeBarIndex={activeBarIndex}\n bothRendered={bothRendered}\n />\n }\n />\n )}\n\n {visibleSeries.forecast && hasForecastData && (\n <Bar\n dataKey=\"forecast_value\"\n name=\"Previsto\"\n fill={COLORS.forecast}\n maxBarSize={32}\n isAnimationActive={false}\n radius={[4, 4, 0, 0]}\n {...(!visibleSeries.realized && {\n background: <BarBackground activeBarIndex={activeBarIndex} />,\n })}\n />\n )}\n </BarChart>\n </ResponsiveContainer>\n </ChartWrapper>\n );\n};\n\nexport default ForecastChart;\n","import { SalesForecastDashboardSeriesItem } from 'types/overviewAnalytics';\nimport { ViewMode } from 'utils/analytics';\n\nexport interface SalesForecastProps {\n data: SalesForecastDashboardSeriesItem[];\n isFetching?: boolean;\n viewMode: ViewMode;\n}\n\nexport interface VisibleSeries {\n realized: boolean;\n forecast: boolean;\n}\n\nexport interface SummaryProps {\n totalForecast: number;\n totalRealized: number;\n percentage: number;\n isMonthly: boolean;\n}\n\nexport interface LegendProps {\n visibleSeries: VisibleSeries;\n onToggleSerie: (serie: keyof VisibleSeries) => void;\n}\n\nexport const COLORS = {\n realized: '#22C55E',\n forecast: '#F59E0B',\n} as const;\n","import { BarBackgroundComponentProps } from './props';\n\nconst BarBackground = ({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n index,\n activeBarIndex,\n}: BarBackgroundComponentProps) => {\n if (activeBarIndex !== index) return null;\n\n return (\n <rect\n x={x - 6}\n y={y}\n width={width + 12}\n height={height + 6}\n fill=\"#919EAB\"\n opacity={0.16}\n rx={6}\n />\n );\n};\n\nexport default BarBackground;\n","import { RealizedBackgroundProps } from './props';\n\nconst RealizedBackground = ({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n index,\n activeBarIndex,\n bothRendered,\n}: RealizedBackgroundProps) => {\n if (activeBarIndex !== index) return null;\n\n return (\n <rect\n x={x - 6}\n y={y}\n width={bothRendered ? width * 2 + 4 + 12 : width + 12}\n height={height + 6}\n fill=\"#919EAB\"\n opacity={0.16}\n rx={6}\n />\n );\n};\n\nexport default RealizedBackground;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport SimpleCard from 'components/SimpleCard';\nimport { ViewMode } from 'utils/analytics';\nimport { MONTH_FULL_LABELS } from 'utils/chart';\nimport { fCurrencyBRL } from 'utils/formatNumber';\n\nimport { CustomTooltipProps } from './props';\n\nconst SalesForecastTooltip = ({\n active,\n payload,\n label,\n viewMode,\n}: CustomTooltipProps) => {\n if (!active || !payload?.length) return null;\n\n const isDaily = viewMode === ViewMode.DAILY;\n\n let formattedLabel = String(label);\n const parts = formattedLabel.split('-');\n\n if (parts.length >= 2) {\n const monthIndex = parseInt(parts[1], 10) - 1;\n const month = MONTH_FULL_LABELS[monthIndex];\n\n if (isDaily && parts.length === 3) {\n formattedLabel = `${parseInt(parts[2], 10)} de ${month} de ${parts[0]}`;\n } else if (!isDaily) {\n formattedLabel = `${month} de ${parts[0]}`;\n }\n }\n\n return (\n <SimpleCard minWidth={{ xs: 'auto', sm: 200 }} p={1} gap={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {formattedLabel}\n </Typography>\n\n <Divider />\n\n <Stack>\n {payload.map((entry, index) => (\n <Stack\n key={entry.name}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap={3}\n data-testid={`tooltip-item-${index}`}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack\n width={6}\n height={6}\n borderRadius=\"50%\"\n bgcolor={entry.color}\n />\n\n <Typography variant=\"body2\" noWrap>\n {entry.name}\n </Typography>\n </Stack>\n\n <Typography variant=\"body2\">{fCurrencyBRL(entry.value)}</Typography>\n </Stack>\n ))}\n </Stack>\n </SimpleCard>\n );\n};\n\nexport default SalesForecastTooltip;\n","import Checkbox from '@mui/material/Checkbox';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Stack from '@mui/material/Stack';\n\nimport { COLORS, LegendProps } from './props';\n\nconst SalesForecastLegend = ({ visibleSeries, onToggleSerie }: LegendProps) => (\n <Stack direction=\"row\" justifyContent=\"center\" flexWrap=\"wrap\" gap={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.realized}\n onChange={() => onToggleSerie('realized')}\n sx={{ '&.Mui-checked': { color: COLORS.realized } }}\n />\n }\n label=\"Realizado\"\n />\n\n <FormControlLabel\n control={\n <Checkbox\n checked={visibleSeries.forecast}\n onChange={() => onToggleSerie('forecast')}\n sx={{ '&.Mui-checked': { color: COLORS.forecast } }}\n />\n }\n label=\"Previsto\"\n />\n </Stack>\n);\n\nexport default SalesForecastLegend;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport useResponsive from 'hooks/useResponsive';\nimport { fCurrencyBRL } from 'utils/formatNumber';\n\nimport { SummaryProps } from './props';\n\nconst SalesForecastSummary = ({\n totalForecast,\n totalRealized,\n percentage,\n isMonthly,\n}: SummaryProps) => {\n const isMobile = useResponsive('down', 'md');\n\n return (\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n alignItems={{ xs: 'flex-start', md: 'center' }}\n flexWrap=\"wrap\"\n gap={3}\n >\n {isMobile && (\n <Divider\n orientation=\"horizontal\"\n flexItem\n sx={{\n borderStyle: 'dashed',\n mx: -3,\n }}\n />\n )}\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {isMonthly ? 'Total previsto no ano' : 'Total previsto no mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fCurrencyBRL(totalForecast)}\n </Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {isMonthly ? 'Total realizado no ano' : 'Total realizado no mês'}\n </Typography>\n\n <Typography variant=\"subtitle2\">\n {fCurrencyBRL(totalRealized)}\n </Typography>\n </Stack>\n\n <Divider\n orientation={isMobile ? 'horizontal' : 'vertical'}\n flexItem\n sx={{ borderStyle: isMobile ? 'solid' : 'dashed' }}\n />\n\n <Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Atingimento\n </Typography>\n\n <Typography variant=\"subtitle2\">{percentage}%</Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default SalesForecastSummary;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../../chunk-K2PWIYEM.js';
|
|
2
2
|
import { b as b$3, a as a$6 } from '../../../chunk-XL6SZZGI.js';
|
|
3
|
-
import { a, b as b$1, m, n, c } from '../../../chunk-
|
|
3
|
+
import { a, b as b$1, m, n, c } from '../../../chunk-OZTGZSNN.js';
|
|
4
4
|
import { a as a$2 } from '../../../chunk-Q2R3X4EB.js';
|
|
5
5
|
import { a as a$9 } from '../../../chunk-DRGARBKB.js';
|
|
6
6
|
import { a as a$5 } from '../../../chunk-LTXQ3A3C.js';
|
|
@@ -69,7 +69,12 @@ interface DashboardLayoutProps {
|
|
|
69
69
|
|
|
70
70
|
declare const DashboardLayout: ({ dashboard, widgets }: DashboardLayoutProps) => react_jsx_runtime.JSX.Element;
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
interface EmptyStateProps {
|
|
73
|
+
title?: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare const EmptyState: ({ title, description, }: EmptyStateProps) => react_jsx_runtime.JSX.Element;
|
|
73
78
|
|
|
74
79
|
interface ExportButtonProps {
|
|
75
80
|
onExport: (format: ExportFormat) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { a as ReferenceCircle, b as WrappedTick } from '../../chunk-XL6SZZGI.js';
|
|
2
|
-
export { a as ChartCard, b as ChartCardHeader, c as ChartWrapper, i as ColoredCheckbox, m as EmptyState, l as EmptyStateContainer, g as LegendContainer, h as LegendItem, n as RotatedTick, k as SummaryDivider, j as SummaryStack, d as TooltipContainer, e as TooltipDivider, f as TooltipDot } from '../../chunk-
|
|
2
|
+
export { a as ChartCard, b as ChartCardHeader, c as ChartWrapper, i as ColoredCheckbox, m as EmptyState, l as EmptyStateContainer, g as LegendContainer, h as LegendItem, n as RotatedTick, k as SummaryDivider, j as SummaryStack, d as TooltipContainer, e as TooltipDivider, f as TooltipDot } from '../../chunk-OZTGZSNN.js';
|
|
3
3
|
import { a as a$9 } from '../../chunk-DRGARBKB.js';
|
|
4
4
|
import { a as a$c } from '../../chunk-RUABKHIV.js';
|
|
5
5
|
import { a as a$8 } from '../../chunk-J7RPKCIN.js';
|
|
@@ -83,6 +83,7 @@ interface OverviewDetailProps {
|
|
|
83
83
|
onPaginationChange: (page: number, pageSize: number) => void;
|
|
84
84
|
buildPartnerLink?: (partnerId: string) => string;
|
|
85
85
|
mobileItemSlot?: (row: OverviewDetailOrder) => ReactNode;
|
|
86
|
+
hideStatus?: boolean;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
export { OverviewDetailBaseProps, OverviewDetailOrder, OverviewDetailProps, QuotationDashboard, QuotationDashboardSeriesItem, RevenueGoalAiSummary, RevenueGoalDashboard, RevenueGoalDashboardKpis, RevenueGoalDashboardSeriesItem, SalesForecastDashboard, SalesForecastDashboardSeriesItem };
|
package/package.json
CHANGED
package/dist/chunk-RTXMZGBW.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-FMFS42U2.js';
|
|
2
|
-
import e from '@mui/material/Box';
|
|
3
|
-
import f from '@mui/material/Card';
|
|
4
|
-
import b from '@mui/material/CardHeader';
|
|
5
|
-
import w from '@mui/material/Checkbox';
|
|
6
|
-
import t from '@mui/material/Stack';
|
|
7
|
-
import { styled } from '@mui/material/styles';
|
|
8
|
-
import g from '@mui/material/Typography';
|
|
9
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
-
|
|
11
|
-
var y=styled(f)(({theme:o})=>({width:"100%",border:`1px solid ${o.palette.divider}`,boxShadow:"none",overflow:"visible"})),k=styled(b)(({theme:o})=>({[o.breakpoints.down("sm")]:{flexWrap:"wrap",gap:o.spacing(2),"& .MuiCardHeader-action":{width:"100%"}}})),v=styled(t)({position:"relative",width:"100%",overflow:"visible","& .recharts-wrapper, & .recharts-wrapper *":{outline:"none !important",boxShadow:"none !important",WebkitTapHighlightColor:"transparent"}}),S=styled(e)(({theme:o})=>({backgroundColor:o.palette.background.paper,border:"1px solid",borderColor:o.palette.divider,borderRadius:o.shape.borderRadius,padding:o.spacing(1.5),boxShadow:o.shadows[3]})),T=styled(e)(({theme:o})=>({width:"100%",height:"1px",backgroundColor:o.palette.divider,marginBottom:o.spacing(1.5)})),D=styled(e,{shouldForwardProp:o=>o!=="dotColor"})(({dotColor:o})=>({width:10,height:10,borderRadius:"50%",backgroundColor:o})),I=styled(t)({flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:16,marginTop:16}),H=styled(t)({flexDirection:"row",alignItems:"center",cursor:"pointer"}),R=styled(w,{shouldForwardProp:o=>o!=="checkboxColor"})(({checkboxColor:o})=>({color:o,"&.Mui-checked":{color:o},padding:4})),A=styled(t)({flexDirection:"row",alignItems:"flex-start",gap:32,marginBottom:24,flexWrap:"wrap"}),W=styled(e)(({theme:o})=>({width:"1px",height:40,backgroundColor:o.palette.divider,alignSelf:"center"})),L=styled(t)({minHeight:350,alignItems:"center",justifyContent:"center",gap:12});var M=()=>jsxs(t,{minHeight:300,alignItems:"center",justifyContent:"center",gap:1.5,children:[jsx(a,{icon:"CALENDAR_TODAY",width:60,color:"text.secondary"}),jsxs(t,{textAlign:"center",children:[jsx(g,{variant:"subtitle1",children:"Nenhum dado dispon\xEDvel ainda"}),jsx(g,{variant:"body2",color:"text.secondary",children:"Assim que houver registros, os dados ser\xE3o exibidos aqui."})]})]}),J=M;var E=o=>{let{x:p,y:d,payload:a,tickFormatter:l,index:C=0,maxChars:s=10}=o;if(p==null||d==null||!a)return null;let i=l?l(a.value,C):a.value,u=i.length>s?`${i.slice(0,s)}...`:i;return jsx("g",{transform:`translate(${p},${d})`,children:jsx("text",{x:0,y:0,dy:4,textAnchor:"end",fill:"#637381",fontSize:11,transform:"rotate(-45)",children:u})})},U=E;
|
|
12
|
-
|
|
13
|
-
export { y as a, k as b, v as c, S as d, T as e, D as f, I as g, H as h, R as i, A as j, W as k, L as l, J as m, U as n };
|
|
14
|
-
//# sourceMappingURL=chunk-RTXMZGBW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Analytics/ChartStyles/styles.ts","../src/components/Analytics/EmptyState/index.tsx","../src/components/Analytics/RotatedTick/index.tsx"],"names":["Box","MuiCard","MuiCardHeader","MuiCheckbox","Stack","styled","ChartCard","theme","ChartCardHeader","ChartWrapper","TooltipContainer","TooltipDivider","TooltipDot","prop","dotColor","LegendContainer","LegendItem","ColoredCheckbox","checkboxColor","SummaryStack","SummaryDivider","EmptyStateContainer","Typography","jsx","jsxs","EmptyState","Icon_default","EmptyState_default","RotatedTick","props","x","y","payload","tickFormatter","index","maxChars","raw","label","RotatedTick_default"],"mappings":"wCAAA,OAAOA,MAAS,oBAChB,OAAOC,MAAa,qBACpB,OAAOC,MAAmB,2BAC1B,OAAOC,MAAiB,y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ACC,EAAS,OAAO,KAE/C,IAAMI,EAAMH,EACRA,EAAcD,EAAQ,MAAOE,CAAK,EAClCF,EAAQ,MACNK,EAAQD,EAAI,OAASD,EAAW,GAAGC,EAAI,MAAM,EAAGD,CAAQ,OAASC,EAEvE,OACEb,EAAC,KAAE,UAAW,aAAaO,KAAKC,KAC9B,SAAAR,EAAC,QACC,EAAG,EACH,EAAG,EACH,GAAI,EACJ,WAAW,MACX,KAAK,UACL,SAAU,GACV,UAAU,cAET,SAAAc,EACH,EACF,CAEJ,EAEOC,EAAQV","sourcesContent":["import Box from '@mui/material/Box';\nimport MuiCard from '@mui/material/Card';\nimport MuiCardHeader from '@mui/material/CardHeader';\nimport MuiCheckbox from '@mui/material/Checkbox';\nimport Stack from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\n\nexport const ChartCard = styled(MuiCard)(({ theme }) => ({\n width: '100%',\n\n border: `1px solid ${theme.palette.divider}`,\n\n boxShadow: 'none',\n overflow: 'visible',\n}));\n\nexport const ChartCardHeader = styled(MuiCardHeader)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n flexWrap: 'wrap',\n gap: theme.spacing(2),\n\n '& .MuiCardHeader-action': {\n width: '100%',\n },\n },\n}));\n\nexport const ChartWrapper = styled(Stack)({\n position: 'relative',\n width: '100%',\n overflow: 'visible',\n\n '& .recharts-wrapper, & .recharts-wrapper *': {\n outline: 'none !important',\n boxShadow: 'none !important',\n WebkitTapHighlightColor: 'transparent',\n },\n});\n\nexport const TooltipContainer = styled(Box)(({ theme }) => ({\n backgroundColor: theme.palette.background.paper,\n border: '1px solid',\n borderColor: theme.palette.divider,\n borderRadius: theme.shape.borderRadius,\n padding: theme.spacing(1.5),\n boxShadow: theme.shadows[3],\n}));\n\nexport const TooltipDivider = styled(Box)(({ theme }) => ({\n width: '100%',\n height: '1px',\n backgroundColor: theme.palette.divider,\n marginBottom: theme.spacing(1.5),\n}));\n\nexport const TooltipDot = styled(Box, {\n shouldForwardProp: prop => prop !== 'dotColor',\n})<{ dotColor: string }>(({ dotColor }) => ({\n width: 10,\n height: 10,\n borderRadius: '50%',\n backgroundColor: dotColor,\n}));\n\nexport const LegendContainer = styled(Stack)({\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n marginTop: 16,\n});\n\nexport const LegendItem = styled(Stack)({\n flexDirection: 'row',\n alignItems: 'center',\n cursor: 'pointer',\n});\n\nexport const ColoredCheckbox = styled(MuiCheckbox, {\n shouldForwardProp: prop => prop !== 'checkboxColor',\n})<{ checkboxColor: string }>(({ checkboxColor }) => ({\n color: checkboxColor,\n '&.Mui-checked': { color: checkboxColor },\n padding: 4,\n}));\n\nexport const SummaryStack = styled(Stack)({\n flexDirection: 'row',\n alignItems: 'flex-start',\n gap: 32,\n marginBottom: 24,\n flexWrap: 'wrap',\n});\n\nexport const SummaryDivider = styled(Box)(({ theme }) => ({\n width: '1px',\n height: 40,\n backgroundColor: theme.palette.divider,\n alignSelf: 'center',\n}));\n\nexport const EmptyStateContainer = styled(Stack)({\n minHeight: 350,\n alignItems: 'center',\n justifyContent: 'center',\n gap: 12,\n});\n","import Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport Icon from 'components/Icon';\n\nconst EmptyState = () => {\n return (\n <Stack\n minHeight={300}\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={1.5}\n >\n <Icon icon=\"CALENDAR_TODAY\" width={60} color=\"text.secondary\" />\n\n <Stack textAlign=\"center\">\n <Typography variant=\"subtitle1\">\n Nenhum dado disponível ainda\n </Typography>\n\n <Typography variant=\"body2\" color=\"text.secondary\">\n Assim que houver registros, os dados serão exibidos aqui.\n </Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default EmptyState;\n","import { RotatedTickProps } from './props';\n\nconst RotatedTick = (props: RotatedTickProps) => {\n const { x, y, payload, tickFormatter, index = 0, maxChars = 10 } = props;\n if (x == null || y == null || !payload) return null;\n\n const raw = tickFormatter\n ? tickFormatter(payload.value, index)\n : payload.value;\n const label = raw.length > maxChars ? `${raw.slice(0, maxChars)}...` : raw;\n\n return (\n <g transform={`translate(${x},${y})`}>\n <text\n x={0}\n y={0}\n dy={4}\n textAnchor=\"end\"\n fill=\"#637381\"\n fontSize={11}\n transform=\"rotate(-45)\"\n >\n {label}\n </text>\n </g>\n );\n};\n\nexport default RotatedTick;\n"]}
|