feat: enforce file attachment for evidence in URA form submission

feat_faro
adriano 2024-06-25 09:35:28 -03:00
parent 6762c8041d
commit e44efb45d9
2 changed files with 25 additions and 27 deletions

View File

@ -278,7 +278,7 @@ const question = async (
) {
await botSendMessage(
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;
}
@ -327,22 +327,9 @@ const question = async (
}
}
// currentId = await get({ key: `form:${ticket.id}:current` });
let index = ask.findIndex((obj: any) => obj.id == currentId);
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) {
ask[index].value = msg?.body;
}
@ -352,18 +339,22 @@ const question = async (
if (index + 1 <= ask.length - 1) {
if (ask[index + 1]?.item?.file && !sendFile) {
await botSendMessage(
ticket,
"¿Quieres enviar archivo? Ingrese *Sí* o *No*"
);
// await botSendMessage(
// ticket,
// "¿Quieres enviar archivo? Ingrese *Sí* o *No*"
// );
await set(
`form:${ticket.id}:file`,
JSON.stringify({ status: "waiting" })
);
return;
set(
`form:${ticket.id}:file`,
JSON.stringify({ ...sendFile, status: "yes" })
);
// return;
}
// Next question
await botSendMessage(ticket, ask[index + 1].question);
await set(`form:${ticket.id}:current`, `${ask[index + 1].id}`);
} else {
@ -2205,6 +2196,13 @@ async function setSoport(ticket: any, wbot: any, contact: any) {
})
.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 files = "";
@ -2251,7 +2249,7 @@ async function setSoport(ticket: any, wbot: any, contact: any) {
</soapenv:Body>
</soapenv:Envelope>`;
// console.log("DATA: ", data);
console.log("DATA REQUEST: ", data);
// return;
var config = {

View File

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