

<?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>
                <br><br>
                <h5 class="mb-0">
                    Claims for <?php echo e($member->name); ?> <?php echo e($member->surname); ?>

                </h5>
            </div>

            <!-- ✅ Create New Claim Button -->
            <div class="col-auto">
                <a href="<?php echo e(route('claims.create', $member->id)); ?>" class="btn btn-success btn-sm">
                    <i class="fas fa-plus-circle"></i> New Claim
                </a>
            </div>
        </div>
    </div>


    <div class="card-body">
        <?php if($claims->isEmpty()): ?>
        <p class="text-center">No claims found for this member.</p>
        <?php else: ?>
        <div class="table-responsive scrollbar">

            <table id="basic-btn" class="table table-bordered table-striped fs--1 mb-0">
                <thead class="bg-200 text-900">
                    <tr>
                        <th>#</th>
                        <th>Ref #</th>
                        <th>Deceased</th>
                        <th>Date of Death</th>
                        <th>Status</th>
                        <th>Created By</th>
                        <th>Last Action</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $claims; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $claim): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        
                        <td class="fw-bold text-center">
                            <?php echo e($loop->iteration); ?>

                        </td>

                        <td class="fw-bold"><?php echo e($claim->reference_number); ?></td>

                        <td><?php echo e($claim->deceased_full_name); ?></td>

                        <td><?php echo e(\Carbon\Carbon::parse($claim->date_of_death)->format('d M Y')); ?></td>


                        <td>
                            <span class="badge
                    <?php echo e($claim->claim_status == 'Pending' ? 'bg-warning' : ''); ?>

                    <?php echo e($claim->claim_status == 'Approved' ? 'bg-success' : ''); ?>

                    <?php echo e($claim->claim_status == 'Rejected' ? 'bg-danger' : ''); ?>

                    <?php echo e($claim->claim_status == 'Under Review' ? 'bg-info' : ''); ?>">
                                <?php echo e(ucfirst($claim->claim_status)); ?>

                            </span>
                        </td>

                        <td>
                            <?php echo e($claim->createdBy->name ?? 'System'); ?>

                        </td>

                        <td>
                            <?php if($claim->action_at): ?>
                            <?php echo e(\Carbon\Carbon::parse($claim->action_at)->format('d M Y H:i')); ?>

                            <?php else: ?>
                            <span class="text-muted">—</span>
                            <?php endif; ?>
                        </td>

                        <td>
                            
                            <a href="<?php echo e(url('/claim', $claim->id)); ?>"
                                class="btn btn-primary btn-sm">
                                <i class="far fa-eye"></i>
                            </a>

                            
                            <a href="<?php echo e($claim->claim_status === 'Pending' ? url('/claim/edit', $claim->id) : '#'); ?>"
                                class="btn btn-warning btn-sm <?php echo e($claim->claim_status !== 'Pending' ? 'disabled' : ''); ?>"
                                aria-disabled="<?php echo e($claim->claim_status !== 'Pending' ? 'true' : 'false'); ?>">
                                <i class="far fa-edit"></i>
                            </a>

                            
                            <?php if(auth()->user()->role == 3): ?>
                            <a href="<?php echo e($claim->claim_status === 'Pending' ? url('/claim/delete', $claim->id) : '#'); ?>"
                                class="btn btn-danger btn-sm <?php echo e($claim->claim_status !== 'Pending' ? 'disabled' : ''); ?>"
                                aria-disabled="<?php echo e($claim->claim_status !== 'Pending' ? 'true' : 'false'); ?>"
                                onclick="<?php echo e($claim->claim_status === 'Pending'
                            ? 'return confirm(\'Delete this claim?\')'
                            : 'return false;'); ?>">
                                <i class="far fa-trash-alt"></i>
                            </a>
                            <?php endif; ?>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
        <?php endif; ?>
    </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/claims/member_claims.blade.php ENDPATH**/ ?>