<?php 
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';

include('model.php');
$sql=new model;
include('db.php');

$_SESSION['adresse_pm']="";
$_SESSION['pourcentage']="";

$infoConfiguration=$sql->infoConfiguration();
while ($infoConfigurations=$infoConfiguration->fetch()) {
    $_SESSION['adresse_pm']=$infoConfigurations['adresse_pm'];
    $_SESSION['pourcentage']=$infoConfigurations['pourcentage'];
}

$_SESSION['nomF']="";
$_SESSION['prixF']="";
$_SESSION['prix_usdF']="";

$infoFormation=$sql->infoFormation();
while ($infoFormations=$infoFormation->fetch()) {
    $_SESSION['nomF']=$infoFormations['nom'];
    $_SESSION['prixF']=$infoFormations['prix'];
    $_SESSION['prix_usdF']=$infoFormations['prix_usd'];
}

$commis=($_SESSION['prixF']*$_SESSION['pourcentage'])/100;

if (empty($_SESSION['admin_id'])) {
    # code...
    header('location:login.php');
}
$_SESSION['error_depot']="";

$dat_traitement=date('Y-m-d H:i:s');

// valider un depot1
if (isset($_GET['val']) && !empty($_GET['val'])) {
    $_SESSION['depot_val']=$_GET['val'];
    $infosDepot=$sql->infoDepot('depot_perfect',$_SESSION['depot_val']);
    $validDepot=$sql->validDepot('depot_perfect',$_SESSION['depot_val']);
    if ($validDepot) {
        $misActive=$sql->misActive($infosDepot);
        $infoUser=$sql->infoUser($infosDepot);

        $dr=$db->prepare('SELECT code_parrain FROM user WHERE id=?');
        $dr->execute(array($infosDepot));
        while ($drs=$dr->fetch()) {
            $code_parrain=$drs['code_parrain'];

            $bon=$db->prepare('UPDATE user SET solde=solde+? WHERE code_perso=?');
            $bon->execute(array($commis,$code_parrain));

            $infoCode=$sql->infoCode($code_parrain);

            $cool=$db->prepare('INSERT INTO comission_parrainnage(beneficiaire,filleul,mnt,dat) VALUES(?,?,?,?)');
            $cool->execute(array($infoCode,$infosDepot,$commis,date('Y-m-d')));
        }

        $mail = new PHPMailer(true);
        $mail->isSMTP();
        $mail->Host = 'smtp.gmail.com';
        $mail->SMTPAuth = true;
        $mail->Username = 'vision.million.inter@gmail.com';
        $mail->Password ='iwdugwoojkbobdxb';
        $mail->SMTPSecure = 'ssl';
        $mail->Port = 465;

        $mail->setFrom('vision.million.inter@gmail.com');
        $mail->addAddress($infoUser);
        $mail->isHTML(true);
        $mail->Subject = "DEPOT VALIDE";
        $mail->Body = '
        <div style="padding:0;margin:0;background-color:#f7f7f7;">
    <table style="table-layout:fixed; border-spacing:0; border-collapse:collapse; background-color:#f7f7f7; width:100%; margin:0 auto; padding:0;" width="100%" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7;">
        <tbody>
            <tr>
                <td align="center" style="padding:25px 0;">
                  <table style="table-layout:fixed; border-spacing:0; border-collapse:collapse; background-color:#fff; border-radius:10px; min-width: 320px; max-width:600px; margin:0 auto; box-shadow:0px 0px 14px -4px rgba(0,0,0,0.2);" width="650" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7;">
                      <tbody>
                          
                          <tr>
                              <td align="center" style="padding:16px 25px 25px;">
                                  <table width="100%" cellspacing="0" cellpadding="0" border="0">
                                      <tbody>
                                          <tr>
                                              <td align="center" style="padding:0;">
                                                  
                                                  
                                                  <p style="color:#000; font-family: Arial, Helvetica, sans-serif; font-size:25px; font-weight:normal; letter-spacing:0.5px; line-height:1.5; text-align:center; margin:0 0 15px;">Cher utilisateur, votre dépot perfect money est validé avec succès.</p>
                                              </td>
                                          </tr>
                                          
                                      </tbody>
                                  </table>
                              </td>
                          </tr>

                          
                         
                          <tr>
                              <td align="center">
                                  <table width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color:#1E2762; padding:25px 25px; border-radius:0 0 10px 10px;">
                                      <tbody>
                                        
                                          <tr>
                                              <td align="center" style="padding:0 0;">
                                                  <p style="color:#fff; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:normal; letter-spacing:0.5px; line-height:1.5; text-align:center; margin:0 0;">Powered by <a href="#" style="color:#f4f4f4; padding:0; margin:0; text-decoration:underline; display:inline-block;padding:0 5px;">Vision million</a>.</p>
                                              </td>
                                          </tr>
                                      </tbody>
                                  </table>
                              </td>
                          </tr>
                      </tbody>
                  </table>
              </td>
          </tr>
      </tbody>
    </table>
    </div>';
    $mail->send();
    $_SESSION['error_depot']="valider";
    }
}


