<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>iLink | Dashboard</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" href="<?= base_url('bower_components/bootstrap/dist/css/bootstrap.min.css') ?>">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?= base_url('bower_components/font-awesome/css/font-awesome.min.css') ?>">
    <!-- Ionicons -->
    <link rel="stylesheet" href="<?= base_url('bower_components/Ionicons/css/ionicons.min.css') ?>">
    <!-- Theme style -->
    <link rel="stylesheet" href="<?= base_url('dist/css/AdminLTE.css') ?>">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="<?= base_url('dist/css/skins/_all-skins.min.css') ?>">
    <link rel="shortcut icon" href="<?= base_url('favicon.ico') ?>" type="image/x-icon">
    <link rel="icon" href="<?= base_url('favicon.ico') ?>" type="image/x-icon">

   <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
   <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
   <![endif]-->
   <style media="screen">
        .img-dash {
            height: 50px !important;
            float: left !important;
            padding: 1% !important;
        }

        .table_modified {
            font-size: 11px !important;
        }

   </style>
</head>

<body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">

        <header class="main-header">
            <!-- Logo -->
            <a href="#" class="logo">
                <!-- mini logo for sidebar mini 50x50 pixels -->
                <span class="logo-mini"><b>iLink</b></span>
                <!-- logo for regular state and mobile devices -->
                <span class="logo-lg">
                    <img class="img img-responsive img-dash" src="<?= base_url('images/logo.png') ?>">
                    <b>iLink</b> World
                </span>
            </a>
            <!-- Header Navbar: style can be found in header.less -->
            <nav class="navbar navbar-static-top">

          <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
            <span class="sr-only">Toggle navigation</span>
          </a>
          <div class="navbar-custom-menu">
                    <ul class="nav navbar-nav">
                        <!-- User Account: style can be found in dropdown.less -->
                        <li class="dropdown user user-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <b><?= $this->session->userdata('current_network');?></b> -
                                <b><?= $this->session->userdata('name_current_pays');?></b> -
                                <b><?= $this->session->userdata('name_current_ville');?></b>
                                - <?= $this->lang->line('Bienvenue'); ?>  <span class="hidden-xs"><b><?= $lastname;?></b></span>
                            </a>
                            <ul class="dropdown-menu" style="width: 400px">
                                <!-- User image -->
                                <li class="user-header">
                                    <p>
                                        <?= $this->lang->line('administrateur'); ?>
                                        <small><?= $email;?></small>
                                    </p>
                                </li>
                                <li class="user-body">
                                    <div class="row">
                                        <div class="col-xs-3 text-center">
                                            <?= $this->session->userdata('current_network');?>
                                        </div>
                                        <div class="col-xs-4 text-center">
                                            <?= $this->session->userdata('current_hyper');?>
                                        </div>
                                        <div class="col-xs-5 text-center">
                                            <?= $this->session->userdata('current_contact_hyper');?>
                                        </div>
                                    </div>
                                    <!-- /.row -->
                                </li>
                                <!-- Menu Footer-->
                                <li class="user-footer">
                                    <div class="pull-left">
                                        <a href="#" data-toggle="modal" data-target="#modal-defaultSwitch" class="btn btn-default btn-flat"><?= $this->lang->line('Reseau'); ?></a>
                                    </div>
                                    <div class="pull-right">
                                        <a href="<?= base_url('Admin_dash/filter') ?>" class="btn btn-default btn-flat"><?= $this->lang->line('Terminer'); ?></a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
        </nav>
        </header>
        <!-- Left side column. contains the logo and sidebar -->
        <aside class="main-sidebar">
            <!-- sidebar: style can be found in sidebar.less -->
            <section class="sidebar">
                <!-- sidebar menu: : style can be found in sidebar.less -->
                <ul class="sidebar-menu" data-widget="tree">

                    <li class="<?php if($active=="dash"){echo "active";}  ?>">
                        <a href="<?= base_url('Admin_dash') ?>">
                             <i class="fa fa-dashboard"></i> <span><?= $this->lang->line('Tableau de bord'); ?></span>
                        </a>
                    </li>
                    <li class="<?php if($active=="members"){echo "active";}  ?>">
                        <a href="<?= base_url('Admin/initGetAllUser_g') ?>">
                            <i class="fa fa-users"></i> <span><?= $this->lang->line('Utilisateurs géolocalisés'); ?></span>
                        </a>
                    </li>
                    <li class="<?php if($active=="simple_members"){echo "active";}  ?>">
                        <a href="<?= base_url('Listes_members') ?>">
                            <i class="fa fa-users"></i> <span><?= $this->lang->line('Utilisateurs simples'); ?></span>
                        </a>
                    </li>
                    <li class="<?php if($active=="members_code"){echo "active";}  ?>">
                        <a href="<?= base_url('Member_code_admin') ?>">
                            <i class="fa fa-database"></i> <span><?= $this->lang->line('code membre'); ?></span>
                        </a>
                    </li>
                    <!--<li class="<?php //if($active=="demandes"){echo "active";}  ?>">
                        <a href="<?php //echo base_url('Admin/getAllDemandes') ?>">
                            <i class="fa fa-ticket"></i> <span><?php //echo $this->lang->line('Demandes de crédits'); ?></span>
                        </a>
                    </li>-->
					<?php if ($hasWallet) {?>
						<li class="<?= "treeview " . ((strpos($active, "wallet_") !== false) ? "active menu-open" : "") ?>"
							style="height: auto;">
							<a href="#">
								<i class="fa fa-credit-card-alt"></i>
								<span><?= $this->lang->line('wallet_management'); ?></span>
								<span class="pull-right-container">
						  <i class="fa fa-angle-left pull-right"></i>
						</span>
							</a>
							<ul class="treeview-menu"
								style="<?= (strpos($active, "wallet_") !== false) ? "" : "display: none;" ?>">
								<li class="<?php if ($active == "wallet_wallet") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Admin_dash/wallet') ?>">
										<i class="glyphicon glyphicon-credit-card"></i>
										<span>Wallet<?php //echo $this->lang->line('Game'); ?></span>
									</a>
								</li>
								<li class="<?php if ($active == "wallet_password") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Admin_dash/walletPassword') ?>">
										<i class="glyphicon glyphicon-lock"></i>
										<span><?= $this->lang->line('menu_wallet_password'); ?></span>
									</a>
								</li>
							</ul>
						</li>


						<?php if (($hasWallet?->type == 'ilink') && ($hasWallet?->has_nano_credit))  { ?>
							<li class="<?php if ($active == "nano_credit") {
								echo "active";
							} ?>">
								<a href="<?= base_url('Admin_dash/nano_credit') ?>">
									<i class="fa fa-money"></i> <span>Nano credit</span>
								</a>
							</li>

							<li class="<?php if($active=="operators"){echo "active";}  ?>">
								<a href="<?= base_url('Admin_dash/operators') ?>">
									<i class="fa fa-building"></i> <span><?= $this->lang->line('operators'); ?></span>
								</a>
							</li>
						<?php }?>
					<?php } ?>
                    <li class="<?php if($active=="deconnexion"){echo "active";}  ?>">
                        <a  href="#" data-toggle="modal" data-target="#modal-disconnect">
                            <i class="glyphicon glyphicon-off"></i> <span><?= $this->lang->line('Déconnexion'); ?></span>
                        </a>
                    </li>
                </ul>
            </section>
            <!-- /.sidebar -->
        </aside>

        <div class="modal fade" id="modal-defaultSwitch">
            <div class="modal-dialog">
                <div class="modal-content">
                    <form action="<?= base_url('Admin_dash/firstFilter')?>" method="post">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title"><?= $this->lang->line('Appliquer un filtre'); ?></h4>
                        </div>
                        <div class="modal-body">
                            <div class="form-group">
                                <?php
                                $result=$pays;
                                $numrows=$result->num_rows();
                                if ($numrows > 0) { ?>
                                    <select class="form-control input-lg" name="pays" required id="pays">
                                        <?php foreach($result->result() as $row) {
                                            echo "<option value='".$row->id."'>".$row->name."</option>";
                                        } ?>
                                    </select>
                                <?php }else{
                                    echo $this->lang->line('Aucun pays');
                                }
                                ?>
                            </div>
                            <div class="form-group">
                                <?php
                                $result=$hyper;
                                $numrows=$result->num_rows();
                                if ($numrows > 0) { ?>
                                    <select class="form-control input-lg" name="hyper" required id="hyper">
                                        <?php foreach($result->result() as $row) {
                                            echo "<option value='".$row->code_membre."'>".$row->lastname."-".$row->network." (".$row->code_membre.")</option>";
                                        } ?>
                                    </select>
                                <?php }else{
                                    echo $this->lang->line('no_admin');
                                }
                                ?>
                            </div>
                            <div class="form-group">
                                <?php
                                $result=$ville;
                                $numrows=$result->num_rows();
                                if ($numrows > 0) { ?>
                                    <select class="form-control input-lg" name="ville" required id="ville">
                                        <?php foreach($result->result() as $row) {
                                            echo "<option value='".$row->town_id."'>".$row->town."</option>";
                                        } ?>
                                    </select>
                                <?php }else{
                                    echo $this->lang->line('Aucune ville');
                                }
                                ?>
                            </div>

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default pull-left" data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
                            <button type="submit" class="btn btn-primary"><?= $this->lang->line('Continuer'); ?></button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="modal fade" id="modal-disconnect">
            <div class="modal-dialog">
                <div class="modal-content">
                    <form action="<?= base_url('Users/logout') ?>">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title"><?= $this->lang->line('Déconnexion'); ?></h4>
                        </div>
                        <div class="modal-body">
                            <?= $this->lang->line('Vous allez être déconnecté'); ?>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default pull-left" data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
                            <button type="submit" class="btn btn-primary"><?= $this->lang->line('Continuer'); ?></button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
