 <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"><?php echo $title ?></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="#"><?php echo ucwords(str_replace("_", " ", $this->uri->segment(2))); ?></a></li>
              <li class="breadcrumb-item active"><?php echo ucwords(str_replace("_", " ", $title)); ?></li>

            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
  <?php
    $errors = $this->session->userdata('errors');
    if (isset($errors)) {
        ?>
        <script>
            swal ( "Oops" ,  "<?php echo $errors ?>" ,  "error" )
        </script>
        <?php echo $errors ?>
        <?php
        $this->session->unset_userdata('errors');
    }
    $error = $this->session->userdata('error');
    if (isset($error)) {
        ?>
         <script>
            swal ( "Oops" ,  "<?php echo $error ?>" ,  "error" )
        </script>
        <?php
        $this->session->unset_userdata('error');
    }
    $success = $this->session->userdata('success');
    if (isset($success)) {
        ?>
         <script>
            swal({
          title: "Done!",
          text: "<?php echo $success ?>",
          icon: "success",
        });
        </script>
        <?php
        $this->session->unset_userdata('success');
    }
    ?>
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">

        <!-- Info boxes -->
        <div class="row">
          <div class="col-sm-12">
            <div class="card card-default">
              <div class="card-header">
                <h3 class="card-title"><?php echo $title ?></h3>

                <div class="card-tools">
                  <a href="view_all_student" class="btn btn-primary"><i class="fa fa-eye" aria-hidden="true"></i> View Student</a>
                </div>
              </div>
              <!-- /.card-header -->
              <?php echo form_open('admin/student_management/new_student_add'); ?>
              <div class="card-body">
                <div class="row">

                <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label">Student Name <span class="required">*</span></label>
                     <div class="col-sm-12">
                        <input class="form-control"  name="name" placeholder="Enter Student Name" required="required">
                     </div>
                  </div>
                </div>

                <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label">Student Mobile No. (This is Login ID) <span class="required">*</span></label>
                     <div class="col-sm-12">
                        <input class="form-control" name="mobile" placeholder="Enter Student Mobile No" required="required" type="number">
                     </div>
                  </div>
                </div>

                <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label">Student Email ID (This is Login ID) <span class="required">*</span></label>
                     <div class="col-sm-12">
                        <input class="form-control" name="email" placeholder="Enter Student Email ID" required="required" type="email">
                     </div>
                  </div>
                </div>
              
                  <div class="col-md-12">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Select Student Course</label>
                       <div class="col-sm-12">
                          <select class="form-control"  name="course" required="">
                            <option value="">Select Course</option>
                              <?php foreach ($get_all_course as $key => $course):?>
                                <option value="<?php echo $course->id ?>"><?php echo $course->title ?></option>
                              <?php endforeach; ?>
                          </select>
                       </div>
                    </div>
                  </div>
                  <?php if(user()->role != 'Branch'): ?>
                    <div class="col-md-12">
                      <div class="form-group">
                         <label for="inputEmail" class="col-sm-12 col-form-label">Select Branch</label>
                         <div class="col-sm-12">
                            <select class="form-control"  name="branch_id" required="">
                              <option value="">Select Branch</option>
                                <?php foreach ($get_all_branch as $key => $branch):?>
                                  <option value="<?php echo $branch->id ?>"><?php echo $branch->name ?></option>
                                <?php endforeach; ?>
                            </select>
                         </div>
                      </div>
                    </div>
                  <?php else: ?>
                    <input type="hidden" name="branch_id" value="<?php echo user()->id?>">
                  <?php endif;?>

                  <div class="col-md-12">
                    <div class="form-group">
                       <button name="submit" style="float: right" type="submit" class="btn btn-success">Add</button>
                    </div>
                  </div>

                   <?php echo form_close() ?>
                   

                  <!-- /.col -->
                </div>
                <!-- /.row -->
              </div>
              <!-- /.card-body -->
            </div>
          </div>
        </div>
            <!-- /.row -->
      </div><!--/. container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <script type="text/javascript">
    $(document).ready(function(){
    $('#showing').on('change', function() {
      if ( this.value > 0)
      //.....................^.......
      {
        $(".showing").hide();
        document.getElementById("mobile_image").required = false;
        document.getElementById("comission").required = false;
        document.getElementById("image").required = false;
      }
      else
      {
        $(".showing").show();
        document.getElementById("mobile_image").required = true;
        document.getElementById("comission").required = true;
        document.getElementById("image").required = true;
      }
    });
});


  </script>