correções para o modulo colabs, estava bugando a fila de atendimento
This commit is contained in:
parent
97fa71f231
commit
75d795bd92
17
main.js
17
main.js
|
|
@ -68,7 +68,7 @@ async function fetchDataFromAPI() {
|
||||||
// Função para coletar a lista de atendimentos do servidor, vai ser chamada uma vez e a cada 30s
|
// Função para coletar a lista de atendimentos do servidor, vai ser chamada uma vez e a cada 30s
|
||||||
async function getDataAndUpdateFloatingBtn (){
|
async function getDataAndUpdateFloatingBtn (){
|
||||||
|
|
||||||
const proximos = JSON.parse(await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')"));
|
const proximos = JSON.parse(await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')")) ?? [];
|
||||||
let count = proximos.length;
|
let count = proximos.length;
|
||||||
|
|
||||||
//lista a contagem no botão flutuante
|
//lista a contagem no botão flutuante
|
||||||
|
|
@ -412,7 +412,7 @@ ipcMain.handle('get-count', async () => {
|
||||||
ipcMain.on('chamar-fila', async () => {
|
ipcMain.on('chamar-fila', async () => {
|
||||||
|
|
||||||
const countFila = async () => {
|
const countFila = async () => {
|
||||||
const proximos = JSON.parse(await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')"));
|
const proximos = JSON.parse(await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')")) ?? [];
|
||||||
return proximos.length;
|
return proximos.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -457,14 +457,15 @@ ipcMain.on('chamar-fila', async () => {
|
||||||
response.on('end', () => {
|
response.on('end', () => {
|
||||||
try {
|
try {
|
||||||
const parsedData = JSON.parse(rawData);
|
const parsedData = JSON.parse(rawData);
|
||||||
|
console.log(parsedData);
|
||||||
|
|
||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
mainWin.webContents.send('select-atend-id', parsedData.data);
|
mainWin.webContents.send('select-atend-id', parsedData.data);
|
||||||
if(parsedData.data.Status === 'Atendendo'){
|
if(parsedData.data && parsedData.data.Status === 'Atendendo'){
|
||||||
let options2 = {
|
let options2 = {
|
||||||
'title': 'Precisa finalizar antes de chamar o próximo.',
|
'title': 'Precisa finalizar antes de chamar o próximo.',
|
||||||
'message': 'Em andamento',
|
'message': 'Em andamento',
|
||||||
'detail': 'Já possui um atendimento em andamento (Chamado/Atendendo), continue e finalize por favor!',
|
'detail': 'Já possui um atendimento em andamento (Atendendo: '+ parsedData.data.clientName +'), continue e finalize por favor!',
|
||||||
'type': 'error',
|
'type': 'error',
|
||||||
'noLink': true,
|
'noLink': true,
|
||||||
'buttons': ['Depois','Continuar'],
|
'buttons': ['Depois','Continuar'],
|
||||||
|
|
@ -472,6 +473,8 @@ ipcMain.on('chamar-fila', async () => {
|
||||||
dialog.showMessageBox(floatingWin, options2).then(result => {
|
dialog.showMessageBox(floatingWin, options2).then(result => {
|
||||||
if(result.response){
|
if(result.response){
|
||||||
mainWin.webContents.send('show-observation');
|
mainWin.webContents.send('show-observation');
|
||||||
|
} else {
|
||||||
|
mainWin.hide();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -513,15 +516,13 @@ ipcMain.on('chamar-fila', async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if(await countFila() > 0){
|
if(await countFila()){
|
||||||
dialog.showMessageBox(floatingWin, options).then(result => {
|
dialog.showMessageBox(floatingWin, options).then(result => {
|
||||||
if(result.response){
|
if(result.response){
|
||||||
requestData();
|
requestData();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
requestData();
|
requestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "autoatendcolab",
|
"name": "autoatendcolab",
|
||||||
"version": "1.0.8",
|
"version": "1.0.9",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"isBuildNow": true,
|
"isBuildNow": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
15
renderer.js
15
renderer.js
|
|
@ -80,6 +80,7 @@ window.electronAPI.selectAtendID((data)=>{
|
||||||
if(!data){
|
if(!data){
|
||||||
queueNumber.innerHTML = 'Ninguem aguardando atendimento, fechando a janela em alguns segundos...';
|
queueNumber.innerHTML = 'Ninguem aguardando atendimento, fechando a janela em alguns segundos...';
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
localStorage.removeItem('proximos');
|
||||||
window.close();
|
window.close();
|
||||||
},5000);
|
},5000);
|
||||||
return;
|
return;
|
||||||
|
|
@ -104,19 +105,7 @@ function populateList(currentData) {
|
||||||
|
|
||||||
// Adiciona os outros itens apenas para visualização (opcional)
|
// Adiciona os outros itens apenas para visualização (opcional)
|
||||||
const proximos = JSON.parse(datastorage);
|
const proximos = JSON.parse(datastorage);
|
||||||
// var count = 6;
|
itemList.innerHTML = '';
|
||||||
|
|
||||||
// itemList.innerHTML = ''; // Limpa a lista anterior
|
|
||||||
|
|
||||||
// const dec_counter = setInterval(() => {
|
|
||||||
// --count;
|
|
||||||
// counterStart.innerHTML = `[ ${count} ]`;
|
|
||||||
// if (count <= 0) {
|
|
||||||
// counterStart.innerHTML = '';
|
|
||||||
// nextButton.disabled = !currentData;
|
|
||||||
// clearInterval(dec_counter);
|
|
||||||
// }
|
|
||||||
// },1000);
|
|
||||||
|
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
nextButton.disabled = !currentData;
|
nextButton.disabled = !currentData;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue