5 Commits

8 changed files with 44 additions and 11 deletions

View File

@ -0,0 +1,14 @@
@extends('layout.base')
@section('page_title')
405 - Método No Permitido
@endsection
@section('page_content')
<div class="ui container">
<div class="ui message">
<i class="exclamation triangle icon"></i>
No se ha encontrado la página solicitada para el método solicitado.
</div>
</div>
@endsection

View File

@ -785,7 +785,9 @@
}
$(document).ready(() => {
$('#fecha_venta_calendar').calendar(calendar_date_options)
const cdo = structuredClone(calendar_date_options)
cdo['maxDate'] = new Date()
$('#fecha_venta_calendar').calendar(cdo)
new Propietario({id: '#propietario', id_tipo: 'persona_propietario', id_cantidad: 'cantidad_propietario'})
new Proyecto({unidades_id: '#unidades', proyecto_id: '#proyecto'})

View File

@ -61,6 +61,9 @@
<tbody>@php
$now = new DateTimeImmutable();
$uf_venta = $venta->uf === 0.0 ? $UF->get($venta->currentEstado()->fecha) : $venta->uf;
if ($uf_venta === 0.0) {
$uf_venta = $UF->get();
}
@endphp
@foreach ($venta->formaPago()->pie->cuotas() as $cuota)
<tr data-pago="{{$cuota->pago->id}}"

View File

@ -5,18 +5,25 @@ use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Log\LoggerInterface;
use Slim\Exception\HttpMethodNotAllowedException;
use Incoviba\Common\Alias\View;
class NotAllowed
{
public function __construct(protected ResponseFactoryInterface $responseFactory) {}
public function __construct(protected LoggerInterface $logger, protected ResponseFactoryInterface $responseFactory,
protected View $view) {}
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
try {
return $handler->handle($request);
} catch (HttpMethodNotAllowedException) {
return $this->responseFactory->createResponse(405, 'Method Not Allowed');
$response = $this->responseFactory->createResponse(405, 'Method Not Allowed');
if (str_contains($request->getUri()->getPath(), '/api')) {
return $response;
}
return $this->view->render($response, 'not_allowed');
}
}
}

View File

@ -8,17 +8,21 @@ use Psr\Http\Server\RequestHandlerInterface;
use Psr\Log\LoggerInterface;
use Slim\Exception\HttpNotFoundException;
use Incoviba\Common\Alias\View;
use Incoviba\Common\Implement\Exception\{EmptyRedis,EmptyResult};
use Incoviba\Exception\ServiceAction\{Create, Delete, Read, Update};
class NotFound
{
public function __construct(protected LoggerInterface $logger, protected ResponseFactoryInterface $responseFactory, protected View $view) {}
public function __construct(protected LoggerInterface $logger, protected ResponseFactoryInterface $responseFactory,
protected View $view) {}
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
try {
return $handler->handle($request);
} catch (HttpNotFoundException $exception) {
} catch (HttpNotFoundException |
EmptyRedis | EmptyResult | Read | Create | Update | Delete $exception) {
$this->logger->notice($exception);
$response = $this->responseFactory->createResponse(404);
$response = $this->responseFactory->createResponse(404, 'Not Found');
if (str_contains($request->getUri()->getPath(), '/api')) {
return $response;
}

View File

@ -33,11 +33,12 @@ class Money
return 0;
}
}
public function getUF(DateTimeInterface $dateTime): float
public function getUF(?DateTimeInterface $dateTime = null): float
{
try {
return $this->getProvider('uf')->get(MiIndicador::UF, $dateTime);
} catch (EmptyResponse) {
} catch (EmptyResponse $exception) {
$this->logger->debug($exception);
return 0;
}
}

View File

@ -18,9 +18,12 @@ class MiIndicador implements Provider
/**
* @throws EmptyResponse
*/
public function get(string $money_symbol, DateTimeInterface $dateTime): float
public function get(string $money_symbol, ?DateTimeInterface $dateTime = null): float
{
$request_uri = "{$money_symbol}/{$dateTime->format('d-m-Y')}";
$request_uri = "{$money_symbol}";
if ($dateTime !== null) {
$request_uri = "{$money_symbol}/{$dateTime->format('d-m-Y')}";
}
try {
$response = $this->client->get($request_uri);
} catch (GuzzleException) {

View File

@ -76,7 +76,6 @@ class UF
$uf = $this->get($date);
return $input * (($from === 'uf') ? $uf : 1/$uf);
}
protected array $redisUFs;
public function getRedisUFs(): array
{