 <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">Edit 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">Edit 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">Edit 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/update_batch/'.$batch->batch_id); ?>
              <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" value="<?php echo $batch->batch_name ?>">
                       </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" value="<?php echo $batch->batch_size ?>">
                       </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 <?php if($batch->batch_attach_course == 1){echo 'selected';} ?> value="1">Yes</option>
                              <option <?php if($batch->batch_attach_course == 0){echo 'selected';} ?> 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 <?php if($batch->batch_course == $course->id){echo 'selected';}?> 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" value="<?php echo $batch->batch_start_date ?>">
                       </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" value="<?php echo $batch->batch_end_date ?>">
                       </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" value="<?php echo $batch->batch_start_time ?>">
                       </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" value="<?php echo $batch->batch_end_time ?>">
                       </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 <?php if($batch->batch_sunday == 0){echo 'selected';} ?> value="0">No</option>
                              <option <?php if($batch->batch_sunday == 1){echo 'selected';} ?> 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 <?php if($batch->batch_monday == 0){echo 'selected';} ?> value="0">No</option>
                              <option <?php if($batch->batch_monday == 1){echo 'selected';} ?> 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 <?php if($batch->batch_tuesday == 0){echo 'selected';} ?> value="0">No</option>
                              <option <?php if($batch->batch_tuesday == 1){echo 'selected';} ?> 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 <?php if($batch->batch_wednesday == 0){echo 'selected';} ?> value="0">No</option>
                              <option <?php if($batch->batch_wednesday == 1){echo 'selected';} ?> 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 <?php if($batch->batch_thursday == 0){echo 'selected';} ?> value="0">No</option>
                              <option <?php if($batch->batch_thursday == 1){echo 'selected';} ?> 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 <?php if($batch->batch_friday == 0){echo 'selected';} ?> value="0">No</option>
                              <option <?php if($batch->batch_friday == 1){echo 'selected';} ?> 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 <?php if($batch->batch_saturday == 0){echo 'selected';} ?> value="0">No</option>
                              <option <?php if($batch->batch_saturday == 1){echo 'selected';} ?> 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 <?php if($instractor->user_id == $batch->instructor_id){echo 'selected'; }?> 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">Update</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>