From 6393a1fced8402aeccd172f1706e55a4e16a1efc Mon Sep 17 00:00:00 2001 From: Aldarien Date: Mon, 8 Jan 2024 21:24:34 -0300 Subject: [PATCH] Implement movimientos cuotas --- app/resources/routes/api/ventas/pagos.php | 6 +- .../views/ventas/pies/cuotas.blade.php | 164 +++++++++++++++--- app/src/Controller/API/Ventas/Pagos.php | 72 ++++++-- app/src/Service/Venta/Pago.php | 16 ++ 4 files changed, 222 insertions(+), 36 deletions(-) diff --git a/app/resources/routes/api/ventas/pagos.php b/app/resources/routes/api/ventas/pagos.php index dc60160..784f146 100644 --- a/app/resources/routes/api/ventas/pagos.php +++ b/app/resources/routes/api/ventas/pagos.php @@ -7,7 +7,9 @@ $app->group('/pagos', function($app) { $app->get('/rebotes', [Pagos::class, 'rebotes']); }); $app->group('/pago/{pago_id:[0-9]+}', function($app) { - $app->put('/depositar[/]', [Pagos::class, 'depositar']); - $app->put('/abonar[/]', [Pagos::class, 'abonar']); + $app->post('/depositar[/]', [Pagos::class, 'depositar']); + $app->post('/abonar[/]', [Pagos::class, 'abonar']); + $app->post('/devolver[/]', [Pagos::class, 'devolver']); + $app->get('/anular[/]', [Pagos::class, 'anular']); $app->post('[/]', [Pagos::class, 'edit']); }); diff --git a/app/resources/views/ventas/pies/cuotas.blade.php b/app/resources/views/ventas/pies/cuotas.blade.php index a8268c3..c302d8e 100644 --- a/app/resources/views/ventas/pies/cuotas.blade.php +++ b/app/resources/views/ventas/pies/cuotas.blade.php @@ -24,6 +24,7 @@ Estado Fecha Estado Fecha Estado ISO + @php @@ -31,7 +32,10 @@ $uf_venta = $venta->uf === 0.0 ? $UF->get($venta->currentEstado()->fecha) : $venta->uf; @endphp @foreach ($venta->formaPago()->pie->cuotas() as $cuota) - + pago->currentEstado->tipoEstadoPago->descripcion, ['anulado', 'reemplazado'])) + class="disabled" + @endif > {{$cuota->numero}} {{$cuota->pago->fecha->format('d-m-Y')}} {{$cuota->pago->fecha->format('Y-m-d')}} @@ -53,28 +57,33 @@ @endif >{{ucwords($cuota->pago->currentEstado->tipoEstadoPago->descripcion)}} - @if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'abonado') + @if (in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['abonado', 'anulado', 'reemplazado'])) {{$cuota->pago->currentEstado->fecha->format('d-m-Y')}} - @else -
-
-
- - -
-
- - @if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado') - - @endif + @if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado') + + @endif +
@endif {{$cuota->pago->currentEstado->fecha->format('Y-m-d')}} + + @if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion !== 'anulado') + + @endif + @endforeach @@ -95,7 +104,7 @@ $cuota->pago->valor()); }, 0.0))}} - + TOTAL PAGADO @@ -114,7 +123,7 @@ {{$format->number($pagado / $total * 100, 2)}}% - + POR PAGAR @@ -127,7 +136,7 @@ {{$format->number(($total - $pagado) / $total * 100, 2)}}% - + @@ -139,12 +148,127 @@ @push('page_scripts')