<tr>
    <td>
        Pie
        @if ($pie !== null)
            <sub>
                <a href="{{$urls->base}}/venta/{{$venta->id}}/pie">
                    <i class="edit icon"></i>
                </a>
            </sub>
        @else
            <a href="{{$urls->base}}/venta/{{$venta->id}}/pie/add">
                <i class="plus icon"></i>
            </a>
        @endif
    </td>
    @if ($pie !== null)
        <td>{{ $format->percent($pie->valor / $venta->valor, 2, true) }}</td>
        <td class="right aligned">{{$format->ufs($pie->valor)}}</td>
        <td class="right aligned">{{$format->pesos($pie->valor * $pie->uf)}}</td>
        <td class="right aligned">Cuotas</td>
        <td>
            <a href="{{$urls->base}}/venta/{{$venta->id}}/pie/cuotas">
                <span data-tooltip="Pagadas">{{count($pie->cuotas(true, true))}}</span>/{{$pie->cuotas}}
            </a>
            @if (count($pie->cuotas(vigentes: true)) < $pie->cuotas)
                <a href="{{$urls->base}}/ventas/pie/{{$pie->id}}/cuotas/add">
                    <i class="plus icon"></i>
                </a>
            @endif
        </td>
    @else
        <td colspan="4"></td>
    @endif
</tr>
@if ($pie !== null)
    <tr>
        <td>Pagado</td>
        <td>{{$format->percent($pie->pagado() / $venta->valor, 2, true)}}</td>
        <td class="right aligned">{{$format->ufs($pie->pagado())}}</td>
        <td class="right aligned">{{$format->pesos($pie->pagado('pesos'))}}</td>
        <td colspan="2"></td>
    </tr>
    @if ($pie->reajuste)
        <tr>
            <td>Reajuste</td>
            <td></td>
            <td class="right aligned">{{$format->ufs($pie->reajuste->valor())}}</td>
            <td class="right aligned">{{$format->pesos($pie->reajuste->valor)}}</td>
            <td colspan="2"></td>
        </tr>
    @endif
@endif
