queues fixed

create a new vision o queue list
Remove card responsive
pull/19/head
Renato Di Giacomo 2022-08-09 16:45:44 -03:00
parent 0f7e91c1bd
commit 564ab7d33f
2 changed files with 53 additions and 46 deletions

View File

@ -17,6 +17,9 @@ import InputLabel from "@mui/material/InputLabel";
import MenuItem from "@mui/material/MenuItem"; import MenuItem from "@mui/material/MenuItem";
import FormControl from "@mui/material/FormControl"; import FormControl from "@mui/material/FormControl";
import Tooltip from "@mui/material/Tooltip";
import Zoom from "@mui/material/Zoom";
import CancelIcon from "@material-ui/icons/Cancel"; import CancelIcon from "@material-ui/icons/Cancel";
import CheckCircleIcon from "@material-ui/icons/CheckCircle"; import CheckCircleIcon from "@material-ui/icons/CheckCircle";
import ErrorIcon from "@material-ui/icons/Error"; import ErrorIcon from "@material-ui/icons/Error";
@ -34,8 +37,6 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
setSearch(event.target.value.toLowerCase()); setSearch(event.target.value.toLowerCase());
}; };
console.log(usersOnlineInfo);
return ( return (
<Grid item xs={12}> <Grid item xs={12}>
<Paper className={classes.cardPaperFix} sx={12} variant="outlined"> <Paper className={classes.cardPaperFix} sx={12} variant="outlined">
@ -153,11 +154,20 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
gap: "12px", gap: "12px",
}} }}
> >
<Typography title="Cobrança">0</Typography> {!user.openClosedInQueue ? (
<Typography>0</Typography> <Typography>Sem fila</Typography>
<Typography>0</Typography> ) : (
<Typography>0</Typography> user.openClosedInQueue.map((queue) => (
<Typography>0</Typography> <Typography
key={queue.queueId}
className={classes.tableQueues}
title={queue.name}
style={{ backgroundColor: queue.color }}
>
{queue.countOpen}
</Typography>
))
)}
</div> </div>
</TableCell> </TableCell>
@ -170,11 +180,29 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
gap: "12px", gap: "12px",
}} }}
> >
<Typography title="Cobrança">0</Typography> <div
<Typography>0</Typography> style={{
<Typography>0</Typography> display: "flex",
<Typography>0</Typography> flexWrap: "wrap",
<Typography>0</Typography> alignItems: "center",
gap: "12px",
}}
>
{!user.openClosedInQueue ? (
<Typography>Sem fila</Typography>
) : (
user.openClosedInQueue.map((queue) => (
<Typography
key={queue.queueId}
className={classes.tableQueues}
title={queue.name}
style={{ backgroundColor: queue.color }}
>
{queue.countClosed}
</Typography>
))
)}
</div>
</div> </div>
</TableCell> </TableCell>
<TableCell> <TableCell>

View File

