 <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 Package</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="#">Royalty Manager</a></li>
              <li class="breadcrumb-item active">Edit Package</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 Package Details</h3>
                <div class="card-tools">
                  <a href="<?php echo base_url()?>admin/royalty/all_package" class="btn btn-primary btn-sm"><i class="fa fa-eye" aria-hidden="true"></i> View All Package</a>
                </div>
              </div>
              <!-- /.card-header -->
              <?php echo form_open_multipart('admin/royalty/update_package/'.$package->package_id); ?>
              <div class="card-body">
                <div class="row">
                  <div class="col-md-4 d-none">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Program <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <select id="mySelect" onchange="getValue()" class="form-control" type="text"  name="package_programm" placeholder="Enter Package Name" >
                           <option value="">Select A Program</option>
                          </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-5">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Name <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="text"  name="package_name" placeholder="Enter Package Name" required="required" value="<?php echo $package->package_name; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Price <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="number"  name="package_price" placeholder="Enter Package Price" required="required" value="<?php echo $package->package_price; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4 gp">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Student Reg. Fee <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input id="reg_amt" class="form-control" type="number"  name="student_reg_amt" placeholder="Enter Package Student Reg. Fee" value="<?php echo $package->package_student_reg_fee; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4 pp">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Student Adm. Royalty Percantage <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input id="reg_per" class="form-control" type="number"  name="student_reg_percantage" placeholder="Student Admission Royalty Percantage" value="<?php echo $package->package_student_reg_fee; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4 d-none">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Lead Price <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="number"  name="package_lead_price" placeholder="Enter Package Lead Price" value="<?php echo $package->package_lead_price; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4 d-none">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Digital Certificate Price <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="number"  name="package_digital_certificate_price" placeholder="Enter Package Digital Certificate Price" value="<?php echo $package->package_digital_certificate_price; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3 d-none">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Live Class Price <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="number"  name="package_live_class_price" placeholder="Enter Package Live Class Price" value="<?php echo $package->package_live_class_price; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3 d-none">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Video Course Price (%) <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="number"  name="package_video_course_percantage" placeholder="Enter Package Video Course Price" value="<?php echo $package->package_video_course_percantage; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Balance Amount <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="number"  name="package_balance_amount" placeholder="Enter Package Balance Amount" required="required" value="<?php echo $package->package_balance_amount; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-3 d-none">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Aff. Commission (%) <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="number"  name="package_aff_percantage" placeholder="Enter Package Aff. Commission" value="<?php echo $package->package_aff_percantage; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Image</label>
                       <div class="col-sm-12">
                          <input class="form-control" type="file"  name="package_image" placeholder="Enter Package Balance Amount" >
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Color<span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="color"  name="package_color" placeholder="Enter Package Balance Amount" required="required" value="<?php echo $package->package_color; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-2">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Package Order<span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control" type="number"  name="package_order" placeholder="Enter Package Order" required="required" value="<?php echo $package->package_order; ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-2">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Is Demo Package<span class="required">*</span></label>
                       <div class="col-sm-12">
                          <select class="form-control" name="is_demo_package" placeholder="Enter Package Order" required="required" >
                           <option <?php if($package->is_demo_package == 0){echo 'selected'; }?> value="0">No</option>
                           <option <?php if($package->is_demo_package == 1){echo 'selected'; }?> value="1">yes</option>
                          </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Preview Package Image</label>
                       <div class="col-sm-12">
                          <img src="<?php echo base_url(); ?><?php echo $package->package_image; ?>" width="70px">
                       </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>
  function getValue() {
    var selectElement = document.getElementById("mySelect");
    var selectedOption = selectElement.options[selectElement.selectedIndex];
    var dataValue = selectedOption.getAttribute("data-info");
    if(dataValue == 1)
    {
      $('.gp').show()
      $('.pp').hide();
      $("#reg_amt").prop('required',true);
      $("#reg_per").prop('required',false);

    }
    else
    {
      $('.gp').hide()
      $('.pp').show();
      $("#reg_per").prop('required',true);
      $("#reg_amt").prop('required',false);
    }
  }

  $( document ).ready(function() {
       function_name(<?php echo $package->package_program_type; ?>)
   });
  function function_name(e) 
  {
      if(e == 1)
      {
         $('.gp').show()
         $('.pp').hide();
      }
      else
      {
         $('.gp').hide()
         $('.pp').show();
      }
  }
</script>
<style type="text/css">
.pp, .gp{
   display: none;
}
</style>