<?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 | Hyperviseur</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">

			<?php
			if ($this->session->userdata('network_id') == '271') {
				?>
				<!-- 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/miang-logo.png') ?>">
					<b>MIANG</b>
				</span>
			<?php } else { ?>
				<!-- 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>
			<?php } ?>

		</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('Hyperviseur_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="#" data-toggle="modal" data-target="#modal-default">
						<i class="fa fa-users"></i>
						<span><?= $this->lang->line($hasWallet?->type == 'ilink_sante' ? 'service_providers' : 'Utilisateurs géolocalisés'); ?></span>
					</a>

				</li>
				<li class="<?php if ($active == "super") {
					echo "active ";
				} ?>">
					<a href="<?= base_url('Hyperviseur_dash/getAllSupervisor') ?>">
						<i class="fa fa-users"></i> <span><?= $this->lang->line('Superviseur'); ?></span>
					</a>

				</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('Hyperviseur_dash/getDemandes') ?>">
									<i class="fa fa-users"></i>
									<span><?= $this->lang->line('Demandes de crédits'); ?></span>
								</a>

							</li>
							<li class="<?php if ($active == "demandes_credits_annulation") {
								echo "active ";
							} ?>">
								<a href="<?= base_url('Hyperviseur_dash/demandsCancellation') ?>"><i
											class="fa fa-undo"></i><?= $this->lang->line('cancellation'); ?>
								</a></li>
						</ul>
					</li>

					<li class="<?php if ($active == "demandesAd") {
						echo "active ";
					} ?>">
						<a href="<?= base_url('Hyperviseur_dash/getDemandesAd') ?>">
							<i class="fa fa-user-secret"></i>
							<span><?= $this->lang->line('Demandes adhésion'); ?></span>
						</a>
					</li>
				<?php } ?>
				<?php if ($hasWallet && $hasWallet?->type) { ?>
					<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('Hyperviseur_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') { ?>
								<li class="<?php if ($active == "wallet_validating_account_opening_agents") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/validating_agents/account_opening_agents') ?>">
										<i class="fa fa-users"></i>
										<span><?= $this->lang->line('account_opening_agents'); ?></span>
									</a>
								</li>
							<?php } ?>
							<?php if ($hasWallet?->type == 'ilink_sante') { ?>
								<li class="<?php if ($active == "wallet_drugs_and_devices") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/drugs_and_devices') ?>">
										<i class="fa fa-ambulance"></i>
										<span><?= $this->lang->line('drugs_and_devices'); ?></span>
									</a>
								</li>
								<li class="<?php if ($active == "wallet_validating_agents") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/validating_agents') ?>">
										<i class="fa fa-user"></i>
										<span><?= $this->lang->line('validating_agents'); ?></span>
									</a>
								</li>
								<li class="<?php if ($active == "wallet_validating_doctors") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/validating_agents/doctors') ?>">
										<i class="fa fa-stethoscope"></i>
										<span><?= $this->lang->line('validating_doctors'); ?></span>
									</a>
								</li>
								<li class="<?php if ($active == "wallet_validating_controllers") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/validating_agents/controllers') ?>">
										<i class="fa fa-stethoscope"></i>
										<span><?= $this->lang->line('controllers_doctors'); ?></span>
									</a>
								</li>
								<li class="<?php if ($active == "wallet_insured") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/wallet?history=insurance-insured') ?>">
										<i class="fa fa-medkit"></i>
										<span><?= $this->lang->line('insured'); ?></span>
									</a>
								</li>
								<li class="<?php if ($active == "wallet_health_care_sheets") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/wallet?history=insurance-health_care_sheets') ?>">
										<i class="fa fa-file-text"></i>
										<span><?= $this->lang->line('health_care_sheets'); ?></span>
									</a>
								</li>
								<li class="<?php if ($active == "wallet_invoices") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/wallet?history=insurance-invoices') ?>">
										<i class="fa fa-file-text"></i>
										<span><?= $this->lang->line('invoices'); ?></span>
									</a>
								</li>
								<li class="<?php if ($active == "wallet_exclusions") {
									echo "active";
								} ?>">
									<a href="<?= base_url('Hyperviseur_dash/exclusions') ?>">
										<i class="fa fa-times"></i>
										<span>Exclusions</span>
									</a>
								</li>
							<?php } ?>
							<li class="<?php if ($active == "wallet_password") {
								echo "active";
							} ?>">
								<a href="<?= base_url('Hyperviseur_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('Hyperviseur_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('Hyperviseur_dash/operators') ?>">
								<i class="fa fa-building"></i> <span><?= $this->lang->line('operators'); ?></span>
							</a>
						</li>
					<?php } ?>
				<?php } ?>

				<li class="<?php if ($active == "recherche") {
					echo "active";
				} ?>">
					<a href="<?= base_url('Hyperviseur_dash/recherche') ?>">
						<i class="glyphicon glyphicon-search"></i> <span><?= $this->lang->line('Rechercher'); ?></span>
					</a>
				</li>

				<?php if (($hasWallet) && ($hasWallet?->type == 'ilink')) { ?>
					<li class="<?php if ($active == "documentation") {
						echo "active";
					} ?>">
						<a href="<?= base_url('Hyperviseur_dash/documentation') ?>">
							<i class="fa fa-book"></i> <span>Documentation</span>
						</a>
					</li>
				<?php } ?>
			</ul>

		</section>
		<!-- /.sidebar -->
	</aside>

	<div class="modal fade" id="modal-default">
		<div class="modal-dialog">
			<div class="modal-content">
				<form action="<?= base_url('Hyperviseur_dash/getAllUser_g') ?>" 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('Sélectionnez la ville'); ?></h4>
					</div>
					<div class="modal-body">

						<div class="form-group">

							<?php
							$result = $villes;
							$numrows = $result->num_rows();

							if ($numrows > 0) { ?>
								<select class="form-control input-lg" name="ville" required>
									<?php foreach ($result->result() as $row) {

										echo "<option value='$row->id'>" . $row->ville . "</option>";
									} ?>
								</select>
							<?php } else {
								echo "Aucun utilisateur géolocalisé";
							}
							?>

						</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>


	<!-- /.modal -->

	<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
