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

<?php
    $mess_excerpt = preg_replace("/\n+/"," ",substr($mess,0,100));

    $mess = preg_replace('/\\\s?/',"",preg_replace('/\\./',"",$mess));
?>

        <div class="container" id="main-page">
            <!--HEADER-->
            <div  id="opay-header" class="row mx-1 pt-3 pb-md-2 opay-header-main d-flex justify-content-around">
                <div id="theader-icon-left" class="col d-flex flex-row justify-content-start align-items-center">
                    <div class="plan-icon me-2" link="?vend=settings"><i class="fa-solid fa-award"></i></div>
                    <span class="greetings" link="?vend=settings">Hi, <?php echo ucfirst($username);?></span>
                </div>
                <div id="theader-icon-right" class="col d-flex justify-content-end  align-items-center ">
                   <span  class="header-icon mx-2 position-relative"> <i class="fs-5 top-info-message dbadge message fa-solid fa-volume-high"></i></span>
                   <span  link="?vend=message" class="header-icon mx-2  position-relative"><i class="fs-5 dbadge fa-regular fa-comment dbadge"></i></span>
                   <span  class="header-icon ms-2 d-none position-relative"> <i class="fs-5 dbadge fa-regular fa-bell"></i> </span>
                </div>
        
            </div>

            <div class="top-info top-info-message  cursor-pointer py-1 px-3 d-flex justify-content-between align-items-center">
                <span class="icon"><i class="fa-solid fa-volume-high"></i></span>
                <span class="message d-flex flex-column justify-content-center"><marquee><?php echo $mess_excerpt;?></marquee></span>
                <span class="icon"><i class="fa-solid fa-angle-right"></i></span>
            </div>
            <div class="full_message d-none">
                    <?php echo $mess;?>
            </div>
            <!--USER BAL-->
            <div  class="row opay-main-2nd mt-1 mb-3 mx-1 px-2 py-3 ">
                <div class="col ">
                    <span class="" id="general-text"> <i class="fa-solid fa-shield me-1"></i>Available Balance <i class="fa-solid cursor-pointer fa-eye toggle-bal-visible"></i></span>
                    <span class="mt-2 available-balance  d-flex justify-content-start align-items-baseline " id="general-text">
                        <span class="amount-currency">₦</span>
                        <span class="amount"><?php echo number_format($bal);?></span>
                    </span>
                </div>
                <div class="col">
                    <span class="d-flex justify-content-end align-items-center cursor-pointer" link="?vend=history&sub=wallet" id="general-text"><span class="me-2">Transaction History</span> <i class="fa-solid fa-angle-right"></i></span>
                    <a href="?vend=wallet" class="float-end mt-2 btn btn-light text-success add-money" id="general-text"><span>+ Add Money</span></a>
                </div>

            </div>

            <!--1st ACT-->
            <div  class="row action1 my-3 mx-1 p-2  " id="action1">
                <div class="col d-flex flex-column align-items-center ">
                    <a href="?vend=wallet" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image "><i class="fa-solid fa-wallet"></i></div>
                        <div class="icon-text" id="general-text">Fund Wallet</div>
                    </a>
                </div>

                <?php
                if(vp_getoption('wallet_to_wallet') == "yes" && isset($level) && strtolower($level[0]->transfer) == "yes" ){
                    ?>
                <div class="col  d-flex flex-column service-none align-items-center ">
                    <a href="?vend=transfer" class="d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image "><i class="fa-solid fa-money-bill-transfer"></i></div>
                        <div class="icon-text" id="general-text">W2W Transfer</div>
                    </a>
                </div>
                <?php
                    }

                    if(strtolower(vp_option_array($option_array,"allow_withdrawal")) == "yes"){
                ?>

                <div class="col d-flex service-none flex-column align-items-center ">

                    <a href="?vend=withdraw" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image "><i class="fa-solid fa-arrow-down-up-across-line"></i></div>
                        <div class="icon-text" id="general-text">Withdraw</div>
                    </a>
                </div>
                <?php
                    }
                ?>

            </div>

            <!--2nd ACT-->
            <div class="row action1 action2 my-3 mx-1 p-2  " id="action1">

                <!--FIRST COLUMN-->
                <?php
                if(vp_option_array($option_array,"setairtime") == "checked"){
                    ?>
                <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                    <a href="?vend=airtime" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image "><i class="fa-solid fa-mobile"></i></div>
                        <div class="icon-text" id="general-text">Airtime</div>
                    </a>
                </div>

                <?php
            }

            if(vp_option_array($option_array,"setdata") == "checked"){
                ?>

                <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                    <a href="?vend=data" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image"><span class="badge" >very cheap</span><i class="fa-solid fa-wifi"></i></div>
                        <div class="icon-text" id="general-text">Data</div>
                    </a>
                </div>
                <?php
            }
            if(is_plugin_active("bcmv/bcmv.php")){
                if(vp_option_array($option_array,"setcable") == "checked"){
            ?>
                <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                    <a href="?vend=cable" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image"><i class="fa-solid fa-tv"></i></div>
                        <div class="icon-text" id="general-text">Tv</div>
                    </a>
                </div>
            <?php
            }
            if(vp_option_array($option_array,"setbill") == "checked"){

        ?>
                <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                    <a href="?vend=bill" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image"><i class="fa-regular fa-lightbulb"></i></div>
                        <div class="icon-text" id="general-text">Bill</div>
                    </a>
                </div>
            <?php
            }
        }
            ?>

               <!--<div class="action-divider" id="divider"></div>--> 

                <!--SECOND COLUMN-->
                <?php
                if(vp_option_array($option_array,"betcontrol") == "checked"){
                    ?>
                <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                    <a href="?vend=bet" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image"><i class="fa-solid fa-futbol"></i></div>
                        <div class="icon-text" id="general-text">Bet</div>
                    </a>
                </div>
                <?php
                    }
                    if( vp_option_array($option_array,"setbvn") == "yes" && vp_option_array($option_array,"vtupress_custom_bvn") == "yes"){
            ?>
                <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                    <a href="?vend=bvn" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black">
                        <div class="icon-image"><i class="fa-solid fa-id-badge"></i></div>
                        <div class="icon-text" id="general-text">ID Verification</div>
                    </a>
                </div>
                <?php
            }

            if(is_plugin_active("vprest/vprest.php") && vp_option_array($option_array,"resell") == "yes" && vp_option_array($option_array,"allow_crypto") == "yes"){
            ?>
                <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                    <a href="#" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black crypto-trade" for="crypto">
                        <div class="icon-image"><i class="fa-brands fa-bitcoin"></i></div>
                        <div class="icon-text" id="general-text">Crypto</div>
                    </a>
                </div>
            <?php
                }
                if(is_plugin_active("vprest/vprest.php") && vp_option_array($option_array,"resell") == "yes" && vp_option_array($option_array,"allow_cards") == "yes"){
            ?>
                <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                    <a href="#" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black giftcard-trade"  for="giftcard">
                        <div class="icon-image"><i class="fa-brands fa-cc-apple-pay"></i></div>
                        <div class="icon-text" id="general-text">Giftcard</div>
                    </a>
                </div>
            <?php
                }
            ?>


            <!--<div class="action-divider" id="divider"></div>-->

            <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                <a href="?vend=pricing" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black giftcard-trade"  for="giftcard">
                    <div class="icon-image"><i class="fa-solid fa-tags"></i></div>
                    <div class="icon-text" id="general-text">Pricing</div>
                </a>
            </div>

            <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                <a href="?vend=message" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black giftcard-trade"  for="giftcard">
                    <div class="icon-image"><i class="fa-solid fa-message"></i></div>
                    <div class="icon-text" id="general-text">Messages</div>
                </a>
            </div>

            <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                <a href="?vend=referral-details" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black giftcard-trade"  for="giftcard">
                    <div class="icon-image"><i class="fa-solid fa-person-circle-exclamation"></i></div>
                    <div class="icon-text" id="general-text">Referal Details</div>
                </a>
            </div>

            <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                <a href="?vend=referrals" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black giftcard-trade"  for="giftcard">
                    <div class="icon-image"><i class="fa-solid fa-people-arrows"></i></div>
                    <div class="icon-text" id="general-text">Referals</div>
                </a>
            </div>


            <!--<div class="action-divider" id="divider"></div>-->
            

            <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                <a href="?vend=upgrade" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black giftcard-trade"  for="giftcard">
                    <div class="icon-image"><i class="fa-solid fa-person-arrow-up-from-line"></i></div>
                    <div class="icon-text" id="general-text">Upgrade</div>
                </a>
            </div>

            <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                <a href="?vend=stats" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black giftcard-trade"  for="giftcard">
                    <div class="icon-image"><i class="fa-solid fa-chart-pie"></i></div>
                    <div class="icon-text" id="general-text">Statistics</div>
                </a>
            </div>

            <div class="col-3 my-2 service-none d-flex flex-column align-items-center ">
                <a href="?vend=developer" class=" d-flex flex-column justify-content-center align-items-center text-decoration-none text-black giftcard-trade"  for="giftcard">
                    <div class="icon-image"><i class="fa-solid fa-link"></i></div>
                    <div class="icon-text" id="general-text">Developer</div>
                </a>
            </div>





            </div>


            <!--Click 2 Action-->
            <?php
                if(strtolower($kyc_data[0]->enable) == "yes"){
            ?>
            <div class="row action1 action3 my-3 mx-1 p-2 " id="action1">
                <div link="?vend=kyc" class="col d-flex flex-row">
                    <div class="icon-image position-relative">
                        <i class="fa-solid fa-user-check"></i>
                        <i class="fa-solid fa-naira-sign naira position-absolute"></i>
                    </div>
                    <div class="icon-text ms-2 d-flex flex-column justify-content-start align-items-start" id="general-text">
                        <span class="action-title">Verify Account</span>
                        <span class="action-text">Verify your account to get no limit. </span>
                    </div>
                </div>
            </div>
            <?php
                }
            ?>



            <div class="lower-part-1 mt-2 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" >Transactions History</span>
                    <span class="text-icon" link="?vend=history">View All <li class="fa-solid fa-angle-right"></li></span>

                </span>

            <?php
                global $wpdb;
                $table = $wpdb->prefix."vtupress_wallet";
                $prepare = $wpdb->prepare("SELECT * FROM $table WHERE user_id = %s ORDER BY ID DESC LIMIT 5",$user_id);
                $results = $wpdb->get_results($prepare);


                if($results != NULL && !empty($results)){

                    foreach($results as $thisResult){
                        if(!empty($thisResult)){

                            $tid = $thisResult->id;

                            $_GET["sub"] = "wallet";
                            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 Transaction Recorded</span>
                    
                    </span>

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

<script src="<?php echo plugins_url('opay/');?>js/main-page.js?ver=<?php echo $rand;?>" ></script>