// valider un depot2
if (isset($_GET['val2']) && !empty($_GET['val2'])) {
    $_SESSION['depot_val2']=$_GET['val2'];
    $infosDepot=$sql->infoDepot('depot_internationaux',$_SESSION['depot_val2']);
    $validDepot=$sql->validDepot('depot_internationaux',$_SESSION['depot_val2']);
    if ($validDepot) {
        $misActive=$sql->misActive($infosDepot);
        $infoUser=$sql->infoUser($infosDepot);

        $dr=$db->prepare('SELECT code_parrain FROM user WHERE id=?');
        $dr->execute(array($infosDepot));
        while ($drs=$dr->fetch()) {
            $code_parrain=$drs['code_parrain'];

            $bon=$db->prepare('UPDATE user SET solde=solde+? WHERE code_perso=?');
            $bon->execute(array($commis,$code_parrain));

            $infoCode=$sql->infoCode($code_parrain);

            $cool=$db->prepare('INSERT INTO comission_parrainnage(beneficiaire,filleul,mnt,dat) VALUES(?,?,?,?)');
            $cool->execute(array($infoCode,$infosDepot,$commis,date('Y-m-d')));
        }
        
        $mail = new PHPMailer(true);
        $mail->isSMTP();
        $mail->Host = 'smtp.gmail.com';
        $mail->SMTPAuth = true;
        $mail->Username = 'vision.million.inter@gmail.com';
        $mail->Password ='iwdugwoojkbobdxb';
        $mail->SMTPSecure = 'ssl';
        $mail->Port = 465;

        $mail->setFrom('vision.million.inter@gmail.com');
        $mail->addAddress($infoUser);
        $mail->isHTML(true);
        $mail->Subject = "DEPOT VALIDE";
        $mail->Body = '
        <div style="padding:0;margin:0;background-color:#f7f7f7;">
    <table style="table-layout:fixed; border-spacing:0; border-collapse:collapse; background-color:#f7f7f7; width:100%; margin:0 auto; padding:0;" width="100%" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7;">
        <tbody>
            <tr>
                <td align="center" style="padding:25px 0;">
                  <table style="table-layout:fixed; border-spacing:0; border-collapse:collapse; background-color:#fff; border-radius:10px; min-width: 320px; max-width:600px; margin:0 auto; box-shadow:0px 0px 14px -4px rgba(0,0,0,0.2);" width="650" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7;">
                      <tbody>
                          
                          <tr>
                              <td align="center" style="padding:16px 25px 25px;">
                                  <table width="100%" cellspacing="0" cellpadding="0" border="0">
                                      <tbody>
                                          <tr>
                                              <td align="center" style="padding:0;">
                                                  
                                                  
                                                  <p style="color:#000; font-family: Arial, Helvetica, sans-serif; font-size:25px; font-weight:normal; letter-spacing:0.5px; line-height:1.5; text-align:center; margin:0 0 15px;">Cher utilisateur, votre dépot est validé avec succès.</p>
                                              </td>
                                          </tr>
                                          
                                      </tbody>
                                  </table>
                              </td>
                          </tr>

                          
                         
                          <tr>
                              <td align="center">
                                  <table width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color:#1E2762; padding:25px 25px; border-radius:0 0 10px 10px;">
                                      <tbody>
                                        
                                          <tr>
                                              <td align="center" style="padding:0 0;">
                                                  <p style="color:#fff; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:normal; letter-spacing:0.5px; line-height:1.5; text-align:center; margin:0 0;">Powered by <a href="#" style="color:#f4f4f4; padding:0; margin:0; text-decoration:underline; display:inline-block;padding:0 5px;">Vision million</a>.</p>
                                              </td>
                                          </tr>
                                      </tbody>
                                  </table>
                              </td>
                          </tr>
                      </tbody>
                  </table>
              </td>
          </tr>
      </tbody>
    </table>
    </div>';
    $mail->send();
    $_SESSION['error_depot']="valider";
    }
}


