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 e5bc68be
authored
2024-11-03 14:15:12 -0300
by
Tu Nombre
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Guardado de snaper
1 parent
4e1e29ea
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
7 deletions
protected_static/historico.js
protected_static/snaper.js
static/src/carbone.js
protected_static/historico.js
View file @
e5bc68b
function
CargarLista
()
{
//API KET
const
requestData
=
{
"token"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"url"
:
"https://hgt.hgt.com.ar/api_rto/diaria"
,
...
...
protected_static/snaper.js
View file @
e5bc68b
...
...
@@ -5,20 +5,23 @@ window.allFieldsToJson = function allFieldsToJson() {
fields
.
forEach
(
field
=>
{
const
key
=
field
.
name
;
// || field.id; // Usa el nombre del campo, o su ID si no tiene nombre
const
value
=
field
.
value
;
const
ignorar
=
[
"?"
,
""
,
"---"
,
false
,
"-"
,]
if
(
!
ignorar
.
includes
(
value
)){
// Si la clave ya existe (por ejemplo, en caso de checkboxes o radios con el mismo nombre)
if
(
data
.
hasOwnProperty
(
key
))
{
if
(
Array
.
isArray
(
data
[
key
]))
{
data
[
key
].
push
(
value
);
}
else
{
data
[
key
]
=
[
data
[
key
],
value
];
}
//
if (Array.isArray(data[key])) {
//
data[key].push(value);
//
} else {
//
data[key] = [data[key], value];
//
}
}
else
{
data
[
key
]
=
value
;
}
}
});
return
JSON
.
stringify
(
data
);
//return JSON.stringify(data);
return
data
;
}
window
.
populateFieldsFromJson
=
function
populateFieldsFromJson
(
data
)
{
...
...
@@ -65,3 +68,44 @@ window.watchForChanges = function watchForChanges() {
});
}
window
.
Snapeador
=
function
Sanapeador
(){
const
valor
=
document
.
getElementById
(
'snapear'
).
value
;
if
(
valor
===
"0"
){
return
;
}
const
data
=
allFieldsToJson
()
this
.
SubirSnap
(
data
)
document
.
getElementById
(
'snapear'
).
value
=
0
}
function
SubirSnap
(
data
)
{
//API KET
const
requestData
=
{
"token"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
//"url": "https://hgt.hgt.com.ar/api_rto/snaper",
"url"
:
"https://validacion.hgtsa.com.ar/api_rto/snaper"
,
"clear"
:
true
,
"params"
:
{
"ApiKey"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"id_cent"
:
"61"
,
"data_snap"
:
data
}
};
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
);
});
};
static/src/carbone.js
View file @
e5bc68b
...
...
@@ -21,7 +21,9 @@ function agregarCampoAObjetoID(nombreCampo,reportCampo, objeto) {
function
Reportar
(){
///ACA hay que determinar el template
const
template
=
document
.
getElementById
(
'ReporteInspeccion'
);
window
.
Snapeador
();
generarReporteTemplate
(
template
.
value
)
}
function
generarReporteTemplate
(
template
)
{
...
...
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