 <?php 
if(!$all_instractor)
{
?>
<script type="text/javascript">
$( document ).ready(function() {
    $('#subscribeModal').modal({backdrop: 'static', keyboard: false}, 'show');
});
</script>
<div class="modal fade text-center py-5"  id="subscribeModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-md" role="document">
        <div class="modal-content">
            <div class="modal-body">
                <a class="h2 text-danger" ><b>Oops! 😟</b></a>
                <h3 class="pt-2 pb-2 mb-0 text-secondary">Instractor Not Found</h3>
                <h5><a href="<?php echo base_url(); ?>admin/employee/add_new_employee">Click Here To Add</a></h5>
            </div>
        </div>
    </div>
</div>
<?php }?>
<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 Batch</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="#">Master</a></li>
              <li class="breadcrumb-item active">Add Batch</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 Batch</h3>
                <div class="card-tools">
                  <a href="<?php echo base_url()?>admin/master/all_batch" class="btn btn-primary btn-sm"><i class="fa fa-eye" aria-hidden="true"></i> View Batch</a>
                </div>
              </div>
              <!-- /.card-header -->
              <?php echo form_open('admin/master/add_new_batch'); ?>
              <div class="card-body">
                <div class="row">

                  <div class="col-md-8">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Batch Name <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control"  name="batch_name" placeholder="Enter Batch Name" required="required" >
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Batch Size <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control"  name="batch_size" placeholder="Enter Batch Size" required="required" >
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4 d-none">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Attach Course</label>
                       <div class="col-sm-12">
                           <select class="form-control" onchange="select_batch(this.value)"  name="batch_attach_course" placeholder="Enter Batch Size" >
                              <option value="">Select</option>
                              <option selected value="1">Yes</option>
                              <option value="0">No</option>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Course List <span class="required">*</span></label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="batch_course" id="batch_course" placeholder="Enter Batch Size" required>
                              <option value="">Select</option>
                              <?php foreach ($all_course as $course): ?>
                                 <option value="<?php echo $course->id ?>"><?php echo $course->title ?></option>
                              <?php endforeach ?>?>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Batch Start Date</label>
                       <div class="col-sm-12">
                          <input class="form-control" type="date" name="batch_start_date" placeholder="Enter Batch Size">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Batch End Date</label>
                       <div class="col-sm-12">
                          <input class="form-control" type="date" name="batch_end_date" placeholder="Enter Batch Size">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Batch Start Time</label>
                       <div class="col-sm-12">
                          <input class="form-control" type="time" name="batch_start_time" placeholder="Enter Batch Size">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Batch End Time</label>
                       <div class="col-sm-12">
                          <input class="form-control" type="time" name="batch_end_time" placeholder="Enter Batch Size">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Sunday</label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="batch_sunday" placeholder="Enter Batch Size" >
                              <option value="0">No</option>
                              <option value="1">Yes</option>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Monday</label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="batch_monday" placeholder="Enter Batch Size" >
                              <option value="0">No</option>
                              <option value="1">Yes</option>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Tuesday</label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="batch_tuesday" placeholder="Enter Batch Size" >
                              <option value="0">No</option>
                              <option value="1">Yes</option>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Wednesday</label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="batch_wednesday" placeholder="Enter Batch Size" >
                              <option value="0">No</option>
                              <option value="1">Yes</option>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Thursday</label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="batch_thursday" placeholder="Enter Batch Size" >
                              <option value="0">No</option>
                              <option value="1">Yes</option>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Friday</label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="batch_friday" placeholder="Enter Batch Size" >
                              <option value="0">No</option>
                              <option value="1">Yes</option>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Saturday</label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="batch_saturday" placeholder="Enter Batch Size" >
                              <option value="0">No</option>
                              <option value="1">Yes</option>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Select A Instructor <span>*</span></label>
                       <div class="col-sm-12">
                           <select class="form-control"  name="instructor_id" placeholder="Enter Batch Size" >
                              <option value="">Select</option>
                              <?php foreach ($all_instractor as $key => $instractor): ?>
                                <option value="<?php echo $instractor->user_id; ?>"><?php echo $instractor->user_name; ?></option>
                              <?php endforeach ?>
                           </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                       <button name="form1" style="float: right" type="submit" class="btn btn-success">Add</button>
                    </div>
                  </div>
                  <?php echo form_close() ?>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
<script type="text/javascript">
function select_batch(e) {
   if(e == 1)
   {
      $('#batch_course').show();
      $('#b_course').show();
      $("#batch_course").prop('required',true);
   }
   else
   {
      $('#batch_course').hide();
      $('#b_course').hide();
      $("#batch_course").prop('required',false);
   }
}
</script>
<style type="text/css">
#b_course
{
   display:none;
}
</style>