From 144bb6db94bfaa22b8d1cf921a30271c1dbec754 Mon Sep 17 00:00:00 2001 From: adriano Date: Thu, 7 Mar 2024 18:17:02 -0300 Subject: [PATCH 1/6] update before git pull --- frontend/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/server.js b/frontend/server.js index a05ba32..cd23e05 100644 --- a/frontend/server.js +++ b/frontend/server.js @@ -6,4 +6,4 @@ app.use(express.static(path.join(__dirname, "build"))); app.get("/*", function (req, res) { res.sendFile(path.join(__dirname, "build", "index.html")); }); -app.listen(3333); +app.listen(3337); From e30573519d6925bfd66d40300ab862bdefb19985 Mon Sep 17 00:00:00 2001 From: gustavo-gsp Date: Tue, 25 Jun 2024 10:45:46 -0300 Subject: [PATCH 2/6] fix: resolve issues with WhatsApp creation and editing, message input, and ControlByNumber errors Details: - Fixed issue where the 'number' field was not being saved during WhatsApp creation and editing. - Resolved problem where text in the message input was being cleared upon receiving a new message. - Addressed errors in ControlByNumber when ticketId was not found. --- backend/src/controllers/WhatsAppController.ts | 12 +++++--- backend/src/helpers/controllByNumber.ts | 29 ++++++++++--------- frontend/src/components/MessageInput/index.js | 2 +- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/backend/src/controllers/WhatsAppController.ts b/backend/src/controllers/WhatsAppController.ts index 0158748..1a82021 100644 --- a/backend/src/controllers/WhatsAppController.ts +++ b/backend/src/controllers/WhatsAppController.ts @@ -377,9 +377,11 @@ export const store = async (req: Request, res: Response): Promise => { } else if (!isOfficial) { phoneNumberId = ""; wabaId = ""; - number = ""; + //number = ""; + } + if(!number){ + number = getNumberFromName(name) } - let invalidPhoneName = validatePhoneName(name); if (invalidPhoneName) { @@ -479,9 +481,11 @@ export const update = async ( } else if (!isOfficial) { whatsappData.phoneNumberId = ""; whatsappData.wabaId = ""; - whatsappData.number = ""; + //whatsappData.number = ""; + } + if(!whatsappData?.number){ + whatsappData.number = getNumberFromName(whatsappData.name) } - const { whatsapp, oldDefaultWhatsapp } = await UpdateWhatsAppService({ whatsappData, whatsappId diff --git a/backend/src/helpers/controllByNumber.ts b/backend/src/helpers/controllByNumber.ts index e202f6f..6ffad64 100644 --- a/backend/src/helpers/controllByNumber.ts +++ b/backend/src/helpers/controllByNumber.ts @@ -13,43 +13,44 @@ async function controllByNumber() { let controll: any[] = []; for (const ticket of tickets) { - let match = ticket.match(/"whatsappId":(\d+)/); + let match = ticket?.match(/"whatsappId":(\d+)/); let whatsappId = match ? match[1] : null; const whatsapp = await get({ key: `whatsapp:${whatsappId}` }); - match = whatsapp.match(/"number":"(\d+)"/); + match = whatsapp?.match(/"number":"(\d+)"/); let number = match ? match[1] : null; - match = ticket.match(/"id":(\d+)/); + match = ticket?.match(/"id":(\d+)/); let ticketId = match ? match[1] : null; number = JSON.parse(number); ticketId = JSON.parse(ticketId); - const index = controll.findIndex((c: any) => c.number == number); + const index = controll?.findIndex((c: any) => c.number == number); if (index == -1) { - controll.push({ ticketId, number }); + controll?.push({ ticketId, number }); } } - const ticketIds = controll.map((c: any) => c.ticketId); + const ticketIds = controll?.map((c: any) => c.ticketId); - console.log("=======> ticketIds: ", ticketIds); + //console.log("=======> ticketIds: ", ticketIds); for (const ticketId of ticketIds) { const ticket: any = await Ticket.findByPk(ticketId); + if(ticket){ + const { status } = ticket; - const { status } = ticket; - - if (status == "pending") { - await UpdateTicketService({ - ticketData: { statusChatEnd: uuidv4() }, - ticketId: ticket.id - }); + if (status && status == "pending") { + await UpdateTicketService({ + ticketData: { statusChatEnd: uuidv4() }, + ticketId: ticket.id + }); + } } } diff --git a/frontend/src/components/MessageInput/index.js b/frontend/src/components/MessageInput/index.js index 9f0b895..f20b25a 100644 --- a/frontend/src/components/MessageInput/index.js +++ b/frontend/src/components/MessageInput/index.js @@ -247,7 +247,7 @@ const MessageInput = ({ ticketStatus, ticketLastMessage, ticketIsRemote }) => { setInputMessage(ticketLastMessage) } else { - setInputMessage("") + //setInputMessage("") } }, [countTicketMsg, ticketIsRemote, ticketLastMessage]) From 2bb5db92d7c652a3d9b5bc7e98dd06f7458f5baf Mon Sep 17 00:00:00 2001 From: gustavo-gsp Date: Thu, 27 Jun 2024 14:10:26 -0300 Subject: [PATCH 3/6] fix: resolve issue with blocking audio and video without the option being active Details: - Fixed the problem where audio and video were being blocked even when the option was not active. --- .../src/services/WbotServices/wbotMessageListener.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index db8604a..53b50e2 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -184,12 +184,10 @@ const verifyMediaMessage = async ( phoneNumberId: msg?.phoneNumberId, fromAgent: false }; - if ( - messageData.mediaType === "video" || - (messageData.mediaType === "audio" && - getSettingValue("blockAudioVideoMedia")?.value === "enabled") - ) { - mediaAuthorized = false; + if(getSettingValue('blockAudioVideoMedia')?.value === 'enabled'){ + if( messageData.mediaType === 'video' || messageData.mediaType === 'audio' ){ + mediaAuthorized = false; + } } if (msg?.fromMe) { messageData = { ...messageData, fromAgent: true }; From c39cae9f81f084b04602671ea4e55723e1ec9676 Mon Sep 17 00:00:00 2001 From: adriano Date: Thu, 25 Jul 2024 11:05:39 -0500 Subject: [PATCH 4/6] fix(i18n): add missing translations in the interface --- .../ChatEnd/TimerPickerSelect/index.js | 4 +- frontend/src/components/ConfigModal/index.js | 39 ++++----- .../src/components/DashboardUser/CardUser.jsx | 10 ++- .../DatePicker2/index.js | 4 +- .../TimerPickerSelect2/index.js | 4 +- .../src/components/PositionModal/index.js | 4 +- .../src/components/Report/DatePicker/index.js | 4 +- frontend/src/components/Report/Modal/index.js | 2 +- frontend/src/components/ReportModal/index.js | 7 +- frontend/src/components/UserModal/index.js | 4 +- frontend/src/layout/MainListItems.js | 4 +- frontend/src/pages/Dashboard/PieChart.js | 4 +- frontend/src/pages/Dashboard/index.js | 10 +-- frontend/src/pages/Report/index.js | 76 +++++++++--------- frontend/src/pages/StatusChatEnd/index.js | 10 +-- frontend/src/translate/languages/en.js | 80 +++++++++++++++---- frontend/src/translate/languages/es.js | 73 ++++++++++++++--- frontend/src/translate/languages/pt.js | 61 ++++++++++++-- 18 files changed, 283 insertions(+), 117 deletions(-) diff --git a/frontend/src/components/ChatEnd/TimerPickerSelect/index.js b/frontend/src/components/ChatEnd/TimerPickerSelect/index.js index b49ccf7..b642246 100644 --- a/frontend/src/components/ChatEnd/TimerPickerSelect/index.js +++ b/frontend/src/components/ChatEnd/TimerPickerSelect/index.js @@ -45,7 +45,7 @@ import { import ptBrLocale from "date-fns/locale/pt-BR"; - +import esLocale from 'date-fns/locale/es'; const ResponsiveTimePickers = (props) => { @@ -63,7 +63,7 @@ const ResponsiveTimePickers = (props) => { - + { }} > {({ values, touched, errors, isSubmitting }) => ( - +
@@ -299,7 +302,7 @@ const ConfigModal = ({ open, onClose, change }) => { { { checked={values.businessTimeEnable} /> } - label={'Ativar/Desativar'} /> + label={i18n.t('configModal.titles.enableDisable')} />
{ { { checked={values.businessTimeEnableSaturday} /> } - label={'Ativar/Desativar'} /> + label={i18n.t('configModal.titles.enableDisable')} />
{
{/* SABADO FIM */}
- + {/* Saturday and Sunday date */}
@@ -430,13 +433,13 @@ const ConfigModal = ({ open, onClose, change }) => { checked={values.enableWeekendMessage} /> } - label={'Ativar/Desativar'} + label={i18n.t('configModal.titles.enableDisable')} />
{ @@ -475,13 +478,13 @@ const ConfigModal = ({ open, onClose, change }) => { checked={values.holidayDateEnable} /> } - label={'Ativar/Desativar'} + label={i18n.t('configModal.titles.enableDisable')} />
{ checked={values.ticketExpirationEnable} /> } - label={'Ativar/Desativar'} + label={i18n.t('configModal.titles.enableDisable')} />
{ size={24} className={classes.buttonProgress} /> - ) : 'Salvar'} + ) : i18n.t('configModal.titles.save')} diff --git a/frontend/src/components/DashboardUser/CardUser.jsx b/frontend/src/components/DashboardUser/CardUser.jsx index eea89d1..bd595dd 100644 --- a/frontend/src/components/DashboardUser/CardUser.jsx +++ b/frontend/src/components/DashboardUser/CardUser.jsx @@ -23,6 +23,8 @@ import CheckCircleIcon from "@material-ui/icons/CheckCircle"; import ErrorIcon from "@material-ui/icons/Error"; import RemoveCircleIcon from "@material-ui/icons/RemoveCircle"; +import { i18n } from "../../translate/i18n"; + const CardUser = ({ classes, usersOnlineInfo, logout }) => { const [search, setSearch] = React.useState(""); @@ -46,14 +48,14 @@ const CardUser = ({ classes, usersOnlineInfo, logout }) => { color="primary" style={{ marginBottom: "16px" }} > - Lista de Usuários + {i18n.t('dashboard.titles.listUser')} { Todos Online Offline - Não entrou + {i18n.t('dashboard.titles.notEnter')} @@ -161,7 +163,7 @@ const CardUser = ({ classes, usersOnlineInfo, logout }) => { {user.sumOnlineTime && user.sumOnlineTime.sum ? user.sumOnlineTime.sum - : "Não entrou Hoje"} + : i18n.t('dashboard.titles.notEnterToday')} diff --git a/frontend/src/components/ModalUpdateScheduleReminder/DatePicker2/index.js b/frontend/src/components/ModalUpdateScheduleReminder/DatePicker2/index.js index a4e953e..0dd343c 100644 --- a/frontend/src/components/ModalUpdateScheduleReminder/DatePicker2/index.js +++ b/frontend/src/components/ModalUpdateScheduleReminder/DatePicker2/index.js @@ -13,7 +13,7 @@ import { import ptBrLocale from "date-fns/locale/pt-BR"; - +import esLocale from 'date-fns/locale/es'; function formatDateDatePicker(data){ return String(new Date(data).getFullYear())+'-'+ @@ -50,7 +50,7 @@ function ResponsiveDatePickers(props) { return ( - + { - + - + { const dataChat = props.data.map((dt) => { return { - 'fromMe': dt.fromMe ? 'Atendente' : 'Cliente', + 'fromMe': dt.fromMe ? i18n.t('dashboard.titles.attendant') : 'Cliente', 'body': dt.body, 'createdAt': dt.createdAt } diff --git a/frontend/src/components/ReportModal/index.js b/frontend/src/components/ReportModal/index.js index 35c8216..5ae5095 100644 --- a/frontend/src/components/ReportModal/index.js +++ b/frontend/src/components/ReportModal/index.js @@ -11,7 +11,8 @@ import FormControl from '@mui/material/FormControl'; import InputLabel from '@mui/material/InputLabel'; import MenuItem from '@mui/material/MenuItem'; import Select from '@mui/material/Select'; - + +import { i18n } from "../../translate/i18n"; @@ -56,11 +57,11 @@ useEffect(()=>{ open={open} onClose={handleClose} > - Relatórios + {i18n.t('dashboard.titles.dialogTitle')} - Escolha uma opção de relatório abaixo + {i18n.t('dashboard.titles.dialogContentText')} { fullWidth />
-
- {user.sumOnlineTime ? user.sumOnlineTime.sum : "Não entrou"} + {user.sumOnlineTime ? user.sumOnlineTime.sum : i18n.t('dashboard.titles.notEnter')} {user.statusOnline && user.statusOnline.status === "online" ? ( diff --git a/frontend/src/components/PositionModal/index.js b/frontend/src/components/PositionModal/index.js index d1b68b7..4489f8d 100644 --- a/frontend/src/components/PositionModal/index.js +++ b/frontend/src/components/PositionModal/index.js @@ -5,9 +5,6 @@ import { Formik, Form, Field } from "formik" import { toast } from "react-toastify" import openSocket from 'socket.io-client' -import { i18n } from "../../translate/i18n"; - - import { makeStyles, Button, diff --git a/frontend/src/translate/languages/en.js b/frontend/src/translate/languages/en.js index e5bc319..9f10bd6 100644 --- a/frontend/src/translate/languages/en.js +++ b/frontend/src/translate/languages/en.js @@ -348,7 +348,9 @@ const messages = { title0_1: "Reminders/Schedulings", title1_1: "Calls by attendants", title2_1: "Whatsapp chat", - title3_1: "Users online/offline" + title3_1: "Users online/offline", + title4_1: "Attendance report by numbers", + title5_1: "Queue service report" }, listColumns: { column0_1: 'Actions', diff --git a/frontend/src/translate/languages/es.js b/frontend/src/translate/languages/es.js index 5021cb0..6611563 100644 --- a/frontend/src/translate/languages/es.js +++ b/frontend/src/translate/languages/es.js @@ -52,15 +52,15 @@ const messages = { } }, - table_users:{ - - title: 'Lista de usuarios', - column0: 'Nombre', - column1: 'En servicio/Terminado(S)', - column2: 'Abrir por cola', - column3: 'Cerrado por cola', - column4: 'Tiempo Online', - column5: 'Actions', + table_users: { + + title: 'Lista de usuarios', + column0: 'Nombre', + column1: 'En servicio/Terminado(S)', + column2: 'Abrir por cola', + column3: 'Cerrado por cola', + column4: 'Tiempo Online', + column5: 'Actions', }, titles: { selectQueues: 'Colas', @@ -71,8 +71,8 @@ const messages = { attendant: 'Agente', dialogTitle: 'Reportes', dialogContentText: 'Escoja una opción de reporte abajo.', - transfer: 'Transferir para outras filas', - title: 'Entradas de cierre', + transfer: 'Transferir para otras Colas', + title: 'Cierre de Tickets', confirmationModal: 'Está seguro de que desea eliminar este estado de cierre: ', status: 'Status de cierre', listUser: 'Lista de Usuarios', @@ -356,10 +356,10 @@ const messages = { title1_1: "Atención por agentes", title2_1: "Chat de whatsapp", title3_1: "Usuarios online/offline", - title4_1: "Relatório de atendimento por números", - title5_1: "Relatório de atendimento por filas" + title4_1: "Reporte de atención por números", + title5_1: "Reporte de atención por colas" }, - listColumns:{ + listColumns: { column0_1: 'Acción', column0_2: 'Pic', column0_3: 'Nombre', @@ -370,7 +370,7 @@ const messages = { column0_8: 'Mensaje', column1_1: 'Almacenar', - column1_2: 'Secretario', + column1_2: 'Secretario', column1_5: 'Tema', column1_6: 'Status', column1_7: 'Creado', diff --git a/frontend/src/translate/languages/pt.js b/frontend/src/translate/languages/pt.js index b3d8cd3..8c1af2b 100644 --- a/frontend/src/translate/languages/pt.js +++ b/frontend/src/translate/languages/pt.js @@ -75,8 +75,8 @@ const messages = { status: 'Status de encerramento', listUser: 'Lista de Usuarios', user: 'Usuario', - notEnter: 'No ingresó', - notEnterToday: 'Não entrou' + notEnter: 'Não entrou', + notEnterToday: 'Não entrou hoje' } }, reportOptType: { From e8227661e075ec5161a1c7bcc56100986e8c055f Mon Sep 17 00:00:00 2001 From: adriano Date: Fri, 26 Jul 2024 16:08:18 -0500 Subject: [PATCH 6/6] fix(i18n): resolve translation issues --- frontend/src/pages/Dashboard/index.js | 2 +- frontend/src/translate/languages/en.js | 3 ++- frontend/src/translate/languages/es.js | 3 ++- frontend/src/translate/languages/pt.js | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/Dashboard/index.js b/frontend/src/pages/Dashboard/index.js index 99bbd0a..9337cc0 100644 --- a/frontend/src/pages/Dashboard/index.js +++ b/frontend/src/pages/Dashboard/index.js @@ -520,7 +520,7 @@ const Dashboard = () => { variant="outlined" > - Fechados + {i18n.t('dashboard.titles.ticketsClosed')} diff --git a/frontend/src/translate/languages/en.js b/frontend/src/translate/languages/en.js index 9f10bd6..1b28d36 100644 --- a/frontend/src/translate/languages/en.js +++ b/frontend/src/translate/languages/en.js @@ -75,7 +75,8 @@ const messages = { listUser: 'List user', user: 'user', notEnter: 'Did not enter', - notEnterToday: 'Did not enter today' + notEnterToday: 'Did not enter today', + ticketsClosed: 'Closed' } }, reportOptType: { diff --git a/frontend/src/translate/languages/es.js b/frontend/src/translate/languages/es.js index 6611563..b6a1d29 100644 --- a/frontend/src/translate/languages/es.js +++ b/frontend/src/translate/languages/es.js @@ -78,7 +78,8 @@ const messages = { listUser: 'Lista de Usuarios', user: 'Usuario', notEnter: 'No ingresó', - notEnterToday: 'No ingresó hoy' + notEnterToday: 'No ingresó hoy', + ticketsClosed: 'Cerrados' } }, reportOptType: { diff --git a/frontend/src/translate/languages/pt.js b/frontend/src/translate/languages/pt.js index 8c1af2b..01a2a19 100644 --- a/frontend/src/translate/languages/pt.js +++ b/frontend/src/translate/languages/pt.js @@ -76,7 +76,8 @@ const messages = { listUser: 'Lista de Usuarios', user: 'Usuario', notEnter: 'Não entrou', - notEnterToday: 'Não entrou hoje' + notEnterToday: 'Não entrou hoje', + ticketsClosed: 'Fechados' } }, reportOptType: {