​​​​​​​​​​​​​​​​​​​​​🔴 Seguir para AULA 24.14 instalação com MYSQL (REPO OFICIAL COM TODAS AS CUSTOMS​)

✅ Múltiplos atendentes - 1 número, vários usuários + Exportação em massa de contato - SUPORTE 15 99856-6622​ (wa.me/5515998566622​)


​​👉 ​INSTRUÇÕES BÁSICAS: VÍDEO 1

1- ALTERAR FRONTEND > SRC > COMPONENTS > TICKETACTIONBUTTONS > INDEX.JS

import { useHistory, useParams } from "react-router-dom";

const { ticketId } = useParams();

    const classes = useStyles();

    const history = useHistory();

    const [anchorEl, setAnchorEl] = useState(null);

    const [loading, setLoading] = useState(false);

    const ticketOptionsMenuOpen = Boolean(anchorEl);

    const { user } = useContext(AuthContext);

    const handleSendMessage = async () => {

        const message = {

          read: 1,

          fromMe: true,

          mediaUrl: "",

          body: "Seu protocolo de atendimento é: *nº " + Math.floor(Date.now()/1000) + '*',

        };

        try {

          const { data } = await api.get("/tickets/" + ticketId);

          //ZDGProtocolo(data.contact.number, Math.floor(Date.now()/1000).toString());

          await api.post(`/messages/${ticketId}`, message);

          alert('Protocolo de atendimento:' + Math.floor(Date.now()/1000));

          await api.put(`/tickets/${ticket.id}`, {

            status: "closed"

        });

        } catch (err) {

          toastError(err);

        }

      };


const handleUpdateTicketStatus = async (e, status, userId) => {

        setLoading(true);

        try {

            await api.put(`/tickets/${ticket.id}`, {

                status: status,

                userId: userId || null,

            });

            if (status === "closed") {

                handleSendMessage();

            }

            setLoading(false);

            if (status === "open") {

                history.push(`/tickets/${ticket.id}`);

            }

             else {

                history.push("/tickets");

            }

        } catch (err) {

            setLoading(false);

            toastError(err);

        }

    };​