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

       
 //echo $video[0]['video_url'];


$branch=$_SESSION['branch'];


$m->where ("branch_id", $_SESSION['branch']);
$classOrder = $m->get("edu_adm_section_detail");

if ($classOrder[0]['class_order']=='0') {
  
  $WorkAssignListings = $m->query("SELECT sec.*, cls.* FROM edu_adm_section_detail as sec LEFT JOIN edu_class_config as cls ON sec.class_id = cls.class_id where cls.class_id!='' and cls.branch_id='$branch' and sec.branch_id='$branch' ORDER BY sec.class_id asc");
  

} else {



$WorkAssignListings = $m->query("SELECT sec.*, cls.* FROM edu_adm_section_detail as sec LEFT JOIN edu_class_config as cls ON sec.class_id = cls.class_id where cls.class_id!='' and cls.branch_id='$branch' and sec.branch_id='$branch' order by CAST(sec.class_order as unsigned)  asc");
}

//print_r($WorkAssignListings);
?>

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Class Draging</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
  <style>
  #sortable { list-style-type: none; margin: 0; padding: 0; width: 50%; }
  #sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em;  }
  #sortable li span { position: absolute; margin-left: -1.3em; }

  .center {
  margin-left: auto;
  margin-right: auto;
}

  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#sortable" ).sortable();
    $( "#sortable" ).disableSelection();
  } );



  </script>

 </head>
<body>
 <br>
 <div class="center" style="width: 100%;text-align: center;">

            <a href="<?php echo $_SESSION['dashboard'];?>" target="_blank" class="btn btn-primary tabWidth">Dashboard</a>
            <a href="students_reports.php" target="_blank" class="btn btn-primary tabWidth">Student Reports Dashboard</a>
            <!-- <a href="class_subjects.php" target="_blank" class="btn btn-primary tabWidth"> Classwise Students Reports</a> -->
            
           
            
          </div>
 <h2 style="text-align: center;"> Drag Class-Section for order list</h2>


<form action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" enctype="multipart/form-data" class="form-horizontal form-label-left" >

  <input type="hidden" name="action" value="ClassOrderList" />

  <!-- <input type="hidden" name="class_id" value="<?php echo $_REQUEST['class_id'];?>">

  <input type="hidden" name="section_id" value="<?php echo $_REQUEST['section_id'];?>"> -->
 
<ul id="sortable" style="margin-left: 25%;">

  <?php 

  $count=1;

  foreach($WorkAssignListings as $WorkAssignListVal) {                       
   ?>
  
  <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><?php
   echo $WorkAssignListVal['Class_Name']."-".$WorkAssignListVal['section_name'];?>
  <input style="float:right;" type="hidden" name="classOrder<?php echo $WorkAssignListVal['class_id'];?>[]" value="">

  <input type="hidden" name="class_id[]" value="<?php echo $WorkAssignListVal['section_id'];?>">
</li>

  <?php } ?>
  
</ul>
<br>

<button id="send" style="margin-left: 25%;" type="submit" class="btn btn-primary" >Save Record</button>

</form>
 
 
 
</body>
</html>