<?php $__env->startSection('content'); ?>
    <form action="">
        <div class="d-flex justify-content-end mb-3">
            <div class="input-group w-auto">
                <input class="form-control" name="search" placeholder="<?php echo app('translator')->get('Search by trx , Booking no.'); ?>" type="search" value="<?php echo e(request()->search); ?>">
                <button class="input-group-text bg--base border-0 text-white">
                    <i class="las la-search"></i>
                </button>
            </div>
        </div>
    </form>
    <div class="table-responsive--md">
        <table class="custom--table table">
            <thead>
                <tr>
                    <th><?php echo app('translator')->get('Gateway | Transaction'); ?></th>
                    <th><?php echo app('translator')->get('Booking No.'); ?> | <?php echo app('translator')->get('Initiated At'); ?></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 = $deposits; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $deposit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td>
                            <span class="fw-bold"> <span class="text-primary"><?php echo e(__($deposit->gateway?->name)); ?></span> </span>
                            <br>
                            <small> <?php echo e($deposit->trx); ?> </small>
                        </td>

                        <td>
                            <small class="text--success"><?php echo e($deposit->booking->booking_number); ?></small><br><?php echo e(showDateTime($deposit->created_at)); ?>

                        </td>
                        <td>
                            =<?php echo e(showAmount($deposit->amount)); ?> + <span class="text-danger" data-bs-toggle="tooltip" title="<?php echo app('translator')->get('Charge'); ?>"><?php echo e(showAmount($deposit->charge, currencyFormat: false)); ?> </span>
                            <br>
                            <strong data-bs-toggle="tooltip" title="<?php echo app('translator')->get('Amount with charge'); ?>">
                                <?php echo e(showAmount($deposit->amount + $deposit->charge)); ?>

                            </strong>
                        </td>
                        <td>
                            1 <?php echo e(__(gs()->cur_text)); ?> = <?php echo e(showAmount($deposit->rate, currencyFormat: false)); ?> <?php echo e(__($deposit->method_currency)); ?>

                            <br>
                            <strong><?php echo e(showAmount($deposit->final_amount, currencyFormat: false)); ?> <?php echo e(__($deposit->method_currency)); ?></strong>
                        </td>
                        <td>
                            <?php echo $deposit->statusBadge ?>
                        </td>
                        <?php
                            $details = $deposit->detail != null ? json_encode($deposit->detail) : null;
                        ?>

                        <td>
                            <button <?php if($deposit->method_code >= 1000): ?> data-info="<?php echo e($details); ?>" <?php endif; ?> <?php if($deposit->status == Status::PAYMENT_REJECT): ?> data-admin_feedback="<?php echo e($deposit->admin_feedback); ?>" <?php endif; ?> class="btn btn-sm btn-outline--base ms-1 <?php if($deposit->method_code >= 1000): ?> detailBtn <?php else: ?> disabled <?php endif; ?>" title="<?php echo app('translator')->get('Detail'); ?>" type="button">
                                <i class="la la-desktop"></i>
                                </butto>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td class="text-center" colspan="100%"><?php echo e(__($emptyMessage)); ?></td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>

    <?php if($deposits->hasPages()): ?>
        <?php echo e($deposits->links()); ?>

    <?php endif; ?>

    
    <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>
                    <span aria-label="Close" class="close" data-bs-dismiss="modal" type="button">
                        <i class="las la-times"></i>
                    </span>
                </div>
                <div class="modal-body">
                    <ul class="list-group list-group-flush mb-2 userData"></ul>
                    <div class="feedback"></div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-dark btn-sm" data-bs-dismiss="modal" type="button"><?php echo app('translator')->get('Close'); ?></button>
                </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('info');
                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 p-0">
                                <span>${element.name}</span>
                                <span">${element.value}</span>
                            </li>`;
                        }
                    });
                }

                modal.find('.userData').html(html);

                if ($(this).data('admin_feedback') != undefined) {
                    var adminFeedback = `
                        <div class="my-3 pt-3 border-top">
                            <h6 class="text-start"><?php echo app('translator')->get('Admin Feedback'); ?></h6>
                            <p>${$(this).data('admin_feedback')}</p>
                        </div>
                    `;
                } else {
                    var adminFeedback = '';
                }

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

<?php echo $__env->make($activeTemplate . 'layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/ryanupiz/pan.ryangroups.com/hotel/viserhotel/Files/core/resources/views/templates/basic/user/deposit_history.blade.php ENDPATH**/ ?>