<?php ob_start(); ?>
<!DOCTYPE html>
<html lang="en"> 

<head>
<?php   require_once 'head_link.php'; ?>

</head>

<body>
 
<?php require_once 'header1.php'; ?> 

<?php

	if(isset($_GET['edit_id']) && !empty($_GET['edit_id']))
	{
		$id = $_GET['edit_id'];
		$stmt_edit = $DB_con->prepare('SELECT * FROM option_status_user WHERE id =:uid');
		$stmt_edit->execute(array(':uid'=>$id));
		$edit_row = $stmt_edit->fetch(PDO::FETCH_ASSOC);
		extract($edit_row);
	}
	else
	{
		header("Location: option-status");
	}
	 
	if(isset($_POST['btn_save_updates']))
	{
		
		
		$Task = $_POST['Task'];
		$Course = $_POST['Course'];
		$Teacher = $_POST['Teacher'];
		$Student = $_POST['Student'];
		$SMS = $_POST['SMS'];
		$Dues = $_POST['Dues'];
		$Bill = $_POST['Bill'];
		
		$HrAcc = $_POST['HrAcc'];
		$AdvSal = $_POST['AdvSal'];
		$Bank = $_POST['Bank'];
		$Expense = $_POST['Expense'];
		$Asset = $_POST['Asset'];
		$Report = $_POST['Report'];
		$Setting = $_POST['Setting'];
		
		
		// if no error occured, continue ....
		if(!isset($errMSG))
		{
			$stmt = $DB_con->prepare('UPDATE option_status_user 
									     SET  task=:Task,  
									          course=:Course,
									          teacher=:Teacher, 
									          student=:Student, 
									          sms=:SMS, 
									          dues=:Dues, 
									          bill=:Bill, 
									          hr_acc=:HrAcc ,
									          adv_salary=:AdvSal ,
									          bank=:Bank,
									          exp=:Expense, 
									          asset=:Asset, 
									          report=:Report, 
									          setting=:Setting 
										      
								       WHERE  id = :uid');
			
		
			
			
			
			$stmt->bindParam(':Task',$Task);
			$stmt->bindParam(':Course',$Course);
			
			$stmt->bindParam(':Teacher',$Teacher);
			$stmt->bindParam(':Student',$Student);
			$stmt->bindParam(':SMS',$SMS);
			$stmt->bindParam(':Dues',$Dues);
			
			$stmt->bindParam(':Bill',$Bill);
			$stmt->bindParam(':HrAcc',$HrAcc);
			$stmt->bindParam(':AdvSal',$AdvSal);
			$stmt->bindParam(':Bank',$Bank);
			$stmt->bindParam(':Expense',$Expense);
			$stmt->bindParam(':Asset',$Asset);
			$stmt->bindParam(':Report',$Report);
			$stmt->bindParam(':Setting',$Setting);
			
			$stmt->bindParam(':uid',$id);
			
			if($stmt->execute()){
				?>
                <script>
				alert(' Update Successful...');
				window.location.href='option-status';
				</script>
                <?php
			}
			else{
				$errMSG = "Sorry Data Could Not Updated !";
			}
		
		}
		
						
	}
	
?>

<?php  require_once 'sidebar.php'; ?>

  <main id="main" class="main">

   <div class="pagetitle bg-light rounded p-2">
      <h1><i class="bi bi-ui-checks"></i>  Access Controls Update  | <span> <a href="option-status"> <i class="bi bi-table"></i> </a> </span> </h1>
       
    </div> 

    <section class="section">
      <div class="row">
	  
        <div class="col-lg-6">

          <div class="card">
            <div class="card-body mt-2">

<form method="post" enctype="multipart/form-data" class="form-horizontal"> 
    <?php
	if(isset($errMSG)){
		?>
        <div class="alert alert-danger">
          <span class="glyphicon glyphicon-info-sign"></span> &nbsp; <?php echo $errMSG; ?>
        </div>
        <?php
	}
	?>
   
    
	<table class="table table-hover table-responsive">
	<div class="mt-2"></div>
	
	<tr class="<?php echo $Taska; ?>">
    	<td><label class="control-label"> <i class="bi bi-pencil-square"></i> Daily Task</label></td>
       	<td>
		<select  class="form-select" name="Task" /> 
		<option value="<?php echo $task; ?>"> <?php if ($task=="d-none"){echo "No"; } else {echo $task;} ?></option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $Coursa; ?>">
    	<td><label class="control-label"> <i class="bi bi-book"></i> Courses</label></td>
       	<td>
		<select  class="form-select" name="Course" /> 
		<option value="<?php echo $course; ?>"> <?php if ($course=="d-none"){echo "No"; } else {echo $course;} ?></option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $Teachera; ?>">
    	<td><label class="control-label"> Teachers</label></td>
       	<td>
		<select  class="form-select" name="Teacher" /> 
		<option value="<?php echo $teacher; ?>"> <?php if ($teacher=="d-none"){echo "No"; } else {echo $teacher;} ?></option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $Studenta; ?>">
    	<td><label class="control-label"> Students</label></td>
       	<td>
		<select  class="form-select" name="Student" /> 
		<option value="<?php echo $student; ?>"> <?php if ($student=="d-none"){echo "No"; } else {echo $student;} ?></option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $SMSa; ?>">
    	<td><label class="control-label"> SMS</label></td>
       	<td>
		<select  class="form-select" name="SMS" /> 
		<option value="<?php echo $sms; ?>"> <?php if ($sms=="d-none"){echo "No"; } else {echo $sms;} ?></option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $Duesa; ?>">
    	<td><label class="control-label"> Dues</label></td>
       	<td>
		<select  class="form-select" name="Dues" /> 
		<option value="<?php echo $dues; ?>"> <?php if ($dues=="d-none"){echo "No"; } else {echo $dues;} ?></option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $Billa; ?>">
    	<td><label class="control-label"> Bill / Invoice</label></td>
       	<td>
		<select  class="form-select" name="Bill" /> 
		<option value="<?php echo $bill; ?>"> <?php if ($bill=="d-none"){echo "No"; } else {echo $bill;} ?></option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	
	<tr class="<?php echo $Expa; ?>">
    	<td><label class="control-label">Expense Option</label></td>
       	<td>
		
		<select  class="form-select" name="Expense" /> 
		<option value="<?php echo $exp; ?>"> <?php if ($exp=="d-none"){echo "No"; } else {echo $exp;} ?> </option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	
	<tr class="<?php echo $Asseta; ?>">
    	<td><label class="control-label">Assets</label></td>
       	<td>
		
		<select  class="form-select" name="Asset" /> 
		<option value="<?php echo $asset; ?>"> <?php if ($asset=="d-none"){echo "No"; } else {echo $asset;} ?> </option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	  
	  <tr class="<?php echo $Bnka; ?>">
    	<td><label class="control-label">Banking </label></td>
       	<td>
		<select  class="form-select" name="Bank" /> 
		<option value="<?php echo $bank; ?>"> <?php if ($bank=="d-none"){echo "No"; } else {echo $bank;} ?> </option> 
		 <option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $HrAcca; ?>">
    	<td><label class="control-label">HR / ACC </label></td>
       	<td>
		<select  class="form-select" name="HrAcc" /> 
		 <option value="<?php echo $hr_acc; ?>"> <?php if ($hr_acc=="d-none"){echo "No"; } else {echo $hr_acc;} ?> </option> 
		 <option value="Yes">Yes</option> 
		 <option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $AdvSala; ?>">
    	<td><label class="control-label">Adv Salary </label></td>
       	<td>
		<select  class="form-select" name="AdvSal" /> 
		<option value="<?php echo $adv_salary; ?>"> <?php if ($adv_salary=="d-none"){echo "No"; } else {echo $adv_salary;} ?> </option> 
		<option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	 
	
	
	<tr class="<?php echo $Reporta; ?>">
    	<td><label class="control-label">Reports </label></td>
       	<td>
		<select  class="form-select" name="Report" /> 
		<option value="<?php echo $report; ?>"> <?php if ($report=="d-none"){echo "No"; } else {echo $report;} ?> </option> 
		 <option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
	<tr class="<?php echo $Settinga; ?>">
    	<td><label class="control-label">Settings </label></td>
       	<td>
		<select  class="form-select" name="Setting" /> 
		<option value="<?php echo $setting; ?>"> <?php if ($setting=="d-none"){echo "No"; } else {echo $setting;} ?> </option> 
		 <option value="Yes">Yes</option> 
		<option value="d-none">No</option>
		</select>
		</td>       
	</tr>
	
		 
    
    </table>
	
	<tr>
        <td colspan="2">
		<center> 
		<button type="submit" name="btn_save_updates" class="btn btn-primary">
       <span class="bi bi-check-circle"></span>  Update
        </button>
        
        <a class="btn btn-danger" href="option-status"> <span class="bi bi-arrow-left-circle"></span> Cancel </a>
        
		</center>
        </td>
    </tr>
	 
    
</form> 
</div>
          </div>

        </div>
      </div>
	  
	  <?php include('../includes/footer.php');?>
	  
    </section>

  </main>
  




  <?php  require_once 'footer1.php'; ?>