falta armar una ultima notificacion para el inquilino y setear el front para que mande las request bien
This commit is contained in:
@@ -7,11 +7,25 @@
|
||||
garantes: GaranteDto[],
|
||||
onCancel:()=>void,
|
||||
onClose:()=>void,
|
||||
onConfirm:()=>void } = $props();
|
||||
onConfirm:(file:File, idcontrato:string)=>void } = $props();
|
||||
|
||||
let file:File | null = $state(null);
|
||||
let confirmaGarantes: boolean = $state(false);
|
||||
|
||||
|
||||
function handleFile(e:Event):void {
|
||||
const input = e.target as HTMLInputElement;
|
||||
if (input.files && input.files.length > 0 ) {
|
||||
file = input.files[0];
|
||||
}
|
||||
}
|
||||
|
||||
function submit() {
|
||||
if (file == null) return;
|
||||
onConfirm(file, men.mensaje.split(" ").reverse()[0]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal show d-block" tabindex="-1" role="dialog" aria-labelledby="staticModalLabel" aria-hidden="true" style="background-color: rgba(0,0,0,0.5);">
|
||||
<div class="modal-dialog modal-xl" role="document">
|
||||
<div class="modal-content">
|
||||
@@ -31,29 +45,51 @@
|
||||
<th>Domicilio</th>
|
||||
<th>Celular</th>
|
||||
<th>Domicilio Laboral</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each garantes as garante, index}
|
||||
<tr>
|
||||
<td>{index + 1}</td>
|
||||
<td>{garante.Dni}</td>
|
||||
<td>{garante.Nombre}</td>
|
||||
<td>{garante.Apellido}</td>
|
||||
<td>{garante.Domicilio}</td>
|
||||
<td>{garante.Celular}</td>
|
||||
<td>{garante.Domiciliolaboral}</td>
|
||||
<td>{garante.dni}</td>
|
||||
<td>{garante.nombre}</td>
|
||||
<td>{garante.apellido}</td>
|
||||
<td>{garante.domicilio}</td>
|
||||
<td>{garante.celular}</td>
|
||||
<td>{garante.domiciliolaboral}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="checkbox" bind:checked={confirmaGarantes} disabled={confirmaGarantes}>
|
||||
|
||||
<div class="d-flex flex-column align-items-center mt-3">
|
||||
<div class="form-check">
|
||||
<input
|
||||
id="checkestabien"
|
||||
type="checkbox"
|
||||
class="form-check-input"
|
||||
bind:checked={confirmaGarantes}
|
||||
disabled={confirmaGarantes}
|
||||
>
|
||||
<label for="checkestabien" class="form-check-label ms-2">
|
||||
¿Están bien estos datos?
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{#if confirmaGarantes}
|
||||
<hr>
|
||||
<div class="d-flex flex-column align-items-center mt-3">
|
||||
<div class="mb-3">
|
||||
<label for="formFile" class="form-label">Suba contrato en pdf</label>
|
||||
<input class="form-control" type="file" id="formFile"
|
||||
onchange={handleFile}>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer d-flex justify-content-between">
|
||||
<button class="btn btn-primary" disabled={!confirmaGarantes} onclick={() => onConfirm()} >
|
||||
<button class="btn btn-primary" disabled={!(confirmaGarantes && file != null)} onclick={submit} >
|
||||
Subir
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" onclick={onCancel}>Cancelar Contrato</button>
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
if (mensaje.accion === "Check y Contrato"){
|
||||
Selmens = {...mensaje};
|
||||
let idcontrato = Number(Selmens.mensaje.split(" ").reverse()[0]);
|
||||
obtenerListaGarantes(idcontrato);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -126,7 +127,7 @@
|
||||
async function obtenerListaGarantes(idcontrato: number) {
|
||||
if (Selmens.accion !== "Check y Contrato") return;
|
||||
try {
|
||||
const responce = await fetch($urlG+"/api/contratos/precontrato/listaGarantes?idcontrato="+idcontrato+"&EmailPropietario="+sessionStorage.getItem("email"), {
|
||||
const responce = await fetch($urlG+"/api/contratos/precontrato/listaGarantes?idcontrato="+idcontrato+"&EmailPropietario="+localStorage.getItem("email"), {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
@@ -263,8 +264,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function handleEnviarmensaje4() {
|
||||
|
||||
async function handleEnviarmensaje4(file:File, idcontrato:string) {
|
||||
let formdata = new FormData();
|
||||
formdata.append("idcontrato", idcontrato);
|
||||
formdata.append("contrato", file);
|
||||
try{
|
||||
const responce = await fetch("", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
},
|
||||
body: formdata,
|
||||
});
|
||||
if () {
|
||||
|
||||
}
|
||||
}catch{
|
||||
modaldata="Fallo al intentar hacer la request";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user