<?php

 include("../../../dbconnection/dbconnection.php");$name='';if(isset($_SESSION["id"])){  $user=strtolower($_SESSION['type']); if($user==="admin"){$id=$_SESSION['id'];include("../../../steam_functions/steam_functions.php");$team=(staff_team($connect));$loggedin=staff_loggedin($id,$connect);$students=few_students($connect);}else if($user=="staff"){header("location:../../../pages/staff_login.php");}else{ header("location:../../../pages/staff_login.php"); }}else{header("location:.../../../pages/staff_login.php");}

include("../../header.php");

if(isset($_SESSION["id"])){  
$user=strtolower($_SESSION['type']);
 if($user==="admin"){$id=$_SESSION['id'];
 $loggedin=staff_loggedin($id,$connect);}else if($user=="staff"){header("location:../../../staff_login.php");
 	
 }else{ header("location:../../../staff_login.php"); }
 
 }else{header("location:../../../staff_login.php");}

 
 $school_det=school_details($connect);
foreach($loggedin as $row){
	
	$staff_name=ucwords(strtolower($row["fname"]." ".$row["other_names"]));
	$gender=$row["gender"];
	$rank=$row["rank"];
	$level=$row["edlevel"];
	$course=$row["course"];
	$profile=$row["photo"];
	if(($profile==="") and ($gender==="male")){
		$profile='../../../images/img_avatar3.png';
	}
	if(($profile==="") and ($gender==="female")){
		$profile='../../../images/img_avatar5.png';
	}
}
?>
 <div class="content-wrapper"  style='min-height:auto'>
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">User profile</li>
      </ol>
    </section><br>

    <!-- Main content -->
    <section class="content">

      <div class="row">
        <div class="col-md-4">


          <!-- Widget: user widget style 1 -->
          <div class="box box-widget widget-user">
            <!-- Add the bg color to the header using any of the bg-* classes -->
            <div class="widget-user-header bg-aqua-active">
              <h3 class="widget-user-username"><?php echo $staff_name;?></h3>
              <h5 class="widget-user-desc"><?php echo $rank;?></h5>
            </div>
            <div class="widget-user-image">
              <img class="img-circle" src="<?php echo $profile;?>" alt="User Avatar">
            </div>
			
            <div class="box-header with-border">
              <h3 class="box-title">About Me</h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <strong><i class="fa fa-book margin-r-5"></i> Education</strong>

              <p class="text-muted">
               <?php echo $level." in ".$course;?>
              </p>

              <hr>

              <strong><i class="fa fa-map-marker margin-r-5"></i> Location</strong>

              <p class="text-muted">Malibu, California</p>

              <hr>

              <strong><i class="fa fa-pencil margin-r-5"></i> Skills</strong>

              <p>
                <span class="label label-danger">UI Design</span>
                <span class="label label-success">Coding</span>
                <span class="label label-info">Javascript</span>
                <span class="label label-warning">PHP</span>
                <span class="label label-primary">Node.js</span>
              </p>

              <hr>

              <strong><i class="fa fa-file-text-o margin-r-5"></i> Favorite Quote</strong>

              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam fermentum enim neque.</p>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
        

        <div class="col-md-8">
          <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
			
              
              <li  class="active" ><a href="#form-contacts" data-toggle="tab">Contacts</a></li>
			  	   <li ><a href="#form-details" data-toggle="tab">Information</a></li>
			    <li><a href="#form-settings" data-toggle="tab">Settings</a></li>
           
		
            </ul>
            <div class="tab-content">
					<?php
									
										foreach($school_det as $row){
											$sch_id=$row["id"];
											$sch=$row["name"];
											$mission=$row["mission"];
											$vision=$row["vision"];
											$about=$row["about"];
											$tel=$row["tel"];
											$whatsapp=$row["whatsapp"];
											$email=$row["email"];
											$fb=$row["fb"];
											$twitter=$row["twitter"];
											$ig=$row["ig"];
											$ln=$row["ln"];
											$youtube=$row["youtube"];
										}
			
					?>
			
			
                <form class="tab-pane form-horizontal " id="form-details" method='POST'>
                 
                  <div class="form-group">
                       <div  class="col-sm-12"><label  class="control-label">Skills</label></div>

                    <div class="col-sm-12">
                      <textarea class="form-control" name="mission" placeholder="Mission of the school" style='min-height:80px'  required><?php echo $mission; ?></textarea>
                    </div>
                  </div>                  
				  
				  <div class="form-group">
                   <div  class="col-sm-12"><label  class="control-label">Favorite Quotes</label></div>

                    <div class="col-sm-12">
                      <textarea class="form-control" name="vision" placeholder="Vision of the school" style='min-height:80px'  required><?php echo $vision; ?></textarea>
                    </div>
                  </div>				  
				  
				  <div class="form-group">
                    <div  class="col-sm-12"><label  class="control-label">About Me</label></div>

                    <div class="col-sm-12">
                      <textarea class="form-control" name="about" placeholder="About the school" style='min-height:150px' required><?php echo $about; ?></textarea>
                    </div>
                  </div>
				  
                  <div class="form-group">
                    <div class="col-sm-offset-0 col-sm-12">
                      <input type='hidden' name='sch_id' value="<?php echo $sch_id; ?>">
                      <input type='hidden' name='btn_action' value="Add-Details">
                      <button type="submit" class="btn btn-danger">Submit</button>
                    </div>
                  </div>
				  
                </form>
              <!-- /.tab-pane -->  
			  
				<form class="tab-pane form-horizontal " id="form-settings" method='post'>
				
				
				
						<div  class="col-sm-12 "><h3 class="">Change Password</h3></div>
				
					<div class="form-group col-sm-12">
						<div  class="col-sm-12"><label for="tel" class="" style='' >Old Password</label></div>

						<div class="input-group col-sm-12">
							<div class="input-group-addon">	<i class="fa fa-lock"></i></div>
							 <input type="password" class="form-control" name="opass" value='' placeholder="old Password"  required>
						</div>
									 
					<!-- /.input group -->
					  </div>
					  
					<div class="form-group col-sm-12">
						<div  class="col-sm-12"><label  class=" " style='' >New Password</label></div>

						<div class="input-group col-sm-12">
							<div class="input-group-addon">	<i class="fa fa-key " ></i></div>
							   <input type="password" class="form-control" name="pass" value='' placeholder="New Password"  required>
						</div>
									 
					<!-- /.input group -->
					  </div>
					  
					  
					<div class="form-group col-sm-12">
						<div  class="col-sm-12"><label  class=" " style='' >Confirm Password</label></div>

						<div class="input-group col-sm-12">
							<div class="input-group-addon">	<i class="fa fa-key " ></i></div>
							  <input type="password" class="form-control" name="cpass" value='' placeholder="Confirm Password"  required>
						</div>
									 
					<!-- /.input group -->
					  </div>
					  
					  
					  <div class="form-group">
                    <div class="col-sm-offset-1 col-sm-11">
					
                      <input type='hidden' name='sch_id' value="<?php echo $sch_id; ?>">
                      <input type='hidden' name='btn_action' value="Add-Contacts">
                      <button type="submit" class="btn btn-primary">Change</button>
                      <button type="reset" class="btn btn-danger col-sm-offset-8 pull-right ">Discard</button>
                    </div>
                  </div>
		</form>
			  
			  
                <form class="tab-pane form-horizontal active" id="form-contacts" method='post'>
				
                  <div class="form-group col-sm-12">
                    <label for="tel" class=" control-label col-sm-2" style='' >Tel</label>

                    <div class="input-group col-sm-10">
						<div class="input-group-addon">	<i class="fa fa-phone"></i></div>
						  <input type="number" class="form-control" name="tel" value='<?php echo $tel; ?>' placeholder="Phone  Number" disabled required>
                    </div>
					             
                <!-- /.input group -->
                  </div>
				  
				  		<div class="form-group col-sm-12">
                    <label for="email" class=" control-label col-sm-2" style='' >Email</label>

                    <div class="input-group col-sm-10">
						<div class="input-group-addon">	<i class="fa fa-envelope-o " ></i></div>
						  <input type="email" class="form-control" name="email" value='<?php echo $email; ?>' placeholder="Email" disabled required>
                    </div>
					             
                <!-- /.input group -->
                  </div>
				  		
                  <div class="form-group col-sm-12">
                    <label for="whatsapp" class=" control-label col-sm-2" style='' >WhatsApp</label>

                    <div class="input-group col-sm-10">
						<div class="input-group-addon">	<i class="fa fa-whatsapp"></i></div>
						  <input type="number" class="form-control" name="whatsapp"value='<?php echo $whatsapp; ?>'  placeholder="WhatsApp Number" required>
                    </div>
					             
                <!-- /.input group -->
                  </div>
				  			  				
                  
				  				  			  				
                  <div class="form-group col-sm-12">
                    <label for="fb" class=" control-label col-sm-2" style='' >Facebook</label>

                    <div class="input-group col-sm-10">
						<div class="input-group-addon">	<i class="fa fa-facebook"></i></div>
						  <input type="text" class="form-control" name="fb" value='<?php echo $fb; ?>' placeholder="Facebook Account">
                    </div>
					             
                <!-- /.input group -->
                  </div>
				  
				  				  				  			  				
                  <div class="form-group col-sm-12">
                    <label for="twitter" class=" control-label col-sm-2" style='' >Twitter</label>

                    <div class="input-group col-sm-10">
						<div class="input-group-addon">	<i class="fa fa-twitter"></i></div>
						  <input type="email" class="form-control" name="twitter" value='<?php echo $twitter; ?>' placeholder="Twitter Account">
                    </div>
					             
                <!-- /.input group -->
                  </div>
				  
				                      
				<div class="form-group col-sm-12">
                    <label for="ig" class=" control-label col-sm-2" style='' >Instagram</label>

                    <div class="input-group col-sm-10">
						<div class="input-group-addon">	<i class="fa fa-instagram"></i></div>
						  <input type="text" class="form-control" name="ig" value='<?php echo $ig; ?>' placeholder="Instagram Account">
                    </div>
					             
                <!-- /.input group -->
                  </div>
				                       
				<div class="form-group col-sm-12">
                    <label for="ln" class=" control-label col-sm-2" style='' >LinkedIn</label>

                    <div class="input-group col-sm-10">
						<div class="input-group-addon">	<i class="fa fa-linkedin"></i></div>
						  <input type="text" class="form-control" name="ln" value='<?php echo $ln; ?>' placeholder="LinkedIn Account">
                    </div>
					             
                <!-- /.input group -->
                  </div>
				 
				  		                  
				<div class="form-group col-sm-12">
                    <label for="youtube" class=" control-label col-sm-2" style='' >Youtube</label>

                    <div class="input-group col-sm-10">
						<div class="input-group-addon">	<i class="fa fa-youtube "></i></div>
						  <input type="text" class="form-control" name="youtube" value='<?php echo $youtube; ?>' placeholder="Youtube Account">
                    </div>
					             
                <!-- /.input group -->
                  </div>
				 
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
					
                      <input type='hidden' name='sch_id' value="<?php echo $sch_id; ?>">
                      <input type='hidden' name='btn_action' value="Add-Contacts">
                      <button type="submit" class="btn btn-danger">Submit</button>
                    </div>
                  </div>
                </form>
              <!-- /.tab-pane -->
			
              </div>
              <!-- /.tab-pane -->
         

            </div>
            <!-- /.tab-content -->
          </div>
          <!-- /.nav-tabs-custom -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->

    </section>
    <!-- /.content -->
	 </div>
	
