<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
	<title>VOODOO GROUP - Application de gestion des Fournisseurs</title>
	<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" rel="stylesheet" />
	<link href="assets/css/style.css" rel="stylesheet" type="text/css" />
	<link crossorigin="anonymous" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" referrerpolicy="no-referrer" rel="stylesheet" />
	 <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>
	 <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
	 
	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.18.3/bootstrap-table.min.css">
	
	 <script>
		document.addEventListener('DOMContentLoaded', function() {
		  const token = localStorage.getItem('apiToken');
		  if (!token) {
			// Redirect to login page if no token is found
			window.location.href = 'login.html';
		  }
		});
	   document.addEventListener('DOMContentLoaded', function() {
				var logoutButton = document.getElementById('logout');
				if (logoutButton) {
					logoutButton.addEventListener('click', function() {
						localStorage.removeItem('apiToken');
						localStorage.removeItem('loggedIn');
						localStorage.removeItem('userName');
						localStorage.removeItem('lastActivity');
						window.location.href = 'login.html';
					});
				}
			});
	  </script>
	  
	  <script>
		document.addEventListener('DOMContentLoaded', function() {
		  const token = localStorage.getItem('apiToken');
		  const username = localStorage.getItem('username');
		  const lastActivity = localStorage.getItem('lastActivity');
		  if (!token || !lastActivity) {
			window.location.href = 'login.html';
		  } else {
			const inactivityLimit = 60 * 60 * 1000; // 60 minutes
			const currentTime = Date.now();
			
			if (currentTime - parseInt(lastActivity) > inactivityLimit) {
			  localStorage.removeItem('apiToken');
			  localStorage.removeItem('loggedIn');
			  localStorage.removeItem('username');
			  localStorage.removeItem('lastActivity');
			  alert('Vous avez été déconnecté en raison de l\'inactivité.');
			  window.location.href = 'login.html';
			} else {
			  localStorage.setItem('lastActivity', currentTime.toString());
			}
		
			// Fetch user information
			fetchUserInfo(username, token);
			
		  }

		  document.addEventListener('mousemove', resetTimer);
		  document.addEventListener('keydown', resetTimer);
		  document.addEventListener('click', resetTimer);

		  function resetTimer() {
			localStorage.setItem('lastActivity', Date.now().toString());
		  }
		  
		  
			function fetchUserInfo(username, token) {
			axios.get(`https://furytech-sa.com/voodoo/api/index.php/users/login/${username}`, {
			  headers: {
				'DOLAPIKEY': token
			  }
			})
			.then(response => {
			  const userInfo = response.data;
			  document.getElementById('userInfo').innerText = JSON.stringify(userInfo, null, 2);
			})
			.catch(error => {
			  console.error('Erreur lors de la récupération des informations utilisateur:', error);
			});
		  }
		  
		  
		  
		});
	 </script>
	  

</head>
<body>
<div class="container wrapper">
<div class="row">
<div class="col-lg-9 mx-auto">
<div class="set-red-box">
<div class="row w-100 align-items-center">
<div class="col-lg-4 mt-4 set-margin-left-112">
<div class="set-border-3"><img alt="error-icon" src="assets/images/error.png" /></div>
</div>

<div class="col-lg-8 mt-4">
<p>les informations de cette plateforme sont strictement confidentielles et</p>
<p>&eacute;tablies &agrave; l&#39;intentionexclusive de ses destinataires. Les informations</p>
<p>fournies ne seront en aucun cas transmises &agrave; des tiers, toute</p>
<p>reproduction ou utilisation sous toutes ses formes en tout ou en partie</p>
<p>est strictement interdite sans autorisation.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- *****NAVBAR**** -->

<header class="container">
<div class="set-logo mb-3"><a href="#"><img alt="logo" src="assets/images/logo.png" /></a></div>

<div class="set-divider-sm"></div>

<nav class="navbar navbar-expand-lg set-nav-org">
<div class="container-fluid"><button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-bs-target="#navbarSupportedContent" data-bs-toggle="collapse" type="button"></button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
	<li class="nav-item d-flex align-items-center gap-2"><img alt="home" src="assets/images/home.png" /> <a aria-current="page" class="nav-link set-active" href="index.php">ACCUEIL</a></li>
	<li class="nav-item"><a class="nav-link" href="gestion.php">GESTION DES FOURNISSEURS</a></li>
	<li class="nav-item"><a class="nav-link" href="produits-services.php">PRODUITS &amp; SERVICES</a></li>
	<li class="nav-item"><a class="nav-link" href="commandes.php">COMMANDES</a></li>
