From f597d552be3d5151a3b5718f65f1420978e3e40d Mon Sep 17 00:00:00 2001 From: Aldarien Date: Mon, 4 Dec 2023 21:43:57 -0300 Subject: [PATCH] Edit fecha escritura --- .../routes/api/ventas/escrituras.php | 6 ++ app/resources/routes/ventas/escrituras.php | 6 ++ .../views/ventas/escrituras/show.blade.php | 56 +++++++++++++++++++ .../views/ventas/estado/edit.blade.php | 16 ++++++ .../views/ventas/show/escritura.blade.php | 5 ++ .../ventas/show/forma_pago/bono_pie.blade.php | 8 ++- .../ventas/show/forma_pago/credito.blade.php | 8 ++- .../show/forma_pago/escritura.blade.php | 8 ++- .../ventas/show/forma_pago/pie.blade.php | 8 ++- .../ventas/show/forma_pago/subsidio.blade.php | 8 ++- app/src/Controller/API/Ventas/Escrituras.php | 38 +++++++++++++ app/src/Controller/Ventas/Escrituras.php | 16 ++++++ app/src/Controller/Ventas/Estados.php | 17 ++++++ 13 files changed, 185 insertions(+), 15 deletions(-) create mode 100644 app/resources/routes/api/ventas/escrituras.php create mode 100644 app/resources/routes/ventas/escrituras.php create mode 100644 app/resources/views/ventas/escrituras/show.blade.php create mode 100644 app/resources/views/ventas/estado/edit.blade.php create mode 100644 app/src/Controller/API/Ventas/Escrituras.php create mode 100644 app/src/Controller/Ventas/Escrituras.php create mode 100644 app/src/Controller/Ventas/Estados.php diff --git a/app/resources/routes/api/ventas/escrituras.php b/app/resources/routes/api/ventas/escrituras.php new file mode 100644 index 0000000..e2a65f4 --- /dev/null +++ b/app/resources/routes/api/ventas/escrituras.php @@ -0,0 +1,6 @@ +group('/escritura/{venta_id}', function($app) { + $app->post('/edit[/]', [Escrituras::class, 'edit']); +}); diff --git a/app/resources/routes/ventas/escrituras.php b/app/resources/routes/ventas/escrituras.php new file mode 100644 index 0000000..7a310a9 --- /dev/null +++ b/app/resources/routes/ventas/escrituras.php @@ -0,0 +1,6 @@ +group('/escritura/{venta_id}', function($app) { + $app->get('[/]', [Escrituras::class, 'show']); +}); diff --git a/app/resources/views/ventas/escrituras/show.blade.php b/app/resources/views/ventas/escrituras/show.blade.php new file mode 100644 index 0000000..037fe1c --- /dev/null +++ b/app/resources/views/ventas/escrituras/show.blade.php @@ -0,0 +1,56 @@ +@extends('layout.base') + +@section('page_content') +
+

+ Escritura - + {{$venta->proyecto()->descripcion}} - + + {{$venta->propiedad()->summary()}} + +

+
+
+ +
+
+ + +
+
+
+ +
+
+@endsection + +@push('page_scripts') + +@endpush diff --git a/app/resources/views/ventas/estado/edit.blade.php b/app/resources/views/ventas/estado/edit.blade.php new file mode 100644 index 0000000..194ebfc --- /dev/null +++ b/app/resources/views/ventas/estado/edit.blade.php @@ -0,0 +1,16 @@ +@extends('layout.base') + +@section('page_content') +
+

+ Estado Venta - + {{$venta->proyecto()->descripcion}} - + + {{$venta->propiedad()->summary()}} + +

+

+ {{$venta->currentEstado()->tipoEstadoVenta->descripcion}} +

