<?php
	require_once '../php/singles.php';
		if(isset($_GET['plan'])){
			$schema = $_GET['plan'];
			if(!empty($schema)){
			
			}
		}else{
			
		}
		$plan_no = $schema;
		require_once '../php/plan_info.php';
	
 ?>
<!DOCTYPE html>
<html lang="en">

	<?php require_once('../include/head.php');  ?>
	
<body class="dark-theme">

<!-- notice -->
	<?php include_once('../include/notify.php'); ?>
<!-- notice -->

<script>
    var notify = {
        timeout: "5000",
    }
</script>
<!--Full Layout-->
<div class="panel-layout">
    <!--Header-->
    	<?php require_once('../include/header.php');  ?>

    <!--/Header-->

    <!--Side Nav-->
    	<?php include_once('../include/sidebar.php');  ?>

    <!--/Side Nav-->

    <div class="page-container">
        <div class="main-content">
            <div class="section-gap">
                <div class="container-fluid">
                                            
                                                                <!--Page Content-->
                        <div class="row justify-content-center">
        <div class="col-xl-10 col-lg-12 col-md-12">
            <div class="site-card">
                <div class="site-card-header">
                    <h3 class="title">Review and Confirm Investment</h3>
                </div>
                <div class="site-card-body">
                    <form action="../php/invest-now.php" method="post" enctype="multipart/form-data">
                        <input type="hidden" name="_token" value="o6NSYv0qfcdPD4MSfRmI7YmeyLIGmIW8ZZasV8n8">                        <div class="progress-steps-form">
                            <div class="transaction-list table-responsive">
                                <table class="table preview-table">
                                    <tbody>
                                    <tr>
                                        <td><strong>Select Schema:</strong></td>
                                        <td>
                                            <div class="input-group mb-0">
                                                <select class="site-nice-select" aria-label="Default select example"
                                                        id="select-schema" name="schema_id" required>
                                                                                                            <option value="1"
					<?php if($plan_no==1){ echo 'selected'; } ?>	  >Standard Plan</option>
                                                                                                            <option value="2"
                    <?php if($plan_no==2){ echo 'selected'; } ?>      >Corporate Plan</option>
                                                                                                           <option value="3"
                    <?php if($plan_no==3){ echo 'selected'; } ?>      >Offshore  Plan</option>
                                                                                                            <option value="4"
                     <?php if($plan_no==4){ echo 'selected'; } ?>     >Platinum  Plan</option>
                                                                                                    </select>
                                            </div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td><strong>Amount:</strong></td>
                                        <td id="amount">
                                            <?php if($plan_no==1){ echo 'Minimum 1,000 USD - Maximum 10,000'; } ?>
                                            <?php if($plan_no==2){ echo 'Minimum 10,000 USD - Maximum 25,000'; } ?>
                                            <?php if($plan_no==3){ echo 'Minimum 25,000 USD - Maximum 50,000'; } ?>
                                            <?php if($plan_no==4){ echo 'Minimum 50,000 USD - Maximum &#x221E;'; } ?>
											USD
                                        </td>
                                    </tr>

                                    <tr>
                                        <td><strong>Enter Amount:</strong></td>
                                        <td>
                                            <div class="input-group mb-0">
                                                <input type="text" class="form-control"
             value="<?php if($plan_no==1){ echo '500'; }  if($plan_no==2){ echo '1000'; }  if($plan_no==3){ echo '5000'; }	 if($plan_no==4){ echo '10000'; } ?>"
			<?php if($plan_no==1){ echo ''; }  if($plan_no==2){ echo ''; }  if($plan_no==3){ echo ''; }	 if($plan_no==4){ echo ''; } ?>
													  placeholder="Enter Amount"
                                                       oninput="this.value = validateDouble(this.value)"
                                                       aria-label="Amount" name="invest_amount" id="enter-amount"
                                                       aria-describedby="basic-addon1" required>
                                                <span class="input-group-text" id="basic-addon1">USD</span>
                                            </div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td><strong>Select Wallet:</strong></td>
                                        <td>
                                            <div class="input-group mb-0">
                                                <select class="site-nice-select" aria-label="Default select example"
                                                        name="wallet" required id="selectWallet">
                                                    <option
                                                        value="main">Main Wallet ( <?php echo $infos['bal']; ?> USD
                                                        )
                                                    </option>
                                                    <option
                                                        value="profit">Profit Wallet ( <?php echo $infos['bal2']; ?> USD
                                                        )
                                                    </option>
                                                    <!-- <option value="gateway">Direct Gateway</option> -->
                                                </select>
                                            </div>

                                        </td>
                                    </tr>

                                    <tr class="gatewaySelect">

                                    </tr>

                                    <tr>
                                        <td colspan="2">
                                            <div class="row manual-row"></div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td><strong>Return of Interest:</strong></td>
                                        <td id="return-interest"><?php echo $plan_rate2; ?></td>
                                    </tr>
                                    <tr>
                                        <td><strong>Number of Period:</strong></td>
                                        <td id="number-period"><?php echo $plan_return_no; ?> Times </td>
                                    </tr>
                                    <tr>
                                        <td><strong>Capital Back:</strong></td>
                                        <td id="capital_back"><?php echo $plan_capital_back; ?></td>
                                    </tr>
                                    <tr>
                                        <td><strong>Total Investment Amount:</strong></td>
                                        <td><span
                  id="total-amount"> <?php if($plan_no==1){ echo '1,000'; }  if($plan_no==2){ echo '10,000'; }  if($plan_no==3){ echo '25,000'; }	 if($plan_no==4){ echo '50,000'; } ?></span> USD
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="button">
                                <button type="submit" class="site-btn primary-btn me-3">
                                    <i class="anticon anticon-check"></i>Invest Now
                                </button>
                                <a href="../schemas" class="site-btn black-btn">
                                    <i class="anticon anticon-stop"></i>Cancel
                                </a>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
                    <!--Page Content-->
                </div>
            </div>
        </div>
    </div>


    <!-- Automatic Popup -->
    
    <!-- /Automatic Popup End -->
