Compare commits

..

4 Commits

Author SHA1 Message Date
gustavo-gsp 9b6e48f54e feat: add notification for tickets in waiting status
Details:
- Implemented notification functionality for tickets that are in waiting status.
2024-03-20 14:33:36 -03:00
gustavo-gsp 82863f9d0e Merge branch 'el_lojas_melhorias' of github.com:AdrianoRobson/projeto-hit into el_lojas_melhorias 2024-03-20 14:17:25 -03:00
gustavo-gsp 18d0420949 error correction in notifications for already opened tickets 2024-03-20 14:08:35 -03:00
adriano 1894fd35ab feat: modify reports page
Details:
- Added a new hidden column called "messages" to the tickets table.
- Implemented search functionality based on ticket messages.
2024-03-20 11:33:30 -03:00
3 changed files with 37 additions and 28 deletions

View File

@ -529,6 +529,7 @@ const transferTicket = async (
sendGreetingMessage?: boolean sendGreetingMessage?: boolean
) => { ) => {
const botInfo = await BotIsOnQueue("botqueue"); const botInfo = await BotIsOnQueue("botqueue");
const io = getIO();
const queuesWhatsGreetingMessage = await queuesOutBot( const queuesWhatsGreetingMessage = await queuesOutBot(
wbot, wbot,
@ -548,6 +549,7 @@ const transferTicket = async (
} }
if (queue) await botTransferTicket(queue, ticket, sendGreetingMessage); if (queue) await botTransferTicket(queue, ticket, sendGreetingMessage);
io.emit('notifyPeding', {data: {ticket, queue}});
}; };
const botTransferTicket = async ( const botTransferTicket = async (

View File

@ -261,15 +261,14 @@ const NotificationsPopOver = () => {
}) })
}else{ }else{
user.queues.forEach(queue =>{ user.queues.forEach(queue =>{
if(queue.id === notify.data.queue?.id){ if(queue.id === notify.data?.queue?.id){
isQueue = true; isQueue = true;
} }
}) })
} if(!isQueue){
if(!isQueue && notify){
return; return;
}else { }else {
const notification = new Notification(`${i18n.t("tickets.notification.messagePeding")} ${notify.data.queue?.name}`); const notification = new Notification(`${i18n.t("tickets.notification.messagePeding")} ${notify.data?.queue?.name}`);
notification.onclick = e => { notification.onclick = e => {
e.preventDefault() e.preventDefault()
window.focus() window.focus()
@ -287,6 +286,7 @@ const NotificationsPopOver = () => {
return [notification, ...prevState] return [notification, ...prevState]
}) })
} }
}
soundAlertRef.current() soundAlertRef.current()
} }

View File

@ -235,7 +235,9 @@ let columnsData = [
{ title: `${i18n.t("reports.listColumns.column1_7")}`, field: 'createdAt' }, { title: `${i18n.t("reports.listColumns.column1_7")}`, field: 'createdAt' },
{ title: `${i18n.t("reports.listColumns.column1_8")}`, field: 'updatedAt' }, { title: `${i18n.t("reports.listColumns.column1_8")}`, field: 'updatedAt' },
{ title: `${i18n.t("reports.listColumns.column1_9")}`, field: 'statusChatEnd' }] { title: `${i18n.t("reports.listColumns.column1_9")}`, field: 'statusChatEnd' },
{ title: `Mensagens`, field: 'messagesToFilter', searchable: true, hidden: true },
]
let columnsDataSuper = [ let columnsDataSuper = [
{ title: `${i18n.t("reports.listColumns.column1_1")}`, field: 'whatsapp.name' }, { title: `${i18n.t("reports.listColumns.column1_1")}`, field: 'whatsapp.name' },
@ -247,7 +249,8 @@ let columnsDataSuper = [
{ title: `${i18n.t("reports.listColumns.column1_7")}`, field: 'createdAt' }, { title: `${i18n.t("reports.listColumns.column1_7")}`, field: 'createdAt' },
{ title: `${i18n.t("reports.listColumns.column1_8")}`, field: 'updatedAt' }, { title: `${i18n.t("reports.listColumns.column1_8")}`, field: 'updatedAt' },
{ title: `${i18n.t("reports.listColumns.column1_9")}`, field: 'statusChatEnd' } { title: `${i18n.t("reports.listColumns.column1_9")}`, field: 'statusChatEnd' },
{ title: `Mensagens`, field: 'messagesToFilter', searchable: true, hidden: true },
] ]
@ -369,8 +372,12 @@ const Report = () => {
filterQueuesTickets = ticketsQueue.filter(ticket => ticket?.queue?.name === userQueues[0]?.name) filterQueuesTickets = ticketsQueue.filter(ticket => ticket?.queue?.name === userQueues[0]?.name)
} }
data.tickets = filterQueuesTickets data.tickets = filterQueuesTickets
dispatchQ({ type: "LOAD_QUERY", payload: data.tickets }) const tickets = data.tickets.map(ticket => ({
...ticket,
messagesToFilter: ticket.messages.map(message => message.body).join(' '),
}));
dispatchQ({ type: "LOAD_QUERY", payload: tickets })
console.log(tickets);
setHasMore(data.hasMore) setHasMore(data.hasMore)
setTotalCountTickets(data.count) setTotalCountTickets(data.count)
setLoading(false) setLoading(false)