From a428aeebe1a000f461fc978e18d72dc94b7eeaff Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 4 Jul 2024 18:09:25 -0400 Subject: [PATCH] Agregar, editar y borrar comentarios --- app/resources/routes/api/ventas.php | 5 +- .../routes/api/ventas/comentarios.php | 8 + .../views/ventas/show/comentarios.blade.php | 225 ++++++++++++++++-- app/src/Controller/API/Ventas.php | 35 ++- app/src/Controller/API/Ventas/Comentarios.php | 68 ++++++ app/src/Model/Venta/Comentario.php | 3 + app/src/Repository/Venta/Comentario.php | 38 ++- 7 files changed, 358 insertions(+), 24 deletions(-) create mode 100644 app/resources/routes/api/ventas/comentarios.php create mode 100644 app/src/Controller/API/Ventas/Comentarios.php diff --git a/app/resources/routes/api/ventas.php b/app/resources/routes/api/ventas.php index 1b9a936..1b8b8b8 100644 --- a/app/resources/routes/api/ventas.php +++ b/app/resources/routes/api/ventas.php @@ -27,7 +27,10 @@ $app->group('/ventas', function($app) { }); $app->group('/venta/{venta_id}', function($app) { $app->get('/unidades[/]', [Ventas::class, 'unidades']); - $app->get('/comentarios[/]', [Ventas::class, 'comentarios']); + $app->group('/comentarios', function($app) { + $app->post('/add[/]', [Ventas::class, 'addComentario']); + $app->get('[/]', [Ventas::class, 'comentarios']); + }); $app->group('/escritura', function($app) { $app->post('/add[/]', [Ventas\Escrituras::class, 'add']); }); diff --git a/app/resources/routes/api/ventas/comentarios.php b/app/resources/routes/api/ventas/comentarios.php new file mode 100644 index 0000000..dc4d368 --- /dev/null +++ b/app/resources/routes/api/ventas/comentarios.php @@ -0,0 +1,8 @@ +group('/comentario/{comentario_id}', function($app) { + $app->post('/edit[/]', [Comentarios::class, 'edit']); + $app->delete('/remove[/]', [Comentarios::class, 'remove']); + //$app->get('[/]', [Comentarios::class, 'get']); +}); diff --git a/app/resources/views/ventas/show/comentarios.blade.php b/app/resources/views/ventas/show/comentarios.blade.php index 8c5d735..475a9fc 100644 --- a/app/resources/views/ventas/show/comentarios.blade.php +++ b/app/resources/views/ventas/show/comentarios.blade.php @@ -3,9 +3,9 @@ COMENTARIOS
- +
@@ -13,37 +13,199 @@
+ + @push('page_scripts')