{
return parseInt(act);
}),
files: request.files,
answers: request.answers,
pua: request.tPlot.pua,
Zone: request.tPlot.zone,
bromatology_flag: request.bromatology_flag,
state_resolute: "Suelo",
};
request.person.cuit = request.person.cuit;
request.person.cel_phone =
"" + request.person.cel_phone_cod + request.person.cel_phone_num;
request.person.phone = "" + request.person.phone_cod + request.person.phone_num;
request.person.cel_phone =
parseInt(request.person.cel_phone.replaceAll(" ", "")) || 0;
request.person.phone = parseInt(request.person.phone.replaceAll(" ", "")) || 0;
delete request.person["cel_phone_cod"];
delete request.person["cel_phone_num"];
delete request.person["phone_cod"];
delete request.person["phone_num"];
fetch("hsolicitudes-hc.cc.gob.ar/api/persons", {
method: "POST",
headers: {
"Content-Type": "application/json;charset=utf-8",
},
body: JSON.stringify({ data: request.person }),
})
.then((responsePerson) => responsePerson.json())
.then((json) => {
req.person = json.data.id;
if (request.juridic) {
request.juridic_person.cuit = request.juridic_person.cuit;
fetch("hsolicitudes-hc.cc.gob.ar/api/juridic-persons", {
method: "POST",
headers: {
"Content-Type": "application/json;charset=utf-8",
},
body: JSON.stringify({ data: request.juridic_person }),
})
.then((response) => response.json())
.then((jsonresp) => {
req.juridic_person = jsonresp.data.id;
console.log(reg)
fetch("hsolicitudes-hc.cc.gob.ar/api/requests", {
method: "POST",
headers: {
"Content-Type": "application/json;charset=utf-8",
},
body: JSON.stringify({ data: req }),
})
.then((response) => response.json())
.then((jsonreq) => {
request.id = jsonreq.data.id;
console.log(request.id);
step++;
});
});
} else {
console.log(req)
fetch("hsolicitudes-hc.cc.gob.ar/api/requests", {
method: "POST",
headers: {
"Content-Type": "application/json;charset=utf-8",
},
body: JSON.stringify({ data: req }),
})
.then((response) => response.json())
.then((jsonreq) => {
request.id = jsonreq.data.id;
request.code = request.person.cuit+""+request.id.toLocaleString("en-US", {minimumIntegerDigits: 6, useGrouping: false})
console.log(request.id);
request.createdAt= jsonreq.data.attributes.createdAt
step++;
});
}
});
' class="btn btn-success" value="enviar">
Enviar