Search
This commit is contained in:
@ -20,6 +20,10 @@ class Login
|
||||
if ($request->hasHeader('X-Redirect-URI')) {
|
||||
$redirect_uri = $request->getHeaderLine('X-Redirect-URI');
|
||||
}
|
||||
$query = $request->getQueryParams();
|
||||
if (isset($query['url'])) {
|
||||
$redirect_uri = base64_decode(urldecode($query['url']));
|
||||
}
|
||||
return $view->render($response, 'login.form', compact('redirect_uri'));
|
||||
}
|
||||
public function login(ServerRequestInterface $request, ResponseInterface $response, Repository\User $userRepository, Service\Login $service): ResponseInterface
|
||||
|
23
app/src/Controller/Search.php
Normal file
23
app/src/Controller/Search.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace Incoviba\Controller;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Incoviba\Common\Alias\View;
|
||||
use Incoviba\Service;
|
||||
|
||||
class Search
|
||||
{
|
||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, View $view, ?string $query = '', ?string $tipo = '*'): ResponseInterface
|
||||
{
|
||||
$post = $request->getParsedBody() ?? '';
|
||||
return $view->render($response, 'search', compact('post', 'query', 'tipo'));
|
||||
}
|
||||
public function query(ServerRequestInterface $request, ResponseInterface $response, Service\Search $service): ResponseInterface
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
$results = $service->query($data['query'], $data['tipo']);
|
||||
$response->getBody()->write(json_encode(compact('results')));
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ class Ventas
|
||||
'total' => 0
|
||||
];
|
||||
try {
|
||||
$ventas = $service->fetchByProyecto($proyecto_id);
|
||||
$ventas = $service->fetchActivaByProyecto($proyecto_id);
|
||||
$output['ventas'] = array_map(function(Model\Venta $venta) {return $venta->id;}, $ventas);
|
||||
$output['proyecto']['descripcion'] = $ventas[0]->proyecto()->descripcion;
|
||||
$output['total'] = count($ventas);
|
||||
|
Reference in New Issue
Block a user