
<?php 
$title = 'Withdraw Bonus';
// require_once('../admin/lib/basic-function.php');
// require_once('../admin/lib/user-functions.php');
// require_once('../admin/lib/investment-plan-functions.php');
// require_once('../admin/lib/package-functions.php');
// require_once('../admin/lib/currency-functions.php');
require_once('header-links.php');

$current_pg = 5;
$affiliate = $basicFunctn->selectWhereDlt($basicFunctn->referrer_bonus_tb,'referrer_id',$user_logged['unique_id']);
$free_bonus = $basicFunctn->selectWhereDlt($basicFunctn->bonus_tb,'user_id',$user_logged['unique_id']);

// print_r($user_details);
// die();



?>

<body>
    <!-- BEGIN LOADER -->
    <div id="load_screen">
        <div class="loader">
            <div class="loader-content">
                <div class="spinner-grow align-self-center"></div>
            </div>
        </div>
    </div>
    <!--  END LOADER -->
    <!-- ajax loader -->
    <div style="display: none;" id="the_load_screen">
        <div class="loader">
            <div class="loader-content">
                <div class="spinner-grow align-self-center"></div>
            </div>
        </div>
    </div>
    <!-- ajax loader -->

    <!--  BEGIN NAVBAR  -->
    <?php require_once('header.php'); ?>
    <!--  END NAVBAR  -->

    <!--  BEGIN MAIN CONTAINER  -->
    <div class="main-container" id="container">

        <div class="overlay"></div>
        <div class="search-overlay"></div>

        <!--  BEGIN SIDEBAR  -->
        <?php require_once('sidebar.php'); ?>
        <!--  END SIDEBAR  -->

        <!--  BEGIN CONTENT AREA  -->
        <div id="content" class="main-content">
            <div class="layout-px-spacing">

                <div class="row layout-spacing">

                <div class="col-xl-8 col-lg-6 col-md-7 col-sm-12 layout-top-spacing">
                        <div class="widget-content widget-content-area">
                            <form id="contact" class="section contact withdraw_form">
                                <div class="info">
                                    <h5 class="">Withdraw Bonus</h5>
                                    <div class="row">
                                        <div class="col-md-11 mx-auto">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="form-group">
                                                        <label for="country">Transactions<span class="text-danger">*</span></label>
                                                        <select class="form-control" name="create_withdrawal_bonus">
                                                            <option value="" selected>-- Select Bonus To Withdraw From --</option>
                                                            <?php foreach ($affiliate as $e) { ?>
                                                                <option value="<?php print $e['unique_id']; ?>"><?php print $e['unique_id']; ?> => Affiliate Bonus ($<?php print round($e['amt_in_usd'],2); ?>)</option>
                                                            <?php } ?>
                                                            <?php foreach ($free_bonus as $e) { ?>
                                                                <option value="<?php print $e['unique_id']; ?>"><?php print $e['unique_id']; ?> => Free Bonus ($<?php print round($e['amt_in_usd'],2); ?>)</option>
                                                            <?php } ?>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-md-12">
                                                    <div class="form-group">
                                                        <label for="">Amount($)<span class="text-danger">*</span> </label>
                                                        <input type="number" class="form-control mb-4" name="amount" value="" placeholder="Enter amount in USD">
                                                    </div>
                                                </div>
                                                <div class="col-md-12 text-right mb-5">
                                                    <button id="add-work-platforms" class="btn btn-primary make_withdraw_btn">Create Withdrawal</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!-- Content -->
                    <div class="col-xl-4 col-lg-6 col-md-5 col-sm-12 layout-top-spacing">

                        <div class="user-profile layout-spacing">
                            <div class="widget-content widget-content-area">
                            <img src="assets/bg/1.jpg" >
                            </div>
                        </div>

                    </div>



                </div>
            </div>
            <!-- deposit modal -->
            <div id="deposit_pay_modal" class="modal animated zoomInUp register-modal" role="dialog">
                <div style="max-width: 400px;" class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header" id="registerModalLabel">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x">
                                    <line x1="18" y1="6" x2="6" y2="18"></line>
                                    <line x1="6" y1="6" x2="18" y2="18"></line>
                                </svg>
                            </button>
                        </div>
                        <div class="container">
                            <div class="form-group">
                                <div class="col-md-12 text-center">
                                    <h5 class="modal-title text-warning">TrustFort Finance</h5>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-12 text-center text-danger">
                                    <span>Transfer funds to the address below <i style="font-size: 20px;" class="bx bx-loader-circle rotate"></i></span>
                                </div>
                            </div>
                        </div>
                        <div style="padding-top: 0px;" class="modal-body">
                            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
                                <div class="user-profile layout-spacing">
                                    <div style="float: left;" class="widget-content widget-content-area">
                                        <div class="form-group">
                                            <div class="col-md-12 text-left">
                                                <span>Please send payment within 12hrs </span>
                                            </div>
                                        </div>
                                        <ul class="contacts-block list-unstyled">
                                            <li class="contacts-block__item" id="modal-pay-details">
                                                <div class="social text-success">
                                                    <div class="brand-name mb-3 text-left ">Payment Address</div>
                                                    <div class="brand-name mb-3 text-right">CVHHN89Y83J89JJ8</div>
                                                </div>
                                                <div class="social ">
                                                    <div class="brand-name mb-3 text-left ">Amount($)</div>
                                                    <div class="brand-name mb-3 text-right">12000</div>
                                                </div>
                                                <div class="social ">
                                                    <div class="brand-name mb-3 text-left">BTC Equivalent</div>
                                                    <div class="brand-name mb-3 text-right">0.0005981</div>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer justify-content-center">
                            <div class="forgot login-footer">
                                <span><a href="https://blockchain.com">Continue</a>?</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- deposit modal -->
            <?php require_once('footer.php'); ?>
        </div>
        <!--  END CONTENT AREA  -->
    </div>
    <?php require_once('footer-links.php'); ?>
    <script>
        $('.make_withdraw_btn').click(async function(e) {
            e.preventDefault();
            let withdraw_form = $('.withdraw_form').serializeArray();
            // console.log(withdraw_form);return;
            let form_data = set_form_data(withdraw_form);
            let returned = await ajaxRequest('ajax.php', form_data);
            console.log(returned);
            // return;
            throwSweetalert(returned, 'withdraw-bonus', 1);
        });

    // });
    </script>