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