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

if(isset($_REQUEST['id'])){


  $data = array('status' => "1");

      $m->where("contact_id", $_REQUEST['id']);
    $result =  $m->update ('eduportal_contacts', $data);
   
     
      header("location:contacts.php?".session_id().session_id().session_id());


 }
   
       $m->where("branch_id", $_SESSION['branch']);
       $m->where("status",'0');
       $m->orderBy("contact_id","desc");

       $WorkAssignListings = $m->get("eduportal_contacts");
 
     ?>


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

.tdStyle{border-bottom:1px solid lightgray;}
.thStyle{background-color:#00AFEF;color:white;}

</style>
  </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="row" style="background-color: white;">
           
     <h3 style="margin-left: 15px;"> Add Contact </h3>      
  <section class="add_sub_agent" id="table_sub_agent">
  <div class="container">
   <div class="box_visa_form">
    <div class="" style="min-height:320px;">
      
<form class="form-style-7" id="add_student" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" onSubmit="return student_check();" enctype="multipart/form-data">


  <?php
    if($_GET['cont'] != Null){    
      ?>
  <input type="hidden" name="action"  value="UpdateContacts"> 
  <input type="hidden" name="contact_id"  value="<?php echo $_GET['cont'];?>">  
    <?php
    }else {?>
    
  <input type="hidden" name="action"  value="AddContact"> 
    <?php } ?>
  

        <div class="col-md-12">

          
           <div id="check_std_msg" style="display:none;" class="alert alert-warning alert-dismissible">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
                     <strong>Warning !</strong> Student Record is already exist !!!
            </div>

        </div>



     <div class="col-md-2" > 

    

     </div>

     
       <div class="col-md-8"> 

<?php 
  if ($_GET['cont']!= null)
  {
$query="select * from eduportal_contacts where contact_id=".$_GET['cont'];
        $contact = $m->query($query);
  }
?>

          

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



                          <div class="form-group" >
                              
                              <label>  Title :  </label>
                               
                               <input type="text" name="title" value="<?php echo $contact[0]['contact_title']; ?>" class="form-control"/>


                            </div>

                   </div>   
                   
    
                      <div class="col-md-12" >



                          <div class="form-group" >
                              
                              <label>  Contact : * </label>
                               
                                <input type="text" name="contact" value="<?php echo $contact[0]['contact_no']; ?>" class="form-control" required />


                            </div>

                   </div>   
             
             
             <div class="col-md-12" >

                        <div class="form-group" >
                            
                            <label>  Categories </label>
                              <select name="cat" class="form-control"  >
                                <option value="">Select</option>

                  <?php
                  $m->where("branch_id", $_SESSION['branch']);
                  $query="select * from eduportal_contacts_category";
                  $WorkAssignList = $m->query($query);
                  foreach($WorkAssignList as $WorkAssignListVal)
                  { ?>

                         <option <?php if($contact[0]['cat_id']==$WorkAssignListVal['cat_id']){echo "selected";} ?>  value="<?php echo $WorkAssignListVal['cat_id']; ?>"><?php echo $WorkAssignListVal['cat_name']; ?></option>


                  <?php } ?>

                            </select>
                          </div>

                   </div> 


                   <div class="col-md-12" >

                        <div class="form-group" >
                            
                            <label>  Send Message </label>
                              <select name="send_msg"  class="form-control" >
                     <option value="YES">YES</option>
                     <option Selected value="NO">NO</option>                     
                    </select>
                          </div>

                   </div> 
                   
                 
                                    

                      <div class="col-md-12" >



                          <div class="form-group" >
                              
                              <label>  Details :  </label>
                               
                                <textarea class="form-control message1 form-textarea" rows="7" name="detail" style="line-height: 1.5em; font-family: Arial, Helvetica, sans-serif; font-size: 14px;"><?php echo $contact[0]['contact_details'];?></textarea>


                            </div>

                   </div>   




  
                      <div class="col-md-12" >

                      <br>



                      <input type="submit" value=" Save Record " class="pull-right btn btn-primary" >

                   </div>                    


    
                   </div>  <!-- ending row-->


    </div>   <!--  ending 10 column-->



     <div class="col-md-2" > 

    

     </div>


    </form>






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


     </div>   <!--  main row -->


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

           
          </div>
        </div>

            </div>
          </div>
        </div>
        <!-- /page content -->
     
  <?php include('RootMe/js_linksscript.php');?>


   

<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
 <!-- jQuery -->
    <script src="js/ajax_functions.js"></script> 
  </body>
</html>
