Promociones

This commit is contained in:
Juan Pablo Vial
2025-03-25 19:22:38 -03:00
parent d3b0026ca4
commit b191a01313
12 changed files with 286 additions and 8 deletions

View File

@ -10,10 +10,20 @@ use Incoviba\Service;
class Promotions extends Ideal\Controller
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Venta\Promotion $promotionService): ResponseInterface
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, View $view,
Service\Venta\Promotion $promotionService): ResponseInterface
{
$promotions = $promotionService->getAll('description');
return $view->render($response, 'ventas.promotions', ['promotions' => $promotions]);
}
public function show(ServerRequestInterface $request, ResponseInterface $response, View $view,
Service\Venta\Promotion $promotionService, int $promotion_id): ResponseInterface
{
$promotion = null;
try {
$promotion = $promotionService->getById($promotion_id);
} catch (ServiceAction\Read) {}
return $view->render($response, 'ventas.promotions.show', ['promotion' => $promotion]);
}
}