Avances hasta las 16
This commit is contained in:
@@ -1,7 +1,238 @@
|
||||
<script lang="ts">
|
||||
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||
import { onMount } from "svelte";
|
||||
import ModalEstatico from "../Componentes/ModalEstatico.svelte";
|
||||
import {urlG} from "../stores/urlStore";
|
||||
import type { CanonDto, ContratoDto, ContratoPropiedadDto, GaranteDto2 } from "../types";
|
||||
|
||||
|
||||
let token:string = sessionStorage.getItem("token")||"";
|
||||
|
||||
let interes:number = $state(0);
|
||||
|
||||
let canons:CanonDto[] = $state([]);
|
||||
let garantes: GaranteDto2[] = $state([]);
|
||||
let prop:ContratoPropiedadDto = $state({
|
||||
estado:"",
|
||||
fechainicio:"",
|
||||
id:0,
|
||||
inquilino:"",
|
||||
propietario:"",
|
||||
tipoPropiedad:"",
|
||||
ubicacion:"",
|
||||
habitaciones:0,
|
||||
piso:0,
|
||||
letra:"",
|
||||
mesesAumento:0,
|
||||
mesesDuracion:0,
|
||||
});
|
||||
|
||||
let modaldata:string = $state("");
|
||||
let contratoid:string = $state("");
|
||||
|
||||
onMount(()=>{
|
||||
getparams();
|
||||
obtenerDatosACargar();
|
||||
});
|
||||
|
||||
async function obtenerDatosACargar() {
|
||||
try {
|
||||
const respPropiedad = fetch($urlG+"/api/contrato/inquilino?id="+contratoid, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
const respgarantes = fetch($urlG+"/api/contratos/garantes?idcontrato="+contratoid, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
const respCanons = fetch($urlG+"/api/contratos/canon?id="+contratoid, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
const [p, g, c] = await Promise.all([respPropiedad, respgarantes, respCanons]);
|
||||
|
||||
const datosPropiedad = await p.json();
|
||||
const datosGarantes = await g.json();
|
||||
const datosCanons = await c.json();
|
||||
prop = datosPropiedad;
|
||||
garantes = datosGarantes;
|
||||
canons = datosCanons;
|
||||
} catch {
|
||||
modaldata = "Fallo hacer las request";
|
||||
}
|
||||
}
|
||||
|
||||
function getparams(){
|
||||
const qs = window.location.search;
|
||||
const par = new URLSearchParams(qs);
|
||||
contratoid = par.get("id")||"";
|
||||
}
|
||||
|
||||
|
||||
function submitnuevosCanones() {
|
||||
|
||||
}
|
||||
async function verContrato() {
|
||||
if (prop.id <= 0) {
|
||||
modaldata = "no hay contratos con id 0 o menor";
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const resp = await fetch ($urlG+"/api/contrato/DocumentoFinal?idcontrato="+prop.id, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
|
||||
if (!resp.ok) {
|
||||
let blob = await resp.json();
|
||||
modaldata=blob.message;
|
||||
return;
|
||||
}
|
||||
|
||||
let blob = await resp.blob();
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
window.open(blobUrl, '_blank');
|
||||
setTimeout(() => URL.revokeObjectURL(blobUrl), 100000);
|
||||
} catch {
|
||||
modaldata= "fallo intentar hacer la request";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable/>
|
||||
<NavBarAutocompletable/>
|
||||
|
||||
{#if modaldata}
|
||||
<ModalEstatico payload={modaldata} close={()=>!!(modaldata = "")}/>
|
||||
{/if}
|
||||
<div class="container-fluid mt-4 d-flex">
|
||||
<div class="col-md-4 me-4">
|
||||
<div class="card">
|
||||
<div class="card-header text-center">Propiedad</div>
|
||||
<div class="card-body">
|
||||
<p><b>Tipo:</b> {prop.tipoPropiedad}</p>
|
||||
<p><b>Ubicación:</b> {prop.ubicacion}</p>
|
||||
<p><b>Propietario:</b> {prop.propietario}</p>
|
||||
<p><b>Inquilino:</b> {prop.inquilino}</p>
|
||||
<p><b>Habitaciones:</b> {prop.habitaciones}</p>
|
||||
<p><b>Piso:</b> {prop.piso}</p>
|
||||
<p><b>Letra:</b> {prop.letra}</p>
|
||||
<p><b>Fecha Inicio:</b> {String(prop.fechainicio).split("T")[0]}</p>
|
||||
<p><b>Estado:</b> {prop.estado}</p>
|
||||
<button class="btn btn-secondary" onclick={verContrato}>
|
||||
Ver Contrato
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-footer text-center">
|
||||
IdContrato: {prop.id}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col d-flex flex-column">
|
||||
<div class="accordion mb-4" id="accordionExample">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button
|
||||
class="accordion-button"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#collapseOne"
|
||||
aria-expanded="true"
|
||||
aria-controls="collapseOne"
|
||||
>
|
||||
Garantes
|
||||
</button>
|
||||
</h2>
|
||||
<div
|
||||
id="collapseOne"
|
||||
class="accordion-collapse collapse show"
|
||||
aria-labelledby="headingOne"
|
||||
data-bs-parent="#accordionExample"
|
||||
>
|
||||
<div class="accordion-body">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Dni</th>
|
||||
<th>Nombre</th>
|
||||
<th>Apellido</th>
|
||||
<th>Domicilio</th>
|
||||
<th>Dom. Laboral</th>
|
||||
<th>Celular</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each garantes as g}
|
||||
<tr>
|
||||
<td>{g.dni}</td>
|
||||
<td>{g.nombre}</td>
|
||||
<td>{g.apellido}</td>
|
||||
<td>{g.domicilio}</td>
|
||||
<td>{g.domiciliolaboral}</td>
|
||||
<td>{g.celular}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button
|
||||
class="accordion-button collapsed"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#collapseTwo"
|
||||
aria-expanded="false"
|
||||
aria-controls="collapseTwo"
|
||||
>
|
||||
Canons
|
||||
</button>
|
||||
</h2>
|
||||
<div
|
||||
id="collapseTwo"
|
||||
class="accordion-collapse collapse"
|
||||
aria-labelledby="headingTwo"
|
||||
data-bs-parent="#accordionExample"
|
||||
>
|
||||
<div class="accordion-body">
|
||||
<div class="row">
|
||||
{#each canons as canon}
|
||||
<div class="col-6 mb-3">
|
||||
<div class="card">
|
||||
<div class="card-header text-center">
|
||||
{canon.mesNum}/{prop.mesesDuracion}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p><strong>Mes:</strong> {String(canon.mes).split("T")[0]}</p>
|
||||
<p><strong>Monto:</strong> {canon.monto}</p>
|
||||
<p><strong>Divisa:</strong> {canon.divisa}</p>
|
||||
<p><strong>Pago:</strong> {canon.pago ? "Sí" : "No"}</p>
|
||||
</div>
|
||||
<div class="card-footer d-flex justify-content-between">
|
||||
<button class="btn btn-primary btn-xs" disabled={canon.pago}>
|
||||
Pagar
|
||||
</button>
|
||||
<button class="btn btn-info btn-xs" disabled={!canon.pago}>
|
||||
Generar Tiket
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import ModalEstatico from "../Componentes/ModalEstatico.svelte";
|
||||
import {urlG} from "../stores/urlStore";
|
||||
import type { CanonDto, ContratoDto, ContratoPropiedadDto, GaranteDto2 } from "../types";
|
||||
import ModalConfirm from "../Componentes/ModalConfirm.svelte";
|
||||
|
||||
|
||||
let token:string = sessionStorage.getItem("token")||"";
|
||||
@@ -74,10 +75,37 @@
|
||||
contratoid = par.get("id")||"";
|
||||
}
|
||||
|
||||
|
||||
function submitnuevosCanones() {
|
||||
function submitnuevosCanones() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async function verContrato() {
|
||||
if (prop.id <= 0) {
|
||||
modaldata = "no hay contratos con id 0 o menor";
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const resp = await fetch ($urlG+"/api/contrato/DocumentoFinal?idcontrato="+prop.id, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
|
||||
if (!resp.ok) {
|
||||
let blob = await resp.json();
|
||||
modaldata=blob.message;
|
||||
return;
|
||||
}
|
||||
|
||||
let blob = await resp.blob();
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
window.open(blobUrl, '_blank');
|
||||
setTimeout(() => URL.revokeObjectURL(blobUrl), 100000);
|
||||
} catch {
|
||||
modaldata= "fallo intentar hacer la request";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable/>
|
||||
@@ -85,8 +113,9 @@
|
||||
{#if modaldata}
|
||||
<ModalEstatico payload={modaldata} close={()=>!!(modaldata = "")}/>
|
||||
{/if}
|
||||
|
||||
<ModalConfirm />
|
||||
<div class="container-fluid mt-4 d-flex">
|
||||
<!-- Columna de la Propiedad -->
|
||||
<div class="col-md-4 me-4">
|
||||
<div class="card">
|
||||
<div class="card-header text-center">Propiedad</div>
|
||||
@@ -100,16 +129,17 @@
|
||||
<p><b>Letra:</b> {prop.letra}</p>
|
||||
<p><b>Fecha Inicio:</b> {String(prop.fechainicio).split("T")[0]}</p>
|
||||
<p><b>Estado:</b> {prop.estado}</p>
|
||||
<button class="btn btn-secondary" onclick={verContrato}>
|
||||
Ver Contrato
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-footer text-center">
|
||||
IdPropiedad: {prop.id}
|
||||
IdContrato: {prop.id}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Contenedor principal del acordeón y el formulario -->
|
||||
<div class="col d-flex flex-column">
|
||||
<!-- Acordeón -->
|
||||
<div class="accordion mb-4" id="accordionExample">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
@@ -234,9 +264,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Formulario -->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user