tengo que arreglar el tema de los streams
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
import ModalAddGarantes from "../Componentes/ModalAddGarantes.svelte";
|
||||
import ModalCheckYContrato from "../Componentes/ModalCheckYContrato.svelte";
|
||||
import { self } from "svelte/legacy";
|
||||
import ModalVeryAceptarContrato from "../Componentes/ModalVeryAceptarContrato.svelte";
|
||||
import { getRequest } from "@sveltejs/kit/node";
|
||||
|
||||
const token = sessionStorage.getItem("token");
|
||||
let mensajes: MensajeDto[] = $state([]);
|
||||
@@ -122,6 +124,11 @@
|
||||
obtenerListaGarantes(idcontrato);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mensaje.accion === "Aceptar Contrato") {
|
||||
Selmens = {...mensaje};
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async function obtenerListaGarantes(idcontrato: number) {
|
||||
@@ -253,6 +260,7 @@
|
||||
} else {
|
||||
SinLeer();
|
||||
}
|
||||
Selmens.accion = "";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,22 +276,59 @@
|
||||
let formdata = new FormData();
|
||||
formdata.append("idcontrato", idcontrato);
|
||||
formdata.append("contrato", file);
|
||||
formdata.append("ubicarnotificacion", Selmens.fecha);
|
||||
try{
|
||||
const responce = await fetch("", {
|
||||
const responce = await fetch($urlG+"/api/contratos/subirContrato", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
},
|
||||
body: formdata,
|
||||
});
|
||||
if () {
|
||||
|
||||
if (responce.ok) {
|
||||
let data = await responce.json();
|
||||
modaldata = data.message;
|
||||
if (mostrarleidos) {
|
||||
Leidos();
|
||||
} else {
|
||||
SinLeer();
|
||||
}
|
||||
return;
|
||||
}
|
||||
let data = await responce.json();
|
||||
modaldata = data.message;
|
||||
return;
|
||||
}catch{
|
||||
modaldata="Fallo al intentar hacer la request";
|
||||
}
|
||||
}
|
||||
|
||||
async function ObtenerContrato(idcontrato: number) {
|
||||
if (Selmens.accion != "Aceptar Contrato") {
|
||||
modaldata = "Hay algo mal comunicate con el administrador";
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const responce = await fetch($urlG+"/api/contrato/getdocumento?idcontrato="+idcontrato, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
if (!responce.ok) {
|
||||
modaldata="Error al obtener el archivo";
|
||||
return;
|
||||
}
|
||||
|
||||
let blob = await Blob(responce.body());
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
window.open(blobUrl, '_blank');
|
||||
setTimeout(() => URL.revokeObjectURL(blobUrl), 100000);
|
||||
} catch {
|
||||
modaldata = "Fallo al intentar conectarse al servidor";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable/>
|
||||
@@ -298,6 +343,8 @@
|
||||
<ModalAddGarantes maxGarantes={setCantGarantes} onClose={() => (Selmens.accion = "")} onSubmit={handleEnviarmensaje3}/>
|
||||
{:else if Selmens.accion == "Check y Contrato"}
|
||||
<ModalCheckYContrato {garantes} men={Selmens} onCancel={handleCancelPrecontrato} onClose={() => (Selmens.accion = "")} onConfirm={handleEnviarmensaje4}/>
|
||||
{:else if Selmens.accion == "Aceptar Contrato"}
|
||||
<ModalVeryAceptarContrato onClose={() => (Selmens.accion = "")} onConfirm={()=> ""} onCancel={()=>""} getContrato={ObtenerContrato} men={Selmens}/>
|
||||
{/if}
|
||||
|
||||
<div class="container">
|
||||
|
||||
Reference in New Issue
Block a user