Painel de configuração - Primeiras modificações
This commit is contained in:
parent
e0b6eff1b9
commit
35a38a521a
|
|
@ -5,6 +5,7 @@ body {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: fonteTi;
|
font-family: fonteTi;
|
||||||
src: url(../../Acessts/Fontes/zekton\ rg.otf);
|
src: url(../../Acessts/Fontes/zekton\ rg.otf);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
height: 70vh;
|
height: 70vh;
|
||||||
background-color: var(--Cor_Segundaria_5_1);
|
background-color: var(--Cor_Segundaria_5_1);
|
||||||
box-shadow: 10px 10px 0px var(--Cor_Segundaria_5_2);
|
box-shadow: 10px 10px 0px var(--Cor_Segundaria_5_2);
|
||||||
animation: surgirpopupcenter 1s ease;
|
animation: surgirpopupcenter 0.5s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes surgirpopupcenter {
|
@keyframes surgirpopupcenter {
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,75 @@
|
||||||
function verificarAmbiente() {
|
async function respostaServer() {
|
||||||
var main = document.getElementById("entrada_1");
|
// Função para obter a URL base da API
|
||||||
const tela_laod = document.getElementById('entrada_2');
|
async function getApiUrl() {
|
||||||
let elemento_1;
|
try {
|
||||||
let elemento_2;
|
const response = await fetch('../../../Sites/Site_ItGuys/php/config_url.php');
|
||||||
|
if (!response.ok) {
|
||||||
if (main.innerHTML.trim() === "") {
|
throw new Error('Network response was not ok');
|
||||||
elemento_1 = 'Estamos carregando sua página';
|
}
|
||||||
} else {
|
const data = await response.json();
|
||||||
elemento_1 = 'Algo foi encontrado mas estamos preparando';
|
return data.apiUrl;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching API URL:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elemento_2 = '<canvas id="animationCanvas"></canvas>';
|
// Função para obter o token do localStorage
|
||||||
tela_laod.innerHTML = '<div class="teste"><h1>' + elemento_1 + '</h1>' + elemento_2 + '</div>';
|
function getAuthToken() {
|
||||||
|
return localStorage.getItem('x-access-token');
|
||||||
|
}
|
||||||
|
|
||||||
// Inicia a animação após configurar o canvas
|
// Obtenha a URL da API e o token
|
||||||
iniciarAnimacao();
|
const apiUrl = await getApiUrl();
|
||||||
|
const token = getAuthToken();
|
||||||
|
|
||||||
// Inicia a contagem para limpar a tela após 3 segundos
|
return { apiUrl, token }; // Retorne os valores
|
||||||
finalizar();
|
}
|
||||||
|
|
||||||
|
// Função para verificar o ambiente do usuário
|
||||||
|
async function verificarAmbiente() {
|
||||||
|
try {
|
||||||
|
const { apiUrl, token } = await respostaServer(); // Desestruture a resposta
|
||||||
|
|
||||||
|
const response = await fetch(`${apiUrl}/mounting`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'x-access-token': token || '' // Use um fallback para token
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Erro na requisição: ' + response.statusText);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
const nameuser = data.usuario.nome || 'Visitante'; // Fallback caso o nome não esteja definido
|
||||||
|
const primeiroNomeuser = nameuser.split(' ')[0].substring(0, 10);
|
||||||
|
|
||||||
|
const main = document.getElementById("entrada_1");
|
||||||
|
const tela_laod = document.getElementById('entrada_2');
|
||||||
|
|
||||||
|
let elemento_1;
|
||||||
|
let elemento_2;
|
||||||
|
|
||||||
|
if (main.innerHTML.trim() === "") {
|
||||||
|
elemento_1 = 'Estamos carregando sua página';
|
||||||
|
} else {
|
||||||
|
elemento_1 = 'Seja bem-vindo, ' + primeiroNomeuser; // Corrigido para concatenar corretamente
|
||||||
|
}
|
||||||
|
|
||||||
|
elemento_2 = '<canvas id="animationCanvas"></canvas>';
|
||||||
|
tela_laod.innerHTML = '<div class="teste"><h1>' + elemento_1 + '</h1>' + elemento_2 + '</div>';
|
||||||
|
|
||||||
|
// Inicia a animação após configurar o canvas
|
||||||
|
iniciarAnimacao();
|
||||||
|
|
||||||
|
// Inicia a contagem para limpar a tela após 3 segundos
|
||||||
|
finalizar();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao verificar o ambiente:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function finalizar() {
|
function finalizar() {
|
||||||
|
|
@ -50,10 +102,12 @@ function iniciarAnimacao() {
|
||||||
circle.linePath.push({ x: pathX, y: pathY });
|
circle.linePath.push({ x: pathX, y: pathY });
|
||||||
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
for (let i = 0; i < circle.linePath.length - 1; i++) {
|
circle.linePath.forEach((point, i) => {
|
||||||
ctx.moveTo(circle.linePath[i].x, circle.linePath[i].y);
|
if (i > 0) {
|
||||||
ctx.lineTo(circle.linePath[i + 1].x, circle.linePath[i + 1].y);
|
ctx.moveTo(circle.linePath[i - 1].x, circle.linePath[i - 1].y);
|
||||||
}
|
ctx.lineTo(point.x, point.y);
|
||||||
|
}
|
||||||
|
});
|
||||||
ctx.strokeStyle = '#22c0a3';
|
ctx.strokeStyle = '#22c0a3';
|
||||||
ctx.lineWidth = 10;
|
ctx.lineWidth = 10;
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
|
||||||
|
|
@ -1,66 +1,123 @@
|
||||||
const Data_Center = {
|
async function respostaServer_data() {
|
||||||
Ser_User: {},
|
// Função para obter a URL base da API
|
||||||
Ser_Itguys: {}
|
async function getApiUrl() {
|
||||||
};
|
try {
|
||||||
|
const response = await fetch('../../../Sites/Site_ItGuys/php/config_url.php');
|
||||||
const permissa_User = true;
|
if (!response.ok) {
|
||||||
|
throw new Error('Network response was not ok');
|
||||||
if (permissa_User === true) {
|
}
|
||||||
Data_Center.Ser_User = {
|
const data = await response.json();
|
||||||
resetar_senha: {
|
return data.apiUrl;
|
||||||
nome: 'Resetar senha',
|
} catch (error) {
|
||||||
Imagem: '../../Acessts/Imagens/Iconis/ferramentas.png',
|
console.error('Error fetching API URL:', error);
|
||||||
id_server: 'serv_gat_2',
|
throw error;
|
||||||
resposta_popup: '<h1>Olá do Resetar Senha!</h1>',
|
|
||||||
resposta_script: `console.log('Script para Resetar Senha');`,
|
|
||||||
resposta_estilo: `document.body.style.backgroundColor = '#f0f0f0';`
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
// Função para obter o token do localStorage
|
||||||
|
function getAuthToken() {
|
||||||
|
return localStorage.getItem('x-access-token');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtenha a URL da API e o token
|
||||||
|
const apiUrl = await getApiUrl();
|
||||||
|
const token = getAuthToken();
|
||||||
|
|
||||||
|
return { apiUrl, token }; // Retorne os valores
|
||||||
}
|
}
|
||||||
|
|
||||||
const permissa_Itguys = true;
|
// Função para verificar o ambiente do usuário
|
||||||
|
async function verificarAmbiente() {
|
||||||
|
try {
|
||||||
|
const { apiUrl, token } = await respostaServer_data(); // Desestruture a resposta
|
||||||
|
|
||||||
if (permissa_Itguys === true) {
|
const response = await fetch(`${apiUrl}/mounting`, {
|
||||||
Data_Center.Ser_Itguys = {
|
method: 'GET',
|
||||||
Gerador_de_arquivos_telefonia: {
|
headers: {
|
||||||
nome: 'Configurador de Telefonia',
|
'Content-Type': 'application/json',
|
||||||
Imagem: '../../Acessts/Imagens/Iconis/ferramentas.png',
|
'x-access-token': token || '' // Use um fallback para token
|
||||||
id_server: 'serv_gat_1',
|
}
|
||||||
resposta_popup: `
|
});
|
||||||
<form id="form" class='control'>
|
|
||||||
|
|
||||||
<div class='formulario'>
|
if (!response.ok) {
|
||||||
<label for="mac_equipamento">MAC Equipamento:</label>
|
throw new Error('Erro na requisição: ' + response.statusText);
|
||||||
<input type="text" id="mac_equipamento" name="mac_equipamento" required><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='formulario'>
|
|
||||||
<label for="nome_cliente">Nome do Cliente:</label>
|
|
||||||
<input type="text" id="nome_cliente" name="nome_cliente" required><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='formulario'>
|
|
||||||
<div class='formulario'></div>
|
|
||||||
<label for="nome_setor">Nome do Setor:</label>
|
|
||||||
<input type="text" id="nome_setor" name="nome_setor" required><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='formulario'>
|
|
||||||
<label for="usuario_sip">Usuário SIP:</label>
|
|
||||||
<input type="text" id="usuario_sip" name="usuario_sip" required><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='formulario'>
|
|
||||||
<label for="senha_sip">Senha SIP:</label>
|
|
||||||
<input type="password" id="senha_sip" name="senha_sip" required><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='formulario'>
|
|
||||||
<button type="button" onclick="gerarArquivo()">Gerar Arquivo</button>
|
|
||||||
</div>
|
|
||||||
</form>`,
|
|
||||||
resposta_script: '../js/Ambiente/Service/List/Gerador_XML_Telefonia.js',
|
|
||||||
resposta_estilo: `.control {width: 100%;display: flex;flex-direction: column;justify-content: center;align-content: center;align-items: center;}.formulario {width: 80%;display: flex;flex-direction: column;animation: surgirpopup 1s ease;}@keyframes surgirpopup {to {opacity: 1;transform: translateY(0);}from {opacity: 0;transform: translateY(40vw);}}.formulario input {border:none;outline: none;background: none;background-color: var(--Matriz);border: 0.2vw solid var(--Cor_Segundaria_2_1);box-shadow: 5px 5px 0px 2px var(--Cor_Segundaria_2_2);font-family: var(--font_titulo);font-size: 0.9vw;color: var(--Cor_Segundaria_2_1);padding-left: 1vw;padding-right: 1vw;width: 100%;height: 3vh;}.formulario label {font-family: var(--font_titulo);font-size: 1vw;color: var(--Matriz);}.formulario button {border: none;outline: none;background: none;font-family: var(--font_titulo);font-size: 1vw;color: var(--Matriz);background-color: #c6c6c6;box-shadow: -5px 5px 0px #9a9a9a;transition: 1s ease;width: 8vw;height: 4vh;}.formulario button:hover {background-color: var(--Cor_Segundaria_2_1);box-shadow: 5px 5px 0px var(--Cor_Segundaria_2_2);};`
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
const data = await response.json(); // Mover para cá após a verificação de resposta
|
||||||
|
const nameempresa = data.empresa.nome || 'Empresa Desconhecida'; // Fallback
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
const Data_Center = {
|
||||||
|
Ser_User: {},
|
||||||
|
Ser_Itguys: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const permissa_User = true;
|
||||||
|
const permissa_Itguys = true;
|
||||||
|
|
||||||
|
if (permissa_User) {
|
||||||
|
Data_Center.Ser_User = {
|
||||||
|
resetar_senha: {
|
||||||
|
nome: 'Resetar senha',
|
||||||
|
Imagem: '../../Acessts/Imagens/Iconis/ferramentas.png',
|
||||||
|
id_server: 'serv_gat_2',
|
||||||
|
resposta_popup: '<h1>Olá do Resetar Senha!</h1>',
|
||||||
|
resposta_script: `console.log('Script para Resetar Senha');`,
|
||||||
|
resposta_estilo: `document.body.style.backgroundColor = '#f0f0f0';`
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (permissa_Itguys) {
|
||||||
|
Data_Center.Ser_Itguys = {
|
||||||
|
Gerador_de_arquivos_telefonia: {
|
||||||
|
nome: 'Configurador de Telefonia',
|
||||||
|
Imagem: '../../Acessts/Imagens/Iconis/ferramentas.png',
|
||||||
|
id_server: 'serv_gat_1',
|
||||||
|
resposta_popup: `
|
||||||
|
<form id="form" class='control'>
|
||||||
|
<div class='formulario'>
|
||||||
|
<h2>Preencha o Formulario</h2>
|
||||||
|
</div>
|
||||||
|
<div class='formulario'>
|
||||||
|
<label for="mac_equipamento">MAC Equipamento:</label>
|
||||||
|
<input type="text" id="mac_equipamento" name="mac_equipamento" required><br>
|
||||||
|
</div>
|
||||||
|
<div class='formulario'>
|
||||||
|
<label for="nome_cliente">Nome do Cliente:</label>
|
||||||
|
<input type="text" id="nome_cliente" name="nome_cliente" required><br>
|
||||||
|
</div>
|
||||||
|
<div class='formulario'>
|
||||||
|
<label for="nome_setor">Nome do Setor:</label>
|
||||||
|
<input type="text" id="nome_setor" name="nome_setor" required><br>
|
||||||
|
</div>
|
||||||
|
<div class='formulario'>
|
||||||
|
<label for="usuario_sip">Usuário SIP:</label>
|
||||||
|
<input type="text" id="usuario_sip" name="usuario_sip" required><br>
|
||||||
|
</div>
|
||||||
|
<div class='formulario'>
|
||||||
|
<label for="senha_sip">Senha SIP:</label>
|
||||||
|
<input type="password" id="senha_sip" name="senha_sip" required><br>
|
||||||
|
</div>
|
||||||
|
<div class='formulario'>
|
||||||
|
<button type="button" onclick="gerarArquivo()">Gerar Arquivo</button>
|
||||||
|
</div>
|
||||||
|
</form>`,
|
||||||
|
resposta_script: '../js/Ambiente/Service/List/Gerador_XML_Telefonia.js',
|
||||||
|
resposta_estilo: `.control {width: 100%; display: flex; flex-direction: column; justify-content: center; align-content: center; align-items: center;}
|
||||||
|
.formulario {width: 80%; display: flex; flex-direction: column; animation: surgirpopup 0.8s ease;}
|
||||||
|
@keyframes surgirpopup {to {opacity: 1; transform: translateY(0);} from {opacity: 0; transform: translateY(40vw);}}
|
||||||
|
.formulario input {border:none; outline: none; background: none; background-color: var(--Matriz); border: 0.2vw solid var(--Cor_Segundaria_2_1); box-shadow: 5px 5px 0px 2px var(--Cor_Segundaria_2_2); font-family: var(--font_titulo); font-size: 0.9vw; color: var(--Cor_Segundaria_2_1); padding-left: 1vw; padding-right: 1vw; width: 100%; height: 3vh;}
|
||||||
|
.formulario label {font-family: var(--font_titulo); font-size: 1vw; color: var(--Matriz);}
|
||||||
|
.formulario button {border: none; outline: none; background: none; font-family: var(--font_titulo); font-size: 1vw; color: var(--Matriz); background-color: #c6c6c6; box-shadow: -5px 5px 0px #9a9a9a; transition: 1s ease; width: 8vw; height: 4vh;}
|
||||||
|
.formulario button:hover {background-color: var(--Cor_Segundaria_2_1); box-shadow: 5px 5px 0px var(--Cor_Segundaria_2_2);}
|
||||||
|
.formulario h2 {font-family: var(--font_titulo); text-align:center; font-size: 2vw; color: var(--Matriz);}`
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao verificar o ambiente:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue