
<?php $__env->startSection('content'); ?>
    <div class="page-container">

        <div class="page-title-head d-flex align-items-sm-center flex-sm-row flex-column gap-2">
            <div class="flex-grow-1">
                <h4 class="fs-18 fw-semibold mb-0"><?php echo e($title); ?></h4>
            </div>

            <div class="text-end">
                <?php if (isset($component)) { $__componentOriginalb2c223f2cabdcb0c6da76bfac943142c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalb2c223f2cabdcb0c6da76bfac943142c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.dashboard.admin.breadcrumbs','data' => ['breadcrumbs' => $breadcrumbs]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('dashboard.admin.breadcrumbs'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['breadcrumbs' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($breadcrumbs)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalb2c223f2cabdcb0c6da76bfac943142c)): ?>
<?php $attributes = $__attributesOriginalb2c223f2cabdcb0c6da76bfac943142c; ?>
<?php unset($__attributesOriginalb2c223f2cabdcb0c6da76bfac943142c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalb2c223f2cabdcb0c6da76bfac943142c)): ?>
<?php $component = $__componentOriginalb2c223f2cabdcb0c6da76bfac943142c; ?>
<?php unset($__componentOriginalb2c223f2cabdcb0c6da76bfac943142c); ?>
<?php endif; ?>
            </div>
        </div>

        <div class="row">
            <?php echo $__env->make('dashboard.admin.user.partials.account_options_and_status', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <div class="col-lg-12">
                <?php if (isset($component)) { $__componentOriginal9f62502e3945f54811d2559dbe1792df = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9f62502e3945f54811d2559dbe1792df = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.dashboard.available_balance','data' => ['user' => $user]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('dashboard.available_balance'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['user' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($user)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9f62502e3945f54811d2559dbe1792df)): ?>
<?php $attributes = $__attributesOriginal9f62502e3945f54811d2559dbe1792df; ?>
<?php unset($__attributesOriginal9f62502e3945f54811d2559dbe1792df); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9f62502e3945f54811d2559dbe1792df)): ?>
<?php $component = $__componentOriginal9f62502e3945f54811d2559dbe1792df; ?>
<?php unset($__componentOriginal9f62502e3945f54811d2559dbe1792df); ?>
<?php endif; ?>
                
                <div class="card">
                    <div class="card-header border-bottom">
                        <h5 class="card-title mb-0">
                            Fund Account
                        </h5>
                    </div>
                    <div class="card-body">
                        <form action="<?php echo e(route('admin.user.transaction.store', $user->uuid)); ?>" method="POST">
                            <?php echo csrf_field(); ?>
                            <div class="row">
                                <!-- Amount -->
                                <div class="col-md-6 mb-3">
                                    <label for="amount" class="form-label">Amount</label>
                                    <input type="number" step="0.01" min="0"
                                        class="form-control <?php $__errorArgs = ['amount'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="amount"
                                        name="amount" value="<?php echo e(old('amount', 100000)); ?>">
                                    <?php $__errorArgs = ['amount'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <span class="invalid-feedback"><?php echo e($message); ?></span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>

                                <!-- Type -->
                                <div class="col-md-6 mb-3">
                                    <label for="type" class="form-label">Transaction Type</label>
                                    <select id="type" name="type"
                                        class="form-select <?php $__errorArgs = ['type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                                        <option value="">-- Select Type --</option>
                                        <?php $__currentLoopData = $transactionTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transactionType): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($transactionType->value); ?>"
                                                <?php echo e(old('type', 'deposit') == $transactionType->value ? 'selected' : ''); ?>>
                                                <?php echo e($transactionType->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <span class="invalid-feedback"><?php echo e($message); ?></span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>

                                <!-- Direction -->
                                <div class="col-md-6 mb-3">
                                    <label for="direction" class="form-label">Transaction Direction</label>
                                    <select id="direction" name="direction"
                                        class="form-select <?php $__errorArgs = ['direction'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                                        <option value="">-- Select Direction --</option>
                                        <?php $__currentLoopData = $transactionDirections; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transactionDirection): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($transactionDirection->value); ?>"
                                                <?php echo e(old('direction', 'credit') == $transactionDirection->value ? 'selected' : ''); ?>>
                                                <?php echo e($transactionDirection->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['direction'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <span class="invalid-feedback"><?php echo e($message); ?></span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>

                                <!-- Date -->
                                <div class="col-md-6 mb-3">
                                    <label for="transaction_at" class="form-label">Transaction Date</label>
                                    <input type="datetime-local"
                                        class="form-control <?php $__errorArgs = ['transaction_at'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                        id="transaction_at" name="transaction_at"
                                        value="<?php echo e(old('transaction_at', now()->format('Y-m-d H:i:s'))); ?>">
                                    <?php $__errorArgs = ['transaction_at'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <span class="invalid-feedback"><?php echo e($message); ?></span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>

                                <!-- Description -->
                                <div class="col-md-6 mb-3">
                                    <label for="description" class="form-label">Description</label>
                                    <input type="text" class="form-control <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                        id="description" name="description"
                                        value="<?php echo e(old('description', 'User initiated transaction')); ?>"
                                        placeholder="Optional">
                                    <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <span class="invalid-feedback"><?php echo e($message); ?></span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>

                                <!-- Notification -->
                                <div class="col-md-6 mb-3">
                                    <label for="notification" class="form-label">Send Notification</label>
                                    <select id="notification" name="notification"
                                        class="form-select <?php $__errorArgs = ['notification'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                                        <option value="none" <?php echo e(old('notification') == 'none' ? 'selected' : ''); ?>>
                                            None
                                        </option>
                                        <option value="email"
                                            <?php echo e(old('notification', 'email') == 'email' ? 'selected' : ''); ?>>
                                            Email
                                        </option>
                                    </select>
                                    <?php $__errorArgs = ['notification'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <span class="invalid-feedback"><?php echo e($message); ?></span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>

                            <button type="submit" class="btn btn-primary"> <i class="fa-solid fa-paper-plane me-1"></i>
                                Submit Transaction</button>
                        </form>

                    </div>
                </div>
                <div class="card">
                    <div class="card-header border-bottom">
                        <h5 class="card-title mb-0">
                            Transaction History
                        </h5>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table id="myTable" class="table table-bordered">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>Reference ID</th>
                                        <th>Type</th>
                                        <th>Description</th>
                                        <th>Amount</th>
                                        <th>Balance</th>
                                        <th>Date</th>
                                        <th>Status</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__currentLoopData = $transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td><?php echo e($loop->iteration); ?></td>
                                            <td><?php echo e($transaction->reference_id); ?></td>
                                            <td>
                                                <?php echo e($transaction->type->label()); ?>

                                            </td>
                                            <td>
                                                <?php echo e($transaction->description); ?>

                                            </td>
                                            <td>
                                                <?php if($transaction->isDirectionCredit()): ?>
                                                    <span
                                                        class="text-success">+<?php echo e(currency($user->currency)); ?><?php echo e(formatAmount($transaction->amount)); ?></span>
                                                <?php else: ?>
                                                    <span
                                                        class="text-danger">-<?php echo e(currency($user->currency)); ?><?php echo e(formatAmount($transaction->amount)); ?></span>
                                                <?php endif; ?>
                                            </td>
                                            <td>
                                                <?php echo e(currency($user->currency)); ?><?php echo e(formatAmount($transaction->current_balance)); ?>

                                            </td>
                                            <td>
                                                <?php echo e(formatDateTime($transaction->transaction_at)); ?>

                                            </td>
                                            <td>
                                                <span class="<?php echo e($transaction->status->badge()); ?>">
                                                    <?php echo e($transaction->status->label()); ?>

                                                </span>
                                            </td>
                                            <td>
                                                <a href="<?php echo e(route('admin.user.transaction.show', [$user->uuid, $transaction->uuid])); ?>"
                                                    class="btn btn-warning btn-sm m-1">
                                                    <i class="ti ti-eye me-1">
                                                    </i>View </a>
                                                <form
                                                    action="<?php echo e(route('admin.user.transaction.delete', [$user->uuid, $transaction->uuid])); ?>"
                                                    method="post">
                                                    <?php echo csrf_field(); ?>
                                                    <?php echo method_field('DELETE'); ?>
                                                    <button type="submit" class="btn btn-danger btn-sm m-1"
                                                        onclick="return confirm('Are you sure you want to delete this transaction?')">
                                                        <i class="ti ti-trash me-1"></i>Delete
                                                    </button>
                                                </form>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    </div><!-- end card-body -->
                </div><!-- end card -->
            </div>
            <!-- end col -->
        </div>
        <!-- end row -->

    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('dashboard.admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\projects\online-banking-v7.1\resources\views/dashboard/admin/user/transaction/index.blade.php ENDPATH**/ ?>