feat: PieChart data ploted from backend

feat-scaling-ticket-remote-creation
adriano 2024-03-28 14:12:30 -03:00
parent 5e81f02116
commit 76929c41ec
2 changed files with 11 additions and 6 deletions

View File

@ -72,7 +72,7 @@ const PieChart = ({ data = dataExample }) => {
return (
<Box width="100%" height="100%" position="relative" display="flex">
<Box sx={{ position: "absolute" }}>
<Title>Tickets Status</Title>
<Title>Tickets status de encerramento</Title>
</Box>
<Box
component="ul"

View File

@ -258,7 +258,7 @@ const Dashboard = () => {
const [usersOnlineInfo, dispatch] = useReducer(reducer, [])
const [ticketStatusChange, setStatus] = useState()
const [ticketsStatus, setTicktsStatus] = useState({ open: 0, openAll: 0, pending: 0, closed: 0 })
const [ticketStatusChatEnd, setTicketStatusChatEnd] = useState([])
const { user } = useContext(AuthContext)
useEffect(() => {
@ -289,10 +289,15 @@ const Dashboard = () => {
params: { userId: null, startDate: dateToday, endDate: dateToday },
})
// console.log('data.data: ', data.usersProfile)
dispatch({ type: "RESET" })
dispatch({ type: "LOAD_QUERY", payload: data.usersProfile })
const { data: ticketStatusChatEndData } = await api.get("/reports/count/statusChatEnd", {
params: { startDate: '2024-03-21', endDate: '2024-03-28' },
})
setTicketStatusChatEnd(ticketStatusChatEndData.reportStatusChatEnd)
} catch (err) {
}
@ -506,7 +511,7 @@ const Dashboard = () => {
</Grid>
<Grid item xs={12} sm={12} md={6} lg={6}>
<Paper className={classes.fixedHeightPaper} variant="outlined">
<PieChart data={[]} />
<PieChart data={ticketStatusChatEnd} />
</Paper>
</Grid>
</Grid>