Fix some errors in table users

pull/20/head
Renato Di Giacomo 2022-08-10 16:26:36 -03:00
parent ec19fb6799
commit 72c2a6c353
2 changed files with 48 additions and 56 deletions

View File

@ -94,7 +94,7 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
</TableHead>
<TableBody>
{usersOnlineInfo &&
{usersOnlineInfo &&
usersOnlineInfo
.filter((e) => {
if (filterStatus === null) return e;
@ -135,12 +135,20 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
</TableCell>
<TableCell>
<div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
<Typography className={classes.tableCounterOpen}>
{user.sumOpen === undefined ? 0 : user.sumOpen.count}
<div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
<Typography className={classes.tableCounterOpen} title="Em Atendimento">
{user.sumOpen
? user.sumOpen.count !== ""
? user.sumOpen.count
: 0
: 0}
</Typography>
<Typography className={classes.tableCounterClosed}>
{user.sumClosed === undefined ? 0 : user.sumClosed.count}
<Typography className={classes.tableCounterClosed} title="Finalzados">
{user.sumClosed
? user.sumClosed.count !== ""
? user.sumClosed.count
: 0
: 0}
</Typography>
</div>
</TableCell>
@ -154,19 +162,7 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
gap: "12px",
}}
>
<Typography
className={classes.tableQueues}
title="Sem Fila"
style={{ backgroundColor: "grey" }}
>
{user.openClosedOutQueue.countOpen === 0
? ""
: user.openClosedOutQueue.countOpen}
</Typography>
{!user.openClosedInQueue ? (
<Typography>Nenhuma fila atribuida</Typography>
) : (
{user.openClosedInQueue &&
user.openClosedInQueue.map((queue) => (
<Typography
key={queue.queueId}
@ -174,10 +170,18 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
title={queue.name}
style={{ backgroundColor: queue.color }}
>
{queue.countOpen}
{queue.countOpen ? queue.countOpen : "0"}
</Typography>
))
)}
))}
<Typography
className={classes.tableQueues}
title="Sem Fila"
style={{ backgroundColor: "grey" }}
>
{user.openClosedOutQueue.countOpen === 0
? 0
: user.openClosedOutQueue.countOpen}
</Typography>
</div>
</TableCell>
@ -190,38 +194,26 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
gap: "12px",
}}
>
<div
style={{
display: "flex",
flexWrap: "wrap",
alignItems: "center",
gap: "12px",
}}
{user.openClosedInQueue &&
user.openClosedInQueue.map((queue) => (
<Typography
key={queue.queueId}
className={classes.tableQueues}
title={queue.name}
style={{ backgroundColor: queue.color }}
>
{queue.countClosed ? queue.countClosed : "0"}
</Typography>
))}
<Typography
className={classes.tableQueues}
title="Sem Fila"
style={{ backgroundColor: "grey" }}
>
<Typography
className={classes.tableQueues}
title="Sem Fila"
style={{ backgroundColor: "grey" }}
>
{user.openClosedOutQueue.countClosed === 0
? ""
: user.openClosedOutQueue.countClosed}
</Typography>
{!user.openClosedInQueue ? (
<Typography>Nenhuma fila atribuida</Typography>
) : (
user.openClosedInQueue.map((queue) => (
<Typography
key={queue.queueId}
className={classes.tableQueues}
title={queue.name}
style={{ backgroundColor: queue.color }}
>
{queue.countClosed}
</Typography>
))
)}
</div>
{user.openClosedOutQueue.countOpen === 0
? 0
: user.openClosedOutQueue.countOpen}
</Typography>
</div>
</TableCell>
<TableCell>
@ -238,6 +230,7 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
) : (
<PowerSettingsNewIcon
style={{ color: "grey", cursor: "not-allowed" }}
title="Agente Não Logado"
/>
)}
</TableCell>

View File

@ -256,8 +256,8 @@ const Dashboard = () => {
const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
socket.on("ticketStatus", (data) => {
if (data.action === "update") {
setStatus("");
if (data.action === "update") {
setStatus("");
setStatus(data.ticketStatus.status);
}
});
@ -486,7 +486,6 @@ const Dashboard = () => {
usersOnlineInfo={usersOnlineInfo}
logout={handleLogouOnlineUser}
/>
</Grid>
</Paper>
</Grid>