// rejeter depot1
if (isset($_POST['cancel'])) {
    //Vérification motif
    if (!empty($_POST['motif'])) {
        if (trim($_POST['motif']=="")) {
            $error_motif= "Caractères alphanumériques uniquement";
        }else{
            $motif=htmlspecialchars($_POST['motif']);
        }
    }else{
        $error_motif= "Ce champs est obligatoire";
    }

    if (empty($motif)) {
        // code...
    } else {
        $infosDepot=$sql->infoDepot('depot_perfect',$_POST['id']);
        $annulerDepot=$sql->annulerDepot('depot_perfect',$_POST['id']);
        $infoUser=$sql->infoUser($infosDepot);
        $mail = new PHPMailer(true);
        $mail->isSMTP();
        $mail->Host = 'smtp.gmail.com';
        $mail->SMTPAuth = true;
        $mail->Username = 'vision.million.inter@gmail.com';
        $mail->Password ='iwdugwoojkbobdxb';
        $mail->SMTPSecure = 'ssl';
        $mail->Port = 465;

        $mail->setFrom('vision.million.inter@gmail.com');
        $mail->addAddress($infoUser);
        $mail->isHTML(true);
        $mail->Subject = "DEPOT REJETE";
        $mail->Body = '
        <div style="padding:0;margin:0;background-color:#f7f7f7;">
    <table style="table-layout:fixed; border-spacing:0; border-collapse:collapse; background-color:#f7f7f7; width:100%; margin:0 auto; padding:0;" width="100%" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7;">
        <tbody>
            <tr>
                <td align="center" style="padding:25px 0;">
                  <table style="table-layout:fixed; border-spacing:0; border-collapse:collapse; background-color:#fff; border-radius:10px; min-width: 320px; max-width:600px; margin:0 auto; box-shadow:0px 0px 14px -4px rgba(0,0,0,0.2);" width="650" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7;">
                      <tbody>
                          
                          <tr>
                              <td align="center" style="padding:16px 25px 25px;">
                                  <table width="100%" cellspacing="0" cellpadding="0" border="0">
                                      <tbody>
                                          <tr>
                                              <td align="center" style="padding:0;">
                                                  
                                                  
                                                  <p style="color:#000; font-family: Arial, Helvetica, sans-serif; font-size:25px; font-weight:normal; letter-spacing:0.5px; line-height:1.5; text-align:center; margin:0 0 15px;">Cher utilisateur, votre dépot perfect money est rejeté pour motif: '.$motif.'.</p>
                                              </td>
                                          </tr>
                                          
                                      </tbody>
                                  </table>
                              </td>
                          </tr>

                          
                         
                          <tr>
                              <td align="center">
                                  <table width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color:#1E2762; padding:25px 25px; border-radius:0 0 10px 10px;">
                                      <tbody>
                                        
                                          <tr>
                                              <td align="center" style="padding:0 0;">
                                                  <p style="color:#fff; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:normal; letter-spacing:0.5px; line-height:1.5; text-align:center; margin:0 0;">Powered by <a href="#" style="color:#f4f4f4; padding:0; margin:0; text-decoration:underline; display:inline-block;padding:0 5px;">Vision million</a>.</p>
                                              </td>
                                          </tr>
                                      </tbody>
                                  </table>
                              </td>
                          </tr>
                      </tbody>
                  </table>
              </td>
          </tr>
      </tbody>
    </table>
    </div>';
    $mail->send();
        
    }
    $_SESSION['error_depot']="rejeter";
    


}


