Desistir venta

This commit is contained in:
2023-12-21 18:45:47 -03:00
parent 93431e41b3
commit 80a6bf1535
8 changed files with 221 additions and 62 deletions

View File

@ -244,4 +244,18 @@ class Ventas
} catch (EmptyResult) {}
return $this->withJson($response, $output);
}
public function desistir(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService, int $venta_id): ResponseInterface
{
$data = $request->getParsedBody();
$output = [
'input' => $data,
'venta_id' => $venta_id,
'desistida' => false
];
try {
$venta = $ventaService->getById($venta_id);
$output['desistida'] = $ventaService->desistir($venta, $data);
} catch (EmptyResult) {}
return $this->withJson($response, $output);
}
}

View File

@ -108,4 +108,10 @@ class Ventas
});
return $view->render($response, 'ventas.escriturar', compact('venta', 'bancos'));
}
public function desistir(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService,
View $view, int $venta_id): ResponseInterface
{
$venta = $ventaService->getById($venta_id);
return $view->render($response, 'ventas.desistir', compact('venta'));
}
}