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" && ( - - )} {ticket.lastMessage && ( { )} )} - {ticket?.whatsappId && ( -
{ticket.whatsapp.name}
+ {ticket.whatsappId && ( +
{ticket.whatsapp?.name}
)} } @@ -243,17 +295,51 @@ const TicketListItem = ({ ticket }) => { } /> {ticket.status === "pending" && ( - handleAcepptTicket(ticket.id)} - > - {i18n.t("ticketsList.buttons.accept")} - + handleAcepptTicket(ticket.id)} > + + + )} + {ticket.status === "pending" && ( + handleViewTicket(ticket.id)} > + + + )} + {ticket.status === "open" && ( + handleViewTicket(ticket.id)} > + + )} + {ticket.status === "open" && ( + handleClosedTicket(ticket.id)} > + + + )} + {ticket.status === "closed" && ( + handleReopenTicket(ticket.id)} > + + + )} + {ticket.status === "closed" && ( + + + )} From d0bc8ef86da6fa721a84b73ae4f5d489ac02b0c7 Mon Sep 17 00:00:00 2001 From: tonnybarros <68646516+tonnybarros@users.noreply.github.com> Date: Thu, 12 May 2022 19:41:27 -0300 Subject: [PATCH 2/3] =?UTF-8?q?Visualizador=20de=20imagem:=20Inserir=20o?= =?UTF-8?q?=20bot=C3=A3o=20de=20girar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Visualizador de imagem: Inserir o botão de girar --- frontend/src/components/ModalImageCors/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/components/ModalImageCors/index.js b/frontend/src/components/ModalImageCors/index.js index 1e3a0237..635e4439 100644 --- a/frontend/src/components/ModalImageCors/index.js +++ b/frontend/src/components/ModalImageCors/index.js @@ -42,6 +42,7 @@ const ModalImageCors = ({ imageUrl }) => { smallSrcSet={fetching ? imageUrl : blobUrl} medium={fetching ? imageUrl : blobUrl} large={fetching ? imageUrl : blobUrl} + showRotate="true" alt="image" /> ); From 7c95ebded1532f0ea1730860ca5d9be7bba364c6 Mon Sep 17 00:00:00 2001 From: Robson Tenorio Date: Fri, 13 May 2022 01:03:17 -0300 Subject: [PATCH 3/3] Delete index.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Será incluso em outra PR para fins de controle --- .../src/components/ModalImageCors/index.js | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 frontend/src/components/ModalImageCors/index.js diff --git a/frontend/src/components/ModalImageCors/index.js b/frontend/src/components/ModalImageCors/index.js deleted file mode 100644 index 635e4439..00000000 --- a/frontend/src/components/ModalImageCors/index.js +++ /dev/null @@ -1,51 +0,0 @@ -import React, { useState, useEffect } from "react"; -import { makeStyles } from "@material-ui/core/styles"; - -import ModalImage from "react-modal-image"; -import api from "../../services/api"; - -const useStyles = makeStyles(theme => ({ - messageMedia: { - objectFit: "cover", - width: 250, - height: 200, - borderTopLeftRadius: 8, - borderTopRightRadius: 8, - borderBottomLeftRadius: 8, - borderBottomRightRadius: 8, - }, -})); - -const ModalImageCors = ({ imageUrl }) => { - const classes = useStyles(); - const [fetching, setFetching] = useState(true); - const [blobUrl, setBlobUrl] = useState(""); - - useEffect(() => { - if (!imageUrl) return; - const fetchImage = async () => { - const { data, headers } = await api.get(imageUrl, { - responseType: "blob", - }); - const url = window.URL.createObjectURL( - new Blob([data], { type: headers["content-type"] }) - ); - setBlobUrl(url); - setFetching(false); - }; - fetchImage(); - }, [imageUrl]); - - return ( - - ); -}; - -export default ModalImageCors;