 <?php $__env->startSection('content'); ?>

<div class="card mb-3">
    <div class="card-header">
        <div class="row flex-between-end">
            <div class="col-auto align-self-center">
                <a href="<?php echo e(url()->previous()); ?>" class="btn btn-primary btn-sm"><i class="fas fa-arrow-circle-left"></i> Back</a>
                <a href='<?php echo e(url("/allmembers")); ?>' class="btn btn-primary btn-sm"><i class="fas fa-users"></i> All members</a>
                <a href='<?php echo e(url("/new_payment", $member->id)); ?>' class="btn btn-primary btn-sm"><i class="fas fa-user"></i> Add new payment</a>
                <a href='<?php echo e(url("/statement", $member->id)); ?>' class="btn btn-primary btn-sm"><i class="fas fa-user"></i>Print Statement</a>

                <a href='<?php echo e(url("/member_profile", $member->id)); ?>' class="btn btn-primary btn-sm"><i class="fas fa-user"></i> <?php echo e($member->name); ?> <?php echo e($member->surname); ?>'s Profile</a>

                <br>
                <br>

                <br>
                <h5 class="mb-0" data-anchor="data-anchor">List of payments</h5>
            </div>
        </div>
    </div>
    <div class="card-body pt-0">

        <div class="dt-responsive table-responsive">
            <small>
                <table class="table table-sm table-striped table-bordered nowrap">
                    <thead class="bg-200 text-900">
                        <tr>
                            <th>ID</th>                          
                            <th>Date</th>                     
                            <th>Amount</th>
                            <th>Payment Method</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody class="list">
                        <?php $__currentLoopData = $payments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $payment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($payment->id); ?></td>                       
                            <td>
    <?php if($payment->created_at): ?>
        <?php echo e($payment->payment_date); ?> - <?php echo e($payment->created_at->diffForHumans()); ?>

    <?php else: ?>
        <?php echo e($payment->payment_date); ?>

    <?php endif; ?>
</td>
             
                            <td><?php echo e($payment->amount_paid); ?></td>
                            <td><?php echo e($payment->mode->name); ?></td>
                            <td>
                                <a href='<?php echo e(url("/receipt", $payment->id)); ?>' class="btn btn-primary btn-sm"> Print</a>&nbsp;
                                <a href='<?php echo e(url("/payment_edit", $payment->id)); ?>' onclick="return confirm('Are you sure you want to delete this payment?')" class="btn btn-sm btn-danger btn-outline-primary">Delete Request</a>
                                <?php if(Auth::user()->role == 3): ?> &nbsp;                     
                                <a href='<?php echo e(url("/delete_payment")); ?>/<?php echo e($payment->id); ?>/<?php echo e($payment->member_id); ?>' class="btn btn-danger btn-sm" 
                                onclick="return confirm('Are you sure you want to delete this payment?')"> Delete </a>
                                <?php endif; ?>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </small>

        </div>


    </div>

</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\WORK-STATION\MBBS\Insurance-Version Controls\03-01-2026\resources\views/payments/memberpayments.blade.php ENDPATH**/ ?>