<?php 
use App\Models\AdmissionModel;
$admission = new AdmissionModel();
?>

<link rel="stylesheet" href="<?php echo admin_css(); ?>plugins/bs-stepper/css/bs-stepper.min.css">
<link rel="stylesheet" href="<?php echo admin_css(); ?>plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">

 <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark">Add Admission</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/admin/dashboard">Dashboard</a></li>
              <li class="breadcrumb-item"><a href="#">Admission</a></li>
              <li class="breadcrumb-item active">Add Admission</li>

            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">

        <div class="row">
          <div class="col-sm-12">
            <div class="card card-default">
              <div class="card-header">
                <h3 class="card-title">Add New Admission</h3>
                <div class="card-tools">
                  <a href="<?php echo base_url()?>/admin/admission/view_all_admission" class="btn btn-primary btn-sm"><i class="fa fa-eye" aria-hidden="true"></i> View All Admission</a>
                </div>
              </div>
              <!-- /.card-header -->
              <?php echo form_open_multipart('admin/admission/add_admission', ['id' => 'inq_form']); ?>
              <div class="card-body p-0">
                 <div class="bs-stepper">
                    <div class="bs-stepper-header" role="tablist">
                       <div class="step active" data-target="#personal-information">
                          <button type="button" class="step-trigger" role="tab" aria-controls="logins-part" id="logins-part-trigger">
                          <span class="bs-stepper-circle">1</span>
                          <span class="bs-stepper-label">Personal Information</span>
                          </button>
                       </div>
                       <div class="line"></div>
                       <div class="step" data-target="#communication-details">
                          <button type="button" class="step-trigger" role="tab" aria-controls="information-part" id="information-part-trigger">
                          <span class="bs-stepper-circle">2</span>
                          <span class="bs-stepper-label">Address Details</span>
                          </button>
                       </div>
                       <div class="line"></div>
                       <div class="step" data-target="#know-us">
                          <button type="button" class="step-trigger" role="tab" aria-controls="information-part" id="information-part-trigger">
                          <span class="bs-stepper-circle">3</span>
                          <span class="bs-stepper-label">Image Upload</span>
                          </button>
                       </div>
                       <div class="line"></div>
                       <div class="step" data-target="#course-details">
                          <button type="button" class="step-trigger" role="tab" aria-controls="information-part" id="information-part-trigger">
                          <span class="bs-stepper-circle">4</span>
                          <span class="bs-stepper-label">Student Onboard</span>
                          </button>
                       </div>
                       

                    </div>
                    <div class="bs-stepper-content">
                      
                       <div id="personal-information" class="content active" role="tabpanel" aria-labelledby="logins-part-trigger">
                        <div class="row">
                          <div class="col-sm-6">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Mobile No विद्यार्थी का मोबाइल नं <span style="color:red">*</span></label>
                               <input type="text" onchange="check_mobile(this.value)" class="form-control" placeholder="Enter Student Mobile No" required id="student_mobile" name="user_mobile" pattern="[1-9]{1}[0-9]{9}">
                               <span id="mobile_msg"></span>
                            </div>
                          </div>
                          <div class="col-sm-6">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Email ID विद्यार्थी ईमेल आईडी </label>
                               <input type="email" onchange="check_email(this.value)" class="form-control" placeholder="Enter Student Email ID" name="user_email" id="user_email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$">
                               <span id="email_msg"></span>
                            </div>
                          </div>
                          <div class="col-sm-8">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Name विद्यार्थी का नाम<span style="color:red">*</span></label>
                               <input type="text" class="form-control" placeholder="Enter Student Name" required id="student_name_f" name="user_name" >
                            </div>
                          </div>
                          <div class="col-sm-4">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Qualification विद्यार्थी का योग्यता<span style="color:red">*</span></label>
                               <input type="text" class="form-control" placeholder="Enter Student Qualification" name="user_qualification" id="user_qualification" >
                            </div>
                          </div>
                          <div class="col-sm-4">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Birth date विद्यार्थी की जन्म तिथि<span style="color:red">*</span></label>
                               <input required type="date" class="form-control" placeholder="Enter Aadhar No." name="user_dob" id='user_dob'  max="<?php echo date('Y-m-d')?>">
                            </div>
                          </div>
                          <div class="col-sm-4">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Gender विद्यार्थी की लिंग<span style="color:red">*</span></label>
                               <select required id="user_gender" class="form-control" placeholder="Enter Aadhar No." name="user_gender">
                                <option value="">Select</option>
                                <option value="Male">Male</option>
                                <option value="Female">Female</option>
                                <option value="Other">Other</option>
                               </select>
                            </div>
                          </div>
                          <div class="col-sm-4">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Aadhar No छात्र का आधार नंबर</label>
                               <input type="text" class="form-control" placeholder="Enter Aadhar No." name="user_aadhar_no" id="user_aadhar_no" >
                            </div>
                          </div>
                          <div class="col-sm-6">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student College/School विद्यार्थी कॉलेज/स्कूल<span style="color:red">*</span></label>
                               <input type="text" class="form-control" placeholder="Enter College/School Name" name="user_school_college_name" id="user_school_college_name" >
                            </div>
                          </div>
                          <div class="col-sm-3">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Year of Highest Education सर्वोच्च शिक्षा का वर्ष<span style="color:red">*</span></label>
                               <?php
                                $currentYear = date('Y');
                                $startYear = 1980;

                                echo '<select name="user_year_of_highest_education" class="form-control" required id="year_of_highest_education">
                                <option value="">Select</option>';
                                for ($year = $currentYear; $year >= $startYear; $year--) {
                                    echo '<option value="' . $year . '">' . $year . '</option>';
                                }
                                echo '</select>';
                              ?>
                            </div>
                          </div>
                          <div class="col-sm-3">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Still Studying ? अब भी अध्ययन जारी है?<span style="color:red">*</span></label>
                               <select type="text" class="form-control" name="user_still_studying" id="still_studying" >
                                <option value="">Select</option>
                                <option value="Yes">Yes</option>
                                <option value="No">No</option>
                               </select>
                               
                            </div>
                          </div>

                          <div class="col-sm-6">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Guardian Name विद्यार्थी अभिभावक का नाम<span style="color:red">*</span></label>
                               <input type="text" class="form-control" placeholder="Enter Student Guardian Name" required id="guardian_name_l" name="guardian_name" >
                            </div>
                          </div>
                          <div class="col-sm-6">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Guardian Contact No. अभिभावक संपर्क नंबर<span style="color:red">*</span></label>
                               <input type="text" class="form-control" placeholder="Enter Guardian Contact No" required id="guardian_contact_no" name="user_guardian_contact_no" >
                            </div>
                          </div>
                          <div class="col-sm-12">
                            <button id="next-btn" type="button" onclick="check_stp_1()" class="btn btn-primary">Next</button>
                          </div>
                        </div>
                       </div>

                       <div id="communication-details" class="content" role="tabpanel" aria-labelledby="information-part-trigger">
                          <div class="row">
                          
                          <div class="col-sm-5">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Pin Code विद्यार्थी का पिन कोड<span style="color:red">*</span></label>
                               <input required type="number" class="form-control" placeholder="Enter Student Address Pin Code" name="user_pin_code" id="pin_code" >
                            </div>
                          </div>
                          <div class="col-sm-7">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Village Name विद्यार्थी का ग्राम का नाम<span style="color:red">*</span></label>
                               <input required type="text" class="form-control" placeholder="Enter Student Village" name="user_address" id="user_village" >
                            </div>
                          </div>
                          <div class="col-sm-4">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Post Office विद्यार्थी का डाकघर<span style="color:red">*</span></label>
                               <select required type="text" class="form-control" name="user_post" id="area">
                                  <option>Select Post Office</option>
                               </select>
                            </div>
                          </div>
                          <div class="col-sm-4">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student Dist विद्यार्थी का जिला<span style="color:red">*</span></label>
                               <input type="text" class="form-control" placeholder="Enter Student Dist" name="user_dist" id="city" readonly required>
                            </div>
                          </div>
                          <div class="col-sm-4">
                            <div class="form-group">
                               <label for="exampleInputEmail1">Student State विद्यार्थी का राज्य<span style="color:red">*</span></label>
                               <input type="text" class="form-control" placeholder="Enter Student Dist" name="user_state" id="state" readonly required>
                            </div>
                          </div>
                          <div class="col-sm-12">
                            <button type="button"  class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                            <button  type="button" style="float:right" class="btn btn-primary" onclick="check_stp_2()">Next</button>
                          </div>
                        </div>
                       </div>

                       <div id="know-us" class="content" role="tabpanel" aria-labelledby="information-part-trigger">
                          <div class="row">
                            <div class="col-sm-12">

                              <div class="row image-wrapper">
                                
                                <div class="col-md-6 col-6">
                                  
                                    <input type="file" name="user_image" class="form-control mt-5" accept="image/*" id="imgInp">
                                </div>
                              </div>
                            </div>

                            <div class="col-sm-12 mt-5">
                              <button type="button"  class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                              <button type="button" style="float:right" class="btn btn-primary" onclick="stepper.next()">Next</button>
                              
                            </div>
                          </div>
                        </div>
                      

                       <div id="course-details" class="content " role="tabpanel" aria-labelledby="information-part-trigger">
                          <div class="row">
                            <div class="col-sm-8">
                              <div class="form-group">
                                <label for="exampleInputEmail1">Join New Course प्रवेश के लिए एक कोर्स का चयन करें</label>
                                <select type="text" class="form-control" placeholder="Enter Student Dist" id="course_list">
                                  <option value="">Select</option>
                                  <?php foreach ($all_course as $key => $course_d):?>
                                    <option value="<?php echo $course_d->course_id; ?>"><?php echo $course_d->course_name; ?></option>
                                  <?php endforeach; ?>
                                </select>
                              </div>
                            </div>
                            <div class="col-sm-4">
                              <button type="button" onclick="add_new_course()" style="position:absolute;bottom:20px" class="btn btn-success align-self-end mt-auto btn-add">Add Course</button>
                            </div>
                            <div class="col-sm-12">
                              <div style="overflow-x:auto;">
                              <table id="example10" class="table table-bordered table-striped">
                                <thead>
                                <tr>
                                  <th>No</th>
                                  <th>Course Name</th>
                                  <th>Batch</th>
                                  <th>Admission Date</th>
                                </tr>
                                </thead>
                                <tbody>
                                    <?php 
                                    if(session()->get('course_d')):
                                       $i=1; 
                                    foreach (session()->get('course_d') as $key => $c_id):
                                       $course_details = $admission->get_course_by_id($c_id);
                                       $batch_details = $admission->get_batch_by_course_id($c_id);
                                    ?>
                                       <tr>
                                          <td><?php echo $i; ?></td>
                                          <td>
                                             <?php echo $course_details->course_name; ?>
                                             <input type="hidden" name="adm_course_id[]" value="<?php echo $c_id; ?>">
                                          </td>
                                          <td>
                                             <select class="form-control" required name="adm_batch_id[]">
                                                <option value="">Select A Batch *</option>
                                                <?php foreach ($batch_details as $key => $batch):?>
                                                   <option value="<?php echo $batch->batch_id; ?>"><?php echo $batch->batch_name; ?></option>
                                                <?php endforeach; ?>
                                             </select>
                                          </td>
                                          <td><input class="form-control" type="date" name="adm_batch_date[]" required></td>
                                       </tr>
                                       <?php $i++; 
                                       endforeach; ?>
                                       <input type="hidden" value="1" id="cou_id">
                                    <?php else: ?>
                                       <input type="hidden" value="0" id="cou_id">
                                    <?php endif;?>
                                </tbody>
                              </table>
                            </div>
                         </div>
                            <div class="col-sm-12">
                              <button type="button"  class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                              <button type="button" onclick="form_submit()" style="float:right" class="btn btn-success">Submit</button>
                            </div>
                          </div>
                       </div>


                        <?php echo form_close();?>
                       </div>
                    </div>
                 </div>
              </div>
            </div>
          </div>
      </div>
    </div>
  </section>
</div>


<style type="text/css">
.table-s, .table-s td, .table-s th {
  border: 1px solid black;
  padding: 5px;
}

.table-s {
  border-collapse: collapse;
  width: 100%;
}
#my_camera
{
  border:2px dotted;
}
.bs-stepper-content
{
  padding:20px;
}
.image-wrapper {
  text-align: center;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
<script language="JavaScript">
function add_new_course() 
{
  var course_id = $('#course_list').val();
  if(confirm("Are You Sure You Want to Add This Course?"))
  {
      $.ajax({
        beforeSend: function() {
           $(".loader").show();
        },
        type: "POST",
        dataType:"JSON",
        async: true,
        data : {course_id:course_id},
        url: '<?php echo base_url(); ?>/admin/admission/add_new_course_for_student_in_session',
        success: function (data) 
        {
            if(data == 1)
            {
              swal('Done!', "Course Successfully Added", 'success');
              $("#example10").load(location.href + " #example10");
              $(".loader").hide();
            }
            else
            {
              swal('Oops!', "Course Already Added", 'error');
              $(".loader").hide();
            }
            
        },
        error: function (e) {
          swal('Oops!', "Course Already Added", 'error');
          $(".loader").hide();
          console.log(e.responseText)
        }
      });
  }
  else
  {
      return false;
  }
}
function student_course_payment(e) 
{
  if(confirm("Are you sure you want to Payment?"))
  {
    var is_digital_certificate = $('#is_digital_certificate_'+e).val();
    var amt_main = $('#amt_main_'+e).val();
    var course_id = e;
      $.ajax({
        beforeSend: function() {
          $('#payment_model'+e).modal('hide');
           $(".loader").show();
        },
        type: "POST",
        dataType:"JSON",
        async: true,
        data : {is_digital_certificate:is_digital_certificate, amt_main:amt_main, course_id:course_id},
        url: '<?php echo base_url(); ?>/admin/students/student_course_payment',
        success: function (data) 
        {
            swal('Done!', "Payment Done", 'success');
            $("#example2").load(location.href + " #example2");
            $(".loader").hide();
        },
        error: function () {
          $(".loader").hide();
        }
      });
  }
  else
  {
      return false;
  }
}

function form_submit() 
{
  var name_f = $('#student_name_f').val();
  var g_name_l = $('#guardian_name_l').val();
  var user_qualification = $('#user_qualification').val();
  var user_school_college_name = $('#user_school_college_name').val();
  var user_aadhar_no = $('#user_aadhar_no').val();
  var user_dob = $('#user_dob').val();
  var user_gender = $('#user_gender').val();
  var guardian_contact_no = $('#guardian_contact_no').val();
  var still_studying = $('#still_studying').val();
  var year_of_highest_education = $('#year_of_highest_education').val();
  var student_mobile = $('#student_mobile').val();
  var user_email = $('#user_email').val();
  var pin_code = $('#pin_code').val();
  var user_village = $('#user_village').val();
  var area = $('#area').val();
  var cou_id = $('#cou_id').val();

  if(name_f == '')
  {
    swal('Opps!', 'Please Enter Student Name', 'error');
    return false;
  }
  if(g_name_l == '')
  {
    swal('Opps!', 'Please Enter Student Guardian Name', 'error');
    return false;
  }
  if(user_qualification == '')
  {
    swal('Opps!', 'Please Enter Student Qulification.', 'error');
    return false;
  }
  if(user_school_college_name == '')
  {
    swal('Opps!', 'Please Enter Student School/College Name.', 'error');
    return false;
  }
  // if(user_aadhar_no == '')
  // {
  //   swal('Opps!', 'Please Enter Student Aadhar Card No.', 'error');
  //   return false;
  // }
  if(user_dob == '')
  {
    swal('Opps!', 'Please Enter Student date of Birth.', 'error');
    return false;
  }
  if(user_gender == '')
  {
    swal('Opps!', 'Please Select Student Gender.', 'error');
    return false;
  }
  if(student_mobile == '')
  {
    swal('Opps!', 'Please Enter Student Mobile.', 'error');
    return false;
  }
  if(year_of_highest_education == '')
  {
    swal('Opps!', 'Please Select Student Year of Highest Education Pass Year', 'error');
    return false;
  }

  if(still_studying == '')
  {
    swal('Opps!', 'Please Select Student Still Studying Or Not', 'error');
    return false;
  }

  if(guardian_contact_no == '')
  {
    swal('Opps!', 'Please Enter Guardian Contact No', 'error');
    return false;
  }
  // if(user_email == '')
  // {
  //   swal('Opps!', 'Please Enter Student Email ID.', 'error');
  //   return false;
  // }
  if(pin_code == '')
  {
    swal('Opps!', 'Please Enter Student Address Pin Code.', 'error');
    return false;
  }
  if(user_village == '')
  {
    swal('Opps!', 'Please Enter Student Village Address.', 'error');
    return false;
  }
  if(area == '')
  {
    swal('Opps!', 'Please Select Student Area.', 'error');
    return false;
  }

  if(cou_id == 0)
  {
      swal('Opps!', 'Please Select One Course.', 'error');
      return false;
  }

  $( "#inq_form" ).submit();

}

function check_stp_1()
{
  var name_f = $('#student_name_f').val();
  var g_name_l = $('#guardian_name_l').val();
  var user_qualification = $('#user_qualification').val();
  var user_school_college_name = $('#user_school_college_name').val();
  var user_aadhar_no = $('#user_aadhar_no').val();
  var user_dob = $('#user_dob').val();
  var user_gender = $('#user_gender').val();
  var guardian_contact_no = $('#guardian_contact_no').val();
  var still_studying = $('#still_studying').val();
  var year_of_highest_education = $('#year_of_highest_education').val();
  var student_mobile = $('#student_mobile').val();

  if(student_mobile == '')
  {
    swal('Opps!', 'Please Enter Student Mobile.', 'error');
    return false;
  }

  if(name_f == '')
  {
    swal('Opps!', 'Please Enter Student Name', 'error');
    return false;
  }
  if(g_name_l == '')
  {
    swal('Opps!', 'Please Enter Student Guardian Name', 'error');
    return false;
  }
  if(user_qualification == '')
  {
    swal('Opps!', 'Please Enter Student Qulification.', 'error');
    return false;
  }
  if(user_school_college_name == '')
  {
    swal('Opps!', 'Please Enter Student School/College Name.', 'error');
    return false;
  }
  // if(user_aadhar_no == '')
  // {
  //   swal('Opps!', 'Please Enter Student Aadhar Card No.', 'error');
  //   return false;
  // }
  if(user_dob == '')
  {
    swal('Opps!', 'Please Enter Student date of Birth.', 'error');
    return false;
  }
  if(user_gender == '')
  {
    swal('Opps!', 'Please Select Student Gender.', 'error');
    return false;
  }
  if(year_of_highest_education == '')
  {
    swal('Opps!', 'Please Select Student Year of Highest Education Pass Year', 'error');
    return false;
  }

  if(still_studying == '')
  {
    swal('Opps!', 'Please Select Student Still Studying Or Not', 'error');
    return false;
  }

  if(guardian_contact_no == '')
  {
    swal('Opps!', 'Please Enter Guardian Contact No', 'error');
    return false;
  }

  stepper.next();
}

function check_stp_2() {
   
  var user_email = $('#user_email').val();
  var pin_code = $('#pin_code').val();
  var user_village = $('#user_village').val();
  var area = $('#area').val();
  
  // if(user_email == '')
  // {
  //   swal('Opps!', 'Please Enter Student Email ID.', 'error');
  //   return false;
  // }
  if(pin_code == '')
  {
    swal('Opps!', 'Please Enter Student Address Pin Code.', 'error');
    return false;
  }
  if(user_village == '')
  {
    swal('Opps!', 'Please Enter Student Village Address.', 'error');
    return false;
  }
  if(area == '')
  {
    swal('Opps!', 'Please Select Student Area.', 'error');
    return false;
  }
  stepper.next();
}

document.addEventListener('DOMContentLoaded', function () {
  window.stepper = new Stepper(document.querySelector('.bs-stepper'))
});
</script>
<script src="<?php echo admin_css(); ?>plugins/bs-stepper/js/bs-stepper.min.js"></script>

<script type="text/javascript">
$('body').on('change', '#pin_code', function () {
    let pin_code = $('#pin_code').val();
    if (pin_code == 0) {
            swal ( "Oops" ,  "Please Enter Pin Code!" ,  "warning" );
        return false;
    }
    $.ajax({
      beforeSend: function() {
         $(".loader").show();
      },
      type: "GET",
      dataType:"JSON",
      async: true,
      url: '<?php echo base_url(); ?>/admin/admin/get_aadress_detaile_by_pin_code/'+pin_code,
      success: function (data) 
      {
          $('#area').html(data.area);
          $('#city').val(data.city);
          $('#state').val(data.state);
          $(".loader").hide();
      },
      error: function () {
        $(".loader").hide();
      }
    });
});
function update_admission_date(id) 
{
  var adm_date = $('#course_admission_date_'+id).val();
  $.ajax({
    beforeSend: function() {
       $(".loader").show();
    },
    type: "POST",
    dataType:"JSON",
    async: true,
    data: {adm_date:adm_date, id:id},
    url: '<?php echo base_url(); ?>/admin/students/update_admission_date',
    success: function (data) 
    {
        swal('Done!', 'Admissio Date Successfully Update', 'success');
        $(".loader").hide();
    },
    error: function () {
      $(".loader").hide();
    }
  });
}

function update_batch_data(id, status) 
{
  if(status == 0)
  {
    swal('Oops!', 'Please Pay Course Registration Fee First', 'error');
  }
  else
  {
    var batch = $('#course_admission_batch_'+id).val();
    if(!batch)
    {
      swal('Oops!', 'Please Select A Batch First', 'error');
      return false;
    }
    $.ajax({
      beforeSend: function() {
         $(".loader").show();
      },
      type: "POST",
      dataType:"JSON",
      async: true,
      data: {batch:batch, id:id},
      url: '<?php echo base_url(); ?>/admin/students/update_admission_batch',
      success: function (data) 
      {
          swal('Done!', 'Batch Successfully Update', 'success');
          $("#example2").load(location.href + " #example2");
          $(".loader").hide();
      },
      error: function () {
        $(".loader").hide();
      }
    });
  }
}
function check_mobile(e) 
{
  if(e != '')
  {
    $.ajax({
      beforeSend: function() {
         $(".loader").show();
         $('#next-btn').hide();
      },
      type: "GET",
      dataType:"JSON",
      async: true,
      url: '<?php echo base_url(); ?>/admin/admin/check_mobile_for_student_add/'+e,
      success: function (data) 
      {
          $('#mobile_msg').html(data.msg);
          if(data.status == 6)
          {
            if(data.role == 'Student')
            {
              $('#exampleModal').modal('show');
              $('#student_go').attr("href", '<?php echo base_url(); ?>/admin/admission/edit_admission/'+data.id)
            }
            $('#next-btn').hide();
          }
          else
          {
            $('#next-btn').show();
          }
          $(".loader").hide();
      },
      error: function () {
        $(".loader").hide();
      }
    });
  }
  else
  {
    $('#mobile_msg').hide();
    $('#next-btn').show();
  }
}
function check_email(email) 
{
  if(email != '')
  {
    $.ajax({
      beforeSend: function() {
         $(".loader").show();
         $('#next-btn').hide();
      },
      type: "POST",
      dataType:"JSON",
      async: true,
      data : {email:email},
      url: '<?php echo base_url(); ?>/admin/admin/check_email_id',
      success: function (data) 
      {
          $('#email_msg').html(data.msg);
          if(data.status == 6)
          {
            $('#next-btn').hide();
          }
          else
          {
            $('#next-btn').show();
          }
          $(".loader").hide();
      },
      error: function () {
        $(".loader").hide();
      }
    });
  }
  else
  {
    $('#email_msg').hide();
    $('#next-btn').show();
  }
}
</script>
<style type="text/css">
.bs-stepper-header {
  overflow-x: auto;
  white-space: nowrap;
}
@media only screen and (min-width: 600px) {
  .btn-add {
    position: absolute;
    bottom: 20px;
  }
}

</style>

<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Student Already Exits</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <div class="">
          <h6 class="text-center">Student Already Exits in this Mobile No. If you Want to Add Another Course. Please Click Below Button</h6>
        </div>
        <div class="text-center">
          <a href="#" id="student_go" class="btn btn-primary btn-xs">Go To Student Details <i class="fa fa-arrow-right" aria-hidden="true"></i> </a>
        </div>
      </div>
    </div>
  </div>
</div>