|
|
@ -27,6 +27,17 @@ $(function () { |
|
|
|
filaNotifications(); |
|
|
|
filaNotifications(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#recuperaratendimento").on("click", () => { |
|
|
|
|
|
|
|
recuperarAtendimento( |
|
|
|
|
|
|
|
localStorage.getItem("session_uniqueid"), |
|
|
|
|
|
|
|
localStorage.getItem("my_uniqueid") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#btnAtendimento").on("click", () => { |
|
|
|
$("#btnAtendimento").on("click", () => { |
|
|
|
notifications(); |
|
|
|
notifications(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -37,6 +48,13 @@ $(function () { |
|
|
|
// removeMensagemBody();
|
|
|
|
// removeMensagemBody();
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#uploadimage").on("change", function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startSendImage(this.files); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** FIM VOICE RECORDER */ |
|
|
|
/** FIM VOICE RECORDER */ |
|
|
|
/** EVENTOS DE CLICK NO BODY */ |
|
|
|
/** EVENTOS DE CLICK NO BODY */ |
|
|
|
$("body").mouseup(function () { |
|
|
|
$("body").mouseup(function () { |
|
|
@ -47,7 +65,7 @@ $(function () { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** INICIO DAS FUNCIONALIDADES */ |
|
|
|
/** INICIO DAS FUNCIONALIDADES */ |
|
|
|
startSendImage(); |
|
|
|
// startSendImage();
|
|
|
|
startSendFile(); |
|
|
|
startSendFile(); |
|
|
|
startPause(); |
|
|
|
startPause(); |
|
|
|
startTransfer(); |
|
|
|
startTransfer(); |
|
|
@ -55,6 +73,38 @@ $(function () { |
|
|
|
exitSystem(); |
|
|
|
exitSystem(); |
|
|
|
startFooter(); |
|
|
|
startFooter(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* HABILITA O ENVIO DE MIDIAS CTRL+V |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
$(document).on('keydown', function(e) { |
|
|
|
|
|
|
|
if (e.ctrlKey || e.metaKey) { |
|
|
|
|
|
|
|
if (e.keyCode == 86) { // 86 é o código da tecla "V"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(+localStorage.getItem('session_status') === 0) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).one('paste', function(event) { |
|
|
|
|
|
|
|
// Verifica se o que foi colado é uma imagem
|
|
|
|
|
|
|
|
if (event.originalEvent.clipboardData.items && event.originalEvent.clipboardData.items.length) { |
|
|
|
|
|
|
|
// Percorre todos os itens colados
|
|
|
|
|
|
|
|
for (let i = 0; i < event.originalEvent.clipboardData.items.length; i++) { |
|
|
|
|
|
|
|
// Verifica se o item atual é uma imagem
|
|
|
|
|
|
|
|
if (event.originalEvent.clipboardData.items[i].type.indexOf("image") !== -1) { |
|
|
|
|
|
|
|
// Cria um objeto File a partir da imagem colada
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let imageFile = event.originalEvent.clipboardData.items[i].getAsFile(); |
|
|
|
|
|
|
|
startSendImagePrintScreen(imageFile) |
|
|
|
|
|
|
|
mediaPrint = imageFile; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** INICIA COM O HEADER DO CONTATO VAZIO */ |
|
|
|
/** INICIA COM O HEADER DO CONTATO VAZIO */ |
|
|
|
startChannelMessage(); |
|
|
|
startChannelMessage(); |
|
|
|
/** INICIA O CHAT NO FINAL DA CONVERSA */ |
|
|
|
/** INICIA O CHAT NO FINAL DA CONVERSA */ |
|
|
@ -111,7 +161,9 @@ $(function () { |
|
|
|
* EVENTOS DE CLICK PARA SELECIONAR A SESSAO DE MENSAGEM/CONVERSA E RECUPERAR AS MENSAGENS JA TROCADAS NO ATENDIMENTO |
|
|
|
* EVENTOS DE CLICK PARA SELECIONAR A SESSAO DE MENSAGEM/CONVERSA E RECUPERAR AS MENSAGENS JA TROCADAS NO ATENDIMENTO |
|
|
|
* @param {*} id |
|
|
|
* @param {*} id |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const selectNotification = (id) => { |
|
|
|
const selectNotification = (id, status, datetime) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
marcarMensagemVista(id); |
|
|
|
marcarMensagemVista(id); |
|
|
|
listaMensagem(id).then(async () => { |
|
|
|
listaMensagem(id).then(async () => { |
|
|
|
let uniqueid; |
|
|
|
let uniqueid; |
|
|
@ -135,12 +187,14 @@ const selectNotification = (id) => { |
|
|
|
); |
|
|
|
); |
|
|
|
if (e.uniqueid == id && e.status == 0) { |
|
|
|
if (e.uniqueid == id && e.status == 0) { |
|
|
|
hideButtons(true); |
|
|
|
hideButtons(true); |
|
|
|
|
|
|
|
monitoraStatusTransferenciaAtendimento(datetime); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
$("#" + id.replace(".", `\\.`)).addClass("select-notification"); |
|
|
|
$("#" + id.replace(".", `\\.`)).addClass("select-notification"); |
|
|
|
allNotifications.data.forEach((e) => { |
|
|
|
allNotifications.data.forEach((e) => { |
|
|
|
if (e.uniqueid == id && e.status == 0) { |
|
|
|
if (e.uniqueid == id && e.status == 0) { |
|
|
|
hideButtons(true); |
|
|
|
hideButtons(true); |
|
|
|
|
|
|
|
monitoraStatusTransferenciaAtendimento(datetime); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (dataRequest.data.length > 0) { |
|
|
|
if (dataRequest.data.length > 0) { |
|
|
@ -160,8 +214,10 @@ const selectNotification = (id) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
localStorage.removeItem("session_window"); |
|
|
|
localStorage.removeItem("session_window"); |
|
|
|
localStorage.removeItem("session_uniqueid"); |
|
|
|
localStorage.removeItem("session_uniqueid"); |
|
|
|
|
|
|
|
localStorage.removeItem("session_status"); |
|
|
|
localStorage.setItem("session_uniqueid", uniqueid); |
|
|
|
localStorage.setItem("session_uniqueid", uniqueid); |
|
|
|
localStorage.setItem("session_window", number); |
|
|
|
localStorage.setItem("session_window", number); |
|
|
|
|
|
|
|
localStorage.setItem("session_status", status); |
|
|
|
$(".chat-window-contact-name").text(name); |
|
|
|
$(".chat-window-contact-name").text(name); |
|
|
|
|
|
|
|
|
|
|
|
$(".chat-window-contact-status").text("Protocolo: " + protocolo); |
|
|
|
$(".chat-window-contact-status").text("Protocolo: " + protocolo); |
|
|
@ -169,6 +225,7 @@ const selectNotification = (id) => { |
|
|
|
$(".chat-window .sender").remove(); |
|
|
|
$(".chat-window .sender").remove(); |
|
|
|
$(".chat-window .receiver").remove(); |
|
|
|
$(".chat-window .receiver").remove(); |
|
|
|
$(".chat-window .events").remove(); |
|
|
|
$(".chat-window .events").remove(); |
|
|
|
|
|
|
|
|
|
|
|
alertNotification(localStorage.getItem("session_uniqueid"), "remove"); |
|
|
|
alertNotification(localStorage.getItem("session_uniqueid"), "remove"); |
|
|
|
|
|
|
|
|
|
|
|
if (typeof dataContact === "undefined") return; |
|
|
|
if (typeof dataContact === "undefined") return; |
|
|
@ -257,11 +314,14 @@ const selectNotification = (id) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
scrollDown(); |
|
|
|
scrollDown(); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
abrirMensagem = true; |
|
|
|
abrirMensagem = true; |
|
|
|
|
|
|
|
|
|
|
|
startNotification(); |
|
|
|
startNotification(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* REALIZA O ENVIO DE MENSAGEM ATRAVEZ DA API |
|
|
|
* REALIZA O ENVIO DE MENSAGEM ATRAVEZ DA API |
|
|
@ -469,8 +529,10 @@ const keepMensage = (ev) => { |
|
|
|
* FUNCAO PARA CAPTURAR O ARQUIVO A SER ENVIADO |
|
|
|
* FUNCAO PARA CAPTURAR O ARQUIVO A SER ENVIADO |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const sendMedia = (media = null) => { |
|
|
|
const sendMedia = (media = null) => { |
|
|
|
|
|
|
|
|
|
|
|
let rec; |
|
|
|
let rec; |
|
|
|
let filename; |
|
|
|
let filename; |
|
|
|
|
|
|
|
|
|
|
|
if ($("#footer-content-left audio").length) { |
|
|
|
if ($("#footer-content-left audio").length) { |
|
|
|
if (media.state == "recording") { |
|
|
|
if (media.state == "recording") { |
|
|
|
media.stop(); |
|
|
|
media.stop(); |
|
|
@ -495,7 +557,13 @@ const sendMedia = (media = null) => { |
|
|
|
)}" target="_blank">${imgContent}</a>`; |
|
|
|
)}" target="_blank">${imgContent}</a>`; |
|
|
|
filename = el.name; |
|
|
|
filename = el.name; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rec = mediaPrint; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($("#uploadimage")[0].files[0]){ |
|
|
|
rec = $("#uploadimage")[0].files[0]; |
|
|
|
rec = $("#uploadimage")[0].files[0]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let filesent = $("#myImg"); |
|
|
|
let filesent = $("#myImg"); |
|
|
|
filesent[0].id = Date.now(); |
|
|
|
filesent[0].id = Date.now(); |
|
|
|
fileContent = filesent.css({ "max-width": "200px" })[0].outerHTML; |
|
|
|
fileContent = filesent.css({ "max-width": "200px" })[0].outerHTML; |
|
|
@ -516,4 +584,6 @@ const sendMedia = (media = null) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
file.readAsDataURL(rec); |
|
|
|
file.readAsDataURL(rec); |
|
|
|
|
|
|
|
$("#uploadimage").val(""); |
|
|
|
|
|
|
|
$('#fieldsendmessage').focus(); |
|
|
|
}; |
|
|
|
}; |
|
|
|