</div>
<!--/Full Layout-->

<script src="/assets2/global/js/jquery.min.js"></script>
<script src="/assets2/global/js/jquery-migrate.js"></script>

<script src="/assets2/frontend/js/bootstrap.bundle.min.js"></script>
<script src="/assets2/frontend/js/scrollUp.min.js"></script>

<script src="/assets2/frontend/js/owl.carousel.min.js"></script>
<script src="/assets2/global/js/waypoints.min.js"></script>
<script src="/assets2/frontend/js/jquery.counterup.min.js"></script>
<script src="/assets2/frontend/js/jquery.nice-select.min.js"></script>
<script src="/assets2/frontend/js/lucide.min.js"></script>
<script src="/assets2/frontend/js/magnific-popup.min.js"></script>
<script src="/assets2/frontend/js/aos.js"></script>
<script src="/assets2/global/js/datatables.min.js" type="text/javascript" charset="utf8"></script>
<script src="/assets2/frontend/js/main.js?var=5"></script>
<script src="/assets2/frontend/js/cookie.js"></script>
<script src="/assets2/global/js/custom.js?var=5"></script>


    <script>
        (function ($) {
            'use strict';
            // To top
            $.scrollUp({
                scrollText: '<i class="fas fa-caret-up"></i>',
                easingType: 'linear',
                scrollSpeed: 500,
                animation: 'fade'
            });
        })(jQuery);
    </script>

<script type="text/javascript" src="/assets2/vendor/mckenziearts/laravel-notify/js/notify.js"></script>    <script>
        $("#select-schema").on('change',function (e) {
            "use strict";
            e.preventDefault();
            var id = $(this).val();

            var invest_amount = $("#enter-amount");
            invest_amount.val('');
            invest_amount.attr('readonly', false);

            var url = '../php/plan_select.php?id=:id';
            url = url.replace(':id', id);

            $.ajax({
                url: url, success: function (result) {
				result = (JSON.parse(result));
                    $('#amount').html(result.amount);
                    $('#return-interest').html(result.roi);
                    $('#number-period').html(result.period);
                    $('#capital_back').html(result.capital_back);

                    if (result.invest_amount > 0) {
                        invest_amount.val(result.invest_amount);
                        invest_amount.attr('readonly', true);
                    }

                }
            });
        });
        $("#enter-amount").on('keyup',function (e) {
            "use strict";
            e.preventDefault();
            var amount = $(this).val();
            $("#total-amount").html(amount);
        })

        $("#selectWallet").on('change',function (e) {
            "use strict";
            $('.gatewaySelect').empty();
            $('.manual-row').empty();
            var wallet = $(this).val();
            if (wallet === 'gateway') {
                $.get('/gateway/list', function (data) {
                    $('.gatewaySelect').append(data)
                    $('select').niceSelect();

                });
            }

        })
        $('body').on('change', '#gatewaySelect', function (e) {
            "use strict"
            e.preventDefault();

            $('.manual-row').empty();

            var code = $(this).val()

            var url = '/user/deposit/gateway/:code';
            url = url.replace(':code', code);
            $.get(url, function (data) {

                if (data.credentials !== undefined) {

                    console.log(data.credentials);

                    $('.manual-row').append(data.credentials)
                    imagePreview()
                }


            });

            $('#amount').on('keyup',function (e) {
                "use strict"
                var amount = $(this).val()
                $('.amount').text((Number(amount)))
                $('.currency').text(currency)
                var charge = globalData.charge_type === 'percentage' ? calPercentage(amount, globalData.charge) : globalData.charge
                $('.charge2').text(charge + ' ' + currency)

                $('.total').text((Number(amount) + Number(charge)) + ' ' + currency)
            })


        });
    </script>
    <script>
        // Color Switcher
        $(".color-switcher").on('click', function () {
            "use strict"
            $("body").toggleClass("dark-theme");
            var url = '/theme-mode';
            $.get(url)
        });
    </script>


	<?php 
			require_once('../include/footer.php');
	?>




</body>
</html>

