You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
7.0 KiB
193 lines
7.0 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Interfaz de Servicio</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 20px;
|
|
padding: 20px;
|
|
background-color: #f4f4f9;
|
|
}
|
|
.container {
|
|
max-width: 600px;
|
|
margin: auto;
|
|
padding: 20px;
|
|
background: #fff;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
}
|
|
.logo {
|
|
position: absolute;
|
|
top: 10px;
|
|
right: 20px;
|
|
width: 150px;
|
|
height: auto;
|
|
}
|
|
.logoS {
|
|
position: absolute;
|
|
top: 30px;
|
|
left: 20px;
|
|
width: 150px;
|
|
height: auto;
|
|
}
|
|
h1 {
|
|
text-align: center;
|
|
color: #333;
|
|
}
|
|
label {
|
|
margin-bottom: 10px;
|
|
display: block;
|
|
font-weight: bold;
|
|
}
|
|
input, button, textarea {
|
|
width: 100%;
|
|
margin-bottom: 15px;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
box-sizing: border-box;
|
|
}
|
|
button {
|
|
background-color: #007bff;
|
|
color: #fff;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Control de Servicio</h1>
|
|
<img src="Logo_sian_all.png" alt="Logo de la Empresa" class="logo">
|
|
<img src="SAPIANLOGO.png" alt="Logo de la Empresa" class="logoS">
|
|
<!-- Campo de rango de cumplimiento -->
|
|
<label for="complianceRange">Rango de Cumplimiento</label>
|
|
<textarea id="complianceRange" rows="4" placeholder="Ingresa los parametros para la clasificación de las llamadas"></textarea>
|
|
<button id="sendButton">Enviar</button>
|
|
|
|
<!-- prompt de backoffice -->
|
|
<label for="backoffice">Prompt Backoffice</label>
|
|
<textarea id="backoffice" rows="4" placeholder="Ingresa los parámetros que quieres conocer de las llamadas del mes"></textarea>
|
|
<button id="sendBack">Enviar</button>
|
|
|
|
<!-- Campo para BackOffice del mes -->
|
|
<label for="monthInput">BackOffice del mes</label>
|
|
<input type="number" id="monthInput" min="1" max="12" placeholder="Ingrese un número del 1 al 12">
|
|
<button id="generateButton">Generar</button>
|
|
</div>
|
|
|
|
<script>
|
|
// Función para cargar datos iniciales
|
|
function loadInitialData() {
|
|
fetch('http://resumen-sapian-cctel-02.dialbox.cloud:5024/get_initial_data')
|
|
.then(response => {
|
|
if (response.ok) {
|
|
return response.json();
|
|
} else {
|
|
throw new Error('Error al obtener los datos iniciales');
|
|
}
|
|
})
|
|
.then(data => {
|
|
// Establecer valores en los campos del HTML
|
|
document.getElementById('complianceRange').value = data.rango_cumplimiento || "";
|
|
document.getElementById('backoffice').value = data.promt_back || "";
|
|
alert('Datos cargados correctamente.');
|
|
})
|
|
.catch(error => {
|
|
console.error('Error al cargar los datos iniciales:', error);
|
|
alert('Error al cargar los datos iniciales.');
|
|
});
|
|
}
|
|
|
|
// Llamar a la función al cargar la página
|
|
document.addEventListener('DOMContentLoaded', loadInitialData);
|
|
|
|
// Enviar rango de cumplimiento
|
|
document.getElementById('sendButton').addEventListener('click', function () {
|
|
const complianceText = document.getElementById('complianceRange').value;
|
|
fetch('http://resumen-sapian-cctel-02.dialbox.cloud:5021/rango_cumplimiento', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ text: complianceText })
|
|
}).then(response => {
|
|
if (response.ok) {
|
|
alert('Rango de cumplimiento guardado correctamente.');
|
|
} else {
|
|
response.text().then(text => {
|
|
alert(`Error al guardar el rango de cumplimiento: ${text}`);
|
|
});
|
|
}
|
|
}).catch(error => {
|
|
console.error('Error de red:', error);
|
|
alert('No se pudo conectar al servidor.');
|
|
});
|
|
});
|
|
|
|
// Enviar prompt backoffice
|
|
document.getElementById('sendBack').addEventListener('click', function () {
|
|
const complianceText = document.getElementById('backoffice').value;
|
|
fetch('http://resumen-sapian-cctel-02.dialbox.cloud:5022/pront_back', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ text: complianceText })
|
|
}).then(response => {
|
|
if (response.ok) {
|
|
alert('Prompt guardado correctamente.');
|
|
} else {
|
|
response.text().then(text => {
|
|
alert(`Error al guardar el prompt: ${text}`);
|
|
});
|
|
}
|
|
}).catch(error => {
|
|
console.error('Error de red:', error);
|
|
alert('No se pudo conectar al servidor.');
|
|
});
|
|
});
|
|
|
|
// Generar archivo para el mes
|
|
document.getElementById('generateButton').addEventListener('click', function () {
|
|
const month = document.getElementById('monthInput').value;
|
|
alert('el mes seleccionado es' + month);
|
|
|
|
if (month < 1 || month > 12) {
|
|
alert('Por favor, ingrese un mes válido entre 1 y 12.');
|
|
return;
|
|
}
|
|
|
|
fetch('http://resumen-sapian-cctel-02.dialbox.cloud:5000/execute_script', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ month: month })
|
|
})
|
|
.then(response => {
|
|
if (response.ok) {
|
|
const url = `http://resumen-sapian-cctel-02.dialbox.cloud/back_de_mes_sapian_2024-${month}.html`;
|
|
alert(`Se generó el resumen en: ${url}`);
|
|
} else {
|
|
response.text().then(text => {
|
|
alert(`Error al ejecutar el script: ${text}`);
|
|
});
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error('Error de red:', error);
|
|
alert('No se pudo conectar al servidor.');
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|