<?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 | Superviseur</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">
			<!-- Sidebar toggle button-->
			<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">
							<?= $this->lang->line('Bienvenue'); ?>  <span class="hidden-xs"><b><?= $this->session->userdata('firstname').' '.$this->session->userdata('lastname');?></b></span>
						</a>
						<ul class="dropdown-menu">
							<!-- User image -->
							<li class="user-header">
								<p>
									<?= $this->session->userdata('network').' - '.$this->session->userdata('member_code');?>
									<small><?= $this->session->userdata('email');?></small>
								</p>
							</li>
							<li class="user-body">
								<div class="row">
									<div class="col-xs-6 text-center">
										<?= $this->session->userdata('current_pays');?>
									</div>
									<div class="col-xs-6 text-center">
										<?= $this->session->userdata('phone');?>
									</div>
								</div>
								<!-- /.row -->
							</li>
							<li class="user-footer">
								<div class="pull-right">
									<a href="<?= base_url('Users/logout') ?>" class="btn btn-default btn-flat"><?= $this->lang->line('Déconnexion'); ?></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('Superviseur_dash') ?>">
						<i class="fa fa-dashboard"></i> <span><?= $this->lang->line('Tableau de bord'); ?></span>
					</a>
				</li>
				<li class="<?php if ($active == "geolocated") {
					echo "active ";
				} ?>">
					<a href="<?= base_url('Superviseur_dash/getAllUser_g') ?>">
						<i class="fa fa-users"></i>
						<span><?= $this->lang->line('Utilisateurs géolocalisés'); ?></span>
					</a>
				</li>
				</li>
				<?php if($hasWallet?->type != 'ilink_sante') { ?>
				<li class="<?= "treeview " . ((strpos($active, "demandes_credits") !== false) ? "active menu-open" : "") ?>"
					style="height: auto;">
					<a href="#">
						<i class="fa fa-users"></i>
						<span><?= $this->lang->line('Demandes de crédits'); ?></span>
						<span class="pull-right-container">
						  <i class="fa fa-angle-left pull-right"></i>
						</span>
					</a>
					<ul class="treeview-menu"
						style="<?= (strpos($active, "demandes_credits") !== false) ? "" : "display: none;" ?>">
						<li class="<?php if ($active == "demandes_credits_entrantes") {
							echo "active ";
						} ?>">
							<a href="<?= base_url('Superviseur_dash/getDemandes?type=incoming') ?>"><i
										class="fa fa-arrow-down"></i><?= $this->lang->line('incoming_requests'); ?>
							</a></li>
						<li class="<?php if ($active == "demandes_credits_sortantes") {
							echo "active ";
						} ?>">
							<a href="<?= base_url('Superviseur_dash/getDemandes?type=outgoing') ?>"><i
										class="fa fa-arrow-up"></i><?= $this->lang->line('outgoing_requests'); ?>
							</a></li>
					</ul>
				</li>
				<!--				<li class="--><?php // if($active=="demandesAd"){echo "active ";}  ?><!--">-->
				<!--                            <a href="-->
				<?php // echo base_url('Superviseur_dash/getDemandesAd') ?><!--">-->
				<!--                                <i class="fa fa-users"></i> <span> -->
				<?php //echo $this->lang->line('Demandes adhésion'); ?><!--</span>-->
				<!--                            </a>-->
				<!--				</li>-->
				<?php } ?>
				<?php if ($hasWallet) {
					?>
					<li class="<?php if ($active == "wallet") {
						echo "active";
					} ?>">
						<a href="<?= base_url('Superviseur_dash/wallet') ?>">
							<i class="glyphicon glyphicon-credit-card"></i> <span>Wallet<?php //echo $this->lang->line('Game'); ?></span>
						</a>
					</li>

					<?php if (($hasWallet?->type == 'ilink') && ($hasWallet?->has_nano_credit)) { ?>
						<li class="<?php if ($active == "nano_credit") {
							echo "active";
						} ?>">
							<a href="<?= base_url('Superviseur_dash/nano_credit') ?>">
								<i class="fa fa-money"></i> <span>Nano credit</span>
							</a>
						</li>
					<?php }?>
				<?php } ?>
				<li class="<?php if($active=="recherche"){echo "active";}  ?>">
					<a href="<?= base_url('Superviseur_dash/recherche') ?>">
						<i class="glyphicon glyphicon-search"></i> <span><?= $this->lang->line('Rechercher'); ?></span>
					</a>
				</li>
			</ul>
		</section>
		<!-- /.sidebar -->
	</aside>

	<!-- /.modal -->
	<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
	<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
	<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
	<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />

	<script type="text/javascript">
		var startDate;
		var endDate;

		$(function() {

			var start = moment().subtract(29, 'days');
			var end = moment();

			startDate = start;
			endDate = end;

			function cb(start, end) {
				$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
				startDate = start;
				endDate = end;
			}

			$('#reportrange').daterangepicker({
				startDate: start,
				endDate: end,
				ranges: {
					'Today': [moment(), moment()],
					'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
					'Last 7 Days': [moment().subtract(6, 'days'), moment()],
					'Last 30 Days': [moment().subtract(29, 'days'), moment()],
					'This Month': [moment().startOf('month'), moment().endOf('month')],
					'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
				}
			}, cb);

			cb(start, end);

		});

	</script>
