<link rel="stylesheet" href="<?php echo plugins_url('opay/');?>css/airtime-page.css?ver=<?php echo $rand;?>" />



            <div class="container position-relative" id="main-page">

                <div id="airtime-page-header" class="row p-4 bg-white">
                    <div class="col d-flex flex-row justify-content-start align-items-start">
                       <span class="general-text"><a href="#" class="back cursor-pointer text-decoration-none text-black"><i class="fa-solid fa-angle-left me-3 "></i></a>Mobile Data</span>
                    </div>
                    <div class="col d-flex flex-row justify-content-end align-items-end">
                        <span link="?vend=history&sub=data" class="general-text hisotry-text  cursor-pointer">History</span>
                    </div>
                </div>

                <div id="network-select" class="row mt-2 p-2 bg-white rounded ">

                
                    <div class="col-12 ads position-relative">
                        
                    </div>
              

                    <div class="col-12 mt-3 border-bottom pb-2 position-relative">
                        <div class="row">
                            <div id="first-col" class="networks col-3 col-md-1 d-flex justify-content-start align-items-center">
                                <img src="<?php echo plugins_url('opay/');?>image/mtn.jpg" id="drop-down-image-select" class="me-3 me-md-2 changeNetworkLogo" for="mtn" value=""><i class="fa-solid fa-caret-down"></i>
                            </div>
                            <div id="second-col" class="col-7 col-md-10">
                                <input type="number"  min="0" max="9" class="form-control input-recipient" placeholder="0XX XXXX XXXX" />
                            </div>
                            <div id="third-col" class="col-2 col-md-1 d-flex justify-content-center align-items-center">
                                <i class="fa-solid fa-circle-user "></i>
                            </div>
                        </div>
                        <span class="text-warning recipient-incorrect-notice"></span>

                    </div>

                    <div class="col-12 service-type-choice">
                        <div class="row my-1 d-flex justify-content-center align-items-center">

                            <?php
                            if(!empty(vp_option_array($option_array,"databaseurl")) && !empty(vp_option_array($option_array,"dataendpoint"))  && vp_option_array($option_array,"smecontrol") == "checked"){
                                ?>
                            <div class="col-4 service-type-col cursor-pointer" for="sme">
                                <div class="service-type p-3 text-center">
                                    <span class="type">SME</span>
                                </div>
                            </div>

                            <?php
                            }
                             if(!empty(vp_option_array($option_array,"r2databaseurl")) && !empty(vp_option_array($option_array,"r2dataendpoint"))  && vp_option_array($option_array,"corporatecontrol") == "checked"){
                            ?>
                            
                            <div class="col-4 service-type-col cursor-pointer"  for="corporate">
                                <div class="service-type p-3 text-center">
                                    <span class="type">CG</span>
                                </div>
                            </div>
                            <?php
                                }
                                if(!empty(vp_option_array($option_array,"rdatabaseurl")) && !empty(vp_option_array($option_array,"rdataendpoint"))  && vp_option_array($option_array,"directcontrol") == "checked"){
						    ?>

                            <div class="col-4 service-type-col cursor-pointer"  for="direct">
                                <div class="service-type p-3 text-center">
                                    <span class="type">GIFTING</span>
                                </div>
                            </div>
                            <?php
                                }
                            ?>

                        </div>
                    </div>

                    <div class="col-12 mt-3 d-none" id="dropdown-for-networks">

                        <div class="row p-3 choice-row">
                            <div class="col-12 choice-div p-3">
                                <div class="col-12 py-2 net-choice cursor-pointer" for="airtel"  ext="jpg">
                                <label for="airtel" class="d-block">
                                    <div class="row">
                                        <div class="col  d-flex justify-content-start align-items-center">
                                            <img src="<?php echo plugins_url('opay/');?>image/airtel.jpg" id="drop-down-image-option" class="me-2 bg-danger" ><span class="network-name">Airtel</span>
                                        </div>
                                        <div class="col d-flex justify-content-end align-items-center">
                                            <input type="radio" name="network" id="airtel" class="d-none">
                                            <label class="network-label position-relative " for="airtel"></label>  
                                        </div>
                                    </div>

                                </label>

                                </div>

                                <div class="col-12 py-2 net-choice active cursor-pointer" for="mtn" ext="jpg">
                                    <label for="mtn" class="d-block">  
                                        <div class="row">
                                            <div class="col  d-flex justify-content-start align-items-center">
                                                <img src="<?php echo plugins_url('opay/');?>image/mtn.jpg" id="drop-down-image-option" class="me-2 bg-danger" ><span class="network-name">MTN</span>
                                            </div>
                                            <div class="col d-flex justify-content-end align-items-center">
                                                <input type="radio" name="network" id="mtn" class="d-none">
                                                <label class="network-label position-relative" for="mtn"></label>
        
                                            </div>
                                        </div>
                                    </label>


                                </div>

                                <div class="col-12 py-2 net-choice cursor-pointer" for="glo" ext="jpg">
                                    <label for="glo" class="d-block">  
                                        <div class="row">
                                            <div class="col  d-flex justify-content-start align-items-center">
                                                <img src="<?php echo plugins_url('opay/');?>image/glo.jpg" id="drop-down-image-option" class="me-2 bg-danger" ><span class="network-name">GLO</span>
                                            </div>
                                            <div class="col d-flex justify-content-end align-items-center">
                                                <input type="radio" name="network" id="glo" class="d-none">
                                                <label class="network-label position-relative" for="glo"></label>
        
                                            </div>
                                        </div>
                                    </label>

                                </div>

                                <div class="col-12 py-2 net-choice cursor-pointer" for="9mobile" ext="jpg">
                                    <label for="9mobile" class="d-block">  
                                        <div class="row">
                                            <div class="col  d-flex justify-content-start align-items-center">
                                                <img src="<?php echo plugins_url('opay/');?>image/9mobile.jpg" id="drop-down-image-option" class="me-2 bg-danger" ><span class="network-name">9mobile</span>
                                            </div>
                                            <div class="col d-flex justify-content-end align-items-center">
                                                <input type="radio" name="network" id="9mobile" class="d-none">
                                            <label class="network-label position-relative" for="9mobile"></label>

                                            </div>
                                        </div>
                                    </label>


                                </div>
                            </div>

                        </div>

                    </div>

            
                </div>
                


                <!--AMOUNT CHOICE SECTION-->
                <div id="amount-choice-div" class="row  mt-2 rounded">




                    <div class="col-12 position-relative">

                        <div id="top-green" class="p-3 position-relative d-flex justify-content-center align-items-center">
                            <span class="me-2">Top Up And Get Cash Back</span>
                            <button class="btn btn-sm bg-white" id="btn">GO</button>
                        </div>
                        
                        <div id="amount-choices" class="p-2 bg-white">
                            <span class="py-3">Mobile Data</span>
                            
                            <div class="amount-list row px-3 py-2">

                                <div  class="no_data all_data_types cursor-pointer py-2 mb-4 col-12 ">
                                    <div id="each-list" class="py-2 d-flex flex-column align-items-center justify-content-center text-center">
                                        <span>No plan available for <b class="dtype"></b> <b class="ntype"></b> </span>
                                    </div>
                                </div>

                                <!--- FOR SME -->
                            <?php

                            $all_datatypes = [
	
                                        "sme" => "",
                                        "corporate" => "r2",
                                        "direct" => "r"
                                    ];
                                    
                                $all_networks = [
                                        "mtn" => "cdata",
                                        "glo" => "gcdata",
                                        "airtel" => "acdata",
                                        "9mobile" => "9cdata"
                                    ];
	
                                    foreach($all_datatypes as $dtype => $dtype_add){
                                        //$dtype as sme
                                        //$dtype_add as ""

                                        if(vp_option_array($option_array,$dtype."control") != "checked"){
                                            continue;
                                        }

                                        $this_datatype_vn = strtolower(vp_option_array($option_array,$dtype."_visible_networks"));
                                        
                                       // echo "$dtype -($dtype_add) \n";
                                        foreach($all_networks as $network => $networkcode){
                                                //$network as mtn
                                                //$networkcode as "cdata"	
                                                $code = $dtype_add.$networkcode;
                                                $price = $code."p";
                                                $plan_name = $code."n";  
                                                
                                                if(!preg_match("/$network/",$this_datatype_vn)){
                                                    continue;
                                                }
                                                
                                                    for($i=0; $i<=10; $i++){
                                                            $doos = vp_option_array($option_array,$code.$i);
                                                            $pricei = vp_option_array($option_array,$price.$i);
                                                            $plan_namei = vp_option_array($option_array,$plan_name.$i).' ₦'.$pricei;
                                                            if(!empty($doos) && !empty($plan_namei) && !empty($pricei) ){

                                                        ?>

                                                            <div plan_index="<?php echo $i;?>" plan_name="<?php echo $plan_namei;?>" plan_id='<?php echo $doos;?>'  amount='<?php echo $pricei;?>' class="<?php echo $dtype.' '.$network;?> all_data_types cursor-pointer buy-with-this py-2 col-md-4 col-4 ">
                                                                <div id="each-list" class="py-2 d-flex flex-column align-items-center justify-content-center text-center">
                                                                    <span>1 Cashback</span>
                                                                    <span><?php echo trim(strtoupper(preg_replace("/\s{2,}/"," ",preg_replace("/$network|$dtype|30\s*days|month[ly]*|daily/i","",vp_option_array($option_array,$plan_name.$i)))));?></span>
                                                                    <span><span class="naira-symbol">₦</span><?php echo vp_option_array($option_array,$price.$i);?></span>
                                                                </div>
                                                            </div>

                                                            <?php
                                                        }
                                                    }
                                                }
                                            }
                                                        ?>
                                
                            </div>

                            <script>


/*
                                var sme_visible_networks = '<?php echo vp_option_array($option_array,"sme_visible_networks");?>';
                                var corporate_visible_networks = '<?php echo vp_option_array($option_array,"corporate_visible_networks");?>';
                                var direct_visible_networks = '<?php echo vp_option_array($option_array,"direct_visible_networks");?>';
                if(sme_visible_networks != ""){
                    sme_visible_networks = sme_visible_networks.toLowerCase();
                }
                if(corporate_visible_networks != ""){
                    corporate_visible_networks = corporate_visible_networks.toLowerCase();
                }
                if(direct_visible_networks != ""){
                    direct_visible_networks = direct_visible_networks.toLowerCase();
                }

                var allNetwork = ["mtn","glo","9mobile","airtel"];

                jQuery.each(allNetwork, function(index, value) {
                    
                    if(sme_visible_networks.indexOf(value) === -1){
                        jQuery(".sme ."+value).remove();
                    }
                    if(corporate_visible_networks.indexOf(value) === -1){
                        jQuery(".corporate ."+value).remove();
                    }
                    if(direct_visible_networks.indexOf(value) === -1){
                        jQuery(".direct ."+value).remove();
                    }
                });

*/
 
</script>



                            <div id="form-submit-section" class="d-none row px-4 py-2 form-submit-section  ">
                                <div class="col-9 first d-flex justify-content-start align-items-center">
                                    <span class="naira-symbol">₦</span>
                                    <input type="number" class="ms-2 form-control input-amount" placeholder="50-500,000" />
                                </div>
                                <div class="col-3 d-flex second justify-content-start justify-content-md-center">
                                    <button class="btn paybutton inactive cursor-pointer">Pay</button>
                                </div>
                            
                                <span class="text-warning amount-incorrect-notice"></span>

                            </div>

                            <div class="lower-part-1 mx-1 bg-white px-2 py-4 m-auto">

                                <span class="mb-3 d-flex justify-content-between align-items-center">
                                    <span class="text" >Last Data Transactions History</span>
                                    <span class="text-icon" link="?vend=history&sub=data">View All <li class="fa-solid fa-angle-right"></li></span>
                
                                </span>
                
                            <?php
                                global $wpdb;
                                $table = $wpdb->prefix."sdata";
                                $prepare = $wpdb->prepare("SELECT * FROM $table WHERE user_id = %s ORDER BY ID DESC LIMIT 1",$user_id);
                                $results = $wpdb->get_results($prepare);
                
                
                                if($results != NULL && !empty($results)){
                
                                    foreach($results as $thisResult){
                                        if(!empty($thisResult)){
                
                                            $tid = $thisResult->id;
                
                                            $_GET["sub"] = "data";
                                            include(__DIR__."/history/functions.php");
                            ?>
                            
                
                
                                <span link="?vend=history&id=<?php echo $tid;?>" class="my-3 mx-3 cursor-pointer d-flex justify-content-between <?php echo $status;?>">
                                    <span class="icon icon-div me-3 d-flex align-items-center"><?php echo $icon;?></span>
                                    <span class="icon-text flex-grow-1 d-flex flex-column">
                                        <span class="topic"><?php echo $type;?></span>
                                        <span class="message text-muted" id="general-text"><?php echo $time;?></span>
                                    </span>
                                    <span class="icon ms-2 d-flex flex-column align-items-end justify-content-center">
                                        <span class="amount-span"><?php echo $sign;?> ₦<span class="amount"><?php echo number_format($amount);?></span></span>
                                        <span class="status"><?php echo ucfirst($status);?></span>
                                    </span>
                                
                                </span>
                
                                            <?php
                                        }
                                    }
                                }else{
                                    ?>
                
                                    <span link="#" class=" cursor-pointer d-flex justify-content-center align-items-center <?php echo $status;?>">
                
                                        <span class="">No Data Transaction Recorded</span>
                                    
                                    </span>
                
                                    <?php
                                }
                                ?>
                            </div>
                            

                        </div>



                        
                    </div>
                </div>


                <!-- CONFIRM TRANSACTION-->
                <div id="confirm-transaction" class="d-flex align-items-end justify-content-center rounded d-none checkout_trans_levels">

                    <div class="row confirm-transaction-container p-3 level_1 checkout_levels" level="1">
                        <div class="col-12 d-flex justify-content-start">
                            <i class="fa-solid text-muted close-confirm-transaction fa-xmark proceed_prev" current="1"></i>
                        </div>

                        <div class="col-12 my-2 d-flex justify-content-center ">
                            <span class="naira-symbol align-self-end mb-2">₦</span><span class="amount amount-value"></span>
                        </div>
                        <div class="col-12 my-1 d-flex justify-content-between">
                            <span class="text-muted product-name">Product Name</span>
                            <span class="product-value"><img src="<?php echo plugins_url('opay/');?>image/mtn.jpg" id="drop-down-image-option" class="me-2 bg-danger changeNetworkLogo" >Mobile Data</span>
                        </div>
                        <div class="col-12 my-1 d-flex justify-content-between">
                            <span class="text-muted product-name">Product Type</span>
                            <span class="product-type text-capitalize"></span>
                        </div>
                        <div class="col-12 my-1 d-flex justify-content-between">
                            <span class="text-muted product-name">Amount</span>
                            <span class="product-value">₦<span class="amount-value"></span></span>
                        </div>
                        <?php
                            if(vp_option_array($option_array,"discount_method") == "direct"){
                        ?>
                            <div class="col-12 my-2 d-flex justify-content-between">
                                <span class="text-muted product-name">Amount To Pay</span>
                                <span class="product-value">₦<span class="bonus-value">0</span></span>
                            </div>
                    <?php
                        }
                        else{
                    ?>
                            <div class="col-12 my-2 d-flex justify-content-between">
                                <span class="text-muted product-name">Bonus To Earn</span>
                                <span class="product-value">₦<span class="bonus-value">0</span></span>
                            </div>
                    <?php	
                        }
                    
                        ?>
                        <hr>
                        <div class="col-12 my-2 d-flex justify-content-start">
                            <span class="payment-method">Payment Method</span>
                        </div>
                        <div class="col-12 my-2 payment-method-div p-3 d-flex justify-content-between">
                            <div class="d-flex justify-content-start align-items-center">
                                <span class="me-2 wallet-div d-flex justify-content-center align-items-center"><i class="fa-solid fa-wallet "></i></span>
                                <span>Balance (₦<?php echo number_format($bal);?>)</span>
                            </div>
                            <div class="d-flex justify-content-end align-items-center check-sign">
                                <i class="fa-solid fa-check fs-3"></i>
                            </div>

                        </div>

                        <div class="col-12 pt-2 checkout-div position-relative">
                            <div class="info-div d-flex justify-content-center align-items-start">
                                <span class="">Enjoy seamless services from us!</span>
                            </div>
                            <div class="large-pay-div d-flex justify-content-center align-items-center ">
                                <h4 class=" proceed_checkout proceed_next cursor-pointer" current="1">Proceed</h4>
                            </div>
                        </div>

                    </div>

                    <div id="enter-pin-container" class="row enter-pin-container p-3 level_2 d-none  checkout_levels" level="2">

                        <div class="col-12 d-flex justify-content-end">
                            <i class="fa-solid text-muted close-pin-container fa-xmark proceed_prev" current="2"></i>
                        </div>

                        <div class="col-12 ajax-error-response-div d-flex justify-content-center">
                            <span id="ajax-error-response" class="ajax-error-response text-danger"></span>
                        </div>

                        <div class="col-12 d-flex justify-content-center pb-2" style="font-weight:bold; font-size:20px;">
                            <span>Enter Payment Pin</span>
                        </div>

                        <div class="col-12 d-flex justify-content-center">
                            <input type="number" class="pin_1 pin_input" min="0" max="9" pin="1" maxlength="1">
                            <input type="number" class="mx-2 pin_2 pin_input"  min="0" max="9"   maxlength="1" pin="2">
                            <input type="number" class="me-2 pin_3 pin_input"  min="0" max="9"  maxlength="1" pin="3">
                            <input type="number" class="pin_4 pin_input"  min="0" max="9"  maxlength="1" pin="4">

                        </div>
                        <div class="col-12 my-3 d-flex justify-content-center">
                            <h4 class="checkout inactive cursor-pointer">Checkout</h4>
                        </div>

                    </div>

                </div>

                <!-- TRANSACTION MESSAGE-->
                <div id="transaction-response" class="d-none  level_3  checkout_trans_levels" >

                            <div class="mx-4 mt-4 d-flex justify-content-end">
                                <span class="done-btn cursor-pointer">Done</span>
                            </div>

                        <div class="comp d-flex flex-column  mt-3 d-none">
                            <div class="confirmation d-flex flex-column justify-content-center align-items-center">
                                <i class="fa-regular fa-circle-check"></i>
                                <span class="done-text mt-2">Transaction Complete</span>
                                <span><span class="naira-symbol">₦</span><span class="amount-value"></span></span>
                            </div>

                            <div class="container">
                                <div class="row mt-5 actions px-2">
                                    <div class="col ">
                                        <div link="?vend=history&sub=data&generate=last" class="cursor-pointer p-4 d-flex flex-column justify-content-center align-items-center work-on">
                                            <i class="fa-solid fa-share-from-square"></i>
                                            <span class="action-word">Share receipt</span>
                                        </div>
                                    </div>
                                    <div class="col ">
                                        <div link="?vend=history&sub=data&generate=last&plain=yes" class="cursor-pointer p-4 d-flex flex-column justify-content-center align-items-center work-on">
                                            <i class="fa-solid fa-download"></i>
                                            <span class="action-word">Download receipt</span>
                                        </div>
                                    </div>
                                </div>

                                <div class="row mt-3 p-3">
                                    <div class="col-12 ">
                                        <div class="get-rewards p-4">
                                            <span class="get-reward-statement">More Services</span>

                                            <!--Data-->
                                            <div class="row mt-3 service-airtime ">
                                                <div class="col d-flex justify-content-start align-items-center">
                                                    <div class="benefit-image p-3 bg-white">
                                                        <i class="fa-solid fa-phone"></i>
                                                    </div>
                                                    <div class="ms-2 benefit-messages d-flex flex-column">
                                                        <span class="benefit-topic">
                                                            Airtime
                                                        </span>
                                                        <span class="benefit-message">
                                                            Cheap Airtime
                                                        </span>
                                                    </div>
                                                </div>
                                                <div class="col-2 d-flex justify-content-end align-items-center">
                                                    <button  link="?vend=airtime"  class="benefit-button">Go</button>
                                                </div>
                                            </div>

                                            <!--Cable-->
                                            <div class="row mt-3 service-cable">
                                                <div class="col d-flex justify-content-start align-items-center">
                                                    <div class="benefit-image p-3 bg-white">
                                                        <i class="fa-solid fa-tv"></i>
                                                    </div>
                                                    <div class="ms-2 benefit-messages d-flex flex-column">
                                                        <span class="benefit-topic">
                                                            Tv Subscription
                                                        </span>
                                                        <span class="benefit-message">
                                                            Don't miss your fav. shows
                                                        </span>
                                                    </div>
                                                </div>
                                                <div class="col-2 d-flex justify-content-end align-items-center">
                                                    <button  link="?vend=cable" class="benefit-button">Go</button>
                                                </div>
                                            </div>

                                            <!--Bill-->
                                            <div class="row mt-3 service-bill">
                                                <div class="col d-flex justify-content-start align-items-center">
                                                    <div class="benefit-image p-3 bg-white">
                                                        <i class="fa-solid fa-tower-cell"></i>
                                                    </div>
                                                    <div class="ms-2 benefit-messages d-flex flex-column">
                                                        <span class="benefit-topic">
                                                            Utility
                                                        </span>
                                                        <span class="benefit-message">
                                                            Always light up your house
                                                        </span>
                                                    </div>
                                                </div>
                                                <div class="col-2 d-flex justify-content-end align-items-center">
                                                    <button link="?vend=bill" class="benefit-button">Go</button>
                                                </div>
                                            </div>


                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="failed d-flex flex-column  mt-3 d-none">
                            <div class="confirmation d-flex flex-column justify-content-center align-items-center">
                                <i class="fa-regular fa-circle-xmark text-danger"></i>
                                <span class="done-text mt-2 text-danger">Transaction Failed</span>
                                <span><span class="naira-symbol">₦</span><span class="amount-value"></span></span>
                            </div>

                            <div class="container">
                                <div class="row mt-5 actions px-2">
                                    <div class="col ">
                                    <div class="p-4 d-flex flex-column justify-content-center align-items-center work-on">
                                            <i class="fa-solid fa-circle-info text-warning"></i>
                                            <span class="action-data-message"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>




                </div>

                



            </div>




            <script>
            var the_netc = jQuery("#drop-down-image-select").attr("for");
            jQuery(`.net-choice[for=${the_netc}]`).addClass("active");
            jQuery(`.net-choice[for=${the_netc}] input`).prop("checked",true);

                function doUrl(){
            var datatcode = jQuery(".service-type-col.active").attr("for");
            var request_id =  run_code;
            var phone = jQuery(".input-recipient").val();
            var network = jQuery("#drop-down-image-select").attr("value");
            var amount = jQuery(".buy-with-this.chosen").attr("amount");
            var airtimechoice = datatcode;
            var cdat2 = jQuery(".buy-with-this.chosen").attr("plan_id");
            var url;
            
            if(airtimechoice == "sme"){
                    <?php
                echo'
                
                url = "smebase'.vp_option_array($option_array,"dataendpoint")."smepostdata1".'=smepostvalue1&'.vp_option_array($option_array,"request_id").'="+request_id+"&'."smepostdata2".'='."smepostvalue2".'&'.vp_option_array($option_array,"datapostdata3").'='.vp_option_array($option_array,"datapostvalue3").'&'.vp_option_array($option_array,"datapostdata4").'='.vp_option_array($option_array,"datapostvalue4").'&'.vp_option_array($option_array,"datapostdata5").'='.vp_option_array($option_array,"datapostvalue5").'&'.vp_option_array($option_array,"datanetworkattribute").'="+network+"&'.vp_option_array($option_array,"dataamountattribute").'="+amount+"&'.vp_option_array($option_array,"dataphoneattribute").'="+phone+"&'.vp_option_array($option_array,"cvariationattr").'="+cdat2+"&datacode="+datatcode;
            
                ';
                ?>
            
            }
            if(airtimechoice == "direct"){
                <?php
                echo'
                
                url = "directbase'.vp_option_array($option_array,"rdataendpoint")."directpostdata1".'='."directpostvalue1".'&'.vp_option_array($option_array,"rrequest_id").'="+request_id+"&'."directpostdata2".'='."directpostvalue2".'&'.vp_option_array($option_array,"rdatapostdata3").'='.vp_option_array($option_array,"rdatapostvalue3").'&'.vp_option_array($option_array,"rdatapostdata4").'='.vp_option_array($option_array,"rdatapostvalue4").'&'.vp_option_array($option_array,"rdatapostdata5").'='.vp_option_array($option_array,"rdatapostvalue5").'&'.vp_option_array($option_array,"rdatanetworkattribute").'="+network+"&'.vp_option_array($option_array,"rdataamountattribute").'="+amount+"&'.vp_option_array($option_array,"rdataphoneattribute").'="+phone+"&'.vp_option_array($option_array,"rcvariationattr").'="+cdat2+"&datacode="+datatcode;
            
                ';
                ?>
            }
            if(airtimechoice == "corporate"){
            
            <?php
                echo'
               
                url = "corporatebase'.vp_option_array($option_array,"r2dataendpoint")."corporatepostdata1".'='."corporatepostvalue1".'&'.vp_option_array($option_array,"r2request_id").'="+request_id+"&'."corporatepostdata2".'='."corporatepostvalue2".'&'.vp_option_array($option_array,"r2datapostdata3").'='.vp_option_array($option_array,"r2datapostvalue3").'&'.vp_option_array($option_array,"r2datapostdata4").'='.vp_option_array($option_array,"r2datapostvalue4").'&'.vp_option_array($option_array,"r2datapostdata5").'='.vp_option_array($option_array,"r2datapostvalue5").'&'.vp_option_array($option_array,"r2datanetworkattribute").'="+network+"&'.vp_option_array($option_array,"r2dataamountattribute").'="+amount+"&'.vp_option_array($option_array,"r2dataphoneattribute").'="+phone+"&'.vp_option_array($option_array,"r2cvariationattr").'="+cdat2+"&datacode="+datatcode;
            
                ';
                ?>	
            }
            
            return url;
                }
            
        </script>
        
    <script src="<?php echo plugins_url('opay/');?>js/airtime-service.js?ver=<?php echo $rand;?>" ></script>

    <script>
    
