<?php $__env->startSection('content'); ?>
    <div class="dashboard-top mb-4">
        <form class="search-form" method="GET">
            <div class="input-group">
                <input class="form-control form--control bg-white" type="text" name="search" value="<?php echo e(request()->search); ?>"
                    placeholder="<?php echo app('translator')->get('Search by transactions'); ?>" id="search">
                <button class="btn btn--base" type="submit">
                    <i class="fas fa-search"></i>
                </button>
            </div>
        </form>
        <a href="<?php echo e(route('user.withdraw')); ?>" class="btn btn--base btn--lg" role="button">
            <i class="fas fa-plus"></i>
            <span><?php echo app('translator')->get('Withdraw Now'); ?></span>
        </a>
    </div>
    <div class="table-section">
        <div class="table-area">
            <table class="table table--custom table-responsive--xl">
                <thead>
                    <tr>
                        <th><?php echo app('translator')->get('Gateway | Transaction'); ?></th>
                        <th><?php echo app('translator')->get('Initiated'); ?></th>
                        <th><?php echo app('translator')->get('Amount'); ?></th>
                        <th><?php echo app('translator')->get('Conversion'); ?></th>
                        <th><?php echo app('translator')->get('Status'); ?></th>
                        <th><?php echo app('translator')->get('Details'); ?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $withdraws; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $withdraw): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td>
                                <div>
                                    <span class="fw-bold"><span
                                            class="text--base"><?php echo e(__(@$withdraw->method->name)); ?></span></span>
                                    <br>
                                    <small><?php echo e($withdraw->trx); ?></small>
                                </div>
                            </td>
                            <td class="text-md-center">
                                <div>
                                    <?php echo e(showDateTime($withdraw->created_at)); ?> <br>
                                    <?php echo e(diffForHumans($withdraw->created_at)); ?>

                                </div>
                            </td>
                            <td class="text-md-center">
                                <div>
                                    <span data-bs-toggle="tooltip" data-bs-placement="top"
                                        title="<?php echo app('translator')->get('Requested Amount'); ?>"><?php echo e(showAmount($withdraw->amount)); ?></span> - <span
                                        class="text--danger" data-bs-toggle="tooltip" data-bs-placement="top"
                                        title="<?php echo app('translator')->get('Charge'); ?>"><?php echo e(showAmount($withdraw->charge)); ?></span>
                                    <br>
                                    <strong data-bs-toggle="tooltip" data-bs-placement="top" title="<?php echo app('translator')->get('Amount after charge'); ?>">
                                        <?php echo e(showAmount($withdraw->amount - $withdraw->charge)); ?>

                                    </strong>
                                </div>
                            </td>
                            <td class="text-md-center">
                                <div>
                                    <span data-bs-toggle="tooltip" data-bs-placement="top" title="<?php echo app('translator')->get('Rate'); ?>">
                                        1 <?php echo e(__(gs('cur_text'))); ?> =
                                        <?php echo e(showAmount($withdraw->rate, currencyFormat: false)); ?>

                                        <?php echo e(__($withdraw->currency)); ?>

                                    </span>
                                    <br>
                                    <strong data-bs-toggle="tooltip" data-bs-placement="top" title="<?php echo app('translator')->get('Final Amount'); ?>">
                                        <?php echo e(showAmount($withdraw->final_amount, currencyFormat: false)); ?>

                                        <?php echo e(__($withdraw->currency)); ?>

                                    </strong>
                                </div>
                            </td>
                            <td class="text-md-center">
                                <div>
                                    <?php echo $withdraw->statusBadge ?>
                                </div>
                            </td>
                            <td>
                                <div class="text-end">
                                    <button class="btn btn--base text-white btn-sm ms-1 detailBtn" data-bs-toggle="tooltip"
                                        data-bs-placement="top" data-bs-offset="0,8"
                                        data-user_data="<?php echo e(json_encode($withdraw->withdraw_information)); ?>"
                                        title="<?php echo app('translator')->get('Details'); ?>"
                                        <?php if($withdraw->status == Status::PAYMENT_REJECT): ?> data-admin_feedback="<?php echo e($withdraw->admin_feedback); ?>" <?php endif; ?>>
                                        <i class="las la-desktop"></i>
                                    </button>
                                </div>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="100%" class="text-center">

                                <?php echo $__env->make('Template::partials.empty', [
                                    'message' => 'No withdraw yet!',
                                ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>

            <?php if($withdraws->hasPages()): ?>
                <?php echo e(paginateLinks($withdraws)); ?>

            <?php endif; ?>
        </div>
    </div>

    
    <div class="modal fade" id="detailModal" role="dialog" tabindex="-1">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php echo app('translator')->get('Details'); ?></h5>
                    <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                        <i class="las la-times"></i>
                    </button>
                </div>
                <div class="modal-body">
                    <ul class="list-group userData list-group-flush"></ul>
                    <div class="feedback"></div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('script'); ?>
    <script>
        (function($) {
            "use strict";
            $('.detailBtn').on('click', function() {
                var modal = $('#detailModal');
                var userData = $(this).data('user_data');
                var html = ``;
                if (userData) {
                    userData.forEach(element => {
                        if (element.type != 'file') {
                            html += `
                        <li class="list-group-item d-flex justify-content-between align-items-center">
                            <span>${element.name}</span>
                            <span>${element.value}</span>
                        </li>`;
                        }
                    });
                }
                modal.find('.userData').html(html);

                var adminFeedback = $(this).data('admin_feedback') ? `
                <div class="my-3">
                    <strong><?php echo app('translator')->get('Admin Feedback'); ?></strong>
                    <p>${$(this).data('admin_feedback')}</p>
                </div>` : '';

                modal.find('.feedback').html(adminFeedback);
                modal.modal('show');
            });
        })(jQuery);
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('Template::layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/mojibor/work.mojibor.com/core/resources/views/templates/basic/user/withdraw/log.blade.php ENDPATH**/ ?>