<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>

<?php

$m->where("user_id", $_SESSION['user_id']);
$m->where ("branch_id", $_SESSION['branch']);
$m->where("page_id", $_REQUEST['page']);
$access = $m->get("users_privilege_detail");


 
$sql = " select * from  eduportal_acadmic_heads where branch_id=".$_SESSION['branch']." order by heads_id desc";
//echo $sql;

 $WorkAssignListings = $m->query($sql);

if(isset($_GET['id'])){
  
  $sql = "select * from  eduportal_acadmic_heads where heads_id=".$_GET['id'];
  $terms = $m->query($sql);

}
 
     ?>


<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>Academic Heads | EduPortal</title>
    <?php include('RootMe/css_links.php');?>
   
  </head>
  




  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
     
            <?php include('RootMe/sidebar.php');?>

              <?php include('RootMe/header.php');?>
     
        <!-- page content -->
          <div class="right_col" role="main">
          <div class="" style="background-color: white;">

        <a href="<?php echo $_SESSION['dashboard'];?>">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
              
         <a href="academic_settings.php">Academic Settings </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
              
          Academic Heads


           
<section class="add_sub_agent" id="table_sub_agent">
  <div class="container">


    <br>
          
          <?php  if(isset($_SESSION['Upsuccess'])){?>


            <div class="alert alert-success" id="msg">
             <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
              <strong>Success!</strong> One record is updated successfully...
            </div>


          <?php  unset($_SESSION['Upsuccess']); }?>

  

<div style="float:left;" class="col-md-6">

    

    <table  class="table table-striped table-bordered" style="width:100%;font-size:12px;">
          
          <thead>
            <tr>
                <th width="5%"   style="text-align:center;">S.No</th>
                <th width="30%"> Heads Name </th>                
                <th width="10%">Action </th>

            </tr>
        </thead>
        <tbody>


   
     
     <?php 

     $count=1;

      foreach($WorkAssignListings as $WorkAssignListVal)
      { 

              
      ?>

        <tr>
              <td  style="text-align:center;">
                 <?php echo $count;  $count++;?>

               </td>

              <td> <?php echo $WorkAssignListVal['heads_title'];?> </td>             
             
              <td>

              

                <a style="padding: 0px 5px; font-size:14px;"  href="add_acdamic_heads.php?<?php echo session_id().session_id().session_id().session_id().session_id();?>&id=<?php echo $WorkAssignListVal['heads_id'];?>" style="cursor:pointer;"  class="btn btn-success">
                  <i class="fa fa-pencil" aria-hidden="true"></i>
                </a>
              

                <a href="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php?heads=<?php echo $WorkAssignListVal['heads_id'];?>&action=DeleteAcadmicHeads" style="padding: 0px 5px; font-size:14px;" onClick="return confirm('Are you sure you want to delete this record');"  class="btn btn-danger"><i class="fa fa-remove"></i> </a>

            
    
                </td>




              </tr>





              <?php
      } ?>



           
            
           
        </tbody>
        
    </table>


</div>




<div style="float:left;" class="col-md-6">


  <h3> Add Academic Heads </h3>

 
  <span style="color: red;"> Please use short words </span>
  <br/>

  <table style="width:100%">
          
         <tr>
          <td width="100%" style="padding-left:2%; padding-right:2%;" >

<?php if(!isset($_GET['id'])){?>

        <form class="form-style-7" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" enctype="multipart/form-data">
              
              <input type="hidden" name="action" value="AddAcadmicHeads">



              <div class="form-group">               
                   
                
                  <label for=""> Heads Title </label>
                  <input type="text" class="inputfield" name="head_name" placeholder="Home Work ..."    autocomplete="off"  maxlength="20" autofocus="autofocus" required>
                   
                  <br><br>
                  
                  <div class="clearfix"></div>
              
                  <input type="submit" value="Save Record" class="btn btn-primary" >
              
              </div>

        </form>

<?php } else {?>


        <form class="form-style-7" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" enctype="multipart/form-data">
              
              <input type="hidden" name="action" value="UpdateAcadmicHeads">

              <input type="hidden" name="id" value="<?php echo $_REQUEST['id'];?>" />





              <div class="form-group">



                  <label for=""> Update Heads </label>
                  <input type="text" class="inputfield"  name="heads_title"  value="<?php echo $terms[0]['heads_title']; ?>" required maxlength="100" autofocus="autofocus" required>
                   
                  <br><br>
                  
                  <div class="clearfix"></div>
              
                  <input type="submit" value="Update Record" class="btn btn-primary" >
              
              </div>

        </form>



<?php }?>





                </td>
                
          </tr>
        
  </table>


</div>



    <br><br>


  </div>
  <div class="clearfix"></div>
</section>            
    

           
          </div>
        </div>

            </div>
          </div>
        </div>
        <!-- /page content -->
  

    
  <?php include('RootMe/js_linksscript.php');?>
  </body>
</html>
