tengo que arreglar el tema de los streams
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
|
using System.Net;
|
||||||
|
using System.Text.Json;
|
||||||
using AlquilaFacil.Builder;
|
using AlquilaFacil.Builder;
|
||||||
|
using AlquilaFacil.Config;
|
||||||
using Entidades;
|
using Entidades;
|
||||||
using Entidades.Dto;
|
using Entidades.Dto;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@@ -210,12 +213,21 @@ public class ContratoController: ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly IMinioClient mc;
|
private readonly IMinioClient mc;
|
||||||
public ContratoController(IMinioClient mcc){
|
public ContratoController(IMinioClient minioClient) {
|
||||||
mc = mcc;
|
mc = minioClient;
|
||||||
|
if (mc == null){
|
||||||
|
MinioConfigcus? mcon = JsonSerializer.Deserialize<MinioConfigcus>(System.IO.File.ReadAllText("./settings.json"))?? null;
|
||||||
|
if (mcon == null) throw new Exception();
|
||||||
|
|
||||||
|
mc = new MinioClient().WithCredentials(mcon.usr, mcon.scrt)
|
||||||
|
.WithEndpoint("192.168.1.11:9000")
|
||||||
|
.WithSSL(false)
|
||||||
|
.Build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("api/contratos/subirContrato")]
|
[HttpPost("api/contratos/subirContrato")]
|
||||||
public IActionResult subirContrato([FromHeader(Name = "Auth")]string Auth, [FromForm]long idcontrato, IFormFile contrato) {
|
public async Task<IActionResult> subirContrato([FromHeader(Name = "Auth")]string Auth, [FromForm]long idcontrato, [FromForm]DateTime ubicarnotificacion, IFormFile contrato) {
|
||||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
@@ -223,6 +235,14 @@ public class ContratoController: ControllerBase {
|
|||||||
if (idcontrato<=0) return BadRequest(new {message = "No puede tener un id contrato menor o igual a 0"});
|
if (idcontrato<=0) return BadRequest(new {message = "No puede tener un id contrato menor o igual a 0"});
|
||||||
Contrato? contr = RepositorioContratos.Singleton.ObtenerPreContratoPorId(idcontrato);
|
Contrato? contr = RepositorioContratos.Singleton.ObtenerPreContratoPorId(idcontrato);
|
||||||
if (contr == null) return BadRequest(new { message = "No hay precontrato por esa id"});
|
if (contr == null) return BadRequest(new { message = "No hay precontrato por esa id"});
|
||||||
|
if (contr.Dniinquilino == 0 || contr.Dnipropietario == 0 || contr.Idpropiedad == 0 ||
|
||||||
|
contr.Dniinquilino == null || contr.Dnipropietario == null || contr.Idpropiedad == null) {
|
||||||
|
return BadRequest(new { message = "Estan mal cargados los datos del precontrato comunicate con un administrador"});
|
||||||
|
}
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null || contr.DnipropietarioNavigation == null) return BadRequest(new { message ="No se pudo checkear que el token corresponda al propietario"});
|
||||||
|
if (cli.Dni != contr.DnipropietarioNavigation.Dni) return BadRequest(new { message = "el token de usuario no coinside con el usuario propietario"});
|
||||||
|
|
||||||
if (contrato == null) return BadRequest(new { message = "Debe subir un archivo." });
|
if (contrato == null) return BadRequest(new { message = "Debe subir un archivo." });
|
||||||
if (contrato.ContentType != "application/pdf") return BadRequest(new { message = "El archivo debe ser un documento PDF." });
|
if (contrato.ContentType != "application/pdf") return BadRequest(new { message = "El archivo debe ser un documento PDF." });
|
||||||
@@ -230,42 +250,102 @@ public class ContratoController: ControllerBase {
|
|||||||
|
|
||||||
string nuevoNombreArchivo = $"id:{contr.Id}-inq:{contr.Dniinquilino}-propi:{contr.Dnipropietario}-idprop:{contr.Idpropiedad}.pdf";
|
string nuevoNombreArchivo = $"id:{contr.Id}-inq:{contr.Dniinquilino}-propi:{contr.Dnipropietario}-idprop:{contr.Idpropiedad}.pdf";
|
||||||
|
|
||||||
var ret = subirContrato(contrato, mc, nuevoNombreArchivo).Wait();
|
bool ret = await subirContrato(contrato, nuevoNombreArchivo);
|
||||||
|
if(ret == false) return BadRequest(new {message = "No se pudo subir el archivo"});
|
||||||
|
|
||||||
|
ret = RepositorioContratos.Singleton.AddUrl(contr.Id, nuevoNombreArchivo);
|
||||||
|
if (ret == false) return BadRequest(new { message = "No se pudo guardar la url del contrato" });
|
||||||
|
|
||||||
|
var noti = new NotificacioneBuilder()
|
||||||
|
.SetDniremitente(contr.Dnipropietario??0)
|
||||||
|
.SetIdpropiedad(contr.Idpropiedad??0)
|
||||||
|
.SetDnicliente(contr.Dniinquilino??0)
|
||||||
|
.SetAccion("Aceptar Contrato")
|
||||||
|
.SetMensaje($"El propietario: {contr.Dnipropietario}, hizo un documento de contrato: {contr.Id}")
|
||||||
|
.SetFecha(DateTime.Now)
|
||||||
|
.SetLeido(false)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, ubicarnotificacion);
|
||||||
|
ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||||
|
|
||||||
|
return (ret)?
|
||||||
|
Ok(new { message = "se notifico al futuro inquilino"}): BadRequest(new { message = "No se pudo enviar la notificacion"});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("api/contrato/getdocumento")]
|
||||||
|
public async Task<IActionResult> ObtenerContrato([FromHeader(Name = "Auth")]string Auth, [FromQuery]long idcontrato) {
|
||||||
|
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
|
if (idcontrato <= 0) return BadRequest(new {message = "La id no puede ser igual o menor a 0"});
|
||||||
|
|
||||||
|
Contrato? contr = RepositorioContratos.Singleton.ObtenerPreContratoPorId(idcontrato);
|
||||||
|
if (contr == null || contr.Dniinquilino == 0) return BadRequest(new { message = "No hay un precontrato por esa id"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return BadRequest(new { message = "No hay un cliente por ese token"});
|
||||||
|
if (cli.Dni != contr.Dniinquilino) return BadRequest(new { message = "El token no corresponde con el del inquilino"});
|
||||||
|
|
||||||
|
string nuevoNombreArchivo = $"id:{contr.Id}-inq:{contr.Dniinquilino}-propi:{contr.Dnipropietario}-idprop:{contr.Idpropiedad}.pdf";
|
||||||
|
try{
|
||||||
|
using( var memstream = new MemoryStream()){
|
||||||
|
|
||||||
|
var goa = new GetObjectArgs()
|
||||||
|
.WithBucket("alquilafacil")
|
||||||
|
.WithObject(nuevoNombreArchivo)
|
||||||
|
.WithCallbackStream(async stream => {
|
||||||
|
memstream.Position=0;
|
||||||
|
await stream.CopyToAsync(memstream);
|
||||||
|
});
|
||||||
|
|
||||||
|
await mc.GetObjectAsync(goa);
|
||||||
|
memstream.Position = 0;
|
||||||
|
|
||||||
|
if (memstream.Length == 0) return BadRequest(new { message = "El archivo está vacío" });
|
||||||
|
|
||||||
|
return File(memstream.ToArray(), "application/pdf", nuevoNombreArchivo);
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
Console.Error.WriteLine(e);
|
||||||
|
return BadRequest(new { message = "Fallo al intentar obtener el archivo del almacenamiento o este no existe"});
|
||||||
|
}
|
||||||
|
|
||||||
return Ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("api/contratos/aceptarContrato")]
|
[HttpPost("api/contratos/aceptarContrato")]
|
||||||
public IActionResult AceptarContrato([FromHeader(Name = "Auth")]string Auth){
|
public IActionResult AceptarContrato([FromHeader(Name = "Auth")]string Auth){
|
||||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest();
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> subirContrato(IFormFile f, IMinioClient m, string flname) {
|
private async Task<bool> subirContrato(IFormFile f, string flname) {
|
||||||
try {
|
try {
|
||||||
var buck = new BucketExistsArgs().WithBucket("alquilafacil");
|
var buck = new BucketExistsArgs().WithBucket("alquilafacil");
|
||||||
bool encontrado = await m.BucketExistsAsync(buck).ConfigureAwait(false);
|
bool encontrado = await mc.BucketExistsAsync(buck).ConfigureAwait(false);
|
||||||
|
|
||||||
if(!encontrado){
|
if(!encontrado){
|
||||||
var mb = new MakeBucketArgs().WithBucket("alquilafacil");
|
var mb = new MakeBucketArgs().WithBucket("alquilafacil");
|
||||||
await m.MakeBucketAsync(mb).ConfigureAwait(false);
|
await mc.MakeBucketAsync(mb).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
using (var stream = f.OpenReadStream()){
|
using (var stream = new MemoryStream()){
|
||||||
|
await f.CopyToAsync(stream);
|
||||||
var putbj = new PutObjectArgs()
|
stream.Position=0;
|
||||||
|
PutObjectArgs putbj = new PutObjectArgs()
|
||||||
.WithBucket("alquilafacil")
|
.WithBucket("alquilafacil")
|
||||||
.WithObject(flname)
|
.WithObject(flname)
|
||||||
.WithStreamData(stream)
|
.WithStreamData(stream)
|
||||||
.WithContentType("application/pdf")
|
.WithContentType("application/pdf")
|
||||||
.WithObjectSize(f.Length);
|
.WithObjectSize(stream.Length);
|
||||||
await m.PutObjectAsync(putbj).ConfigureAwait(false);
|
await mc.PutObjectAsync(putbj);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (MinioException e ) {
|
} catch (Exception e ) {
|
||||||
Console.Error.WriteLine(e.Message);
|
Console.Error.WriteLine(e.Message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ if (mcon == null) return;
|
|||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen();
|
||||||
builder.Services.AddMinio(confi => confi
|
builder.Services.AddMinio(options => options
|
||||||
.WithCredentials(mcon.usr, mcon.scrt)
|
.WithCredentials(mcon.usr, mcon.scrt)
|
||||||
.WithEndpoint("http://192.168.1.11:9000")
|
.WithEndpoint("192.168.1.11:9000")
|
||||||
|
.WithSSL(false)
|
||||||
.Build());
|
.Build());
|
||||||
|
|
||||||
builder.Services.AddCors(options =>
|
builder.Services.AddCors(options =>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
let file:File | null = $state(null);
|
let file:File | null = $state(null);
|
||||||
let confirmaGarantes: boolean = $state(false);
|
let confirmaGarantes: boolean = $state(false);
|
||||||
|
let clickeado: boolean = $state(false);
|
||||||
|
|
||||||
function handleFile(e:Event):void {
|
function handleFile(e:Event):void {
|
||||||
const input = e.target as HTMLInputElement;
|
const input = e.target as HTMLInputElement;
|
||||||
@@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
|
clickeado = true;
|
||||||
onConfirm(file, men.mensaje.split(" ").reverse()[0]);
|
onConfirm(file, men.mensaje.split(" ").reverse()[0]);
|
||||||
|
onClose();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -89,8 +91,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer d-flex justify-content-between">
|
<div class="modal-footer d-flex justify-content-between">
|
||||||
<button class="btn btn-primary" disabled={!(confirmaGarantes && file != null)} onclick={submit} >
|
<button class="btn btn-primary" disabled={!(confirmaGarantes && file != null && clickeado == false)} onclick={submit} >
|
||||||
|
{#if clickeado == false}
|
||||||
Subir
|
Subir
|
||||||
|
{:else}
|
||||||
|
<div class="spinner-border" role="status">
|
||||||
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-danger" onclick={onCancel}>Cancelar Contrato</button>
|
<button type="button" class="btn btn-danger" onclick={onCancel}>Cancelar Contrato</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
91
Front/src/Componentes/ModalVeryAceptarContrato.svelte
Normal file
91
Front/src/Componentes/ModalVeryAceptarContrato.svelte
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { MensajeDto } from "../types";
|
||||||
|
|
||||||
|
let {getContrato, onConfirm, onCancel, onClose, men
|
||||||
|
} : {
|
||||||
|
getContrato:(idcontrato:number)=>void,
|
||||||
|
onConfirm:()=>void,
|
||||||
|
onCancel:()=>void,
|
||||||
|
onClose:()=>void,
|
||||||
|
men: MensajeDto
|
||||||
|
} = $props();
|
||||||
|
|
||||||
|
let contratoDescargado = $state(false);
|
||||||
|
let leiContrato:boolean = $state(false);
|
||||||
|
|
||||||
|
function descargarContrato() {
|
||||||
|
let idcontrato = Number(men.mensaje.split(" ").reverse()[0]);
|
||||||
|
getContrato(idcontrato);
|
||||||
|
contratoDescargado = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmar() {
|
||||||
|
if (leiContrato) {
|
||||||
|
onConfirm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rechazar() {
|
||||||
|
if (leiContrato) {
|
||||||
|
onCancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="modal show d-block" tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Contrato</h5>
|
||||||
|
<button type="button" class="btn-close" onclick={onClose}></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Por favor, descargue y lea el contrato antes de aceptar o rechazar.</p>
|
||||||
|
<div class="d-flex flex-column align-items-center">
|
||||||
|
<button class="btn btn-primary mb-3" onclick={descargarContrato}>
|
||||||
|
Descargar contrato
|
||||||
|
</button>
|
||||||
|
<div class="form-check">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
id="leiContratoCheckbox"
|
||||||
|
bind:checked={leiContrato}
|
||||||
|
disabled={!contratoDescargado}
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="leiContratoCheckbox">
|
||||||
|
Leí el contrato
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer d-flex justify-content-between">
|
||||||
|
<button
|
||||||
|
class="btn btn-success"
|
||||||
|
onclick={confirmar}
|
||||||
|
disabled={!leiContrato}
|
||||||
|
>
|
||||||
|
Aceptar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-danger"
|
||||||
|
onclick={rechazar}
|
||||||
|
disabled={!leiContrato}
|
||||||
|
>
|
||||||
|
Rechazar
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-secondary" onclick={onClose}>
|
||||||
|
Cerrar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.modal {
|
||||||
|
background-color: rgba(0, 0, 0, 0.5); /* Fondo semi-transparente */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
import ModalAddGarantes from "../Componentes/ModalAddGarantes.svelte";
|
import ModalAddGarantes from "../Componentes/ModalAddGarantes.svelte";
|
||||||
import ModalCheckYContrato from "../Componentes/ModalCheckYContrato.svelte";
|
import ModalCheckYContrato from "../Componentes/ModalCheckYContrato.svelte";
|
||||||
import { self } from "svelte/legacy";
|
import { self } from "svelte/legacy";
|
||||||
|
import ModalVeryAceptarContrato from "../Componentes/ModalVeryAceptarContrato.svelte";
|
||||||
|
import { getRequest } from "@sveltejs/kit/node";
|
||||||
|
|
||||||
const token = sessionStorage.getItem("token");
|
const token = sessionStorage.getItem("token");
|
||||||
let mensajes: MensajeDto[] = $state([]);
|
let mensajes: MensajeDto[] = $state([]);
|
||||||
@@ -122,6 +124,11 @@
|
|||||||
obtenerListaGarantes(idcontrato);
|
obtenerListaGarantes(idcontrato);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mensaje.accion === "Aceptar Contrato") {
|
||||||
|
Selmens = {...mensaje};
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function obtenerListaGarantes(idcontrato: number) {
|
async function obtenerListaGarantes(idcontrato: number) {
|
||||||
@@ -253,6 +260,7 @@
|
|||||||
} else {
|
} else {
|
||||||
SinLeer();
|
SinLeer();
|
||||||
}
|
}
|
||||||
|
Selmens.accion = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,22 +276,59 @@
|
|||||||
let formdata = new FormData();
|
let formdata = new FormData();
|
||||||
formdata.append("idcontrato", idcontrato);
|
formdata.append("idcontrato", idcontrato);
|
||||||
formdata.append("contrato", file);
|
formdata.append("contrato", file);
|
||||||
|
formdata.append("ubicarnotificacion", Selmens.fecha);
|
||||||
try{
|
try{
|
||||||
const responce = await fetch("", {
|
const responce = await fetch($urlG+"/api/contratos/subirContrato", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Auth": String(token),
|
"Auth": String(token),
|
||||||
},
|
},
|
||||||
body: formdata,
|
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{
|
}catch{
|
||||||
modaldata="Fallo al intentar hacer la request";
|
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>
|
</script>
|
||||||
|
|
||||||
<NavBarAutocompletable/>
|
<NavBarAutocompletable/>
|
||||||
@@ -298,6 +343,8 @@
|
|||||||
<ModalAddGarantes maxGarantes={setCantGarantes} onClose={() => (Selmens.accion = "")} onSubmit={handleEnviarmensaje3}/>
|
<ModalAddGarantes maxGarantes={setCantGarantes} onClose={() => (Selmens.accion = "")} onSubmit={handleEnviarmensaje3}/>
|
||||||
{:else if Selmens.accion == "Check y Contrato"}
|
{:else if Selmens.accion == "Check y Contrato"}
|
||||||
<ModalCheckYContrato {garantes} men={Selmens} onCancel={handleCancelPrecontrato} onClose={() => (Selmens.accion = "")} onConfirm={handleEnviarmensaje4}/>
|
<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}
|
{/if}
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -88,9 +88,21 @@ public class RepositorioContratos: RepositorioBase<RepositorioContratos> {
|
|||||||
|
|
||||||
public Contrato? ObtenerPreContratoPorId(long idcontrato) {
|
public Contrato? ObtenerPreContratoPorId(long idcontrato) {
|
||||||
var con = Context;
|
var con = Context;
|
||||||
Contrato? contr = con.Contratos.Include(x=>x.Idgarantes).Where(x=>x.Cancelado == 0 && x.Habilitado == 0)
|
Contrato? contr = con.Contratos
|
||||||
|
.Include(x=>x.DnipropietarioNavigation)
|
||||||
|
.Include(x=>x.Idgarantes)
|
||||||
|
.Where(x=>x.Cancelado == 0 && x.Habilitado == 0)
|
||||||
.FirstOrDefault(x=>x.Id == idcontrato);
|
.FirstOrDefault(x=>x.Id == idcontrato);
|
||||||
if (contr == null) return null;
|
if (contr == null) return null;
|
||||||
return contr;
|
return contr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AddUrl(long id, string nuevoNombreArchivo) {
|
||||||
|
var con = Context;
|
||||||
|
Contrato? contrato = con.Contratos
|
||||||
|
.FirstOrDefault(x=>x.Id == id);
|
||||||
|
if (contrato == null) return false;
|
||||||
|
contrato.UrlContrato = nuevoNombreArchivo;
|
||||||
|
return Guardar(con);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user