@ -10,20 +10,13 @@ import Zoom from "@mui/material/Zoom";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import Info from "@material-ui/icons/Info"; import Info from "@material-ui/icons/Info";
import useTickets from "../../hooks/useTickets";
import { AuthContext } from "../../context/Auth/AuthContext"; import { AuthContext } from "../../context/Auth/AuthContext";
import { i18n } from "../../translate/i18n"; import { i18n } from "../../translate/i18n";
import Chart from "./Chart"; import Chart from "./Chart";
import openSocket from "socket.io-client"; import openSocket from "socket.io-client";
import api from "../../services/api"; import api from "../../services/api";
import { Can } from "../../components/Can"; import { Can } from "../../components/Can";
import CardUser from "../../components/DashboardUser/CardUser";
import TableUser from "../../components/DashboardUser/TableUser"; import TableUser from "../../components/DashboardUser/TableUser";
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
@ -103,6 +96,12 @@ const useStyles = makeStyles((theme) => ({
textAlign: "center", textAlign: "center",
borderRadius: "5px", borderRadius: "5px",
}, },
tableQueues: {
color: "white",
width: "25px",
textAlign: "center",
borderRadius: "5px",
},
})); }));
const reducer = (state, action) => { const reducer = (state, action) => {
@ -175,20 +174,16 @@ const reducer = (state, action) => {
if (onlineUser.sumOpen) { if (onlineUser.sumOpen) {
if ("sumOpen" in state[index]) { if ("sumOpen" in state[index]) {
// console.log(' >>>>>>>>>>>>>>>>>> sumOpen 1 | state[index].sumOpen["count"]: ', state[index].sumOpen['count'], ' | onlineUser.sumOpen.count: ', onlineUser.sumOpen.count)
state[index].sumOpen["count"] = onlineUser.sumOpen.count; state[index].sumOpen["count"] = onlineUser.sumOpen.count;
} else if (!("sumOpen" in state[index])) { } else if (!("sumOpen" in state[index])) {
// console.log(' >>>>>>>>>>>>>>>>>> sumOpen 1')
state[index].sumOpen = onlineUser.sumOpen; state[index].sumOpen = onlineUser.sumOpen;
} }
} }
if (onlineUser.sumClosed) { if (onlineUser.sumClosed) {
if ("sumClosed" in state[index]) { if ("sumClosed" in state[index]) {
// console.log(' >>>>>>>>>>>>>>>>>> sumClosed 1 | state[index].sumClosed["count"]: ', state[index].sumClosed['count'], ' | onlineUser.sumClosed.count: ', onlineUser.sumClosed.count)
state[index].sumClosed["count"] = onlineUser.sumClosed.count; state[index].sumClosed["count"] = onlineUser.sumClosed.count;
} else if (!("sumClosed" in state[index])) { } else if (!("sumClosed" in state[index])) {
// console.log(' >>>>>>>>>>>>>>>>>> sumOpen 1')
state[index].sumClosed = onlineUser.sumClosed; state[index].sumClosed = onlineUser.sumClosed;
} }
} }
@ -247,10 +242,6 @@ const Dashboard = () => {
}); });
dispatch({ type: "RESET" }); dispatch({ type: "RESET" });
dispatch({ type: "LOAD_QUERY", payload: dataQuery.data }); dispatch({ type: "LOAD_QUERY", payload: dataQuery.data });
console.log("xxx REPORT 2 dataQuery : ", dataQuery.data);
//console.log()
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
@ -265,8 +256,6 @@ const Dashboard = () => {
const socket = openSocket(process.env.REACT_APP_BACKEND_URL); const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
socket.on("ticketStatus", (data) => { socket.on("ticketStatus", (data) => {
// console.log('data: ',data)
if (data.action === "update") { if (data.action === "update") {
setStatus(data.ticketStatus.status); setStatus(data.ticketStatus.status);
} }
@ -284,7 +273,6 @@ const Dashboard = () => {
socket.on("user", (data) => { socket.on("user", (data) => {
if (data.action === "delete") { if (data.action === "delete") {
// console.log(' entrou no delete user: ', data)
dispatch({ type: "DELETE_USER", payload: +data.userId }); dispatch({ type: "DELETE_USER", payload: +data.userId });
} }
}); });
@ -402,7 +390,7 @@ const Dashboard = () => {
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
<Paper className={classes.fixedHeightPaper} variant="outlined"> <Paper className={classes.fixedHeightPaper} variant="outlined">
<Chart /> <Chart allTickets={usersOnlineInfo} />
</Paper> </Paper>
</Grid> </Grid>
</Grid> </Grid>
@ -486,27 +474,18 @@ const Dashboard = () => {
</Grid> </Grid>
</Paper> </Paper>
</Grid> </Grid>
{window.innerWidth <= 992 ? (
<CardUser
classes={classes}
usersOnlineInfo={usersOnlineInfo}
logout={handleLogouOnlineUser}
/>
) : (
<TableUser <TableUser
classes={classes} classes={classes}
usersOnlineInfo={usersOnlineInfo} usersOnlineInfo={usersOnlineInfo}
logout={handleLogouOnlineUser} logout={handleLogouOnlineUser}
/> />
)}
</Grid> </Grid>
</Paper> </Paper>
</Grid> </Grid>
</Container> </Container>
)} )}
/> />
/**/
); );
}; };