Merge branch 'feat_faro' of github.com:AdrianoRobson/projeto-hit into feat_faro

feat_faro
adriano 2024-06-25 08:01:52 -05:00
commit 6450fb6ea7
2 changed files with 24 additions and 26 deletions

View File

@ -278,7 +278,7 @@ const question = async (
) { ) {
await botSendMessage( await botSendMessage(
ticket, ticket,
"¡Envía uno o más archivos simultáneamente!" "Por favor adjuntar evidencias.\n¡Envía uno o más archivos simultáneamente!"
); );
return; return;
} }
@ -327,22 +327,9 @@ const question = async (
} }
} }
// currentId = await get({ key: `form:${ticket.id}:current` });
let index = ask.findIndex((obj: any) => obj.id == currentId); let index = ask.findIndex((obj: any) => obj.id == currentId);
if (index != -1) { if (index != -1) {
console.log(
"msg?.body: ",
msg?.body,
" | sendFile?.filePath: ",
sendFile?.filePath,
" | index: ",
index,
" | ask[index]?.item?.file: ",
ask[index]?.item?.file
);
if (!ask[index]?.item?.file && !sendFile) { if (!ask[index]?.item?.file && !sendFile) {
ask[index].value = msg?.body; ask[index].value = msg?.body;
} }
@ -352,18 +339,22 @@ const question = async (
if (index + 1 <= ask.length - 1) { if (index + 1 <= ask.length - 1) {
if (ask[index + 1]?.item?.file && !sendFile) { if (ask[index + 1]?.item?.file && !sendFile) {
await botSendMessage( // await botSendMessage(
ticket, // ticket,
"¿Quieres enviar archivo? Ingrese *Sí* o *No*" // "¿Quieres enviar archivo? Ingrese *Sí* o *No*"
); // );
await set( await set(
`form:${ticket.id}:file`, `form:${ticket.id}:file`,
JSON.stringify({ status: "waiting" }) JSON.stringify({ status: "waiting" })
); );
return; set(
`form:${ticket.id}:file`,
JSON.stringify({ ...sendFile, status: "yes" })
);
// return;
} }
// Next question // Next question
await botSendMessage(ticket, ask[index + 1].question); await botSendMessage(ticket, ask[index + 1].question);
await set(`form:${ticket.id}:current`, `${ask[index + 1].id}`); await set(`form:${ticket.id}:current`, `${ask[index + 1].id}`);
} else { } else {
@ -1222,7 +1213,7 @@ const handleMessage = async (
return; return;
} }
} }
// //
if ( if (
@ -1390,7 +1381,7 @@ const handleMessage = async (
msg?.body?.trim() != "0" && msg?.body?.trim() != "0" &&
msg?.body?.trim() != "#" msg?.body?.trim() != "#"
) { ) {
await question(fillingOutForm, msg, ticket, contact, wbot); await question(fillingOutForm, msg, ticket, contact, wbot);
return; return;
} }
@ -1614,7 +1605,7 @@ const menu = async (userTyped: string, whatsappId: any, contactId: any, ticket:
const data: any = await get({ const data: any = await get({
key: whatsapp?.number ? `ura_${whatsapp?.number}` : "ura", key: whatsapp?.number ? `ura_${whatsapp?.number}` : "ura",
parse: true parse: true
}); });
if (!lastId[0]) { if (!lastId[0]) {
await createObject({ await createObject({
@ -1982,7 +1973,7 @@ async function backUra(whatsappId: any, contactId: any, data: any) {
let uraOptionSelected = await findObject( let uraOptionSelected = await findObject(
whatsappId, whatsappId,
contactId, contactId,
_whatsapp?.number ? `ura_${_whatsapp?.number}` : "ura" _whatsapp?.number ? `ura_${_whatsapp?.number}` : "ura"
); );
@ -2223,6 +2214,13 @@ async function setSoport(ticket: any, wbot: any, contact: any) {
}) })
.join(""); .join("");
let request = await get({
key: `form:${ticket.id}:request`,
parse: true
});
payload += `<nit_transp>${request.nit}</nit_transp>`;
let payloadFile = fillingOutForm.ask.find((a: any) => a?.item?.file); let payloadFile = fillingOutForm.ask.find((a: any) => a?.item?.file);
let files = ""; let files = "";
@ -2269,7 +2267,7 @@ async function setSoport(ticket: any, wbot: any, contact: any) {
</soapenv:Body> </soapenv:Body>
</soapenv:Envelope>`; </soapenv:Envelope>`;
// console.log("DATA: ", data); console.log("DATA REQUEST: ", data);
// return; // return;
var config = { var config = {

View File

@ -229,7 +229,7 @@ const TicketListItem = ({ ticket, remoteTicketsControll, settings }) => {
variant="body2" variant="body2"
color="textPrimary" color="textPrimary"
> >
{ticket.contact.name} {ticket?.contact?.name}
</Typography> </Typography>
{ticket.status === "closed" && ( {ticket.status === "closed" && (
<Badge <Badge