2023-09-12
This commit is contained in:
@ -111,4 +111,25 @@ class Ventas
|
||||
$proyectos = $proyectoRepository->fetchAllActive();
|
||||
return $view->render($response, 'ventas.add', compact('regiones', 'proyectos'));
|
||||
}
|
||||
public function doAdd(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService): ResponseInterface
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
$output = [
|
||||
'status' => false,
|
||||
'errors' => []
|
||||
];
|
||||
try {
|
||||
$ventaService->add($data);
|
||||
$output['status'] = true;
|
||||
} catch (\Exception $exception) {
|
||||
$output['errors'] = $exception;
|
||||
}
|
||||
$response->getBody()->write(json_encode($output));
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
}
|
||||
public function cuotas(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService, View $view, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $ventaService->getById($venta_id);
|
||||
return $view->render($response, 'ventas.pies.cuotas', compact('venta'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user