// rejeter depot2
if (isset($_POST['cancel2'])) {
    //Vérification motif2
    if (!empty($_POST['motif2'])) {
        if (trim($_POST['motif2']=="")) {
            $error_motif2= "Caractères alphanumériques uniquement";
        }else{
            $motif2=htmlspecialchars($_POST['motif2']);
        }
    }else{
        $error_motif2= "Ce champs est obligatoire";
    }

    if (empty($motif2)) {
        // code...
    } else {
        $infosDepot=$sql->infoDepot('depot_internationaux',$_POST['id2']);
        $annulerDepot=$sql->annulerDepot('depot_internationaux',$_POST['id2']);
        $infoUser=$sql->infoUser($infosDepot);
        $mail = new PHPMailer(true);
        $mail->isSMTP();
        $mail->Host = 'smtp.gmail.com';
        $mail->SMTPAuth = true;
        $mail->Username = 'vision.million.inter@gmail.com';
        $mail->Password ='iwdugwoojkbobdxb';
        $mail->SMTPSecure = 'ssl';
        $mail->Port = 465;

        $mail->setFrom('vision.million.inter@gmail.com');
        $mail->addAddress($infoUser);
        $mail->isHTML(true);
        $mail->Subject = "DEPOT REJETE";
        $mail->Body = '
        <div style="padding:0;margin:0;background-color:#f7f7f7;">
    <table style="table-layout:fixed; border-spacing:0; border-collapse:collapse; background-color:#f7f7f7; width:100%; margin:0 auto; padding:0;" width="100%" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7;">
        <tbody>
            <tr>
                <td align="center" style="padding:25px 0;">
                  <table style="table-layout:fixed; border-spacing:0; border-collapse:collapse; background-color:#fff; border-radius:10px; min-width: 320px; max-width:600px; margin:0 auto; box-shadow:0px 0px 14px -4px rgba(0,0,0,0.2);" width="650" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7;">
                      <tbody>
                          
                          <tr>
                              <td align="center" style="padding:16px 25px 25px;">
                                  <table width="100%" cellspacing="0" cellpadding="0" border="0">
                                      <tbody>
                                          <tr>
                                              <td align="center" style="padding:0;">
                                                  
                                                  
                                                  <p style="color:#000; font-family: Arial, Helvetica, sans-serif; font-size:25px; font-weight:normal; letter-spacing:0.5px; line-height:1.5; text-align:center; margin:0 0 15px;">Cher utilisateur, votre dépot est rejeté pour motif: '.$motif2.'.</p>
                                              </td>
                                          </tr>
                                          
                                      </tbody>
                                  </table>
                              </td>
                          </tr>

                          
                         
                          <tr>
                              <td align="center">
                                  <table width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color:#1E2762; padding:25px 25px; border-radius:0 0 10px 10px;">
                                      <tbody>
                                        
                                          <tr>
                                              <td align="center" style="padding:0 0;">
                                                  <p style="color:#fff; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:normal; letter-spacing:0.5px; line-height:1.5; text-align:center; margin:0 0;">Powered by <a href="#" style="color:#f4f4f4; padding:0; margin:0; text-decoration:underline; display:inline-block;padding:0 5px;">Vision million</a>.</p>
                                              </td>
                                          </tr>
                                      </tbody>
                                  </table>
                              </td>
                          </tr>
                      </tbody>
                  </table>
              </td>
          </tr>
      </tbody>
    </table>
    </div>';
    $mail->send();
        
    }
    $_SESSION['error_depot']="rejeter";
    


}




