

<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
           <h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
            <?php echo e(__('Transactions')); ?>

        </h2>



<?php $__env->startSection('content'); ?>
<div class="container">
    <h2>Total Transactions</h2>

    <?php if(session('success')): ?>
        <div class="alert alert-success"><?php echo e(session('success')); ?></div>
    <?php endif; ?>

    <div class="table-responsive">
        <table class="table table-hover table-sm align-middle">
            <thead>
                <tr>
                    <th>Reference</th>
                    <th>Member</th>
                    <th>Type</th>
                    <th>Amount (TSH)</th>
                    <th>Balance Before</th>
                    <th>Balance After</th>
                    <th>Payment Method</th>
                    <th>Date</th>
                    <th>Recorded By</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td><?php echo e($transaction->transaction_reference); ?></td>
                    <td><?php echo e($transaction->member->name); ?></td>
                    <td><?php echo e(ucfirst(str_replace('_', ' ', $transaction->transaction_type))); ?></td>
                    <td><?php echo e(number_format($transaction->amount)); ?></td>
                    <td><?php echo e(number_format($transaction->balance_before)); ?></td>
                    <td><?php echo e(number_format($transaction->balance_after)); ?></td>
                    <td><?php echo e(ucfirst($transaction->payment_method)); ?></td>
                    <td><?php echo e($transaction->transaction_date->format('d M Y')); ?></td>
                    <td><?php echo e($transaction->recorder->name ?? 'N/A'); ?></td>
                    <td>
                        <a href="<?php echo e(route('transactions.show', $transaction->id)); ?>" class="btn btn-sm btn-outline-primary" title="View">
                            <i class="fas fa-eye"></i>
                        </a>
                        <?php if(!$transaction->reversed): ?>
                        <form action="<?php echo e(route('transactions.reverse', $transaction->id)); ?>" method="POST" class="d-inline">
                            <?php echo csrf_field(); ?>
                            <?php echo method_field('POST'); ?>
                            <button type="submit" class="btn btn-sm btn-outline-danger" title="Reverse" onclick="return confirm('Are you sure you want to reverse this transaction?')">
                                <i class="fas fa-undo"></i>
                            </button>
                        </form>
                        <?php endif; ?>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
    </div>

    <?php echo e($transactions->links()); ?>

</div>
<?php $__env->stopSection(); ?>
 <?php $__env->endSlot(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH /var/www/html/Arise/resources/views/transactions/index.blade.php ENDPATH**/ ?>