Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
Pruebas-RTO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 93a15843
authored
2024-07-24 10:59:08 -0300
by
Tu Nombre
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Agrego historico
1 parent
6fcac8d7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
0 deletions
main.py
protected_static/historico.js
templates/form.html
templates/historico.html
main.py
View file @
93a1584
...
@@ -50,6 +50,25 @@ def main():
...
@@ -50,6 +50,25 @@ def main():
bypass
=
False
bypass
=
False
)
)
@app.route
(
'/protected_static/<path:filename>'
)
def
protected_static
(
filename
):
if
"login"
in
request
.
cookies
:
return
send_from_directory
(
'protected_static'
,
filename
)
else
:
return
abort
(
403
)
@app.route
(
'/historico'
)
def
historico
():
if
"login"
not
in
request
.
cookies
:
return
redirect
(
url_for
(
"login"
))
return
render_template
(
"historico.html"
,
bypass
=
False
)
@app.route
(
'/login'
,
methods
=
[
'GET'
,
'POST'
])
@app.route
(
'/login'
,
methods
=
[
'GET'
,
'POST'
])
def
login
():
def
login
():
if
request
.
method
==
"GET"
:
if
request
.
method
==
"GET"
:
...
...
protected_static/historico.js
0 → 100644
View file @
93a1584
function
CargarLista
()
{
const
requestData
=
{
"token"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"url"
:
"https://hgt.hgt.com.ar/api_rto/diaria"
,
"clear"
:
true
,
"params"
:
{
"ApiKey"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"id_cent"
:
"50"
}
};
fetch
(
'https://api.hgt.com.ar/redirect'
,
{
method
:
'POST'
,
headers
:
{
'Accept'
:
'application/json'
,
"Content-Type"
:
"application/json"
},
body
:
JSON
.
stringify
(
requestData
)
})
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
createHistoricoList
(
data
);
})
.
catch
(
error
=>
{
console
.
error
(
'Error:'
,
error
);
});
};
// Function to create the list items
function
createHistoricoList
(
data
)
{
const
historicoDiv
=
document
.
getElementById
(
'div_historico'
);
historicoDiv
.
innerHTML
=
""
;
//historicoDiv.innerText = "Dominios del dia"
data
.
inspecciones
.
forEach
(
inspeccion
=>
{
const
button
=
document
.
createElement
(
'button'
);
button
.
className
=
'PDFButton'
;
button
.
id
=
inspeccion
.
name
;
button
.
textContent
=
'Ir dominio '
;
const
div
=
document
.
createElement
(
'div'
);
//div.textContent = inspeccion.name + " " + inspeccion.resultado + " " + inspeccion.fecha + " ";
const
titulo
=
document
.
createElement
(
'H4'
);
titulo
.
textContent
=
inspeccion
.
name
+
" "
+
inspeccion
.
resultado
;
const
ftl
=
document
.
createElement
(
'H6'
);
ftl
.
textContent
=
"Linea "
+
inspeccion
.
linea
+
", Planilla "
+
inspeccion
.
numeroplanilla
+
", Categoria "
+
inspeccion
.
categoria
;
div
.
appendChild
(
titulo
);
div
.
appendChild
(
ftl
);
div
.
appendChild
(
button
);
const
separador
=
document
.
createElement
(
'hr'
)
separador
.
className
=
'custom-hr'
;
historicoDiv
.
appendChild
(
div
);
historicoDiv
.
appendChild
(
separador
);
});
}
const
chatUrl
=
'https://api.hgt.com.ar/poll/rto_50_update/dewfrfgbeolkgkteprlk,hptrlk,hqff'
;
let
pendingRequests
=
0
;
async
function
fetchChat
()
{
const
MensajeDiv
=
document
.
getElementById
(
'DivMensajeFijo'
);
const
MensajeCaida
=
"Se perdio contacto con el server, revise conexcion a internet"
MensajeDiv
.
innerText
=
"Escuchando novedades"
while
(
true
)
{
try
{
const
response
=
await
fetch
(
chatUrl
);
const
data
=
await
response
.
json
();
if
(
data
.
proccess
===
true
)
{
CargarLista
();
MensajeDiv
.
innerText
=
"Lista Actualizada al "
+
data
.
tiempo
}
if
(
MensajeDiv
.
innerText
==
MensajeCaida
)
{
MensajeDiv
.
innerText
=
"Se recupero conixion al server, Esperando novedades, o recarge la pagina"
}
}
catch
(
error
)
{
MensajeDiv
.
innerText
=
MensajeCaida
;
// Si ocurre un error, esperamos 5 segundos antes de volver a intentarlo
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
5000
));
}
}
}
window
.
addEventListener
(
'load'
,
()
=>
{
CargarLista
();
fetchChat
();
});
templates/form.html
View file @
93a1584
...
@@ -192,6 +192,10 @@
...
@@ -192,6 +192,10 @@
<button
class=
"PDFButton"
onclick=
"collectToSearch('data')"
>
<button
class=
"PDFButton"
onclick=
"collectToSearch('data')"
>
Ticket Fosa
Ticket Fosa
</button>
</button>
<button
class=
"PDFButton"
onclick=
"location.href='/historico'"
>
Historico
</button>
</div>
</div>
<button
class=
"PDFButton loginB"
onclick=
"location.href='/login'"
>
<button
class=
"PDFButton loginB"
onclick=
"location.href='/login'"
>
...
...
templates/historico.html
0 → 100755
View file @
93a1584
<html
lang=
"es"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<link
rel=
"stylesheet"
href=
"{{ url_for('static', filename = 'styles/general.css') }}"
>
<script
src=
"/protected_static/historico.js"
></script>
<!--INCLUIMOS LA FUENTE
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cmu-typewriter" type="text/css" />
-->
<title>
Pruebas de Alineamiento
</title>
<style>
.custom-hr
{
border
:
none
;
border-top
:
1px
solid
#000
;
/* Personaliza el color y grosor aquí */
width
:
66.67%
;
/* Dos tercios del ancho de la página */
margin
:
20px
0
;
/* Ajusta el espacio alrededor de la línea aquí */
margin-left
:
0
;
/* Alinea la línea al inicio (izquierda) */
}
</style>
</head>
<body>
<div
>
<div
class=
"MessageFixed"
id=
"DivMensajeFijo"
>
Los datos con signo de pregunta '?' son datos no encontrados o faltantes.
<br>
Pueden ser completados a mano antes de convertir a PDF.
<br>
De no ser completados, se completaran automáticamente con el valor del campo 'Por defecto' al final de la página.
</div>
<div
class=
"DataCard"
id=
"div_historico"
>
</div>
<div
class=
"PDFButtonContainerFixed"
>
<h3>
Dominios del dia
</h3>
<button
class=
"PDFButton"
onclick=
"location.href='/'"
>
Carga
</button>
</div>
</div>
<div
id=
"message"
class=
"MessageContainer"
onclick=
"this.style.display = 'none'"
style=
"display: none;"
>
<div
class=
"Message"
style=
"text-align: center;"
>
<p
id =
"msg"
></p>
<span
class =
"X"
>
x
<span>
</div>
</div>
</body>
</html>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment