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


<?php

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

       $m->where("cat_id", $_REQUEST['cat_id']);
       $m->where("branch_id", $_SESSION['branch']);
       $m->where("status",'0');
       $m->orderBy("contact_id","desc");
       $WorkAssignListings = $m->get("eduportal_contacts");

      } else {

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

     }



     $branchID=$_SESSION['branch'];
  $sql2 = "SELECT MAX(CAST(inquiry_number AS UNSIGNED)) AS inquiry_number FROM eduportal_student_inquiry_form WHERE branch_id='$branchID'";

  //print_r($sql2);
      $evt1 =$m->query($sql2);

      $prev1= $evt1[0]['inquiry_number'];

      //$prev11=str_pad($prev11, 5, "0", STR_PAD_LEFT);
         
      $IquiryNo=$prev1+1;
     ?>


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

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

</style>
  </head>

<script type="text/javascript">

function HideDate(str){

  //alert(str);
  
  if(str==7 ){
    
   // document.getElementById("fee").style.display="block";
    document.getElementById("otherRemarks").style.display="block";
   
  }
  else {
    
   // document.getElementById("fee").style.display="none";
    document.getElementById("otherRemarks").style.display="none";
   
   
  }
}


</script>


  <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">
            <br>
            <a href="<?php echo $_SESSION['dashboard'];?>">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
                   
          <a href="student_inquiry.php">View Student Inquiry List  </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
               Add Inquiry Form    
                     
                            <br><br><br>
                            
          <div class="row" style="background-color: white;">
     

   
  <section class="add_sub_agent" id="table_sub_agent">
  <div class="container">

 <div class="" style="margin-top:10px;">
    
      <div class="clearfix"></div>
    </div>
    <br>
        
          
<div>
<a href="print_blank_student_inquiry_form.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>" target="_blank" style="float: left;margin-top: -50px;" class=" btn btn-primary" > Print Blank Student Inquiry Form  </a>

<a href="print_blank_student_inquiry_sheet.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>" target="_blank" style="float: right; margin-top: -50px;" class=" btn btn-primary" > Print Blank Student Inquiry Sheet  </a>
</div>

<h3>Student Inquiry Information</h3>



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

<?php 
  if(isset($_REQUEST['formId'])) {

    // $m->where("status", '0');
     $m->where("iquiryFormID", $_REQUEST['formId']);
     $m->where("branch_id", $_SESSION['branch']);
     $InquriyForm = $m->get("eduportal_student_inquiry_form");
?>

  <input type="hidden" name="action"  value="edit_inquiry_form">

  <input type="hidden" name="formId"  value="<?php echo $_REQUEST['formId']; ?>" />



<?php } else  { ?>

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

<?php } ?>

<?php

$date;
$DOB;
if(isset($_REQUEST['formId'])){

  $date= $InquriyForm[0]['inquiry_date'];
  $Testdate= $InquriyForm[0]['test_date'];
  $DOB= $InquriyForm[0]['DOB'];
  } else {
    $date= date("Y-m-d");
    $Testdate= date("Y-m-d");
    $DOB= date("Y-m-d");
  }

 ?>

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


  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">

                    <label class="required"> Inquiry Number</label>
                    <input name="inquiry_number" readonly value="<?php echo $IquiryNo;?>" type="Text" class="form-control"  >
                       
                </div>
  </div>


  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">

                    <label class="required"> Student Name</label>
                    <input name="student_name" required value="<?php echo $InquriyForm[0]['student_name'];?>" type="Text" class="form-control"  >
                       
                </div>
  </div>

  <div class="col-md-4 col-xs-12" style="padding: 8px;">
    <div class="form-group ">

        <label class="required">Father Name</label>
        <input name="father_name" required value="<?php echo $InquriyForm[0]['father_name'];?>" type="Text" class="form-control"  >
           
    </div>
  </div>

  <div class="col-md-4 col-xs-12" style="padding: 8px;">
   <div class="form-group ">

        <label class="required"> Gender</label>
        <select name="gender" required  class="form-control" >
         <option <?php if($InquriyForm[0]['prospectus']=="male"){echo "Selected";} ?> value="male">Male</option>
         <option <?php if($InquriyForm[0]['prospectus']=="female"){echo "Selected";} ?> value="female">Female</option>
         <option <?php if($InquriyForm[0]['prospectus']=="shemale"){echo "Selected";} ?> value="shemale">Shemale</option>                     
        </select>
           
    </div>
</div>

<div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Father Cell No</label>
                  <input name="cell" required  value="<?php echo $InquriyForm[0]['cell'];?>" type="text" class="form-control"  >
            
                   
                  
  </div>
</div>

<div class="col-md-4 col-xs-12" style="padding: 8px;">
  <div class="form-group ">
      <label class="required">Student Cell No</label>
      <input name="std_cell" required  value="<?php echo $InquriyForm[0]['std_cell'];?>" type="text" class="form-control">                  
  </div>