+
+@endsection diff --git a/app/resources/views/ventas/show/escritura.blade.php b/app/resources/views/ventas/show/escritura.blade.php index 98d2112..cd9ce80 100644 --- a/app/resources/views/ventas/show/escritura.blade.php +++ b/app/resources/views/ventas/show/escritura.blade.php @@ -4,6 +4,11 @@ @if (in_array($venta->currentEstado()->tipoEstadoVenta->descripcion, ['escriturando', 'firmado por inmobiliaria', 'archivado']))
Escriturado {{$venta->currentEstado()->fecha->format('d-m-Y')}} + + + + + Informe diff --git a/app/resources/views/ventas/show/forma_pago/bono_pie.blade.php b/app/resources/views/ventas/show/forma_pago/bono_pie.blade.php index 06022e3..adae804 100644 --- a/app/resources/views/ventas/show/forma_pago/bono_pie.blade.php +++ b/app/resources/views/ventas/show/forma_pago/bono_pie.blade.php @@ -2,9 +2,11 @@ Bono Pie @if ($bonoPie !== null) - - - + + + + + @else diff --git a/app/resources/views/ventas/show/forma_pago/credito.blade.php b/app/resources/views/ventas/show/forma_pago/credito.blade.php index 90c3905..0310043 100644 --- a/app/resources/views/ventas/show/forma_pago/credito.blade.php +++ b/app/resources/views/ventas/show/forma_pago/credito.blade.php @@ -2,9 +2,11 @@ Crédito @if ($credito !== null) - - - + + + + + @else diff --git a/app/resources/views/ventas/show/forma_pago/escritura.blade.php b/app/resources/views/ventas/show/forma_pago/escritura.blade.php index 6d329f1..25be00c 100644 --- a/app/resources/views/ventas/show/forma_pago/escritura.blade.php +++ b/app/resources/views/ventas/show/forma_pago/escritura.blade.php @@ -2,9 +2,11 @@ Escritura @if ($escritura !== null) - - - + + + + + @else diff --git a/app/resources/views/ventas/show/forma_pago/pie.blade.php b/app/resources/views/ventas/show/forma_pago/pie.blade.php index a04255d..06f68a2 100644 --- a/app/resources/views/ventas/show/forma_pago/pie.blade.php +++ b/app/resources/views/ventas/show/forma_pago/pie.blade.php @@ -2,9 +2,11 @@ Pie - - - + + + + + {{$format->ufs($pie->valor)}} diff --git a/app/resources/views/ventas/show/forma_pago/subsidio.blade.php b/app/resources/views/ventas/show/forma_pago/subsidio.blade.php index 1f0dab4..c090946 100644 --- a/app/resources/views/ventas/show/forma_pago/subsidio.blade.php +++ b/app/resources/views/ventas/show/forma_pago/subsidio.blade.php @@ -6,9 +6,11 @@ > Subsidio @if ($subsidio !== null) - - - + + + + + @else diff --git a/app/src/Controller/API/Ventas/Escrituras.php b/app/src/Controller/API/Ventas/Escrituras.php new file mode 100644 index 0000000..1776fc4 --- /dev/null +++ b/app/src/Controller/API/Ventas/Escrituras.php @@ -0,0 +1,38 @@ +getParsedBody(); + $output = [ + 'venta_id' => $venta_id, + 'input' => $body, + 'edited' => false + ]; + try { + $venta = $ventaService->getById($venta_id); + $estado = $venta->currentEstado(); + if (!in_array($estado->tipoEstadoVenta->descripcion, ['escriturando', 'firmado por inmobiliaria'])) { + throw new EmptyResult(''); + } + $body['fecha'] = (new DateTimeImmutable($body['fecha']))->format('Y-m-d'); + $estadoVentaRepository->edit($estado, $body); + $output['edited'] = true; + } catch (EmptyResult) {} + return $this->withJson($response, $output); + } +} diff --git a/app/src/Controller/Ventas/Escrituras.php b/app/src/Controller/Ventas/Escrituras.php new file mode 100644 index 0000000..9437d9a --- /dev/null +++ b/app/src/Controller/Ventas/Escrituras.php @@ -0,0 +1,16 @@ +getById($venta_id); + return $view->render($response, 'ventas.escrituras.show', compact('venta')); + } +} diff --git a/app/src/Controller/Ventas/Estados.php b/app/src/Controller/Ventas/Estados.php new file mode 100644 index 0000000..4e8782f --- /dev/null +++ b/app/src/Controller/Ventas/Estados.php @@ -0,0 +1,17 @@ +getById($venta_id); + return $view->render($response, 'ventas.estado', compact('venta')); + } +}