function makeChoice(){
	
			var the_net = jQuery("#drop-down-image-select").attr("for");
		
		var ddatachoice = jQuery(".service-type-col.active").attr("for");
		if(ddatachoice == "sme"){
			switch(the_net){
				case"mtn":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'datamtn');?>");
				break
				case"glo":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'dataglo');?>");
	
				break
				case"airtel":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'dataairtel');?>");
	
				break
				case"9mobile":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'data9mobile');?>");
	
				break;
	
			}
		}
		else if(ddatachoice == "corporate"){
			switch(the_net){
				case"mtn":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'r2datamtn');?>");
				break
				case"glo":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'r2dataglo');?>");
	
				break
				case"airtel":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'r2dataairtel');?>");
	
				break
				case"9mobile":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'r2data9mobile');?>");
	
				break;
	
			}
		}
		else if(ddatachoice == "direct"){
			switch(the_net){
				case"mtn":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'rdatamtn');?>");
				break
				case"glo":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'rdataglo');?>");
	
				break
				case"airtel":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'rdataairtel');?>");
	
				break
				case"9mobile":
					jQuery("#drop-down-image-select").attr("value","<?php echo vp_option_array($option_array,'rdata9mobile');?>");
	
				break;
	
			}
		}

}
        
function calcit(){
    makeChoice();

    var original = jQuery(".input-amount").val();
    var topay = jQuery(".bonus-value");
	var data_network_value = jQuery("#drop-down-image-select").attr("value");
	
	var datachoice = jQuery(".service-type-col.active").attr("for");
	var discount = 0;
	//DISCOUNT BGN
	<?php
	if(is_plugin_active("vprest/vprest.php")  && vp_option_array($option_array,'resell') == "yes" && isset($level) && isset($level[0]->total_level)){
		?>

	if(datachoice == "sme"){
		switch(data_network_value){
			case"<?php echo vp_option_array($option_array,'datamtn');?>":
			discount = <?php echo floatval($level[0]->mtn_sme);?>;
			break;
			case"<?php echo vp_option_array($option_array,'dataglo');?>":
			discount = <?php echo floatval($level[0]->glo_sme);?>;
			break;
			case"<?php echo vp_option_array($option_array,'dataairtel');?>":
			discount = <?php echo floatval($level[0]->airtel_sme);?>;
			break;
			case"<?php echo vp_option_array($option_array,'data9mobile');?>":
			discount = <?php echo floatval($level[0]->mobile_sme);?>;
			break;
		}
	}
	else if(datachoice == "direct"){
		switch(data_network_value){
			case"<?php echo vp_option_array($option_array,'rdatamtn');?>":
			discount = <?php echo floatval($level[0]->mtn_gifting);?>;
			break;
			case"<?php echo vp_option_array($option_array,'rdataglo');?>":
			discount = <?php echo floatval($level[0]->glo_gifting);?>;
			break;
			case"<?php echo vp_option_array($option_array,'rdataairtel');?>":
			discount = <?php echo floatval($level[0]->airtel_gifting);?>;
			break;
			case"<?php echo vp_option_array($option_array,'rdata9mobile');?>":
			discount = <?php echo floatval($level[0]->mobile_gifting);?>;
			break;
		}
	}
	else if(datachoice == "corporate"){
		switch(data_network_value){
			case"<?php echo vp_option_array($option_array,'r2datamtn');?>":
			discount = <?php echo floatval($level[0]->mtn_corporate);?>;
			break;
			case"<?php echo vp_option_array($option_array,'r2dataglo');?>":
			discount = <?php echo floatval($level[0]->glo_corporate);?>;
			break;
			case"<?php echo vp_option_array($option_array,'r2dataairtel');?>":
			discount = <?php echo floatval($level[0]->airtel_corporate);?>;
			break;
			case"<?php echo vp_option_array($option_array,'r2data9mobile');?>":
			discount = <?php echo floatval($level[0]->mobile_corporate);?>;
			break;	
		}
	}
	
	<?php
	}
	?>
	var the_amo = (original * discount)/100;
	var the_amount = original - the_amo;
									<?php
					if(is_plugin_active("vprest/vprest.php")  && vp_option_array($option_array,'resell') == "yes"){
						
						if(vp_option_array($option_array,"discount_method") == "direct"){
						?>


	topay.text(the_amount);
	<?php
						}
						else{
						?>
                        

	topay.text(the_amo);
	<?php
					}
					}
					?>
	}
		
	


document.addEventListener("DOMContentLoaded",function(){
        jQuery(".all_data_types").hide();


function makeServiceVisible(){
    jQuery(".all_data_types").hide();
//What data type is active
var dataTypesActive = jQuery(".service-type-col.active").attr("for");
//For What Network
var networkActive = jQuery("#drop-down-image-select").attr("for");

jQuery("."+dataTypesActive+"."+networkActive).show();

if(!jQuery("."+dataTypesActive+"."+networkActive).is(":visible")){
    jQuery(".no_data .dtype").text(dataTypesActive);
    jQuery(".no_data .ntype").text(networkActive);
    jQuery(".no_data").show();
}else{
    jQuery(".no_data").hide();

    jQuery(".product-type").text(dataTypesActive);

}

}

makeServiceVisible();
//What network is active
jQuery(".net-choice, .service-type-col").on("click",function(){
  //  jQuery(".service-type-col").removeClass("active");
  //  jQuery(".net-choice").removeClass("active");
  //  jQuery(this).addClass("active");
    makeServiceVisible();

});







});

</script>
        



