<script src="js/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

<!-- Optional theme -->

<style> .alert-successs{background-color: #1eaf59;color: white;display: none}
            .required{color: #FF0000;}
            .error-message{font-size: 12px;color: red;display: none;}
            .col-md-6{margin: 12px;}
            th {background: #ffa50075; font-size: 20px;}
            td {font-family:SutonnyMJ; font-size: 20px;}
            #class {font-family:SutonnyMJ; font-size: 20px; font-weight: bold;}
    </style>
	

 
            <!-- /.box-header -->
            <div class="box-body no-padding">
              <table class="table table-striped" style="font-family: Kalpurush;">
                <tbody><tr>               
                  <th style="text-align: center;">ক্রমিক</th>
                  <th style="text-align: center;">আইডি</th>
                  <th style="text-align: center;">সিরিয়াল নং</th>
                  <th style="text-align: center;">ছবি</th>
                  
                  <th style="text-align: center;">নাম</th>
                  <th style="text-align: center;">পদবী</th>
                  <th style="text-align: center;">মোবাইল</th>
                  <th style="text-align: center;">আপডেট</th>
                  <th style="text-align: center;">অ্যাকশন</th>
                </tr>


                <?php
            if (isset($_POST["income_action_d"]) && $_POST["income_action_d"] !="" && isset($_POST["teacher_id"]) && $_POST["teacher_id"] !="" ) {
              $result="UPDATE `teacher` SET status=0 WHERE teacher_id='".$_POST["teacher_id"]."'";
              if (mysqli_query($con,$result)===TRUE) {
                echo '<div class="alert alert-danger " role="alert">Success Inactive</div>
                 <meta http-equiv="refresh" content="1">';
              }
            }
            if (isset($_POST["income_action_a"]) && $_POST["income_action_a"] !="" && isset($_POST["teacher_id"]) && $_POST["teacher_id"] !="" ) {
              $result="UPDATE `teacher` SET status=1 WHERE teacher_id='".$_POST["teacher_id"]."'";
              if (mysqli_query($con,$result)===TRUE) {
                echo '<div class="alert alert-success" role="alert">Success Active</div>
                 <meta http-equiv="refresh" content="1">';
              }
            }
            ?>

   <?php              
      $i=1;
      //শিক্ষক বিভাগ
  $staff_division=mysqli_query($con,"SELECT distinct staff_division.staff_division_id, staff_division.staff_division_name FROM `staff_division`
  INNER JOIN teacher ON staff_division.staff_division_id=teacher.staff_division ");   
  while($row_class = mysqli_fetch_assoc($staff_division)){           
  echo "<tr style='background-color:#85f0a675; text-align: center;'><td colspan='9' id='class'>$row_class[staff_division_name]</td></tr>";   
             
//শিক্ষক
	$result=mysqli_query($con,"SELECT teacher.teacher_id,teacher.teacher_sr,teacher.name,teacher.father,teacher.title, teacher.teacher_img, teacher.mobile,teacher.status FROM `teacher` 
  INNER JOIN staff_division ON staff_division.staff_division_id=teacher.staff_division     
  where staff_division='$row_class[staff_division_id]' ORDER BY status desc");
	while($row = mysqli_fetch_assoc($result)){?>	

			<tr>
      <td style="text-align: center;"><?= $i++;?></td>
				<td style="text-align: center;"><?= $row['teacher_id'];?></td>
				<td style="text-align: center;"><?= $row['teacher_sr'];?></td>
        <td><?php 
                  if ($row['teacher_img']=="") {
                  	echo '<img src="teacher_img/gr man.png" class="img-rounded img-thumbnail img-responsive" style="height: 60px;" >';
                  }else{
                  	echo '<img src="teacher_img/'.$row['teacher_img'].'" class="img-rounded img-thumbnail img-responsive" style="    height: 60px;" >';
                  }
                  
                  ?></td>	
				<td><?= $row['name'];?></td>
				<td><?= $row['title'];?></td>
				<td><?= $row['mobile'];?></td>
							
				<td style="text-align: center;">
				<a href="Divition_edit.php?exam_id=<?= $row['name']?>" class="btn btn-success btn-sm"><i class="fa fa-fw fa-edit"></i> সম্পাদনা</a>
				
								 <td style="text-align: center;">
              
				  <?php 
					if($row['status']== 1){
					?>
          <form action="" method="post" accept-charset="utf-8">
            <input type="hidden" name="income_action_d" value="1">
            <input type="hidden" name="teacher_id" value="<?=$row['teacher_id'];?>">
           
          <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-fw fa-check"></i>আকটিভ</button>
          </form>
					<?php 
					}else{
						?>
          <form action="" method="post" accept-charset="utf-8">
            <input type="hidden" name="income_action_a" value="1">
            <input type="hidden" name="teacher_id" value="<?=$row['teacher_id'];?>">
           
          
						<button class="btn btn-danger btn-sm"><i class="fa fa-fw fa-close"></i> ইনএকটিভ</button>
          </form>
					<?php
					}}  }
				  ?>
				  </td> 				  	
          </tr>
				   	
              </tbody></table>

            </div>
            <!-- /.box-body -->
          </div>
