<div class="table-responsive">
                    <table class="table table-striped table-bordered text-center">
        <thead>
            <tr>
                <th>#</th>
                <th> Id</th>
                <th> Purpose</th>
                <th>Term</th>
                <th>Interest</th>
                <th>Amount</th>
                <th>Outstanding Amount</th>
                <th>Pay Amount</th>
                <th>Collect Principal</th>
                <th>Collect Interest</th>
                
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            <?php
                $count = 1;
            ?>
            <?php $__currentLoopData = $getData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $loanEncId = Crypt::encrypt($data->id);
                ?>
                <tr>
                    <td><?php echo e($count++); ?></td>
                    <td> <a href="<?php echo e(route('view_loan_details', $loanEncId)); ?>"><?php echo e($data->loanId); ?></a></td>
                    <td>
                        <?php $__currentLoopData = $getLoanPurpose; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pur): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($pur->id == $data->loanPurpose): ?>
                                <?php echo e($pur->name); ?>

                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </td>
                    <td><?php echo e($data->loanterm); ?></td>
                    <td><?php echo e($data->interestRate); ?>%</td>
                    <td><?php echo e(number_format($data->principal, 2)); ?></td>
                    <?php
                        $totalPayAmount = 0;
                        $totalPrincipalArreas = 0;
                        $totalInterestArreas = 0;
                        $totalArreasAmount = null;

                        foreach ($getRepaymentData as $repayment) {
                            if ($repayment->loanId == $data->id) {
                                $totalPayAmount += $repayment->repaymentAmount;
                                $totalPrincipalArreas += $repayment->principalAmount;
                                $totalInterestArreas += $repayment->interest;
                                if ($totalArreasAmount === null || $repayment->lastLoanBalance < $totalArreasAmount) {
                                    $totalArreasAmount = $repayment->lastLoanBalance;
                                }
                            }
                        }

                        if ($totalArreasAmount === null) {
                            $totalArreasAmount = 0;
                        }

                    ?>
                    <td><?php echo e(number_format($totalArreasAmount, 2)); ?></td>
                    <td><?php echo e(number_format($totalPayAmount, 2)); ?></td>
                    <td><?php echo e(number_format($totalPrincipalArreas, 2)); ?></td>
                    <td><?php echo e(number_format($totalInterestArreas, 2)); ?></td>
                    
                    <td>
                        <?php
                            if ($data->loanStatus == 'Active') {
                                $statusClass = 'bg-success';
                            } elseif ($data->loanStatus == 'Rejected') {
                                $statusClass = 'bg-danger';
                            } else {
                                $statusClass = 'bg-primary';
                            }

                        ?>
                        <span class="badge <?php echo e($statusClass); ?>"><?php echo e($data->loanStatus); ?></span>
                    </td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
    </table>
</div>
<?php /**PATH /home/techhdyz/new.technathi.cloud/resources/views/pages/allpages/memberpages/loan_details.blade.php ENDPATH**/ ?>