una cosa más hecha
This commit is contained in:
@@ -21,7 +21,9 @@
|
||||
import ControlAlquileresPropietario from "./paginas/ControlAlquileresPropietario.svelte";
|
||||
import ContratosPropietario from "./paginas/ContratosPropietario.svelte";
|
||||
import ContratoInquilino from "./paginas/ContratoInquilino.svelte";
|
||||
import Informes from "./paginas/Informes.svelte";
|
||||
import Informes from "./paginas/Informes.svelte";
|
||||
import CompraYVentas from "./paginas/CompraYVenta.svelte";
|
||||
import Ventas from "./paginas/Ventas.svelte";
|
||||
</script>
|
||||
|
||||
<Router>
|
||||
@@ -95,6 +97,16 @@
|
||||
<ProteRoute componente={ControlAlquileresPropietario}/>
|
||||
</Route>
|
||||
|
||||
<!-- Compra y Ventas -->
|
||||
<Route path="/accion/13">
|
||||
<ProteRoute componente={CompraYVentas}/>
|
||||
</Route>
|
||||
|
||||
<!-- Pagina Ventas -->
|
||||
<Route path="/Ventas">
|
||||
<ProteRoute componente={Ventas}/>
|
||||
</Route>
|
||||
|
||||
<!--Paginas info Grupo-->
|
||||
<Route path="/grupo/Inquilino">
|
||||
<ProteRoute componente={FrontInquilino}/>
|
||||
|
||||
75
Front/src/paginas/CompraYVenta.svelte
Normal file
75
Front/src/paginas/CompraYVenta.svelte
Normal file
@@ -0,0 +1,75 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||
import type { VentasDto } from "../types";
|
||||
import ModalEstatico from "../Componentes/ModalEstatico.svelte";
|
||||
import { urlG } from "../stores/urlStore";
|
||||
import Ventas from "./Ventas.svelte";
|
||||
import { navigate } from "svelte-routing";
|
||||
|
||||
let token:string = sessionStorage.getItem("token")||"";
|
||||
let modaldata:string = $state("");
|
||||
|
||||
let ventas:VentasDto[] = $state([]);
|
||||
|
||||
onMount(()=>{
|
||||
obtenerVentas();
|
||||
});
|
||||
|
||||
async function obtenerVentas() {
|
||||
try{
|
||||
const r = await fetch($urlG+"/api/ventas", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": token
|
||||
}
|
||||
});
|
||||
let data = await r.json();
|
||||
if (!r.ok){
|
||||
modaldata = data;
|
||||
return;
|
||||
}
|
||||
ventas = data;
|
||||
}catch{
|
||||
modaldata = "Fallo al hacer la request";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable/>
|
||||
|
||||
{#if modaldata}
|
||||
<ModalEstatico payload={modaldata} close={()=> !!(modaldata = "")} />
|
||||
{/if}
|
||||
|
||||
<div class="container-fluid mt-3">
|
||||
<div class="row">
|
||||
{#each ventas as venta (venta.id)}
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5>{venta.nombreVendedor} → {venta.nombreComprador}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
<strong>Monto:</strong> {venta.monto} {venta.divisa}<br>
|
||||
<strong>Ubicación:</strong> {venta.ubicacion}<br>
|
||||
<strong>Estado:</strong> {venta.estado}
|
||||
</p>
|
||||
</div>
|
||||
<div class="card-footer d-flex justify-content-center">
|
||||
<button class="btn btn-secondary" onclick={()=>navigate("/Ventas?idventa="+venta.id)}>Ver</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.card {
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
</style>
|
||||
@@ -525,7 +525,7 @@
|
||||
Ejercer
|
||||
</button>
|
||||
{#if dtoVenta.fueEjercido}
|
||||
<button class="btn btn-secondary" onclick={()=>navigate("/accion/13?idventa="+dtoVenta.id)}>
|
||||
<button class="btn btn-secondary" onclick={()=>navigate("/Ventas?idventa="+dtoVenta.id)}>
|
||||
Ir a la pagina de la Venta
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@@ -591,7 +591,7 @@
|
||||
Para que el inquilino pueda ejercer la opcion de venta necesitas estar en el mismo mes que el ultimo pago y haber pagado todos los canones
|
||||
</p>
|
||||
<div class="d-flex">
|
||||
<button class="btn btn-primary" disabled={!dtoVenta.fueEjercido} onclick={()=>navigate("/accion/13?idventa="+dtoVenta.id)}>
|
||||
<button class="btn btn-primary" disabled={!dtoVenta.fueEjercido} onclick={()=>navigate("/Ventas?idventa="+dtoVenta.id)}>
|
||||
Ir a la pagina de la Venta
|
||||
</button>
|
||||
</div>
|
||||
|
||||
7
Front/src/paginas/Ventas.svelte
Normal file
7
Front/src/paginas/Ventas.svelte
Normal file
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable/>
|
||||
12
Front/src/types.d.ts
vendored
12
Front/src/types.d.ts
vendored
@@ -152,4 +152,16 @@ export type OpcionVentaDto = {
|
||||
divisa:string,
|
||||
enOrden:boolean,
|
||||
fueEjercido:boolean
|
||||
}
|
||||
|
||||
export type VentasDto = {
|
||||
id:number,
|
||||
monto:numver,
|
||||
divisa:string,
|
||||
ubicacion:string,
|
||||
nombreVendedor:string,
|
||||
idVendedor:number,
|
||||
nombreComprador:string,
|
||||
idComprador:number,
|
||||
estado:string,
|
||||
}
|
||||
Reference in New Issue
Block a user