<!-- jQuery 2.2.3 -->
<script src="../../plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="../../bootstrap/js/bootstrap.min.js"></script>
	<!-- DataTables -->
<script src="../../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../../plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="../../plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="../../plugins/fastclick/fastclick.js"></script>

<!-- Bootstrap WYSIHTML5 -->
<script src="../../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>

<script src="../../plugins/select2/select2.full.min.js"></script>


	
 <script type="text/javascript">
 
     $(document).ready(function(){
		 	//Initialize Select2 Elements
    $(".select2").select2();

	$("#staff-members").DataTable();
	
	
	
    $('#id').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false
    });
	
	$('#add_button').click(function(){
			$('#settingsModal').modal('show');
			$('#form-staff_reg')[0].reset();
			$('#btn_action').val('Add');
			// $('#span_product_details').html('');
			// add_product_row();
		});

		
		$(document).on('submit', '#form-details', function(event){
			event.preventDefault();
			// $('#action').attr('disabled', 'disabled');
			// alert();
			var form_data = $(this).serialize();
			$.ajax({
				url:"pages/settings/settings_action.php",
				method:"POST",
				data:form_data,
				success:function(data){
					alert(data);
				}
			});
		});
		
		$(document).on('submit', '#form-contacts', function(event){
			event.preventDefault();
			// $('#action').attr('disabled', 'disabled');
			// alert();
			var form_data = $(this).serialize();
			alert(form_data);
			$.ajax({
				url:"pages/settings/settings_action.php",
				method:"POST",
				data:form_data,
				success:function(data){
					alert(data);
				}
			});
		});	
			$(document).on('submit', '#form-staff_reg', function(event){
			event.preventDefault();
			// $('#action').attr('disabled', 'disabled');
			// alert();
			var form_data = $(this).serialize();
			$.ajax({
				url:"pages/users/staff_action.php",
				method:"POST",
				data:form_data,
				success:function(data){
					alert(data);
				}
			});
		});	
		
	
	})
</script>
 <?php include("../../footer.php");?>