From dd683049da9767651aa04ea7e7845fc1cb37d76d Mon Sep 17 00:00:00 2001
From: tonnybarros <68646516+tonnybarros@users.noreply.github.com>
Date: Wed, 11 May 2022 11:07:26 -0300
Subject: [PATCH 1/3] Update index.js
Visualizar a conversa sem aceitar.
---
.../src/components/TicketListItem/index.js | 140 ++++++++++++++----
1 file changed, 113 insertions(+), 27 deletions(-)
diff --git a/frontend/src/components/TicketListItem/index.js b/frontend/src/components/TicketListItem/index.js
index b9c7d302..519e2c92 100644
--- a/frontend/src/components/TicketListItem/index.js
+++ b/frontend/src/components/TicketListItem/index.js
@@ -13,11 +13,14 @@ import Typography from "@material-ui/core/Typography";
import Avatar from "@material-ui/core/Avatar";
import Divider from "@material-ui/core/Divider";
import Badge from "@material-ui/core/Badge";
-
+import IconButton from '@material-ui/core/IconButton';
import { i18n } from "../../translate/i18n";
-
+import DoneIcon from '@material-ui/icons/Done';
+import VisibilityIcon from '@material-ui/icons/Visibility';
+import ReplayIcon from '@material-ui/icons/Replay';
+import StopIcon from '@material-ui/icons/Stop';
import api from "../../services/api";
-import ButtonWithSpinner from "../ButtonWithSpinner";
+//import ButtonWithSpinner from "../ButtonWithSpinner";
import MarkdownWrapper from "../MarkdownWrapper";
import { Tooltip } from "@material-ui/core";
import { AuthContext } from "../../context/Auth/AuthContext";
@@ -81,6 +84,10 @@ const useStyles = makeStyles(theme => ({
marginLeft: "auto",
},
+ bottomButton: {
+ top: "12px",
+ },
+
badgeStyle: {
color: "white",
backgroundColor: green[500],
@@ -102,12 +109,12 @@ const useStyles = makeStyles(theme => ({
userTag: {
position: "absolute",
- marginRight: 35,
- right: 10,
- bottom: 9,
- background:"#2576D2",
+ marginRight: 5,
+ right: 20,
+ bottom: 30,
+ background: "#2576D2",
color: "#ffffff",
- border:"1px solid #CCC",
+ border: "1px solid #CCC",
padding: 1,
paddingLeft: 5,
paddingRight: 5,
@@ -147,6 +154,58 @@ const TicketListItem = ({ ticket }) => {
history.push(`/tickets/${id}`);
};
+ const handleReopenTicket = async id => {
+ setLoading(true);
+ try {
+ await api.put(`/tickets/${id}`, {
+ status: "open",
+ userId: user?.id,
+ });
+ } catch (err) {
+ setLoading(false);
+ toastError(err);
+ }
+ if (isMounted.current) {
+ setLoading(false);
+ }
+ history.push(`/tickets/${id}`);
+ };
+
+ const handleViewTicket = async id => {
+ setLoading(true);
+ try {
+ await api.put(`/tickets/${id}`, {
+ status: "pending",
+ userId: user?.id,
+ });
+ } catch (err) {
+ setLoading(false);
+ toastError(err);
+ }
+ if (isMounted.current) {
+ setLoading(false);
+ }
+ history.push(`/tickets/${id}`);
+ };
+
+ const handleClosedTicket = async id => {
+ setLoading(true);
+ try {
+ await api.put(`/tickets/${id}`, {
+ status: "closed",
+ userId: user?.id,
+ });
+ } catch (err) {
+ setLoading(false);
+ toastError(err);
+ }
+ if (isMounted.current) {
+ setLoading(false);
+ }
+ history.push(`/tickets/${id}`);
+ };
+
+
const handleSelectTicket = id => {
history.push(`/tickets/${id}`);
};
@@ -190,13 +249,6 @@ const TicketListItem = ({ ticket }) => {
>
{ticket.contact.name}
- {ticket.status === "closed" && (
-