<?php
session_start();
require_once '../include/Constants.php';
require_once "../vendor/autoload.php";
require_once "../include/DatabaseConn.php";
require_once "../models/User.php";
require_once '../models/Wallet.php';
require_once '../include/Helper.php';
require_once '../models/USettings.php';
require_once '../models/Settings.php';
require_once '../include/GoogleAuthenticator.php';


$db = new DatabaseConn();
$link = $db->connect();

$user = User::getCurrentUser($link);
if (is_null($user)) {
    $url = $_SERVER['REQUEST_URI'];
    header("location: ../login?" . RETURN_URL . "=" . $url);
    die();
}

$settings = USettings::getSystemSettings($link, $user->getEmail());
if ($settings->getTwofa() && is_null($user->getFa())) {
    header("location: add-2fa");
    die();
}
$wallets = Wallet::getWalletDeposit($link, $user->getEmail());
?>
<!DOCTYPE html>
<html lang="en">

    <head>
        <?php require_once './partials/head.php'; ?>
        <link href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css" rel="stylesheet" type="text/css" media="all" />
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.3/css/intlTelInput.min.css" />

    </head>

    <body class="ltr en">
        <div ui-view="" id="app" ng-class="{'app-mobile' : app.isMobile, 'app-invest' : app.isInvest, 'app-navbar-fixed' : app.layout.isNavbarFixed,
     'app-sidebar-fixed' : app.layout.isSidebarFixed, 'app-footer-fixed':app.layout.isFooterFixed}" class="ng-scope app-navbar-fixed app-sidebar-fixed" style="">
             <?php require_once './partials/sidebar.php'; ?>
            <div class="app-content ng-scope" ng-class="{loading: loading}">
                <!-- ngInclude: 'assets/views/partials/top-navbar.html' -->
                <?php require_once './partials/header_.php'; ?>
                <div data-ng-controller="PageCtrl" class="ng-scope">

                    <div data-ng-include=" 'assets/views/partials/main-content.html'" id="main_content" class="main-content ng-scope" ng-class="{'hidden' : hidePageContent, 'wrap-content-dashboard' : (currentPageId == 'app.dashboard')}" style="">
                        <!-- uiView:  -->
                        <div ui-view="" class="wrap-content container fade-in-up ng-scope" id="container" style=""><!-- uiView:  --><div ui-view="" class="fade-in-right-big smooth ng-scope" style="">
                              <data-ng-include src="'assets/views/partials/title.html'" style="margin-top: 10px" class="ng-scope">
											    <div data-ng-include=" 'assets/views/partials/alerts.html'" style="margin-top: 61px;" class="ng-scope">
											<div ng-controller="AlertCtrl" class="PopupAlertDiv ng-scope">
												<div class="container-fluid mt20" ng-show="alertsLen > 0">
													<div class="row">
														<div class="col-sm-12">
															<!-- ngRepeat: (id, alert) in alerts track by $index -->
															<div ng-repeat="(id, alert) in alerts track by $index" class="alert alert-block alert-success alert-type--welcome fade in" id="notice_20300006" data-ng-init="setNoticeAsShown(alert.id)">
																<!-- ngIf: alert.is_closable -->
																<button ng-hide="getInclude(alert.type) == 'alert-prompt.html'" data-ct-dismiss="alert" class="close ng-scope" ng-if="alert.is_closable" type="button" ng-click="profileAlertClose(alert)"></button>
																<!-- end ngIf: alert.is_closable -->
																<div class="PopupAlertDiv__content">
																	<!-- ngInclude: 'assets/views/tpl/' + getInclude(alert.type) --><span ng-include="'assets/views/tpl/' + getInclude(alert.type)" class="ng-scope"><div class="ng-scope">
                                                                            <h4 class="alert-heading margin-bottom-10">
                                                                                <span class="success-title ng-binding" ng-bind-html="('welcome_to_myfxtm' | translate)">Welcome to Ozz Capital - your personal client area.</span> </h4>
																	<p class="m0"> <b class="ng-binding">Your referral ID:  <a class="upgrade-to-text" style="cursor: pointer" data-clipboard-text="https://ozzcapital.com/?referral=irsgmyleigsuc@baybabes.com">
                                                                                        <span>Click to copy referral link</span>
                                                                                    </a> </b>
																		<br> </p>
																	<!-- ngIf: alert.data['30PctBonusAvailable'] || alert.data.switchToFxTmBonusAvailable -->
																</div>
																</span>
															</div>
														</div>
														<!-- end ngRepeat: (id, alert) in alerts track by $index -->
													</div>
												</div>
											</div>
										</div>
								</div>
												<div ng-hide="currentPageId === 'app.dashboard'" class="ng-scope">
													<section id="page-title" class="padding-top-15 padding-bottom-0 ng-scope" ng-controller="TitleCtrl">
														<div class="container-fluid">
															<div class="row">
																<div class="col-xs-12">
																	<h1 class="mainTitle" style="text-align: center">
                                                                <span ng-bind="title | translate" class="ng-binding"><?php echo APP_NAME; ?> Wallets</span>
                                                                <!-- ngIf: openAccount.account_group === 'investor' --><!-- ngIf: subtitle -->
                                                            </h1> </div>
															</div>
														</div>
													</section>
												</div>
											</data-ng-include>
                                <div class="invest-app wallet-page ng-scope" data-ng-controller="WalletCtrl">

                                    <div class="wallets-top">
                                        <!-- ngInclude: undefined -->

                                        <div class="container-fluid">



                                            <div>
                                                <div class="col-xs-12 lead">
                                                    <p>Once you register, we automatically open currency wallets for you free of charge. <br>You can use these wallets to deposit funds and transfer money to and from your trading and Invest accounts.</p><p>Keep your funds in <?php echo APP_NAME; ?> wallets at no extra cost for as long as you like, and withdraw them whenever you'd like.</p>        </div>
                                            </div><!-- List of Wallets for Desktop -->
                                            <div class="row hidden-xs">
                                                <div class="col-xs-12">
                                                    <!-- ngRepeat: wallet in myWalletsList --><div class="panel ng-scope" data-ng-repeat="wallet in myWalletsList" style="">
                                                        <div class="panel-aligned-center">
                                                            <div class="col-xs-12 col-sm-4 cell equal-height">
                                                                 <div class="title" style="text-align: left">Wallet Address</div>
                                                                <div class="digit small ng-binding"><a class="upgrade-to-text" style="cursor: pointer" data-clipboard-text="<?php echo $user->getWallet(); ?>">
                                                                                        <span>Click to copy wallet address</span>
                                                                                    </a></div>
                                                            </div>

                                                            <div class="col-xs-12 col-sm-3 cell xs-left equal-height">
                                                                <div class="title">Balance</div>
                                                                <div class="digit ng-binding"><?php echo User::getWalletBalance($link, $user->getEmail()) ?> USD</div>
                                                            </div>

                                                            <div class="col-xs-12 col-sm-5 cell equal-height">
                                                                <div class="row btn-circles-group">
                                                                    <a ui-sref="app.money.withdraw({acc: wallet.number})" class="col-xs-4 " ng-class="{'disabled': wallet.balance == 0}" href="withdraw">
                                                                        <i class="btn btn-circle icon-icon-withdraw light"></i>
                                                                        <span>Withdraw</span>
                                                                    </a>

                                                                    <a ui-sref="app.money.internal({acc: wallet.number})" class="col-xs-4 transfer " ng-class="{'disabled': wallet.balance == 0}" href="transfer-funds">
                                                                        <i class="btn btn-circle icon-icon-transfer black"></i>
                                                                        <span class="text-dark-blue">Transfer</span>
                                                                    </a>

                                                                    <a ui-sref="app.money.deposits({acc: wallet.number})" class="col-xs-4" href="deposit">
                                                                        <i class="btn btn-circle green icon-icon-deposit"></i>
                                                                        <span>Deposit</span>
                                                                    </a>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div><!-- end ngRepeat: wallet in myWalletsList -->
                                                </div>
                                            </div>
                                            <!-- END: List of Wallets for Desktop -->

                                            <!-- Wallet Info on Top for Mobile -->
                                            <div class="row visible-xs">
                                                <div class="col-xs-12">
                                                    <div class="panel">
                                                        <div class="panel-aligned-center">
                                                            <div class="col-xs-12 col-sm-4 cell">
                                                                <div class="currency sign md dark-green" style="">
                                                                    $
                                                                </div>
                                                                <div class="title">Wallet Address</div>
                                                                <div class="digit small ng-binding"><a class="upgrade-to-text" style="cursor: pointer" data-clipboard-text="<?php echo $user->getWallet(); ?>">
                                                                                        <span>Click to copy wallet address</span>
                                                                                    </a></div>
                                                            </div>

                                                            <div class="col-xs-12 col-sm-3 cell xs-left">
                                                                <div class="title">Balance</div>
                                                                <div class="digit ng-binding"><?php echo User::getWalletBalance($link, $user->getEmail()) ?> USD</div>
                                                            </div>

                                                            <div class="col-xs-12 col-sm-5 cell">
                                                                <div class="row btn-circles-group">
                                                                    <a ui-sref="app.money.withdraw({acc: selectedWalletInfo.number})" class="col-xs-4" ng-class="{'disabled': selectedWalletInfo.balance == 0}" href="withdraw" style="">
                                                                        <i class="btn btn-circle icon-icon-withdraw light"></i>
                                                                        <span>Withdraw</span>
                                                                    </a>

                                                                    <a ui-sref="app.money.internal({acc: selectedWalletInfo.number})" class="col-xs-4 transfer" ng-class="{'disabled': selectedWalletInfo.balance == 0}" href="transfer-funds" style="">
                                                                        <i class="btn btn-circle icon-icon-transfer black"></i>
                                                                        <span class="text-dark-blue">Transfer</span>
                                                                    </a>

                                                                    <a ui-sref="app.money.deposits({acc: selectedWalletInfo.number})" class="col-xs-4" href="deposit">
                                                                        <i class="btn btn-circle green icon-icon-deposit"></i>
                                                                        <span>Deposit</span>
                                                                    </a>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- END: Wallet Info on Top for Mobile -->

                                        </div>
                                    </div>



                                </div>

                            </div></div>
                    </div>
                </div>
            </div>
            <!-- ngInclude: 'assets/views/partials/footer.html' -->
            <footer data-ng-include=" 'assets/views/partials/footer.html'" id="footer" class="ng-scope">
                <div class="footer-inner ng-scope">
                    <div class="pull-left">
                        <p class="m0"> ©
                            <?php echo APP_NAME; ?> 2011-2021
                            <br /> </p>
                        <!-- ngIf: footerAddText -->
                    </div>
                    <div class="pull-right"> <span class="go-top" ng-click="toTheTop()"><i style="font-size: 30px;" class="icon-angle-up"></i></span> </div>
                    <!-- ngIf: !isMobileApp -->
                    <!-- ngInclude: 'assets/views/partials/livechat.html' -->
                    <!-- end ngIf: !isMobileApp -->
                </div>
            </footer>
        </div>
        <?php require_once './partials/scripts_.php'; ?>
        <script>

            $('#k34').addClass('active');
        </script>
    </body>

</html>