?>
<!doctype html>
<html lang="en" data-layout="horizontal" data-topbar="dark" data-sidebar-size="lg" data-sidebar="light" data-sidebar-image="none" data-preloader="disable">

<?php include('head.php'); ?>

<body>

    <!-- Begin page -->
    <div id="layout-wrapper">

       <?php include('header.php'); ?>
<br><br>

        <div class="app-menu navbar-menu">
            

            <div id="scrollbar">
                <div class="container-fluid">

                    <div id="two-column-menu">
                    </div>
                    <ul class="navbar-nav" id="navbar-nav">
                        <?php include('nav.php'); ?>
                    </ul>
                </div>
                <!-- Sidebar -->
            </div>

            <div class="sidebar-background"></div>
        </div>
        <!-- Left Sidebar End -->
        <!-- Vertical Overlay-->
        <div class="vertical-overlay"></div>

        <div class="main-content">

        <div class="page-content">
                <div class="container-fluid">

                    <div class="chat-wrapper d-lg-flex gap-1 mx-n4 mt-n4 p-1">
                        
                        <div class="file-manager-content w-100 p-3 py-0">
                            <div class="mx-n3 pt-4 px-4 file-manager-content-scroll" data-simplebar>
                                <div id="folder-list" class="mb-2">
                                    <div class="row">
                            <div class="col-lg-12">
                                <div class="card">
                                    <div class="card-body">
                                        <div class="row g-2">
                                            
                                            <div class="col-sm-3">
                                                <div class="search-box">
                                                <h4 class="mb-sm-0">Tableau de bord</h4>
                                                </div>
                                            </div>

                                            <div class="col-sm-12">
                                                <?php
                                                    if ($_SESSION['error_depot']=="valider") {
                                                        # code...
                                                        echo('
                                                            <div class="alert alert-success mb-xl-0" role="alert">
                                                                <strong> Opération réussie. </strong> <b>Dépôt validé</b> 
                                                            </div>
                                                        ');
                                                    }
                                                     elseif ($_SESSION['error_depot']=="rejeter") {
                                                        # code...
                                                        echo('
                                                            <div class="alert alert-success mb-xl-0" role="alert">
                                                                <strong> Opération réussie. </strong> <b>Dépôt rejeté</b> 
                                                            </div>
                                                        ');
                                                    }
                                                    elseif (empty($_SESSION['error_depot'])) {
                                                        # code...
                                                    }
                                                ?>

                                            </div>
                                            <!--end col-->
                                            
                                        </div><!--end row-->
                                    </div>
                                </div>
                            </div><!--end col-->
                        </div><!--end row-->
                                    <div class="row" id="folderlist-data">
                                        <h5>Liste des dépôts en attente de validation</h5>
                                        <div class="card">
                                    <div class="card-body">
                                        <!-- Nav tabs -->
                                    <ul class="nav nav-pills animation-nav gap-2 gap-lg-3 flex-grow-1" role="tablist">
                                        <li class="nav-item">
                                            <a class="nav-link fs-14 active" data-bs-toggle="tab" href="#pill-justified-home-1" role="tab">
                                                <span class="d-md-none d-inline-block">Dépôts Perfect Money</span> <span class="d-none d-md-inline-block">Dépôts Perfect Money</span>
                                                </a>
                                            </li>
                                        <li class="nav-item">
                                            <a class="nav-link fs-14" data-bs-toggle="tab" href="#pill-justified-profile-1" role="tab">
                                                <span class="d-md-none d-inline-block">Dépôts Internationaux</span> <span class="d-none d-md-inline-block">Dépôts Internationaux</span>
                                            </a>
                                        </li> 
                                    </ul>

                                    <!-- Tab panes -->
                                    <div class="tab-content text-muted">
                                        <div class="tab-pane active" id="pill-justified-home-1" role="tabpanel">
                                        
                    <div class="row" id="folderlist-data">
                                        
                                        <div class="card">
                                    <div class="card-body">
                                        <div id="example">
                                            <div class="row g-4 mb-3">
                                                <div class="col-sm-auto">
                                                    <div>
                                                        
                                                    </div>
                                                </div>
                                                <div class="col-sm">
                                                    <div class="d-flex justify-content-sm-end">
                                                        <div class="search-box ms-2">
                                                            <input type="text" class="form-control search" placeholder="Search...">
                                                            <i class="ri-search-line search-icon"></i>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="table-responsive table-card mt-3 mb-1">
                                                <table class="table align-middle table-nowrap" id="customerTable">
                                                    <thead class="table-light">
                                                        <tr>
                                                            <th class="sort" data-sort="customer_name">Utilisateur</th>
                                                            <th class="sort" data-sort="email">Adresse d'envoie</th>
                                                            <th class="sort" data-sort="phone">Date</th>
                                                            <th class="sort" data-sort="action">Action</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody class="list form-check-all">
                                                        <?php 
                                                            $getDepotPerfect=$sql->getDepotPerfect();
                                                            while($getDepotPerfects=$getDepotPerfect->fetch()){
                                                                echo('
                                                                <tr>
                                                                    <td class="email">'.$getDepotPerfects['nom'].' '.$getDepotPerfects['pre'].'</td>
                                                                    <td class="email">'.$getDepotPerfects['adresse_envoie'].'</td>
                                                                    <td class="email">'.$getDepotPerfects['dat'].'</td>
                                                                    
                                                                    <td>
                                                                        <div class="">
                                                                        <button class="btn btn-ghost-primary btn-icon btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                                                                    <i class="bx bx-dots-horizontal-rounded fs-16 align-bottom"></i>
                                                                        </button>
                                                                        <ul class="dropdown-menu dropdown-menu-end">
                                                                            <li><a class="dropdown-item" onclick="return confirmsup()" href="?val='.$getDepotPerfects['id'].'"><i class="ri-check-line text-primary"></i>Valider</a></li>
                                                                            <li><a class="dropdown-item edit-folder-list"');?> onclick='renameFolder("<?php echo $getDepotPerfects['id'];?>")' <?php echo ('href="#updatefolderModal" data-bs-toggle="modal" role="button"><i class="ri-close-line text-danger"></i>Annuler</a></li>
                                                                        </ul>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                ');
                                                            }
                                                        ?>
                                                    </tbody>
                                                </table>
                                                <div class="noresult" style="display: none">
                                                    <div class="text-center">
                                                        <lord-icon src="https://cdn.lordicon.com/msoeawqm.json" trigger="loop" colors="primary:#121331,secondary:#08a88a" style="width:75px;height:75px">
                                                        </lord-icon>
                                                        <h5 class="mt-2">Aucun résultat</h5>
                                                        <!--<p class="text-muted mb-0">We've searched more than 150+ Orders We did not find any
                                                            orders for you search.</p>-->
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div><!-- end card -->
                                </div>
                                                                    
                                        <!--end col-->
                                    </div>
                                        </div>
                                        <div class="tab-pane" id="pill-justified-profile-1" role="tabpanel">
                                            
                                        
                    <div class="row" id="folderlist-data">
                                        
                                        <div class="card">
                                    <div class="card-body">
                                        <div id="customerList">
                                <div class="row g-4 mb-3">
                                    <div class="col-sm-auto"></div>
                                    <div class="col-sm">
                                        <div class="d-flex justify-content-sm-end">
                                            <div class="search-box ms-2">
                                                <input type="text" class="form-control search" placeholder="Rechercher...">
                                                <i class="ri-search-line search-icon"></i>
                                            </div>
                                        </div>
                                    </div>
                                </div>  
                                <div class="table-responsive table-card mt-3 mb-1">
                                    <table class="table align-middle table-nowrap" id="customerTable">
                                        <thead class="table-light">
                                            <tr>
                                                <th class="sort" data-sort="customer_name">Utilisateur</th>
                                                <th class="sort" data-sort="email">Moyen de paiement</th>
                                                <th class="sort" data-sort="status">Fichier reçu</th>
                                                <th class="sort" data-sort="action">Date</th>
                                                <th class="sort" data-sort="action">Action</th>
                                            </tr>
                                        </thead>
                                        <tbody class="list form-check-all">
                                            <?php 
                                            $getDepotInter=$sql->getDepotInter();
                                                while($getDepotInters=$getDepotInter->fetch()){
                                                echo('
                                                    <tr>
                                                        <td class="id" style="">'.$getDepotInters['nom'].' '.$getDepotInters['pre'].'</td>
                                                        <td class="customer_name">'.$getDepotInters['moyen'].'</td>
                                                        <td class="email"><a class="dropdown-item view-item-btn" target="_blank" href="../'.$getDepotInters['fichier_recu'].'"><i class="ri-eye-fill text-success"></i>Voir</a></td>
                                                        <td class="email">'.$getDepotInters['dat'].'</td>
                                                        <td>
                                                            <div class="">
                                                            <button class="btn btn-ghost-primary btn-icon btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                                                        <i class="bx bx-dots-horizontal-rounded fs-16 align-bottom"></i>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-end">
                                                                <li><a class="dropdown-item" onclick="return confirmsup()" href="?val2='.$getDepotInters['id'].'"><i class="ri-check-line text-primary"></i>Valider</a></li>
                                                                <li><a class="dropdown-item edit-folder-list"');?> onclick='renameFolder2("<?php echo $getDepotInters['id'];?>")' <?php echo ('href="#updatefolderModal2" data-bs-toggle="modal" role="button"><i class="ri-close-line text-danger"></i>Annuler</a></li>
                                                            </ul>
                                                            </div>
                                                        </td> 
                                                    </tr>
                                                ');
                                            }
                                            ?>
                                        </tbody>
                                    </table>
                                    <div class="noresult" style="display: none">
                                        <div class="text-center">
                                            <lord-icon src="https://cdn.lordicon.com/msoeawqm.json" trigger="loop" colors="primary:#121331,secondary:#08a88a" style="width:75px;height:75px"></lord-icon>
                                            <h5 class="mt-2">Aucun résultat</h5>
                                            <p class="text-muted mb-0"></p>
                                        </div>
                                    </div>
                                </div>

                                
                            </div>
                                    </div><!-- end card -->
                                </div>
                                                                    
                                        <!--end col-->
                                    </div>
                                        </div>
                                        
                                    </div>
                                    </div><!-- end card -->
                                </div>
                                                                    
                                        <!--end col-->
                                    </div>
                                    <!--end row-->
                                </div>
                       
                            </div>
                        </div>
                    </div>
                </div>
                <!-- container-fluid -->
            </div>
            <!-- End Page-content -->

            <!-- START UPDATE FOLDER  MODAL -->
                <div class="modal fade zoomIn" id="updatefolderModal" tabindex="-1" aria-labelledby="createFileModalLabel" aria-hidden="true">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content border-0">
                            <div class="modal-header p-3 bg-soft-success">
                                <h5 class="modal-title" id="createFileModalLabel">Entrez le motif de l'annulation</h5>
                                <button type="button" class="btn-close" data-bs-dismiss="modal" id="addFileBtn-close" aria-label="Close"></button>
                            </div>
                            <div class="modal-body">
                                <form  method="post">
                                    <div class="mb-4">
                                        <label for="foldername-input" class="form-label">Motif de l'annulation</label>
                                        <textarea  name="motif" class="ckeditor" cols="60" rows="10" ></textarea>
                                        <?php
                                             if(!empty($error_motif)){
                                                echo '<h6 style="color:red;">'.$error_motif.'</h6>';
                                             }
                                        ?>
                                        <input type="hidden" name="id" id="renamID" class="form-control" id="foldername-input" required>
                                    </div>
                                     
                                    <div class="hstack gap-2 justify-content-end">
                                        <button type="button" class="btn btn-ghost-success" data-bs-dismiss="modal"><i class="ri-close-line align-bottom"></i> Fermer</button>
                                        <button style="background:#1E2762;" type="submit" name="cancel" class="btn btn-dark" >Soumettre</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- END UPDATE FOLDER MODAL -->

                <!-- START UPDATE FOLDER  MODAL -->
                <div class="modal fade zoomIn" id="updatefolderModal2" tabindex="-1" aria-labelledby="createFileModalLabel" aria-hidden="true">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content border-0">
                            <div class="modal-header p-3 bg-soft-success">
                                <h5 class="modal-title" id="createFileModalLabel">Entrez le motif de l'annulation</h5>
                                <button type="button" class="btn-close" data-bs-dismiss="modal" id="addFileBtn-close" aria-label="Close"></button>
                            </div>
                            <div class="modal-body">
                                <form  method="post">
                                    <div class="mb-4">
                                        <label for="foldername-input" class="form-label">Motif de l'annulation</label>
                                        <textarea  name="motif2" class="ckeditor" cols="60" rows="10" ></textarea>
                                        <?php
                                             if(!empty($error_motif)){
                                                echo '<h6 style="color:red;">'.$error_motif.'</h6>';
                                             }
                                        ?>
                                        <input type="hidden" name="id2" id="renamID2" class="form-control" id="foldername-input" required>
                                    </div>
                                     
                                    <div class="hstack gap-2 justify-content-end">
                                        <button type="button" class="btn btn-ghost-success" data-bs-dismiss="modal"><i class="ri-close-line align-bottom"></i> Fermer</button>
                                        <button style="background:#1E2762;" type="submit" name="cancel2" class="btn btn-dark" >Soumettre</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- END UPDATE FOLDER MODAL -->

            <?php include('footer.php'); ?>
        </div>
        <!-- end main content-->

    </div>
    <!-- END layout-wrapper -->



    <!--start back-to-top-->
    <button onclick="topFunction()" class="btn btn-danger btn-icon" id="back-to-top">
        <i class="ri-arrow-up-line"></i>
    </button>
    <!--end back-to-top-->

    <!--preloader-->
    <div id="preloader">
        <div id="status">
            <div class="spinner-border text-primary avatar-sm" role="status">
                <span class="visually-hidden">Loading...</span>
            </div>
        </div>
    </div>

    

    <!-- JAVASCRIPT -->
    <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
    <script src="assets/libs/simplebar/simplebar.min.js"></script>
    <script src="assets/libs/node-waves/waves.min.js"></script>
    <script src="assets/libs/feather-icons/feather.min.js"></script>
    <script src="assets/js/pages/plugins/lord-icon-2.1.0.js"></script>
    <script src="assets/js/plugins.js"></script>
    <!-- prismjs plugin -->
    <script src="assets/libs/prismjs/prism.js"></script>
    <script src="assets/libs/list.js/list.min.js"></script>
    <script src="assets/libs/list.pagination.js/list.pagination.min.js"></script>

    <!-- listjs init -->
    <script src="assets/js/pages/listjs.init.js"></script>

    <!-- Sweet Alerts js -->
    <script src="assets/libs/sweetalert2/sweetalert2.min.js"></script>

    <!-- App js -->
    <script src="assets/js/app.js"></script>

    <script>
        function confirmsup(){
            return confirm("Etes-vous sur de vouloir effectuer cette action ? ")
        }
        function renameFolder(val1){
           document.getElementById('renamID').value=val1;      
        }

        function renameFolder2(val2){
           document.getElementById('renamID2').value=val2;      
        }
    </script>
    <script type="text/javascript">
        function rtn() {
            window.history.back();
        }
    </script>
</body>

</html>