<?php
session_start();
include './connection_sql.php';
if ($_SESSION["CURRENT_USER"] == "") { 
    exit('Please Logging Again..');
} 
if ($_SESSION['company'] == "") { 
    exit('Please Logging Again..');
} 
?>
<section class="content-header">
    <h1>
        Dashboard
        <small>Home Page</small>
    </h1>

</section>

<section class="content">

   


    <div class="row">
        
        <?php
     session_start();
     include './connection_sql.php';

     $sql = "select * from view_userpermission where username ='" . $_SESSION["CURRENT_USER"] . "' and grp='Accounts' and doc_view='1' and block='0'   order by grp";

     $grp = "";



     foreach ($conn->query($sql) as $row) {

      if ($grp != $row['grp']) {

        if ($grp!="") {
         echo "</div>";
       }
       


       echo "<div class='col-xs-12'>";
       echo "<h1>&nbsp;&nbsp;" . $row["grp"] . "</h1>";
       echo "<div class='col-lg-3 col-xs-12'>";
       echo "<div class='" . $row['color'] . "'>";
       echo "<div class='inner'>";
       if($row['id']=="1"){
        echo"<h3 style=\"display: inline-block;
        width: 100%;\"><a href='home.php?url=" . trim($row['name']) . "' style=\"color: white; font-size:20PX;font-family: Verdana,Sans-serif;\" class=\"small-box-footer\">" . trim($row['docname']) . "</a></h3></font>";
      }else{
        echo"<h3 style=\"display: inline-block;
        width: 100%;\"><a  href=\"../" . $row['name'] . "\"   style=\"color: white; font-size:20PX;font-family: Verdana,Sans-serif;\" class=\"small-box-footer\">" . trim($row['docname']) . "</a></h3></font>";
      }

      echo "</div>";
      echo "<div class='icon'>";
      echo "<i class='".trim($row['icon'])."'></i>";
      echo "</div>";

      if($row['id']=="1"){
       echo "<a href='home.php?url=" . $row["name"] . "' target='_blank' class='small-box-footer'><i class='fa fa-arrow-circle-right'></i></a>";
     }else{
      if($row['grp']=="Stores"){
        echo "<a  href=\"../stores/" . $row['name'] . ".php\" target='_blank' class='small-box-footer'><i class='fa fa-arrow-circle-right'></i></a>";
      }else{
        echo "<a  href=\"../" . $row['name'] . ".php\" target='_blank' class='small-box-footer'><i class='fa fa-arrow-circle-right'></i></a>";
      }
      
    }
    
    echo "</div>";
    echo "</div>";
    $grp = $row['grp'];
  }else{
   echo "<div class='col-lg-3 col-xs-12'>";
   echo "<div class='" . $row['color']. "'>";
   echo "<div class='inner'>";
   if($row['id']=="1"){
    echo"<h3 style=\"display: inline-block;
    width: 100%;\"><a href='home.php?url=" . trim($row['name']) . "' style=\"color: white; font-size:20PX;font-family: Verdana,Sans-serif;\" class=\"small-box-footer\">" . trim($row['docname']) . "</a></h3></font>";
  }else{
    echo"<h3 style=\"display: inline-block;
    width: 100%;\"><a  href=\"../" . $row['name'] . "\"   style=\"color: white; font-size:20PX;font-family: Verdana,Sans-serif;\" class=\"small-box-footer\">" . trim($row['docname']) . "</a></h3></font>";
  }
  echo "</div>";
  echo "<div class='icon'>";
  echo "<i class='".trim($row['icon'])."'></i>";
  echo "</div>";
  if($row['id']=="1"){
   echo "<a href='home.php?url=" . $row["name"] . "' target='_blank' class='small-box-footer'><i class='fa fa-arrow-circle-right'></i></a>";
 }else{
  if($row['grp']=="Stores"){
   echo "<a  href=\"../stores/" . $row['name'] . ".php\" target='_blank' class='small-box-footer'><i class='fa fa-arrow-circle-right'></i></a>";
 }else{
   echo "<a  href=\"../" . $row['name'] . ".php\" target='_blank' class='small-box-footer'><i class='fa fa-arrow-circle-right'></i></a>";
 }
 
}
echo "</div>";
echo "</div>";
}
 


}


echo "</ul>";

echo "</li>";

?>
         
        
     </div>    
    
    
 

</section>

