FIX: Cuotas vigentes
This commit is contained in:
@ -23,7 +23,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="cuotas">
|
||||
@for ($i = count($pie->cuotas()); $i < $pie->cuotas - count($pie->cuotas()); $i ++)
|
||||
@for ($i = count($pie->cuotas()); $i < $pie->cuotas - count($pie->cuotas(vigentes: true)); $i ++)
|
||||
<tr>
|
||||
<td>{{$i + 1}}</td>
|
||||
<td>
|
||||
|
@ -15,18 +15,23 @@ class Pie extends Model
|
||||
public ?Pago $reajuste;
|
||||
|
||||
public array $cuotasArray;
|
||||
public function cuotas(bool $pagadas = false): array
|
||||
public function cuotas(bool $pagadas = false, bool $vigentes = false): array
|
||||
{
|
||||
if ($this->asociado !== null) {
|
||||
return $this->asociado->cuotas($pagadas);
|
||||
}
|
||||
if (!$pagadas) {
|
||||
if (!$pagadas and !$vigentes) {
|
||||
return $this->cuotasArray;
|
||||
}
|
||||
if ($pagadas) {
|
||||
return array_filter($this->cuotasArray, function(Cuota $cuota) {
|
||||
return $cuota->pago->currentEstado->tipoEstadoPago->descripcion !== 'no pagado';
|
||||
});
|
||||
}
|
||||
return array_filter($this->cuotasArray, function(Cuota $cuota) {
|
||||
return $cuota->pago->currentEstado->tipoEstadoPago->active === 1;
|
||||
});
|
||||
}
|
||||
|
||||
public function pagado(string $moneda = Pago::UF): float
|
||||
{
|
||||
|
Reference in New Issue
Block a user