</div>





  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Previous School Name</label>

            
                    <select name="school_id" class="form-control"  >
                     <option>Select</option> 
                    <?php
                    $m->where("branch_id", $_SESSION['branch']);
                    $WorkAssignList = $m->get("eduportal_add_school");
                    foreach($WorkAssignList as $WorkAssignListVal)
                    { ?>

                       <option <?php if($InquriyForm[0]['school_id']==$WorkAssignListVal['school_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['school_id']; ?>"><?php echo $WorkAssignListVal['school_name']; ?></option>


                            <?php
                    } ?>

                    </select>

                  
  </div>
</div>


 




  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Applying For Class</label>

            
                    <select name="class_id" class="form-control" required onChange="getsec(this.value)" >
                     <option value="All">All</option> 
                    <?php
                    $m->where("branch_id", $_SESSION['branch']);
                    $WorkAssignList = $m->get("edu_class_config");
                    foreach($WorkAssignList as $WorkAssignListVal)
                    { ?>

                       <option <?php if($InquriyForm[0]['class_id']==$WorkAssignListVal['class_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['class_id']; ?>"><?php echo $WorkAssignListVal['Class_Name']; ?></option>


                            <?php
                    } ?>

                    </select>

                  
  </div>
</div>

  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label >Applying For Section</label>
                    <select name="section" id="txt_section" class="form-control" onChange="getSubjects(this.value)">
                      
                   <?php
                              if($_REQUEST['section']!='')
                              { 

                              $m->where("class_id", $_REQUEST['class_id']);    

                              $secondLevel = $m->get("edu_adm_section_detail");
                              
                              foreach($secondLevel as $secondLevel_val)
                              {
                              
                               ?>
                                <option <?php if($InquriyForm[0]['section_id']==$secondLevel_val['section_id']){echo "selected";} ?> value="<?php echo $secondLevel_val['section_id']; ?>"><?php echo trim(utf8_encode_all($secondLevel_val['section_name'])); ?></option>

                              <?php }   ?>
                                
                          <?php } ?>

                    </select>

                  
  </div>
</div>
 


  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Admission Confirmation</label>

            
                    <select name="student_confirmed"  class="form-control" >
                     <option <?php if($InquriyForm[0]['student_confirmed']=="YES"){echo "Selected";} ?> value="YES">YES</option>
                     <option <?php if($InquriyForm[0]['student_confirmed']=="NO"){echo "Selected";} ?> value="NO">NO</option>                     
                    </select>                  
  </div>
</div>

 <div class="col-md-4 col-xs-12" style="padding: 8px;">
    <div class="form-group ">
      <label class="required">Registration Confirmation</label>


        <select name="registration_confirmation"  class="form-control" >
         <option <?php if($InquriyForm[0]['registration_confirmation']=="YES"){echo "Selected";} ?> value="YES">YES</option>
         <option <?php if($InquriyForm[0]['registration_confirmation']=="NO"){echo "Selected";} ?> value="NO">NO</option>                     
        </select>                  
  </div>
</div>

 <!--  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Student Visited </label>

            
                    <select name="student_visited"  class="form-control" >
                     <option <?php if($InquriyForm[0]['student_visited']=="YES"){echo "Selected";} ?> value="YES">YES</option>
                     <option <?php if($InquriyForm[0]['student_visited']=="NO"){echo "Selected";} ?> value="NO">NO</option>                     
                    </select>
                  
  </div>
</div>   -->

 <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Prospectus</label>

            
                    <select name="prospectus"  class="form-control" >
                     <option <?php if($InquriyForm[0]['prospectus']=="YES"){echo "Selected";} ?> value="YES">YES</option>
                     <option <?php if($InquriyForm[0]['prospectus']=="NO"){echo "Selected";} ?> value="NO">NO</option>                     
                    </select>

                  
  </div>
</div>





 <div class="col-md-4 col-xs-12" style="padding: 8px;">
    <div class="form-group ">

    <label class="required">Visiting Date</label>
    <input name="inquiry_date"   value="<?php echo $date;?>" type="date" class="form-control"  >
       
</div>
</div>



<div class="col-md-4 col-xs-12" style="padding: 8px;">
   <div class="form-group ">

        <label class="required"> Add Locality</label>
        <select name="Locality" required class="form-control" >
                   
         <option value="">Choose Locality</option>
                  

                <?php
                $m->where("branch_id", $_SESSION['branch']);
                $WorkAssignList = $m->get("eduportal_branch_locality");

                if(count($WorkAssignList)>0){
                foreach($WorkAssignList as $WorkAssignListVal)
                { ?>

                   <option <?php if($InquriyForm[0]['Locality']==$WorkAssignListVal['locality_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['locality_id']; ?>"><?php echo $WorkAssignListVal['locality_name']; ?></option>
            <?php }  } else { ?>

                    <option>No Locality</option>
            <?php    } ?>

    </select>
           
    </div>
</div>

<div class="col-md-4 col-xs-12" style="padding: 8px;">
  <div class="form-group ">
    <label class="required">Welcome 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-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">

                    <label class="required"> Admission fee</label>
                    <input name="admission_fee" value="<?php echo $InquriyForm[0]['admission_fee'];?>" type="Text" class="form-control"  >
                       
                </div>
  </div>

  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">

                    <label class="required"> Annual Fund (Exam Charges)</label>
                    <input name="annual_fund"  value="<?php echo $InquriyForm[0]['annual_fund'];?>" type="Text" class="form-control"  >
                       
                </div>
  </div>

  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">

                    <label class="required"> Registration Fee</label>
                    <input name="registration_fee" value="<?php echo $InquriyForm[0]['registration_fee'];?>" type="Text" class="form-control"  >
                       
                </div>
  </div>


  <div class="col-md-4 col-xs-12" style="padding: 8px;">
                <div class="form-group ">

                    <label class="required"> Date Of Birth</label>
                    <input name="date_of_birth" value="<?php echo $InquriyForm[0]['date_of_birth'];?>" type="date" class="form-control"  >
                       
                </div>
  </div>


  <div class="col-md-4 col-xs-12" style="padding: 8px;">
   <div class="form-group ">

      <label class="required"> Refered By</label>
      <select name="refrence" class="form-control" onChange="HideDate(this.value);" >
                 
        <?php                   
        $WorkAssignList = $m->get("eduportal_student_referBy_admission");
        foreach($WorkAssignList as $WorkAssignListVal)
        { ?>

           <option <?php if($InquriyForm[0]['Refer_id']==$WorkAssignListVal['Refer_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['Refer_id']; ?>"><?php echo $WorkAssignListVal['Refer_By']; ?></option>


                <?php
        } ?>

        </select>
         
    </div>
</div>


<div class="col-md-8 col-xs-12" style="padding: 8px;display: none;" id="otherRemarks">
<div class="form-group ">

<label class="required"> Other Remarks</label>
<input name="other_remarks" value="<?php echo $InquriyForm[0]['other_remarks'];?>" type="Text" class="form-control"  >

</div>
</div>

<h3 class="col-md-12">Academic Record / Address</h3>


<div class="col-md-3 col-xs-12" style="padding: 8px;">
    <div class="form-group ">

    <label class="required">Test Date / Time</label>
    <input name="test_date"   value="" type="text" class="form-control"  >
       
</div>
</div>


<div class="col-md-3 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Previous Class</label>

            
                    <select name="previous_class" class="form-control">
                     <option value="All">All</option> 
                    <?php
                    $m->where("branch_id", $_SESSION['branch']);
                    $WorkAssignList = $m->get("edu_class_config");
                    foreach($WorkAssignList as $WorkAssignListVal)
                    { ?>

                       <option <?php if($InquriyForm[0]['class_id']==$WorkAssignListVal['class_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['class_id']; ?>"><?php echo $WorkAssignListVal['Class_Name']; ?></option>


                            <?php
                    } ?>

                    </select>

                  
  </div>
</div>

<div class="col-md-3 col-xs-12" style="padding: 8px;">
    <div class="form-group ">

        <label class="required"> Total Marks (Previous Class)</label>
        <input name="previous_Tmarks"   value="<?php echo $InquriyForm[0]['previous_Tmarks'];?>" type="number" class="form-control"  >
           
    </div>
  </div>

  <div class="col-md-3 col-xs-12" style="padding: 8px;">
    <div class="form-group ">

        <label class="required"> Total Obtain (Previous Class)</label>
        <input name="previous_Omarks"   value="<?php echo $InquriyForm[0]['previous_Omarks'];?>" type="number" class="form-control"  >
           
    </div>
  </div>



<div class="col-md-6 col-xs-12" style="padding: 8px;float: left;">
      <div class="form-group ">

        <label class="required"> Address</label>
        <input name="address"   value="<?php echo $InquriyForm[0]['address'];?>" type="text" class="form-control"  >
           
    </div>
</div>


<div class="col-md-6 col-xs-6" style="padding: 8px;float: left;">
      <div class="form-group ">

        <label class="required"> Remarks</label>
        <input name="remarks"   value="<?php echo $InquriyForm[0]['remarks'];?>" type="text" class="form-control"  >
           
    </div>
</div>


      
</div>
 
<div class="col-md-12" style="margin-left:10px;">

<?php 


$m->where("branch_id", $_SESSION['branch']);
$m->orderBy("id","asc");
$WorkAssignList = $m->get("eduportal_attach_documents");

foreach($WorkAssignList as $WorkAssignListVal) { ?>

<label class="container1">
<input type="checkbox" name="document_attach[]" value="<?php echo $WorkAssignListVal['id'];?>" />
<span style="font-size:12px;"><?php echo " ".$WorkAssignListVal['document_type'];?></span> <span class="checkmark"></span>
</label>
<?php } ?>

</div>
<div>

  <button id="send" type="submit" style="margin-top:30px;margin-left: 20px;" class="btn btn-primary"  >Submit</button>
  
</div>

</form>

    <br><br>


  </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>