</ul>

			<div class="d-flex set-nav-icons dropdown" role="search">
              <a href="#" class="set-border-right"><img src="assets/images/bell.png" alt=""></a>
              <a href="#" class="dropdown-toggle"  data-bs-toggle="dropdown" aria-expanded="false"><img src="assets/images/user.png" alt=""></a>
              <ul class="dropdown-menu">
                <li><button class="dropdown-item" type="button">Profil</button></li>
                <li><button class="dropdown-item" id="logout" type="button">Déconnexion</button></li>
              </ul>
            </div>
</div>
</div>
</nav>
</header>
<!-- ***** BANNER ***** -->

<section class="set-main-banner"><img alt="avatar-img" class="set-img-user" src="assets/images/avatar-img.png" />
<div class="set-banner-text">
<h1>Fournisseurs</h1>

<div>
<h2>internes et externes</h2>
</div>
</div>
</section>
<!-- ***** BOX ***** -->

<section class="set-main-black-white-box py-4">
<div class="container">
<div class="set-inner-white pt-4 pb-5 px-5">
<div class="row align-items-center">
<div class="col-lg-7 mt-4">
<div class="row">
<div class="col-lg-4 mt-3">
<div class="set-card-brown p-4">
<div class="set-border-bottom-white text-center pb-3"><a href="referencer-fournisseur.php"><img alt="icon" src="assets/images/referencer.png" /> </a></div>

<div class="set-text-card mt-3"><a href="referencer-fournisseur.php"><span>Referencer</span><br />
<span>un fournisseur</span> </a></div>
</div>
</div>

<div class="col-lg-4 mt-3">
<div class="set-card-brown set-card-red p-4 px-3">
<div class="set-border-bottom-white text-center pb-3"><a href="enregistrer-produit.php"><img alt="icon" src="assets/images/referencer.png" /> </a></div>

<div class="set-text-card set-bg-transparent mt-3"><a href="enregistrer-produit.php"><span>Enregistrer un</span><br />
<span>produit / un service</span> </a></div>
</div>
</div>

<div class="col-lg-4 mt-3">
<div class="set-card-brown set-card-dark-red p-4 px-3">
<div class="set-border-bottom-white text-center pb-3"><a href="acheter-produit.php"><img alt="icon" src="assets/images/referencer.png" /> </a></div>

<div class="set-text-card set-bg-transparent mt-3"><a href="acheter-produit.php"><span>Acheter un</span><br />
<span>produit / un service</span> </a></div>
</div>
</div>
</div>
</div>

<div class="col-lg-5 mt-4">

<form action="" method="get" onsubmit="updateFormAction()">
<h5>Rechercher tous les actifs</h5>

<!--<div class="set-input-select mt-3">
<select name ="t" class="form-select form-select-lg mb-3" aria-label="Selection">
  <option selected>Selectionner</option>
  <option value="1">Fournisseurs</option>
  <option value="2">Produits</option>
  <option value="3">Services</option>
</select>
<div class="set-input-main">
<input name="s"  class="input-group-text placeholder="Recherche de la selection" type="text" />
</div>-->

<div class="input-group mb-3">
  <select name ="t" class="form-select form-select-lg mb-3" aria-label="Selection">
  <option selected>Selectionner</option>
  <option value="1">Fournisseurs</option>
  <option value="2">Produits</option>
  <option value="3">Services</option>
  </select>
  <input name="s"  class="control-form" placeholder="Recherche de la selection" type="text" />
</div>
<div class="set-btn-all mt-2"><button type="submit">Trouver</button></div>

</div>

<!-- <div class="set-input-all mt-2"><input name="" placeholder="Recherche" type="text" /></div> -->


</form>
</div>
</div>
</div>
</div>

<div class="set-divider-white my-5"></div>
</section>


<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>

    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.18.3/bootstrap-table.min.js"></script>

<script>

	function updateFormAction() {
            const selectElement = document.querySelector('select[name="t"]');
            const formElement = document.querySelector('form');
            let actionURL = '';

            switch (selectElement.value) {
                case '1':
                    actionURL = 'gestion.php';
                    break;
                case '2':
                    actionURL = 'produits-services.php';
                    break;
                case '3':
                    actionURL = 'produits-services.php';
                    break;
                default:
                    actionURL = 'gestion.php';
            }

            formElement.action = actionURL;
        }



      //const cookieBox = document.querySelector(".wrapper"),
      //button = document.querySelector(".buttons");

      //const executeCodes = () => {
        // If cookie contains codinglab it will be returned and below of this code will not run
        //if (document.cookie.includes("codinglab")) return;
       // cookieBox.classList.add("show");

        // Add a click event listener to the button
        //button.addEventListener("click", () => {
          //cookieBox.classList.remove("show");
        //});
      //};

      // executeCodes function will be called on webpage load
      //window.addEventListener("load", executeCodes);

    </script></body>
</html>