Escriturar
This commit is contained in:
@ -230,4 +230,18 @@ class Ventas
|
||||
}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
public function escriturar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService, int $venta_id): ResponseInterface
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
$output = [
|
||||
'input' => $data,
|
||||
'venta_id' => $venta_id,
|
||||
'status' => false
|
||||
];
|
||||
try {
|
||||
$venta = $ventaService->getById($venta_id);
|
||||
$output['status'] = $ventaService->escriturar($venta, $data);
|
||||
} catch (EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
}
|
||||
|
@ -42,12 +42,14 @@ class Ventas
|
||||
$venta = $service->getByProyectoAndUnidad($proyecto_nombre, $unidad_descripcion);
|
||||
return $view->render($response, 'ventas.show', compact('venta'));
|
||||
}
|
||||
public function edit(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Venta $service, int $venta_id): ResponseInterface
|
||||
public function edit(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
||||
Service\Venta $service, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $service->getById($venta_id);
|
||||
return $view->render($response, 'ventas.edit', compact('venta'));
|
||||
}
|
||||
public function propietario(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Venta $service, Repository\Region $regionRepository, int $venta_id): ResponseInterface
|
||||
public function propietario(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
||||
Service\Venta $service, Repository\Region $regionRepository, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $service->getById($venta_id);
|
||||
$propietario = $venta->propietario();
|
||||
@ -55,9 +57,11 @@ class Ventas
|
||||
usort($regiones, function(Model\Region $a, Model\Region $b) {
|
||||
return $a->numeracion - $b->numeracion;
|
||||
});
|
||||
return $view->render($response, 'ventas.propietarios.edit', compact('propietario', 'venta_id', 'regiones'));
|
||||
return $view->render($response, 'ventas.propietarios.edit', compact('propietario',
|
||||
'venta_id', 'regiones'));
|
||||
}
|
||||
public function propiedad(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Venta $service, Service\Venta\Unidad $unidadService, int $venta_id): ResponseInterface
|
||||
public function propiedad(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
||||
Service\Venta $service, Service\Venta\Unidad $unidadService, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $service->getById($venta_id);
|
||||
$propiedad = $venta->propiedad();
|
||||
@ -69,14 +73,17 @@ class Ventas
|
||||
$tiposUnidades []= $unidad->proyectoTipoUnidad->tipoUnidad;
|
||||
}
|
||||
}
|
||||
return $view->render($response, 'ventas.propiedades.edit', compact('propiedad', 'proyecto', 'tiposUnidades', 'unidades', 'venta'));
|
||||
return $view->render($response, 'ventas.propiedades.edit', compact('propiedad',
|
||||
'proyecto', 'tiposUnidades', 'unidades', 'venta'));
|
||||
}
|
||||
public function pie(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Venta $service, int $venta_id): ResponseInterface
|
||||
public function pie(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
||||
Service\Venta $service, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $service->getById($venta_id);
|
||||
return $view->render($response, 'ventas.pies.edit', compact('venta'));
|
||||
}
|
||||
public function add(ServerRequestInterface $request, ResponseInterface $response, View $view, Repository\Region $regionRepository, Repository\Proyecto $proyectoRepository): ResponseInterface
|
||||
public function add(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
||||
Repository\Region $regionRepository, Repository\Proyecto $proyectoRepository): ResponseInterface
|
||||
{
|
||||
$regiones = $regionRepository->fetchAll();
|
||||
usort($regiones, function(Model\Region $a, Model\Region $b) {
|
||||
@ -85,9 +92,20 @@ class Ventas
|
||||
$proyectos = $proyectoRepository->fetchAllActive();
|
||||
return $view->render($response, 'ventas.add', compact('regiones', 'proyectos'));
|
||||
}
|
||||
public function cuotas(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService, View $view, int $venta_id): ResponseInterface
|
||||
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'));
|
||||
}
|
||||
public function escriturar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService,
|
||||
Repository\Banco $bancoRepository, View $view, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $ventaService->getById($venta_id);
|
||||
$bancos = $bancoRepository->fetchAll();
|
||||
usort($bancos, function(Model\Banco $a, Model\Banco $b) {
|
||||
return strcmp($a->nombre, $b->nombre);
|
||||
});
|
||||
return $view->render($response, 'ventas.escriturar', compact('venta', 'bancos'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user