<?php $__env->startSection('body'); ?>

    <?php echo $__env->make('Customer.left-menu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

    <main id="main" class="main">
        <div class="pagetitle">
            <h1>Bill Pay</h1>
            <nav>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="<?php echo e(route('customerDashboard')); ?>">Home</a></li>
                    <li class="breadcrumb-item active">Bill Pay</li>
                </ol>
            </nav>
        </div><!-- End Page Title -->
        <section class="section profile">
            <div class="row">

                <div class="col-xl-8">

                    <div class="card">
                        <div class="card-body pt-3">
                            <!-- Bordered Tabs -->

                            <?php if(Session::has('successMsg')): ?>
                                <p class="alert alert-info"><?php echo e(Session::get('successMsg')); ?></p>
                            <?php endif; ?>
                            <?php if(Session::has('error')): ?>
                                <p class="alert alert-danger"><?php echo e(Session::get('error')); ?></p>
                            <?php endif; ?>

                            <div class="tab-content pt-2">

                                <div class="tab-pane fade show active profile-overview" id="profile-overview">
                                    <h5 class="card-title">Profile Details</h5>

                                    <?php if(json_decode(siteinfo()->payment_url)->payment_url_enable == 'on'): ?>
                                        <h2>Pay now Using Different Url</h2>
                                        <a href="<?php echo e(json_decode(siteinfo()->payment_url)->payment_url); ?>" target="_blank"
                                            class="btn btn-danger mb-5" style="padding:10px 50px;">Pay Now</a>
                                    <?php endif; ?>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label ">Full Name</div>
                                        <div class="col-lg-9 col-md-8">
                                            <?php echo e($details['userinfo']->clientsinfo->clients_name); ?></div>
                                    </div>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">Subscriber ID</div>
                                        <div class="col-lg-9 col-md-8"><?php echo e($details['userinfo']->id); ?></div>
                                    </div>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">PACKAGE NAME</div>
                                        <div class="col-lg-9 col-md-8"><?php echo e($details['package']->package_name); ?></div>
                                    </div>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">STATUS</div>
                                        <div class="col-lg-9 col-md-8">
                                            <?php if($details['userinfo']->clients_status == 'expired'): ?>
                                                <span
                                                    class="badge bg-danger"><?php echo e($details['userinfo']->clients_status); ?></span>
                                            <?php else: ?>
                                                <span
                                                    class="badge bg-success"><?php echo e($details['userinfo']->clients_status); ?></span>
                                            <?php endif; ?>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">PACKAGE PRICE</div>
                                        <?php if(checkSettings('ResellerClientOnlineRecharge') == 'enable' && $details['userinfo']->pop->bill_generate == 'no'): ?>
                                            <?php if(checkSettings('setClientPaymentAmountToClient') == 'enable' && $details['userinfo']->client_payment_amount > 0): ?>
                                                <div class="col-lg-9 col-md-8">
                                                    <?php echo e($details['userinfo']->client_payment_amount); ?></div>
                                            <?php else: ?>
                                                <div class="col-lg-9 col-md-8">
                                                    <?php echo e($details['package']->client_payment_amount); ?></div>
                                            <?php endif; ?>
                                        <?php else: ?>
                                            <div class="col-lg-9 col-md-8"><?php echo e($details['package']->package_rate); ?></div>
                                        <?php endif; ?>
                                    </div>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">CURRENT BALANCE</div>
                                        <div class="col-lg-9 col-md-8">
                                            <?php if(checkSettings('ResellerClientOnlineRecharge') == 'enable' &&
                                                    $details['userinfo']->pop->bill_generate == 'no' &&
                                                    $details['userinfo']->un_recharge_amount > 0): ?>
                                                <?php echo e($details['userinfo']->un_recharge_amount); ?>

                                            <?php else: ?>
                                                <?php if(isset($details['account']->dueAmount) && $details['account']->dueAmount < 1): ?>
                                                    <?php echo e(abs($details['account']->dueAmount)); ?>

                                                <?php else: ?>
                                                    0
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </div>
                                    </div>

                                    <?php if($details['userinfo']->pop->bill_generate != 'no'): ?>
                                        <div class="row">
                                            <div class="col-lg-3 col-md-4 label">Due Balance</div>
                                            <div class="col-lg-9 col-md-8">
                                                <?php if(isset($details['account']->dueAmount) && $details['account']->dueAmount > 0): ?>
                                                    <span class="text-red-600 font-bold">
                                                        <?php echo e(abs($details['account']->dueAmount)); ?> </span>
                                                <?php else: ?>
                                                    0
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    <?php endif; ?>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">EXPIRE DATE</div>
                                        <div class="col-lg-9 col-md-8">
                                            <?php echo e(date('d-M-Y', strtotime($details['userinfo']->expire_date))); ?></div>
                                    </div>



                                    <div class="row d-none">
                                        <div class="col-lg-3 col-md-4 label ">Name</div>
                                        <div class="col-lg-9 col-md-8">
                                            <input type="text" name="customer_name" class="border px-3 py-1"
                                                id="customer_name" placeholder=""
                                                value="<?php echo e($details['userinfo']->clientsinfo->clients_name); ?>"
                                                value="" required>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">Mobile</div>
                                        <div class="col-lg-9 col-md-8">
                                            <input type="text" name="customer_mobile" class="border px-4 py-1"
                                                id="mobile" placeholder="Mobile" readonly
                                                value="<?php echo e($details['userinfo']->clientsinfo->contact_no); ?>" required>
                                        </div>
                                    </div>

                                    <div class="row d-none">
                                        <div class="col-lg-3 col-md-4 label">Email</div>
                                        <div class="col-lg-9 col-md-8">
                                            <input type="email" name="customer_email" class="border px-4 py-1"
                                                id="email"
                                                value="<?php echo e($details['userinfo']->clientsinfo->email ?? 'test@gmail.com'); ?>"
                                                placeholder="you@example.com" required>
                                        </div>
                                    </div>

                                    <div class="row d-none">
                                        <div class="col-lg-3 col-md-4 label">Address</div>
                                        <div class="col-lg-9 col-md-8">
                                            <input type="text" class="border px-4 py-1 " id="address" name="address1"
                                                placeholder="1234 Main St"
                                                value="<?php echo e($details['userinfo']->clientsinfo->area); ?>" value=""
                                                required>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">Payment Amount</div>
                                        <div class="col-lg-9 col-md-8">
                                            <input type="hidden" id="customer_id" name="customer_id" class=""
                                                value="<?php echo e($details['userinfo']->id); ?>">

                                            <?php if(checkSettings('ResellerClientOnlineRecharge') == 'enable' && $details['userinfo']->pop->bill_generate == 'no'): ?>
                                                <?php if(checkSettings('setClientPaymentAmountToClient') == 'enable' && $details['userinfo']->client_payment_amount > 0): ?>
                                                    <input type="number" min="0" name="amount" id="amount"
                                                        value="<?php echo e($details['userinfo']->client_payment_amount); ?>"
                                                        class="border px-4 py-1" required readonly />
                                                <?php else: ?>
                                                    <input type="number" min="0" name="amount" id="amount"
                                                        value="<?php echo e($details['package']->client_payment_amount); ?>"
                                                        class="border px-4 py-1" required readonly />
                                                <?php endif; ?>
                                            <?php else: ?>
                                                <?php if(getBillingType() === 'day_to_day'): ?>
                                                    <?php if(checkSettings('change_payment_amount_client_portal') == 'enable'): ?>
                                                        <input type="number" min="0" name="amount"
                                                            id="amount" value="<?php echo e(abs($bill_amount)); ?>"
                                                            class="border px-4 py-1" required <?php echo e((checkSettings('change_payment_amount_client_portal') == 'enable' ? '' : 'readonly')); ?>/>
                                                    <?php else: ?>
                                                        <input type="hidden" min="0" value="<?php echo e($bill_amount); ?>"
                                                            name="amount" id="amount" class="border px-4 py-1"
                                                            required <?php echo e((checkSettings('change_payment_amount_client_portal') == 'enable' ? '' : 'readonly')); ?> /> <?php echo e($bill_amount); ?>

                                                    <?php endif; ?>
                                                <?php else: ?>
                                                    <?php if(isset($details['account']->dueAmount) && $details['account']->dueAmount > 0): ?>
                                                        <input type="number" min="0" name="amount"
                                                            id="amount"
                                                            value="<?php echo e(abs($details['account']->dueAmount)); ?>"
                                                            class="border px-4 py-1" required <?php echo e((checkSettings('change_payment_amount_client_portal') == 'enable' ? '' : 'readonly')); ?>/>
                                                    <?php else: ?>
                                                        <input type="number" min="0" name="amount"
                                                            id="amount"
                                                            value="<?php echo e($details['package']->package_rate - $details['userinfo']->parmanent_discount); ?>"
                                                            class="border px-4 py-1" required <?php echo e((checkSettings('change_payment_amount_client_portal') == 'enable' ? '' : 'readonly')); ?>/>
                                                    <?php endif; ?>
                                                <?php endif; ?>
                                            <?php endif; ?>

                                        </div>
                                    </div>

                                    <?php
                                        $payment_button = collect(siteinfo()->payment_button);
                                        $bkash_image_btn = $buttons->where('type', 'bkash_img')->first();
                                        $ssl_image_btn = $buttons->where('type', 'ssl_img')->first();
                                        $upay_image_btn = $buttons->where('type', 'upay_img')->first();
                                        $nagad_image_btn = $buttons->where('type', 'nagod_img')->first();

                                    ?>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label">Pay Now</div>
                                        <div class="col-lg-9 col-md-8">
                                            <?php if(checkSettings('ssl-commerz-show') == 'enable'): ?>
                                                <td class="p-2 w-1/2">
                                                    <button type="button" id="paySSL" class="btn btn-default">

                                                        <img style="height:50px;border:1px solid #ddd; border-radius:5px;padding:5px;"
                                                            src="<?php if(!empty($ssl_image_btn)): ?> <?php echo e(asset('storage/company/' . $ssl_image_btn->value)); ?> <?php else: ?> visa.png <?php endif; ?>"
                                                            alt="">
                                                    </button>

                                                    <button style="display: none"
                                                        class="hidden btn btn-primary btn-lg btn-block" id="sslczPayBtn"
                                                        token="if you have any token validation"
                                                        postdata="your javascript arrays or objects which requires in backend"
                                                        order="If you already have the transaction generated for current order"
                                                        endpoint="<?php echo e(url('/pay-via-ajax')); ?>"> Pay Now
                                                    </button>
                                                </td>
                                            <?php endif; ?>


                                            <?php if(checkSettings('bkash-show') == 'enable'): ?>
                                                <td class="p-2 w-1/2">

                                                    <?php if(checkSettings('bkash-tokenized') == 'enable'): ?>
                                                        <button class="btn btn-default" id="bKash_payment">
                                                            Pay with bKash

                                                            <img style="height:50px;border:1px solid #ddd; border-radius:5px;padding:5px;"
                                                                src="<?php if(!empty($bkash_image_btn)): ?> <?php echo e(asset('storage/company/' . $bkash_image_btn->value)); ?> <?php else: ?> https://www.bkash.com/sites/all/themes/bkash/logo.png <?php endif; ?>"
                                                                alt="">
                                                        </button>
                                                    <?php endif; ?>

                                                    <?php if(checkSettings('bkash-checkout') == 'enable'): ?>
                                                        <button id="bKash_button" class="btn btn-default"
                                                            onclick="BkashPayment()">
                                                            <img style="height:50px;border:1px solid #ddd; border-radius:5px;padding:5px;"
                                                                src="<?php if(!empty($bkash_image_btn)): ?> <?php echo e(asset('storage/company/' . $bkash_image_btn->value)); ?> <?php else: ?> https://www.bkash.com/sites/all/themes/bkash/logo.png <?php endif; ?>"
                                                                alt="">
                                                        </button>
                                                    <?php endif; ?>

                                                </td>
                                            <?php endif; ?>

                                            <?php if(checkSettings('uddokta-pay-show') == 'enable'): ?>
                                                <td class="p-2 w-1/2">
                                                    <button class="btn btn-danger" type="button"
                                                        id="uddokta_pay">Uddokta Pay</button>
                                                </td>
                                            <?php endif; ?>

                                            <?php if(checkSettings('pay-with-eps') == 'enable'): ?>
                                                <td class="p-2 w-1/2">
                                                    <button class="btn btn-danger" type="button" id="eps_pay">EPS
                                                        Pay</button>
                                                </td>
                                            <?php endif; ?>

                                            <?php if(checkSettings('upay-payment') == 'enable'): ?>
                                                <button class="btn btn-default" id="upay_payment">
                                                    Pay with Upay
                                                    <img style="height:50px;border:1px solid #ddd; border-radius:5px;padding:5px;"
                                                        src="<?php if(!empty($upay_image_btn)): ?> <?php echo e(asset('storage/company/' . $upay_image_btn->value)); ?> <?php else: ?> <?php endif; ?>"
                                                        alt="">
                                                </button>
                                            <?php endif; ?>

                                            <?php if(checkSettings('nagad-checkout-client-payment') == 'enable'): ?>
                                                <button class="btn btn-default" id="nagad_payment">
                                                    Pay with Nagad
                                                    <img style="height:50px;border:1px solid #ddd; border-radius:5px;padding:5px;"
                                                        src="<?php if(!empty($nagad_image_btn)): ?> <?php echo e(asset('storage/company/' . $nagad_image_btn->value)); ?> <?php else: ?> <?php endif; ?>"
                                                        alt="">
                                                </button>
                                            <?php endif; ?>

                                            <?php if(checkSettings('surjo-pay-show') == 'enable'): ?>
                                                <button class="btn btn-default" id="surjo_payment">
                                                    Pay with Surjo
                                                    <img style="height:50px;border:1px solid #ddd; border-radius:5px;padding:5px;"
                                                        src="<?php echo e(asset('images/payment_getway/shurjopay.png')); ?>"
                                                        alt="">
                                                </button>
                                            <?php endif; ?>

                                            <?php if(checkSettings('nagad_health_service') == 'enable'): ?>
                                                <br>
                                                <p>
                                                    <a href="https://milvikbd.com/milvik-health-product/?fbclid=IwQ0xDSwLygchleHRuA2FlbQIxMAABHia9sn_UcTZZpu6CmKgg8N-IzZzpo41kCoHkd89XAMbt5DjUrxuwZaHrQGPK_aem_KWA4F-z0R7E5RNqbb_J9Bw">
                                                        Health Benefit for Circle Users
                                                        <img src="https://milvikbd.com/wp-content/uploads/2024/05/Menu-Logo.svg" alt="Health Benefit"
                                                            style="height: 80px; width: 80px; border-radius: 5px; padding: 5px;">
                                                    </a>
                                                </p>

                                            <?php endif; ?>



                                            


                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-lg-3 col-md-4 label"></div>
                                        <div class="col-lg-9 col-md-8">


                                        </div>



                                    </div>
                                </div><!-- End Bordered Tabs -->

                            </div>
                        </div>

                        <div class="card-footer">
                            <button class="btn btn-primary"><a href="<?php echo e(route('customerDashboard')); ?>"
                                    class="text-light"><i class="fa fa-arrow-left"></i>
                                    Back</a></button>
                        </div>

                    </div>




                </div>
        </section>

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

<?php $__env->startSection('script'); ?>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"
        integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
        integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous">
    </script>
    <link rel="stylesheet" href="<?php echo e(asset('/')); ?>css/toastr.min.css">
    <script src="<?php echo e(asset('/')); ?>js/toastr.min.js"></script>

    <?php echo Toastr::message(); ?>


    <?php if(checkSettings('ssl-commerz-show') == 'enable'): ?>
        <?php echo $__env->make('Customer.sslcommerz-script', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php endif; ?>

    <?php if(checkSettings('bkash-tokenized') == 'enable'): ?>
        <?php echo $__env->make('Customer.bkash-tokenized', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php endif; ?>
    <?php if(checkSettings('bkash-checkout') == 'enable'): ?>
        <?php echo $__env->make('Customer.bkash-checkout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php endif; ?>
    <?php if(checkSettings('upay-payment') == 'enable'): ?>
        <?php echo $__env->make('Customer.upay-payment', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php endif; ?>

    <?php if(checkSettings('nagad-checkout-client-payment') == 'enable'): ?>
        <?php echo $__env->make('Customer.nagad_checkout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php endif; ?>

    <script>
        // onclick uddokta_pay button send request to pay route
        $('#uddokta_pay').click(function() {

            if ($('#amount').val() == '') {
                toastr.error('Amount is required');
            } else if ($('#customer_name').val() == '') {
                toastr.error('Customer name is required');
            } else if ($('#mobile').val() == '') {
                toastr.error('Mobile number is required');
            } else {
                //submit for
                $.ajax({
                    url: "<?php echo e(route('uddoktapay.pay')); ?>",
                    type: "POST",
                    data: {
                        full_name: $('#customer_name').val(),
                        mobile: $('#mobile').val(),
                        email: $('#email').val(),
                        amount: $('#amount').val(),
                        customer_id: $('#customer_id').val()
                    },
                    success: function(data) {
                        if (data.status == 'success') {
                            window.location.href = data.payment_url;
                        } else {
                            toastr.error(data.message);
                        }
                        //
                    }
                });
            }


        });

        var obj = {};

        $('#eps_pay').on('click', function() {
            obj.cus_name = $('#customer_name').val();
            obj.cus_phone = $('#mobile').val();
            obj.cus_email = $('#email').val() == '' ? 'demo@example.com' : $('#email').val();
            obj.cus_addr1 = $('#address').val();
            obj.amount = $('#amount').val();
            obj.customer_id = $('#customer_id').val();

            // console.log('comes to eps here');

            if ($('#mobile').val() != '' && $('#amount').val() != '' && $('#amount').val() != '') {
                var token = '<?php echo e(csrf_token()); ?>';

                $.ajax({
                    url: "<?php echo e(route('eps-payment-token')); ?>",
                    type: 'GET',
                    data: obj,
                    headers: {
                        "X-CSRF-TOKEN": token
                    },
                    success: function(result) {
                        if (result.status == 'error') {
                            toastr.error(result.message);
                        } else {
                            window.location.href = result.RedirectURL;
                            // $(location).attr('href', result.message);
                        }
                        // console.log(result, 'response Result');
                    },
                    error: function(err) {
                        toastr.error(err.message);
                    }
                });
            } else {
                if ($('#mobile').val() == '') {
                    toastr.error('Mobile Number is required');
                }
                if ($('#amount').val() == '') {
                    toastr.error('Amount is required');
                }
            }
        });
    </script>

    <?php echo $__env->make('Customer.surjopayscript', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('Customer.customer-layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/airnet/radius-circle/resources/views/Customer/customer_payment.blade.php ENDPATH**/ ?>