Compare commits
14 Commits
main
...
nest-integ
| Author | SHA1 | Date |
|---|---|---|
|
|
6ff0b11d61 | |
|
|
7db4b2a37d | |
|
|
6591c074b6 | |
|
|
8403281a6d | |
|
|
8e53b7ccbd | |
|
|
b6d9fd3d26 | |
|
|
9f224068b8 | |
|
|
c9c28e68c7 | |
|
|
d12f38fbaf | |
|
|
99b34b2871 | |
|
|
624b6a7268 | |
|
|
96ac1510ae | |
|
|
e54015cfba | |
|
|
636a7a7f62 |
119
index.html
119
index.html
|
|
@ -1,51 +1,108 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="pt-br">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="Content-Security-Policy" content="
|
||||
default-src 'self';
|
||||
script-src 'self' 'unsafe-inline';
|
||||
style-src 'self' 'unsafe-inline';
|
||||
connect-src 'self' ws://autoatend.linco.work:6001 ws://localhost:6001 wss://aa.linco.work:443;
|
||||
">
|
||||
<title>Tela de Atendimento</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Painel do Operador</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="res/js/jquery/jquery.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="list-view">
|
||||
<h1>Fila</h1>
|
||||
<h3><span id="queue-number"></span></h3>
|
||||
<ul id="item-list">
|
||||
<!-- Itens serão carregados aqui -->
|
||||
</ul>
|
||||
<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>
|
||||
<div class="main-container">
|
||||
<!-- Sidebar/Lista de Espera -->
|
||||
<div class="queue-sidebar">
|
||||
<div class="sidebar-header">
|
||||
<h2>Fila de Espera</h2>
|
||||
<span id="queue-count" class="badge">0</span>
|
||||
</div>
|
||||
<div class="queue-list-container">
|
||||
<table class="queue-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Senha</th>
|
||||
<th>Cliente</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="queue-table-body">
|
||||
<!-- Filas serão inseridas aqui -->
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="queue-empty" class="empty-state">
|
||||
Ninguém na fila
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Área Principal / Chamada -->
|
||||
<div class="call-area">
|
||||
<div id="no-current" class="no-current-card">
|
||||
<div class="pulse-icon">🔔</div>
|
||||
<h2>Aguardando Chamada</h2>
|
||||
<p>Clique no botão abaixo para chamar o próximo cliente</p>
|
||||
<button id="call-next-btn" class="btn-primary">CHAMAR PRÓXIMO</button>
|
||||
</div>
|
||||
|
||||
<div id="current-card" class="current-card" style="display: none;">
|
||||
<div class="card-header">
|
||||
<span id="card-status-badge" class="status-badge">CHAMADO</span>
|
||||
<h1 id="card-ticket">---</h1>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p id="card-client-name" class="card-client-name">---</p>
|
||||
<p id="card-service" class="card-service">---</p>
|
||||
<p id="card-type" class="card-type"></p>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<button id="recall-button" class="btn-recall" disabled>RECHAMAR</button>
|
||||
<button id="forward-button" class="btn-forward" disabled>ENCAMINHAR</button>
|
||||
<button id="next-button" class="btn-start" disabled>
|
||||
<span id="counter-start"></span>
|
||||
INICIAR
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bottom-bar">
|
||||
<button id="logout-button" class="btn-logout">Trocar Colaborador</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TELA DE OBSERVAÇÕES (atendimento em andamento) -->
|
||||
<div id="obs-view" style="display: none;">
|
||||
<h1>Observações</h1>
|
||||
<p>Atendendo: <span id="selected-item-name"></span></p>
|
||||
<input type="hidden" name="idAtend" id="idAtend">
|
||||
<textarea id="observation-text" rows="10" cols="50" placeholder="Digite suas observações..."></textarea>
|
||||
<button id="save-button">Finalizar atendimento</button>
|
||||
<div class="obs-layout">
|
||||
<div class="obs-header">
|
||||
<h2>Atendimento em Andamento</h2>
|
||||
<div class="obs-client-info">
|
||||
<span id="selected-item-name" class="obs-client-name"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="idAtend" id="idAtend">
|
||||
<textarea id="observation-text" rows="10" placeholder="Digite suas observações sobre o atendimento..."></textarea>
|
||||
<div class="obs-actions">
|
||||
<button id="save-button" class="btn-finish">Finalizar atendimento</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="encaminhar-view" style="display: none;">
|
||||
<h1>Observações</h1>
|
||||
<p>Atendendo: <span id="selected-item-name"></span></p>
|
||||
<textarea id="enc-observation-text" rows="10" cols="50" placeholder="Digite suas observações..."></textarea>
|
||||
<button id="save-button">Salvar</button>
|
||||
<!-- MODAL DE ENCAMINHAMENTO -->
|
||||
<div id="forward-view" class="modal-view" style="display: none;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>Encaminhar</h2>
|
||||
<button id="close-forward" class="btn-close">×</button>
|
||||
</div>
|
||||
<p style="color: #aaa; font-size: 14px; margin-bottom: 10px;">Selecione para quem encaminhar <span id="forward-ticket" class="highlight"></span>:</p>
|
||||
<div id="operators-list" class="operators-grid">
|
||||
<!-- Operadores serão carregados aqui -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="res/js/pusher.min.js"></script>
|
||||
<script src="res/js/socket.io.min.js"></script>
|
||||
<script src="renderer.js"></script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@
|
|||
//o campo username deve ser formatado como cpf ou cnpj
|
||||
function formatarCampoCPFCNPJ() {
|
||||
var campo = document.getElementById('username');
|
||||
var valor = campo.value.replace(/\D/g, ''); // Remove todos os caracteres não numéricos
|
||||
var valor = campo.value.replace(/[^a-zA-Z0-9]/g, ''); // Remove apenas o que não for alfanumérico
|
||||
|
||||
if (valor.length <= 11) {
|
||||
// Formata como CPF
|
||||
valor = valor.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4');
|
||||
valor = valor.replace(/([a-zA-Z0-9]{3})([a-zA-Z0-9]{3})([a-zA-Z0-9]{3})([a-zA-Z0-9]{2})/, '$1.$2.$3-$4');
|
||||
} else {
|
||||
// Formata como CNPJ
|
||||
valor = valor.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, '$1.$2.$3/$4-$5');
|
||||
valor = valor.replace(/([a-zA-Z0-9]{2})([a-zA-Z0-9]{3})([a-zA-Z0-9]{3})([a-zA-Z0-9]{4})([a-zA-Z0-9]{2})/, '$1.$2.$3/$4-$5');
|
||||
}
|
||||
campo.value = valor;
|
||||
}
|
||||
|
|
|
|||
4
login.js
4
login.js
|
|
@ -16,8 +16,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
loginForm.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const login = document.getElementById('username').value;
|
||||
const password = document.getElementById('password').value;
|
||||
const login = document.getElementById('username').value.replace(/[./-]/g, '');
|
||||
const password = document.getElementById('password').value.replace(/[./-]/g, '');
|
||||
|
||||
// Limpa mensagens de erro anteriores
|
||||
errorMessage.textContent = '';
|
||||
|
|
|
|||
527
main.js
527
main.js
|
|
@ -13,19 +13,63 @@ let operatorWin;
|
|||
let updateWin;
|
||||
|
||||
const dataPath = path.join(__dirname, 'data.json'); // Caminho para o JSON (backup local)
|
||||
const apiUrl = 'https://autoatend.linco.work/api/v1/';
|
||||
// const apiUrl = 'http://_lara10-autoatend.devel/api/v1/';
|
||||
|
||||
const pusherUrl = 'aa.linco.work';
|
||||
// const pusherUrl = 'localhost';
|
||||
const settingsPath = path.join(app.getPath('userData'), 'settings.json'); // Caminho para as configurações
|
||||
|
||||
//! api
|
||||
const apiUrl = 'https://aapi.linco.work/';
|
||||
//! pusher
|
||||
const pusherUrl = apiUrl;
|
||||
|
||||
autoUpdater.autoDownload = false;
|
||||
autoUpdater.autoInstallOnAppQuit = true;
|
||||
|
||||
//? Função para ler as configurações
|
||||
function getSettings() {
|
||||
try {
|
||||
if (fs.existsSync(settingsPath)) {
|
||||
const settingsData = fs.readFileSync(settingsPath, 'utf-8');
|
||||
return JSON.parse(settingsData);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erro ao ler arquivo de configurações: ', error);
|
||||
}
|
||||
return {}; // Retorna objeto vazio se o arquivo não existir ou houver erro
|
||||
}
|
||||
|
||||
//? Função para salvar as configurações
|
||||
function saveSettings(settings) {
|
||||
try {
|
||||
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
||||
} catch (error) {
|
||||
console.error('Erro ao salvar arquivo de configurações:', error);
|
||||
}
|
||||
}
|
||||
|
||||
ipcMain.handle('get-setting', (event, key) => {
|
||||
const settings = getSettings();
|
||||
return settings[key];
|
||||
});
|
||||
|
||||
ipcMain.on('set-setting', (event, key, value) => {
|
||||
const settings = getSettings();
|
||||
settings[key] = value;
|
||||
saveSettings(settings);
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
});
|
||||
//! final de configurações
|
||||
|
||||
//impede que o app seja executado mais de uma vez
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
|
||||
// Função para configurar inicialização automática
|
||||
function setAutoLaunch(start) {
|
||||
app.setLoginItemSettings({
|
||||
openAtLogin: start,
|
||||
path: app.getPath('exe'), // Aponta para o executável do seu app
|
||||
});
|
||||
}
|
||||
|
||||
// Função modificada para buscar dados da API
|
||||
async function readData() {
|
||||
try {
|
||||
|
|
@ -56,7 +100,7 @@ async function fetchDataFromAPI() {
|
|||
//! as outras é o websockt que solicita a chamada de requisições em busca de alterações
|
||||
const updData = setInterval(() => {
|
||||
getDataAndUpdateFloatingBtn();
|
||||
}, 3000);
|
||||
}, 30000);
|
||||
|
||||
const updVersion = setTimeout(() => {
|
||||
if (pjson.isBuildNow) {
|
||||
|
|
@ -66,65 +110,82 @@ async function fetchDataFromAPI() {
|
|||
}
|
||||
|
||||
async function getFirstData() {
|
||||
|
||||
const token = await getAuthToken();
|
||||
const colabId = await floatingWin.webContents.executeJavaScript("localStorage.getItem('idOperator')")
|
||||
const url = apiUrl + 'get-proximos/' + colabId;
|
||||
const colab = await getSelectedOperator();
|
||||
const colabId = await getSelectedOperatorId();
|
||||
const tenantId = await getTenantId();
|
||||
const url = apiUrl + 'attendance/next-in-line/' + colabId;
|
||||
|
||||
//! checa se o token e o colabId existem
|
||||
if (!token && !colabId) { console.warn("Token or colabId not found in localStorage. API requests will not be made."); return; }
|
||||
if (!token || !colabId) {
|
||||
console.warn("Token or colabId not found. Skipping API request.");
|
||||
return [];
|
||||
}
|
||||
|
||||
//! faz o request
|
||||
const request = net.request({
|
||||
method: 'GET',
|
||||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token
|
||||
}
|
||||
});
|
||||
|
||||
//! busca pela resposta
|
||||
request.on('response', (response) => {
|
||||
let rawData = '';
|
||||
response.on('data', (chunk) => { rawData += chunk; });
|
||||
response.on('end', () => {
|
||||
try {
|
||||
const parsedData = JSON.parse(rawData);
|
||||
let proximos = parsedData;
|
||||
if (response.statusCode === 200) {
|
||||
floatingWin.webContents.executeJavaScript("localStorage.setItem('proximos','" + JSON.stringify(proximos) + "')");
|
||||
let count = proximos.length;
|
||||
floatingWin.webContents.send('update-count', count);
|
||||
} else {
|
||||
console.error(`Erro na requisição: Status code ${response.statusCode}`, parsedData);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Erro ao analisar a resposta JSON:", error);
|
||||
mainWin.webContents.send('api-error', {
|
||||
message: `Erro ao processar resposta do servidor.`
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
const request = net.request({
|
||||
method: 'GET',
|
||||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'x-tenant-id': tenantId,
|
||||
'x-colab': colab
|
||||
}
|
||||
});
|
||||
});
|
||||
request.on('error', (error) => {
|
||||
console.error("Erro na requisição:", error);
|
||||
});
|
||||
|
||||
request.end();
|
||||
request.on('response', (response) => {
|
||||
let rawData = '';
|
||||
response.on('data', (chunk) => { rawData += chunk; });
|
||||
response.on('end', async () => {
|
||||
try {
|
||||
const parsedData = JSON.parse(rawData);
|
||||
let proximos = Array.isArray(parsedData) ? parsedData : [];
|
||||
|
||||
if (response.statusCode === 200) {
|
||||
const proximosStr = JSON.stringify(proximos);
|
||||
|
||||
// Sincroniza o localStorage de todas as janelas importantes
|
||||
const updateStorageScript = `localStorage.setItem('proximos', ${JSON.stringify(proximosStr)})`;
|
||||
|
||||
if (floatingWin && !floatingWin.isDestroyed()) {
|
||||
floatingWin.webContents.executeJavaScript(updateStorageScript);
|
||||
floatingWin.webContents.send('update-count', proximos.length);
|
||||
}
|
||||
|
||||
// SÓ atualiza a janela principal se NÃO houver atendimento em andamento
|
||||
floatingWin.webContents.executeJavaScript("localStorage.getItem('atendimentoAtual')").then(atendimentoAtualId => {
|
||||
if (!atendimentoAtualId && mainWin && !mainWin.isDestroyed()) {
|
||||
mainWin.webContents.executeJavaScript(updateStorageScript);
|
||||
mainWin.webContents.send('load-data', proximos);
|
||||
}
|
||||
resolve(proximos);
|
||||
}).catch(err => {
|
||||
console.error("Erro ao verificar atendimento atual:", err);
|
||||
resolve(proximos);
|
||||
});
|
||||
} else {
|
||||
console.error(`Erro API: ${response.statusCode}`);
|
||||
resolve([]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Erro JSON:", error);
|
||||
resolve([]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return JSON.parse(await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')"));
|
||||
request.on('error', (error) => {
|
||||
console.error("Erro rede:", error);
|
||||
resolve([]);
|
||||
});
|
||||
|
||||
request.end();
|
||||
});
|
||||
}
|
||||
|
||||
// Função para coletar a lista de atendimentos do servidor, vai ser chamada uma vez e a cada 30s
|
||||
// Atualiza a função de monitoramento para realmente buscar dados a cada 30s (ou o que desejar)
|
||||
async function getDataAndUpdateFloatingBtn() {
|
||||
|
||||
const proximos = JSON.parse(await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')")) ?? [];
|
||||
let count = proximos.length;
|
||||
|
||||
//lista a contagem no botão flutuante
|
||||
floatingWin.webContents.send('update-count', count);
|
||||
|
||||
await getFirstData();
|
||||
}
|
||||
|
||||
// Função para verificar se o token existe no localStorage
|
||||
|
|
@ -152,6 +213,29 @@ async function getAuthToken() {
|
|||
});
|
||||
}
|
||||
|
||||
// Função para verificar o tenantId no localStorage
|
||||
async function getTenantId() {
|
||||
const checkWindow = async (win) => {
|
||||
if (win && !win.isDestroyed()) {
|
||||
try {
|
||||
const val = await win.webContents.executeJavaScript('localStorage.getItem("tenantId");');
|
||||
return (val && val !== 'null' && val !== 'undefined') ? val : null;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// Prioridade para janelas visíveis
|
||||
let id = await checkWindow(operatorWin);
|
||||
if (!id) id = await checkWindow(mainWin);
|
||||
if (!id) id = await checkWindow(floatingWin);
|
||||
if (!id) id = await checkWindow(loginWin);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
// Função para criar a janela de login
|
||||
function createLoginWindow() {
|
||||
loginWin = new BrowserWindow({
|
||||
|
|
@ -193,6 +277,7 @@ function createOperatorWindow() {
|
|||
});
|
||||
|
||||
// operatorWin.webContents.openDevTools();
|
||||
operatorWin.webContents.executeJavaScript('localStorage.setItem("version","' + app.getVersion() + '")');
|
||||
|
||||
operatorWin.loadFile('operator.html');
|
||||
|
||||
|
|
@ -256,8 +341,6 @@ function createFloatingWindow() {
|
|||
|
||||
floatingWin.loadFile('floating.html');
|
||||
|
||||
floatingWin.webContents.executeJavaScript('localStorage.setItem("version","' + app.getVersion() + '")');
|
||||
|
||||
// Envia a contagem inicial para a janela flutuante
|
||||
const data = readData();
|
||||
floatingWin.webContents.on('did-finish-load', () => {
|
||||
|
|
@ -344,6 +427,11 @@ if (!gotTheLock) {
|
|||
// Inicialização do aplicativo modificada para verificar autenticação
|
||||
app.whenReady().then(async () => {
|
||||
|
||||
//define a inicialização automatica do aplicativo ao entrar no windows
|
||||
const settings = getSettings();
|
||||
const enableAutoStart = settings.autostart === undefined ? true : settings.autostart;
|
||||
setAutoLaunch(enableAutoStart);
|
||||
|
||||
// Verifica se o usuário já está autenticado
|
||||
const token = await getAuthToken();
|
||||
|
||||
|
|
@ -429,10 +517,12 @@ async function getSelectedOperatorId() {
|
|||
}
|
||||
|
||||
ipcMain.handle('get-pusher-config', async () => {
|
||||
// Obtenha sua chave e host de forma segura aqui (ambiente, .env, etc.)
|
||||
const PUSHER_APP_KEY = process.env.PUSHER_APP_KEY || '1feb970af7708cb';
|
||||
const PUSHER_HOST = process.env.PUSHER_HOST || pusherUrl;
|
||||
return { appKey: PUSHER_APP_KEY, host: PUSHER_HOST };
|
||||
// Garante que o host não termine com barra para o Socket.io
|
||||
let host = pusherUrl;
|
||||
if (host && host.endsWith('/')) {
|
||||
host = host.slice(0, -1);
|
||||
}
|
||||
return { host: host };
|
||||
});
|
||||
|
||||
ipcMain.on('update_version', async (event, arg) => {
|
||||
|
|
@ -459,8 +549,13 @@ ipcMain.handle('get-count', async () => {
|
|||
return data.length;
|
||||
});
|
||||
|
||||
let isCallingNext = false;
|
||||
|
||||
// Ouvir pedido para mostrar a janela principal
|
||||
ipcMain.on('chamar-fila', async () => {
|
||||
// Evita múltiplas chamadas simultâneas
|
||||
if (isCallingNext) return;
|
||||
isCallingNext = true;
|
||||
|
||||
// Primeiro, verifica se já existe um atendimento em andamento
|
||||
const atendimentoAtualId = await floatingWin.webContents.executeJavaScript("localStorage.getItem('atendimentoAtual')");
|
||||
|
|
@ -483,56 +578,48 @@ ipcMain.on('chamar-fila', async () => {
|
|||
}
|
||||
|
||||
// Se um atendimento já estiver em andamento, apenas mostra a janela principal.
|
||||
// A lógica em renderer.js cuidará de exibir a tela de observação.
|
||||
if (atendimentoAtualId) {
|
||||
showMainWindow();
|
||||
return; // Interrompe a execução aqui
|
||||
}
|
||||
|
||||
// Se não houver atendimento em andamento, continua com a lógica original.
|
||||
const countFila = async () => {
|
||||
const proximos = JSON.parse(await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')")) ?? [];
|
||||
return proximos.length;
|
||||
isCallingNext = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const requestData = async () => {
|
||||
|
||||
|
||||
|
||||
|
||||
const colabId = await getSelectedOperatorId();
|
||||
const token = await getAuthToken('token');
|
||||
const url = apiUrl + 'chama-fila-app-colab/' + colabId; // URL de exemplo para enviar a solicitação
|
||||
const colab = await getSelectedOperator();
|
||||
const token = await getAuthToken();
|
||||
const tenantId = await getTenantId();
|
||||
const url = apiUrl + 'attendance/call-next/' + colabId;
|
||||
|
||||
const request = net.request({
|
||||
method: 'GET',
|
||||
method: 'POST',
|
||||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'x-tenant-id': tenantId,
|
||||
'x-colab': colab
|
||||
}
|
||||
});
|
||||
|
||||
request.on('response', (response) => {
|
||||
let rawData = '';
|
||||
|
||||
response.on('data', (chunk) => {
|
||||
rawData += chunk;
|
||||
});
|
||||
|
||||
response.on('data', (chunk) => { rawData += chunk; });
|
||||
response.on('end', () => {
|
||||
isCallingNext = false;
|
||||
try {
|
||||
const parsedData = JSON.parse(rawData);
|
||||
if (response.statusCode === 200) {
|
||||
mainWin.webContents.send('select-atend-id', parsedData.data);
|
||||
if (parsedData.data && (parsedData.data.Status === 'Fila' || parsedData.data.Status === 'Chamado')) { showMainWindow(); } else
|
||||
if (parsedData.data && parsedData.data.Status === 'Atendendo') {
|
||||
if (response.statusCode === 201 || response.statusCode === 200) {
|
||||
if (parsedData) {
|
||||
mainWin.webContents.send('select-atend-id', parsedData);
|
||||
if (parsedData.status === 'Fila' || parsedData.status === 'Chamado') {
|
||||
showMainWindow();
|
||||
} else if (parsedData.status === 'Atendendo') {
|
||||
let options2 = {
|
||||
'title': 'Precisa finalizar antes de chamar o próximo.',
|
||||
'message': 'Em andamento',
|
||||
'detail': 'Já possui um atendimento em andamento (Atendendo: ' + parsedData.data.clientName + '), continue e finalize por favor!',
|
||||
'detail': 'Já possui um atendimento em andamento (Atendendo: ' + parsedData.clientName + '), continue e finalize por favor!',
|
||||
'type': 'error',
|
||||
'noLink': true,
|
||||
'buttons': ['Depois', 'Continuar'],
|
||||
};
|
||||
dialog.showMessageBox(floatingWin, options2).then(result => {
|
||||
|
|
@ -544,10 +631,11 @@ ipcMain.on('chamar-fila', async () => {
|
|||
};
|
||||
});
|
||||
}
|
||||
// console.log(parsedData);
|
||||
} else {
|
||||
mainWin.webContents.send('select-atend-id', null);
|
||||
}
|
||||
} else {
|
||||
console.error(`Erro na requisição: Status code ${response.statusCode}`, parsedData);
|
||||
// Lidar com o erro adequadamente, talvez enviando uma mensagem para a janela principal
|
||||
mainWin.webContents.send('api-error', {
|
||||
message: `Erro ao chamar atendimento: ${parsedData.message || 'Erro desconhecido'}`
|
||||
});
|
||||
|
|
@ -562,6 +650,7 @@ ipcMain.on('chamar-fila', async () => {
|
|||
});
|
||||
|
||||
request.on('error', (error) => {
|
||||
isCallingNext = false;
|
||||
console.error("Erro na requisição:", error);
|
||||
mainWin.webContents.send('api-error', {
|
||||
message: `Erro ao chamar atendimento: ${error.message}`
|
||||
|
|
@ -571,7 +660,11 @@ ipcMain.on('chamar-fila', async () => {
|
|||
request.end();
|
||||
};
|
||||
|
||||
|
||||
const countFilaValue = async () => {
|
||||
const stored = await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')");
|
||||
const proximos = JSON.parse(stored || '[]');
|
||||
return proximos.length;
|
||||
}
|
||||
|
||||
let options = {
|
||||
'title': 'Incie o atendimento quando o cliente chegar na sala.',
|
||||
|
|
@ -581,23 +674,27 @@ ipcMain.on('chamar-fila', async () => {
|
|||
'buttons': ['Não', 'Sim'],
|
||||
};
|
||||
|
||||
|
||||
if (await countFila()) {
|
||||
const count = await countFilaValue();
|
||||
if (count > 0) {
|
||||
dialog.showMessageBox(floatingWin, options).then(result => {
|
||||
if (result.response) {
|
||||
if (result.response === 1) { // 1 é 'Sim'
|
||||
requestData();
|
||||
};
|
||||
} else {
|
||||
isCallingNext = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
requestData();
|
||||
// Se a fila estiver vazia, apenas abre a janela principal para visualização
|
||||
showMainWindow();
|
||||
isCallingNext = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Ouve um pedido da janela flutuante para forçar a atualização da contagem
|
||||
ipcMain.on('refresh-count', async () => {
|
||||
if (floatingWin) {
|
||||
const proximos = JSON.parse(await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')")) ?? [];
|
||||
const stored = await floatingWin.webContents.executeJavaScript("localStorage.getItem('proximos')");
|
||||
const proximos = JSON.parse(stored || '[]');
|
||||
floatingWin.webContents.send('update-count', proximos.length);
|
||||
}
|
||||
});
|
||||
|
|
@ -611,44 +708,114 @@ ipcMain.on('select-atend-id', (itemId) => {
|
|||
ipcMain.on('iniciar-atendimento', async (event, itemId) => {
|
||||
|
||||
const token = await getAuthToken();
|
||||
const colabId = await floatingWin.webContents.executeJavaScript("localStorage.getItem('idOperator')")
|
||||
//TODO inicia o atendimento o id do atendimento deve ser requisitado do backend
|
||||
|
||||
const url = apiUrl + 'iniciar-atendimento/' + itemId; // URL para enviar a solicitação
|
||||
const tenantId = await getTenantId();
|
||||
const colabId = await getSelectedOperatorId();
|
||||
const colab = await getSelectedOperator();
|
||||
const url = apiUrl + 'attendance/' + itemId + '/start';
|
||||
|
||||
// envio de uma solicitação POST com o ID do item
|
||||
const request = net.request({
|
||||
method: 'GET',
|
||||
method: 'PATCH',
|
||||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'x-tenant-id': tenantId,
|
||||
'x-colab': colab
|
||||
}
|
||||
});
|
||||
|
||||
request.on('response', (response) => {
|
||||
// console.log(`STATUS: ${response.statusCode}`);
|
||||
// console.log(`HEADERS: ${JSON.stringify(response.headers)}`);
|
||||
response.on('data', (chunk) => {
|
||||
console.log(`BODY: ${chunk}`);
|
||||
});
|
||||
response.on('end', () => {
|
||||
console.log('Solicitação concluída.');
|
||||
// Avisa a janela principal que a solicitação foi feita (opcional)
|
||||
// mainWin.webContents.send('request-done', itemId);
|
||||
});
|
||||
});
|
||||
request.on('error', (error) => {
|
||||
console.error(`Erro na solicitação: ${error}`);
|
||||
// Poderia notificar a UI sobre o erro
|
||||
});
|
||||
|
||||
// Envia o ID como corpo da requisição (exemplo)
|
||||
request.write(JSON.stringify({ id: itemId }));
|
||||
request.end();
|
||||
});
|
||||
|
||||
// Não precisamos esperar a resposta para mudar a UI na janela principal
|
||||
// A janela principal já mudou a UI ao enviar o evento 'next-step'
|
||||
// Ouvir clique no botão "Rechamar" - chama novamente o mesmo atendimento
|
||||
ipcMain.on('rechamar-atendimento', async (event, itemId) => {
|
||||
|
||||
const token = await getAuthToken();
|
||||
const tenantId = await getTenantId();
|
||||
const colabId = await getSelectedOperatorId();
|
||||
const colab = await getSelectedOperator();
|
||||
// Rota correta para atualizar o status do item específico e disparar o chamado na TV
|
||||
const url = apiUrl + 'attendance/' + itemId + '/status';
|
||||
|
||||
const request = net.request({
|
||||
method: 'PATCH',
|
||||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'x-tenant-id': tenantId,
|
||||
'x-colab': colab
|
||||
}
|
||||
});
|
||||
|
||||
// Enviar o corpo com o status "Chamado"
|
||||
request.write(JSON.stringify({
|
||||
status: 'Chamado',
|
||||
collaboratorId: colabId
|
||||
}));
|
||||
|
||||
request.on('response', (response) => {
|
||||
response.on('data', (chunk) => {
|
||||
console.log(`Rechamar BODY: ${chunk}`);
|
||||
});
|
||||
response.on('end', () => {
|
||||
console.log('Rechamada concluída.');
|
||||
});
|
||||
});
|
||||
request.on('error', (error) => {
|
||||
console.error(`Erro na rechamada: ${error}`);
|
||||
});
|
||||
|
||||
request.end();
|
||||
});
|
||||
|
||||
// Encaminhar atendimento para outro colaborador
|
||||
ipcMain.on('encaminhar-atendimento', async (event, { itemId, collaboratorId }) => {
|
||||
const token = await getAuthToken();
|
||||
const tenantId = await getTenantId();
|
||||
const colabId = await getSelectedOperatorId();
|
||||
const colab = await getSelectedOperator();
|
||||
const url = apiUrl + 'attendance/' + itemId + '/forward';
|
||||
|
||||
const request = net.request({
|
||||
method: 'PATCH',
|
||||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'x-tenant-id': tenantId,
|
||||
'x-colab': colab
|
||||
}
|
||||
});
|
||||
|
||||
request.write(JSON.stringify({ collaboratorId }));
|
||||
|
||||
request.on('response', (response) => {
|
||||
response.on('data', (chunk) => {
|
||||
console.log(`Encaminhar BODY: ${chunk}`);
|
||||
});
|
||||
response.on('end', () => {
|
||||
console.log('Encaminhamento concluído.');
|
||||
});
|
||||
});
|
||||
request.on('error', (error) => {
|
||||
console.error(`Erro no encaminhamento: ${error}`);
|
||||
});
|
||||
|
||||
request.end();
|
||||
});
|
||||
|
||||
// Ouve quando um atendimento é iniciado e notifica a janela flutuante
|
||||
|
|
@ -665,22 +832,26 @@ ipcMain.on('atendimento-finalizado', () => {
|
|||
}
|
||||
});
|
||||
|
||||
// Ouve atualização da fila vinda do renderer (via socket)
|
||||
ipcMain.on('update-queue', (event, data) => {
|
||||
// Sempre busca dados frescos da API quando o socket notifica mudança,
|
||||
// pois o socket pode enviar apenas o objeto da mudança e não a lista completa.
|
||||
getFirstData();
|
||||
});
|
||||
|
||||
// Ouvir clique no botão "Salvar"
|
||||
ipcMain.on('save-observation', async (event, { itemId, observation }) => {
|
||||
|
||||
//TODO salva a observação e finaliza o atendimento
|
||||
|
||||
console.log(`Salvando observação para item ${itemId}: ${observation}`);
|
||||
|
||||
const token = await getAuthToken();
|
||||
const colabId = await floatingWin.webContents.executeJavaScript("localStorage.getItem('idOperator')")
|
||||
//TODO inicia o atendimento o id do atendimento deve ser requisitado do backend
|
||||
|
||||
const url = apiUrl + 'finalizar-atendimento/' + itemId; // URL de exemplo para enviar a solicitação
|
||||
const tenantId = await getTenantId();
|
||||
const colabId = await getSelectedOperatorId();
|
||||
const colab = await getSelectedOperator();
|
||||
const url = apiUrl + 'attendance/' + itemId + '/finish';
|
||||
|
||||
const fmData = JSON.stringify({
|
||||
"colabId": colabId,
|
||||
"obsAtendimento": observation
|
||||
"observation": observation
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -690,7 +861,9 @@ ipcMain.on('save-observation', async (event, { itemId, observation }) => {
|
|||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'x-tenant-id': tenantId,
|
||||
'x-colab': colab
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -700,13 +873,10 @@ ipcMain.on('save-observation', async (event, { itemId, observation }) => {
|
|||
});
|
||||
response.on('end', () => {
|
||||
console.log('Solicitação concluída.');
|
||||
// Avisa a janela principal que a solicitação foi feita (opcional)
|
||||
// mainWin.webContents.send('request-done', itemId);
|
||||
});
|
||||
});
|
||||
request.on('error', (error) => {
|
||||
console.error(`Erro na solicitação: ${error}`);
|
||||
// Poderia notificar a UI sobre o erro
|
||||
});
|
||||
|
||||
// Envia o ID como corpo da requisição (exemplo)
|
||||
|
|
@ -716,22 +886,10 @@ ipcMain.on('save-observation', async (event, { itemId, observation }) => {
|
|||
|
||||
// Opcional: Fechar ou resetar a janela principal após salvar
|
||||
if (mainWin) {
|
||||
mainWin.hide(); // Ou mainWin.webContents.send('reset-view');
|
||||
mainWin.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Permite que a janela flutuante seja arrastada
|
||||
// REMOVA ou comente este listener inteiro:
|
||||
/*
|
||||
ipcMain.on('drag-float-window', (event, { offsetX, offsetY }) => {
|
||||
if (floatingWin) {
|
||||
const { x, y } = screen.getCursorScreenPoint();
|
||||
floatingWin.setPosition(x - offsetX, y - offsetY);
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
ipcMain.on('logout', () => {
|
||||
mainWin.webContents.executeJavaScript(`
|
||||
localStorage.removeItem("idOperator");
|
||||
|
|
@ -750,8 +908,7 @@ ipcMain.on('logout', () => {
|
|||
// Handler para login
|
||||
ipcMain.on('login-attempt', async (event, credentials) => {
|
||||
try {
|
||||
// Substitua pela URL real da sua API de autenticação
|
||||
const route = apiUrl + 'login';
|
||||
const route = apiUrl + 'auth/login';
|
||||
|
||||
const request = net.request({
|
||||
method: 'POST',
|
||||
|
|
@ -766,19 +923,22 @@ ipcMain.on('login-attempt', async (event, credentials) => {
|
|||
request.on('response', (response) => {
|
||||
response.on('data', (chunk) => {
|
||||
responseData += chunk.toString();
|
||||
console.log("Resposta da API:", responseData); // Adiciona este log para ver a resposta crua
|
||||
});
|
||||
|
||||
response.on('end', () => {
|
||||
try {
|
||||
const data = JSON.parse(responseData);
|
||||
|
||||
if (data.access_token) {
|
||||
// Tenta encontrar o tenantId em diferentes locais possíveis da resposta
|
||||
const tenantId = data.tenantId || (data.user && data.user.tenantId) || (data.user && data.user.tenant_id);
|
||||
|
||||
console.log(`Login bem-sucedido. Token presente. TenantId encontrado: ${tenantId}`);
|
||||
|
||||
if (data.status === 'Authorized' && data.api_key) {
|
||||
// Login bem-sucedido
|
||||
loginWin.webContents.executeJavaScript(`
|
||||
localStorage.setItem("authToken", "${data.api_key}");
|
||||
localStorage.setItem("channel", "${data.channel}");
|
||||
localStorage.setItem("authToken", "${data.access_token}");
|
||||
localStorage.setItem("tenantId", "${tenantId || ''}");
|
||||
`).then(() => {
|
||||
// Fecha a janela de login e abre a de seleção de operador
|
||||
event.reply('login-response', { success: true });
|
||||
|
|
@ -794,7 +954,6 @@ ipcMain.on('login-attempt', async (event, credentials) => {
|
|||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Resposta da API:", error);
|
||||
event.reply('login-response', {
|
||||
success: false,
|
||||
message: 'Erro ao processar resposta do servidor'
|
||||
|
|
@ -810,8 +969,12 @@ ipcMain.on('login-attempt', async (event, credentials) => {
|
|||
});
|
||||
});
|
||||
|
||||
// Remove máscara do login (CPF/CNPJ) e da senha antes de enviar para a API
|
||||
const cleanLogin = credentials.login.replace(/[.\-\/]/g, '');
|
||||
const cleanPassword = credentials.password.replace(/[.\-\/]/g, '');
|
||||
|
||||
// Envia as credenciais
|
||||
request.write(JSON.stringify(credentials));
|
||||
request.write(JSON.stringify({ login: cleanLogin, password: cleanPassword }));
|
||||
request.end();
|
||||
} catch (error) {
|
||||
event.reply('login-response', {
|
||||
|
|
@ -850,6 +1013,9 @@ ipcMain.handle('get-operators', async () => {
|
|||
try {
|
||||
// Verifica se existe token de autenticação
|
||||
const token = await getAuthToken();
|
||||
const tenantId = await getTenantId();
|
||||
|
||||
console.log(`Buscando operadores - TenantId: ${tenantId}, Token presente: ${!!token}`);
|
||||
|
||||
if (!token) {
|
||||
return {
|
||||
|
|
@ -859,39 +1025,59 @@ ipcMain.handle('get-operators', async () => {
|
|||
};
|
||||
}
|
||||
|
||||
// Aqui você pode fazer uma chamada à API para obter os operadores
|
||||
// Por enquanto, vamos retornar alguns operadores de exemplo
|
||||
// Substitua pela URL real da sua API de autenticação
|
||||
const route = apiUrl + 'colabs/list';
|
||||
const route = apiUrl + 'collaborators';
|
||||
|
||||
return new Promise(async (resolve) => {
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
};
|
||||
|
||||
// Garante que o tenantId é uma string válida e não "null" ou "undefined"
|
||||
if (tenantId && tenantId !== 'null' && tenantId !== 'undefined') {
|
||||
headers['x-tenant-id'] = tenantId;
|
||||
}
|
||||
|
||||
// Adiciona x-colab se disponível
|
||||
const colab = await getSelectedOperator().catch(() => null);
|
||||
if (colab && colab !== 'null' && colab !== 'undefined') {
|
||||
headers['x-colab'] = colab;
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = net.request({
|
||||
method: 'GET',
|
||||
url: route,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
headers: headers
|
||||
});
|
||||
|
||||
let responseData = '';
|
||||
|
||||
request.on('response', (response) => {
|
||||
let body = '';
|
||||
response.on('data', (chunk) => {
|
||||
responseData += chunk.toString();
|
||||
console.log("Resposta da API:", responseData); // Adiciona este log para ver a resposta crua
|
||||
body += chunk.toString();
|
||||
});
|
||||
|
||||
response.on('end', () => {
|
||||
try {
|
||||
const data = JSON.parse(responseData);
|
||||
if (response.statusCode !== 200) {
|
||||
console.error(`Erro na API (${response.statusCode}):`, body);
|
||||
resolve({
|
||||
success: false,
|
||||
message: `Erro ${response.statusCode}: ${body}`,
|
||||
operators: []
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.colabs) {
|
||||
const operators = data.colabs.map(colab => ({
|
||||
id: colab.id,
|
||||
name: colab.nome.toUpperCase(),
|
||||
sala: colab.sala,
|
||||
servicos: colab.servicos
|
||||
try {
|
||||
const data = JSON.parse(body);
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
const operators = data.map(colab => ({
|
||||
id: colab._id,
|
||||
name: colab.name.toUpperCase(),
|
||||
sala: colab.roomId?.name || 'Sala',
|
||||
servicos: colab.serviceIds?.map(s => s.name).join(',') || ''
|
||||
}));
|
||||
|
||||
resolve({
|
||||
|
|
@ -899,15 +1085,14 @@ ipcMain.handle('get-operators', async () => {
|
|||
operators: operators
|
||||
});
|
||||
} else {
|
||||
reject({
|
||||
resolve({
|
||||
success: false,
|
||||
message: data.message || 'Erro ao obter a lista de colaboradores',
|
||||
message: 'Resposta da API não é uma lista válida',
|
||||
operators: []
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Erro ao processar resposta da API:", error);
|
||||
reject({
|
||||
resolve({
|
||||
success: false,
|
||||
message: 'Erro ao processar resposta do servidor',
|
||||
operators: []
|
||||
|
|
@ -917,7 +1102,7 @@ ipcMain.handle('get-operators', async () => {
|
|||
});
|
||||
|
||||
request.on('error', (error) => {
|
||||
reject({
|
||||
resolve({
|
||||
success: false,
|
||||
message: `Erro de conexão: ${error.message}`,
|
||||
operators: []
|
||||
|
|
@ -1022,4 +1207,4 @@ ipcMain.on('show-context-menu', (event) => {
|
|||
];
|
||||
const menu = Menu.buildFromTemplate(template);
|
||||
menu.popup({ window: floatingWin });
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,6 +19,14 @@
|
|||
<option value="">Selecione um operador</option>
|
||||
<!-- Operadores serão carregados aqui -->
|
||||
</select>
|
||||
|
||||
<p>
|
||||
Iniciar automaticamente com o sistema
|
||||
</p>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="active-switch" checked>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button id="select-button" disabled>Continuar</button>
|
||||
|
|
@ -29,11 +37,11 @@
|
|||
<script>
|
||||
$(function(){
|
||||
let opse = localStorage.getItem('selectedOperator');
|
||||
let vs = localStorage.getItem('version');
|
||||
setTimeout(()=>{
|
||||
let vs = localStorage.getItem('version');
|
||||
$('span.op').text(opse);
|
||||
$('#version').text(vs);
|
||||
},2000);
|
||||
},1000);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
13
operator.js
13
operator.js
|
|
@ -3,9 +3,17 @@ const selectButton = document.getElementById('select-button');
|
|||
const errorMessage = document.getElementById('error-message');
|
||||
const quitButton = document.getElementById('sair-button');
|
||||
const verionSpan = document.getElementById('version');
|
||||
const autoStartSwitch = document.getElementById('active-switch');
|
||||
|
||||
// Carrega a lista de operadores ao iniciar
|
||||
window.addEventListener('DOMContentLoaded', async () => {
|
||||
//... (código existente)
|
||||
|
||||
// Carrega o estado do autostart
|
||||
const autostart = await window.electronAPI.getSetting('autostart');
|
||||
autoStartSwitch.checked = autostart === undefined ? true : autostart;
|
||||
|
||||
|
||||
try {
|
||||
const response = await window.electronAPI.getOperators();
|
||||
|
||||
|
|
@ -88,7 +96,10 @@ window.electronAPI.onOperatorResponse((response) => {
|
|||
// Se for bem-sucedido, o processo principal fechará esta janela
|
||||
});
|
||||
|
||||
|
||||
autoStartSwitch.addEventListener('change', () => {
|
||||
const isEnabled = autoStartSwitch.checked;
|
||||
window.electronAPI.setSetting('autostart', isEnabled);
|
||||
});
|
||||
|
||||
quitButton.addEventListener('click',()=>{
|
||||
window.electronAPI.quitApp();
|
||||
|
|
|
|||
|
|
@ -6,4 +6,6 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||
showVersion: (version) => ipcRenderer.on('show-version', version),
|
||||
onOperatorResponse: (callback) => ipcRenderer.on('operator-response', (_event, response) => callback(response)),
|
||||
quitApp : () => ipcRenderer.send('sair'),
|
||||
getSetting: (key) => ipcRenderer.invoke('get-setting', key),
|
||||
setSetting: (key, value) => ipcRenderer.send('set-setting', key, value),
|
||||
});
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
{
|
||||
"name": "autoatendcolab",
|
||||
"version": "1.0.7",
|
||||
"version": "1.1.6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "autoatendcolab",
|
||||
"version": "1.0.7",
|
||||
"version": "1.1.6",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@electron/remote": "^2.1.2",
|
||||
"electron-single-instance": "^0.0.2",
|
||||
"electron-updater": "^6.6.2",
|
||||
"jquery": "^3.7.1"
|
||||
"jquery": "^3.7.1",
|
||||
"socket.io-client": "^4.8.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^35.2.1",
|
||||
|
|
@ -952,6 +953,12 @@
|
|||
"url": "https://github.com/sindresorhus/is?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@socket.io/component-emitter": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
|
||||
"integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@szmarczak/http-timer": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz",
|
||||
|
|
@ -2041,9 +2048,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
|
||||
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
|
|
@ -2743,6 +2751,28 @@
|
|||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io-client": {
|
||||
"version": "6.6.4",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.4.tgz",
|
||||
"integrity": "sha512-+kjUJnZGwzewFDw951CDWcwj35vMNf2fcj7xQWOctq1F2i1jkDdVvdFG9kM/BEChymCH36KgjnW0NsL58JYRxw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.4.1",
|
||||
"engine.io-parser": "~5.2.1",
|
||||
"ws": "~8.18.3",
|
||||
"xmlhttprequest-ssl": "~2.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io-parser": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz",
|
||||
"integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/env-paths": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
|
||||
|
|
@ -5029,6 +5059,34 @@
|
|||
"npm": ">= 3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-client": {
|
||||
"version": "4.8.3",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.3.tgz",
|
||||
"integrity": "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.4.1",
|
||||
"engine.io-client": "~6.6.1",
|
||||
"socket.io-parser": "~4.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-parser": {
|
||||
"version": "4.2.6",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.6.tgz",
|
||||
"integrity": "sha512-asJqbVBDsBCJx0pTqw3WfesSY0iRX+2xzWEWzrpcH7L6fLzrhyF8WPI8UaeM4YCuDfpwA/cgsdugMsmtz8EJeg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.4.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socks": {
|
||||
"version": "2.8.4",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz",
|
||||
|
|
@ -5734,6 +5792,27 @@
|
|||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.18.3",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
|
||||
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/xmlbuilder": {
|
||||
"version": "15.1.1",
|
||||
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",
|
||||
|
|
@ -5744,6 +5823,14 @@
|
|||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xmlhttprequest-ssl": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
|
||||
"integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/y18n": {
|
||||
"version": "5.0.8",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "autoatendcolab",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.9",
|
||||
"main": "main.js",
|
||||
"isBuildNow": true,
|
||||
"scripts": {
|
||||
|
|
@ -40,7 +40,8 @@
|
|||
"@electron/remote": "^2.1.2",
|
||||
"electron-single-instance": "^0.0.2",
|
||||
"electron-updater": "^6.6.2",
|
||||
"jquery": "^3.7.1"
|
||||
"jquery": "^3.7.1",
|
||||
"socket.io-client": "^4.8.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^35.2.1",
|
||||
|
|
@ -48,4 +49,4 @@
|
|||
"electron-reload": "^2.0.0-alpha.1",
|
||||
"nodemon": "^3.1.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
preload.js
10
preload.js
|
|
@ -14,10 +14,20 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||
//inicia o atendimento atual
|
||||
iniciaAtendimento: (itemId) => ipcRenderer.send('iniciar-atendimento', itemId),
|
||||
|
||||
//rechama o atendimento atual
|
||||
rechamarAtendimento: (itemId) => ipcRenderer.send('rechamar-atendimento', itemId),
|
||||
|
||||
//encaminha o atendimento atual
|
||||
getOperators: () => ipcRenderer.invoke('get-operators'),
|
||||
encaminharAtendimento: (data) => ipcRenderer.send('encaminhar-atendimento', data),
|
||||
|
||||
//notifica sobre o status do atendimento
|
||||
atendimentoIniciado: (itemId) => ipcRenderer.send('atendimento-iniciado', itemId),
|
||||
atendimentoFinalizado: () => ipcRenderer.send('atendimento-finalizado'),
|
||||
|
||||
//notifica o main process sobre atualização na fila vinda do socket
|
||||
updateQueue: (data) => ipcRenderer.send('update-queue', data),
|
||||
|
||||
showObservation: (callback) => ipcRenderer.on('show-observation', (_event) => callback() ),
|
||||
//salva a observação do atendimento
|
||||
saveObservation: (data) => ipcRenderer.send('save-observation', data),
|
||||
|
|
|
|||
360
renderer.js
360
renderer.js
|
|
@ -1,104 +1,122 @@
|
|||
const listView = document.getElementById('list-view');
|
||||
const observationView = document.getElementById('obs-view');
|
||||
const encaminharView = document.getElementById('encaminhar-view');
|
||||
const itemList = document.getElementById('item-list');
|
||||
|
||||
// Novos elementos do layout redesenhado
|
||||
const queueTableBody = document.getElementById('queue-table-body');
|
||||
const queueEmpty = document.getElementById('queue-empty');
|
||||
const queueCount = document.getElementById('queue-count');
|
||||
const currentCard = document.getElementById('current-card');
|
||||
const noCurrentCard = document.getElementById('no-current');
|
||||
const cardTicket = document.getElementById('card-ticket');
|
||||
const cardStatusBadge = document.getElementById('card-status-badge');
|
||||
const cardClientName = document.getElementById('card-client-name');
|
||||
const cardService = document.getElementById('card-service');
|
||||
const cardType = document.getElementById('card-type');
|
||||
const nextButton = document.getElementById('next-button');
|
||||
const recallButton = document.getElementById('recall-button');
|
||||
const forwardButton = document.getElementById('forward-button');
|
||||
const logoutButton = document.getElementById('logout-button');
|
||||
const observationText = document.getElementById('observation-text');
|
||||
const encObservationText = document.getElementById('enc-observation-text');
|
||||
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');
|
||||
|
||||
// Elementos do Modal de Encaminhamento
|
||||
const forwardView = document.getElementById('forward-view');
|
||||
const operatorsList = document.getElementById('operators-list');
|
||||
const closeForward = document.getElementById('close-forward');
|
||||
const forwardTicketSpan = document.getElementById('forward-ticket');
|
||||
|
||||
let currentData = [];
|
||||
let selectedItemId = null;
|
||||
let selectedItemName = '';
|
||||
|
||||
// ===========================
|
||||
// FLAG que trava o ID do atendimento chamado.
|
||||
// Quando o call-next retorna e define o atendimento atual,
|
||||
// este flag impede que atualizações da fila sobrescrevam o selectedItemId.
|
||||
// ===========================
|
||||
let calledAtendimentoData = null; // Guarda os dados completos do atendimento chamado
|
||||
|
||||
window.electronAPI.onLoadData((data) => {
|
||||
nextButton.disabled = true;
|
||||
// Se já estiver em atendimento, ignora atualizações da lista para evitar flickering no botão
|
||||
if (localStorage.getItem('atendimentoAtual')) {
|
||||
return;
|
||||
}
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
// Reseta a view para a lista sempre que os dados são carregados
|
||||
populateList(data[0]);
|
||||
populateQueueTable(data);
|
||||
});
|
||||
|
||||
async function initializePusher() {
|
||||
async function initializeSocket() {
|
||||
if (typeof window.electronAPI === 'undefined' || !window.electronAPI.getPusherConfig) {
|
||||
console.error('electronAPI not available or getPusherConfig method missing.');
|
||||
return;
|
||||
}
|
||||
|
||||
const pusherConfig = await window.electronAPI.getPusherConfig();
|
||||
const PUSHER_APP_KEY = pusherConfig.appKey;
|
||||
let host = pusherConfig.host;
|
||||
const config = await window.electronAPI.getPusherConfig();
|
||||
let host = config.host;
|
||||
|
||||
const channelLocal = localStorage.getItem('channel');
|
||||
const colabId = localStorage.getItem('idOperator');
|
||||
const tenantId = localStorage.getItem('tenantId');
|
||||
const token = localStorage.getItem('authToken');
|
||||
const colab = localStorage.getItem('selectedOperator');
|
||||
|
||||
//! checa se ja tem o colabId
|
||||
if (channelLocal && colabId && PUSHER_APP_KEY) {
|
||||
Pusher.logToConsole = true;
|
||||
|
||||
var pusher = new Pusher(PUSHER_APP_KEY, {
|
||||
wsHost: host,
|
||||
wsPort: 80,
|
||||
wssPort: 443,
|
||||
forceTLS: true,
|
||||
enableStats: false,
|
||||
enabledTransports: ['wss', 'ws'],
|
||||
cluster: 'mt1'
|
||||
//! checa se ja tem o colabId e o tenantId
|
||||
if (tenantId && token) {
|
||||
// Conexão Socket.io adaptada do Pusher
|
||||
const socket = io(host, {
|
||||
auth: { token },
|
||||
extraHeaders: {
|
||||
'x-tenant-id': tenantId,
|
||||
'x-colab': colab || 'N/A'
|
||||
}
|
||||
});
|
||||
|
||||
let channel;
|
||||
if (pusher.connection.state === 'connected') {
|
||||
pusher.unsubscribe('chat.' + channelLocal + '_' + colabId);
|
||||
}
|
||||
|
||||
channel = pusher.subscribe('chat.' + channelLocal + '_' + colabId);
|
||||
|
||||
channel.bind('message-sent', function (r) {
|
||||
let data = r.data.fila.original;
|
||||
let count = data.length;
|
||||
console.log(data);
|
||||
localStorage.setItem('proximos', JSON.stringify(data));
|
||||
|
||||
populateList(r.data.currentData.original);
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log('Socket.io conectado ao host: ', host);
|
||||
});
|
||||
|
||||
pusher.connection.bind('error', function (err) {
|
||||
console.error('Pusher connection error: ', err);
|
||||
// Evento que substitui o bind do Pusher
|
||||
socket.on('queueUpdate', (data) => {
|
||||
console.log('Notificação de fila recebida:', data);
|
||||
// Avisa o processo principal que houve mudança.
|
||||
// O main vai buscar a lista completa e atualizar todas as janelas.
|
||||
window.electronAPI.updateQueue();
|
||||
});
|
||||
|
||||
socket.on('error', (err) => {
|
||||
console.error('Socket.io connection error: ', err);
|
||||
});
|
||||
|
||||
console.log('Host de conexão: ', host);
|
||||
} else {
|
||||
console.warn('User not authenticated or Pusher APP_KEY not available. Private channel not subscribed.');
|
||||
console.warn('User not authenticated or tenantId not available. WebSocket not connected.');
|
||||
}
|
||||
}
|
||||
|
||||
initializePusher();
|
||||
initializeSocket();
|
||||
|
||||
//chama o proximo da fila ao abrir a janela de atendimentos
|
||||
window.electronAPI.selectAtendID((data) => {
|
||||
nextButton.disabled = true;
|
||||
if (!data) {
|
||||
queueNumber.innerHTML = 'Ninguem aguardando atendimento, fechando a janela em alguns segundos...';
|
||||
showNoCurrentCard('Ninguém aguardando atendimento');
|
||||
return;
|
||||
}
|
||||
// Reseta a view para a lista sempre que os dados são carregados ao clicar no botão para abrir a janela
|
||||
populateList(data);
|
||||
showListView();
|
||||
|
||||
// Garante que o item selecionado (ID e Nome) seja o que veio da chamada, sobrescrevendo o da lista.
|
||||
selectedItemId = data.id ?? null;
|
||||
// Trava os dados do atendimento chamado para que atualizações da fila
|
||||
// NÃO sobrescrevam quem foi chamado.
|
||||
calledAtendimentoData = data;
|
||||
selectedItemId = data._id ?? null;
|
||||
selectedItemName = data.clientName ?? '';
|
||||
|
||||
//data.senhaGen
|
||||
queueNumber.innerHTML = data ? `NA VEZ: <u>${data.clientName.toUpperCase()}</u> - ${data.descricaoServico.toUpperCase()}` : 'Ninguem aguardando atendimento';
|
||||
selectedItemNameSpan.innerHTML = data ? `<u> ${data.clientName.toUpperCase()} </u> <i style="float:right;">[ ${data.senhaGen} ]</i>` : 'Ninguem aguardando atendimento';
|
||||
// Atualiza a tabela da fila (sem afetar o card atual)
|
||||
// populateQueueTable já NÃO mexe no selectedItemId quando calledAtendimentoData está travado
|
||||
showListView();
|
||||
|
||||
// Mostra o card do atendimento chamado
|
||||
showCurrentCard(data);
|
||||
});
|
||||
|
||||
window.electronAPI.showObservation(() => {
|
||||
|
|
@ -106,53 +124,115 @@ window.electronAPI.showObservation(() => {
|
|||
showObservationView(); // Muda para a tela de observação
|
||||
});
|
||||
|
||||
// Função para popular a lista de itens
|
||||
function populateList(currentData) {
|
||||
// Função para popular a tabela da fila
|
||||
function populateQueueTable(proximos) {
|
||||
const atendimentoEmAndamentoId = localStorage.getItem('atendimentoAtual');
|
||||
const atendimentoEmAndamentoNome = localStorage.getItem('atendimentoAtualNome');
|
||||
|
||||
if (atendimentoEmAndamentoId) {
|
||||
itemList.innerHTML = `<li>Atendimento com <strong>${(atendimentoEmAndamentoNome || '').toUpperCase()}</strong> em andamento.</li>`;
|
||||
queueNumber.innerHTML = `EM ATENDIMENTO: <u>${(atendimentoEmAndamentoNome || '').toUpperCase()}</u>`;
|
||||
// Em atendimento: mostra card de atendimento no painel direito
|
||||
queueTableBody.innerHTML = '';
|
||||
queueCount.textContent = '0';
|
||||
queueEmpty.style.display = 'flex';
|
||||
document.querySelector('.queue-table').style.display = 'none';
|
||||
|
||||
// Mostra card como "Atendendo"
|
||||
currentCard.style.display = 'flex';
|
||||
noCurrentCard.style.display = 'none';
|
||||
cardTicket.textContent = '';
|
||||
cardStatusBadge.textContent = 'Atendendo';
|
||||
cardStatusBadge.className = 'card-badge badge-atendendo';
|
||||
cardClientName.textContent = (atendimentoEmAndamentoNome || '').toUpperCase();
|
||||
cardService.textContent = '';
|
||||
cardType.textContent = '';
|
||||
nextButton.disabled = true;
|
||||
recallButton.disabled = true;
|
||||
forwardButton.disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
let datastorage = localStorage.getItem('proximos');
|
||||
|
||||
// Adiciona os outros itens apenas para visualização (opcional)
|
||||
const proximos = JSON.parse(datastorage);
|
||||
itemList.innerHTML = '';
|
||||
|
||||
setTimeout(() => {
|
||||
nextButton.disabled = !currentData;
|
||||
}, 5000);
|
||||
|
||||
// Seleciona o primeiro item por padrão (ou o próximo disponível)
|
||||
// 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');
|
||||
li.innerHTML = /*${itemToProcess.senhaGen}: */ `<u>${itemToProcess.clientName.toUpperCase()}</u> - ${itemToProcess.attendanceType.toUpperCase()} - ${itemToProcess.descricaoServico.toUpperCase()}`;
|
||||
li.dataset.id = itemToProcess.id; // Armazena o ID no elemento
|
||||
li.classList.add('selected'); // Marca como selecionado visualmente (precisa de CSS)
|
||||
itemList.appendChild(li);
|
||||
} else {
|
||||
itemList.innerHTML = '<li>Fila vazia!</li>';
|
||||
nextButton.disabled = true;
|
||||
selectedItemId = null;
|
||||
selectedItemName = '';
|
||||
// Se não vier dados por parâmetro, tenta pegar do localStorage (fallback)
|
||||
if (!Array.isArray(proximos)) {
|
||||
let datastorage = localStorage.getItem('proximos');
|
||||
proximos = JSON.parse(datastorage || '[]');
|
||||
}
|
||||
|
||||
// Adiciona os outros itens apenas para visualização (opcional)
|
||||
proximos.slice(1).forEach(item => {
|
||||
const li = document.createElement('li');
|
||||
//${item.senhaGen}:
|
||||
li.textContent = `${item.clientName.toUpperCase()} - ${item.attendanceType.toUpperCase()} - ${item.descricaoServico.toUpperCase()}`;
|
||||
itemList.appendChild(li);
|
||||
});
|
||||
// Limpa e popula a tabela
|
||||
queueTableBody.innerHTML = '';
|
||||
|
||||
if (!proximos || proximos.length === 0) {
|
||||
queueEmpty.style.display = 'flex';
|
||||
document.querySelector('.queue-table').style.display = 'none';
|
||||
queueCount.textContent = '0';
|
||||
} else {
|
||||
queueEmpty.style.display = 'none';
|
||||
document.querySelector('.queue-table').style.display = 'table';
|
||||
queueCount.textContent = proximos.length;
|
||||
|
||||
proximos.forEach((item, index) => {
|
||||
const tr = document.createElement('tr');
|
||||
const isPreferencial = item.ticketNumber && item.ticketNumber.startsWith('P');
|
||||
|
||||
tr.innerHTML = `
|
||||
<td class="ticket-cell ${isPreferencial ? 'ticket-preferencial' : 'ticket-normal'}">${item.ticketNumber || '---'}</td>
|
||||
<td>${(item.clientName || '---').toUpperCase()}</td>
|
||||
<td>${item.serviceName || 'Atendimento'}</td>
|
||||
<td class="${isPreferencial ? 'type-preferencial' : 'type-normal'}">${isPreferencial ? 'PREFERENCIAL' : 'NORMAL'}</td>
|
||||
`;
|
||||
|
||||
queueTableBody.appendChild(tr);
|
||||
});
|
||||
}
|
||||
|
||||
// CORREÇÃO DO BUG: Só atualiza selectedItemId se NÃO houver um atendimento já chamado (travado)
|
||||
if (!calledAtendimentoData) {
|
||||
// Nenhum atendimento foi chamado ainda, pode selecionar o primeiro
|
||||
const firstItem = proximos && proximos[0];
|
||||
if (firstItem) {
|
||||
selectedItemId = firstItem._id;
|
||||
selectedItemName = firstItem.clientName;
|
||||
} else {
|
||||
selectedItemId = null;
|
||||
selectedItemName = '';
|
||||
}
|
||||
// Sem atendimento chamado: não mostra card
|
||||
if (!currentCard.style.display || currentCard.style.display === 'none') {
|
||||
noCurrentCard.style.display = 'flex';
|
||||
}
|
||||
}
|
||||
// Se calledAtendimentoData está definido, NÃO toca no selectedItemId — mantém o que foi chamado.
|
||||
}
|
||||
|
||||
// Mostra o card do atendimento atual (chamado)
|
||||
function showCurrentCard(data) {
|
||||
currentCard.style.display = 'flex';
|
||||
noCurrentCard.style.display = 'none';
|
||||
|
||||
cardTicket.textContent = data.ticketNumber || '---';
|
||||
|
||||
const statusText = data.status === 'Atendendo' ? 'Atendendo' : 'Chamado';
|
||||
cardStatusBadge.textContent = statusText;
|
||||
cardStatusBadge.className = `card-badge ${data.status === 'Atendendo' ? 'badge-atendendo' : 'badge-chamado'}`;
|
||||
|
||||
cardClientName.textContent = (data.clientName || '---').toUpperCase();
|
||||
cardService.textContent = (data.serviceName || 'ATENDIMENTO').toUpperCase();
|
||||
|
||||
const isPreferencial = data.ticketNumber && data.ticketNumber.startsWith('P');
|
||||
cardType.textContent = isPreferencial ? 'PREFERENCIAL' : 'NORMAL';
|
||||
cardType.className = `card-type ${isPreferencial ? 'type-preferencial' : ''}`;
|
||||
|
||||
// Habilita os botões
|
||||
setTimeout(() => {
|
||||
nextButton.disabled = false;
|
||||
recallButton.disabled = false;
|
||||
forwardButton.disabled = false;
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function showNoCurrentCard(message) {
|
||||
currentCard.style.display = 'none';
|
||||
noCurrentCard.style.display = 'flex';
|
||||
noCurrentCard.querySelector('p').textContent = message || 'Nenhum atendimento chamado';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -172,7 +252,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
//mostra a tela de listagem e permite iniciar o atendimento
|
||||
function showListView() {
|
||||
listView.style.display = 'block';
|
||||
encaminharView.style.display = 'none';
|
||||
forwardView.style.display = 'none';
|
||||
observationView.style.display = 'none';
|
||||
observationText.value = ''; // Limpa a textarea
|
||||
}
|
||||
|
|
@ -187,23 +267,100 @@ function showObservationView() {
|
|||
observationView.style.display = 'block';
|
||||
}
|
||||
|
||||
// // Evento do botão "Iniciar atendimento"
|
||||
// // Evento do botão "Iniciar atendimento" (INICIAR)
|
||||
nextButton.addEventListener('click', () => {
|
||||
if (selectedItemId !== null) {
|
||||
// Usa calledAtendimentoData para garantir que estamos iniciando O ATENDIMENTO CORRETO
|
||||
const idToStart = calledAtendimentoData ? calledAtendimentoData._id : selectedItemId;
|
||||
const nameToStart = calledAtendimentoData ? calledAtendimentoData.clientName : selectedItemName;
|
||||
|
||||
if (idToStart !== null) {
|
||||
// Salva o estado de atendimento no localStorage
|
||||
localStorage.setItem('atendimentoAtual', selectedItemId);
|
||||
localStorage.setItem('atendimentoAtualNome', selectedItemName);
|
||||
localStorage.setItem('atendimentoAtual', idToStart);
|
||||
localStorage.setItem('atendimentoAtualNome', nameToStart);
|
||||
|
||||
// Atualiza o span da tela de observação
|
||||
selectedItemId = idToStart;
|
||||
selectedItemName = nameToStart;
|
||||
selectedItemNameSpan.innerHTML = `<u> ${(nameToStart || '').toUpperCase()} </u>`;
|
||||
|
||||
// Notifica o main process e muda a view
|
||||
window.electronAPI.atendimentoIniciado(selectedItemId);
|
||||
window.electronAPI.iniciaAtendimento(selectedItemId);
|
||||
// IMPORTANTE: iniciaAtendimento deve apenas mudar o status na API, não chamar o próximo.
|
||||
window.electronAPI.atendimentoIniciado(idToStart);
|
||||
window.electronAPI.iniciaAtendimento(idToStart);
|
||||
|
||||
// Limpa o travamento — atendimento foi iniciado
|
||||
calledAtendimentoData = null;
|
||||
|
||||
showObservationView(); // Muda para a tela de observação
|
||||
} else {
|
||||
console.warn("Nenhum item selecionado para 'Próximo'");
|
||||
console.warn("Nenhum item selecionado para 'Iniciar'");
|
||||
}
|
||||
});
|
||||
|
||||
// Evento do botão RECHAMAR
|
||||
recallButton.addEventListener('click', () => {
|
||||
if (calledAtendimentoData) {
|
||||
// Re-chama o mesmo atendimento (pode tocar som, exibir no painel, etc.)
|
||||
window.electronAPI.rechamarAtendimento(calledAtendimentoData._id);
|
||||
|
||||
// Feedback visual
|
||||
recallButton.textContent = 'RECHAMANDO...';
|
||||
recallButton.disabled = true;
|
||||
setTimeout(() => {
|
||||
recallButton.textContent = 'RECHAMAR';
|
||||
recallButton.disabled = false;
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
|
||||
// Evento do botão ENCAMINHAR
|
||||
forwardButton.addEventListener('click', async () => {
|
||||
if (calledAtendimentoData) {
|
||||
forwardTicketSpan.textContent = calledAtendimentoData.ticketNumber;
|
||||
forwardView.style.display = 'flex';
|
||||
|
||||
// Carrega operadores
|
||||
operatorsList.innerHTML = '<p style="color: #aaa; padding: 20px; text-align: center;">Carregando atendentes...</p>';
|
||||
const response = await window.electronAPI.getOperators();
|
||||
|
||||
if (response.success && response.operators) {
|
||||
operatorsList.innerHTML = '';
|
||||
|
||||
response.operators.forEach(op => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'operator-item';
|
||||
item.textContent = op.name;
|
||||
item.onclick = () => {
|
||||
if (confirm(`Encaminhar para ${op.name}?`)) {
|
||||
window.electronAPI.encaminharAtendimento({
|
||||
itemId: calledAtendimentoData._id,
|
||||
collaboratorId: op._id
|
||||
});
|
||||
forwardView.style.display = 'none';
|
||||
|
||||
// Limpa o atendimento atual pois foi encaminhado
|
||||
localStorage.removeItem('atendimentoAtual');
|
||||
localStorage.removeItem('atendimentoAtualNome');
|
||||
calledAtendimentoData = null;
|
||||
selectedItemId = null;
|
||||
showListView();
|
||||
}
|
||||
};
|
||||
operatorsList.appendChild(item);
|
||||
});
|
||||
|
||||
if (response.operators.length === 0) {
|
||||
operatorsList.innerHTML = '<p style="color: #aaa; padding: 20px; text-align: center;">Nenhum outro atendente disponível.</p>';
|
||||
}
|
||||
} else {
|
||||
operatorsList.innerHTML = `<p style="color: #e74c3c; padding: 20px; text-align: center;">${response.message || 'Erro ao carregar atendentes.'}</p>`;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
closeForward.addEventListener('click', () => {
|
||||
forwardView.style.display = 'none';
|
||||
});
|
||||
|
||||
logoutButton.addEventListener('click', () => {
|
||||
window.electronAPI.logoutApp();
|
||||
|
|
@ -219,9 +376,10 @@ saveButton.addEventListener('click', () => {
|
|||
localStorage.removeItem('atendimentoAtualNome');
|
||||
window.electronAPI.atendimentoFinalizado();
|
||||
|
||||
// Limpa o travamento
|
||||
calledAtendimentoData = null;
|
||||
|
||||
window.electronAPI.saveObservation({ itemId: selectedItemId, observation: observation });
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
// Inicialmente, mostra a view da lista (estará vazia até receber dados)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"autostart": false
|
||||
}
|
||||
658
style.css
658
style.css
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
/* Estilos Gerais */
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
color: #FFF;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
|
|
@ -125,16 +125,465 @@ body#floating{
|
|||
}
|
||||
|
||||
|
||||
/* Janela Principal */
|
||||
#list-view, #obs-view {
|
||||
/* ================================================
|
||||
NOVO LAYOUT: Tela de Atendimento Redesenhada
|
||||
================================================ */
|
||||
|
||||
#list-view {
|
||||
padding: 16px;
|
||||
background-color: var(--primary-color);
|
||||
height: 96vh;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#obs-view {
|
||||
padding: 20px;
|
||||
background-color: var(--secondary-color); /* Fundo branco para a janela principal */
|
||||
background-color: var(--secondary-color);
|
||||
border-radius: var(--border-radius);
|
||||
box-shadow: var(--box-shadow);
|
||||
height: 96vh; /* Ocupa a altura da viewport */
|
||||
height: 96vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.attendance-layout {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* PAINEL ESQUERDO: Tabela da fila */
|
||||
.queue-panel {
|
||||
flex: 1.6;
|
||||
background-color: rgba(11, 44, 80, 0.4);
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.panel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.panel-header h2 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.queue-badge {
|
||||
background: var(--info-color);
|
||||
color: white;
|
||||
padding: 2px 10px;
|
||||
border-radius: 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
min-width: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.queue-table-wrapper {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Tabela da fila */
|
||||
.queue-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.queue-table thead th {
|
||||
padding: 10px 20px;
|
||||
text-align: left;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: rgba(11, 44, 80, 0.95);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.queue-table tbody tr {
|
||||
transition: background-color 0.2s ease;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
.queue-table tbody tr:hover {
|
||||
background-color: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.queue-table tbody td {
|
||||
padding: 12px 20px;
|
||||
font-size: 13px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.ticket-cell {
|
||||
font-weight: 700;
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
.ticket-normal {
|
||||
color: var(--light-info-color) !important;
|
||||
}
|
||||
|
||||
.ticket-preferencial {
|
||||
color: var(--warning-color) !important;
|
||||
}
|
||||
|
||||
.type-normal {
|
||||
color: rgba(255, 255, 255, 0.5) !important;
|
||||
font-size: 11px !important;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.type-preferencial {
|
||||
color: var(--warning-color) !important;
|
||||
font-size: 11px !important;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.queue-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px;
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.queue-empty .empty-icon {
|
||||
font-size: 36px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.queue-empty p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
||||
/* PAINEL DIREITO: Card do atendimento atual */
|
||||
.current-card-panel {
|
||||
flex: 0.8;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.current-card {
|
||||
background: linear-gradient(145deg, rgba(11, 44, 80, 0.6), rgba(8, 30, 60, 0.8));
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
animation: cardFadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
@keyframes cardFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.card-ticket {
|
||||
font-size: 32px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.card-badge {
|
||||
padding: 4px 14px;
|
||||
border-radius: 16px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.badge-chamado {
|
||||
background: var(--warning-color);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.badge-atendendo {
|
||||
background: var(--success-color);
|
||||
color: #fff;
|
||||
animation: pulse-badge 1.5s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse-badge {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.7; }
|
||||
}
|
||||
|
||||
.card-body {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.card-client-name {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.card-service {
|
||||
font-size: 13px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
margin: 0;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.card-type {
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.35);
|
||||
margin: 4px 0 0 0;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.card-type.type-preferencial {
|
||||
color: var(--warning-color);
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.btn-recall {
|
||||
flex: 1;
|
||||
padding: 12px 16px;
|
||||
border: 2px solid var(--warning-color);
|
||||
background: transparent;
|
||||
color: var(--warning-color);
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
letter-spacing: 0.5px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.btn-recall:hover:not(:disabled) {
|
||||
background: var(--warning-color);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-recall:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-start {
|
||||
flex: 1;
|
||||
padding: 12px 16px;
|
||||
border: none;
|
||||
background: var(--info-color);
|
||||
color: #fff;
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
letter-spacing: 0.5px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.btn-start:hover:not(:disabled) {
|
||||
background: var(--light-info-color);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(41, 128, 185, 0.4);
|
||||
}
|
||||
|
||||
.btn-start:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.no-current-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
background: rgba(11, 44, 80, 0.2);
|
||||
border-radius: 12px;
|
||||
border: 1px dashed rgba(255, 255, 255, 0.1);
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
gap: 8px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.no-current-card .empty-icon {
|
||||
font-size: 36px;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.no-current-card p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.no-current-card small {
|
||||
font-size: 12px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
|
||||
/* Barra inferior */
|
||||
.bottom-bar {
|
||||
padding: 10px 0 0 0;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.btn-logout {
|
||||
padding: 8px 20px;
|
||||
background: transparent;
|
||||
border: 1px solid var(--danger-color);
|
||||
color: var(--danger-color);
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.btn-logout:hover {
|
||||
color: var(--white);
|
||||
background: var(--danger-color);
|
||||
}
|
||||
|
||||
|
||||
/* ================================================
|
||||
TELA DE OBSERVAÇÕES (Atendimento em andamento)
|
||||
================================================ */
|
||||
.obs-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.obs-header {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.obs-header h2 {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.obs-client-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.obs-client-name {
|
||||
font-size: 16px;
|
||||
color: var(--light-info-color);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
#observation-text {
|
||||
width: calc(100% - 22px) !important;
|
||||
padding: 10px;
|
||||
background-color: var(--secondary-color);
|
||||
border: 1px solid var(--tertiary-color);
|
||||
border-radius: 6px;
|
||||
color: var(--medium-gray);
|
||||
font-size: 14px;
|
||||
flex: 1;
|
||||
resize: vertical;
|
||||
min-height: 120px;
|
||||
}
|
||||
|
||||
#observation-text:focus-visible {
|
||||
box-shadow: var(--box-shadow-inputs);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.obs-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
.btn-finish {
|
||||
padding: 12px 28px;
|
||||
background: var(--warning-color);
|
||||
border: none;
|
||||
color: #fff;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.btn-finish:hover {
|
||||
background: var(--light-warning-color);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
|
||||
}
|
||||
|
||||
|
||||
/* ================================================
|
||||
ESTILOS LEGADOS (mantidos para outras telas)
|
||||
================================================ */
|
||||
|
||||
#item-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
|
|
@ -227,15 +676,6 @@ textarea {
|
|||
font-size: 16px;
|
||||
}
|
||||
|
||||
textarea#observation-text{
|
||||
width: calc(100% -20px) !important;
|
||||
padding: 10px;
|
||||
background-color: var(--secondary-color);
|
||||
border: 1px solid var(--tertiary-color);
|
||||
border-radius: 4px;
|
||||
color: var(--medium-gray);
|
||||
}
|
||||
|
||||
.error-message {
|
||||
background-color: #ffebee;
|
||||
color: #c62828;
|
||||
|
|
@ -263,10 +703,12 @@ button{
|
|||
}
|
||||
|
||||
#logout-button{
|
||||
color: var(--white);
|
||||
background-color: var(--danger-color);
|
||||
}
|
||||
|
||||
#logout-button:hover{
|
||||
color: var(--white);
|
||||
background-color: var(--dark-danger-color);
|
||||
}
|
||||
|
||||
|
|
@ -286,10 +728,12 @@ button{
|
|||
|
||||
|
||||
#sair-button{
|
||||
color: var(--white);
|
||||
background-color: #eb574d;
|
||||
}
|
||||
|
||||
#sair-button:hover{
|
||||
color: var(--white);
|
||||
background-color: #e93f2c;
|
||||
}
|
||||
|
||||
|
|
@ -301,3 +745,189 @@ button{
|
|||
#save-button:hover{
|
||||
background-color: var(--warning-color);
|
||||
}
|
||||
|
||||
/* Estilo do Switch */
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 60px;
|
||||
height: 34px;
|
||||
z-index: 1; /* Garante que o switch esteja acima de outros elementos */
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: var(--success-color);
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px var(--success-color);
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
/* width: 60px; */
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
|
||||
/* Scrollbar personalizada */
|
||||
.queue-table-wrapper::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.queue-table-wrapper::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.queue-table-wrapper::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.queue-table-wrapper::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
}
|
||||
.btn-forward {
|
||||
flex: 1;
|
||||
padding: 12px 16px;
|
||||
border: 2px solid #8e44ad;
|
||||
background: transparent;
|
||||
color: #8e44ad;
|
||||
border-radius: 8px;
|
||||
font-weight: 700;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-forward:hover:not(:disabled) {
|
||||
background: #8e44ad;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-forward:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Modal Forward styles */
|
||||
.modal-view {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background: var(--primary-color);
|
||||
width: 90%;
|
||||
max-width: 500px;
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--secondary-color);
|
||||
padding: 24px;
|
||||
box-shadow: 0 20px 40px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.modal-header h2 {
|
||||
color: var(--white);
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.btn-close {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--dark-gray);
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.operators-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
margin-top: 15px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.operator-item {
|
||||
background: var(--secondary-color);
|
||||
border: 1px solid var(--tertiary-color);
|
||||
padding: 15px;
|
||||
border-radius: 10px;
|
||||
color: var(--white);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
text-align: left;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.operator-item:hover {
|
||||
background: var(--medium-gold);
|
||||
border-color: var(--accent-gold);
|
||||
}
|
||||
|
||||
.highlight {
|
||||
color: var(--accent-gold);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue