Mejora en look de depositos y vencidos

This commit is contained in:
Juan Pablo Vial
2024-02-13 12:08:25 -03:00
parent 7f25b4b5e1
commit 4fb75b11c4
2 changed files with 77 additions and 40 deletions

View File

@ -3,47 +3,72 @@
@section('page_content')
<div class="ui container">
<h1 class="ui header">Depósitos a Plazo</h1>
<table class="ui table" id="depositos">
<thead>
<tr>
<th>Inmobiliaria</th>
<th>Banco</th>
<th> Depósito</th>
<th>Capital</th>
<th>Inicio</th>
<th>Plazo</th>
<th>Vencimiento</th>
<th>Monto al Vencimiento</th>
<th>Tasa</th>
<th>
<button class="ui green icon button" id="add_button">
<i class="plus icon"></i>
</button>
</th>
</tr>
</thead>
<tbody>
@foreach ($depositos as $deposito)
</div>
<div class="ui grid">
<div class="two wide column"></div>
<div class="twelve wide column">
<table class="ui table" id="depositos">
<thead>
<tr>
<td>{{$deposito->cuenta->inmobiliaria->razon}}</td>
<td>{{$deposito->cuenta->banco->nombre}}</td>
<td>{{$deposito->id}}</td>
<td>{{$format->pesos($deposito->capital)}}</td>
<td>{{$deposito->inicio->format('d-m-Y')}}</td>
<td>{{$deposito->plazo()}}</td>
<td>{{$deposito->termino->format('d-m-Y')}}</td>
<td>{{$format->pesos($deposito->futuro)}}</td>
<td>{{$format->percent($deposito->tasa() * 100, 4)}}</td>
<td>
<button class="ui red icon button remove_button" data-deposito="{{$deposito->id}}">
<i class="remove icon"></i>
<th>Inmobiliaria</th>
<th>Banco</th>
<th> Depósito</th>
<th>Capital</th>
<th>Inicio</th>
<th>Plazo</th>
<th>Vencimiento</th>
<th>Vencimiento ISO</th>
<th>Monto al Vencimiento</th>
<th>Tasa</th>
<th>
<button class="ui green icon button" id="add_button">
<i class="plus icon"></i>
</button>
</td>
</th>
</tr>
@endforeach
</tbody>
</table>
</thead>
<tbody>
@foreach ($activos as $deposito)
<tr>
<td>{{$deposito->cuenta->inmobiliaria->razon}}</td>
<td>{{$deposito->cuenta->banco->nombre}}</td>
<td>{{$deposito->id}}</td>
<td>{{$format->pesos($deposito->capital)}}</td>
<td>{{$deposito->inicio->format('d-m-Y')}}</td>
<td>{{$deposito->plazo()}}</td>
<td>{{$deposito->termino->format('d-m-Y')}}</td>
<td>{{$deposito->termino->format('Y-m-d')}}</td>
<td>{{$format->pesos($deposito->futuro)}}</td>
<td>{{$format->percent($deposito->tasa() * 100, 4)}}</td>
<td>
<button class="ui red icon button remove_button" data-deposito="{{$deposito->id}}">
<i class="remove icon"></i>
</button>
</td>
</tr>
@endforeach
@foreach ($vencidos as $deposito)
<tr class="yellow">
<td>{{$deposito->cuenta->inmobiliaria->razon}}</td>
<td>{{$deposito->cuenta->banco->nombre}}</td>
<td>{{$deposito->id}}</td>
<td>{{$format->pesos($deposito->capital)}}</td>
<td>{{$deposito->inicio->format('d-m-Y')}}</td>
<td>{{$deposito->plazo()}}</td>
<td>{{$deposito->termino->format('d-m-Y')}}</td>
<td>{{$deposito->termino->format('Y-m-d')}}</td>
<td>{{$format->pesos($deposito->futuro)}}</td>
<td>{{$format->percent($deposito->tasa() * 100, 4)}}</td>
<td>
<button class="ui red icon button remove_button" data-deposito="{{$deposito->id}}">
<i class="remove icon"></i>
</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="ui modal" id="add_modal">
<div class="content">
@ -208,7 +233,10 @@
$(this.ids.forms.add.inicio).calendar(calendar_date_options)
$(this.ids.forms.add.termino).calendar(calendar_date_options)
$(this.ids.table).dataTable()
$(this.ids.table).dataTable({
columnDefs: [{target: 7, visible: false, searchable: false}],
order: [[7, 'desc'], [0, 'asc']]
})
}
}
$(document).ready(() => {

View File

@ -8,6 +8,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Incoviba\Common\Alias\View;
use Incoviba\Common\Implement\Exception\{EmptyResult, EmptyRedis};
use Incoviba\Model;
use Incoviba\Repository;
use Incoviba\Service;
@ -50,7 +51,15 @@ class Contabilidad extends Controller
try {
$depositos = $dapRepository->fetchAll();
} catch (EmptyResult) {}
return $view->render($response, 'contabilidad.depositos', compact('inmobiliarias', 'depositos'));
$fecha = new DateTimeImmutable('today');
$activos = array_filter($depositos, function(Model\Deposito $deposito) use ($fecha) {
return $deposito->termino >= $fecha;
});
$mes = $fecha->sub(new DateInterval('P1M'));
$vencidos = array_filter($depositos, function(Model\Deposito $deposito) use ($fecha, $mes) {
return $deposito->termino < $fecha and $deposito->termino >= $mes;
});
return $view->render($response, 'contabilidad.depositos', compact('inmobiliarias', 'activos', 'vencidos'));
}
public function tesoreria(ServerRequestInterface $request, ResponseInterface $response, View $view,
Service\Contabilidad\Informe\Tesoreria $contabilidadService,