adicionado timer para impedir o colaborador iniciar o atendimento antes do cliente chegar na sala.
This commit is contained in:
parent
7999fbdd56
commit
5705acbacc
|
|
@ -14,7 +14,7 @@
|
|||
<ul id="item-list">
|
||||
<!-- Itens serão carregados aqui -->
|
||||
</ul>
|
||||
<button id="next-button" disabled>Iniciar atendimento</button>
|
||||
<button id="next-button" disabled><span id="counter-start"></span> Iniciar atendimento</button>
|
||||
<!-- <button id="sendto-button" disabled>Encaminhar</button> -->
|
||||
<button id="logout-button">Trocar Colaborador</button>
|
||||
|
||||
|
|
|
|||
8
main.js
8
main.js
|
|
@ -53,9 +53,15 @@ async function fetchDataFromAPI() {
|
|||
//TODO propicio para fazer um webhook nessas funções que repetem a chamada de requisições em busca de alterações
|
||||
getAndUpdateDataStorage();
|
||||
|
||||
const timer = setInterval(()=>{
|
||||
const updData = setInterval(()=>{
|
||||
getAndUpdateDataStorage();
|
||||
},10000);
|
||||
|
||||
const updVersion = setTimeout(()=>{
|
||||
if(pjson.isBuildNow){
|
||||
autoUpdater.checkForUpdates();
|
||||
}
|
||||
},300000);
|
||||
}
|
||||
|
||||
// Função para coletar a lista de atendimentos do servidor, vai ser chamada uma vez e a cada 30s
|
||||
|
|
|
|||
19
renderer.js
19
renderer.js
|
|
@ -10,6 +10,7 @@ const saveButton = document.getElementById('save-button');
|
|||
const selectedItemNameSpan = document.getElementById('selected-item-name');
|
||||
const queueNumber = document.getElementById('queue-number');
|
||||
const idAtend = document.getElementById('idAtend');
|
||||
const counterStart = document.getElementById('counter-start');
|
||||
|
||||
let currentData = [];
|
||||
let selectedItemId = null;
|
||||
|
|
@ -50,9 +51,19 @@ function populateList(currentData) {
|
|||
const proximos = JSON.parse(datastorage);
|
||||
|
||||
itemList.innerHTML = ''; // Limpa a lista anterior
|
||||
if (!proximos || proximos.length === 0 || !currentData) {
|
||||
if (!proximos || proximos.length === 0) {
|
||||
var count = 15;
|
||||
itemList.innerHTML = '<li>Fila vazia!</li>';
|
||||
nextButton.disabled = !currentData;
|
||||
nextButton.disabled = true;
|
||||
const dec_counter = setInterval(() => {
|
||||
count = count -1;
|
||||
counterStart.innerHTML = `[ ${count} ]`;
|
||||
if (count <= 0 && currentData) {
|
||||
counterStart.innerHTML = '';
|
||||
nextButton.disabled = false;
|
||||
clearInterval(dec_counter);
|
||||
}
|
||||
},1000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +71,7 @@ function populateList(currentData) {
|
|||
// Aqui, vamos apenas pegar o primeiro da lista atual
|
||||
const itemToProcess = proximos[0]; // Pega o primeiro item
|
||||
if (itemToProcess) {
|
||||
|
||||
selectedItemId = itemToProcess.id;
|
||||
selectedItemName = itemToProcess.clientName;
|
||||
const li = document.createElement('li');
|
||||
|
|
@ -67,7 +79,8 @@ function populateList(currentData) {
|
|||
li.dataset.id = itemToProcess.id; // Armazena o ID no elemento
|
||||
li.classList.add('selected'); // Marca como selecionado visualmente (precisa de CSS)
|
||||
itemList.appendChild(li);
|
||||
nextButton.disabled = false;
|
||||
|
||||
|
||||
} else {
|
||||
itemList.innerHTML = '<li>Fila vazia!</li>';
|
||||
nextButton.disabled = !currentData;
|
||||
|
|
|
|||
Loading…
Reference in New Issue